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

kontact

akregator_plugin.cpp

Go to the documentation of this file.
00001 /*
00002   This file is part of Akregator.
00003 
00004   Copyright (C) 2004 Sashmit Bhaduri <smt@vfemail.net>
00005 
00006   This program is free software; you can redistribute it and/or modify
00007   it under the terms of the GNU General Public License as published by
00008   the Free Software Foundation; either version 2 of the License, or
00009   (at your option) any later version.
00010 
00011   This program is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014   GNU General Public License for more details.
00015 
00016   You should have received a copy of the GNU General Public License along
00017   with this program; if not, write to the Free Software Foundation, Inc.,
00018   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 
00020   As a special exception, permission is given to link this program
00021   with any edition of Qt, and distribute the resulting executable,
00022   without including the source code for Qt in the source distribution.
00023 */
00024 
00025 #include "akregator_plugin.h"
00026 #include "partinterface.h"
00027 
00028 #include <akregator_options.h>
00029 #include <akregator_part.h>
00030 
00031 #include <kontactinterfaces/core.h>
00032 #include <kontactinterfaces/plugin.h>
00033 
00034 #include <kaboutdata.h>
00035 #include <kaction.h>
00036 #include <kactioncollection.h>
00037 #include <kcmdlineargs.h>
00038 #include <kdebug.h>
00039 #include <kgenericfactory.h>
00040 #include <kicon.h>
00041 #include <kiconloader.h>
00042 #include <kmessagebox.h>
00043 #include <kparts/componentfactory.h>
00044 
00045 EXPORT_KONTACT_PLUGIN( AkregatorPlugin, akregator )
00046 
00047 AkregatorPlugin::AkregatorPlugin( Kontact::Core *core, const QVariantList & )
00048   : Kontact::Plugin( core, core, "akregator" ), m_interface( 0 )
00049 {
00050 
00051   setComponentData( KontactPluginFactory::componentData() );
00052 
00053   KAction *action  = new KAction( KIcon( "bookmark-new" ), i18n( "New Feed..." ), this );
00054   actionCollection()->addAction( "feed_new", action );
00055   action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_F ) );
00056   connect( action, SIGNAL(triggered(bool)), SLOT(addFeed()) );
00057   insertNewAction( action );
00058 
00059   mUniqueAppWatcher = new Kontact::UniqueAppWatcher(
00060     new Kontact::UniqueAppHandlerFactory<AkregatorUniqueAppHandler>(), this );
00061 }
00062 
00063 AkregatorPlugin::~AkregatorPlugin()
00064 {
00065 }
00066 
00067 bool AkregatorPlugin::isRunningStandalone()
00068 {
00069   return mUniqueAppWatcher->isRunningStandalone();
00070 }
00071 
00072 QStringList AkregatorPlugin::invisibleToolbarActions() const
00073 {
00074   return QStringList( "file_new_contact" );
00075 }
00076 
00077 OrgKdeAkregatorPartInterface *AkregatorPlugin::interface()
00078 {
00079   if ( !m_interface ) {
00080     part();
00081   }
00082   Q_ASSERT( m_interface );
00083   return m_interface;
00084 
00085 }
00086 
00087 QString AkregatorPlugin::tipFile() const
00088 {
00089   // TODO: tips file
00090   //QString file = KStandardDirs::locate("data", "akregator/tips");
00091   QString file;
00092   return file;
00093 }
00094 
00095 KParts::ReadOnlyPart *AkregatorPlugin::createPart()
00096 {
00097   KParts::ReadOnlyPart *part = loadPart();
00098   if ( !part ) {
00099     return 0;
00100   }
00101 
00102   connect( part, SIGNAL(showPart()), this, SLOT(showPart()) );
00103   m_interface = new OrgKdeAkregatorPartInterface(
00104     "org.kde.akregator", "/Akregator", QDBusConnection::sessionBus() );
00105   m_interface->openStandardFeedList();
00106 
00107   return part;
00108 }
00109 
00110 void AkregatorPlugin::showPart()
00111 {
00112   core()->selectPlugin( this );
00113 }
00114 
00115 void AkregatorPlugin::addFeed()
00116 {
00117   (void) part(); // ensure part is loaded
00118   Q_ASSERT( m_interface );
00119   m_interface->addFeed();
00120 }
00121 
00122 QStringList AkregatorPlugin::configModules() const
00123 {
00124   QStringList modules;
00125   modules << "PIM/akregator.desktop";
00126   return modules;
00127 }
00128 
00129 void AkregatorPlugin::readProperties( const KConfigGroup &config )
00130 {
00131   if ( part() ) {
00132     Akregator::Part *myPart = static_cast<Akregator::Part*>( part() );
00133     myPart->readProperties( config );
00134   }
00135 }
00136 
00137 void AkregatorPlugin::saveProperties( KConfigGroup &config )
00138 {
00139   if ( part() ) {
00140     Akregator::Part *myPart = static_cast<Akregator::Part*>( part() );
00141     myPart->saveProperties( config );
00142   }
00143 }
00144 
00145 #include "../../../akregator/src/akregator_options.h"
00146 void AkregatorUniqueAppHandler::loadCommandLineOptions()
00147 {
00148   KCmdLineArgs::addCmdLineOptions( Akregator::akregator_options() );
00149 }
00150 
00151 int AkregatorUniqueAppHandler::newInstance()
00152 {
00153   kDebug();
00154   // Ensure part is loaded
00155   (void)plugin()->part();
00156 
00157   org::kde::akregator::part akregator(
00158     "org.kde.akregator", "/Akregator", QDBusConnection::sessionBus() );
00159   akregator.openStandardFeedList();
00160 
00161   return Kontact::UniqueAppHandler::newInstance();
00162 }
00163 
00164 #include "akregator_plugin.moc"

kontact

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

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal