From 2adfd3607d7ee71abbddce05470de83a9f63eee1 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sat, 20 Jun 2009 23:42:12 +0300 Subject: [PATCH] GUI: Enable clearing/saving results also if there are only hidden results. This commit fixes a bug in my earlier commit that only checked visible results. --- gui/mainwindow.cpp | 2 +- gui/resultstree.cpp | 5 +++++ gui/resultstree.h | 6 ++++++ gui/resultsview.cpp | 5 +++++ gui/resultsview.h | 7 +++++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index c38d58934..bdb93ad9d 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -351,7 +351,7 @@ QStringList MainWindow::RemoveUnacceptedFiles(const QStringList &list) void MainWindow::CheckDone() { EnableCheckButtons(true); - if (mResults.HasVisibleResults()) + if (mResults.HasResults()) { mActionClearResults.setEnabled(true); mActionSave.setEnabled(true); diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 5d1068962..7532352ec 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -778,3 +778,8 @@ bool ResultsTree::HasVisibleResults() const { return mVisibleErrors; } + +bool ResultsTree::HasResults() const +{ + return mModel.rowCount() > 0; +} diff --git a/gui/resultstree.h b/gui/resultstree.h index c77e071a3..21975e4d4 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -100,6 +100,12 @@ public: */ bool HasVisibleResults() const; + /** + * @brief Do we have results from check? + * @return true if there is at least one warning/error, hidden or visible. + */ + bool HasResults() const; + protected slots: /** * @brief Slot to quickstart an error with default application diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 5160b9718..a08ae6f9a 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -170,3 +170,8 @@ bool ResultsView::HasVisibleResults() const { return mTree->HasVisibleResults(); } + +bool ResultsView::HasResults() const +{ + return mTree->HasResults(); +} diff --git a/gui/resultsview.h b/gui/resultsview.h index 7bbcb7ce0..1dd27be7f 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -97,6 +97,13 @@ public: */ bool HasVisibleResults() const; + /** + * @brief Do we have results from check? + * + * @return true if there is at least one warning/error, hidden or visible. + */ + bool HasResults() const; + signals: /**