From d23aa6a68647a3c8bfb8c446498a3372437abf3b Mon Sep 17 00:00:00 2001 From: fortefr Date: Mon, 18 Jan 2010 14:56:41 +0000 Subject: [PATCH] Favourites fix --- src/gui/mainwindow.cpp | 11 +++++++++-- src/gui/mainwindow.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 5747356..0ab7bd5 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -69,7 +69,7 @@ MainWindow::MainWindow(QWidget *parent) } connect(static_cast(dayTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavView())); - connect(static_cast(favTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavView())); + connect(static_cast(favTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavViewComplete())); } MainWindow::~MainWindow() @@ -134,6 +134,13 @@ void MainWindow::updateFavView() { int confId = 1; static_cast(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId); - favTreeView->reset(); + favTreeView->reset(); //Necessary reset: + // if favourite event unselected as favourite is the only one in its time, and reset is not produced, crashed +} + +void MainWindow::updateFavViewComplete() +{ + int confId = 1; + updateFavView(); updateDayView(Conference::getById(confId).start()); } diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 670df95..bf3429d 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -20,6 +20,7 @@ private slots: void aboutApp(); void updateDayView(const QDate &aDate); void updateFavView(); + void updateFavViewComplete(); private: SqlEngine *mSqlEngine; ScheduleXmlParser *mXmlParser; -- 2.39.5