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

kontact

  • sources
  • kde-4.14
  • kdepim
  • kontact
  • plugins
  • summary
summaryview_plugin.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the KDE project
3 
4  Copyright (C) 2003 Sven L�ppken <sven@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20  */
21 
22 #include "summaryview_plugin.h"
23 #include "summaryview_part.h"
24 #include "kdepim-version.h"
25 #ifdef KMAIL_SUPPORTED
26 #include "kmailinterface.h"
27 #endif
28 
29 #include <KontactInterface/Core>
30 
31 #include <KAboutData>
32 #include <KActionCollection>
33 #include <KIcon>
34 #include <KLocalizedString>
35 #include <KSelectAction>
36 
37 #include <QMenu>
38 
39 EXPORT_KONTACT_PLUGIN( SummaryView, summary )
40 
41 SummaryView::SummaryView( KontactInterface::Core *core, const QVariantList & )
42  : KontactInterface::Plugin( core, core, 0 ), mAboutData( 0 ), mPart( 0 )
43 {
44  setComponentData( KontactPluginFactory::componentData() );
45 
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()) );
50 
51  insertSyncAction( mSyncAction );
52  fillSyncActionSubEntries();
53 }
54 
55 void SummaryView::fillSyncActionSubEntries()
56 {
57  QStringList menuItems;
58  menuItems.append( i18nc( "@action:inmenu sync everything", "All" ) );
59 
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();
65  }
66 #endif
67 
68  mSyncAction->clear();
69  mSyncAction->setItems( menuItems );
70 }
71 
72 void SummaryView::syncAccount( const QString &account )
73 {
74  if ( account == i18nc( "sync everything", "All" ) ) {
75  doSync();
76  } else {
77 #ifdef KMAIL_SUPPORTED
78  org::kde::kmail::kmail kmail( QLatin1String("org.kde.kmail"), QLatin1String("/KMail"),
79  QDBusConnection::sessionBus() );
80  kmail.checkAccount( account );
81 #endif
82  }
83  fillSyncActionSubEntries();
84 }
85 
86 SummaryView::~SummaryView()
87 {
88 }
89 
90 void SummaryView::doSync()
91 {
92  if ( mPart ) {
93  mPart->updateSummaries();
94  }
95 
96  const QList<KontactInterface::Plugin *> pluginList = core()->pluginList();
97  Q_FOREACH ( const KontactInterface::Plugin *i, pluginList ) {
98  // execute all sync actions but our own
99  Q_FOREACH ( KAction *j, i->syncActions() ) {
100  if ( j != mSyncAction ) {
101  j->trigger();
102  }
103  }
104  }
105  fillSyncActionSubEntries();
106 }
107 
108 KParts::ReadOnlyPart *SummaryView::createPart()
109 {
110  mPart = new SummaryViewPart( core(), "summarypartframe", aboutData(), this );
111  mPart->setObjectName( QLatin1String("summaryPart") );
112  return mPart;
113 }
114 
115 const KAboutData *SummaryView::aboutData() const
116 {
117  if ( !mAboutData ) {
118  mAboutData = new KAboutData(
119  "kontactsummary", 0, ki18n( "Kontact Summary" ),
120  KDEPIM_VERSION,
121  ki18n( "Kontact Summary View" ),
122  KAboutData::License_LGPL,
123  ki18n( "(c) 2003-2014 The Kontact developers" ) );
124 
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" );
132  }
133 
134  return mAboutData;
135 }
136 
QDBusReply
QDBusReply::isValid
bool isValid() const
QDBusConnection::sessionBus
QDBusConnection sessionBus()
SummaryView
Definition: summaryview_plugin.h:30
QList::append
void append(const T &value)
SummaryView::~SummaryView
~SummaryView()
Definition: summaryview_plugin.cpp:86
QDBusReply::value
Type value() const
QString
QList< KontactInterface::Plugin * >
QStringList
SummaryView::aboutData
const KAboutData * aboutData() const
Definition: summaryview_plugin.cpp:115
SummaryViewPart
Definition: summaryview_part.h:43
summaryview_plugin.h
SummaryView::createPart
virtual KParts::ReadOnlyPart * createPart()
Definition: summaryview_plugin.cpp:108
summaryview_part.h
QLatin1String
SummaryViewPart::updateSummaries
void updateSummaries()
Definition: summaryview_part.cpp:106
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kontact

Skip menu "kontact"
  • Main Page
  • Namespace List
  • 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