summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJekyll Wu <adaptee@gmail.com>2012-05-15 17:08:00 (GMT)
committerJekyll Wu <adaptee@gmail.com>2012-05-15 17:10:04 (GMT)
commit6fa0121b8ef31934153767678ed18467e900eca0 (patch)
tree37c2805a4159233db70819f93f864073b6f59c12
parenteec927bd887f1939dbc544df7d795a9cf282634d (diff)
When saving profile, always use its untranslated name as filename
An internal property is introduced to record the untranslated name. When saving profile into disk, always refer to that untranslated name to get the filename. This extra consideration is intended to deal with the situation when the profile's contents are i18nized. The typical example is the "Shell" profile shipped by default. BUG: 250506 FIXED-IN: 4.9.0
-rw-r--r--src/Profile.cpp2
-rw-r--r--src/Profile.h9
-rw-r--r--src/ProfileReader.cpp2
-rw-r--r--src/ProfileWriter.cpp2
4 files changed, 14 insertions, 1 deletions
diff --git a/src/Profile.cpp b/src/Profile.cpp
index dfea342..ea6e0f6 100644
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -55,6 +55,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = {
// General
{ Path , "Path" , 0 , QVariant::String }
, { Name , "Name" , GENERAL_GROUP , QVariant::String }
+ , { UntranslatedName, "UntranslatedName" , 0 , QVariant::String }
, { Icon , "Icon" , GENERAL_GROUP , QVariant::String }
, { Command , "Command" , 0 , QVariant::String }
, { Arguments , "Arguments" , 0 , QVariant::StringList }
@@ -137,6 +138,7 @@ FallbackProfile::FallbackProfile()
{
// Fallback settings
setProperty(Name, i18n("Shell"));
+ setProperty(UntranslatedName, "Shell");
// magic path for the fallback profile which is not a valid
// non-directory file name
setProperty(Path, "FALLBACK/");
diff --git a/src/Profile.h b/src/Profile.h
index 98164ca..f59c891 100644
--- a/src/Profile.h
+++ b/src/Profile.h
@@ -79,6 +79,10 @@ public:
Path,
/** (QString) The descriptive name of this profile. */
Name,
+ /** (QString) The untranslted name of this profile.
+ * Warning: this is an internal property. Do not touch it.
+ */
+ UntranslatedName,
/** (QString) The name of the icon associated with this profile.
* This is used in menus and tabs to represent the profile.
*/
@@ -324,6 +328,11 @@ public:
return property<QString>(Profile::Name);
}
+ /** Convenience method for property<QString>(Profile::UntranslatedName) */
+ QString untranslatedName() const {
+ return property<QString>(Profile::UntranslatedName);
+ }
+
/** Convenience method for property<QString>(Profile::Directory) */
QString defaultWorkingDirectory() const {
return property<QString>(Profile::Directory);
diff --git a/src/ProfileReader.cpp b/src/ProfileReader.cpp
index 2cd9193..053f3e1 100644
--- a/src/ProfileReader.cpp
+++ b/src/ProfileReader.cpp
@@ -86,6 +86,8 @@ bool KDE4ProfileReader::readProfile(const QString& path , Profile::Ptr profile ,
profile->setProperty(Profile::Arguments, shellCommand.arguments());
}
+ profile->setProperty(Profile::UntranslatedName, general.readEntryUntranslated("Name"));
+
// Read remaining properties
readProperties(config, profile, Profile::DefaultPropertyNames);
diff --git a/src/ProfileWriter.cpp b/src/ProfileWriter.cpp
index d582733..8448e5a 100644
--- a/src/ProfileWriter.cpp
+++ b/src/ProfileWriter.cpp
@@ -45,7 +45,7 @@ QString KDE4ProfileWriter::getPath(const Profile::Ptr profile)
static const QString localDataLocation = KGlobal::dirs()->saveLocation("data", "konsole/");
static const QString systemDataLocation = KStandardDirs::installPath("data") + "konsole/";
- const QString candidateLocalPath = localDataLocation + profile->name() + ".profile";
+ const QString candidateLocalPath = localDataLocation + profile->untranslatedName() + ".profile";
QString newPath;
// when the path property is not set, it means the profile has just