• 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
  • akregator
akregator_plugin.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2004 Sashmit Bhaduri <smt@vfemail.net>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program 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
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License along
17  with this program; if not, write to the Free Software Foundation, Inc.,
18  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of Qt, and distribute the resulting executable,
22  without including the source code for Qt in the source distribution.
23 */
24 
25 #include "akregator_plugin.h"
26 #include "akregator_part.h"
27 #include "akregator_options.h"
28 #include "partinterface.h"
29 
30 #include <KontactInterface/Core>
31 
32 #include <KAction>
33 #include <KActionCollection>
34 #include <KLocalizedString>
35 
36 EXPORT_KONTACT_PLUGIN( AkregatorPlugin, akregator )
37 
38 AkregatorPlugin::AkregatorPlugin( KontactInterface::Core *core, const QVariantList & )
39  : KontactInterface::Plugin( core, core, "akregator" ), m_interface( 0 )
40 {
41 
42  setComponentData( KontactPluginFactory::componentData() );
43 
44  KAction *action =
45  new KAction( KIcon( QLatin1String("bookmark-new") ),
46  i18nc( "@action:inmenu", "New Feed..." ), this );
47  actionCollection()->addAction( QLatin1String("feed_new"), action );
48  action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_F ) );
49  action->setHelpText(
50  i18nc( "@info:status", "Create a new feed" ) );
51  action->setWhatsThis(
52  i18nc( "@info:whatsthis",
53  "You will be presented with a dialog where you can add a new feed." ) );
54  connect( action, SIGNAL(triggered(bool)), SLOT(addFeed()) );
55  insertNewAction( action );
56 
57  mUniqueAppWatcher = new KontactInterface::UniqueAppWatcher(
58  new KontactInterface::UniqueAppHandlerFactory<AkregatorUniqueAppHandler>(), this );
59 }
60 
61 AkregatorPlugin::~AkregatorPlugin()
62 {
63  delete m_interface;
64  m_interface = 0;
65 }
66 
67 bool AkregatorPlugin::isRunningStandalone() const
68 {
69  return mUniqueAppWatcher->isRunningStandalone();
70 }
71 
72 QStringList AkregatorPlugin::invisibleToolbarActions() const
73 {
74  return QStringList() <<QLatin1String("file_new_contact" );
75 }
76 
77 OrgKdeAkregatorPartInterface *AkregatorPlugin::interface()
78 {
79  if ( !m_interface ) {
80  part();
81  }
82  Q_ASSERT( m_interface );
83  return m_interface;
84 
85 }
86 
87 QString AkregatorPlugin::tipFile() const
88 {
89  // TODO: tips file
90  //QString file = KStandardDirs::locate("data", "akregator/tips");
91  QString file;
92  return file;
93 }
94 
95 KParts::ReadOnlyPart *AkregatorPlugin::createPart()
96 {
97  KParts::ReadOnlyPart *part = loadPart();
98  if ( !part ) {
99  return 0;
100  }
101 
102  m_interface = new OrgKdeAkregatorPartInterface(
103  QLatin1String("org.kde.akregator"), QLatin1String("/Akregator"), QDBusConnection::sessionBus() );
104  m_interface->openStandardFeedList();
105 
106  return part;
107 }
108 
109 void AkregatorPlugin::addFeed()
110 {
111  // Ensure part is loaded
112  (void)part();
113 
114  org::kde::akregator::part akregator(
115  QLatin1String("org.kde.akregator"), QLatin1String("/Akregator"), QDBusConnection::sessionBus() );
116  akregator.addFeed();
117 }
118 
119 QStringList AkregatorPlugin::configModules() const
120 {
121  QStringList modules;
122  modules << QLatin1String("PIM/akregator.desktop");
123  return modules;
124 }
125 
126 void AkregatorPlugin::readProperties( const KConfigGroup &config )
127 {
128  if ( part() ) {
129  Akregator::Part *myPart = static_cast<Akregator::Part*>( part() );
130  myPart->readProperties( config );
131  }
132 }
133 
134 void AkregatorPlugin::saveProperties( KConfigGroup &config )
135 {
136  if ( part() ) {
137  Akregator::Part *myPart = static_cast<Akregator::Part*>( part() );
138  myPart->saveProperties( config );
139  }
140 }
141 
142 void AkregatorUniqueAppHandler::loadCommandLineOptions()
143 {
144  KCmdLineArgs::addCmdLineOptions( Akregator::akregator_options() );
145 }
146 
147 int AkregatorUniqueAppHandler::newInstance()
148 {
149  // Ensure part is loaded
150  (void)plugin()->part();
151 
152  org::kde::akregator::part akregator(
153  QLatin1String("org.kde.akregator"), QLatin1String("/Akregator"), QDBusConnection::sessionBus() );
154  akregator.openStandardFeedList();
155  akregator.handleCommandLine();
156 
157  return KontactInterface::UniqueAppHandler::newInstance();
158 }
159 
AkregatorPlugin::mUniqueAppWatcher
KontactInterface::UniqueAppWatcher * mUniqueAppWatcher
Definition: akregator_plugin.h:69
AkregatorPlugin::m_interface
OrgKdeAkregatorPartInterface * m_interface
Definition: akregator_plugin.h:70
AkregatorPlugin::createPart
KParts::ReadOnlyPart * createPart()
Definition: akregator_plugin.cpp:95
AkregatorPlugin::readProperties
virtual void readProperties(const KConfigGroup &config)
Definition: akregator_plugin.cpp:126
QDBusConnection::sessionBus
QDBusConnection sessionBus()
AkregatorPlugin::configModules
virtual QStringList configModules() const
Definition: akregator_plugin.cpp:119
AkregatorPlugin::invisibleToolbarActions
QStringList invisibleToolbarActions() const
Definition: akregator_plugin.cpp:72
AkregatorPlugin
Definition: akregator_plugin.h:45
akregator_plugin.h
QString
AkregatorPlugin::tipFile
QString tipFile() const
Definition: akregator_plugin.cpp:87
QStringList
AkregatorPlugin::isRunningStandalone
bool isRunningStandalone() const
Definition: akregator_plugin.cpp:67
AkregatorPlugin::saveProperties
virtual void saveProperties(KConfigGroup &config)
Definition: akregator_plugin.cpp:134
QLatin1String
QKeySequence
AkregatorPlugin::interface
OrgKdeAkregatorPartInterface * interface()
Definition: akregator_plugin.cpp:77
AkregatorUniqueAppHandler::newInstance
virtual int newInstance()
Definition: akregator_plugin.cpp:147
AkregatorUniqueAppHandler::loadCommandLineOptions
virtual void loadCommandLineOptions()
Definition: akregator_plugin.cpp:142
AkregatorPlugin::~AkregatorPlugin
~AkregatorPlugin()
Definition: akregator_plugin.cpp:61
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