Mercurial > trustbridge
diff ui/mainwindow.cpp @ 19:9af6198deb8e
Add timed trigger for the message
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 20 Feb 2014 10:56:49 +0000 |
parents | c12825a651ed |
children | 62cd56cea09b |
line wrap: on
line diff
--- a/ui/mainwindow.cpp Wed Feb 19 15:41:14 2014 +0000 +++ b/ui/mainwindow.cpp Thu Feb 20 10:56:49 2014 +0000 @@ -8,6 +8,11 @@ #include <QMenu> #include <QApplication> #include <QFile> +#include <QTimer> + +// The amount of time in minutes stay silent if we have +// something to say +#define NAG_INTERVAL_MINUTES 2 #include "certificatelist.h" #include "downloader.h" @@ -18,6 +23,11 @@ connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); + + mMessageTimer = new QTimer(this); + connect(mMessageTimer, SIGNAL(timeout()), this, SLOT(showMessage())); + mMessageTimer->setInterval(NAG_INTERVAL_MINUTES * 60 * 1000); + mMessageTimer->start(); } void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason) @@ -40,6 +50,7 @@ if (!mCurMessage.isEmpty()) { mTrayIcon->showMessage(QApplication::applicationName(), mCurMessage, QSystemTrayIcon::Information, 5000); + mMessageTimer->start(); // Restart the timer so that we don't spam } }