plugin.h
00001 /* 00002 This file is part of KDE Kontact. 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 KONTACT_PLUGIN_H 00025 #define KONTACT_PLUGIN_H 00026 00027 #include <tqobject.h> 00028 #include <kxmlguiclient.h> 00029 #include <kdepimmacros.h> 00030 #include <tqptrlist.h> 00031 00032 class TQStringList; 00033 class DCOPClient; 00034 class DCOPObject; 00035 class KAboutData; 00036 class KAction; 00037 class KConfig; 00038 class TQWidget; 00039 namespace KParts { class ReadOnlyPart; } 00040 00045 #define KONTACT_PLUGIN_VERSION 6 00046 00047 namespace Kontact 00048 { 00049 00050 class Core; 00051 class Summary; 00052 00058 class KDE_EXPORT Plugin : public TQObject, virtual public KXMLGUIClient 00059 { 00060 Q_OBJECT 00061 TQ_OBJECT 00062 00063 public: 00072 Plugin( Core *core, TQObject *parent, const char *name ); 00073 00074 ~Plugin(); 00075 00079 void setIdentifier( const TQString &identifier ); 00080 00085 TQString identifier() const; 00086 00090 void setTitle( const TQString &title ); 00091 00095 TQString title() const; 00096 00100 void setIcon( const TQString &icon ); 00101 00105 TQString icon() const; 00106 00110 void setExecutableName( const TQString &bin ); 00111 00115 TQString executableName() const; 00116 00120 void setPartLibraryName( const TQCString & ); 00121 00126 virtual bool createDCOPInterface( const TQString& /*serviceType*/ ) { return false; } 00127 00132 virtual bool isRunningStandalone() { return false; } 00133 00139 virtual void bringToForeground(); 00140 00145 virtual const KAboutData *aboutData(); 00146 00152 KParts::ReadOnlyPart *part(); 00153 00157 virtual TQString tipFile() const; 00158 00163 virtual void select(); 00164 00169 virtual void configUpdated(); 00170 00175 virtual Summary *createSummaryWidget( TQWidget * /*parent*/ ) { return 0; } 00176 00180 virtual bool showInSideBar() const; 00181 00185 void setShowInSideBar( bool hasPart ); 00186 00192 virtual bool queryClose() const { return true; } 00193 00203 DCOPClient *dcopClient() const; 00204 00209 virtual int weight() const { return 0; } 00210 00214 void insertNewAction( KAction *action ); 00215 00219 void insertSyncAction( KAction *action ); 00220 00224 TQPtrList<KAction>* newActions() const; 00225 00229 TQPtrList<KAction>* syncActions() const; 00230 00234 virtual TQStringList invisibleToolbarActions() const { return TQStringList(); } 00235 00239 virtual bool canDecodeDrag( TQMimeSource * ) { return false; } 00240 00244 virtual void processDropEvent( TQDropEvent * ) {} 00245 00246 virtual void loadProfile( const TQString& directoryPath ); 00247 00248 virtual void saveToProfile( const TQString& directoryPath ) const; 00249 00253 virtual void readProperties( KConfig * ) {} 00254 00258 virtual void saveProperties( KConfig * ) {} 00259 00260 Core *core() const; 00261 00262 bool disabled() const; 00263 void setDisabled( bool v ); 00264 00265 public slots: 00269 void slotConfigUpdated(); 00270 00271 protected: 00276 virtual KParts::ReadOnlyPart *createPart() = 0; 00277 00278 KParts::ReadOnlyPart *loadPart(); 00279 00280 virtual void virtual_hook( int id, void* data ); 00281 00282 private slots: 00283 void partDestroyed(); 00284 00285 private: 00286 class Private; 00287 Private *d; 00288 }; 00289 00290 } 00291 00292 #endif