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

#include "globalsettings_webengineurlinterceptoradblock.h"

#include <klocalizedstring.h>

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

using namespace AdBlock;

namespace AdBlock {

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

Q_GLOBAL_STATIC(AdBlockSettingsHelper, s_globalAdBlockSettings)
AdBlockSettings *AdBlockSettings::self()
{
  if (!s_globalAdBlockSettings()->q) {
    new AdBlockSettings;
    s_globalAdBlockSettings()->q->read();
  }

  return s_globalAdBlockSettings()->q;
}

AdBlockSettings::AdBlockSettings( )
  : KConfigSkeleton( QStringLiteral( "webengineurlinterceptoradblockrc" ) )
{
  Q_ASSERT(!s_globalAdBlockSettings()->q);
  s_globalAdBlockSettings()->q = this;
  setCurrentGroup( QStringLiteral( "General" ) );

  mAdBlockEnabledItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AdBlockEnabled" ), mAdBlockEnabled, false );
  mAdBlockEnabledItem->setLabel( i18n("Enabled ad block") );
  addItem( mAdBlockEnabledItem, QStringLiteral( "AdBlockEnabled" ) );
  mHideAdsEnabledItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "HideAdsEnabled" ), mHideAdsEnabled, false );
  mHideAdsEnabledItem->setLabel( i18n("Hide advertisement enabled") );
  addItem( mHideAdsEnabledItem, QStringLiteral( "HideAdsEnabled" ) );
  mAdBlockUpdateIntervalItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "AdBlockUpdateInterval" ), mAdBlockUpdateInterval, 7 );
  mAdBlockUpdateIntervalItem->setLabel( i18n("Update interval list of adblock") );
  addItem( mAdBlockUpdateIntervalItem, QStringLiteral( "AdBlockUpdateInterval" ) );
}

AdBlockSettings::~AdBlockSettings()
{
  s_globalAdBlockSettings()->q = nullptr;
}

