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

#include "sieve-editor.h"

#include <klocalizedstring.h>

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

using namespace KSieveUi;

namespace KSieveUi {

class EditorSettingsHelper
{
  public:
    EditorSettingsHelper() noexcept : q(nullptr) {}
    ~EditorSettingsHelper() noexcept { delete q; q = nullptr; }
    EditorSettingsHelper(const EditorSettingsHelper&) = delete;
    EditorSettingsHelper& operator=(const EditorSettingsHelper&) = delete;
    EditorSettings *q;
};

}
Q_GLOBAL_STATIC(EditorSettingsHelper, s_globalEditorSettings)
EditorSettings *EditorSettings::self()
{
  if (!s_globalEditorSettings()->q) {
    new EditorSettings;
    s_globalEditorSettings()->q->read();
  }

  return s_globalEditorSettings()->q;
}

EditorSettings::EditorSettings( )
  : KConfigSkeleton()
{
  Q_ASSERT(!s_globalEditorSettings()->q);
  s_globalEditorSettings()->q = this;
  setCurrentGroup( QStringLiteral( "General" ) );

  mUseGraphicEditorByDefaultItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "UseGraphicEditorByDefault" ), mUseGraphicEditorByDefault, false );
  mUseGraphicEditorByDefaultItem->setLabel( i18n("Use graphical editor by default to edit sieve script.") );
  addItem( mUseGraphicEditorByDefaultItem, QStringLiteral( "UseGraphicEditorByDefault" ) );
}

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

