]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/mvc/treeview.cpp
Add .pro.user.* to svn:ignore and remove it in the release target.
[toast/confclerk.git] / src / mvc / treeview.cpp
index 151fd8a697915c9f0775d387e5700b47e7feddad..6b427e184234527132514cb108ff436813cc26bc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010 Ixonos Plc.
- * Copyright (C) 2011 Philipp Spitzer, gregor herrmann
+ * Copyright (C) 2011-2012 Philipp Spitzer, gregor herrmann, Stefan Stahl
  *
  * This file is part of ConfClerk.
  *
@@ -26,7 +26,7 @@
 #include "eventmodel.h"
 
 #ifdef MAEMO
-#include <alarm.h>
+#include "alarm.h"
 #endif
 
 #include <QDebug>
@@ -70,10 +70,7 @@ bool TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aP
                 Event event = Event::getById(aIndex.data().toInt(),confId);
 
                 QList<Event> conflicts = Event::conflictEvents(event.id(),Conference::activeConference());
-                if(event.isFavourite())
-                    event.setFavourite(false);
-                else
-                    event.setFavourite(true);
+                event.setFavourite(!event.isFavourite());
                 event.update("favourite");
 
                 if(event.isFavourite())
@@ -82,13 +79,13 @@ bool TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aP
                     conflicts = Event::conflictEvents(event.id(),Conference::activeConference());
                 }
 
-                // have to emit 'eventHasChanged' signal on all events in conflict
+                // have to emit 'eventChanged' signal on all events in conflict
                 for(int i=0; i<conflicts.count(); i++)
-                    emit(eventHasChanged(conflicts[i].id()));
+                    emit eventChanged(conflicts[i].id(), false);
 
                 // since the Favourite icon has changed, update TreeViews accordingly
                 // all TreeViews have to listen on this signal
-                emit(eventHasChanged(event.id(),true));
+                emit eventChanged(event.id(), true);
 
                 handled = true;
             }
@@ -104,8 +101,7 @@ bool TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aP
 #ifdef MAEMO
                     // remove alarm from the 'alarmd' alrms list
                     Alarm alarm;
-                    alarm.deleteAlarm(event.id());
-                    // TODO: test if removing was successfull
+                    alarm.deleteAlarm(event.conferenceId(), event.id());
 #endif /* MAEMO */
                 }
                 else
@@ -114,14 +110,13 @@ bool TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aP
 #ifdef MAEMO
                     // add alarm to the 'alarmd'
                     Alarm alarm;
-                    //int cookie = alarm.addAlarm(event.id(),QDateTime::currentDateTime().addSecs(10)); // testing
-                    int cookie = alarm.addAlarm(event.id(),event.start().addSecs(-15*60)); // 15 minutes before real start
+                    alarm.addAlarm(event.conferenceId(), event.id(), event.title(),event.start().addSecs(PRE_EVENT_ALARM_SEC));
 #endif /* MAEMO */
                 }
                 event.update("alarm");
                 // since the Alarm icon has changed, update TreeView accordingly
                 // all TreeViews have to listen on this signal
-                emit(eventHasChanged(event.id()));
+                emit eventChanged(event.id(), false);
                 handled = true;
             }
             break;