KontactInterface::Plugin Class
class KontactInterface::PluginBase class for all Plugins in Kontact. More...
| Header: | #include <KontactInterface/Plugin> |
| CMake: | find_package(KPim6KontactInterface REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::KontactInterface) |
| Inherits: | QObject and |
Public Functions
| Plugin(KontactInterface::Core *core, QObject *parent, const KPluginMetaData &data, const char *appName, const char *pluginName = nullptr) | |
| virtual | ~Plugin() override |
| virtual const KAboutData | aboutData() |
| void | aboutToSelect() |
| virtual void | bringToForeground() |
| virtual bool | canDecodeMimeData(const QMimeData *data) const |
| virtual void | configUpdated() |
| KontactInterface::Core * | core() const |
| virtual KontactInterface::Summary * | createSummaryWidget(QWidget *parent) |
| bool | disabled() const |
| QString | executableName() const |
| QString | icon() const |
| QString | identifier() const |
| void | insertNewAction(QAction *action) |
| void | insertSyncAction(QAction *action) |
| virtual QStringList | invisibleToolbarActions() const |
| virtual bool | isRunningStandalone() const |
| QList<QAction *> | newActions() const |
| KParts::Part * | part() |
| virtual void | processDropEvent(QDropEvent *) |
| virtual bool | queryClose() const |
| virtual void | readProperties(const KConfigGroup &) |
| QString | registerClient() |
| virtual void | saveProperties(KConfigGroup &) |
| virtual void | select() |
| void | setDisabled(bool disabled) |
| void | setExecutableName(const QString &exeName) |
| void | setIcon(const QString &icon) |
| void | setIdentifier(const QString &identifier) |
| void | setPartLibraryName(const QByteArray &name) |
| void | setShowInSideBar(bool hasPart) |
| void | setTitle(const QString &title) |
| virtual void | shortcutChanged() |
| virtual bool | showInSideBar() const |
| QList<QAction *> | syncActions() const |
| QString | title() const |
| virtual int | weight() const |
Protected Functions
| virtual KParts::Part * | createPart() = 0 |
| KParts::Part * | loadPart() |
Reimplemented Protected Functions
| virtual void | virtual_hook(int id, void *data) override |
Macros
| EXPORT_KONTACT_PLUGIN_WITH_JSON(pluginclass, jsonFile) | |
| KONTACT_PLUGIN_VERSION |
Detailed Description
Inherit from it to get a plugin. It can insert an icon into the sidepane, add widgets to the widgetstack and add menu items via XMLGUI.
Member Function Documentation
Plugin::Plugin(KontactInterface::Core *core, QObject *parent, const KPluginMetaData &data, const char *appName, const char *pluginName = nullptr)
Creates a new plugin.
core The core object that manages the plugin. parent The parent object. data The plugin metadata. appName The name of the application that provides the part. This is the name used for DBus registration. It's ok to have several plugins using the same application name. pluginName The unique name of the plugin. Defaults to appName if not set.
[override virtual noexcept] Plugin::~Plugin()
Destroys the plugin.
[virtual] const KAboutData Plugin::aboutData()
Reimplement this method if you want to add your credits to the Kontact about dialog.
void Plugin::aboutToSelect()
Called by kontact when the plugin is selected by the user. Calls the virtual method select(), but also handles some standard behavior like "invisible toolbar actions".
[virtual] void Plugin::bringToForeground()
Reimplement this method if your application needs a different approach to be brought in the foreground. The default behaviour is calling the binary. This is only required if your part is also available as standalone application.
[virtual] bool Plugin::canDecodeMimeData(const QMimeData *data) const
Returns whether the plugin can handle the drag object data of the given mime type.
[virtual] void Plugin::configUpdated()
This function is called whenever the config dialog has been closed successfully.
KontactInterface::Core *Plugin::core() const
Returns a pointer to the kontact core object.
[pure virtual protected] KParts::Part *Plugin::createPart()
Reimplement and return the part here. Reimplementing createPart() is mandatory!
[virtual] KontactInterface::Summary *Plugin::createSummaryWidget(QWidget *parent)
Reimplement this method if you want to add a widget for your application to Kontact's summary page.
parent The parent widget of the summary widget.
bool Plugin::disabled() const
Returns whether the plugin is disabled.
See also setDisabled().
QString Plugin::executableName() const
Returns the name of the executable (if existent).
See also setExecutableName().
QString Plugin::icon() const
Returns the icon name that is used for the plugin.
See also setIcon().
QString Plugin::identifier() const
Returns the identifier of the plugin.
See also setIdentifier().
void Plugin::insertNewAction(QAction *action)
Inserts a custom "New" action. action the new action to insert
void Plugin::insertSyncAction(QAction *action)
Inserts a custom "Sync" action. action the custom Sync action to insert
[virtual] QStringList Plugin::invisibleToolbarActions() const
Returns a list of action names that shall be hidden in the main toolbar.
[virtual] bool Plugin::isRunningStandalone() const
Reimplement this method and return whether a standalone application is still running. This is only required if your part is also available as standalone application.
[protected] KParts::Part *Plugin::loadPart()
Returns the loaded part.
QList<QAction *> Plugin::newActions() const
Returns the list of custom "New" actions.
KParts::Part *Plugin::part()
You can use this method if you need to access the current part. You can be sure that you always get the same pointer as long as the part has not been deleted.
[virtual] void Plugin::processDropEvent(QDropEvent *)
Process drop event.
[virtual] bool Plugin::queryClose() const
Reimplement this method if you want to add checks before closing the main kontact window. Return true if it's OK to close the window. If any loaded plugin returns false from this method, then the main kontact window will not close.
[virtual] void Plugin::readProperties(const KConfigGroup &)
Session management: read properties
QString Plugin::registerClient()
Registers the client at DBus and returns the dbus identifier.
[virtual] void Plugin::saveProperties(KConfigGroup &)
Session management: save properties
[virtual] void Plugin::select()
This function is called when the plugin is selected by the user before the widget of the KPart belonging to the plugin is raised.
void Plugin::setDisabled(bool disabled)
Sets whether the plugin shall be disabled.
See also disabled().
void Plugin::setExecutableName(const QString &exeName)
Sets the exeName of executable (if existent).
See also executableName().
void Plugin::setIcon(const QString &icon)
Sets the icon name that is used for the plugin.
See also icon().
void Plugin::setIdentifier(const QString &identifier)
Sets the identifier of the plugin.
See also identifier().
void Plugin::setPartLibraryName(const QByteArray &name)
Set name of library which contains the KPart used by this plugin.
void Plugin::setShowInSideBar(bool hasPart)
Set if the plugin provides a part that should be shown in the sidebar. hasPart shows part in sidebar if set as true
See also showInSideBar().
void Plugin::setTitle(const QString &title)
Sets the localized title of the plugin.
See also title().
[virtual] void Plugin::shortcutChanged()
[virtual] bool Plugin::showInSideBar() const
Returns whether the plugin provides a part that should be shown in the sidebar.
See also setShowInSideBar().
QList<QAction *> Plugin::syncActions() const
Returns the list of custom "Sync" actions.
QString Plugin::title() const
Returns the localized title of the plugin.
See also setTitle().
[override virtual protected] void Plugin::virtual_hook(int id, void *data)
Virtual hook for BC extension.
id The hook identifier. data The hook data.
[virtual] int Plugin::weight() const
Return the weight of the plugin. The higher the weight the lower it will be displayed in the sidebar. The default implementation returns 0.
Macro Documentation
EXPORT_KONTACT_PLUGIN_WITH_JSON(pluginclass, jsonFile)
Exports Kontact plugin. pluginclass the class to instantiate (must derive from KontactInterface::Plugin) jsonFile filename of the JSON file, generated from a .desktop file
KONTACT_PLUGIN_VERSION
Increase this version number whenever you make a change in the API.