Stephan Witt wrote:
Abdelrazak Younes schrieb:
Do you need a new patch from me or will you change it yourself?
No, that's fine, I'll do it.
Thank you!
You are welcome. Please send a message to this list stating the following:
I grant permission to license any and all contributions I've made to
LyX under the Gnu GPL version 2 or later.
Could one of the usual suspects add Stephan to the Contrib list please?
Abdel.
Author: younes
Date: Mon Aug 27 08:35:24 2007
New Revision: 19824
URL: http://www.lyx.org/trac/changeset/19824
Log:
New 'Save all on shutdown or cancel' feature from Stephan Witt.
Modified:
lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp
lyx-devel/trunk/src/frontends/qt4/GuiApplication.h
Modified: lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp
URL:
http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp?rev=19824
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp (original)
+++ lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp Mon Aug 27
08:35:24 2007
@@ -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>
@@ -318,6 +320,20 @@
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
Modified: lyx-devel/trunk/src/frontends/qt4/GuiApplication.h
URL:
http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/GuiApplication.h?rev=19824
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiApplication.h (original)
+++ lyx-devel/trunk/src/frontends/qt4/GuiApplication.h Mon Aug 27
08:35:24 2007
@@ -25,6 +25,8 @@
#include <QApplication>
#include <QTranslator>
+
+class QSessionManager;
namespace lyx {
@@ -74,9 +76,10 @@
void unregisterSocketCallback(int fd);
//@}
- /// Methods inherited from \c Application class
+ /// Methods inherited from \c QApplication class
//@{
- virtual bool notify(QObject * receiver, QEvent * event);
+ bool notify(QObject * receiver, QEvent * event);
+ void commitData(QSessionManager & sm);
//@}
///