The favorite tab gets updated again after changing the favorite state.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Mon, 17 Oct 2011 18:15:33 +0000 (18:15 +0000)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Mon, 17 Oct 2011 18:15:33 +0000 (18:15 +0000)
src/gui/mainwindow.cpp
src/gui/mainwindow.h
src/gui/tabcontainer.cpp
src/gui/tabcontainer.h
src/mvc/treeview.cpp
src/mvc/treeview.h

index 730755d..a9748a7 100644 (file)
@@ -84,11 +84,11 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent)
     QNetworkProxy::setApplicationProxy(proxy);
 
     // event details have changed
-    connect(dayTabContainer, SIGNAL(eventChanged(int,bool)), SLOT(redisplayEvent(int,bool)));
-    connect(favsTabContainer, SIGNAL(eventChanged(int,bool)), SLOT(redisplayEvent(int,bool)));
-    connect(tracksTabContainer, SIGNAL(eventChanged(int,bool)), SLOT(redisplayEvent(int,bool)));
-    connect(roomsTabContainer, SIGNAL(eventChanged(int,bool)), SLOT(redisplayEvent(int,bool)));
-    connect(searchTabContainer, SIGNAL(eventChanged(int,bool)), SLOT(redisplayEvent(int,bool)));
+    connect(dayTabContainer, SIGNAL(eventChanged(int,bool)), SLOT(onEventChanged(int,bool)));
+    connect(favsTabContainer, SIGNAL(eventChanged(int,bool)), SLOT(onEventChanged(int,bool)));
+    connect(tracksTabContainer, SIGNAL(eventChanged(int,bool)), SLOT(onEventChanged(int,bool)));
+    connect(roomsTabContainer, SIGNAL(eventChanged(int,bool)), SLOT(onEventChanged(int,bool)));
+    connect(searchTabContainer, SIGNAL(eventChanged(int,bool)), SLOT(onEventChanged(int,bool)));
 
     // date has changed
     connect(dayNavigator, SIGNAL(dateChanged(QDate)), dayTabContainer, SLOT(redisplayDate(QDate)));
@@ -154,16 +154,16 @@ void MainWindow::on_searchAction_triggered() {
 }
 
 
-
-void MainWindow::redisplayEvent(int aEventId, bool aReloadModel)
-{
+void MainWindow::onEventChanged(int aEventId, bool favouriteChanged) {
     dayTabContainer->redisplayEvent(aEventId);
-    favsTabContainer->redisplayEvent(aEventId,aReloadModel);
+    if (favouriteChanged) favsTabContainer->redisplayDate(dayNavigator->curDate());
+    else favsTabContainer->redisplayEvent(aEventId);
     tracksTabContainer->redisplayEvent(aEventId);
     roomsTabContainer->redisplayEvent(aEventId);
     searchTabContainer->redisplayEvent(aEventId);
 }
 
+
 void MainWindow::useConference(int id)
 {
     if (id == -1)  // in case no conference is active
index 1d38333..127620d 100644 (file)
@@ -48,7 +48,7 @@ private slots:
     void on_nowAction_triggered();
     void on_searchAction_triggered();
 
-    void redisplayEvent(int aEventId, bool aReloadModel);
+    void onEventChanged(int aEventId, bool favouriteChanged);
     // TODO: remove
     void networkQueryFinished(QNetworkReply*);
     void importFromNetwork(const QString&);
index 694ce78..822a80b 100644 (file)
@@ -86,9 +86,8 @@ void TabContainer::displayConflicts(const QModelIndex &aIndex)
 }
 
 
-void TabContainer::redisplayEvent(int aEventId, bool aReloadModel) {
-    /* if (aReloadModel) updateTreeView(dayNavigator->curDate());
-    else */ static_cast<EventModel*>(treeView->model())->updateModel(aEventId);
+void TabContainer::redisplayEvent(int aEventId) {
+    static_cast<EventModel*>(treeView->model())->updateModel(aEventId);
 }
 
 
index fa85b73..437fbe4 100644 (file)
@@ -44,7 +44,7 @@ signals:
     void eventChanged(int aEventId, bool aReloadModel);
 
 public slots:
-    virtual void redisplayEvent(int aEventId, bool aReloadModel = false);
+    virtual void redisplayEvent(int aEventId);
     void redisplayDate(const QDate& curDate);
 
 protected slots:
index 6f514e9..57de752 100644 (file)
@@ -79,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;
             }
@@ -118,7 +118,7 @@ bool TreeView::testForControlClicked(const QModelIndex &aIndex, const QPoint &aP
                 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;
index 888b6f7..c47d6eb 100644 (file)
@@ -37,7 +37,7 @@ private slots:
     void handleItemClicked(const QModelIndex &index);
 signals:
     void requestForConflicts(const QModelIndex &aIndex);
-    void eventHasChanged(int aEventId, bool aReloadModel = false); // emited when user changes some event details, eg. sets it Favourite
+    void eventChanged(int aEventId, bool favouriteChanged); // emited when user changes some event details, eg. sets it Favourite
 };
 
 #endif /* TREEVIEW_H */