kontact

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 <qobject.h>
00028 #include <kxmlguiclient.h>
00029 #include <kdepimmacros.h>
00030 #include <qptrlist.h>
00031 
00032 class QStringList;
00033 class DCOPClient;
00034 class DCOPObject;
00035 class KAboutData;
00036 class KAction;
00037 class KConfig;
00038 class QWidget;
00039 namespace KParts { class ReadOnlyPart; }
00040 
00045 #define KONTACT_PLUGIN_VERSION 5
00046 
00047 namespace Kontact
00048 {
00049 
00050 class Core;
00051 class Summary;
00052 
00058 class KDE_EXPORT Plugin : public QObject, virtual public KXMLGUIClient
00059 {
00060   Q_OBJECT
00061 
00062   public:
00071     Plugin( Core *core, QObject *parent, const char *name );
00072 
00073     ~Plugin();
00074 
00078     void setIdentifier( const QString &identifier );
00079 
00084     QString identifier() const;
00085 
00089     void setTitle( const QString &title );
00090 
00094     QString title() const;
00095 
00099     void setIcon( const QString &icon );
00100 
00104     QString icon() const;
00105 
00109     void setExecutableName( const QString &bin );
00110 
00114     QString executableName() const;
00115 
00119     void setPartLibraryName( const QCString & );
00120 
00125     virtual bool createDCOPInterface( const QString& /*serviceType*/ ) { return false; }
00126 
00131     virtual bool isRunningStandalone() { return false; }
00132 
00138     virtual void bringToForeground();
00139 
00144     virtual const KAboutData *aboutData();
00145 
00151     KParts::ReadOnlyPart *part();
00152 
00156     virtual QString tipFile() const;
00157 
00162     virtual void select();
00163 
00168     virtual void configUpdated();
00169 
00174     virtual Summary *createSummaryWidget( QWidget * /*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( KAction *action );
00214 
00218     QPtrList<KAction>* newActions() const;
00219 
00223     virtual QStringList invisibleToolbarActions() const { return QStringList(); }
00224 
00228     virtual bool canDecodeDrag( QMimeSource * ) { return false; }
00229 
00233     virtual void processDropEvent( QDropEvent * ) {}
00234 
00238     virtual void readProperties( KConfig * ) {}
00239 
00243     virtual void saveProperties( KConfig * ) {}
00244 
00245     Core *core() const;
00246 
00247   public slots:
00251     void slotConfigUpdated();
00252 
00253   protected:
00258     virtual KParts::ReadOnlyPart *createPart() = 0;
00259 
00260     KParts::ReadOnlyPart *loadPart();
00261 
00262     virtual void virtual_hook(  int id, void* data );
00263 
00264   private slots:
00265     void partDestroyed();
00266 
00267   private:
00268     class Private;
00269     Private *d;
00270 };
00271 
00272 }
00273 
00274 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys