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

#include "gravatarsettings.h"

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

using namespace Gravatar;

namespace Gravatar {

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

}
Q_GLOBAL_STATIC(GravatarSettingsHelper, s_globalGravatarSettings)
GravatarSettings *GravatarSettings::self()
{
  if (!s_globalGravatarSettings()->q) {
    new GravatarSettings;
    s_globalGravatarSettings()->q->read();
  }

  return s_globalGravatarSettings()->q;
}

GravatarSettings::GravatarSettings( )
  : KConfigSkeleton()
{
  Q_ASSERT(!s_globalGravatarSettings()->q);
  s_globalGravatarSettings()->q = this;
  setCurrentGroup( QStringLiteral( "Gravatar" ) );

  mGravatarSupportEnabledItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "GravatarSupportEnabled" ), mGravatarSupportEnabled, false );
  addItem( mGravatarSupportEnabledItem, QStringLiteral( "GravatarSupportEnabled" ) );
  mGravatarUseDefaultImageItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "GravatarUseDefaultImage" ), mGravatarUseDefaultImage, false );
  addItem( mGravatarUseDefaultImageItem, QStringLiteral( "GravatarUseDefaultImage" ) );
  mGravatarCacheSizeItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "GravatarCacheSize" ), mGravatarCacheSize, 20 );
  addItem( mGravatarCacheSizeItem, QStringLiteral( "GravatarCacheSize" ) );
  mFallbackToGravatarItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "FallbackToGravatar" ), mFallbackToGravatar, false );
  addItem( mFallbackToGravatarItem, QStringLiteral( "FallbackToGravatar" ) );
  mLibravatarSupportEnabledItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "LibravatarSupportEnabled" ), mLibravatarSupportEnabled, false );
  addItem( mLibravatarSupportEnabledItem, QStringLiteral( "LibravatarSupportEnabled" ) );
}

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

