// This file is generated by kconfig_compiler from 802-11-wireless.kcfg.
// All changes you do to this file will be lost.

#include "802-11-wirelesspersistence.h"

using namespace Knm;

WirelessPersistence::WirelessPersistence(WirelessSetting * setting, KSharedConfig::Ptr config, SettingPersistence::SecretStorageMode mode) : SettingPersistence(setting, config, mode)
{
}

WirelessPersistence::~WirelessPersistence()
{
}

void WirelessPersistence::load()
{
  WirelessSetting * setting = static_cast<WirelessSetting *>(m_setting);
  setting->setSsid(m_config->readEntry("ssid", QByteArray()));
  {
    QString contents = m_config->readEntry("mode", "infrastructure");
    if (contents == "infrastructure")
      setting->setMode(WirelessSetting::EnumMode::infrastructure);
    else if (contents == "adhoc")
      setting->setMode(WirelessSetting::EnumMode::adhoc);

  }
  {
    QString contents = m_config->readEntry("band", "bg");
    if (contents == "a")
      setting->setBand(WirelessSetting::EnumBand::a);
    else if (contents == "bg")
      setting->setBand(WirelessSetting::EnumBand::bg);

  }
  setting->setChannel(m_config->readEntry("channel", 0));
  setting->setBssid(m_config->readEntry("bssid", QByteArray()));
  setting->setRate(m_config->readEntry("rate", 0));
  setting->setTxpower(m_config->readEntry("txpower", 0));
  setting->setMacaddress(macaddressFromString(m_config->readEntry("macaddress", QString())));
  setting->setMtu(m_config->readEntry("mtu", 0));
  setting->setSeenbssids(m_config->readEntry("seenbssids", QStringList()));
  setting->setSecurity(m_config->readEntry("security", ""));
}
