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

#include "specialmailcollectionssettings.h"

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

#include <QDebug>

using namespace Akonadi;

namespace Akonadi {

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

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

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

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

SpecialMailCollectionsSettings::SpecialMailCollectionsSettings( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalSpecialMailCollectionsSettings()->q);
  s_globalSpecialMailCollectionsSettings()->q = this;
  setCurrentGroup( QStringLiteral( "SpecialCollections" ) );

  mDefaultResourceIdItem = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "DefaultResourceId" ), mDefaultResourceId );
  addItem( mDefaultResourceIdItem, QStringLiteral( "DefaultResourceId" ) );
}

SpecialMailCollectionsSettings::~SpecialMailCollectionsSettings()
{
  s_globalSpecialMailCollectionsSettings()->q = nullptr;
}

