Implemented "unset dates" in the date navigator.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 21 Sep 2011 21:49:43 +0000 (21:49 +0000)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 21 Sep 2011 21:49:43 +0000 (21:49 +0000)
src/gui/daynavigatorwidget.cpp
src/gui/daynavigatorwidget.h
src/gui/mainwindow.cpp
src/gui/tabcontainer.cpp

index c6d0a40..e251f6f 100644 (file)
@@ -71,6 +71,17 @@ void DayNavigatorWidget::setCurDate(const QDate& curDate) {
 }
 
 
+void DayNavigatorWidget::unsetDates() {
+    mStartDate= QDate();
+    mEndDate = QDate();
+    mCurDate = QDate();
+
+    configureNavigation();
+    emit(dateChanged(mCurDate));
+    this->update();
+}
+
+
 void DayNavigatorWidget::configureNavigation() {
     prevDayButton->setDisabled(!mStartDate.isValid() || mCurDate == mStartDate);
     nextDayButton->setDisabled(!mEndDate.isValid() || mCurDate == mEndDate);
index de8cc22..d342e19 100644 (file)
@@ -35,6 +35,7 @@ class DayNavigatorWidget : public QWidget, private Ui::DayNavigatorWidget {
         void setDates(const QDate &aStartDate, const QDate &aEndDate);
         void setCurDate(const QDate& curDate);
         QDate curDate() const {return mCurDate;}
+        void unsetDates();
     protected:
         void paintEvent(QPaintEvent *);
         void configureNavigation();
index 91a00e2..76e69ae 100644 (file)
@@ -112,13 +112,6 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent)
         clearTabs();
     }
 
-    // TODO: open conferences at startup?
-    #if 0
-    if(!confCount)
-        tabWidget->setCurrentIndex(6); // 6 - conference tab
-    }
-    #endif
-
     // open dialog for given Event ID
     // this is used in case Alarm Dialog request application to start
     if(aEventId)
@@ -214,6 +207,7 @@ void MainWindow::initTabs()
         searchTabContainer->setDates(startDate, endDate);
         searchTabContainer->searchAgainClicked();
         nowTabContainer->updateTreeView(QDate::currentDate());
+        dayNavigator->setDates(startDate, endDate);
     }
 }
 
@@ -231,6 +225,7 @@ void MainWindow::clearTabs()
 void MainWindow::unsetConference()
 {
     clearTabs();
+    dayNavigator->unsetDates();
     setWindowTitle(saved_title);
 }
 
index 48f9120..da29115 100644 (file)
@@ -44,7 +44,7 @@ TabContainer::TabContainer(QWidget *aParent)
     treeView->setModel(new EventModel());
     treeView->setItemDelegate(new Delegate(treeView));
 
-    connect(dayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateTreeView(const QDate &)));
+    // connect(dayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateTreeView(const QDate &)));
 
     connect(treeView, SIGNAL(eventHasChanged(int,bool)), SIGNAL(eventHasChanged(int,bool)));
     connect(treeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &)));