From 0669c669875e7d550bc2771a4183672513e11560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <daniel.vratil@kdab.com> Date: Fri, 19 Feb 2016 15:31:50 +0100 Subject: [PATCH 47/74] Only rely on comparing our and indexer's queues Relying on indexer emitting currentCollectionChanged(-1) meaning that the indexer is done is not correct. In case of queue under-run the indexer will emit this signal with more collections indexing requests still pending on the DBus --- kmail/searchdialog/incompleteindexdialog.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/kmail/searchdialog/incompleteindexdialog.cpp b/kmail/searchdialog/incompleteindexdialog.cpp index 504c7e2899..a0b0c4e804 100644 --- a/kmail/searchdialog/incompleteindexdialog.cpp +++ b/kmail/searchdialog/incompleteindexdialog.cpp @@ -193,6 +193,16 @@ void IncompleteIndexDialog::waitForIndexer() return; } + + mProgressDialog = new KProgressDialog(this); + mProgressDialog->progressBar()->setMaximum(mIndexingQueue.size()); + mProgressDialog->progressBar()->setValue(0); + mProgressDialog->setLabelText(i18n("Indexing Collections...")); + connect(mProgressDialog, SIGNAL(rejected()), + this, SLOT(slotStopIndexing())); + + connect(mIndexer, SIGNAL(currentCollectionChanged(qlonglong)), + this, SLOT(slotCurrentlyIndexingCollectionChanged(qlonglong))); Q_FOREACH (const Akonadi::Collection &col, collectionsToReindex()) { mIndexer->asyncCall(QLatin1String("reindexCollection"), col.id()); mIndexingQueue.push_back(col.id()); @@ -203,16 +213,7 @@ void IncompleteIndexDialog::waitForIndexer() return; } - mProgressDialog = new KProgressDialog(this); - mProgressDialog->progressBar()->setMaximum(mIndexingQueue.size()); - mProgressDialog->progressBar()->setValue(0); - mProgressDialog->setLabelText(i18n("Indexing Collections...")); mProgressDialog->show(); - connect(mProgressDialog, SIGNAL(rejected()), - this, SLOT(slotStopIndexing())); - - connect(mIndexer, SIGNAL(currentCollectionChanged(qlonglong)), - this, SLOT(slotCurrentlyIndexingCollectionChanged(qlonglong))); } void IncompleteIndexDialog::slotStopIndexing() @@ -223,12 +224,6 @@ void IncompleteIndexDialog::slotStopIndexing() void IncompleteIndexDialog::slotCurrentlyIndexingCollectionChanged(qlonglong colId) { - if (colId == -1) { - // Give indexer time to commit - QTimer::singleShot(1000, this, SLOT(accept())); - return; - } - const int idx = mIndexingQueue.indexOf(colId); if (idx > -1) { mIndexingQueue.remove(idx); -- 2.14.1