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 <tdepimmacros.h> 00030 #include <tqptrlist.h> 00031 00032 class TQStringList; 00033 class DCOPClient; 00034 class DCOPObject; 00035 class TDEAboutData; 00036 class TDEAction; 00037 class TDEConfig; 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 00062 public: 00071 Plugin( Core *core, TQObject *parent, const char *name ); 00072 00073 virtual ~Plugin(); 00074 00078 void setIdentifier( const TQString &identifier ); 00079 00084 TQString identifier() const; 00085 00089 void setTitle( const TQString &title ); 00090 00094 TQString title() const; 00095 00099 void setIcon( const TQString &icon ); 00100 00104 TQString icon() const; 00105 00109 void setExecutableName( const TQString &bin ); 00110 00114 TQString executableName() const; 00115 00119 void setPartLibraryName( const TQCString & ); 00120 00125 virtual bool createDCOPInterface( const TQString& /*serviceType*/ ) { return false; } 00126 00131 virtual bool isRunningStandalone() { return false; } 00132 00138 virtual void bringToForeground(); 00139 00144 virtual const TDEAboutData *aboutData(); 00145 00151 KParts::ReadOnlyPart *part(); 00152 00156 virtual TQString tipFile() const; 00157 00162 virtual void select(); 00163 00168 virtual void configUpdated(); 00169 00174 virtual Summary *createSummaryWidget( TQWidget * /*parent*/ ) { return 0; } 00175 00179 virtual bool showInSideBar() const; 00180 00184 void setShowInSideBar( bool hasPart ); 00185 00191 virtual bool queryClose() const { return true; } 00192 00202 DCOPClient *dcopClient() const; 00203 00208 virtual int weight() const { return 0; } 00209 00213 void insertNewAction( TDEAction *action ); 00214 00218 void insertSyncAction( TDEAction *action ); 00219 00223 TQPtrList<TDEAction>* newActions() const; 00224 00228 TQPtrList<TDEAction>* syncActions() const; 00229 00233 virtual TQStringList invisibleToolbarActions() const { return TQStringList(); } 00234 00238 virtual bool canDecodeDrag( TQMimeSource * ) { return false; } 00239 00243 virtual void processDropEvent( TQDropEvent * ) {} 00244 00245 virtual void loadProfile( const TQString& directoryPath ); 00246 00247 virtual void saveToProfile( const TQString& directoryPath ) const; 00248 00252 virtual void readProperties( TDEConfig * ) {} 00253 00257 virtual void saveProperties( TDEConfig * ) {} 00258 00259 Core *core() const; 00260 00261 bool disabled() const; 00262 void setDisabled( bool v ); 00263 00264 public slots: 00268 void slotConfigUpdated(); 00269 00270 protected: 00275 virtual KParts::ReadOnlyPart *createPart() = 0; 00276 00277 KParts::ReadOnlyPart *loadPart(); 00278 00279 virtual void virtual_hook( int id, void* data ); 00280 00281 private slots: 00282 void partDestroyed(); 00283 00284 private: 00285 class Private; 00286 Private *d; 00287 }; 00288 00289 } 00290 00291 #endif