mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
New 'Save all on shutdown or cancel' feature from Stephan Witt.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19824 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
db3439ce77
commit
9484768959
@ -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 @@ 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
|
||||
|
@ -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);
|
||||
//@}
|
||||
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user