diff --git a/CMakeLists.txt b/CMakeLists.txt index ca746f805..1d14d3efe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,7 +188,7 @@ if (KDEPIM_BUILD_DESKTOP) util.cpp messageactions.cpp foldershortcutactionmanager.cpp - kmconfigureagent.cpp + kmlaunchexternalcomponent.cpp manageshowcollectionproperties.cpp ${kmailprivate_attributes_LIB_SRCS} ${kmailprivate_tag_LIB_SRCS} diff --git a/kmconfigureagent.cpp b/kmlaunchexternalcomponent.cpp similarity index 52% rename from kmconfigureagent.cpp rename to kmlaunchexternalcomponent.cpp index c3bbea06a..5a5e14a82 100644 --- a/kmconfigureagent.cpp +++ b/kmlaunchexternalcomponent.cpp @@ -15,9 +15,10 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "kmconfigureagent.h" +#include "kmlaunchexternalcomponent.h" #include #include +#include #include "archivemailagentinterface.h" #include "sendlateragentinterface.h" @@ -25,20 +26,22 @@ #include #include +#include +#include -KMConfigureAgent::KMConfigureAgent(QWidget *parentWidget, QObject *parent) +KMLaunchExternalComponent::KMLaunchExternalComponent(QWidget *parentWidget, QObject *parent) : QObject(parent), mParentWidget(parentWidget) { } -KMConfigureAgent::~KMConfigureAgent() +KMLaunchExternalComponent::~KMLaunchExternalComponent() { } -void KMConfigureAgent::slotConfigureAutomaticArchiving() +void KMLaunchExternalComponent::slotConfigureAutomaticArchiving() { OrgFreedesktopAkonadiArchiveMailAgentInterface archiveMailInterface(QLatin1String("org.freedesktop.Akonadi.ArchiveMailAgent"), QLatin1String("/ArchiveMailAgent"), QDBusConnection::sessionBus(), this); if (archiveMailInterface.isValid()) { @@ -48,7 +51,7 @@ void KMConfigureAgent::slotConfigureAutomaticArchiving() } } -void KMConfigureAgent::slotConfigureSendLater() +void KMLaunchExternalComponent::slotConfigureSendLater() { OrgFreedesktopAkonadiSendLaterAgentInterface sendLaterInterface(QLatin1String("org.freedesktop.Akonadi.SendLaterAgent"), QLatin1String("/SendLaterAgent"), QDBusConnection::sessionBus(), this); if (sendLaterInterface.isValid()) { @@ -58,7 +61,7 @@ void KMConfigureAgent::slotConfigureSendLater() } } -void KMConfigureAgent::slotConfigureFollowupReminder() +void KMLaunchExternalComponent::slotConfigureFollowupReminder() { OrgFreedesktopAkonadiFollowUpReminderAgentInterface followUpInterface(QLatin1String("org.freedesktop.Akonadi.FollowUpReminder"), QLatin1String("/FollowUpReminder"), QDBusConnection::sessionBus(), this); if (followUpInterface.isValid()) { @@ -67,3 +70,39 @@ void KMConfigureAgent::slotConfigureFollowupReminder() KMessageBox::error(mParentWidget, i18n("Followup Reminder Agent was not registered.")); } } + +void KMLaunchExternalComponent::slotStartCertManager() +{ + if ( !QProcess::startDetached(QLatin1String("kleopatra") ) ) + KMessageBox::error( mParentWidget, i18n( "Could not start certificate manager; " + "please check your installation." ), + i18n( "KMail Error" ) ); + else + qDebug() << "slotStartCertManager(): certificate manager started."; +} + +void KMLaunchExternalComponent::slotStartWatchGnuPG() +{ + if ( !QProcess::startDetached(QLatin1String("kwatchgnupg")) ) + KMessageBox::error( mParentWidget, i18n( "Could not start GnuPG LogViewer (kwatchgnupg); " + "please check your installation." ), + i18n( "KMail Error" ) ); +} + +void KMLaunchExternalComponent::slotImportWizard() +{ + const QString path = KStandardDirs::findExe( QLatin1String("importwizard" ) ); + if ( !QProcess::startDetached( path ) ) + KMessageBox::error( mParentWidget, i18n( "Could not start the import wizard. " + "Please check your installation." ), + i18n( "Unable to start import wizard" ) ); +} + +void KMLaunchExternalComponent::slotExportData() +{ + const QString path = KStandardDirs::findExe( QLatin1String("pimsettingexporter" ) ); + if ( !QProcess::startDetached( path ) ) + KMessageBox::error( mParentWidget, i18n( "Could not start \"PIM Setting Exporter\" program. " + "Please check your installation." ), + i18n( "Unable to start \"PIM Setting Exporter\" program" ) ); +} diff --git a/kmconfigureagent.h b/kmlaunchexternalcomponent.h similarity index 69% rename from kmconfigureagent.h rename to kmlaunchexternalcomponent.h index 83d3c82b9..8eda3cf9e 100644 --- a/kmconfigureagent.h +++ b/kmlaunchexternalcomponent.h @@ -15,24 +15,28 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef KMCONFIGUREAGENT_H -#define KMCONFIGUREAGENT_H +#ifndef KMLAUNCHEXTERNALCOMPONENT_H +#define KMLAUNCHEXTERNALCOMPONENT_H #include -class KMConfigureAgent : public QObject +class KMLaunchExternalComponent : public QObject { Q_OBJECT public: - explicit KMConfigureAgent(QWidget *parentWidget, QObject *parent = Q_NULLPTR); - ~KMConfigureAgent(); + explicit KMLaunchExternalComponent(QWidget *parentWidget, QObject *parent = Q_NULLPTR); + ~KMLaunchExternalComponent(); public Q_SLOTS: void slotConfigureSendLater(); void slotConfigureAutomaticArchiving(); void slotConfigureFollowupReminder(); + void slotStartCertManager(); + void slotStartWatchGnuPG(); + void slotImportWizard(); + void slotExportData(); private: QWidget *mParentWidget; }; -#endif // KMCONFIGUREAGENT_H +#endif // KMLAUNCHEXTERNALCOMPONENT_H diff --git a/kmmainwidget.cpp b/kmmainwidget.cpp index 0430e564c..52d457124 100644 --- a/kmmainwidget.cpp +++ b/kmmainwidget.cpp @@ -96,7 +96,7 @@ using KSieveUi::SieveDebugDialog; #include "widgets/displaymessageformatactionmenu.h" #include "ksieveui/vacation/vacationmanager.h" -#include "kmconfigureagent.h" +#include "kmlaunchexternalcomponent.h" // LIBKDEPIM includes #include "progresswidget/progressmanager.h" @@ -183,15 +183,13 @@ using KSieveUi::SieveDebugDialog; #include #include #include -#include -#include -#include #include // System includes -#include // ugh #include #include #include +#include + #include #include @@ -205,9 +203,6 @@ using KMail::AntiSpamWizard; using KMime::Types::AddrSpecList; using MessageViewer::AttachmentStrategy; -Q_DECLARE_METATYPE(KPIM::ProgressItem *) -Q_DECLARE_METATYPE(Akonadi::Job *) -Q_DECLARE_METATYPE(QPointer) Q_GLOBAL_STATIC(KMMainWidget::PtrList, theMainWidgetList) //----------------------------------------------------------------------------- @@ -232,7 +227,7 @@ KMMainWidget::KMMainWidget(QWidget *parent, KXMLGUIClient *aGUIClient, mSearchMessages(0), mManageShowCollectionProperties(new ManageShowCollectionProperties(this, this)) { - mConfigAgent = new KMConfigureAgent(this, this); + mLaunchExternalComponent = new KMLaunchExternalComponent(this, this); // must be the first line of the constructor: mStartupDone = false; mWasEverShown = false; @@ -1467,7 +1462,6 @@ void KMMainWidget::slotExpireFolder() } bool mustDeleteExpirationAttribute = false; MailCommon::ExpireCollectionAttribute *attr = MailCommon::ExpireCollectionAttribute::expirationCollectionAttribute(mCurrentFolder->collection(), mustDeleteExpirationAttribute); - ; bool canBeExpired = true; if (!attr->isAutoExpire()) { canBeExpired = false; @@ -2331,28 +2325,6 @@ void KMMainWidget::slotDebugSieve() #endif } -//----------------------------------------------------------------------------- -void KMMainWidget::slotStartCertManager() -{ - if (!QProcess::startDetached(QLatin1String("kleopatra"))) - KMessageBox::error(this, i18n("Could not start certificate manager; " - "please check your installation."), - i18n("KMail Error")); - else { - qDebug() << "\nslotStartCertManager(): certificate manager started."; - } -} - -//----------------------------------------------------------------------------- -void KMMainWidget::slotStartWatchGnuPG() -{ - if (!QProcess::startDetached(QLatin1String("kwatchgnupg"))) - KMessageBox::error(this, i18n("Could not start GnuPG LogViewer (kwatchgnupg); " - "please check your installation."), - i18n("KMail Error")); -} - -//----------------------------------------------------------------------------- void KMMainWidget::slotConfigChanged() { readConfig(); @@ -3026,7 +2998,7 @@ void KMMainWidget::setupActions() { QAction *action = new QAction(QIcon::fromTheme(QLatin1String("pgp-keys")), i18n("Certificate Manager"), this); actionCollection()->addAction(QLatin1String("tools_start_certman"), action); - connect(action, &QAction::triggered, this, &KMMainWidget::slotStartCertManager); + connect(action, &QAction::triggered, mLaunchExternalComponent, &KMLaunchExternalComponent::slotStartCertManager); // disable action if no certman binary is around if (QStandardPaths::findExecutable(QLatin1String("kleopatra")).isEmpty()) { action->setEnabled(false); @@ -3035,7 +3007,7 @@ void KMMainWidget::setupActions() { QAction *action = new QAction(QIcon::fromTheme(QLatin1String("pgp-keys")), i18n("GnuPG Log Viewer"), this); actionCollection()->addAction(QLatin1String("tools_start_kwatchgnupg"), action); - connect(action, &QAction::triggered, this, &KMMainWidget::slotStartWatchGnuPG); + connect(action, &QAction::triggered, mLaunchExternalComponent, &KMLaunchExternalComponent::slotStartWatchGnuPG); #ifdef Q_OS_WIN32 // not ported yet, underlying infrastructure missing on Windows const bool usableKWatchGnupg = false; @@ -3085,7 +3057,7 @@ void KMMainWidget::setupActions() { QAction *action = new QAction(i18n("&Import Wizard..."), this); actionCollection()->addAction(QLatin1String("importWizard"), action); - connect(action, &QAction::triggered, this, &KMMainWidget::slotImportWizard); + connect(action, &QAction::triggered, mLaunchExternalComponent, &KMLaunchExternalComponent::slotImportWizard); } if (KSieveUi::Util::allowOutOfOfficeSettings()) { QAction *action = new QAction(i18n("Edit \"Out of Office\" Replies..."), this); @@ -3096,19 +3068,19 @@ void KMMainWidget::setupActions() { QAction *action = new QAction(i18n("&Configure Automatic Archiving..."), this); actionCollection()->addAction(QLatin1String("tools_automatic_archiving"), action); - connect(action, &QAction::triggered, mConfigAgent, &KMConfigureAgent::slotConfigureAutomaticArchiving); + connect(action, &QAction::triggered, mLaunchExternalComponent, &KMLaunchExternalComponent::slotConfigureAutomaticArchiving); } { QAction *action = new QAction(i18n("Delayed Messages..."), this); actionCollection()->addAction(QLatin1String("message_delayed"), action); - connect(action, &QAction::triggered, mConfigAgent, &KMConfigureAgent::slotConfigureSendLater); + connect(action, &QAction::triggered, mLaunchExternalComponent, &KMLaunchExternalComponent::slotConfigureSendLater); } { QAction *action = new QAction(i18n("Followup Reminder Messages..."), this); actionCollection()->addAction(QLatin1String("followup_reminder_messages"), action); - connect(action, &QAction::triggered, mConfigAgent, &KMConfigureAgent::slotConfigureFollowupReminder); + connect(action, &QAction::triggered, mLaunchExternalComponent, &KMLaunchExternalComponent::slotConfigureFollowupReminder); } // Disable the standard action delete key sortcut. @@ -3519,7 +3491,7 @@ void KMMainWidget::setupActions() { QAction *action = new QAction(QIcon::fromTheme(QLatin1String("kmail")), i18n("&Export KMail Data..."), this); actionCollection()->addAction(QLatin1String("kmail_export_data"), action); - connect(action, &QAction::triggered, this, &KMMainWidget::slotExportData); + connect(action, &QAction::triggered, mLaunchExternalComponent, &KMLaunchExternalComponent::slotExportData); } { @@ -4336,15 +4308,6 @@ void KMMainWidget::slotAccountWizard() KMail::Util::launchAccountWizard(this); } -void KMMainWidget::slotImportWizard() -{ - const QString path = QStandardPaths::findExecutable(QLatin1String("importwizard")); - if (!QProcess::startDetached(path)) - KMessageBox::error(this, i18n("Could not start the import wizard. " - "Please check your installation."), - i18n("Unable to start import wizard")); -} - //----------------------------------------------------------------------------- void KMMainWidget::slotFilterLogViewer() { @@ -4585,15 +4548,6 @@ void KMMainWidget::updatePaneTagComboBox() } } -void KMMainWidget::slotExportData() -{ - const QString path = QStandardPaths::findExecutable(QLatin1String("pimsettingexporter")); - if (!QProcess::startDetached(path)) - KMessageBox::error(this, i18n("Could not start \"PIM Setting Exporter\" program. " - "Please check your installation."), - i18n("Unable to start \"PIM Setting Exporter\" program")); -} - void KMMainWidget::slotCreateAddressBookContact() { CreateNewContactJob *job = new CreateNewContactJob(this, this); diff --git a/kmmainwidget.h b/kmmainwidget.h index 5143f7139..1b1f8f877 100644 --- a/kmmainwidget.h +++ b/kmmainwidget.h @@ -50,7 +50,7 @@ class Message; class KUrl; class QVBoxLayout; class QSplitter; -class KMConfigureAgent; +class KMLaunchExternalComponent; class DisplayMessageFormatActionMenu; class QMenu; class QAction; @@ -363,8 +363,6 @@ protected slots: void slotResendMsg(); void slotCheckVacation(); void slotDebugSieve(); - void slotStartCertManager(); - void slotStartWatchGnuPG(); void slotApplyFilters(); void slotApplyFiltersOnFolder(); void slotExpandThread(); @@ -394,7 +392,6 @@ protected slots: void slotAntiVirusWizard(); void slotFilterLogViewer(); void slotAccountWizard(); - void slotImportWizard(); /** Message navigation */ void slotSelectNextMessage(); @@ -463,7 +460,6 @@ protected slots: void slotCollectionChanged(const Akonadi::Collection &, const QSet &); void slotCreateNewTab(bool); void slotUpdateActionsAfterMailChecking(); - void slotExportData(); void slotCreateAddressBookContact(); void slotOpenRecentMsg(const QUrl &url); @@ -656,7 +652,7 @@ private: DisplayMessageFormatActionMenu *mDisplayMessageFormatMenu; MessageViewer::Viewer::DisplayFormatMessage mFolderDisplayFormatPreference; QAction *mSearchMessages; - KMConfigureAgent *mConfigAgent; + KMLaunchExternalComponent *mLaunchExternalComponent; ManageShowCollectionProperties *mManageShowCollectionProperties; };