[app] Added BooksSaveTimer::saveNow() method

This commit is contained in:
Slava Monich 2015-11-30 23:18:53 +02:00
parent a89e489f7a
commit 9f1261a822
2 changed files with 10 additions and 4 deletions

View file

@ -70,6 +70,13 @@ void BooksSaveTimer::cancelSave()
iInactivityTimer->stop();
}
void BooksSaveTimer::saveNow()
{
iMandatarySaveTimer->stop();
iInactivityTimer->stop();
Q_EMIT save();
}
bool BooksSaveTimer::saveRequested() const
{
return iMandatarySaveTimer->isActive();
@ -77,14 +84,12 @@ bool BooksSaveTimer::saveRequested() const
void BooksSaveTimer::onTimeout()
{
iMandatarySaveTimer->stop();
iInactivityTimer->stop();
Q_EMIT save();
saveNow();
}
void BooksSaveTimer::onAboutToQuit()
{
if (saveRequested()) {
onTimeout();
saveNow();
}
}

View file

@ -48,6 +48,7 @@ public:
void requestSave();
void cancelSave();
bool saveRequested() const;
void saveNow();
Q_SIGNALS:
void save();