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

#include "donotdisturbsettings.h"

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

#include <QDebug>

using namespace NotificationManager;

namespace NotificationManager {

class DoNotDisturbSettingsHelper
{
  public:
    DoNotDisturbSettingsHelper() : q(nullptr) {}
    ~DoNotDisturbSettingsHelper() { delete q; }
    DoNotDisturbSettingsHelper(const DoNotDisturbSettingsHelper&) = delete;
    DoNotDisturbSettingsHelper& operator=(const DoNotDisturbSettingsHelper&) = delete;
    DoNotDisturbSettings *q;
};
}

Q_GLOBAL_STATIC(DoNotDisturbSettingsHelper, s_globalDoNotDisturbSettings)
DoNotDisturbSettings *DoNotDisturbSettings::self()
{
  if (!s_globalDoNotDisturbSettings()->q)
     qFatal("you need to call DoNotDisturbSettings::instance before using");
  return s_globalDoNotDisturbSettings()->q;
}

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

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

DoNotDisturbSettings::DoNotDisturbSettings(  KSharedConfig::Ptr config  )
  : KConfigSkeleton( config )
{
  Q_ASSERT(!s_globalDoNotDisturbSettings()->q);
  s_globalDoNotDisturbSettings()->q = this;
  setCurrentGroup( QStringLiteral( "DoNotDisturb" ) );

  KConfigSkeleton::ItemDateTime  *itemUntil;
  itemUntil = new KConfigSkeleton::ItemDateTime( currentGroup(), QStringLiteral( "Until" ), mUntil );
  itemUntil->setWriteFlags(KConfigBase::Notify);
  addItem( itemUntil, QStringLiteral( "Until" ) );
  KConfigSkeleton::ItemBool  *itemWhenScreensMirrored;
  itemWhenScreensMirrored = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "WhenScreensMirrored" ), mWhenScreensMirrored, true );
  itemWhenScreensMirrored->setWriteFlags(KConfigBase::Notify);
  addItem( itemWhenScreensMirrored, QStringLiteral( "WhenScreensMirrored" ) );
  KConfigSkeleton::ItemBool  *itemNotificationSoundsMuted;
  itemNotificationSoundsMuted = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "NotificationSoundsMuted" ), mNotificationSoundsMuted, false );
  itemNotificationSoundsMuted->setWriteFlags(KConfigBase::Notify);
  addItem( itemNotificationSoundsMuted, QStringLiteral( "NotificationSoundsMuted" ) );
}

bool DoNotDisturbSettings::defaultWhenScreensMirroredValue_helper()
{

  return true;
}

bool DoNotDisturbSettings::defaultNotificationSoundsMutedValue_helper()
{

  return false;
}

DoNotDisturbSettings::~DoNotDisturbSettings()
{
  s_globalDoNotDisturbSettings()->q = nullptr;
}

