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

#include "sieve-vacation.h"

#include <klocalizedstring.h>

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

using namespace KSieveUi;

namespace KSieveUi {

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

}
Q_GLOBAL_STATIC(VacationSettingsHelper, s_globalVacationSettings)
VacationSettings *VacationSettings::self()
{
  if (!s_globalVacationSettings()->q) {
    new VacationSettings;
    s_globalVacationSettings()->q->read();
  }

  return s_globalVacationSettings()->q;
}

VacationSettings::VacationSettings( )
  : KConfigSkeleton( QStringLiteral( "vacationsettingsrc" ) )
{
  Q_ASSERT(!s_globalVacationSettings()->q);
  s_globalVacationSettings()->q = this;
  setCurrentGroup( QStringLiteral( "OutOfOffice" ) );

  mAllowOutOfOfficeSettingsItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AllowOutOfOfficeSettings" ), mAllowOutOfOfficeSettings, true );
  mAllowOutOfOfficeSettingsItem->setLabel( i18nd("libksieve", "Allow out-of-office settings to be changeable by the user.") );
  addItem( mAllowOutOfOfficeSettingsItem, QStringLiteral( "AllowOutOfOfficeSettings" ) );
  mAllowOutOfOfficeUploadButNoSettingsItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AllowOutOfOfficeUploadButNoSettings" ), mAllowOutOfOfficeUploadButNoSettings, false );
  mAllowOutOfOfficeUploadButNoSettingsItem->setLabel( i18nd("libksieve", "Allow users to upload out-of-office sieve scripts, but prevent them from changing any settings, such as the domain to react to or the spam reaction switch.") );
  addItem( mAllowOutOfOfficeUploadButNoSettingsItem, QStringLiteral( "AllowOutOfOfficeUploadButNoSettings" ) );
  mOutOfOfficeDomainItem = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "OutOfOfficeDomain" ), mOutOfOfficeDomain );
  mOutOfOfficeDomainItem->setLabel( i18nd("libksieve", "Send out-of-office replies to mails coming from this domain only.") );
  addItem( mOutOfOfficeDomainItem, QStringLiteral( "OutOfOfficeDomain" ) );
  mOutOfOfficeReactToSpamItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "OutOfOfficeReactToSpam" ), mOutOfOfficeReactToSpam, false );
  mOutOfOfficeReactToSpamItem->setLabel( i18nd("libksieve", "Allow out-of-office replies to be sent to messages marked as SPAM.") );
  addItem( mOutOfOfficeReactToSpamItem, QStringLiteral( "OutOfOfficeReactToSpam" ) );
  mCheckOutOfOfficeOnStartupItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "CheckOutOfOfficeOnStartup" ), mCheckOutOfOfficeOnStartup, true );
  mCheckOutOfOfficeOnStartupItem->setLabel( i18nd("libksieve", "Check if there is still an active out-of-office reply configured on startup.") );
  addItem( mCheckOutOfOfficeOnStartupItem, QStringLiteral( "CheckOutOfOfficeOnStartup" ) );
}

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

