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

#include "gsmpersistence.h"

using namespace Knm;

GsmPersistence::GsmPersistence(GsmSetting * setting, KSharedConfig::Ptr config, SettingPersistence::SecretStorageMode mode) : SettingPersistence(setting, config, mode)
{
}

GsmPersistence::~GsmPersistence()
{
}

void GsmPersistence::load()
{
  GsmSetting * setting = static_cast<GsmSetting *>(m_setting);
  setting->setNumber(m_config->readEntry("number", "*99#"));
  setting->setUsername(m_config->readEntry("username", ""));
  setting->setApn(m_config->readEntry("apn", ""));
  setting->setNetworkid(m_config->readEntry("networkid", ""));
  setting->setNetworktype(m_config->readEntry("networktype", 0));
  setting->setBand(m_config->readEntry("band", 0));
  // SECRETS
  if (m_storageMode == SettingPersistence::PlainText) {
    setting->setPassword(m_config->readEntry("password", ""));
    if (setting->password().isEmpty()) {
      setting->setPasswordflags(Setting::NotRequired);
    } else {
      setting->setPasswordflags(Setting::AgentOwned);
    }

    // Do not read pin.
    //setting->setPin(m_config->readEntry("pin", ""));
    if (setting->pin().isEmpty()) {
      setting->setPinflags(Setting::NotRequired);
    } else {
      setting->setPinflags(Setting::AgentOwned);
    }
    setting->setSecretsAvailable(true);
  }
}
