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

#include "802-3-ethernetpersistence.h"

using namespace Knm;

WiredPersistence::WiredPersistence(WiredSetting * setting, KSharedConfig::Ptr config, SettingPersistence::SecretStorageMode mode) : SettingPersistence(setting, config, mode)
{
}

WiredPersistence::~WiredPersistence()
{
}

void WiredPersistence::load()
{
  WiredSetting * setting = static_cast<WiredSetting *>(m_setting);
  {
    QString contents = m_config->readEntry("port", "tp");
    if (contents == "tp")
      setting->setPort(WiredSetting::EnumPort::tp);
    else     if (contents == "aui")
      setting->setPort(WiredSetting::EnumPort::aui);
    else     if (contents == "bnc")
      setting->setPort(WiredSetting::EnumPort::bnc);
    else     if (contents == "mii")
      setting->setPort(WiredSetting::EnumPort::mii);

  }
  setting->setSpeed(m_config->readEntry("speed", 0));
  {
    QString contents = m_config->readEntry("duplex", "full");
    if (contents == "half")
      setting->setDuplex(WiredSetting::EnumDuplex::half);
    else     if (contents == "full")
      setting->setDuplex(WiredSetting::EnumDuplex::full);

  }
  setting->setAutonegotiate(m_config->readEntry("autonegotiate", true));
  setting->setMacaddress(macaddressFromString(m_config->readEntry("macaddress", QString())));
  setting->setMtu(m_config->readEntry("mtu", 0));
}
