diff --git a/src/kcmodule.desktop b/src/kcmodule.desktop index 7c980a8..983d012 100644 --- a/src/kcmodule.desktop +++ b/src/kcmodule.desktop @@ -1,125 +1,129 @@ [Desktop Entry] Type=ServiceType X-KDE-ServiceType=KCModule Name=KDE Configuration Module Name[af]=KDE konfigurasiemodule Name[ar]=وحدة لضبط كدي Name[as]=KDE বিন্যাসৰ অংশ Name[ast]=Módulu de configuración de KDE Name[be]=Модуль настаўлення KDE Name[be@latin]=Modul naładžvańnia KDE Name[bg]=Контролен модул на KDE Name[bn]=কে.ডি.ই. কনফিগারেশন মডিউল Name[bn_IN]=KDE কনফিগারেশন মডিউল Name[br]=Mollad kreizenn ren KDE Name[bs]=KDE modul za podešavanje Name[ca]=Mòdul de configuració del KDE Name[ca@valencia]=Mòdul de configuració del KDE Name[cs]=Ovládací modul KDE Name[csb]=Kòntrolny mòduł pùltu KDE Name[da]=KDE konfigurationsmodul Name[de]=KDE-Kontrollmodul Name[el]=Άρθρωμα ρύθμισης του KDE Name[en_GB]=KDE Configuration Module Name[eo]=KDE-agordomodulo Name[es]=Módulo de configuración de KDE Name[et]=KDE seadistamismoodul Name[eu]=KDE konfigurazio modulua Name[fa]=پیمانه پیکربندی KDE Name[fi]=KDE:n asetusosio Name[fr]=Module de configuration de KDE Name[fy]=KDE konfiguraasjemodule Name[ga]=Modúl Cumraíochta KDE Name[gd]=Mòideal rèiteachaidh KDE Name[gl]=Módulo de configuración de KDE Name[gu]=KDE રૂપરેખાંકન મોડ્યુલ Name[he]=מודול הגדרות של KDE Name[hi]=केडीई कॉन्फ़िगरेशन मॉड्यूल Name[hne]=केडीई कान्फिगरेसन माड्यूल Name[hr]=KDE-ov konfiguracijski modul Name[hsb]=Modul za konfigurowanje KDE Name[hu]=KDE beállítómodul Name[hy]=KDE-ի կերպարանքի մոդուլ Name[ia]=Modulo de configuration de KDE Name[id]=Modul Konfigurasi KDE Name[is]=KDE stillingaeining Name[it]=Modulo di configurazione KDE Name[ja]=KDE 設定モジュール Name[kk]=KDE баптау модулі Name[km]=ម៉ូឌុល​កំណត់​រចនាសម្ព័ន្ធ​របស់ KDE Name[kn]=ಕೆಡಿಇ ಸಂರಚನಾ ಘಟಕ Name[ko]=KDE 제어 모듈 Name[ku]=Modûla Veavakirina KDE Name[lt]=KDE konfigūravimo modulis Name[lv]=KDE konfigurācijas modulis Name[mai]=केडीई बिन्यास मोड्यूल Name[mk]=KDE-модул за конфигурација Name[ml]=കെഡിഇയിലെ സജ്ജീകരണങ്ങള്‍ക്കുള്ള മൊഡ്യൂള്‍ Name[mr]=केडीई व्यूहरचना विभाग Name[nb]=KDE kontrollsenter-modul Name[nds]=KDE-Kuntrullmoduul Name[ne]=केडीई कन्फिगरेसन मोड्युल Name[nl]=KDE-configuratiemodule Name[nn]=KDE-oppsettsmodul Name[or]=KDE ବିନ୍ୟାସ ଏକକାଂଶ Name[pa]=KDE ਸੰਰਚਨਾ ਮੋਡੀਊਲ Name[pl]=Moduł ustawień KDE Name[ps]=کډي سازونې بېلګه Name[pt]=Módulo de Configuração do KDE Name[pt_BR]=Módulo de configuração do KDE Name[ro]=Modul de configurare KDE Name[ru]=Модуль настройки KDE Name[se]=KDE-heivehusmodula Name[si]=KDE සැකසුම් මොඩියුලය Name[sk]=Ovládací modul KDE Name[sl]=Modul za nastavljanje KDE Name[sr]=КДЕ модул за подешавање Name[sr@ijekavian]=КДЕ модул за подешавање Name[sr@ijekavianlatin]=KDE modul za podešavanje Name[sr@latin]=KDE modul za podešavanje Name[sv]=KDE-inställningsmodul Name[ta]=கேபசூ வடிவமைப்பு பாகம் Name[te]=కెడిఈ అమరిక మాడ్యూల్ Name[tg]=Модули танзимоти KDE Name[th]=มอดูลปรับแต่งค่าของ KDE Name[tr]=KDE Yapılandırma Modülü Name[tt]=KDE көйләү модуле Name[ug]=KDE سەپلىمە بۆلىكى Name[uk]=Модуль налаштування KDE Name[vi]=Mô-đun Cấu hình KDE Name[wa]=Module d' apontiaedje di KDE Name[x-test]=xxKDE Configuration Modulexx Name[zh_CN]=KDE 配置模块 Name[zh_TW]=KDE 控制模組 # the name of the method (with or without the init_ prefix) returning the factory object [PropertyDef::X-KDE-FactoryName] Type=QString # a list of all components this KCM belongs to [PropertyDef::X-KDE-ParentComponents] Type=QStringList # the id of the parent in the TreeList [PropertyDef::X-KDE-CfgDlgHierarchy] Type=QString # the id of the parent in the TreeList for System Settings [PropertyDef::X-KDE-System-Settings-Parent-Category] Type=QString # the id of the parent category in the TreeList for KInfoCenter [PropertyDef::X-KDE-KInfoCenter-Category] Type=QString # sets the order of the modules in the TreeList/IconList [PropertyDef::X-KDE-Weight] Type=int # The keyword to be used when loading the plugin using KPluginFactory (to support multiple KCModules in a single plugin). See KService::pluginKeyword(). [PropertyDef::X-KDE-PluginKeyword] Type=QString # the list of ids of QPAs the module supports, if empty list or not set all are supported [PropertyDef::X-KDE-OnlyShowOnQtPlatforms] Type=QStringList + +# extra arguments for the KCModule +[PropertyDef::X-KDE-KCM-Args] +Type=QStringList diff --git a/src/kcmoduleloader.cpp b/src/kcmoduleloader.cpp index 113da6f..9e7f4c6 100644 --- a/src/kcmoduleloader.cpp +++ b/src/kcmoduleloader.cpp @@ -1,184 +1,186 @@ /* Copyright (c) 1999 Matthias Hoelzer-Kluepfel Copyright (c) 2000 Matthias Elter Copyright (c) 2003,2004,2006 Matthias Kretz Copyright (c) 2004 Frans Englich This file is part of the KDE project This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2, as published by the Free Software Foundation. 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 "kcmoduleloader.h" #include "kcmoduleqml_p.h" #include #include #include #include #include #include #include #include #include #include using namespace KCModuleLoader; /***************************************************************/ /** * When something goes wrong in loading the module, this one * jumps in as a "dummy" module. */ class KCMError : public KCModule { public: KCMError(const QString &msg, const QString &details, QWidget *parent) : KCModule(parent) { QVBoxLayout *topLayout = new QVBoxLayout(this); QLabel *lab = new QLabel(msg, this); lab->setWordWrap(true); topLayout->addWidget(lab); lab = new QLabel(details, this); lab->setWordWrap(true); topLayout->addWidget(lab); } }; /***************************************************************/ KCModule *KCModuleLoader::loadModule(const QString &module, ErrorReporting report, QWidget *parent, const QStringList &args) { return loadModule(KCModuleInfo(module), report, parent, args); } KCModule *KCModuleLoader::loadModule(const KCModuleInfo &mod, ErrorReporting report, QWidget *parent, const QStringList &args) { /* * Simple libraries as modules are the easiest case: * We just have to load the library and get the module * from the factory. */ if (!mod.isValid()) { return reportError(report, i18n("The module %1 could not be found.", mod.moduleName()), i18n("

The diagnosis is:
The desktop file %1 could not be found.

", mod.fileName()), parent); } if (mod.service() && mod.service()->noDisplay()) { return reportError(report, i18n("The module %1 is disabled.", mod.moduleName()), i18n("

Either the hardware/software the module configures is not available or the module has been disabled by the administrator.

"), parent); } if (!mod.library().isEmpty()) { QString error; QVariantList args2; - args2.reserve(args.count()); + const QVariantList additionalArgs = mod.property(QStringLiteral("X-KDE-KCM-Args")).toList(); + args2.reserve(args.count() + additionalArgs.count()); for (const QString &arg : args) { args2 << arg; } + args2 << additionalArgs; KCModule *module = nullptr; KPluginLoader loader(KPluginLoader::findPlugin(QLatin1String("kcms/") + mod.library())); KPluginFactory* factory = loader.factory(); if (!factory) { // KF6 TODO: make this a warning, and remove mention of fallback qDebug() << "Couldn't load plugin" << QLatin1String("kcms/") + mod.library() << ":" << loader.errorString() << " -- falling back to old-style loading from desktop file"; } else { std::unique_ptr cm(factory->create(nullptr, args2)); if (!cm) { qWarning() << "Error creating object from plugin" << loader.fileName(); } else { if (!cm->mainUi()) { return reportError(report, i18n("Error loading QML file."), cm->errorString(), parent); } module = new KCModuleQml(std::move(cm), parent, args2); return module; } } // KF6 TODO: remove this compat block if (mod.service()) { module = mod.service()->createInstance(parent, args2, &error); } if (module) { return module; } else //#ifndef NDEBUG { // KF6 TODO: remove this old compat block // get the create_ function QLibrary lib(KPluginLoader::findPlugin(mod.library())); if (lib.load()) { KCModule *(*create)(QWidget *, const char *); QByteArray factorymethod("create_"); factorymethod += mod.handle().toLatin1(); create = reinterpret_cast(lib.resolve(factorymethod.constData())); if (create) { return create(parent, mod.handle().toLatin1().constData()); } else { qWarning() << "This module has no valid entry symbol at all. The reason could be that it's still using K_EXPORT_COMPONENT_FACTORY with a custom X-KDE-FactoryName which is not supported anymore"; } lib.unload(); } } //#endif // NDEBUG return reportError(report, error, QString(), parent); } /* * Ok, we could not load the library. * Try to run it as an executable. * This must not be done when calling from kcmshell, or you'll * have infinite recursion * (startService calls kcmshell which calls modloader which calls startService...) * */ return reportError(report, i18n("The module %1 is not a valid configuration module.", mod.moduleName()), i18n("The diagnosis is:
The desktop file %1 does not specify a library.
", mod.fileName()), parent); } void KCModuleLoader::unloadModule(const KCModuleInfo &mod) { // get the library loader instance KPluginLoader loader(mod.library()); loader.unload(); } KCModule *KCModuleLoader::reportError(ErrorReporting report, const QString &text, const QString &details, QWidget *parent) { QString realDetails = details; if (realDetails.isNull()) { realDetails = i18n("

Possible reasons:

  • An error occurred during your last " "system upgrade, leaving an orphaned control module behind
  • You have old third party " "modules lying around.

Check these points carefully and try to remove " "the module mentioned in the error message. If this fails, consider contacting " "your distributor or packager.

"); } if (report & KCModuleLoader::Dialog) { KMessageBox::detailedError(parent, text, realDetails); } if (report & KCModuleLoader::Inline) { return new KCMError(text, realDetails, parent); } return nullptr; }