plugin.h
1 /*
2  This file is part of KDE Kontact.
3 
4  Copyright (c) 2001 Matthias Hoelzer-Kluepfel <mhk@kde.org>
5  Copyright (c) 2002-2003 Daniel Molkentin <molkentin@kde.org>
6  Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
23 
24 #ifndef KONTACT_PLUGIN_H
25 #define KONTACT_PLUGIN_H
26 
27 #include <tqobject.h>
28 #include <kxmlguiclient.h>
29 #include <kdepimmacros.h>
30 #include <tqptrlist.h>
31 
32 class TQStringList;
33 class DCOPClient;
34 class DCOPObject;
35 class KAboutData;
36 class KAction;
37 class KConfig;
38 class TQWidget;
39 namespace KParts { class ReadOnlyPart; }
40 
45 #define KONTACT_PLUGIN_VERSION 6
46 
47 namespace Kontact
48 {
49 
50 class Core;
51 class Summary;
52 
58 class KDE_EXPORT Plugin : public TQObject, virtual public KXMLGUIClient
59 {
60  Q_OBJECT
61  TQ_OBJECT
62 
63  public:
72  Plugin( Core *core, TQObject *parent, const char *name );
73 
74  ~Plugin();
75 
79  void setIdentifier( const TQString &identifier );
80 
85  TQString identifier() const;
86 
90  void setTitle( const TQString &title );
91 
95  TQString title() const;
96 
100  void setIcon( const TQString &icon );
101 
105  TQString icon() const;
106 
110  void setExecutableName( const TQString &bin );
111 
115  TQString executableName() const;
116 
120  void setPartLibraryName( const TQCString & );
121 
126  virtual bool createDCOPInterface( const TQString& /*serviceType*/ ) { return false; }
127 
132  virtual bool isRunningStandalone() { return false; }
133 
139  virtual void bringToForeground();
140 
145  virtual const KAboutData *aboutData();
146 
152  KParts::ReadOnlyPart *part();
153 
157  virtual TQString tipFile() const;
158 
163  virtual void select();
164 
169  virtual void configUpdated();
170 
175  virtual Summary *createSummaryWidget( TQWidget * /*parent*/ ) { return 0; }
176 
180  virtual bool showInSideBar() const;
181 
185  void setShowInSideBar( bool hasPart );
186 
192  virtual bool queryClose() const { return true; }
193 
203  DCOPClient *dcopClient() const;
204 
209  virtual int weight() const { return 0; }
210 
214  void insertNewAction( KAction *action );
215 
219  void insertSyncAction( KAction *action );
220 
224  TQPtrList<KAction>* newActions() const;
225 
229  TQPtrList<KAction>* syncActions() const;
230 
234  virtual TQStringList invisibleToolbarActions() const { return TQStringList(); }
235 
239  virtual bool canDecodeDrag( TQMimeSource * ) { return false; }
240 
244  virtual void processDropEvent( TQDropEvent * ) {}
245 
246  virtual void loadProfile( const TQString& directoryPath );
247 
248  virtual void saveToProfile( const TQString& directoryPath ) const;
249 
253  virtual void readProperties( KConfig * ) {}
254 
258  virtual void saveProperties( KConfig * ) {}
259 
260  Core *core() const;
261 
262  bool disabled() const;
263  void setDisabled( bool v );
264 
265  public slots:
269  void slotConfigUpdated();
270 
271  protected:
276  virtual KParts::ReadOnlyPart *createPart() = 0;
277 
278  KParts::ReadOnlyPart *loadPart();
279 
280  virtual void virtual_hook( int id, void* data );
281 
282  private slots:
283  void partDestroyed();
284 
285  private:
286  class Private;
287  Private *d;
288 };
289 
290 }
291 
292 #endif