From 0b037459e163c8f87729231a1ab9bf500b10724f Mon Sep 17 00:00:00 2001 From: Till Adam Date: Sun, 18 Apr 2010 10:05:43 +0000 Subject: [PATCH] Port status updating and clean it up a bit, naming wise. We are currently lacking a signal from the search backend that informs us when the initial search is complete, so it's not working as expected, atm. svn path=/trunk/KDE/kdepim/kmail/; revision=1115975 --- kmail/searchwindow.cpp | 40 +++++++++++++--------------------------- kmail/searchwindow.h | 2 +- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/kmail/searchwindow.cpp b/kmail/searchwindow.cpp index 5b67cbd381..2f800a6e5d 100644 --- a/kmail/searchwindow.cpp +++ b/kmail/searchwindow.cpp @@ -381,44 +381,30 @@ void SearchWindow::setEnabledSearchButton( bool ) } //----------------------------------------------------------------------------- -void SearchWindow::updStatus(void) +void SearchWindow::updateStatusLine() { -#if 0 //TODO port to akonadi QString genMsg, detailMsg; - int numMatches = 0, count = 0; - KMSearch const *search = (mFolder) ? (mFolder->search()) : 0; - QString folderName; - if (search) { - numMatches = search->foundCount(); - count = search->searchCount(); - folderName = search->currentFolder(); + int numMatches = 0; + if ( mFolder.isValid() ) { + numMatches = mFolder.statistics().count(); } - if (search && !search->running()) { + if ( mFolder.isValid() && mSearchJob ) { if(!mStopped) { - genMsg = i18nc("Search finished.", "Done"); - detailMsg = i18np("%1 match (%2)", "%1 matches (%2)", numMatches, - i18np("%1 message processed", - "%1 messages processed", count)); + genMsg = i18nc( "Search finished.", "Done" ); + detailMsg = i18np( "%1 match", "%1 matches", numMatches ); } else { - genMsg = i18n("Search canceled"); - detailMsg = i18np("%1 match so far (%2)", - "%1 matches so far (%2)", numMatches, - i18np("%1 message processed", - "%1 messages processed", count)); + genMsg = i18n( "Search canceled" ); + detailMsg = i18np( "%1 match so far", + "%1 matches so far", numMatches ); } } else { - genMsg = i18np("%1 match", "%1 matches", numMatches); - detailMsg = i18n("Searching in %1 (message %2)", - folderName, - count); + genMsg = i18np( "%1 match", "%1 matches", numMatches ); + detailMsg = i18n( "Searching in %1", mFolder.name() ); } mStatusBar->changeItem(genMsg, 0); mStatusBar->changeItem(detailMsg, 1); -#else - kDebug() << "AKONADI PORT: Disabled code in " << Q_FUNC_INFO; -#endif } @@ -550,7 +536,7 @@ void SearchWindow::searchDone( KJob* job ) } mTimer->stop(); - updStatus(); + updateStatusLine(); QTimer::singleShot(0, this, SLOT(enableGUI())); if(mLastFocus) diff --git a/kmail/searchwindow.h b/kmail/searchwindow.h index 60e1c00afc..e840fef21b 100644 --- a/kmail/searchwindow.h +++ b/kmail/searchwindow.h @@ -112,7 +112,7 @@ public: protected slots: /** Update status line widget. */ - virtual void updStatus(void); + virtual void updateStatusLine(void); virtual void slotClose(); virtual void slotSearch(); -- 2.11.4.GIT