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

#include "specialmailcollectionssettings.h"

#include <kglobal.h>
#include <QtCore/QFile>

#include <kdebug.h>

using namespace Akonadi;

namespace Akonadi {

class SpecialMailCollectionsSettingsHelper
{
  public:
    SpecialMailCollectionsSettingsHelper() : q(0) {}
    ~SpecialMailCollectionsSettingsHelper() { delete q; }
    SpecialMailCollectionsSettings *q;
};
}

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

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

SpecialMailCollectionsSettings::SpecialMailCollectionsSettings(  const QString& config  )
  : KConfigSkeleton( config )
{
  Q_ASSERT(!s_globalSpecialMailCollectionsSettings->q);
  s_globalSpecialMailCollectionsSettings->q = this;
  setCurrentGroup( QLatin1String( "SpecialCollections" ) );

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

SpecialMailCollectionsSettings::~SpecialMailCollectionsSettings()
{
  if (!s_globalSpecialMailCollectionsSettings.isDestroyed()) {
    s_globalSpecialMailCollectionsSettings->q = 0;
  }
}

