Diffstat (limited to 'noncore/settings/language/language.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/language/language.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/language/language.cpp b/noncore/settings/language/language.cpp index 8985fd5..d30a041 100644 --- a/noncore/settings/language/language.cpp +++ b/noncore/settings/language/language.cpp | |||
@@ -70,83 +70,83 @@ LanguageSettings::LanguageSettings( QWidget* parent, const char* name, WFlags fl | |||
70 | langAvail.append(name); | 70 | langAvail.append(name); |
71 | Config conf( desktopFile.filePath(), Config::File ); | 71 | Config conf( desktopFile.filePath(), Config::File ); |
72 | QString langName = conf.readEntry( "Name" ); | 72 | QString langName = conf.readEntry( "Name" ); |
73 | QString ownName = conf.readEntryDirect( "Name[" + name + "]" ); | 73 | QString ownName = conf.readEntryDirect( "Name[" + name + "]" ); |
74 | if ( ownName.isEmpty() ) | 74 | if ( ownName.isEmpty() ) |
75 | ownName = conf.readEntryDirect( "Name" ); | 75 | ownName = conf.readEntryDirect( "Name" ); |
76 | if ( !ownName.isEmpty() && ownName != langName ) | 76 | if ( !ownName.isEmpty() && ownName != langName ) |
77 | langName = langName + " [" + ownName + "]"; | 77 | langName = langName + " [" + ownName + "]"; |
78 | languages->insertItem( langName ); | 78 | languages->insertItem( langName ); |
79 | 79 | ||
80 | } | 80 | } |
81 | } | 81 | } |
82 | if ( langAvail. find ( "en" ) == -1 ) { | 82 | if ( langAvail. find ( "en" ) == -1 ) { |
83 | langAvail. prepend ( "" ); // no tr | 83 | langAvail. prepend ( "" ); // no tr |
84 | languages-> insertItem ( QString ( "English [%1] (%2)" /* no tr (!) */ ). arg ( tr ( "English" )). arg ( tr( "default" )), 0 ); | 84 | languages-> insertItem ( QString ( "English [%1] (%2)" /* no tr (!) */ ). arg ( tr ( "English" )). arg ( tr( "default" )), 0 ); |
85 | } | 85 | } |
86 | 86 | ||
87 | dl = new QPEDialogListener(this); | 87 | dl = new QPEDialogListener(this); |
88 | reset(); | 88 | reset(); |
89 | } | 89 | } |
90 | 90 | ||
91 | LanguageSettings::~LanguageSettings() | 91 | LanguageSettings::~LanguageSettings() |
92 | {} | 92 | {} |
93 | 93 | ||
94 | void LanguageSettings::accept() | 94 | void LanguageSettings::accept() |
95 | { | 95 | { |
96 | applyLanguage(); | 96 | applyLanguage(); |
97 | QDialog::accept(); | 97 | QDialog::accept(); |
98 | } | 98 | } |
99 | 99 | ||
100 | void LanguageSettings::applyLanguage() | 100 | void LanguageSettings::applyLanguage() |
101 | { | 101 | { |
102 | setLanguage ( langAvail. at ( languages-> currentItem ( ))); | 102 | setLanguage ( langAvail. at ( languages-> currentItem ( ))); |
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | void LanguageSettings::reject() | 106 | void LanguageSettings::reject() |
107 | { | 107 | { |
108 | reset(); | 108 | reset(); |
109 | QDialog::reject(); | 109 | QDialog::reject(); |
110 | } | 110 | } |
111 | 111 | ||
112 | void LanguageSettings::reset() | 112 | void LanguageSettings::reset() |
113 | { | 113 | { |
114 | QString l = getenv("LANG"); | 114 | QString l = getenv("LANG"); |
115 | Config config("locale"); | 115 | Config config("locale"); |
116 | config.setGroup("Language"); | 116 | config.setGroup("Language"); |
117 | l = config.readEntry( "Language", l ); | 117 | l = config.readEntry( "Language", l ); |
118 | actualLanguage = l; | ||
118 | if (l.isEmpty()) | 119 | if (l.isEmpty()) |
119 | l = "en"; | 120 | l = "en"; |
120 | actualLanguage = l; | ||
121 | 121 | ||
122 | int n = langAvail.find( l ); | 122 | int n = langAvail.find( l ); |
123 | languages->setCurrentItem( n ); | 123 | languages->setCurrentItem( n ); |
124 | } | 124 | } |
125 | 125 | ||
126 | QString LanguageSettings::actualLanguage; | 126 | QString LanguageSettings::actualLanguage; |
127 | 127 | ||
128 | void LanguageSettings::setLanguage(const QString& lang) | 128 | void LanguageSettings::setLanguage(const QString& lang) |
129 | { | 129 | { |
130 | if ( lang != actualLanguage ) { | 130 | if ( lang != actualLanguage ) { |
131 | Config config("locale"); | 131 | Config config("locale"); |
132 | config.setGroup( "Language" ); | 132 | config.setGroup( "Language" ); |
133 | if ( lang. isEmpty ( )) | 133 | if ( lang. isEmpty ( )) |
134 | config. removeEntry ( "Language" ); | 134 | config. removeEntry ( "Language" ); |
135 | else | 135 | else |
136 | config.writeEntry( "Language", lang ); | 136 | config.writeEntry( "Language", lang ); |
137 | config.write(); | 137 | config.write(); |
138 | 138 | ||
139 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 139 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
140 | 140 | ||
141 | QCopEnvelope e("QPE/System", "language(QString)"); | 141 | QCopEnvelope e("QPE/System", "language(QString)"); |
142 | e << lang; | 142 | e << lang; |
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | void LanguageSettings::done(int r) | 148 | void LanguageSettings::done(int r) |
149 | { | 149 | { |
150 | QDialog::done(r); | 150 | QDialog::done(r); |
151 | close(); | 151 | close(); |
152 | } | 152 | } |