summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-06-15 07:15:53 +0200
committerMontel Laurent <[email protected]>2016-06-15 08:20:40 +0200
commit5ee56038f16b974f86e101f1776f43da4b688276 (patch)
tree53949091c6812337fa4b7fd48e3d71a30efa208d
parent070a49c5c7797e13ff44ec9b5c3dbed13c1316ec (diff)
Backport "Always display number of results"
-rw-r--r--kmail/src/searchdialog/searchwindow.cpp18
-rw-r--r--kmail/src/searchdialog/searchwindow.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/kmail/src/searchdialog/searchwindow.cpp b/kmail/src/searchdialog/searchwindow.cpp
index 395ea3a..00534e7 100644
--- a/kmail/src/searchdialog/searchwindow.cpp
+++ b/kmail/src/searchdialog/searchwindow.cpp
@@ -578,6 +578,9 @@ void SearchWindow::searchDone(KJob *job)
searchDescription->setRecursive(mUi.mChkSubFolders->isChecked());
new Akonadi::CollectionModifyJob(mFolder, this);
mSearchJob = Q_NULLPTR;
+ Akonadi::CollectionFetchJob *fetch = new Akonadi::CollectionFetchJob(mFolder, Akonadi::CollectionFetchJob::Base, this);
+ fetch->fetchScope().setIncludeStatistics(true);
+ connect(fetch, SIGNAL(result(KJob*)), this, SLOT(slotCollectionStatisticsRetrieved(KJob*)));
mUi.mStatusLbl->setText(i18n("Search complete."));
createSearchModel();
@@ -593,6 +596,21 @@ void SearchWindow::searchDone(KJob *job)
}
}
+void SearchWindow::slotCollectionStatisticsRetrieved(KJob *job)
+{
+ Akonadi::CollectionFetchJob *fetch = qobject_cast<Akonadi::CollectionFetchJob*>(job);
+ if (!fetch || fetch->error()) {
+ return;
+ }
+
+ const Akonadi::Collection::List cols = fetch->collections();
+ if (cols.isEmpty()) {
+ return;
+ }
+
+ updateCollectionStatistic(cols[0].id(), cols[0].statistics());
+}
+
void SearchWindow::slotStop()
{
mUi.mProgressIndicator->stop();
diff --git a/kmail/src/searchdialog/searchwindow.h b/kmail/src/searchdialog/searchwindow.h
index dae0c59..7f73a97 100644
--- a/kmail/src/searchdialog/searchwindow.h
+++ b/kmail/src/searchdialog/searchwindow.h
@@ -143,6 +143,7 @@ private Q_SLOTS:
void slotPrintMsg();
/** GUI cleanup after search */
+ void slotCollectionStatisticsRetrieved(KJob *job);
void searchDone(KJob *);
void enableGUI();