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 <tdemacros.h>
30 #include <tqptrlist.h>
31 
32 class TQStringList;
33 class DCOPClient;
34 class DCOPObject;
35 class TDEAboutData;
36 class TDEAction;
37 class TDEConfig;
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 TDE_EXPORT Plugin : public TQObject, virtual public KXMLGUIClient
59 {
60  TQ_OBJECT
61 
62  public:
71  Plugin( Core *core, TQObject *parent, const char *name );
72 
73  virtual ~Plugin();
74 
78  void setIdentifier( const TQString &identifier );
79 
84  TQString identifier() const;
85 
89  void setTitle( const TQString &title );
90 
94  TQString title() const;
95 
99  void setIcon( const TQString &icon );
100 
104  TQString icon() const;
105 
109  void setExecutableName( const TQString &bin );
110 
114  TQString executableName() const;
115 
119  void setPartLibraryName( const TQCString & );
120 
125  virtual bool createDCOPInterface( const TQString& /*serviceType*/ ) { return false; }
126 
131  virtual bool isRunningStandalone() { return false; }
132 
138  virtual void bringToForeground();
139 
144  virtual const TDEAboutData *aboutData();
145 
151  KParts::ReadOnlyPart *part();
152 
156  virtual TQString tipFile() const;
157 
162  virtual void select();
163 
168  virtual void configUpdated();
169 
174  virtual Summary *createSummaryWidget( TQWidget * /*parent*/ ) { return 0; }
175 
179  virtual bool showInSideBar() const;
180 
184  void setShowInSideBar( bool hasPart );
185 
191  virtual bool queryClose() const { return true; }
192 
202  DCOPClient *dcopClient() const;
203 
208  virtual int weight() const { return 0; }
209 
213  void insertNewAction( TDEAction *action );
214 
218  void insertSyncAction( TDEAction *action );
219 
223  TQPtrList<TDEAction>* newActions() const;
224 
228  TQPtrList<TDEAction>* syncActions() const;
229 
233  virtual TQStringList invisibleToolbarActions() const { return TQStringList(); }
234 
238  virtual bool canDecodeDrag( TQMimeSource * ) { return false; }
239 
243  virtual void processDropEvent( TQDropEvent * ) {}
244 
245  virtual void loadProfile( const TQString& directoryPath );
246 
247  virtual void saveToProfile( const TQString& directoryPath ) const;
248 
252  virtual void readProperties( TDEConfig * ) {}
253 
257  virtual void saveProperties( TDEConfig * ) {}
258 
259  Core *core() const;
260 
261  bool disabled() const;
262  void setDisabled( bool v );
263 
264  public slots:
268  void slotConfigUpdated();
269 
270  protected:
275  virtual KParts::ReadOnlyPart *createPart() = 0;
276 
277  KParts::ReadOnlyPart *loadPart();
278 
279  virtual void virtual_hook( int id, void* data );
280 
281  private slots:
282  void partDestroyed();
283 
284  private:
285  class Private;
286  Private *d;
287 };
288 
289 }
290 
291 #endif
This class provides the interface to the Kontact core for the plugins.
Definition: core.h:42
Base class for all Plugins in Kontact.
Definition: plugin.h:59
virtual Summary * createSummaryWidget(TQWidget *)
Reimplement this method if you want to add a widget for your application to Kontact's summary page.
Definition: plugin.h:174
virtual TQStringList invisibleToolbarActions() const
Returns a list of action name which shall be hidden in the main toolbar.
Definition: plugin.h:233
virtual bool isRunningStandalone()
Reimplement this method and return whether a standalone application is still running This is only req...
Definition: plugin.h:131
virtual bool createDCOPInterface(const TQString &)
Create the DCOP interface for the given serviceType, if this plugin provides it.
Definition: plugin.h:125
virtual bool canDecodeDrag(TQMimeSource *)
Return, if the plugin can handle the drag object of the given mime type.
Definition: plugin.h:238
virtual KParts::ReadOnlyPart * createPart()=0
Reimplement and return the part here.
virtual bool queryClose() const
Reimplement this method if you want to add checks before closing down the main kontact window.
Definition: plugin.h:191
virtual void processDropEvent(TQDropEvent *)
Process drop event.
Definition: plugin.h:243
virtual int weight() const
Return the weight of the plugin.
Definition: plugin.h:208
virtual void saveProperties(TDEConfig *)
Session management: save properties.
Definition: plugin.h:257
virtual void readProperties(TDEConfig *)
Session management: read properties.
Definition: plugin.h:252
Summary widget for display in the Summary View plugin.
Definition: summary.h:37