// This file is generated by kconfig_compiler_kf5 from translationssettingsbase.kcfg.
// All changes you do to this file will be lost.

#include "translationssettingsbase.h"

TranslationsSettingsBase::TranslationsSettingsBase( QObject *parent )
  : KConfigSkeleton( QStringLiteral( "plasma-localerc" ) )
{
  setParent(parent);
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&TranslationsSettingsBase::itemChanged);

  setCurrentGroup( QStringLiteral( "Translations" ) );


      KConfigGroup formatsConfig = KConfigGroup(KSharedConfig::openConfig("plasma-localerc"), "Formats");

      QString lang = formatsConfig.readEntry("LANG", QString());

      if (lang.isEmpty()
          || !KLocalizedString::availableDomainTranslations("plasmashell").contains(lang)) {
          lang = QLocale::system().name();
      }

      if (!KLocalizedString::availableDomainTranslations("plasmashell").contains(lang)) {
          lang = QStringLiteral("en_US");
      }
      
  KConfigCompilerSignallingItem  *itemLanguageString;
  KConfigSkeleton::ItemString  *innerItemLanguageString;
  innerItemLanguageString = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "LANGUAGE" ), mLanguageString, lang );
  itemLanguageString = new KConfigCompilerSignallingItem(innerItemLanguageString, this, notifyFunction, signalLanguageStringChanged);
  addItem( itemLanguageString, QStringLiteral( "languageString" ) );
}

QString TranslationsSettingsBase::defaultLanguageStringValue_helper() const
{

      KConfigGroup formatsConfig = KConfigGroup(KSharedConfig::openConfig("plasma-localerc"), "Formats");

      QString lang = formatsConfig.readEntry("LANG", QString());

      if (lang.isEmpty()
          || !KLocalizedString::availableDomainTranslations("plasmashell").contains(lang)) {
          lang = QLocale::system().name();
      }

      if (!KLocalizedString::availableDomainTranslations("plasmashell").contains(lang)) {
          lang = QStringLiteral("en_US");
      }
      
  return lang;
}

TranslationsSettingsBase::~TranslationsSettingsBase()
{
}


void TranslationsSettingsBase::itemChanged(quint64 flags) {

  if ( flags & signalLanguageStringChanged ) {
    Q_EMIT languageStringChanged();
  }
}

#include "translationssettingsbase.moc"

