#ifdef MAEMO
showFullScreen();
-#else
- alarmButton->hide();
#endif
Event event = Event::getById(mEventId, mConferenceId);
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
// 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
connect(mXmlParser, SIGNAL(parsingScheduleEnd(int)), conferenceModel, SLOT(newConferenceEnd(int)));
}
+
void MainWindow::on_aboutAction_triggered()
{
QDialog dialog(this);
}
+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
void onEventChanged(int aEventId, bool favouriteChanged);
void onSearchResultChanged();
+
// TODO: remove
void networkQueryFinished(QNetworkReply*);
void importFromNetwork(const QString&, int conferenceId);
void importFromFile(const QString&, int conferenceId);
void removeConference(int);
void changeConferenceUrl(int, const QString&);
+ void onSystemTrayMessageClicked();
+ void onAlarmTimerTimeout();
void useConference(int conferenceId);
void unsetConference();
ConferenceModel* conferenceModel;
ScheduleXmlParser *mXmlParser;
QNetworkAccessManager *mNetworkAccessManager;
+ QSystemTrayIcon* systemTrayIcon; ///< to be able to show notifications
+ QTimer* alarmTimer; ///< timer that triggers every minute to be able to show alarms
};
#endif /* MAINWINDOW_H */
mControls[FavouriteControlOn]->paint(painter, option.rect);
else
mControls[FavouriteControlOff]->paint(painter, option.rect);
-#ifdef MAEMO
+
if(event->hasAlarm())
mControls[AlarmControlOn]->paint(painter, option.rect);
else
mControls[AlarmControlOff]->paint(painter, option.rect);
-#endif
+
if(event->hasTimeConflict())
mControls[WarningControl]->paint(painter, option.rect);
else // doesn't have parent - time-groups' elements (top items)
{
int numFav = numberOfFavourities(index);
-#ifdef MAEMO
int numAlarm = numberOfAlarms(index);
-#endif
QStyleOptionButton styleOptionButton;
styleOptionButton.rect = option.rect;
painter->drawImage(drawPoint,*image);
painter->drawText(drawPoint+QPoint(image->width()+2, image->height() - 2),
QString::number(numFav));
-#ifdef MAEMO
+
drawPoint.setX(drawPoint.x() - spacer - image->width());
image = mControls[numAlarm ? AlarmControlOn : AlarmControlOff]->image();
painter->drawImage(drawPoint,*image);
painter->drawText(drawPoint+QPoint(image->width()+2, image->height() - 2),
QString::number(numAlarm));
-#endif
+
// draw texts
QString numEvents = QString::number(index.model()->rowCount(index)).append("/");
drawPoint.setX(drawPoint.x() - spacer - fmSmall.boundingRect(numEvents).width());
// off
mControls.insert(FavouriteControlOff, new Control(FavouriteControlOff, QString(":icons/favourite-off.png"), NULL));
-#ifdef MAEMO
// ALARM ICONs
// on
mControls.insert(AlarmControlOn,
// WARNING ICON
mControls.insert(WarningControl,
new Control(WarningControl, QString(":icons/dialog-warning.png"), mControls[AlarmControlOff]));
-#else
- // WARNING ICON
- mControls.insert(WarningControl,
- new Control(WarningControl, QString(":icons/dialog-warning.png"), mControls[FavouriteControlOn]));
-#endif
-
-}
+ }
bool Delegate::isPointFromRect(const QPoint &aPoint, const QRect &aRect) const
{