diff --git a/kmkernel.cpp b/kmkernel.cpp index 241c6eae6..0383099cf 100644 --- a/kmkernel.cpp +++ b/kmkernel.cpp @@ -135,8 +135,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(); @@ -2115,3 +2119,8 @@ PimCommon::StorageServiceManager *KMKernel::storageServiceManager() const { return mStorageManager; } + +bool KMKernel::allowToDebugBalooSupport() const +{ + return mDebugBaloo; +} diff --git a/kmkernel.h b/kmkernel.h index 1f72eeb7a..46e3abdb4 100644 --- a/kmkernel.h +++ b/kmkernel.h @@ -474,6 +474,8 @@ public: FolderArchiveManager *folderArchiveManager() const; PimCommon::StorageServiceManager *storageServiceManager() const; + bool allowToDebugBalooSupport() const; + protected: void agentInstanceBroken( const Akonadi::AgentInstance& instance ); @@ -602,6 +604,7 @@ private: PimCommon::AutoCorrection *mAutoCorrection; FolderArchiveManager *mFolderArchiveManager; PimCommon::StorageServiceManager *mStorageManager; + bool mDebugBaloo; }; #endif // _KMKERNEL_H diff --git a/kmmainwidget.cpp b/kmmainwidget.cpp index 685b7a89d..e15d27449 100644 --- a/kmmainwidget.cpp +++ b/kmmainwidget.cpp @@ -2915,6 +2915,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 b8868dac4..48c58094c 100644 --- a/messageactions.cpp +++ b/messageactions.cpp @@ -38,6 +38,8 @@ #include #include #include +#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( QIcon::fromTheme(QLatin1String("mail-reply-sender")), i18nc("Message->","&Reply"), this ); ac->addAction( QLatin1String("message_reply_menu"), mReplyActionMenu ); @@ -192,6 +195,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(); } @@ -641,3 +649,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 f1c3ef849..ba4f5af1c 100644 --- a/messageactions.h +++ b/messageactions.h @@ -90,6 +90,7 @@ public: void addWebShortcutsMenu( QMenu *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: QAction *mEditAction, *mAnnotateAction, *mPrintAction, *mPrintPreviewAction; TemplateParser::CustomTemplatesMenu *mCustomTemplatesMenu; QAction *mListFilterAction; + QAction *mDebugBalooAction; }; }