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

#include "kscreensaversettingsbase.h"

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

class KScreenSaverSettingsBaseHelper
{
  public:
    KScreenSaverSettingsBaseHelper() : q(nullptr) {}
    ~KScreenSaverSettingsBaseHelper() { delete q; q = nullptr; }
    KScreenSaverSettingsBaseHelper(const KScreenSaverSettingsBaseHelper&) = delete;
    KScreenSaverSettingsBaseHelper& operator=(const KScreenSaverSettingsBaseHelper&) = delete;
    KScreenSaverSettingsBase *q;
};
Q_GLOBAL_STATIC(KScreenSaverSettingsBaseHelper, s_globalKScreenSaverSettingsBase)
KScreenSaverSettingsBase *KScreenSaverSettingsBase::self()
{
  if (!s_globalKScreenSaverSettingsBase()->q) {
    new KScreenSaverSettingsBase;
    s_globalKScreenSaverSettingsBase()->q->read();
  }

  return s_globalKScreenSaverSettingsBase()->q;
}

KScreenSaverSettingsBase::KScreenSaverSettingsBase( )
  : KConfigSkeleton( QStringLiteral( "kscreenlockerrc" ) )
{
  Q_ASSERT(!s_globalKScreenSaverSettingsBase()->q);
  s_globalKScreenSaverSettingsBase()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&KScreenSaverSettingsBase::itemChanged);

  setCurrentGroup( QStringLiteral( "Daemon" ) );

  KConfigCompilerSignallingItem  *itemAutolock;
  KConfigSkeleton::ItemBool  *innerItemAutolock;
  innerItemAutolock = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Autolock" ), mAutolock, true );
  itemAutolock = new KConfigCompilerSignallingItem(innerItemAutolock, this, notifyFunction, signalAutolockChanged);
  addItem( itemAutolock, QStringLiteral( "Autolock" ) );
  KConfigCompilerSignallingItem  *itemTimeout;
  KConfigSkeleton::ItemInt  *innerItemTimeout;
  innerItemTimeout = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "Timeout" ), mTimeout, 5 );
  itemTimeout = new KConfigCompilerSignallingItem(innerItemTimeout, this, notifyFunction, signalTimeoutChanged);
  innerItemTimeout->setMinValue(1);
  addItem( itemTimeout, QStringLiteral( "Timeout" ) );
  KConfigCompilerSignallingItem  *itemLock;
  KConfigSkeleton::ItemBool  *innerItemLock;
  innerItemLock = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Lock" ), mLock, true );
  itemLock = new KConfigCompilerSignallingItem(innerItemLock, this, notifyFunction, signalLockChanged);
  addItem( itemLock, QStringLiteral( "Lock" ) );
  KConfigCompilerSignallingItem  *itemLockGrace;
  KConfigSkeleton::ItemInt  *innerItemLockGrace;
  innerItemLockGrace = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "LockGrace" ), mLockGrace, 5 );
  itemLockGrace = new KConfigCompilerSignallingItem(innerItemLockGrace, this, notifyFunction, signalLockGraceChanged);
  innerItemLockGrace->setMinValue(0);
  innerItemLockGrace->setMaxValue(300);
  addItem( itemLockGrace, QStringLiteral( "LockGrace" ) );
  KConfigCompilerSignallingItem  *itemLockOnResume;
  KConfigSkeleton::ItemBool  *innerItemLockOnResume;
  innerItemLockOnResume = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "LockOnResume" ), mLockOnResume, true );
  itemLockOnResume = new KConfigCompilerSignallingItem(innerItemLockOnResume, this, notifyFunction, signalLockOnResumeChanged);
  addItem( itemLockOnResume, QStringLiteral( "LockOnResume" ) );
  KConfigCompilerSignallingItem  *itemLockOnStart;
  KConfigSkeleton::ItemBool  *innerItemLockOnStart;
  innerItemLockOnStart = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "LockOnStart" ), mLockOnStart, false );
  itemLockOnStart = new KConfigCompilerSignallingItem(innerItemLockOnStart, this, notifyFunction, signalLockOnStartChanged);
  addItem( itemLockOnStart, QStringLiteral( "LockOnStart" ) );

  setCurrentGroup( QStringLiteral( "Greeter" ) );

  KConfigCompilerSignallingItem  *itemTheme;
  KConfigSkeleton::ItemString  *innerItemTheme;
  innerItemTheme = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Theme" ), mTheme );
  itemTheme = new KConfigCompilerSignallingItem(innerItemTheme, this, notifyFunction, signalThemeChanged);
  addItem( itemTheme, QStringLiteral( "Theme" ) );
  KConfigCompilerSignallingItem  *itemWallpaperPluginId;
  KConfigSkeleton::ItemString  *innerItemWallpaperPluginId;
  innerItemWallpaperPluginId = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "WallpaperPlugin" ), mWallpaperPluginId, QStringLiteral( "org.kde.image" ) );
  itemWallpaperPluginId = new KConfigCompilerSignallingItem(innerItemWallpaperPluginId, this, notifyFunction, signalWallpaperPluginIdChanged);
  addItem( itemWallpaperPluginId, QStringLiteral( "wallpaperPluginId" ) );
}

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


void KScreenSaverSettingsBase::itemChanged(quint64 flags) {

  if ( flags & signalAutolockChanged ) {
    Q_EMIT AutolockChanged();
  }
  if ( flags & signalTimeoutChanged ) {
    Q_EMIT TimeoutChanged();
  }
  if ( flags & signalLockChanged ) {
    Q_EMIT LockChanged();
  }
  if ( flags & signalLockGraceChanged ) {
    Q_EMIT LockGraceChanged();
  }
  if ( flags & signalLockOnResumeChanged ) {
    Q_EMIT LockOnResumeChanged();
  }
  if ( flags & signalLockOnStartChanged ) {
    Q_EMIT LockOnStartChanged();
  }
  if ( flags & signalThemeChanged ) {
    Q_EMIT ThemeChanged();
  }
  if ( flags & signalWallpaperPluginIdChanged ) {
    Q_EMIT wallpaperPluginIdChanged();
  }
}

#include "kscreensaversettingsbase.moc"

