React on "commit data" OS request.
This commit is contained in:
parent
a8e86b0f26
commit
ab63fa59a6
2 changed files with 13 additions and 2 deletions
|
@ -47,6 +47,7 @@ Application::Application(const QString& id, int& argc, char** argv)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_feedReader(nullptr),
|
m_feedReader(nullptr),
|
||||||
|
m_quitLogicDone(false),
|
||||||
m_updateFeedsLock(new Mutex()), m_mainForm(nullptr),
|
m_updateFeedsLock(new Mutex()), m_mainForm(nullptr),
|
||||||
m_trayIcon(nullptr), m_settings(Settings::setupSettings(this)), m_webFactory(new WebFactory(this)),
|
m_trayIcon(nullptr), m_settings(Settings::setupSettings(this)), m_webFactory(new WebFactory(this)),
|
||||||
m_system(new SystemFactory(this)), m_skins(new SkinFactory(this)),
|
m_system(new SystemFactory(this)), m_skins(new SkinFactory(this)),
|
||||||
|
@ -424,6 +425,9 @@ void Application::showGuiMessage(const QString& title, const QString& message,
|
||||||
|
|
||||||
void Application::onCommitData(QSessionManager& manager) {
|
void Application::onCommitData(QSessionManager& manager) {
|
||||||
qDebug("OS asked application to commit its data.");
|
qDebug("OS asked application to commit its data.");
|
||||||
|
|
||||||
|
onAboutToQuit();
|
||||||
|
|
||||||
manager.setRestartHint(QSessionManager::RestartNever);
|
manager.setRestartHint(QSessionManager::RestartNever);
|
||||||
manager.release();
|
manager.release();
|
||||||
}
|
}
|
||||||
|
@ -435,6 +439,13 @@ void Application::onSaveState(QSessionManager& manager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::onAboutToQuit() {
|
void Application::onAboutToQuit() {
|
||||||
|
if (m_quitLogicDone) {
|
||||||
|
qWarning("On-close logic is already done.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_quitLogicDone = true;
|
||||||
|
|
||||||
eliminateFirstRun();
|
eliminateFirstRun();
|
||||||
eliminateFirstRun(APP_VERSION);
|
eliminateFirstRun(APP_VERSION);
|
||||||
|
|
||||||
|
|
|
@ -128,8 +128,6 @@ class RSSGUARD_DLLSPEC Application : public QtSingleApplication {
|
||||||
void processExecutionMessage(const QString& message);
|
void processExecutionMessage(const QString& message);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
// Last-minute reactors.
|
|
||||||
void onCommitData(QSessionManager& manager);
|
void onCommitData(QSessionManager& manager);
|
||||||
void onSaveState(QSessionManager& manager);
|
void onSaveState(QSessionManager& manager);
|
||||||
void onAboutToQuit();
|
void onAboutToQuit();
|
||||||
|
@ -152,6 +150,8 @@ class RSSGUARD_DLLSPEC Application : public QtSingleApplication {
|
||||||
|
|
||||||
FeedReader* m_feedReader;
|
FeedReader* m_feedReader;
|
||||||
|
|
||||||
|
bool m_quitLogicDone;
|
||||||
|
|
||||||
// This read-write lock is used by application on its close.
|
// This read-write lock is used by application on its close.
|
||||||
// Application locks this lock for WRITING.
|
// Application locks this lock for WRITING.
|
||||||
// This means that if application locks that lock, then
|
// This means that if application locks that lock, then
|
||||||
|
|
Loading…
Add table
Reference in a new issue