Commit 3d0fcc9c authored by Alexander Lohnau's avatar Alexander Lohnau 💬 Committed by Laurent Montel
Browse files

Port summary KCM loading to KPluginMetaData

The new code loads the KCMs from the pim/kcms/summary namespace.

Task: https://phabricator.kde.org/T14501
parent acc0f9cb
......@@ -15,6 +15,7 @@ qt_add_dbus_interfaces(kontact_kmail_plugins_interface_SRCS ${kmail_BINARY_DIR}/
set(kontact_kmailplugin_PART_SRCS kmail_plugin.cpp summarywidget.cpp ${kontact_kmail_plugins_interface_SRCS} ${kontact_kmail_plugins_interface_common_SRCS})
add_library(kontact_kmailplugin MODULE ${kontact_kmailplugin_PART_SRCS})
kcoreaddons_desktop_to_json(kontact_kmailplugin "kmailplugin.desktop" SERVICE_TYPES kcmodule.desktop)
pim_target_precompile_headers(kontact_kmailplugin PUBLIC ../../../kmail_pch.h)
add_dependencies(kontact_kmailplugin kmail_xml)
......@@ -22,21 +23,21 @@ target_link_libraries(kontact_kmailplugin KF5::Mime KF5::I18n KF5::KontactInterf
########### next target ###############
set(kcm_kmailsummary_PART_SRCS kcmkmailsummary.cpp ${kontact_kmail_plugins_interface_SRCS} ${kontact_kmail_plugins_interface_common_SRCS})
set(kcmkmailsummary_PART_SRCS kcmkmailsummary.cpp ${kontact_kmail_plugins_interface_SRCS} ${kontact_kmail_plugins_interface_common_SRCS})
add_library(kcm_kmailsummary MODULE ${kcm_kmailsummary_PART_SRCS})
pim_target_precompile_headers(kcm_kmailsummary PUBLIC ../../../kmail_pch.h)
kcoreaddons_desktop_to_json(kcm_kmailsummary "kmailplugin.desktop" SERVICE_TYPES kcmodule.desktop)
add_library(kcmkmailsummary MODULE ${kcmkmailsummary_PART_SRCS})
pim_target_precompile_headers(kcmkmailsummary PUBLIC ../../../kmail_pch.h)
kcoreaddons_desktop_to_json(kcmkmailsummary "kcmkmailsummary.desktop" SERVICE_TYPES kcmodule.desktop)
add_dependencies(kcm_kmailsummary kmail_xml)
add_dependencies(kcmkmailsummary kmail_xml)
target_link_libraries(kcm_kmailsummary KF5::Mime KF5::PimCommonAkonadi Qt::DBus KF5::ConfigWidgets KF5::I18n)
target_link_libraries(kcmkmailsummary KF5::Mime KF5::PimCommonAkonadi Qt::DBus KF5::ConfigWidgets KF5::I18n)
########### install files ###############
install(TARGETS kontact_kmailplugin DESTINATION ${KDE_INSTALL_PLUGINDIR}/kontact5)
install(TARGETS kcm_kmailsummary DESTINATION ${KDE_INSTALL_PLUGINDIR})
install(TARGETS kcmkmailsummary DESTINATION ${KDE_INSTALL_PLUGINDIR}/pim/kcms/summary/)
install(FILES kmailplugin.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kontact)
......
......@@ -25,7 +25,7 @@
#include <QTreeView>
#include <QVBoxLayout>
K_PLUGIN_CLASS_WITH_JSON(KCMKMailSummary, "kmailplugin.json")
K_PLUGIN_CLASS_WITH_JSON(KCMKMailSummary, "kcmkmailsummary.json")
KCMKMailSummary::KCMKMailSummary(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
{
......
......@@ -4,7 +4,7 @@ Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-ModuleType=Library
X-KDE-Library=kcm_kmailsummary
X-KDE-Library=pim/kcms/summary/kcmkmailsummary
X-KDE-FactoryName=kmailsummary
X-KDE-ParentApp=kontact_summaryplugin
X-KDE-ParentComponents=kontact_summaryplugin
......
......@@ -15,16 +15,16 @@ kcoreaddons_desktop_to_json(kontact_summaryplugin summaryplugin.desktop)
########### next target ###############
add_library(kcm_kontactsummary MODULE kcmkontactsummary.cpp)
kcoreaddons_desktop_to_json(kcm_kontactsummary "kcmkontactsummary.desktop" SERVICE_TYPES kcmodule.desktop)
pim_target_precompile_headers(kcm_kontactsummary PUBLIC ../../../kmail_pch.h)
add_library(kcmkontactsummary MODULE kcmkontactsummary.cpp)
kcoreaddons_desktop_to_json(kcmkontactsummary "kcmkontactsummary.desktop" SERVICE_TYPES kcmodule.desktop)
pim_target_precompile_headers(kcmkontactsummary PUBLIC ../../../kmail_pch.h)
target_link_libraries(kcm_kontactsummary KF5::I18n KF5::KCMUtils Qt::Widgets KF5::KCMUtils KF5::I18n KF5::KontactInterface)
target_link_libraries(kcmkontactsummary KF5::I18n KF5::KCMUtils Qt::Widgets KF5::KCMUtils KF5::I18n KF5::KontactInterface)
########### install files ###############
install(TARGETS kontact_summaryplugin DESTINATION ${KDE_INSTALL_PLUGINDIR}/kontact5)
install(TARGETS kcm_kontactsummary DESTINATION ${KDE_INSTALL_PLUGINDIR})
install(TARGETS kcmkontactsummary DESTINATION ${KDE_INSTALL_PLUGINDIR}/pim/kcms/summary)
install(FILES summaryplugin.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kontact)
install(FILES kcmkontactsummary.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
......
......@@ -4,7 +4,7 @@ Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-ModuleType=Library
X-KDE-Library=kcm_kontactsummary
X-KDE-Library=pim/kcms/summary/kcmkontactsummary
X-KDE-FactoryName=kontactsummary
X-KDE-ParentApp=kontact_summaryplugin
X-KDE-ParentComponents=kontact_summaryplugin
......
......@@ -28,6 +28,8 @@ using PimCommon::BroadcastStatus;
#include <KConfigGroup>
#include <KLocalizedString>
#include <KParts/PartActivateEvent>
#include <KPluginLoader>
#include <KPluginMetaData>
#include <QAction>
#include <QApplication>
#include <QHBoxLayout>
......@@ -37,6 +39,7 @@ using PimCommon::BroadcastStatus;
#include <QScrollArea>
#include <QTimer>
#include <QVBoxLayout>
#include <kcmutils_version.h>
SummaryViewPart::SummaryViewPart(KontactInterface::Core *core, const KAboutData &aboutData, QObject *parent)
: KParts::Part(parent)
......@@ -404,15 +407,15 @@ void SummaryViewPart::slotConfigure()
QPointer<KCMultiDialog> dlg = new KCMultiDialog(mMainWidget);
dlg->setObjectName(QStringLiteral("ConfigDialog"));
dlg->setModal(true);
QStringList modules = configModules();
modules.prepend(QStringLiteral("kcmkontactsummary.desktop"));
connect(dlg.data(), qOverload<>(&KCMultiDialog::configCommitted), this, &SummaryViewPart::updateWidgets);
QStringList::ConstIterator strIt;
QStringList::ConstIterator end(modules.constEnd());
for (strIt = modules.constBegin(); strIt != end; ++strIt) {
dlg->addModule(*strIt);
const auto metaDataList = KPluginLoader::findPlugins(QStringLiteral("pim/kcms/summary/"));
for (const auto &metaData : metaDataList) {
#if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 84, 0)
dlg->addModule(metaData);
#else
dlg->addModule(metaData.pluginId());
#endif
}
dlg->exec();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment