Hello community, here is the log from the commit of package kded for openSUSE:Factory checked in at 2015-02-16 15:07:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kded (Old) and /work/SRC/openSUSE:Factory/.kded.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kded" Changes: -------- --- /work/SRC/openSUSE:Factory/kded/kded.changes 2015-01-29 12:53:26.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.kded.new/kded.changes 2015-02-16 17:30:44.000000000 +0100 @@ -1,0 +2,8 @@ +Sun Feb 8 18:15:35 UTC 2015 - hrvoje.sen...@gmail.com + +- Update to 5.7.0 + * Add support for loading kded modules with JSON metadata + * For more details please see: + https://www.kde.org/announcements/kde-frameworks-5.7.0.php + +------------------------------------------------------------------- Old: ---- kded-5.6.0.tar.xz New: ---- kded-5.7.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kded.spec ++++++ --- /var/tmp/diff_new_pack.Nj0VBx/_old 2015-02-16 17:30:44.000000000 +0100 +++ /var/tmp/diff_new_pack.Nj0VBx/_new 2015-02-16 17:30:44.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package kded # -# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,12 +16,13 @@ # +%define _tar_path 5.7 Name: kded -Version: 5.6.0 +Version: %{_tar_path}.0 Release: 0 %define kf5_version %{version} BuildRequires: cmake >= 2.8.12 -BuildRequires: extra-cmake-modules >= 1.6.0 +BuildRequires: extra-cmake-modules >= 1.7.0 BuildRequires: fdupes BuildRequires: kcoreaddons-devel >= %{kf5_version} BuildRequires: kcrash-devel >= %{kf5_version} @@ -43,7 +44,7 @@ License: LGPL-2.1+ Group: System/GUI/KDE Url: http://www.kde.org -Source: http://download.kde.org/stable/frameworks/5.6/%{name}-%{version}.tar.xz +Source: http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-%{version}.tar.xz BuildRoot: %{_tmppath}/%{name}-%{version}-build %description ++++++ kded-5.6.0.tar.xz -> kded-5.7.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kded-5.6.0/CMakeLists.txt new/kded-5.7.0/CMakeLists.txt --- old/kded-5.6.0/CMakeLists.txt 2015-01-03 13:04:02.000000000 +0100 +++ new/kded-5.7.0/CMakeLists.txt 2015-02-08 16:14:49.000000000 +0100 @@ -2,7 +2,7 @@ project(KDED) -find_package(ECM 1.6.0 REQUIRED NO_MODULE) +find_package(ECM 1.7.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) set(REQUIRED_QT_VERSION "5.2") @@ -12,8 +12,8 @@ include(KDEFrameworkCompilerSettings) include(KDECMakeSettings) -set(KF5_VERSION "5.6.0") # handled by release scripts -set(KF5_DEP_VERSION "5.6.0") # handled by release scripts +set(KF5_VERSION "5.7.0") # handled by release scripts +set(KF5_DEP_VERSION "5.7.0") # handled by release scripts find_package(KF5Config ${KF5_DEP_VERSION} REQUIRED) find_package(KF5CoreAddons ${KF5_DEP_VERSION} REQUIRED) find_package(KF5Crash ${KF5_DEP_VERSION} REQUIRED) @@ -46,7 +46,7 @@ add_subdirectory(src) # Create a Config.cmake and a ConfigVersion.cmake file and install them -set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KDED") +set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KDED") ecm_configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KDEDConfig.cmake.in" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kded-5.6.0/docs/kded5/CMakeLists.txt new/kded-5.7.0/docs/kded5/CMakeLists.txt --- old/kded-5.6.0/docs/kded5/CMakeLists.txt 2015-01-03 13:04:02.000000000 +0100 +++ new/kded-5.7.0/docs/kded5/CMakeLists.txt 2015-02-08 16:14:49.000000000 +0100 @@ -1 +1 @@ -kdoctools_create_manpage(man-kded5.8.docbook 8 INSTALL_DESTINATION ${MAN_INSTALL_DIR}) +kdoctools_create_manpage(man-kded5.8.docbook 8 INSTALL_DESTINATION ${KDE_INSTALL_MANDIR}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kded-5.6.0/src/CMakeLists.txt new/kded-5.7.0/src/CMakeLists.txt --- old/kded-5.6.0/src/CMakeLists.txt 2015-01-03 13:04:02.000000000 +0100 +++ new/kded-5.7.0/src/CMakeLists.txt 2015-02-08 16:14:49.000000000 +0100 @@ -31,11 +31,11 @@ qt5_generate_dbus_interface( kdedadaptor.h org.kde.kded5.xml ) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kded5.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kded5.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}) configure_file(org.kde.kded5.service.in ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kded5.service) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kded5.service - DESTINATION ${DBUS_SERVICES_INSTALL_DIR}) + DESTINATION ${KDE_INSTALL_DBUSSERVICEDIR}) -install( FILES kdedmodule.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) +install( FILES kdedmodule.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR} ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kded-5.6.0/src/kded.cpp new/kded-5.7.0/src/kded.cpp --- old/kded-5.6.0/src/kded.cpp 2015-01-03 13:04:02.000000000 +0100 +++ new/kded-5.7.0/src/kded.cpp 2015-02-08 16:14:49.000000000 +0100 @@ -43,8 +43,8 @@ #include <KDirWatch> #include <KServiceTypeTrader> #include <KToolInvocation> - -#define MODULES_PATH "/modules/" +#include <KPluginInfo> +#include <KPluginMetaData> Q_DECLARE_LOGGING_CATEGORY(KDED); Q_LOGGING_CATEGORY(KDED, "kf5.kded"); @@ -97,7 +97,11 @@ } Kded::Kded() - : m_needDelayedCheck(false) + : m_pDirWatch(0) + , m_pTimer(new QTimer(this)) + , m_recreateCount(0) + , m_recreateBusy(false) + , m_needDelayedCheck(false) { _self = this; @@ -111,19 +115,13 @@ new KdedAdaptor(this); QDBusConnection session = QDBusConnection::sessionBus(); - session.registerObject("/kbuildsycoca", this); - session.registerObject("/kded", this); + session.registerObject(QStringLiteral("/kbuildsycoca"), this); + session.registerObject(QStringLiteral("/kded"), this); qDBusAddSpyHook(messageFilter); - m_pTimer = new QTimer(this); m_pTimer->setSingleShot(true); connect(m_pTimer, &QTimer::timeout, this, static_cast<void(Kded::*)()>(&Kded::recreate)); - - m_pDirWatch = 0; - - m_recreateCount = 0; - m_recreateBusy = false; } Kded::~Kded() @@ -133,8 +131,8 @@ delete m_pTimer; delete m_pDirWatch; - for (QHash<QString, KDEDModule *>::iterator - it(m_modules.begin()), itEnd(m_modules.end()); + for (QHash<QString, KDEDModule *>::const_iterator + it(m_modules.constBegin()), itEnd(m_modules.constEnd()); it != itEnd; ++it) { KDEDModule *module(it.value()); @@ -157,27 +155,11 @@ return; } - if (message.type() != QDBusMessage::MethodCallMessage) { + QString obj = KDEDModule::moduleForMessage(message); + if (obj.isEmpty() || obj == QLatin1String("ksycoca")) { return; } - QString obj = message.path(); - if (!obj.startsWith(MODULES_PATH)) { - return; - } - - // Remove the <MODULES_PATH> part - obj = obj.mid(strlen(MODULES_PATH)); - if (obj == "ksycoca") { - return; // Ignore this one. - } - - // Remove the part after the modules name - int index = obj.indexOf('/'); - if (index != -1) { - obj = obj.left(index); - } - if (self()->m_dontLoad.value(obj, 0)) { return; } @@ -189,12 +171,51 @@ Q_UNUSED(module); } -static int phaseForModule(const KService::Ptr &service) +static int phaseForModule(const KPluginMetaData &module) { - const QVariant phasev = service->property("X-KDE-Kded-phase", QVariant::Int); + const QVariant phasev = module.rawData().value("X-KDE-Kded-phase").toVariant(); return phasev.isValid() ? phasev.toInt() : 2; } +QVector<KPluginMetaData> Kded::availableModules() const +{ + QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins("kf5/kded"); + QSet<QString> moduleIds; + foreach (const KPluginMetaData &md, plugins) { + moduleIds.insert(md.pluginId()); + } + // also search for old .desktop based kded modules + KPluginInfo::List oldStylePlugins = KPluginInfo::fromServices(KServiceTypeTrader::self()->query("KDEDModule")); + foreach (const KPluginInfo &info, oldStylePlugins) { + if (moduleIds.contains(info.pluginName())) { + qCWarning(KDED).nospace() << "kded module " << info.pluginName() << " has already been found using " + "JSON metadata, please don't install the now unneeded .desktop file (" << info.entryPath() << ")."; + } else { + qCDebug(KDED).nospace() << "kded module " << info.pluginName() << " still uses .desktop files (" + << info.entryPath() << "). Please port it to JSON metadata."; + plugins.append(info.toMetaData()); + } + } + return plugins; +} + +static KPluginMetaData findModule(const QString &id) +{ + KPluginMetaData module(QStringLiteral("kf5/kded/") + id); + if (module.isValid()) { + return module; + } + // TODO KF6: remove the .desktop fallback code + KService::Ptr oldStyleModule = KService::serviceByDesktopPath(QStringLiteral("kded/") + id + QStringLiteral(".desktop")); + if (oldStyleModule) { + qCDebug(KDED).nospace() << "kded module " << oldStyleModule->desktopEntryName() + << " still uses .desktop files (" << oldStyleModule->entryPath() << "). Please port it to JSON metadata."; + return KPluginInfo(oldStyleModule).toMetaData(); + } + qCWarning(KDED) << "could not find kded module with id" << id; + return KPluginMetaData(); +} + void Kded::initModules() { m_dontLoad.clear(); @@ -222,15 +243,14 @@ const bool loadPhase2Now = (kde_running && qgetenv("KDED_STARTED_BY_KDEINIT").toInt() == 0); // Preload kded modules. - const KService::List kdedModules = KServiceTypeTrader::self()->query("KDEDModule"); - for (KService::List::ConstIterator it = kdedModules.begin(); it != kdedModules.end(); ++it) { - KService::Ptr service = *it; + const QVector<KPluginMetaData> kdedModules = availableModules(); + foreach (const KPluginMetaData &module, kdedModules) { // Should the service load on startup? - const bool autoload = isModuleAutoloaded(service); + const bool autoload = isModuleAutoloaded(module); // see ksmserver's README for description of the phases bool prevent_autoload = false; - switch (phaseForModule(service)) { + switch (phaseForModule(module)) { case 0: // always autoload break; case 1: // autoload only in KDE @@ -248,21 +268,21 @@ // Load the module if necessary and allowed if (autoload && !prevent_autoload) { - if (!loadModule(service, false)) { + if (!loadModule(module, false)) { continue; } } // Remember if the module is allowed to load on demand - bool loadOnDemand = isModuleLoadedOnDemand(service); + bool loadOnDemand = isModuleLoadedOnDemand(module); if (!loadOnDemand) { - noDemandLoad(service->desktopEntryName()); + noDemandLoad(module.pluginId()); } // In case of reloading the configuration it is possible for a module // to run even if it is now allowed to. Stop it then. if (!loadOnDemand && !autoload) { - unloadModule(service->desktopEntryName().toLatin1()); + unloadModule(module.pluginId()); } } } @@ -271,13 +291,12 @@ { qCDebug(KDED) << "Loading second phase autoload"; KSharedConfig::Ptr config = KSharedConfig::openConfig(); - KService::List kdedModules = KServiceTypeTrader::self()->query("KDEDModule"); - for (KService::List::ConstIterator it = kdedModules.constBegin(); it != kdedModules.constEnd(); ++it) { - const KService::Ptr service = *it; - const bool autoload = isModuleAutoloaded(service); - if (autoload && phaseForModule(service) == 2) { - qCDebug(KDED) << "2nd phase: loading" << service->desktopEntryName(); - loadModule(service, false); + QVector<KPluginMetaData> kdedModules = availableModules(); + foreach (const KPluginMetaData &module, kdedModules) { + const bool autoload = isModuleAutoloaded(module); + if (autoload && phaseForModule(module) == 2) { + qCDebug(KDED) << "2nd phase: loading" << module.pluginId(); + loadModule(module, false); } } } @@ -291,47 +310,46 @@ { KSharedConfig::Ptr config = KSharedConfig::openConfig(); // Ensure the service exists. - KService::Ptr service = KService::serviceByDesktopPath("kded/" + obj + ".desktop"); - if (!service) { + KPluginMetaData module = findModule(obj); + if (!module.isValid()) { return; } - KConfigGroup cg(config, QString("Module-%1").arg(service->desktopEntryName())); + KConfigGroup cg(config, QString("Module-").append(module.pluginId())); cg.writeEntry("autoload", autoload); cg.sync(); } bool Kded::isModuleAutoloaded(const QString &obj) const { - KService::Ptr s = KService::serviceByDesktopPath("kded/" + obj + ".desktop"); - if (!s) { - return false; - } - return isModuleAutoloaded(s); + return isModuleAutoloaded(findModule(obj)); } -bool Kded::isModuleAutoloaded(const KService::Ptr &module) const +bool Kded::isModuleAutoloaded(const KPluginMetaData &module) const { + if (!module.isValid()) { + return false; + } KSharedConfig::Ptr config = KSharedConfig::openConfig(); - bool autoload = module->property("X-KDE-Kded-autoload", QVariant::Bool).toBool(); - KConfigGroup cg(config, QString("Module-%1").arg(module->desktopEntryName())); + bool autoload = module.rawData().value(QStringLiteral("X-KDE-Kded-autoload")).toVariant().toBool(); + KConfigGroup cg(config, QString("Module-").append(module.pluginId())); autoload = cg.readEntry("autoload", autoload); return autoload; } bool Kded::isModuleLoadedOnDemand(const QString &obj) const { - KService::Ptr s = KService::serviceByDesktopPath("kded/" + obj + ".desktop"); - if (!s) { - return false; - } - return isModuleLoadedOnDemand(s); + return isModuleLoadedOnDemand(findModule(obj)); } -bool Kded::isModuleLoadedOnDemand(const KService::Ptr &module) const +bool Kded::isModuleLoadedOnDemand(const KPluginMetaData &module) const { + if (!module.isValid()) { + return false; + } KSharedConfig::Ptr config = KSharedConfig::openConfig(); bool loadOnDemand = true; - QVariant p = module->property("X-KDE-Kded-load-on-demand", QVariant::Bool); + // use toVariant() since it could be string or bool in the json and QJsonObject does not convert + QVariant p = module.rawData().value(QStringLiteral("X-KDE-Kded-load-on-demand")).toVariant(); if (p.isValid() && (p.toBool() == false)) { loadOnDemand = false; } @@ -341,67 +359,68 @@ KDEDModule *Kded::loadModule(const QString &obj, bool onDemand) { // Make sure this method is only called with valid module names. - Q_ASSERT(obj.indexOf('/') == -1); - + if (obj.contains('/')) { + qCWarning(KDED) << "attempting to load invalid kded module name:" << obj; + return nullptr; + } KDEDModule *module = m_modules.value(obj, 0); if (module) { return module; } - KService::Ptr s = KService::serviceByDesktopPath("kded/" + obj + ".desktop"); - return loadModule(s, onDemand); + return loadModule(findModule(obj), onDemand); } -KDEDModule *Kded::loadModule(const KService::Ptr &s, bool onDemand) +KDEDModule *Kded::loadModule(const KPluginMetaData &module, bool onDemand) { - if (s && !s->library().isEmpty()) { - QString obj = s->desktopEntryName(); - KDEDModule *oldModule = m_modules.value(obj, 0); - if (oldModule) { - return oldModule; - } + if (!module.isValid() || module.fileName().isEmpty()) { + qCWarning(KDED) << "attempted to load an invalid module."; + return nullptr; + } + const QString moduleId = module.pluginId(); + KDEDModule *oldModule = m_modules.value(moduleId, 0); + if (oldModule) { + qCDebug(KDED) << "kded module" << moduleId << "is already loaded."; + return oldModule; + } - if (onDemand) { - QVariant p = s->property("X-KDE-Kded-load-on-demand", QVariant::Bool); - if (p.isValid() && (p.toBool() == false)) { - noDemandLoad(s->desktopEntryName()); - return 0; - } + if (onDemand) { + // use toVariant() since it could be string or bool in the json and QJsonObject does not convert + QVariant p = module.rawData().value(QStringLiteral("X-KDE-Kded-load-on-demand")).toVariant(); + if (p.isValid() && (p.toBool() == false)) { + noDemandLoad(moduleId); + return nullptr; } + } - KDEDModule *module = 0; + KDEDModule *kdedModule = nullptr; - QString errorMessage; - QStringList libNames; - libNames << s->library() - << "kded_" + s->library(); // old-style naming - Q_FOREACH(const QString &libname, libNames) { - KPluginLoader loader(libname); - KPluginFactory *factory = loader.factory(); - if (factory) { - // create the module - module = factory->create<KDEDModule>(this); - if (module) { - break; - } - } else { - errorMessage = loader.errorString(); - } - } - - if (module) { - module->setModuleName(obj); - m_modules.insert(obj, module); - //m_libs.insert(obj, lib); - connect(module, &KDEDModule::moduleDeleted, this, &Kded::slotKDEDModuleRemoved); - qCDebug(KDED) << "Successfully loaded module" << obj; - return module; + KPluginLoader loader(module.fileName()); + KPluginFactory *factory = loader.factory(); + if (factory) { + kdedModule = factory->create<KDEDModule>(this); + } else { + // TODO: remove this fallback code, the kded modules should all be fixed instead + KPluginLoader loader2("kded_" + module.fileName()); + factory = loader2.factory(); + if (factory) { + qCWarning(KDED).nospace() << "found kded module " << moduleId + << " by prepending 'kded_' to the library path, please fix your metadata."; + kdedModule = factory->create<KDEDModule>(this); } else { - qCWarning(KDED) << "Could not load KDED module" << obj << ":" - << errorMessage << "(tried plugins named:" - << libNames << ")"; + qCWarning(KDED).nospace() << "Could not load kded module " << moduleId << ":" + << loader.errorString() << " (library path was:" << module.fileName() << ")"; } } - return 0; + + if (kdedModule) { + kdedModule->setModuleName(moduleId); + m_modules.insert(moduleId, kdedModule); + //m_libs.insert(moduleId, lib); + connect(kdedModule, &KDEDModule::moduleDeleted, this, &Kded::slotKDEDModuleRemoved); + qCDebug(KDED) << "Successfully loaded module" << moduleId; + return kdedModule; + } + return nullptr; } bool Kded::unloadModule(const QString &obj) @@ -586,8 +605,8 @@ void Kded::readDirectory(const QString &_path) { QString path(_path); - if (!path.endsWith('/')) { - path += '/'; + if (!path.endsWith(QLatin1Char('/'))) { + path += QLatin1Char('/'); } if (m_pDirWatch->contains(path)) { // Already seen this one? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kded-5.6.0/src/kded.h new/kded-5.7.0/src/kded.h --- old/kded-5.6.0/src/kded.h 2015-01-03 13:04:02.000000000 +0100 +++ new/kded-5.7.0/src/kded.h 2015-02-08 16:14:49.000000000 +0100 @@ -31,10 +31,10 @@ #include <ksycoca.h> #include <kdedmodule.h> -#include <kservice.h> class QDBusMessage; class QDBusServiceWatcher; +class KPluginMetaData; class KDirWatch; // No need for this in libkio - apps only get readonly access @@ -54,7 +54,6 @@ void noDemandLoad(const QString &obj); // Don't load obj on demand KDEDModule *loadModule(const QString &obj, bool onDemand); - KDEDModule *loadModule(const KService::Ptr &service, bool onDemand); QStringList loadedModules(); bool unloadModule(const QString &obj); //bool isWindowRegistered(qlonglong windowId) const; @@ -85,13 +84,6 @@ * @return @c true if the module will be loaded at startup, @c false otherwise */ bool isModuleAutoloaded(const QString &module) const; - /** - * Check if a module should be loaded on startup. - * - * @param module a service description for the module - * @return @c true if the module will be loaded at startup, @c false otherwise - */ - bool isModuleAutoloaded(const KService::Ptr &module) const; //@} //@{ @@ -103,14 +95,6 @@ * is requested, @c false otherwise */ bool isModuleLoadedOnDemand(const QString &module) const; - /** - * Check if a module should be loaded on demand - * - * @param module a service description for the module - * @return @c true if the module will be loaded when its D-Bus interface - * is requested, @c false otherwise - */ - bool isModuleLoadedOnDemand(const KService::Ptr &module) const; //@} /** @@ -181,7 +165,26 @@ * Scans dir for new files and new subdirectories. */ void readDirectory(const QString &dir); + /** + * Check if a module should be loaded on demand + * + * @param module a service description for the module + * @return @c true if the module will be loaded when its D-Bus interface + * is requested, @c false otherwise + */ + bool isModuleLoadedOnDemand(const KPluginMetaData &module) const; + + /** + * Check if a module should be loaded on startup. + * + * @param module a service description for the module + * @return @c true if the module will be loaded at startup, @c false otherwise + */ + bool isModuleAutoloaded(const KPluginMetaData &module) const; + + KDEDModule *loadModule(const KPluginMetaData &module, bool onDemand); + QVector<KPluginMetaData> availableModules() const; /** * Pointer to the dirwatch class which tells us, when some directories * changed. -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org