[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-games-devel
Subject:    Re: [Kde-games-devel] Data migration issue
From:       David Faure <faure () kde ! org>
Date:       2015-03-22 17:19:46
Message-ID: 21629853.YWXrqbjI6V () asterix
[Download RAW message or body]

On Saturday 21 March 2015 23:53:07 Albert Astals Cid wrote:
> Too late for KDE Applications 15.04 though now that i think, so maybe we 
> actually have to suggest everybody using the migrator to add those extra 
> lines?

OK, that means:

--- a/src/lib/util/kdelibs4configmigrator.h
+++ b/src/lib/util/kdelibs4configmigrator.h
@@ -60,6 +60,10 @@ public:
      *    look for old data to migrate as well
      * }
      * @endcode
+     *
+     * IMPORTANT: after migrate() returns true, call \
KSharedConfig::openConfig()->reparseConfiguration() +     * so that the global config \
(very likely already created by e.g. the platform integration plugin) +     * can see \
                the migrated data.
      */
     bool migrate();
 
But wait, this makes me realize another solution: kdelibs4configmigrator could load \
the framework integration plugin, which would take care of this, if installed.

Patch attached. Tested, at least to the extent that the slot is indeed being called.

Obviously that's still "too late for KDE Applications 15.04", so maybe fix the apps \
that you want to see fixed for 15.04 with a
#if KCOREADDONS_VERSION < 0x050900
KSharedConfig::openConfig()->reparseConfiguration();
#endif

and KF 5.9 will make this unnecessary, i.e. the doc change won't get committed.

Any input?

-- 
David Faure, faure@kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5


["kcoreaddons.diff" (kcoreaddons.diff)]

diff --git a/src/lib/util/kdelibs4configmigrator.cpp b/src/lib/util/kdelibs4configmigrator.cpp
index cde7ab4..c8560c1 100644
--- a/src/lib/util/kdelibs4configmigrator.cpp
+++ b/src/lib/util/kdelibs4configmigrator.cpp
@@ -26,6 +26,7 @@
 #include <QFileInfo>
 #include <QDir>
 #include <QDebug>
+#include <QPluginLoader>
 
 class Kdelibs4ConfigMigrator::Private
 {
@@ -108,5 +109,12 @@ bool Kdelibs4ConfigMigrator::migrate()
             }
         }
     }
+
+    // Trigger KSharedConfig::openConfig()->reparseConfiguration() via the framework integration plugin
+    QPluginLoader lib(QStringLiteral("kf5/FrameworkIntegrationPlugin"));
+    QObject *rootObj = lib.instance();
+    if (rootObj) {
+        QMetaObject::invokeMethod(rootObj, "reparseConfiguration");
+    }
     return true;
 }

["frameworkintegration.diff" (frameworkintegration.diff)]

diff --git a/src/integrationplugin/frameworkintegrationplugin.cpp \
b/src/integrationplugin/frameworkintegrationplugin.cpp index a45ba9d..e44b73b 100644
--- a/src/integrationplugin/frameworkintegrationplugin.cpp
+++ b/src/integrationplugin/frameworkintegrationplugin.cpp
@@ -135,3 +135,8 @@ KFrameworkIntegrationPlugin::KFrameworkIntegrationPlugin()
     setProperty(KMESSAGEBOXDONTASKAGAIN_PROPERTY, \
QVariant::fromValue<KMessageBoxDontAskAgainInterface \
                *>(&m_dontAskAgainConfigStorage));
     setProperty(KMESSAGEBOXNOTIFY_PROPERTY, \
QVariant::fromValue<KMessageBoxNotifyInterface *>(&m_notify));  }
+
+void KFrameworkIntegrationPlugin::reparseConfiguration()
+{
+    KSharedConfig::openConfig()->reparseConfiguration();
+}
diff --git a/src/integrationplugin/frameworkintegrationplugin.h \
b/src/integrationplugin/frameworkintegrationplugin.h index f87a941..8639f7e 100644
--- a/src/integrationplugin/frameworkintegrationplugin.h
+++ b/src/integrationplugin/frameworkintegrationplugin.h
@@ -63,6 +63,9 @@ public:
 
     KFrameworkIntegrationPlugin();
 
+public Q_SLOTS:
+    void reparseConfiguration();
+
 private:
     KMessageBoxDontAskAgainConfigStorage m_dontAskAgainConfigStorage;
     KMessageBoxNotify m_notify;


[Attachment #5 (text/plain)]

_______________________________________________
kde-games-devel mailing list
kde-games-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-games-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic