summaryrefslogtreecommitdiffstats
path: root/kontact/plugins/knode
diff options
context:
space:
mode:
Diffstat (limited to 'kontact/plugins/knode')
-rw-r--r--kontact/plugins/knode/Makefile.am14
-rw-r--r--kontact/plugins/knode/knode_plugin.cpp123
-rw-r--r--kontact/plugins/knode/knode_plugin.h68
-rw-r--r--kontact/plugins/knode/knodeplugin.desktop98
4 files changed, 303 insertions, 0 deletions
diff --git a/kontact/plugins/knode/Makefile.am b/kontact/plugins/knode/Makefile.am
new file mode 100644
index 000000000..bf4ba753a
--- /dev/null
+++ b/kontact/plugins/knode/Makefile.am
@@ -0,0 +1,14 @@
+INCLUDES = -I$(top_srcdir)/kontact/interfaces -I$(top_srcdir)/knode -I$(top_srcdir) $(all_includes)
+
+kde_module_LTLIBRARIES = libkontact_knodeplugin.la
+libkontact_knodeplugin_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkontact_knodeplugin_la_LIBADD = $(top_builddir)/kontact/interfaces/libkpinterfaces.la $(LIB_KPARTS)
+
+libkontact_knodeplugin_la_SOURCES = knode_plugin.cpp knodeiface.stub
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)/kontact
+service_DATA = knodeplugin.desktop
+
+knodeiface_DIR = $(top_srcdir)/knode
diff --git a/kontact/plugins/knode/knode_plugin.cpp b/kontact/plugins/knode/knode_plugin.cpp
new file mode 100644
index 000000000..6ad7fedb1
--- /dev/null
+++ b/kontact/plugins/knode/knode_plugin.cpp
@@ -0,0 +1,123 @@
+/*
+ This file is part of Kontact.
+
+ Copyright (c) 2003 Zack Rusin <zack@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#include "knode_plugin.h"
+
+#include "core.h"
+
+#include <kapplication.h>
+#include <kparts/componentfactory.h>
+#include <kgenericfactory.h>
+#include <kapplication.h>
+#include <kaction.h>
+#include <kiconloader.h>
+#include <kdebug.h>
+
+#include <dcopclient.h>
+
+#include <qwidget.h>
+
+
+typedef KGenericFactory<KNodePlugin, Kontact::Core> KNodePluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libkontact_knodeplugin,
+ KNodePluginFactory( "kontact_knodeplugin" ) )
+
+
+KNodePlugin::KNodePlugin( Kontact::Core *core, const char *, const QStringList& )
+ : Kontact::Plugin( core, core, "knode" ), mStub(0)
+{
+ setInstance( KNodePluginFactory::instance() );
+
+ insertNewAction( new KAction( i18n( "New Article..." ), "mail_new", CTRL+SHIFT+Key_A,
+ this, SLOT( slotPostArticle() ), actionCollection(), "post_article" ) );
+
+ mUniqueAppWatcher = new Kontact::UniqueAppWatcher(
+ new Kontact::UniqueAppHandlerFactory<KNodeUniqueAppHandler>(), this );
+}
+
+KNodePlugin::~KNodePlugin()
+{
+}
+
+bool KNodePlugin::createDCOPInterface( const QString& /*serviceType*/ )
+{
+ return false;
+}
+
+bool KNodePlugin::isRunningStandalone()
+{
+ return mUniqueAppWatcher->isRunningStandalone();
+}
+
+QStringList KNodePlugin::invisibleToolbarActions() const
+{
+ return QStringList( "article_postNew" );
+}
+
+void KNodePlugin::slotPostArticle()
+{
+ (void) part(); // ensure part is loaded
+ Q_ASSERT( mStub );
+ if ( mStub )
+ mStub->postArticle();
+}
+
+KParts::ReadOnlyPart* KNodePlugin::createPart()
+{
+ KParts::ReadOnlyPart *part = loadPart();
+ if ( !part ) return 0;
+
+ mStub = new KNodeIface_stub( dcopClient(), "knode", "KNodeIface" );
+ return part;
+}
+
+////
+
+#include "../../../knode/knode_options.h"
+void KNodeUniqueAppHandler::loadCommandLineOptions()
+{
+ KCmdLineArgs::addCmdLineOptions( knode_options );
+}
+
+int KNodeUniqueAppHandler::newInstance()
+{
+ // Ensure part is loaded
+ (void)plugin()->part();
+ DCOPRef knode( "knode", "KNodeIface" );
+ DCOPReply reply = knode.call( "handleCommandLine" );
+#if 0
+ if ( reply.isValid() ) {
+ bool handled = reply;
+ kdDebug(5602) << k_funcinfo << "handled=" << handled << endl;
+ if ( !handled )
+#endif
+ // in all cases, bring knode plugin to front
+ return Kontact::UniqueAppHandler::newInstance();
+#if 0
+ }
+ return 0;
+#endif
+}
+
+#include "knode_plugin.moc"
diff --git a/kontact/plugins/knode/knode_plugin.h b/kontact/plugins/knode/knode_plugin.h
new file mode 100644
index 000000000..78d4275ed
--- /dev/null
+++ b/kontact/plugins/knode/knode_plugin.h
@@ -0,0 +1,68 @@
+/*
+ This file is part of Kontact.
+
+ Copyright (c) 2003 Zack Rusin <zack@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#ifndef KNODE_PLUGIN_H
+#define KNODE_PLUGIN_H
+
+#include <klocale.h>
+#include <kparts/part.h>
+
+#include "knodeiface_stub.h"
+#include "plugin.h"
+#include <uniqueapphandler.h>
+
+class KNodeUniqueAppHandler : public Kontact::UniqueAppHandler
+{
+public:
+ KNodeUniqueAppHandler( Kontact::Plugin* plugin ) : Kontact::UniqueAppHandler( plugin ) {}
+ virtual void loadCommandLineOptions();
+ virtual int newInstance();
+};
+
+class KNodePlugin : public Kontact::Plugin
+{
+ Q_OBJECT
+
+ public:
+ KNodePlugin( Kontact::Core *core, const char *name, const QStringList& );
+ ~KNodePlugin();
+
+ virtual bool createDCOPInterface( const QString& serviceType );
+ virtual bool isRunningStandalone();
+ int weight() const { return 500; }
+
+ virtual QStringList invisibleToolbarActions() const;
+
+ protected:
+ virtual KParts::ReadOnlyPart* createPart();
+
+ protected slots:
+ void slotPostArticle();
+
+ private:
+ KNodeIface_stub *mStub;
+ Kontact::UniqueAppWatcher *mUniqueAppWatcher;
+};
+
+#endif
diff --git a/kontact/plugins/knode/knodeplugin.desktop b/kontact/plugins/knode/knodeplugin.desktop
new file mode 100644
index 000000000..d84c16f7e
--- /dev/null
+++ b/kontact/plugins/knode/knodeplugin.desktop
@@ -0,0 +1,98 @@
+[Desktop Entry]
+Type=Service
+Icon=kontact_news
+ServiceTypes=Kontact/Plugin,KPluginInfo
+
+X-KDE-Library=libkontact_knodeplugin
+X-KDE-KontactPluginVersion=6
+X-KDE-KontactPartLibraryName=libknodepart
+X-KDE-KontactPartExecutableName=knode
+
+X-KDE-PluginInfo-Name=kontact_knodeplugin
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=false
+
+Comment=Newsreader Component (KNode Plugin)
+Comment[bg]=Приставка за KNode
+Comment[ca]=Component de notícies (endollable del KNode)
+Comment[da]=Nyhedskomponent (KNode-plugin)
+Comment[de]=News-Komponente (KNode-Modul)
+Comment[el]=Συστατικό ανάγνωσης νέων (Πρόσθετο του KNode)
+Comment[es]=Componente de noticias (complemento de KNode)
+Comment[et]=Uudistelugeja plugin (KNode)
+Comment[fr]=Composant de lecteur de nouvelles (Module pour KNode)
+Comment[is]=Fréttaeining (KNode íforrit)
+Comment[it]=Componente lettore di news (plugin KNode)
+Comment[ja]=ニュースリーダーコンポーネント (KNode プラグイン)
+Comment[km]=សមាសភាគ Newsreader (កម្មវិធី​ជំនួយ KNode)
+Comment[nds]=Narichtenkieker-Komponent (KNode-Moduul)
+Comment[nl]=Nieuwscomponent (KNode-plugin)
+Comment[pl]=Składnik wiadomości (wtyczka KNode)
+Comment[ru]=Новости (модуль KNode)
+Comment[sr]=Компонента вести (прикључак KNode-а)
+Comment[sr@Latn]=Komponenta vesti (priključak KNode-a)
+Comment[sv]=Komponent för läsning av diskussionsgrupper (Knode-insticksprogram)
+Comment[tr]=Haber Okuyucu Bileşeni (KNode Eklentisi)
+Comment[zh_CN]=新闻组阅读器组件(KNode 插件)
+Comment[zh_TW]=新聞閱讀器組件(KNode 外掛程式)
+Name=News
+Name[af]=Nuus
+Name[ar]=الأخبار
+Name[be]=Навіны
+Name[bg]=Новини
+Name[br]=Keleier
+Name[bs]=Usenet
+Name[ca]=Notícies
+Name[cs]=Novinky
+Name[cy]=Newyddion
+Name[da]=Nyheder
+Name[de]=Usenet
+Name[el]=Νέα
+Name[eo]=Novaĵoj
+Name[es]=Noticias
+Name[et]=Uudisegrupid
+Name[eu]=Berriak
+Name[fa]=اخبار
+Name[fi]=Uutiset
+Name[fr]=Nouvelles
+Name[fy]=Nijs
+Name[ga]=Nuacht
+Name[gl]=Novas
+Name[he]=חדשות
+Name[hi]=समाचार
+Name[hu]=Hírek
+Name[is]=Fréttir
+Name[ja]=ニュース
+Name[ka]=სიახლეები
+Name[kk]=Жаңалықтар
+Name[km]=ព័ត៌មាន
+Name[lt]=Naujienos
+Name[mk]=Вести
+Name[ms]=Berita
+Name[nb]=Njus
+Name[nds]=Narichten
+Name[ne]=समाचार
+Name[nl]=Nieuws
+Name[nn]=Nyheiter
+Name[pa]=ਖ਼ਬਰਾਂ
+Name[pl]=Listy dyskusyjne
+Name[pt]=Notícias
+Name[pt_BR]=Notícias
+Name[ro]=Ştiri
+Name[ru]=Новости
+Name[se]=Ođđasat
+Name[sk]=Diskusné skupiny
+Name[sl]=Novice
+Name[sr]=Вести
+Name[sr@Latn]=Vesti
+Name[sv]=Nyheter
+Name[ta]=செய்திகள்
+Name[tg]=Ахборот
+Name[th]=ข่าว
+Name[tr]=Haberler
+Name[uk]=Новини
+Name[uz]=Yangiliklar
+Name[uz@cyrillic]=Янгиликлар
+Name[zh_CN]=新闻
+Name[zh_TW]=新聞