Skip to content
Snippets Groups Projects
Commit 3c04de7b authored by SeeLook's avatar SeeLook :musical_note:
Browse files

Restore displaying support page

- every seven days
parent 4b961582
Branches
Tags
No related merge requests found
Pipeline #3645 skipped
......@@ -56,7 +56,7 @@
#include <QtCore/qdebug.h>
bool TdialogLoaderObject::m_firstTime = true;
bool TdialogLoaderObject::m_firstTime = true;
TdialogLoaderObject::TdialogLoaderObject(QObject* parent) :
......@@ -319,3 +319,16 @@ bool TdialogLoaderObject::checkVersion(QObject* nootWin) {
return false;
}
bool TdialogLoaderObject::checkForSupport(QObject* nootWin) {
if (nootWin && QString(nootWin->metaObject()->className()).contains("MainWindow_QMLTYPE")) {
int supportDaysPass = GLOB->config->value("General/supportDate", QDate(2012, 12, 31)).toDate().daysTo(QDate::currentDate());
if (supportDaysPass > 7) { // display support dialog every seven days
QTimer::singleShot(1500, [=]{ QMetaObject::invokeMethod(nootWin, "askForSupport"); });
GLOB->config->setValue("General/supportDate", QDate::currentDate());
return true;
}
}
return false;
}
......@@ -81,6 +81,12 @@ public:
*/
static bool checkVersion(QObject* nootWin);
/**
* Checks days passed from last check for displaying support popup dialog.
* Returns @p TRUE when popup was displayed.
*/
static bool checkForSupport(QObject* nootWin);
signals:
void continueExam(const QString& examFile);
void openLevel(const QString& levelFile);
......
......@@ -321,9 +321,12 @@ int main(int argc, char *argv[])
if (firstLoop && !wasFirstRun && !e->rootObjects().isEmpty()) {
// show dialog with changes when version was changed
if (!TdialogLoaderObject::checkVersion(e->rootObjects().first())) {
// or check updates if no version changed
if (gl->config->value(QLatin1String("Updates/enableUpdates"), true).toBool())
TdialogLoaderObject::updateCheckInBackground();
// or check to dispay support dialog
if (!TdialogLoaderObject::checkForSupport(e->rootObjects().first())) {
// or check for updates if any of above
if (gl->config->value(QLatin1String("Updates/enableUpdates"), true).toBool())
TdialogLoaderObject::updateCheckInBackground();
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment