]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiApplication.cpp
Merge QController into individual dialogs. Also various cleanup
[lyx.git] / src / frontends / qt4 / GuiApplication.cpp
index aaf7add1170615015cd53c8d87056b8be272b8ec..f316019b132bcea5dfc113ae0863282beae3828f 100644 (file)
@@ -15,7 +15,7 @@
 #include "GuiApplication.h"
 
 #include "qt_helpers.h"
-#include "QLImage.h"
+#include "GuiImage.h"
 #include "socket_callback.h"
 
 #include "frontends/LyXView.h"
@@ -27,6 +27,7 @@
 #include "support/os.h"
 #include "support/Package.h"
 
+#include "BufferList.h"
 #include "BufferView.h"
 #include "Color.h"
 #include "debug.h"
@@ -43,6 +44,7 @@
 #include <QLocale>
 #include <QLibraryInfo>
 #include <QPixmapCache>
+#include <QSessionManager>
 #include <QTextCodec>
 #include <QTimer>
 #include <QTranslator>
@@ -139,8 +141,8 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
 
        using namespace lyx::graphics;
 
-       Image::newImage = boost::bind(&QLImage::newImage);
-       Image::loadableFormats = boost::bind(&QLImage::loadableFormats);
+       Image::newImage = boost::bind(&GuiImage::newImage);
+       Image::loadableFormats = boost::bind(&GuiImage::loadableFormats);
 
        // needs to be done before reading lyxrc
        lyxrc.dpi = getDPI();
@@ -318,6 +320,20 @@ void GuiApplication::unregisterSocketCallback(int fd)
        socket_callbacks_.erase(fd);
 }
 
+
+void GuiApplication::commitData(QSessionManager & sm)
+{
+       /// The implementation is required to avoid an application exit
+       /// when session state save is triggered by session manager.
+       /// The default implementation sends a close event to all
+       /// visible top level widgets when session managment allows
+       /// interaction.
+       /// We are changing that to write all unsaved buffers...
+       if (sm.allowsInteraction() && !theBufferList().quitWriteAll())
+               sm.cancel();
+}
+
+
 ////////////////////////////////////////////////////////////////////////
 // X11 specific stuff goes here...
 #ifdef Q_WS_X11