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

#include "pdfsettings.h"

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

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

  return s_globalPDFSettings()->q;
}

PDFSettings::PDFSettings( )
  : KConfigSkeleton( QStringLiteral( "okular-generator-popplerrc" ) )
  , mSettingsChanged(0)
{
  Q_ASSERT(!s_globalPDFSettings()->q);
  s_globalPDFSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&PDFSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  QList<KConfigSkeleton::ItemEnum::Choice> valuesEnhanceThinLines;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("No");
    valuesEnhanceThinLines.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Solid");
    valuesEnhanceThinLines.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Shape");
    valuesEnhanceThinLines.append( choice );
  }
  KConfigSkeleton::ItemEnum  *itemEnhanceThinLines;
  itemEnhanceThinLines = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "EnhanceThinLines" ), mEnhanceThinLines, valuesEnhanceThinLines, EnumEnhanceThinLines::No );
  addItem( itemEnhanceThinLines, QStringLiteral( "EnhanceThinLines" ) );

  setCurrentGroup( QStringLiteral( "Signatures" ) );

  KConfigCompilerSignallingItem  *itemUseDefaultCertDB;
  KConfigSkeleton::ItemBool  *innerItemUseDefaultCertDB;
  innerItemUseDefaultCertDB = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "UseDefaultCertDB" ), mUseDefaultCertDB, true );
  itemUseDefaultCertDB = new KConfigCompilerSignallingItem(innerItemUseDefaultCertDB, this, notifyFunction, signalUseDefaultDBChanged);
  addItem( itemUseDefaultCertDB, QStringLiteral( "UseDefaultCertDB" ) );
  KConfigCompilerSignallingItem  *itemDBCertificatePath;
  KConfigSkeleton::ItemString  *innerItemDBCertificatePath;
  innerItemDBCertificatePath = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "DBCertificatePath" ), mDBCertificatePath );
  itemDBCertificatePath = new KConfigCompilerSignallingItem(innerItemDBCertificatePath, this, notifyFunction, signalDBCertificatePathChanged);
  addItem( itemDBCertificatePath, QStringLiteral( "DBCertificatePath" ) );
  KConfigSkeleton::ItemBool  *itemCheckOCSPServers;
  itemCheckOCSPServers = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "CheckOCSPServers" ), mCheckOCSPServers, true );
  addItem( itemCheckOCSPServers, QStringLiteral( "CheckOCSPServers" ) );
}

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

bool PDFSettings::usrSave()
{
  const bool res = KConfigSkeleton::usrSave();
  if (!res) return false;

  if ( mSettingsChanged & signalUseDefaultDBChanged )
    Q_EMIT useDefaultDBChanged();
  if ( mSettingsChanged & signalDBCertificatePathChanged )
    Q_EMIT dBCertificatePathChanged();
  mSettingsChanged = 0;
  return true;
}

void PDFSettings::itemChanged(quint64 flags) {
  mSettingsChanged |= flags;

}

#include "pdfsettings.moc"

