plugin.h
00001 /* 00002 This file is part of the KDE Kontact Plugin Interface Library. 00003 00004 Copyright (c) 2001 Matthias Hoelzer-Kluepfel <mhk@kde.org> 00005 Copyright (c) 2002-2003 Daniel Molkentin <molkentin@kde.org> 00006 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License as published by the Free Software Foundation; either 00011 version 2 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to 00020 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. 00022 */ 00023 00024 #ifndef KONTACTINTERFACE_PLUGIN_H 00025 #define KONTACTINTERFACE_PLUGIN_H 00026 00027 #include "kontactinterface_export.h" 00028 00029 #include <kpluginfactory.h> 00030 #include <kxmlguiclient.h> 00031 00032 #include <QtCore/QList> 00033 #include <QtCore/QObject> 00034 00035 class KAboutData; 00036 class KAction; 00037 class KConfig; 00038 class KConfigGroup; 00039 class QDropEvent; 00040 class QMimeData; 00041 class QStringList; 00042 class QWidget; 00043 namespace KParts { 00044 class ReadOnlyPart; 00045 } 00046 00050 #define EXPORT_KONTACT_PLUGIN( pluginclass, pluginname ) \ 00051 class Instance \ 00052 { \ 00053 public: \ 00054 static QObject *createInstance( QWidget *, QObject *parent, const QVariantList &list ) \ 00055 { return new pluginclass( static_cast<KontactInterface::Core*>( parent ), list ); } \ 00056 }; \ 00057 K_PLUGIN_FACTORY( KontactPluginFactory, registerPlugin< pluginclass > \ 00058 ( QString(), Instance::createInstance ); ) \ 00059 K_EXPORT_PLUGIN( KontactPluginFactory( "kontact_" #pluginname "plugin" ) ) 00060 00064 #define KONTACT_PLUGIN_VERSION 9 00065 00066 namespace KontactInterface 00067 { 00068 00069 class Core; 00070 class Summary; 00071 00078 class KONTACTINTERFACE_EXPORT Plugin : public QObject, virtual public KXMLGUIClient 00079 { 00080 Q_OBJECT 00081 00082 public: 00093 Plugin( Core *core, QObject *parent, const char *appName, const char *pluginName = 0 ); 00094 00098 virtual ~Plugin(); 00099 00103 void setIdentifier( const QString &identifier ); 00104 00108 QString identifier() const; 00109 00113 void setTitle( const QString &title ); 00114 00118 QString title() const; 00119 00123 void setIcon( const QString &icon ); 00124 00128 QString icon() const; 00129 00133 void setExecutableName( const QString &name ); 00134 00138 QString executableName() const; 00139 00143 void setPartLibraryName( const QByteArray &name ); 00144 00149 virtual bool createDBUSInterface( const QString &serviceType ); 00150 00156 virtual bool isRunningStandalone() const; 00157 00163 virtual void bringToForeground(); 00164 00169 virtual const KAboutData *aboutData() const; 00170 00176 KParts::ReadOnlyPart *part(); 00177 00183 virtual QString tipFile() const; 00184 00189 virtual void select(); 00190 00196 void aboutToSelect(); 00197 00202 virtual void configUpdated(); 00203 00210 virtual Summary *createSummaryWidget( QWidget *parent ); 00211 00215 virtual bool showInSideBar() const; 00216 00220 void setShowInSideBar( bool hasPart ); 00221 00228 virtual bool queryClose() const; 00229 00233 QString registerClient(); 00234 00239 virtual int weight() const; 00240 00244 void insertNewAction( KAction *action ); 00245 00249 void insertSyncAction( KAction *action ); 00250 00254 QList<KAction*> newActions() const; 00255 00259 QList<KAction*> syncActions() const; 00260 00264 virtual QStringList invisibleToolbarActions() const; 00265 00269 virtual bool canDecodeMimeData( const QMimeData *data ) const; 00270 00274 virtual void processDropEvent( QDropEvent * ); 00275 00279 virtual void readProperties( const KConfigGroup & ); 00280 00284 virtual void saveProperties( KConfigGroup & ); 00285 00289 Core *core() const; 00290 00294 void setDisabled( bool value ); 00295 00299 bool disabled() const; 00300 00301 public Q_SLOTS: 00307 void slotConfigUpdated(); 00308 00309 protected: 00314 virtual KParts::ReadOnlyPart *createPart() = 0; 00315 00319 KParts::ReadOnlyPart *loadPart(); 00320 00324 virtual void virtual_hook( int id, void *data ); 00325 00326 private: 00327 //@cond PRIVATE 00328 class Private; 00329 Private *const d; 00330 00331 Q_PRIVATE_SLOT( d, void partDestroyed() ) 00332 //@endcond 00333 }; 00334 00335 } 00336 00337 #endif