author | sandman <sandman> | 2002-10-21 12:13:18 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-21 12:13:18 (UTC) |
commit | cdaf60fdf5dc19e88db4faa319daacfe4e879518 (patch) (unidiff) | |
tree | 39ef0f3b4505cddb7f7eca2f2a1b14528c937bf2 | |
parent | 3774660eaa50fe7adab39564ded7a2e1f296724b (diff) | |
download | opie-cdaf60fdf5dc19e88db4faa319daacfe4e879518.zip opie-cdaf60fdf5dc19e88db4faa319daacfe4e879518.tar.gz opie-cdaf60fdf5dc19e88db4faa319daacfe4e879518.tar.bz2 |
Language settings didn't let you de-select a language (i.e. if you have
opie-i18n-de, but NOT opie-i18n-en installed, you can't go back to english)
Now there's always a "English (default)" entry, as long as opie-i18n-en is
not installed.
-rw-r--r-- | noncore/settings/language/language.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/noncore/settings/language/language.cpp b/noncore/settings/language/language.cpp index 397d372..5c4284b 100644 --- a/noncore/settings/language/language.cpp +++ b/noncore/settings/language/language.cpp | |||
@@ -64,6 +64,7 @@ LanguageSettings::LanguageSettings( QWidget* parent, const char* name, WFlags f | |||
64 | if ( FontManager::hasUnicodeFont() ) | 64 | if ( FontManager::hasUnicodeFont() ) |
65 | languages->setFont(FontManager::unicodeFont(FontManager::Proportional)); | 65 | languages->setFont(FontManager::unicodeFont(FontManager::Proportional)); |
66 | 66 | ||
67 | |||
67 | QString tfn = QPEApplication::qpeDir()+"/i18n/"; | 68 | QString tfn = QPEApplication::qpeDir()+"/i18n/"; |
68 | QDir langDir = tfn; | 69 | QDir langDir = tfn; |
69 | QStringList list = langDir.entryList("*", QDir::Dirs ); | 70 | QStringList list = langDir.entryList("*", QDir::Dirs ); |
@@ -86,14 +87,17 @@ LanguageSettings::LanguageSettings( QWidget* parent, const char* name, WFlags f | |||
86 | 87 | ||
87 | } | 88 | } |
88 | } | 89 | } |
90 | if ( langAvail. find ( "en" ) == -1 ) { | ||
91 | langAvail. prepend ( "" ); // no tr | ||
92 | languages-> insertItem ( QString ( "English [%1] (%2)" /* no tr (!) */ ). arg ( tr ( "English" )). arg ( tr( "default" )), 0 ); | ||
93 | } | ||
89 | 94 | ||
90 | dl = new QPEDialogListener(this); | 95 | dl = new QPEDialogListener(this); |
91 | reset(); | 96 | reset(); |
92 | } | 97 | } |
93 | 98 | ||
94 | LanguageSettings::~LanguageSettings() | 99 | LanguageSettings::~LanguageSettings() |
95 | { | 100 | {} |
96 | } | ||
97 | 101 | ||
98 | void LanguageSettings::accept() | 102 | void LanguageSettings::accept() |
99 | { | 103 | { |
@@ -103,8 +107,7 @@ void LanguageSettings::accept() | |||
103 | 107 | ||
104 | void LanguageSettings::applyLanguage() | 108 | void LanguageSettings::applyLanguage() |
105 | { | 109 | { |
106 | QString lang = langAvail.at( languages->currentItem() ); | 110 | setLanguage ( langAvail. at ( languages-> currentItem ( ))); |
107 | setLanguage( lang ); | ||
108 | } | 111 | } |
109 | 112 | ||
110 | 113 | ||
@@ -117,9 +120,11 @@ void LanguageSettings::reject() | |||
117 | void LanguageSettings::reset() | 120 | void LanguageSettings::reset() |
118 | { | 121 | { |
119 | QString l = getenv("LANG"); | 122 | QString l = getenv("LANG"); |
120 | Config config("language"); | 123 | Config config("locale"); |
124 | config.setGroup("Language"); | ||
121 | l = config.readEntry( "Language", l ); | 125 | l = config.readEntry( "Language", l ); |
122 | if(l.isEmpty()) l = "en"; | 126 | if (l.isEmpty()) |
127 | l = "en"; | ||
123 | actualLanguage = l; | 128 | actualLanguage = l; |
124 | 129 | ||
125 | int n = langAvail.find( l ); | 130 | int n = langAvail.find( l ); |
@@ -133,13 +138,18 @@ void LanguageSettings::setLanguage(const QString& lang) | |||
133 | if( lang != actualLanguage ) { | 138 | if( lang != actualLanguage ) { |
134 | Config config("locale"); | 139 | Config config("locale"); |
135 | config.setGroup( "Language" ); | 140 | config.setGroup( "Language" ); |
141 | if ( lang. isEmpty ( )) | ||
142 | config. removeEntry ( "Language" ); | ||
143 | else | ||
136 | config.writeEntry( "Language", lang ); | 144 | config.writeEntry( "Language", lang ); |
137 | config.write(); | 145 | config.write(); |
138 | 146 | ||
139 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 147 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
148 | |||
140 | QCopEnvelope e("QPE/System","language(QString)"); | 149 | QCopEnvelope e("QPE/System","language(QString)"); |
141 | e << lang; | 150 | e << lang; |
142 | #endif | 151 | #endif |
152 | |||
143 | } | 153 | } |
144 | } | 154 | } |
145 | 155 | ||