[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [plasma-desktop] kcms/krdb: Allow for colorschemes names not perfectly matching the filename
From: David Edmundson <kde () davidedmundson ! co ! uk>
Date: 2014-07-09 23:42:02
Message-ID: E1X51Uw-0007Bs-0V () scm ! kde ! org
[Download RAW message or body]
Git commit 60daaff19238b8d64200a62a235e2a1dbc5139a7 by David Edmundson.
Committed on 09/07/2014 at 23:37.
Pushed by davidedmundson into branch 'master'.
Allow for colorschemes names not perfectly matching the filename
This allows selecting "obsidian coast" (for example) to work
M +10 -1 kcms/krdb/krdb.cpp
http://commits.kde.org/plasma-desktop/60daaff19238b8d64200a62a235e2a1dbc5139a7
diff --git a/kcms/krdb/krdb.cpp b/kcms/krdb/krdb.cpp
index 5dc0a47..2a8ca21 100644
--- a/kcms/krdb/krdb.cpp
+++ b/kcms/krdb/krdb.cpp
@@ -603,8 +603,17 @@ void runRdb( uint flags )
if (colorSchemeName.isEmpty()) {
return;
}
+ //fix filename, copied from ColorsCM::saveScheme()
+ QString colorSchemeFilename = colorSchemeName;
+ colorSchemeFilename.remove('\''); // So Foo's does not become FooS
+ QRegExp fixer("[\\W,.-]+(.?)");
+ int offset;
+ while ((offset = fixer.indexIn(colorSchemeFilename)) >= 0)
+ colorSchemeFilename.replace(offset, fixer.matchedLength(), \
fixer.cap(1).toUpper()); + colorSchemeFilename.replace(0, 1, \
filename.at(0).toUpper()); +
//clone the color scheme
- QString src = QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
"color-schemes/" + colorSchemeName + ".colors"); + QString src = \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, "color-schemes/" + \
colorSchemeFilename + ".colors"); QString dest = migration.saveLocation("data", \
"color-schemes") + colorSchemeName + ".colors";
QFile::remove(dest);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic