diff --git a/CMakeLists.txt b/CMakeLists.txt index b372c13..d2fd876 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,90 +1,90 @@ cmake_minimum_required(VERSION 3.5) -set(PIM_VERSION "5.14.40") +set(PIM_VERSION "5.14.41") project(KontactInterface VERSION ${PIM_VERSION}) # ECM setup set(KF5_MIN_VERSION "5.68.0") find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(GenerateExportHeader) include(ECMGenerateHeaders) include(ECMGeneratePriFile) include(ECMSetupVersion) include(FeatureSummary) include(ECMQtDeclareLoggingCategory) add_definitions(-DTRANSLATION_DOMAIN=\"kontactinterfaces5\") set(KONTACTINTERFACE_LIB_VERSION ${PIM_VERSION}) set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5KontactInterface") ecm_setup_version(PROJECT VARIABLE_PREFIX KONTACTINTERFACE VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kontactinterface_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5KontactInterfaceConfigVersion.cmake" SOVERSION 5 ) ########### Find packages ########### find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons Parts WindowSystem I18n XmlGui ) if (NOT APPLE) find_package(X11) endif() set(KONTACTINTERFACE_HAVE_X11 ${X11_FOUND}) configure_file(config-kontactinterface.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kontactinterface.h ) configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KF5KontactInterfaceConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KF5KontactInterfaceConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) ########### Install Files ########### install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5KontactInterfaceConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KF5KontactInterfaceConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kontactinterface_version.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel ) install(EXPORT KF5KontactInterfaceTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5KontactInterfaceTargets.cmake NAMESPACE KF5::) if (EXISTS "${CMAKE_SOURCE_DIR}/.git") add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00) add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054400) endif() add_definitions(-DQT_NO_FOREACH) add_subdirectory(src) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/core.cpp b/src/core.cpp index 0b5fd5d..f7dbca1 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -1,134 +1,134 @@ /* This file is part of the KDE Kontact Plugin Interface Library. Copyright (c) 2001 Matthias Hoelzer-Kluepfel Copyright (c) 2002-2003 Daniel Molkentin Copyright (c) 2003 Cornelius Schumacher This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "core.h" #include "kontactinterface_debug.h" #include #include #include #include #include using namespace KontactInterface; //@cond PRIVATE class Q_DECL_HIDDEN KontactInterface::Core::Private { Core *const q; public: explicit Private(Core *qq); void slotPartDestroyed(QObject *); void checkNewDay(); QString lastErrorMessage; QDate mLastDate; - QMap mParts; + QMap mParts; }; Core::Private::Private(Core *qq) : q(qq), mLastDate(QDate::currentDate()) { } //@endcond Core::Core(QWidget *parent, Qt::WindowFlags f) : KParts::MainWindow(parent, f), d(new Private(this)) { QTimer *timer = new QTimer(this); connect(timer, &QTimer::timeout, this, [this]() { d->checkNewDay(); }); timer->start(1000 * 60); } Core::~Core() { delete d; } -KParts::ReadOnlyPart *Core::createPart(const char *libname) +KParts::Part *Core::createPart(const char *libname) { qCDebug(KONTACTINTERFACE_LOG) << libname; - QMap::ConstIterator it; + QMap::ConstIterator it; it = d->mParts.constFind(libname); if (it != d->mParts.constEnd()) { return it.value(); } qCDebug(KONTACTINTERFACE_LOG) << "Creating new KPart"; KPluginLoader loader(QString::fromLatin1(libname)); qCDebug(KONTACTINTERFACE_LOG) << loader.fileName(); KPluginFactory *factory = loader.factory(); - KParts::ReadOnlyPart *part = nullptr; + KParts::Part *part = nullptr; if (factory) { - part = factory->create(this); + part = factory->create(this); } if (part) { d->mParts.insert(libname, part); - QObject::connect(part, &KParts::ReadOnlyPart::destroyed, + QObject::connect(part, &KParts::Part::destroyed, this, [this](QObject* obj) { d->slotPartDestroyed(obj);}); } else { d->lastErrorMessage = loader.errorString(); qCWarning(KONTACTINTERFACE_LOG) << d->lastErrorMessage; } return part; } //@cond PRIVATE void Core::Private::slotPartDestroyed(QObject *obj) { // the part was deleted, we need to remove it from the part map to not return // a dangling pointer in createPart - const QMap::Iterator end = mParts.end(); - QMap::Iterator it = mParts.begin(); + const QMap::Iterator end = mParts.end(); + QMap::Iterator it = mParts.begin(); for (; it != end; ++it) { if (it.value() == obj) { mParts.erase(it); return; } } } void Core::Private::checkNewDay() { if (mLastDate != QDate::currentDate()) { emit q->dayChanged(QDate::currentDate()); } mLastDate = QDate::currentDate(); } //@endcond QString Core::lastErrorMessage() const { return d->lastErrorMessage; } #include "moc_core.cpp" diff --git a/src/core.h b/src/core.h index 8f181e7..666d080 100644 --- a/src/core.h +++ b/src/core.h @@ -1,120 +1,120 @@ /* This file is part of the KDE Kontact Plugin Interface Library. Copyright (c) 2001 Matthias Hoelzer-Kluepfel Copyright (c) 2002-2003 Daniel Molkentin This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KONTACTINTERFACE_CORE_H #define KONTACTINTERFACE_CORE_H #include "kontactinterface_export.h" #include -#include +#include namespace KontactInterface { class Plugin; /** * @short The abstract interface that represents the Kontact core. * * This class provides the interface to the Kontact core for the plugins. */ class KONTACTINTERFACE_EXPORT Core : public KParts::MainWindow { Q_OBJECT public: /** * Destroys the core object. */ ~Core() override; /** * Selects the given plugin and raises the associated part. * @see selectPlugin(const QString &) * * @param plugin is a pointer to the Kontact Plugin to select. */ virtual void selectPlugin(KontactInterface::Plugin *plugin) = 0; /** * This is an overloaded member function * @see selectPlugin(KontactInterface::Plugin *) * * @param plugin is the name of the Kontact Plugin select. */ virtual void selectPlugin(const QString &plugin) = 0; /** * Returns the pointer list of available plugins. */ virtual QList pluginList() const = 0; /** * @internal (for Plugin) * * @param library the library to create part from * Creates a part from the given @p library. */ - Q_REQUIRED_RESULT KParts::ReadOnlyPart *createPart(const char *library); + Q_REQUIRED_RESULT KParts::Part *createPart(const char *library); /** * @internal (for Plugin) * * Tells the kontact core that a part has been loaded. */ - virtual void partLoaded(Plugin *plugin, KParts::ReadOnlyPart *part) = 0; + virtual void partLoaded(Plugin *plugin, KParts::Part *part) = 0; Q_SIGNALS: /** * This signal is emitted whenever a new day starts. * * @param date The date of the new day */ void dayChanged(const QDate &date); protected: /** * Creates a new core object. * * @param parent The parent widget. * @param flags The window flags. */ explicit Core(QWidget *parent = nullptr, Qt::WindowFlags flags = {}); /** * Returns the last error message for problems during * KParts loading. */ QString lastErrorMessage() const; private: //@cond PRIVATE class Private; Private *const d; //@endcond }; } #endif diff --git a/src/plugin.cpp b/src/plugin.cpp index d6cee31..da9ff79 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -1,383 +1,383 @@ /* This file is part of the KDE Kontact Plugin Interface Library. Copyright (c) 2001 Matthias Hoelzer-Kluepfel Copyright (c) 2002-2003 Daniel Molkentin This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "plugin.h" #include "core.h" #include "processes.h" #include "kontactinterface_debug.h" #include #include #include #include #include #include #include #include #include #include #include #include using namespace KontactInterface; /** Private class that helps to provide binary compatibility between releases. @internal */ //@cond PRIVATE class Q_DECL_HIDDEN Plugin::Private { public: void partDestroyed(); void setXmlFiles(); void removeInvisibleToolbarActions(Plugin *plugin); Core *core = nullptr; QList newActions; QList syncActions; QString identifier; QString title; QString icon; QString executableName; QString serviceName; QByteArray partLibraryName; QByteArray pluginName; - KParts::ReadOnlyPart *part = nullptr; + KParts::Part *part = nullptr; bool hasPart; bool disabled; }; //@endcond Plugin::Plugin(Core *core, QObject *parent, const char *appName, const char *pluginName) : KXMLGUIClient(core), QObject(parent), d(new Private) { setObjectName(QLatin1String(appName)); core->factory()->addClient(this); d->pluginName = pluginName ? pluginName : appName; d->core = core; d->hasPart = true; d->part = nullptr; d->disabled = false; } Plugin::~Plugin() { delete d->part; delete d; } void Plugin::setIdentifier(const QString &identifier) { d->identifier = identifier; } QString Plugin::identifier() const { return d->identifier; } void Plugin::setTitle(const QString &title) { d->title = title; } QString Plugin::title() const { return d->title; } void Plugin::setIcon(const QString &icon) { d->icon = icon; } QString Plugin::icon() const { return d->icon; } void Plugin::setExecutableName(const QString &bin) { d->executableName = bin; } QString Plugin::executableName() const { return d->executableName; } void Plugin::setPartLibraryName(const QByteArray &libName) { d->partLibraryName = libName; } bool Plugin::isRunningStandalone() const { return false; } -KParts::ReadOnlyPart *Plugin::loadPart() +KParts::Part *Plugin::loadPart() { return core()->createPart(d->partLibraryName.constData()); } const KAboutData Plugin::aboutData() { return part()->componentData(); } -KParts::ReadOnlyPart *Plugin::part() +KParts::Part *Plugin::part() { if (!d->part) { d->part = createPart(); if (d->part) { - connect(d->part, &KParts::ReadOnlyPart::destroyed, this, [this]() { d->partDestroyed(); }); + connect(d->part, &KParts::Part::destroyed, this, [this]() { d->partDestroyed(); }); d->removeInvisibleToolbarActions(this); core()->partLoaded(this, d->part); } } return d->part; } QString Plugin::registerClient() { if (d->serviceName.isEmpty()) { d->serviceName = QLatin1String("org.kde.") + QLatin1String(objectName().toLatin1()); #ifdef Q_OS_WIN const QString pid = QString::number(QCoreApplication::applicationPid()); d->serviceName.append(QLatin1String(".unique-") + pid); #endif QDBusConnection::sessionBus().registerService(d->serviceName); } return d->serviceName; } int Plugin::weight() const { return 0; } void Plugin::insertNewAction(QAction *action) { d->newActions.append(action); } void Plugin::insertSyncAction(QAction *action) { d->syncActions.append(action); } QList Plugin::newActions() const { return d->newActions; } QList Plugin::syncActions() const { return d->syncActions; } QStringList Plugin::invisibleToolbarActions() const { return QStringList(); } bool Plugin::canDecodeMimeData(const QMimeData *data) const { Q_UNUSED(data); return false; } void Plugin::processDropEvent(QDropEvent *) { } void Plugin::readProperties(const KConfigGroup &) { } void Plugin::saveProperties(KConfigGroup &) { } Core *Plugin::core() const { return d->core; } void Plugin::aboutToSelect() { // Because the 3 korganizer plugins share the same part, we need to switch // that part's XML files every time we are about to show its GUI... d->setXmlFiles(); select(); } void Plugin::select() { } void Plugin::configUpdated() { } //@cond PRIVATE void Plugin::Private::partDestroyed() { part = nullptr; } void Plugin::Private::removeInvisibleToolbarActions(Plugin *plugin) { if (pluginName.isEmpty()) { return; } // Hide unwanted toolbar action by modifying the XML before createGUI, rather // than doing it by calling removeAction on the toolbar after createGUI. Both // solutions work visually, but only modifying the XML ensures that the // actions don't appear in "edit toolbars". #207296 const QStringList hideActions = plugin->invisibleToolbarActions(); //qCDebug(KONTACTINTERFACE_LOG) << "Hiding actions" << hideActions << "from" << pluginName << part; QDomDocument doc = part->domDocument(); QDomElement docElem = doc.documentElement(); // 1. Iterate over containers for (QDomElement containerElem = docElem.firstChildElement(); !containerElem.isNull(); containerElem = containerElem.nextSiblingElement()) { if (QString::compare(containerElem.tagName(), QLatin1String("ToolBar"), Qt::CaseInsensitive) == 0) { // 2. Iterate over actions in toolbars QDomElement actionElem = containerElem.firstChildElement(); while (!actionElem.isNull()) { QDomElement nextActionElem = actionElem.nextSiblingElement(); if (QString::compare(actionElem.tagName(), QLatin1String("Action"), Qt::CaseInsensitive) == 0) { //qCDebug(KONTACTINTERFACE_LOG) << "Looking at action" << actionElem.attribute("name"); if (hideActions.contains(actionElem.attribute(QStringLiteral("name")))) { //qCDebug(KONTACTINTERFACE_LOG) << "REMOVING"; containerElem.removeChild(actionElem); } } actionElem = nextActionElem; } } } // Possible optimization: we could do all the above and the writing below // only when (newAppFile does not exist) or (version of domDocument > version of newAppFile) (*) // This requires parsing newAppFile when it exists, though, and better use // the fast kdeui code for that rather than a full QDomDocument. // (*) or when invisibleToolbarActions() changes :) const QString newAppFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kontact/default-") + QLatin1String(pluginName) + QLatin1String(".rc"); QFileInfo fileInfo(newAppFile); QDir().mkpath(fileInfo.absolutePath()); QFile file(newAppFile); if (!file.open(QFile::WriteOnly)) { qCWarning(KONTACTINTERFACE_LOG) << "error writing to" << newAppFile; return; } file.write(doc.toString().toUtf8()); file.flush(); setXmlFiles(); } void Plugin::Private::setXmlFiles() { const QString newAppFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kontact/default-") + QLatin1String(pluginName) + QLatin1String(".rc"); const QString localFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kontact/local-") + QLatin1String(pluginName) + QLatin1String(".rc"); if (!localFile.isEmpty() && !newAppFile.isEmpty()) { if (part->xmlFile() != newAppFile || part->localXMLFile() != localFile) { part->replaceXMLFile(newAppFile, localFile); } } } //@endcond void Plugin::slotConfigUpdated() { configUpdated(); } void Plugin::bringToForeground() { if (d->executableName.isEmpty()) { return; } #ifdef Q_OS_WIN activateWindowForProcess(d->executableName); #else KRun::runCommand(d->executableName, nullptr); #endif } Summary *Plugin::createSummaryWidget(QWidget *parent) { Q_UNUSED(parent); return nullptr; } bool Plugin::showInSideBar() const { return d->hasPart; } void Plugin::setShowInSideBar(bool hasPart) { d->hasPart = hasPart; } bool Plugin::queryClose() const { return true; } void Plugin::setDisabled(bool disabled) { d->disabled = disabled; } bool Plugin::disabled() const { return d->disabled; } void Plugin::shortcutChanged() { } void Plugin::virtual_hook(int, void *) { //BASE::virtual_hook( id, data ); } #include "moc_plugin.cpp" diff --git a/src/plugin.h b/src/plugin.h index 4a601d9..999b01e 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -1,329 +1,329 @@ /* This file is part of the KDE Kontact Plugin Interface Library. Copyright (c) 2001 Matthias Hoelzer-Kluepfel Copyright (c) 2002-2003 Daniel Molkentin Copyright (c) 2003 Cornelius Schumacher This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KONTACTINTERFACE_PLUGIN_H #define KONTACTINTERFACE_PLUGIN_H #include "kontactinterface_export.h" #include #include #include #include class KAboutData; class QAction; class KConfig; class KConfigGroup; class QDropEvent; class QMimeData; class QStringList; class QWidget; namespace KParts { -class ReadOnlyPart; +class Part; } /** Exports Kontact plugin. */ #define EXPORT_KONTACT_PLUGIN( pluginclass, pluginname ) \ class Instance \ { \ public: \ static QObject *createInstance( QWidget *, QObject *parent, const QVariantList &list ) \ { return new pluginclass( static_cast( parent ), list ); } \ }; \ K_PLUGIN_FACTORY( KontactPluginFactory, registerPlugin< pluginclass > \ ( QString(), Instance::createInstance ); ) /** Increase this version number whenever you make a change in the API. */ #define KONTACT_PLUGIN_VERSION 10 namespace KontactInterface { class Core; class Summary; /** * @short Base class for all Plugins in Kontact. * * 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. */ class KONTACTINTERFACE_EXPORT Plugin : public QObject, virtual public KXMLGUIClient { Q_OBJECT public: /** * Creates a new plugin. * * @param core The core object that manages the plugin. * @param parent The parent object. * @param 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. * @param pluginName The unique name of the plugin. Defaults to appName if not set. */ Plugin(Core *core, QObject *parent, const char *appName, const char *pluginName = nullptr); /** * Destroys the plugin. */ ~Plugin() override; /** * Sets the @p identifier of the plugin. */ void setIdentifier(const QString &identifier); /** * Returns the identifier of the plugin. */ Q_REQUIRED_RESULT QString identifier() const; /** * Sets the localized @p title of the plugin. */ void setTitle(const QString &title); /** * Returns the localized title of the plugin. */ Q_REQUIRED_RESULT QString title() const; /** * Sets the @p icon name that is used for the plugin. */ void setIcon(const QString &icon); /** * Returns the icon name that is used for the plugin. */ Q_REQUIRED_RESULT QString icon() const; /** * Sets the @p name of executable (if existent). */ void setExecutableName(const QString &name); /** * Returns the name of the executable (if existent). */ Q_REQUIRED_RESULT QString executableName() const; /** * Set @p name of library which contains the KPart used by this plugin. */ void setPartLibraryName(const QByteArray &name); /** * 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. */ Q_REQUIRED_RESULT virtual bool isRunningStandalone() const; /** * 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 void bringToForeground(); /** * Reimplement this method if you want to add your credits to the Kontact * about dialog. */ Q_REQUIRED_RESULT virtual const KAboutData aboutData(); /** * 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. */ - Q_REQUIRED_RESULT KParts::ReadOnlyPart *part(); + Q_REQUIRED_RESULT KParts::Part *part(); /** * This function is called when the plugin is selected by the user before the * widget of the KPart belonging to the plugin is raised. */ virtual void select(); /** * 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". */ void aboutToSelect(); /** * This function is called whenever the config dialog has been closed * successfully. */ virtual void configUpdated(); /** * Reimplement this method if you want to add a widget for your application * to Kontact's summary page. * * @param parent The parent widget of the summary widget. */ Q_REQUIRED_RESULT virtual Summary *createSummaryWidget(QWidget *parent); /** * Returns whether the plugin provides a part that should be shown in the sidebar. */ Q_REQUIRED_RESULT virtual bool showInSideBar() const; /** * Set if the plugin provides a part that should be shown in the sidebar. * @param hasPart shows part in sidebar if set as @c true */ void setShowInSideBar(bool hasPart); /** * 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. */ Q_REQUIRED_RESULT virtual bool queryClose() const; /** * Registers the client at DBus and returns the dbus identifier. */ Q_REQUIRED_RESULT QString registerClient(); /** * Return the weight of the plugin. The higher the weight the lower it will * be displayed in the sidebar. The default implementation returns 0. */ virtual int weight() const; /** * Inserts a custom "New" @p action. * @param action the new action to insert */ void insertNewAction(QAction *action); /** * Inserts a custom "Sync" @p action. * @param action the custom Sync action to insert */ void insertSyncAction(QAction *action); /** * Returns the list of custom "New" actions. */ Q_REQUIRED_RESULT QList newActions() const; /** * Returns the list of custom "Sync" actions. */ Q_REQUIRED_RESULT QList syncActions() const; /** * Returns a list of action names that shall be hidden in the main toolbar. */ Q_REQUIRED_RESULT virtual QStringList invisibleToolbarActions() const; /** * Returns whether the plugin can handle the drag object of the given mime type. */ Q_REQUIRED_RESULT virtual bool canDecodeMimeData(const QMimeData *data) const; /** * Process drop event. */ virtual void processDropEvent(QDropEvent *); /** * Session management: read properties */ virtual void readProperties(const KConfigGroup &); /** * Session management: save properties */ virtual void saveProperties(KConfigGroup &); /** * Returns a pointer to the kontact core object. */ Q_REQUIRED_RESULT Core *core() const; /** * Sets whether the plugin shall be disabled. */ void setDisabled(bool value); /** * Returns whether the plugin is disabled. */ Q_REQUIRED_RESULT bool disabled() const; /** * @since 4.13 */ virtual void shortcutChanged(); public Q_SLOTS: /** * @internal usage * * This slot is called whenever the configuration has been changed. */ void slotConfigUpdated(); protected: /** * Reimplement and return the part here. Reimplementing createPart() is * mandatory! */ - virtual KParts::ReadOnlyPart *createPart() = 0; + virtual KParts::Part *createPart() = 0; /** * Returns the loaded part. */ - KParts::ReadOnlyPart *loadPart(); + KParts::Part *loadPart(); /** * Virtual hook for BC extension. */ void virtual_hook(int id, void *data) override; private: //@cond PRIVATE class Private; Private *const d; //@endcond }; } #endif