From f277c3e63118b9afa4b72c28bbb6ab2aafae964b Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Fri, 16 Aug 2013 23:22:35 +0200 Subject: [PATCH] I can't add kmessagebox + i18n in 4.11 :( But inform user via some debug output. Will add kmessagebox in 4.12. Now we can know why we don't have some result --- searchdialog/searchwindow.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/searchdialog/searchwindow.cpp b/searchdialog/searchwindow.cpp index e3b762dbf..df76455c0 100644 --- a/searchdialog/searchwindow.cpp +++ b/searchdialog/searchwindow.cpp @@ -402,6 +402,10 @@ void SearchWindow::slotSearch() KUrl::List urls; if ( !mUi.mChkbxAllFolders->isChecked() ) { const Akonadi::Collection col = mUi.mCbxFolders->collection(); + if (!col.isValid()) { + qDebug()<<"You did not selected a valid folder."; + return; + } urls << col.url( Akonadi::Collection::UrlShort ); if ( mUi.mChkSubFolders->isChecked() ) { childCollectionsFromSelectedCollection( col, urls ); @@ -417,14 +421,21 @@ void SearchWindow::slotSearch() const QString query = searchPattern.asXesamQuery(); const QString queryLanguage = "XESAM"; #else - const QString query = searchPattern.asSparqlQuery(urls); + bool allIsEmpty = false; + const QString query = searchPattern.asSparqlQuery(allIsEmpty, urls); const QString queryLanguage = "SPARQL"; #endif qDebug() << queryLanguage; qDebug() << query; - if ( query.isEmpty() ) + if ( query.isEmpty() ) { + if (allIsEmpty) { + qDebug()<<"All folders selected are empty or were not indexed."; + } else { + qDebug()<<"Search query is empty. Please report bug about it."; + } return; + } mUi.mSearchFolderOpenBtn->setEnabled( true ); if ( !mFolder.isValid() ) {