24 #include "kdepim-version.h"
25 #ifdef KMAIL_SUPPORTED
26 #include "kmailinterface.h"
29 #include <KontactInterface/Core>
32 #include <KActionCollection>
35 #include <KSelectAction>
42 : KontactInterface::Plugin( core, core, 0 ), mAboutData( 0 ), mPart( 0 )
44 setComponentData( KontactPluginFactory::componentData() );
46 mSyncAction =
new KSelectAction( KIcon( QLatin1String(
"view-refresh") ), i18n(
"Sync All" ),
this );
47 actionCollection()->addAction( QLatin1String(
"kontact_summary_sync"), mSyncAction );
48 connect( mSyncAction, SIGNAL(triggered(QString)), SLOT(syncAccount(QString)) );
49 connect( mSyncAction->menu(), SIGNAL(aboutToShow()),
this, SLOT(fillSyncActionSubEntries()) );
51 insertSyncAction( mSyncAction );
52 fillSyncActionSubEntries();
55 void SummaryView::fillSyncActionSubEntries()
57 QStringList menuItems;
58 menuItems.append( i18nc(
"@action:inmenu sync everything",
"All" ) );
60 #ifdef KMAIL_SUPPORTED
61 org::kde::kmail::kmail kmail( QLatin1String(
"org.kde.kmail"), QLatin1String(
"/KMail"), QDBusConnection::sessionBus() );
62 const QDBusReply<QStringList> reply = kmail.accounts();
63 if ( reply.isValid() ) {
64 menuItems << reply.value();
69 mSyncAction->setItems( menuItems );
72 void SummaryView::syncAccount(
const QString &account )
74 if ( account == i18nc(
"sync everything",
"All" ) ) {
77 #ifdef KMAIL_SUPPORTED
78 org::kde::kmail::kmail kmail( QLatin1String(
"org.kde.kmail"), QLatin1String(
"/KMail"),
79 QDBusConnection::sessionBus() );
80 kmail.checkAccount( account );
83 fillSyncActionSubEntries();
90 void SummaryView::doSync()
97 Q_FOREACH (
const KontactInterface::Plugin *i, pluginList ) {
99 Q_FOREACH ( KAction *j, i->syncActions() ) {
100 if ( j != mSyncAction ) {
105 fillSyncActionSubEntries();
111 mPart->setObjectName( QLatin1String(
"summaryPart") );
118 mAboutData =
new KAboutData(
119 "kontactsummary", 0, ki18n(
"Kontact Summary" ),
121 ki18n(
"Kontact Summary View" ),
122 KAboutData::License_LGPL,
123 ki18n(
"(c) 2003-2013 The Kontact developers" ) );
125 mAboutData->addAuthor( ki18n(
"Sven Lueppken" ),
126 KLocalizedString(),
"sven@kde.org" );
127 mAboutData->addAuthor( ki18n(
"Cornelius Schumacher" ),
128 KLocalizedString(),
"schumacher@kde.org" );
129 mAboutData->addAuthor( ki18n(
"Tobias Koenig" ),
130 KLocalizedString(),
"tokoe@kde.org" );
131 mAboutData->setProductName(
"kontact/summary" );
137 #include "summaryview_plugin.moc"
const KAboutData * aboutData() const
virtual KParts::ReadOnlyPart * createPart()