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

#include "komodo_config.h"

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

class KomodoConfigHelper
{
  public:
    KomodoConfigHelper() : q(nullptr) {}
    ~KomodoConfigHelper() { delete q; q = nullptr; }
    KomodoConfigHelper(const KomodoConfigHelper&) = delete;
    KomodoConfigHelper& operator=(const KomodoConfigHelper&) = delete;
    KomodoConfig *q;
};
Q_GLOBAL_STATIC(KomodoConfigHelper, s_globalKomodoConfig)
KomodoConfig *KomodoConfig::self()
{
  if (!s_globalKomodoConfig()->q) {
    new KomodoConfig;
    s_globalKomodoConfig()->q->read();
  }

  return s_globalKomodoConfig()->q;
}

KomodoConfig *KomodoConfig::create(QQmlEngine *, QJSEngine *)
{
  QQmlEngine::setObjectOwnership(self(), QQmlEngine::CppOwnership);
  return self();
}

KomodoConfig::KomodoConfig( )
  : KConfigSkeleton()
{
  Q_ASSERT(!s_globalKomodoConfig()->q);
  s_globalKomodoConfig()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&KomodoConfig::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemTodoFilePath;
  KConfigSkeleton::ItemString  *innerItemTodoFilePath;
  innerItemTodoFilePath = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "TodoFilePath" ), mTodoFilePath );
  itemTodoFilePath = new KConfigCompilerSignallingItem(innerItemTodoFilePath, this, notifyFunction, signalTodoFilePathChanged);
  addItem( itemTodoFilePath, QStringLiteral( "TodoFilePath" ) );
  KConfigCompilerSignallingItem  *itemFilterIndex;
  KConfigSkeleton::ItemInt  *innerItemFilterIndex;
  innerItemFilterIndex = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "FilterIndex" ), mFilterIndex );
  itemFilterIndex = new KConfigCompilerSignallingItem(innerItemFilterIndex, this, notifyFunction, signalFilterIndexChanged);
  addItem( itemFilterIndex, QStringLiteral( "FilterIndex" ) );
  KConfigCompilerSignallingItem  *itemAutoInsertCreationDate;
  KConfigSkeleton::ItemBool  *innerItemAutoInsertCreationDate;
  innerItemAutoInsertCreationDate = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AutoInsertCreationDate" ), mAutoInsertCreationDate, false );
  itemAutoInsertCreationDate = new KConfigCompilerSignallingItem(innerItemAutoInsertCreationDate, this, notifyFunction, signalAutoInsertCreationDateChanged);
  addItem( itemAutoInsertCreationDate, QStringLiteral( "AutoInsertCreationDate" ) );
}

bool KomodoConfig::defaultAutoInsertCreationDateValue_helper()
{

  return false;
}

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


void KomodoConfig::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalTodoFilePathChanged:
    Q_EMIT TodoFilePathChanged();
    break;
  case signalFilterIndexChanged:
    Q_EMIT FilterIndexChanged();
    break;
  case signalAutoInsertCreationDateChanged:
    Q_EMIT AutoInsertCreationDateChanged();
    break;
  }
}
