- Timestamp:
- 04/16/13 22:52:25 (10 years ago)
- Branches:
- master, qt5
- Children:
- e619be9
- Parents:
- 097e1f4
- Location:
- src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/alarm/alarm.h
r097e1f4 r3a09de6 30 30 31 31 #define APPID "confclerk-alarm" 32 const int PRE_EVENT_ALARM_SEC = -15*60; // alarm goes off 15 minutes before start of event33 32 34 33 class Alarm : public QObject -
src/app/appsettings.h
r097e1f4 r3a09de6 41 41 static void setProxyPort(const quint16 aPort); 42 42 static void setDirectConnection(bool aDirectConnection); 43 static int preEventAlarmSec() {return 60*15;} ///< seconds that alarm should ring before an event starts 43 44 }; 44 45 -
src/gui/eventdialog.cpp
r097e1f4 r3a09de6 113 113 // add alarm to the 'alarmd' 114 114 Alarm alarm; 115 alarm.addAlarm(event.conferenceId(), event.id(), event.title(), event.start().addSecs( PRE_EVENT_ALARM_SEC));115 alarm.addAlarm(event.conferenceId(), event.id(), event.title(), event.start().addSecs(-AppSettings::preEventAlarmSec())); 116 116 #endif /* MAEMO */ 117 117 } -
src/gui/mainwindow.cpp
r097e1f4 r3a09de6 31 31 #include "eventmodel.h" 32 32 #include "delegate.h" 33 #include "room.h" 33 34 34 35 #include "conference.h" … … 107 108 // systm tray icon 108 109 connect(systemTrayIcon, SIGNAL(messageClicked()), SLOT(onSystemTrayMessageClicked())); 110 connect(systemTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(onSystemTrayMessageClicked())); 109 111 110 112 // timer … … 218 220 219 221 void MainWindow::onSystemTrayMessageClicked() { 220 // TODO: Hide icon 221 // systemTrayIcon->hide(); 222 systemTrayIcon->hide(); 222 223 } 223 224 224 225 225 226 void MainWindow::onAlarmTimerTimeout() { 226 // TODO: Show Message if an alarm is set on an event that's starting soon and delete the corresponding alarm. 227 /* 227 // determine if an alarm is set on an event that's starting soon 228 QList<Event> events = Event::getImminentAlarmEvents(AppSettings::preEventAlarmSec(), Conference::activeConference()); 229 if (events.empty()) return; 230 231 // build a message string 232 Event event; 233 QString title; 234 QString message; 235 if (events.size() == 1) { 236 event = events.first(); 237 title = tr("Next event at %1").arg(event.start().toString()); 238 message = tr("Title: %1\nRoom: %2").arg(event.title()).arg(event.room()->name()); 239 } else { 240 title = tr("%1 upcoming events").arg(events.size()); 241 QStringList messages; 242 foreach (event, events) { 243 messages += tr("Start: %1; Title: %2; Room: %3").arg(event.start().toString()).arg(event.title()).arg(event.room()->name()); 244 } 245 message = messages.join("\n"); 246 } 247 248 // and delete the corresponding alarm 249 foreach (event, events) { 250 event.setHasAlarm(false); 251 event.update("alarm"); 252 onEventChanged(event.id(), false); 253 } 254 255 // show message 228 256 systemTrayIcon->show(); 229 qDebug() << systemTrayIcon->geometry(); // gets moved to the correct location only at second usage. at least under X11/awesome, not on Win32/XP 230 systemTrayIcon->showMessage("title", "message", QSystemTrayIcon::Information, 1000); 257 // The next two lines are to prevent a very strange position of the message box the first time at X11/aweseome (not Win32/XP) 258 systemTrayIcon->showMessage("ConfClerk", "Your upcoming events", QSystemTrayIcon::Information); 259 qApp->processEvents(); 260 systemTrayIcon->showMessage(title, message, QSystemTrayIcon::Information, 60*60*24*1000); 231 261 QApplication::alert(this); 232 262 QApplication::beep(); 233 */234 263 } 235 264 -
src/mvc/event.cpp
r097e1f4 r3a09de6 95 95 96 96 97 QList<Event> Event::getImminentAlarmEvents(int maxSecToAlarm, int conferenceId) { 98 QSqlQuery query; 99 query.prepare(selectQuery() + "WHERE xid_conference = :conf AND (start < :start AND alarm = 1) ORDER BY start, duration"); 100 query.bindValue(":conf", conferenceId); 101 query.bindValue(":start", convertToDb(QDateTime::currentDateTime().addSecs(maxSecToAlarm), QVariant::DateTime)); 102 return load(query); 103 } 104 105 97 106 QList<Event> Event::getFavByDate(const QDate& date, int conferenceId) 98 107 { -
src/mvc/event.h
r097e1f4 r3a09de6 50 50 static QList<Event> getByDateAndRoom(const QDate& date, int conferenceId); 51 51 static QList<Event> conflictEvents(int aEventId, int conferenceId); 52 static QList<Event> getImminentAlarmEvents(int maxSecToAlarm, int conferenceId); 52 53 public: 53 54 int id() const { return value("id").toInt(); } -
src/mvc/treeview.cpp
r097e1f4 r3a09de6 111 111 // add alarm to the 'alarmd' 112 112 Alarm alarm; 113 alarm.addAlarm(event.conferenceId(), event.id(), event.title(),event.start().addSecs( PRE_EVENT_ALARM_SEC));113 alarm.addAlarm(event.conferenceId(), event.id(), event.title(),event.start().addSecs(-AppSettings::preEventAlarmSec())); 114 114 #endif /* MAEMO */ 115 115 }
Note: See TracChangeset
for help on using the changeset viewer.