New 'Save all on shutdown or cancel' feature from Stephan Witt (Fix bug 1656).

* GuiApplication::commitData(): implement.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@19825 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-08-27 07:13:05 +00:00
parent 9d1351d6cd
commit 8fd3e3ecbc
3 changed files with 25 additions and 2 deletions

View File

@ -27,6 +27,7 @@
#include "support/os.h"
#include "support/Package.h"
#include "BufferList.h"
#include "BufferView.h"
#include "Color.h"
#include "debug.h"
@ -42,6 +43,7 @@
#include <QFileOpenEvent>
#include <QLocale>
#include <QLibraryInfo>
#include <QSessionManager>
#include <QTextCodec>
#include <QTimer>
#include <QTranslator>
@ -313,6 +315,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

View File

@ -26,6 +26,8 @@
#include <QApplication>
#include <QTranslator>
class QSessionManager;
namespace lyx {
class BufferView;
@ -74,9 +76,10 @@ public:
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);
//@}
///

View File

@ -50,6 +50,8 @@ What's new
- Add paragraph-params LFUN, used for updating paragraph parameters
(Bug 2714).
- Add "Save all on log-out or cancel" feature (Bug 1656).
** Bug fixes:
*************
@ -94,6 +96,8 @@ What's new
- Reset current cursor font when going to a bookmark.
- Fix crash when login out from within Gnome desktop (Bug 1656).
* DOCUMENTATION