• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kmail

  • sources
  • kde-4.14
  • kdepim
  • kmail
kmlaunchexternalcomponent.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2014-2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "kmlaunchexternalcomponent.h"
19 #include <KMessageBox>
20 #include <KLocalizedString>
21 #include <KStandardDirs>
22 #include <KRun>
23 #include <KTipDialog>
24 
25 #include "util.h"
26 #include "archivemailagentinterface.h"
27 #include "sendlateragentinterface.h"
28 #include "followupreminderinterface.h"
29 #include "mailcommon/filter/filtermanager.h"
30 
31 #include <QtDBus/QDBusInterface>
32 #include <QtDBus/QDBusReply>
33 #include <QProcess>
34 #include <QDebug>
35 #include <antispam-virus/antispamwizard.h>
36 
37 KMLaunchExternalComponent::KMLaunchExternalComponent(QWidget *parentWidget, QObject *parent)
38  : QObject(parent),
39  mParentWidget(parentWidget)
40 {
41 
42 }
43 
44 KMLaunchExternalComponent::~KMLaunchExternalComponent()
45 {
46 
47 }
48 
49 void KMLaunchExternalComponent::slotConfigureAutomaticArchiving()
50 {
51  OrgFreedesktopAkonadiArchiveMailAgentInterface archiveMailInterface(QLatin1String("org.freedesktop.Akonadi.ArchiveMailAgent"), QLatin1String("/ArchiveMailAgent"),QDBusConnection::sessionBus(), this);
52  if (archiveMailInterface.isValid()) {
53  archiveMailInterface.showConfigureDialog( (qlonglong)mParentWidget->winId() );
54  } else {
55  KMessageBox::error(mParentWidget,i18n("Archive Mail Agent was not registered."));
56  }
57 }
58 
59 void KMLaunchExternalComponent::slotConfigureSendLater()
60 {
61  OrgFreedesktopAkonadiSendLaterAgentInterface sendLaterInterface(QLatin1String("org.freedesktop.Akonadi.SendLaterAgent"), QLatin1String("/SendLaterAgent"),QDBusConnection::sessionBus(), this);
62  if (sendLaterInterface.isValid()) {
63  sendLaterInterface.showConfigureDialog( (qlonglong)mParentWidget->winId() );
64  } else {
65  KMessageBox::error(mParentWidget,i18n("Send Later Agent was not registered."));
66  }
67 }
68 
69 void KMLaunchExternalComponent::slotConfigureFollowupReminder()
70 {
71  OrgFreedesktopAkonadiFollowUpReminderAgentInterface followUpInterface(QLatin1String("org.freedesktop.Akonadi.FollowUpReminder"), QLatin1String("/FollowUpReminder"),QDBusConnection::sessionBus(), this);
72  if (followUpInterface.isValid()) {
73  followUpInterface.showConfigureDialog( (qlonglong)mParentWidget->winId() );
74  } else {
75  KMessageBox::error(mParentWidget,i18n("Followup Reminder Agent was not registered."));
76  }
77 }
78 
79 void KMLaunchExternalComponent::slotStartCertManager()
80 {
81  if ( !QProcess::startDetached(QLatin1String("kleopatra") ) )
82  KMessageBox::error( mParentWidget, i18n( "Could not start certificate manager; "
83  "please check your installation." ),
84  i18n( "KMail Error" ) );
85  else
86  qDebug() << "slotStartCertManager(): certificate manager started.";
87 }
88 
89 void KMLaunchExternalComponent::slotStartWatchGnuPG()
90 {
91  if ( !QProcess::startDetached(QLatin1String("kwatchgnupg")) )
92  KMessageBox::error( mParentWidget, i18n( "Could not start GnuPG LogViewer (kwatchgnupg); "
93  "please check your installation." ),
94  i18n( "KMail Error" ) );
95 }
96 
97 void KMLaunchExternalComponent::slotImportWizard()
98 {
99  const QString path = KStandardDirs::findExe( QLatin1String("importwizard" ) );
100  if ( !QProcess::startDetached( path ) )
101  KMessageBox::error( mParentWidget, i18n( "Could not start the import wizard. "
102  "Please check your installation." ),
103  i18n( "Unable to start import wizard" ) );
104 }
105 
106 void KMLaunchExternalComponent::slotExportData()
107 {
108  const QString path = KStandardDirs::findExe( QLatin1String("pimsettingexporter" ) );
109  if ( !QProcess::startDetached( path ) )
110  KMessageBox::error( mParentWidget, i18n( "Could not start \"PIM Setting Exporter\" program. "
111  "Please check your installation." ),
112  i18n( "Unable to start \"PIM Setting Exporter\" program" ) );
113 }
114 
115 void KMLaunchExternalComponent::slotAddrBook()
116 {
117  KRun::runCommand(QLatin1String("kaddressbook"), mParentWidget->window());
118 }
119 
120 void KMLaunchExternalComponent::slotImport()
121 {
122  KRun::runCommand(QLatin1String("kmailcvt"), mParentWidget->window());
123 }
124 
125 void KMLaunchExternalComponent::slotAccountWizard()
126 {
127  QStringList lst;
128  lst.append( QLatin1String("--type") );
129  lst.append( QLatin1String("message/rfc822") );
130 
131  const QString path = KStandardDirs::findExe( QLatin1String("accountwizard" ) );
132  if( !QProcess::startDetached( path, lst ) )
133  KMessageBox::error( mParentWidget, i18n( "Could not start the account wizard. "
134  "Please check your installation." ),
135  i18n( "Unable to start account wizard" ) );
136 }
137 
138 void KMLaunchExternalComponent::slotAntiSpamWizard()
139 {
140  KMail::AntiSpamWizard wiz( KMail::AntiSpamWizard::AntiSpam, mParentWidget );
141  wiz.exec();
142 }
143 
144 void KMLaunchExternalComponent::slotAntiVirusWizard()
145 {
146  KMail::AntiSpamWizard wiz( KMail::AntiSpamWizard::AntiVirus, mParentWidget);
147  wiz.exec();
148 }
149 
150 void KMLaunchExternalComponent::slotFilterLogViewer()
151 {
152  MailCommon::FilterManager::instance()->showFilterLogDialog( (qlonglong)mParentWidget->winId() );
153 }
154 
155 void KMLaunchExternalComponent::slotShowTip()
156 {
157  KTipDialog::showTip( mParentWidget, QString(), true );
158 }
QWidget
antispamwizard.h
KMLaunchExternalComponent::slotConfigureFollowupReminder
void slotConfigureFollowupReminder()
Definition: kmlaunchexternalcomponent.cpp:69
QWidget::window
QWidget * window() const
KMLaunchExternalComponent::slotFilterLogViewer
void slotFilterLogViewer()
Definition: kmlaunchexternalcomponent.cpp:150
KMLaunchExternalComponent::slotAddrBook
void slotAddrBook()
Definition: kmlaunchexternalcomponent.cpp:115
QProcess::startDetached
bool startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid)
QDBusConnection::sessionBus
QDBusConnection sessionBus()
KMLaunchExternalComponent::slotAntiVirusWizard
void slotAntiVirusWizard()
Definition: kmlaunchexternalcomponent.cpp:144
QList::append
void append(const T &value)
QObject
KMail::AntiSpamWizard
KMail anti-spam wizard.
Definition: antispamwizard.h:104
KMLaunchExternalComponent::slotImport
void slotImport()
Definition: kmlaunchexternalcomponent.cpp:120
KMLaunchExternalComponent::KMLaunchExternalComponent
KMLaunchExternalComponent(QWidget *parentWidget, QObject *parent=0)
Definition: kmlaunchexternalcomponent.cpp:37
QWidget::winId
WId winId() const
QString
KMLaunchExternalComponent::slotExportData
void slotExportData()
Definition: kmlaunchexternalcomponent.cpp:106
util.h
KMLaunchExternalComponent::slotImportWizard
void slotImportWizard()
Definition: kmlaunchexternalcomponent.cpp:97
QStringList
kmlaunchexternalcomponent.h
KMLaunchExternalComponent::slotAccountWizard
void slotAccountWizard()
Definition: kmlaunchexternalcomponent.cpp:125
QLatin1String
KMLaunchExternalComponent::~KMLaunchExternalComponent
~KMLaunchExternalComponent()
Definition: kmlaunchexternalcomponent.cpp:44
KMail::AntiSpamWizard::AntiSpam
Definition: antispamwizard.h:112
KMLaunchExternalComponent::slotConfigureSendLater
void slotConfigureSendLater()
Definition: kmlaunchexternalcomponent.cpp:59
KMLaunchExternalComponent::slotStartCertManager
void slotStartCertManager()
Definition: kmlaunchexternalcomponent.cpp:79
KMLaunchExternalComponent::slotStartWatchGnuPG
void slotStartWatchGnuPG()
Definition: kmlaunchexternalcomponent.cpp:89
KMLaunchExternalComponent::slotConfigureAutomaticArchiving
void slotConfigureAutomaticArchiving()
Definition: kmlaunchexternalcomponent.cpp:49
KMail::AntiSpamWizard::AntiVirus
Definition: antispamwizard.h:112
KMLaunchExternalComponent::slotAntiSpamWizard
void slotAntiSpamWizard()
Definition: kmlaunchexternalcomponent.cpp:138
KMLaunchExternalComponent::slotShowTip
void slotShowTip()
Definition: kmlaunchexternalcomponent.cpp:155
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal