summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-16 14:00:44 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-16 14:00:44 (GMT)
commit6d203c3a07534bd0b8a167168ec51c6c3fee8f3c (patch)
tree2cbf44dc831f6acf7a663cd2dc85714da502e130
parent382c28bef6eca4bb097e88026ce766582cb4a1a0 (diff)
Fix parsing
-rw-r--r--src/kdebugsettingsutil.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/kdebugsettingsutil.cpp b/src/kdebugsettingsutil.cpp
index 9475fb6..03c3b25 100644
--- a/src/kdebugsettingsutil.cpp
+++ b/src/kdebugsettingsutil.cpp
@@ -25,6 +25,27 @@
RenameCategory KDebugSettingsUtil::parseRenameCategories(QString line)
{
RenameCategory category;
+ int pos = line.indexOf(QLatin1Char('#'));
+ if (pos != -1) {
+ line.truncate(pos);
+ line = line.simplified();
+ }
+
+ if (line.isEmpty()) {
+ return category;
+ }
+ line = line.simplified();
+ const int space = line.indexOf(QLatin1Char(' '));
+ if (space == -1) {
+ qCWarning(KDEBUGSETTINGS_LOG) << "No space:" << line << endl;
+ return category;
+ }
+
+ const QString originalName = line.left(space);
+
+ const QString newName = line.mid(space).simplified();
+ category.originalName = originalName;
+ category.newName = newName;
return category;
}