Changeset View
Changeset View
Standalone View
Standalone View
kcms/translations/translations.cpp
Show All 15 Lines | |||||
16 | * along with this library; see the file COPYING.LIB. If not, write to | 16 | * along with this library; see the file COPYING.LIB. If not, write to | ||
17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | * Boston, MA 02110-1301, USA. | 18 | * Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "translations.h" | 21 | #include "translations.h" | ||
22 | #include "translationsmodel.h" | 22 | #include "translationsmodel.h" | ||
23 | 23 | | |||
24 | #include "writeexports.h" | | |||
25 | | ||||
26 | #include <KAboutData> | 24 | #include <KAboutData> | ||
27 | #include <KLocalizedString> | 25 | #include <KLocalizedString> | ||
28 | #include <KPluginFactory> | 26 | #include <KPluginFactory> | ||
29 | #include <KSharedConfig> | 27 | #include <KSharedConfig> | ||
30 | 28 | | |||
31 | K_PLUGIN_CLASS_WITH_JSON(Translations, "kcm_translations.json") | 29 | K_PLUGIN_CLASS_WITH_JSON(Translations, "kcm_translations.json") | ||
32 | 30 | | |||
31 | static const QString configFile = QStringLiteral("plasma-localerc"); | ||||
32 | static const QString lcLanguage = QStringLiteral("LANGUAGE"); | ||||
33 | | ||||
33 | Translations::Translations(QObject *parent, const QVariantList &args) | 34 | Translations::Translations(QObject *parent, const QVariantList &args) | ||
34 | : KQuickAddons::ConfigModule(parent, args) | 35 | : KQuickAddons::ConfigModule(parent, args) | ||
35 | , m_translationsModel(new TranslationsModel(this)) | 36 | , m_translationsModel(new TranslationsModel(this)) | ||
36 | , m_selectedTranslationsModel(new SelectedTranslationsModel(this)) | 37 | , m_selectedTranslationsModel(new SelectedTranslationsModel(this)) | ||
37 | , m_availableTranslationsModel(new AvailableTranslationsModel(this)) | 38 | , m_availableTranslationsModel(new AvailableTranslationsModel(this)) | ||
38 | , m_everSaved(false) | 39 | , m_everSaved(false) | ||
39 | { | 40 | { | ||
40 | KAboutData *about = new KAboutData(QStringLiteral("kcm_translations"), | 41 | KAboutData *about = new KAboutData(QStringLiteral("kcm_translations"), | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 93 | { | |||
98 | const auto missingLanguages = m_selectedTranslationsModel->missingLanguages(); | 99 | const auto missingLanguages = m_selectedTranslationsModel->missingLanguages(); | ||
99 | for (const QString& lang : missingLanguages) { | 100 | for (const QString& lang : missingLanguages) { | ||
100 | m_configuredLanguages.removeOne(lang); | 101 | m_configuredLanguages.removeOne(lang); | ||
101 | } | 102 | } | ||
102 | 103 | | |||
103 | m_config.writeEntry(lcLanguage, m_configuredLanguages.join(QLatin1Char(':')), KConfig::Persistent); | 104 | m_config.writeEntry(lcLanguage, m_configuredLanguages.join(QLatin1Char(':')), KConfig::Persistent); | ||
104 | m_config.sync(); | 105 | m_config.sync(); | ||
105 | 106 | | |||
106 | writeExports(); | | |||
107 | | ||||
108 | m_selectedTranslationsModel->setSelectedLanguages(m_configuredLanguages); | 107 | m_selectedTranslationsModel->setSelectedLanguages(m_configuredLanguages); | ||
109 | } | 108 | } | ||
110 | 109 | | |||
111 | void Translations::defaults() | 110 | void Translations::defaults() | ||
112 | { | 111 | { | ||
113 | KConfigGroup formatsConfig = KConfigGroup(KSharedConfig::openConfig(configFile), "Formats"); | 112 | KConfigGroup formatsConfig = KConfigGroup(KSharedConfig::openConfig(configFile), "Formats"); | ||
114 | 113 | | |||
115 | QString lang = formatsConfig.readEntry("LANG", QString()); | 114 | QString lang = formatsConfig.readEntry("LANG", QString()); | ||
Show All 29 Lines |