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

#include "serialpersistence.h"

using namespace Knm;

SerialPersistence::SerialPersistence(SerialSetting * setting, KSharedConfig::Ptr config, SettingPersistence::SecretStorageMode mode) : SettingPersistence(setting, config, mode)
{
}

SerialPersistence::~SerialPersistence()
{
}

void SerialPersistence::load()
{
  SerialSetting * setting = static_cast<SerialSetting *>(m_setting);
  setting->setBaud(m_config->readEntry("baud", 115200));
  setting->setBits(m_config->readEntry("bits", 8));
  {
    QString contents = m_config->readEntry("parity", "None");
    if (contents == "None")
      setting->setParity(SerialSetting::EnumParity::None);
    else     if (contents == "Even")
      setting->setParity(SerialSetting::EnumParity::Even);
    else     if (contents == "Odd")
      setting->setParity(SerialSetting::EnumParity::Odd);

  }
  setting->setStopbits(m_config->readEntry("stopbits", 1));
  setting->setSenddelay(m_config->readEntry("senddelay", 0));
}
