diff options
author | Montel Laurent <montel@kde.org> | 2015-01-06 21:54:21 +0100 |
---|---|---|
committer | Montel Laurent <montel@kde.org> | 2015-01-06 21:59:25 +0100 |
commit | 915976c1238be811f169eab1b02f7e8dad6410e0 (patch) | |
tree | a1a8980b028fddb0c40c63b5488f7dbcdaead909 /src | |
parent | 19ae8748a9352aa31c4919ca09b6f6eb6f03e45e (diff) | |
download | kconfig-915976c1238be811f169eab1b02f7e8dad6410e0.tar.gz kconfig-915976c1238be811f169eab1b02f7e8dad6410e0.tar.bz2 |
Don't upgrate config file with upd file from kde4.
This patch is necessary because:
When we use kf5 + kde4 application, kconf_update which launchs at the start when we launch kde.
But it will migrate some config file, for example it will show that we need to migrate konversation
so it will create a konversationrc in .config/
But when we launch konversation there is a kdelibs4migrator which wants to migrate settings and config in .config
but it shows a konversationrc in .config so it will never migrate and we will lose all settings.
So we can force to remove all .upd in kf5 but it will not fix problem during migration or when we have kde4 application
install in same directory as kf5.
So now I force for each upd file to have a "Version=5" so kconf_update (kf5) will migrate just kf5 upd file and it will fix my bugs.
REVIEW: 121797
CHANGELOG: Now kconf_update doesn't process upd file from kde4. We need to add "Version=5" in top of the upd file otherwise it will be skipped.
Diffstat (limited to 'src')
-rw-r--r-- | src/kconf_update/README.kconf_update | 4 | ||||
-rw-r--r-- | src/kconf_update/kconf_update.cpp | 19 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/kconf_update/README.kconf_update b/src/kconf_update/README.kconf_update index 281fb9e5..72509286 100644 --- a/src/kconf_update/README.kconf_update +++ b/src/kconf_update/README.kconf_update @@ -51,6 +51,9 @@ Commas (,) are used to seperate fields and may not occur as part of any field and all of the keywords are case-sensitive, i.e. you cannot say "key" instead of "Key" for example. +Starting from KDE Frameworks 5 make sure to put Version=5 before the first "Id=" otherwise the upd file +will be skipped and the config file will not be updated. + For the rest the file is parsed and executed sequentially from top to bottom. Each line can contain one entry. The following entries are recognized: @@ -161,6 +164,7 @@ Example update file =================== # This is comment +Version=5 Id=kde2.2 File=kioslaverc,kio_httprc Group=Proxy Settings diff --git a/src/kconf_update/kconf_update.cpp b/src/kconf_update/kconf_update.cpp index 255a382e..309bc3c2 100644 --- a/src/kconf_update/kconf_update.cpp +++ b/src/kconf_update/kconf_update.cpp @@ -29,6 +29,7 @@ #include <QCoreApplication> #include <QtCore/QDir> #include <QProcess> +#include <QDebug> #include <kconfig.h> #include <kconfiggroup.h> @@ -239,13 +240,21 @@ bool KonfUpdate::checkFile(const QString &filename) int lineCount = 0; resetOptions(); QString id; + bool foundVersion = false; while (!ts.atEnd()) { const QString line = ts.readLine().trimmed(); - lineCount++; + if (line.startsWith("Version=5")) { + foundVersion = true; + } + ++lineCount; if (line.isEmpty() || (line[0] == '#')) { continue; } if (line.startsWith("Id=")) { + if (!foundVersion) { + qDebug() << QStringLiteral("Missing \"Version=5\", file \'%1\' will be skipped.").arg(filename); + return true; + } id = m_currentFilename + ':' + line.mid(3); } else if (line.startsWith("File=")) { checkGotFile(line.mid(5), id); @@ -315,13 +324,21 @@ bool KonfUpdate::updateFile(const QString &filename) ts.setCodec(QTextCodec::codecForName("ISO-8859-1")); m_lineCount = 0; resetOptions(); + bool foundVersion = false; while (!ts.atEnd()) { m_line = ts.readLine().trimmed(); + if (m_line.startsWith("Version=5")) { + foundVersion = true; + } m_lineCount++; if (m_line.isEmpty() || (m_line[0] == QLatin1Char('#'))) { continue; } if (m_line.startsWith(QLatin1String("Id="))) { + if (!foundVersion) { + qDebug() << QStringLiteral("Missing \"Version=5\", file \'%1\' will be skipped.").arg(filename); + break; + } gotId(m_line.mid(3)); } else if (m_skip) { continue; |