From: Philipp Spitzer Date: Mon, 12 Dec 2011 22:53:04 +0000 (+0000) Subject: When the search toolbox button is clicked when the search dialog is already open... X-Git-Tag: 0.5.5~31 X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/commitdiff_plain/d12c1e048217e72b2b16bda6504ea1493ff8f9f5 When the search toolbox button is clicked when the search dialog is already open, it is closed. --- diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index ce40dfa..830923a 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -161,8 +161,12 @@ void MainWindow::on_nowAction_triggered() { void MainWindow::on_searchAction_triggered() { - searchTabContainer->showSearchDialog(); - tabWidget->setCurrentWidget(searchTab); + if (tabWidget->currentWidget() == searchTab) + searchTabContainer->showSearchDialog(!searchTabContainer->searchDialogIsVisible()); + else { + tabWidget->setCurrentWidget(searchTab); + searchTabContainer->showSearchDialog(); + } } diff --git a/src/gui/searchtabcontainer.cpp b/src/gui/searchtabcontainer.cpp index 3abc8e5..0f4aac8 100644 --- a/src/gui/searchtabcontainer.cpp +++ b/src/gui/searchtabcontainer.cpp @@ -39,6 +39,11 @@ SearchTabContainer::SearchTabContainer(QWidget *aParent) : TabContainer( aParent } +bool SearchTabContainer::searchDialogIsVisible() const { + return header->isVisible(); +} + + int SearchTabContainer::searchResultCount(const QDate& date) const { int confId = Conference::activeConference(); if (confId == -1) return 0; @@ -46,9 +51,9 @@ int SearchTabContainer::searchResultCount(const QDate& date) const { } -void SearchTabContainer::showSearchDialog() { - header->show(); - treeView->hide(); +void SearchTabContainer::showSearchDialog(bool show) { + header->setVisible(show); + treeView->setVisible(!show); } diff --git a/src/gui/searchtabcontainer.h b/src/gui/searchtabcontainer.h index 80ecd4c..3475632 100644 --- a/src/gui/searchtabcontainer.h +++ b/src/gui/searchtabcontainer.h @@ -31,6 +31,7 @@ class SearchTabContainer: public TabContainer { public: SearchTabContainer(QWidget *aParent); virtual ~SearchTabContainer() {} + bool searchDialogIsVisible() const; int searchResultCount(const QDate& date) const; ///< returns the number of events found on that specific date protected: @@ -40,7 +41,7 @@ signals: void searchResultChanged(); public slots: - void showSearchDialog(); + void showSearchDialog(bool show=true); private slots: void searchButtonClicked();