diff --git a/kmkernel.cpp b/kmkernel.cpp index 538dd6483..39fbe4dde 100644 --- a/kmkernel.cpp +++ b/kmkernel.cpp @@ -132,8 +132,12 @@ KMKernel::KMKernel (QObject *parent) : mConfigureDialog(0), mMailService(0), mSystemNetworkStatus ( Solid::Networking::status() ), - mSystemTray(0) + mSystemTray(0), + mDebugBaloo(false) { + if (!qgetenv("KDEPIM_BALOO_DEBUG").isEmpty()) { + mDebugBaloo = true; + } Akonadi::AttributeFactory::registerAttribute(); QDBusConnection::sessionBus().registerService(QLatin1String("org.kde.kmail")); KMail::Util::migrateFromKMail1(); @@ -2094,3 +2098,8 @@ PimCommon::StorageServiceManager *KMKernel::storageServiceManager() const { return mStorageManager; } + +bool KMKernel::allowToDebugBalooSupport() const +{ + return mDebugBaloo; +} diff --git a/kmkernel.h b/kmkernel.h index 7ea97aea2..6db2d312d 100644 --- a/kmkernel.h +++ b/kmkernel.h @@ -434,6 +434,8 @@ public: FolderArchiveManager *folderArchiveManager() const; PimCommon::StorageServiceManager *storageServiceManager() const; + bool allowToDebugBalooSupport() const; + protected: void agentInstanceBroken( const Akonadi::AgentInstance& instance ); @@ -542,6 +544,7 @@ private: PimCommon::AutoCorrection *mAutoCorrection; FolderArchiveManager *mFolderArchiveManager; PimCommon::StorageServiceManager *mStorageManager; + bool mDebugBaloo; }; #endif // _KMKERNEL_H diff --git a/kmmainwidget.cpp b/kmmainwidget.cpp index b9d73ead3..545df50dd 100644 --- a/kmmainwidget.cpp +++ b/kmmainwidget.cpp @@ -2920,6 +2920,10 @@ void KMMainWidget::showMessagePopup(const Akonadi::Item&msg ,const KUrl&url,cons menu->addSeparator(); menu->addAction( mMsgView->openBlockableItems()); } + if (kmkernel->allowToDebugBalooSupport()) { + menu->addSeparator(); + menu->addAction( mMsgActions->debugBalooAction() ); + } } KAcceleratorManager::manage(menu); menu->exec( aPoint, 0 ); diff --git a/messageactions.cpp b/messageactions.cpp index 0c9826f41..01f3bfa1e 100644 --- a/messageactions.cpp +++ b/messageactions.cpp @@ -34,6 +34,8 @@ #include "messageviewer/viewer/csshelper.h" #include "messageviewer/settings/globalsettings.h" +#include "pimcommon/baloodebug/baloodebugdialog.h" + #include #include #include @@ -66,7 +68,8 @@ MessageActions::MessageActions( KActionCollection *ac, QWidget *parent ) mMessageView( 0 ), mRedirectAction( 0 ), mPrintPreviewAction( 0 ), - mCustomTemplatesMenu( 0 ) + mCustomTemplatesMenu( 0 ), + mDebugBalooAction(0) { mReplyActionMenu = new KActionMenu( KIcon(QLatin1String("mail-reply-sender")), i18nc("Message->","&Reply"), this ); ac->addAction( QLatin1String("message_reply_menu"), mReplyActionMenu ); @@ -203,6 +206,11 @@ MessageActions::MessageActions( KActionCollection *ac, QWidget *parent ) replyMenu()->addAction( mCustomTemplatesMenu->replyActionMenu() ); replyMenu()->addAction( mCustomTemplatesMenu->replyAllActionMenu() ); + //Don't translate it. Shown only when we set env variable KDEPIM_BALOO_DEBUG + mDebugBalooAction = new QAction(QLatin1String("Debug Baloo..."), this); + connect( mDebugBalooAction, SIGNAL(triggered(bool)), this, SLOT(slotDebugBaloo()) ); + + updateActions(); } @@ -654,3 +662,14 @@ void MessageActions::slotConfigureWebShortcuts() { KToolInvocation::kdeinitExec( QLatin1String("kcmshell4"), QStringList() << QLatin1String("ebrowsing") ); } + +void MessageActions::slotDebugBaloo() +{ + if ( !mCurrentItem.isValid() ) + return; + QPointer dlg = new PimCommon::BalooDebugDialog; + dlg->setAkonadiId(mCurrentItem.id()); + dlg->setAttribute( Qt::WA_DeleteOnClose ); + dlg->setSearchType(PimCommon::BalooDebugSearchPathComboBox::Emails); + dlg->show(); +} diff --git a/messageactions.h b/messageactions.h index 7733db135..cd2fbde9b 100644 --- a/messageactions.h +++ b/messageactions.h @@ -90,6 +90,7 @@ public: void addWebShortcutsMenu( KMenu *menu, const QString & text ); + QAction *debugBalooAction() const { return mDebugBalooAction; } signals: // This signal is emitted when a reply is triggered and the @@ -129,7 +130,7 @@ private slots: void slotMailingListFilter(); void slotHandleWebShortcutAction(); void slotConfigureWebShortcuts(); - + void slotDebugBaloo(); private: QList mMailListActionList; @@ -149,6 +150,7 @@ private: KAction *mEditAction, *mAnnotateAction, *mPrintAction, *mPrintPreviewAction; TemplateParser::CustomTemplatesMenu *mCustomTemplatesMenu; KAction *mListFilterAction; + QAction *mDebugBalooAction; }; }