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

#include "plasmaloginsettingsbase.h"

#include <qglobal.h>
#include <QFile>

#include <QDebug>

class PlasmaLoginSettingsBaseHelper
{
  public:
    PlasmaLoginSettingsBaseHelper() noexcept : q(nullptr) {}
    ~PlasmaLoginSettingsBaseHelper() noexcept { delete q; q = nullptr; }
    PlasmaLoginSettingsBaseHelper(const PlasmaLoginSettingsBaseHelper&) = delete;
    PlasmaLoginSettingsBaseHelper& operator=(const PlasmaLoginSettingsBaseHelper&) = delete;
    PlasmaLoginSettingsBase *q;
};
Q_GLOBAL_STATIC(PlasmaLoginSettingsBaseHelper, s_globalPlasmaLoginSettingsBase)
PlasmaLoginSettingsBase *PlasmaLoginSettingsBase::self()
{
  if (!s_globalPlasmaLoginSettingsBase()->q)
     qFatal("you need to call PlasmaLoginSettingsBase::instance before using");
  return s_globalPlasmaLoginSettingsBase()->q;
}

void PlasmaLoginSettingsBase::instance(const QString& cfgfilename)
{
  if (s_globalPlasmaLoginSettingsBase()->q) {
     qDebug() << "PlasmaLoginSettingsBase::instance called after the first use - ignoring";
     return;
  }
  new PlasmaLoginSettingsBase(KSharedConfig::openConfig(cfgfilename));
  s_globalPlasmaLoginSettingsBase()->q->read();
}

void PlasmaLoginSettingsBase::instance(KSharedConfig::Ptr config)
{
  if (s_globalPlasmaLoginSettingsBase()->q) {
     qDebug() << "PlasmaLoginSettingsBase::instance called after the first use - ignoring";
     return;
  }
  new PlasmaLoginSettingsBase(std::move(config));
  s_globalPlasmaLoginSettingsBase()->q->read();
}

PlasmaLoginSettingsBase::PlasmaLoginSettingsBase( KSharedConfig::Ptr config )
  : PlasmaLoginSettingsDefaults( std::move( config ) )
{
  Q_ASSERT(!s_globalPlasmaLoginSettingsBase()->q);
  s_globalPlasmaLoginSettingsBase()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&PlasmaLoginSettingsBase::itemChanged);

  setCurrentGroup( QStringLiteral( "Autologin" ) );

  KConfigCompilerSignallingItem  *itemUser;
  PlasmaLoginSettingsDefaults::ItemString  *innerItemUser;
  innerItemUser = new PlasmaLoginSettingsDefaults::ItemString( currentGroup(), QStringLiteral( "User" ), mUser, defaultUser() );
  itemUser = new KConfigCompilerSignallingItem(innerItemUser, this, notifyFunction, signalUserChanged);
  addItem( itemUser, QStringLiteral( "User" ) );
  KConfigCompilerSignallingItem  *itemSession;
  PlasmaLoginSettingsDefaults::ItemString  *innerItemSession;
  innerItemSession = new PlasmaLoginSettingsDefaults::ItemString( currentGroup(), QStringLiteral( "Session" ), mSession, defaultSession() );
  itemSession = new KConfigCompilerSignallingItem(innerItemSession, this, notifyFunction, signalSessionChanged);
  addItem( itemSession, QStringLiteral( "Session" ) );
  KConfigCompilerSignallingItem  *itemRelogin;
  PlasmaLoginSettingsDefaults::ItemBool  *innerItemRelogin;
  innerItemRelogin = new PlasmaLoginSettingsDefaults::ItemBool( currentGroup(), QStringLiteral( "Relogin" ), mRelogin, defaultRelogin() );
  itemRelogin = new KConfigCompilerSignallingItem(innerItemRelogin, this, notifyFunction, signalReloginChanged);
  addItem( itemRelogin, QStringLiteral( "Relogin" ) );

  setCurrentGroup( QStringLiteral( "Greeter" ) );

  KConfigCompilerSignallingItem  *itemPreselectedUser;
  PlasmaLoginSettingsDefaults::ItemString  *innerItemPreselectedUser;
  innerItemPreselectedUser = new PlasmaLoginSettingsDefaults::ItemString( currentGroup(), QStringLiteral( "PreselectedUser" ), mPreselectedUser, defaultPreselectedUser() );
  itemPreselectedUser = new KConfigCompilerSignallingItem(innerItemPreselectedUser, this, notifyFunction, signalPreselectedUserChanged);
  addItem( itemPreselectedUser, QStringLiteral( "PreselectedUser" ) );
  KConfigCompilerSignallingItem  *itemPreselectedSession;
  PlasmaLoginSettingsDefaults::ItemString  *innerItemPreselectedSession;
  innerItemPreselectedSession = new PlasmaLoginSettingsDefaults::ItemString( currentGroup(), QStringLiteral( "PreselectedSession" ), mPreselectedSession, defaultPreselectedSession() );
  itemPreselectedSession = new KConfigCompilerSignallingItem(innerItemPreselectedSession, this, notifyFunction, signalPreselectedSessionChanged);
  addItem( itemPreselectedSession, QStringLiteral( "PreselectedSession" ) );
  KConfigCompilerSignallingItem  *itemShowClock;
  PlasmaLoginSettingsDefaults::ItemBool  *innerItemShowClock;
  innerItemShowClock = new PlasmaLoginSettingsDefaults::ItemBool( currentGroup(), QStringLiteral( "ShowClock" ), mShowClock, defaultShowClock() );
  itemShowClock = new KConfigCompilerSignallingItem(innerItemShowClock, this, notifyFunction, signalShowClockChanged);
  addItem( itemShowClock, QStringLiteral( "ShowClock" ) );
  KConfigCompilerSignallingItem  *itemWallpaperPluginId;
  PlasmaLoginSettingsDefaults::ItemString  *innerItemWallpaperPluginId;
  innerItemWallpaperPluginId = new PlasmaLoginSettingsDefaults::ItemString( currentGroup(), QStringLiteral( "WallpaperPluginId" ), mWallpaperPluginId, defaultWallpaperPluginId() );
  itemWallpaperPluginId = new KConfigCompilerSignallingItem(innerItemWallpaperPluginId, this, notifyFunction, signalWallpaperPluginIdChanged);
  addItem( itemWallpaperPluginId, QStringLiteral( "WallpaperPluginId" ) );
}

QString PlasmaLoginSettingsBase::defaultUserValue_helper()
{

  return defaultUser();
}

QString PlasmaLoginSettingsBase::defaultSessionValue_helper()
{

  return defaultSession();
}

bool PlasmaLoginSettingsBase::defaultReloginValue_helper()
{

  return defaultRelogin();
}

QString PlasmaLoginSettingsBase::defaultPreselectedUserValue_helper()
{

  return defaultPreselectedUser();
}

QString PlasmaLoginSettingsBase::defaultPreselectedSessionValue_helper()
{

  return defaultPreselectedSession();
}

bool PlasmaLoginSettingsBase::defaultShowClockValue_helper()
{

  return defaultShowClock();
}

QString PlasmaLoginSettingsBase::defaultWallpaperPluginIdValue_helper()
{

  return defaultWallpaperPluginId();
}

PlasmaLoginSettingsBase::~PlasmaLoginSettingsBase()
{
  if (s_globalPlasmaLoginSettingsBase.exists() && !s_globalPlasmaLoginSettingsBase.isDestroyed()) {
    s_globalPlasmaLoginSettingsBase()->q = nullptr;
  }
}


void PlasmaLoginSettingsBase::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalUserChanged:
    Q_EMIT UserChanged();
    break;
  case signalSessionChanged:
    Q_EMIT SessionChanged();
    break;
  case signalReloginChanged:
    Q_EMIT ReloginChanged();
    break;
  case signalPreselectedUserChanged:
    Q_EMIT PreselectedUserChanged();
    break;
  case signalPreselectedSessionChanged:
    Q_EMIT PreselectedSessionChanged();
    break;
  case signalShowClockChanged:
    Q_EMIT ShowClockChanged();
    break;
  case signalWallpaperPluginIdChanged:
    Q_EMIT WallpaperPluginIdChanged();
    break;
  }
}
