]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/gui/mainwindow.cpp
Prepared to show an alarm message via tray icon on non-MAEMO systems.
[toast/confclerk.git] / src / gui / mainwindow.cpp
index e055b6a573aaaa5cf4b9c4808a419b40cd09f266..ce54361390a4916ef6850ee6dafdec0a38685e47 100644 (file)
@@ -63,7 +63,11 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) {
     conferenceModel = new ConferenceModel(this);
     mXmlParser = new ScheduleXmlParser(sqlEngine, this);
     mNetworkAccessManager = new QNetworkAccessManager(this);
+    systemTrayIcon = new QSystemTrayIcon(qApp->windowIcon(), this);
+    alarmTimer = new QTimer(this);
 
+    alarmTimer->setInterval(60000);
+    alarmTimer->start();
     saved_title = windowTitle();
 
 #ifdef N810
@@ -100,6 +104,11 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) {
     // search result has changed
     connect(searchTabContainer, SIGNAL(searchResultChanged()), SLOT(onSearchResultChanged()));
 
+    // systm tray icon
+    connect(systemTrayIcon, SIGNAL(messageClicked()), SLOT(onSystemTrayMessageClicked()));
+
+    // timer
+    connect(alarmTimer, SIGNAL(timeout()), SLOT(onAlarmTimerTimeout()));
 
     useConference(Conference::activeConference());
     // optimization, see useConference() code
@@ -115,6 +124,7 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) {
     connect(mXmlParser, SIGNAL(parsingScheduleEnd(int)), conferenceModel, SLOT(newConferenceEnd(int)));
 }
 
+
 void MainWindow::on_aboutAction_triggered()
 {
     QDialog dialog(this);
@@ -206,6 +216,22 @@ void MainWindow::onSearchResultChanged() {
 }
 
 
+void MainWindow::onSystemTrayMessageClicked() {
+    // TODO: Hide icon
+}
+
+
+void MainWindow::onAlarmTimerTimeout() {
+    // TODO: Show Message if an alarm is set on an event that's starting soon and delete the corresponding alarm.
+    /* Example:
+    systemTrayIcon->show();
+    systemTrayIcon->showMessage("title", "message", QSystemTrayIcon::Information, 1000);
+    QApplication::alert(this);
+    QApplication::beep();
+    */
+}
+
+
 void MainWindow::useConference(int conferenceId)
 {
     if (conferenceId == -1)  // in case no conference is active