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

#include "badgesettings.h"

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

#include <QDebug>

using namespace NotificationManager;

namespace NotificationManager {

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

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

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

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

BadgeSettings::BadgeSettings(  KSharedConfig::Ptr config  )
  : KConfigSkeleton( config )
{
  Q_ASSERT(!s_globalBadgeSettings()->q);
  s_globalBadgeSettings()->q = this;
  setCurrentGroup( QStringLiteral( "Badges" ) );

  KConfigSkeleton::ItemBool  *itemInTaskManager;
  itemInTaskManager = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "InTaskManager" ), mInTaskManager, true );
  itemInTaskManager->setWriteFlags(KConfigBase::Notify);
  addItem( itemInTaskManager, QStringLiteral( "InTaskManager" ) );
}

bool BadgeSettings::defaultInTaskManagerValue_helper()
{

  return true;
}

BadgeSettings::~BadgeSettings()
{
  s_globalBadgeSettings()->q = nullptr;
}

