#include "graphics/LoaderQueue.h"
+#include "support/FileName.h"
#include "support/lstrings.h"
#include "support/os.h"
#include "support/Package.h"
#include "BufferView.h"
-#include "color.h"
+#include "Color.h"
#include "debug.h"
#include "FuncRequest.h"
#include "LyX.h"
namespace lyx {
+using support::FileName;
+
frontend::Application * createApplication(int & argc, char * argv[])
{
return new frontend::GuiApplication(argc, argv);
case QEvent::FileOpen: {
// Open a file; this happens only on Mac OS X for now
QFileOpenEvent * foe = static_cast<QFileOpenEvent *>(e);
- lyx::dispatch(FuncRequest(LFUN_FILE_OPEN,
- fromqstr(foe->file())));
+
+ if (!currentView() || !currentView()->view())
+ // The application is not properly initialized yet.
+ // So we acknowledge the event and delay the file opening
+ // until LyX is ready.
+ // FIXME UNICODE: FileName accept an utf8 encoded string.
+ LyX::ref().addFileToLoad(FileName(fromqstr(foe->file())));
+ else
+ lyx::dispatch(FuncRequest(LFUN_FILE_OPEN,
+ qstring_to_ucs4(foe->file())));
+
+ e->accept();
return true;
}
default:
}
-bool GuiApplication::getRgbColor(LColor_color col,
+bool GuiApplication::getRgbColor(Color_color col,
RGBColor & rgbcol)
{
QColor const & qcol = color_cache_.get(col);
}
-string const GuiApplication::hexName(LColor_color col)
+string const GuiApplication::hexName(Color_color col)
{
return lyx::support::ltrim(fromqstr(color_cache_.get(col).name()), "#");
}
-void GuiApplication::updateColor(LColor_color)
+void GuiApplication::updateColor(Color_color)
{
// FIXME: Bleh, can't we just clear them all at once ?
color_cache_.clear();