KontactInterface

plugin.h
1 /*
2  This file is part of the KDE Kontact Plugin Interface Library.
3 
4  SPDX-FileCopyrightText: 2001 Matthias Hoelzer-Kluepfel <[email protected]>
5  SPDX-FileCopyrightText: 2002-2003 Daniel Molkentin <[email protected]>
6  SPDX-FileCopyrightText: 2003 Cornelius Schumacher <[email protected]>
7 
8  SPDX-License-Identifier: LGPL-2.0-or-later
9 */
10 
11 #ifndef KONTACTINTERFACE_PLUGIN_H
12 #define KONTACTINTERFACE_PLUGIN_H
13 
14 #include "kontactinterface_export.h"
15 
16 #include <KPluginFactory>
17 #include <KXMLGUIClient>
18 
19 #include <QList>
20 #include <QObject>
21 
22 class KAboutData;
23 class QAction;
24 class KConfig;
25 class KConfigGroup;
26 class QDropEvent;
27 class QMimeData;
28 class QStringList;
29 class QWidget;
30 namespace KParts
31 {
32 class Part;
33 }
34 
38 #define KONTACT_PLUGIN_VERSION 10
39 
43 #define EXPORT_KONTACT_PLUGIN( pluginclass, pluginname ) \
44  class Instance \
45  { \
46  public: \
47  static QObject *createInstance( QWidget *, QObject *parent, const QVariantList &list ) \
48  { return new pluginclass( static_cast<KontactInterface::Core*>( parent ), list ); } \
49  }; \
50  K_PLUGIN_FACTORY( KontactPluginFactory, registerPlugin< pluginclass > \
51  ( QString(), Instance::createInstance ); )
52 
58 #define EXPORT_KONTACT_PLUGIN_WITH_JSON( pluginclass, jsonFile ) \
59  class Instance \
60  { \
61  public: \
62  static QObject *createInstance( QWidget *, QObject *parent, const QVariantList &list ) \
63  { return new pluginclass( static_cast<KontactInterface::Core*>( parent ), list ); } \
64  }; \
65  K_PLUGIN_FACTORY_WITH_JSON( KontactPluginFactory, jsonFile, registerPlugin< pluginclass > \
66  ( QString(), Instance::createInstance ); ) \
67  K_EXPORT_PLUGIN_VERSION(KONTACT_PLUGIN_VERSION)
68 
69 namespace KontactInterface
70 {
71 
72 class Core;
73 class Summary;
80 class KONTACTINTERFACE_EXPORT Plugin : public QObject, virtual public KXMLGUIClient
81 {
82  Q_OBJECT
83 
84 public:
95  Plugin(Core *core, QObject *parent, const char *appName, const char *pluginName = nullptr);
96 
100  ~Plugin() override;
101 
105  void setIdentifier(const QString &identifier);
106 
110  Q_REQUIRED_RESULT QString identifier() const;
111 
115  void setTitle(const QString &title);
116 
120  Q_REQUIRED_RESULT QString title() const;
121 
125  void setIcon(const QString &icon);
126 
130  Q_REQUIRED_RESULT QString icon() const;
131 
135  void setExecutableName(const QString &name);
136 
140  Q_REQUIRED_RESULT QString executableName() const;
141 
145  void setPartLibraryName(const QByteArray &name);
146 
152  Q_REQUIRED_RESULT virtual bool isRunningStandalone() const;
153 
159  virtual void bringToForeground();
160 
165  Q_REQUIRED_RESULT virtual const KAboutData aboutData();
166 
172  Q_REQUIRED_RESULT KParts::Part *part();
173 
178  virtual void select();
179 
185  void aboutToSelect();
186 
191  virtual void configUpdated();
192 
199  Q_REQUIRED_RESULT virtual Summary *createSummaryWidget(QWidget *parent);
200 
204  Q_REQUIRED_RESULT virtual bool showInSideBar() const;
205 
210  void setShowInSideBar(bool hasPart);
211 
218  Q_REQUIRED_RESULT virtual bool queryClose() const;
219 
223  Q_REQUIRED_RESULT QString registerClient();
224 
229  virtual int weight() const;
230 
235  void insertNewAction(QAction *action);
236 
241  void insertSyncAction(QAction *action);
242 
246  Q_REQUIRED_RESULT QList<QAction *> newActions() const;
247 
251  Q_REQUIRED_RESULT QList<QAction *> syncActions() const;
252 
256  Q_REQUIRED_RESULT virtual QStringList invisibleToolbarActions() const;
257 
261  Q_REQUIRED_RESULT virtual bool canDecodeMimeData(const QMimeData *data) const;
262 
266  virtual void processDropEvent(QDropEvent *);
267 
271  virtual void readProperties(const KConfigGroup &);
272 
276  virtual void saveProperties(KConfigGroup &);
277 
281  Q_REQUIRED_RESULT Core *core() const;
282 
286  void setDisabled(bool value);
287 
291  Q_REQUIRED_RESULT bool disabled() const;
292 
296  virtual void shortcutChanged();
297 
298 public Q_SLOTS:
304  void slotConfigUpdated();
305 
306 protected:
311  virtual KParts::Part *createPart() = 0;
312 
316  KParts::Part *loadPart();
317 
321  void virtual_hook(int id, void *data) override;
322 
323 private:
324  //@cond PRIVATE
325  class Private;
326  Private *const d;
327  //@endcond
328 };
329 
330 }
331 
332 #endif
Base class for summary widgets in Kontact.
Definition: summary.h:28
Base class for all Plugins in Kontact.
Definition: plugin.h:80
The abstract interface that represents the Kontact core.
Definition: core.h:28
QCA_EXPORT QString appName()
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Sep 22 2020 23:13:41 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.