Changeset View
Changeset View
Standalone View
Standalone View
kcms/formats/kcmformats.cpp
Show All 13 Lines | |||||
14 | * | 14 | * | ||
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | // own | 19 | // own | ||
20 | #include "kcmformats.h" | 20 | #include "kcmformats.h" | ||
21 | #include "ui_kcmformatswidget.h" | 21 | #include "ui_kcmformatswidget.h" | ||
22 | #include "writeexports.h" | | |||
23 | 22 | | |||
24 | // Qt | 23 | // Qt | ||
25 | #include <QApplication> | 24 | #include <QApplication> | ||
26 | #include <QComboBox> | 25 | #include <QComboBox> | ||
27 | #include <QFile> | 26 | #include <QFile> | ||
28 | #include <QDebug> | 27 | #include <QDebug> | ||
29 | #include <QLocale> | 28 | #include <QLocale> | ||
30 | #include <QStandardPaths> | 29 | #include <QStandardPaths> | ||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Line(s) | 162 | } else { | |||
166 | } | 165 | } | ||
167 | icon = m_cachedUnknown; | 166 | icon = m_cachedUnknown; | ||
168 | } | 167 | } | ||
169 | m_cachedFlags.insert(flagCode, icon); | 168 | m_cachedFlags.insert(flagCode, icon); | ||
170 | 169 | | |||
171 | return icon; | 170 | return icon; | ||
172 | } | 171 | } | ||
173 | 172 | | |||
173 | const static QString configFile = QStringLiteral("plasma-localerc"); | ||||
174 | const static QString exportFile = QStringLiteral("plasma-locale-settings.sh"); | ||||
175 | | ||||
176 | const static QString lcLang = QStringLiteral("LANG"); | ||||
177 | const static QString lcNumeric = QStringLiteral("LC_NUMERIC"); | ||||
178 | const static QString lcTime = QStringLiteral("LC_TIME"); | ||||
179 | const static QString lcMonetary = QStringLiteral("LC_MONETARY"); | ||||
180 | const static QString lcMeasurement = QStringLiteral("LC_MEASUREMENT"); | ||||
181 | const static QString lcCollate = QStringLiteral("LC_COLLATE"); | ||||
182 | const static QString lcCtype = QStringLiteral("LC_CTYPE"); | ||||
183 | | ||||
184 | const static QString lcLanguage = QStringLiteral("LANGUAGE"); | ||||
185 | | ||||
186 | | ||||
187 | | ||||
174 | void KCMFormats::readConfig() | 188 | void KCMFormats::readConfig() | ||
175 | { | 189 | { | ||
176 | m_config = KConfigGroup(KSharedConfig::openConfig(configFile), "Formats"); | 190 | m_config = KConfigGroup(KSharedConfig::openConfig(configFile), "Formats"); | ||
177 | 191 | | |||
178 | bool useDetailed = m_config.readEntry("useDetailed", false); | 192 | bool useDetailed = m_config.readEntry("useDetailed", false); | ||
179 | m_ui->checkDetailed->setChecked(useDetailed); | 193 | m_ui->checkDetailed->setChecked(useDetailed); | ||
180 | 194 | | |||
181 | setCombo(m_ui->comboGlobal, m_config.readEntry(lcLang, qgetenv(lcLang.toLatin1()))); | 195 | setCombo(m_ui->comboGlobal, m_config.readEntry(lcLang, qgetenv(lcLang.toLatin1()))); | ||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | 207 | { | |||
265 | } | 279 | } | ||
266 | 280 | | |||
267 | m_config.sync(); | 281 | m_config.sync(); | ||
268 | } | 282 | } | ||
269 | 283 | | |||
270 | void KCMFormats::save() | 284 | void KCMFormats::save() | ||
271 | { | 285 | { | ||
272 | writeConfig(); | 286 | writeConfig(); | ||
273 | writeExports(); | | |||
274 | KMessageBox::information(this, i18n("Your changes will take effect the next time you log in."), | 287 | KMessageBox::information(this, i18n("Your changes will take effect the next time you log in."), | ||
275 | i18n("Format Settings Changed"), QStringLiteral("FormatSettingsChanged")); | 288 | i18n("Format Settings Changed"), QStringLiteral("FormatSettingsChanged")); | ||
276 | } | 289 | } | ||
277 | 290 | | |||
278 | void KCMFormats::defaults() | 291 | void KCMFormats::defaults() | ||
279 | { | 292 | { | ||
280 | m_ui->checkDetailed->setChecked(false); | 293 | m_ui->checkDetailed->setChecked(false); | ||
281 | 294 | | |||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |