kontact
akregator_plugin.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <qwidget.h>
00026
00027 #include <dcopclient.h>
00028 #include <dcopref.h>
00029 #include <kaboutdata.h>
00030 #include <kaction.h>
00031 #include <kapplication.h>
00032 #include <kcmdlineargs.h>
00033 #include <kdebug.h>
00034 #include <kgenericfactory.h>
00035 #include <kiconloader.h>
00036 #include <kmessagebox.h>
00037 #include <kparts/componentfactory.h>
00038
00039 #include <core.h>
00040 #include <plugin.h>
00041
00042 #include <akregator_options.h>
00043 #include "akregator_plugin.h"
00044 namespace Akregator {
00045
00046 typedef KGenericFactory<Akregator::Plugin, Kontact::Core > PluginFactory;
00047 K_EXPORT_COMPONENT_FACTORY( libkontact_akregator,
00048 PluginFactory( "kontact_akregator" ) )
00049
00050 Plugin::Plugin( Kontact::Core *core, const char *, const QStringList& )
00051 : Kontact::Plugin( core, core, "akregator" ), m_stub(0)
00052 {
00053
00054 setInstance( PluginFactory::instance() );
00055
00056 insertNewAction( new KAction( i18n( "New Feed..." ), "bookmark_add", CTRL+SHIFT+Key_F, this, SLOT( addFeed() ), actionCollection(), "feed_new" ) );
00057
00058 m_uniqueAppWatcher = new Kontact::UniqueAppWatcher(
00059 new Kontact::UniqueAppHandlerFactory<Akregator::UniqueAppHandler>(), this );
00060 }
00061
00062 Plugin::~Plugin()
00063 {
00064 }
00065
00066 bool Plugin::isRunningStandalone()
00067 {
00068 return m_uniqueAppWatcher->isRunningStandalone();
00069 }
00070
00071 QStringList Plugin::invisibleToolbarActions() const
00072 {
00073 return QStringList( "file_new_contact" );
00074 }
00075
00076
00077 Akregator::AkregatorPartIface_stub *Plugin::interface()
00078 {
00079 if ( !m_stub ) {
00080 part();
00081 }
00082
00083 Q_ASSERT( m_stub );
00084 return m_stub;
00085 }
00086
00087
00088 MyBasePart* Plugin::createPart()
00089 {
00090 MyBasePart* p = loadPart();
00091
00092 connect(p, SIGNAL(showPart()), this, SLOT(showPart()));
00093 m_stub = new Akregator::AkregatorPartIface_stub( dcopClient(), "akregator",
00094 "AkregatorIface" );
00095 m_stub->openStandardFeedList();
00096 return p;
00097 }
00098
00099
00100 void Plugin::showPart()
00101 {
00102 core()->selectPlugin(this);
00103 }
00104
00105 void Plugin::addFeed()
00106 {
00107 interface()->addFeed();
00108 }
00109
00110 QStringList Plugin::configModules() const
00111 {
00112 QStringList modules;
00113 modules << "PIM/akregator.desktop";
00114 return modules;
00115 }
00116
00117 void UniqueAppHandler::loadCommandLineOptions()
00118 {
00119 KCmdLineArgs::addCmdLineOptions( akregator_options );
00120 }
00121
00122 int UniqueAppHandler::newInstance()
00123 {
00124 kdDebug(5602) << k_funcinfo << endl;
00125
00126 (void)plugin()->part();
00127 DCOPRef akr( "akregator", "AkregatorIface" );
00128
00129
00130
00131
00132
00133 return Kontact::UniqueAppHandler::newInstance();
00134
00135
00136 }
00137
00138 }
00139 #include "akregator_plugin.moc"
|