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

#include "calendarsettings.h"

#include <klocalizedstring.h>

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

using namespace Akonadi;

namespace Akonadi {

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

}
Q_GLOBAL_STATIC(CalendarSettingsHelper, s_globalCalendarSettings)
CalendarSettings *CalendarSettings::self()
{
  if (!s_globalCalendarSettings()->q) {
    new CalendarSettings;
    s_globalCalendarSettings()->q->read();
  }

  return s_globalCalendarSettings()->q;
}

CalendarSettings::CalendarSettings( )
  : KConfigSkeleton( QStringLiteral( "akonadi-calendarrc" ) )
{
  Q_ASSERT(!s_globalCalendarSettings()->q);
  s_globalCalendarSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&CalendarSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "FreeBusy Publish" ) );

  KConfigSkeleton::ItemBool  *innerItemFreeBusyPublishAuto;
  innerItemFreeBusyPublishAuto = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "FreeBusyPublishAuto" ), mFreeBusyPublishAuto, false );
  mFreeBusyPublishAutoItem = new KConfigCompilerSignallingItem(innerItemFreeBusyPublishAuto, this, notifyFunction, signalFreeBusyPublishAutoChanged);
  mFreeBusyPublishAutoItem->setLabel( i18nd("libakonadi-calendar6", "FreeBusyPublishAuto") );
  addItem( mFreeBusyPublishAutoItem, QStringLiteral( "FreeBusyPublishAuto" ) );
  KConfigSkeleton::ItemInt  *innerItemFreeBusyPublishDelay;
  innerItemFreeBusyPublishDelay = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "FreeBusyPublishDelay" ), mFreeBusyPublishDelay, 5 );
  mFreeBusyPublishDelayItem = new KConfigCompilerSignallingItem(innerItemFreeBusyPublishDelay, this, notifyFunction, signalFreeBusyPublishDelayChanged);
  mFreeBusyPublishDelayItem->setLabel( i18nd("libakonadi-calendar6", "FreeBusyPublishDelay") );
  addItem( mFreeBusyPublishDelayItem, QStringLiteral( "FreeBusyPublishDelay" ) );
  KConfigSkeleton::ItemInt  *innerItemFreeBusyPublishDays;
  innerItemFreeBusyPublishDays = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "FreeBusyPublishDays" ), mFreeBusyPublishDays, 60 );
  mFreeBusyPublishDaysItem = new KConfigCompilerSignallingItem(innerItemFreeBusyPublishDays, this, notifyFunction, signalFreeBusyPublishDaysChanged);
  mFreeBusyPublishDaysItem->setLabel( i18nd("libakonadi-calendar6", "FreeBusyPublishDays") );
  addItem( mFreeBusyPublishDaysItem, QStringLiteral( "FreeBusyPublishDays" ) );
  KConfigSkeleton::ItemString  *innerItemFreeBusyPublishUrl;
  innerItemFreeBusyPublishUrl = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "FreeBusyPublishUrl" ), mFreeBusyPublishUrl );
  mFreeBusyPublishUrlItem = new KConfigCompilerSignallingItem(innerItemFreeBusyPublishUrl, this, notifyFunction, signalFreeBusyPublishUrlChanged);
  mFreeBusyPublishUrlItem->setLabel( i18nd("libakonadi-calendar6", "Free/Busy Publish URL") );
  mFreeBusyPublishUrlItem->setWhatsThis( i18nd("libakonadi-calendar6", "URL for publishing free/busy information") );
  addItem( mFreeBusyPublishUrlItem, QStringLiteral( "FreeBusyPublishUrl" ) );
  KConfigSkeleton::ItemString  *innerItemFreeBusyPublishUser;
  innerItemFreeBusyPublishUser = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "FreeBusyPublishUser" ), mFreeBusyPublishUser );
  mFreeBusyPublishUserItem = new KConfigCompilerSignallingItem(innerItemFreeBusyPublishUser, this, notifyFunction, signalFreeBusyPublishUserChanged);
  mFreeBusyPublishUserItem->setLabel( i18nd("libakonadi-calendar6", "Free/Busy Publish Username") );
  mFreeBusyPublishUserItem->setWhatsThis( i18nd("libakonadi-calendar6", "Username for publishing free/busy information") );
  addItem( mFreeBusyPublishUserItem, QStringLiteral( "FreeBusyPublishUser" ) );
  KConfigSkeleton::ItemPassword  *innerItemFreeBusyPublishPassword;
  innerItemFreeBusyPublishPassword = new KConfigSkeleton::ItemPassword( currentGroup(), QStringLiteral( "FreeBusyPublishPassword" ), mFreeBusyPublishPassword );
  mFreeBusyPublishPasswordItem = new KConfigCompilerSignallingItem(innerItemFreeBusyPublishPassword, this, notifyFunction, signalFreeBusyPublishPasswordChanged);
  mFreeBusyPublishPasswordItem->setLabel( i18nd("libakonadi-calendar6", "Free/Busy Publish Password") );
  mFreeBusyPublishPasswordItem->setWhatsThis( i18nd("libakonadi-calendar6", "Password for publishing free/busy information") );
  addItem( mFreeBusyPublishPasswordItem, QStringLiteral( "FreeBusyPublishPassword" ) );
  KConfigSkeleton::ItemBool  *innerItemFreeBusyPublishSavePassword;
  innerItemFreeBusyPublishSavePassword = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "FreeBusyPublishSavePassword" ), mFreeBusyPublishSavePassword, false );
  mFreeBusyPublishSavePasswordItem = new KConfigCompilerSignallingItem(innerItemFreeBusyPublishSavePassword, this, notifyFunction, signalFreeBusyPublishSavePasswordChanged);
  mFreeBusyPublishSavePasswordItem->setLabel( i18nd("libakonadi-calendar6", "FreeBusyPublishSavePassword") );
  addItem( mFreeBusyPublishSavePasswordItem, QStringLiteral( "FreeBusyPublishSavePassword" ) );

  setCurrentGroup( QStringLiteral( "FreeBusy Retrieve" ) );

  KConfigSkeleton::ItemBool  *innerItemFreeBusyRetrieveAuto;
  innerItemFreeBusyRetrieveAuto = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "FreeBusyRetrieveAuto" ), mFreeBusyRetrieveAuto, false );
  mFreeBusyRetrieveAutoItem = new KConfigCompilerSignallingItem(innerItemFreeBusyRetrieveAuto, this, notifyFunction, signalFreeBusyRetrieveAutoChanged);
  mFreeBusyRetrieveAutoItem->setLabel( i18nd("libakonadi-calendar6", "Enable Automatic Free/Busy Retrieval") );
  addItem( mFreeBusyRetrieveAutoItem, QStringLiteral( "FreeBusyRetrieveAuto" ) );
  KConfigSkeleton::ItemBool  *innerItemFreeBusyFullDomainRetrieval;
  innerItemFreeBusyFullDomainRetrieval = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "FreeBusyFullDomainRetrieval" ), mFreeBusyFullDomainRetrieval, false );
  mFreeBusyFullDomainRetrievalItem = new KConfigCompilerSignallingItem(innerItemFreeBusyFullDomainRetrieval, this, notifyFunction, signalFreeBusyFullDomainRetrievalChanged);
  mFreeBusyFullDomainRetrievalItem->setLabel( i18nd("libakonadi-calendar6", "Use full email address for retrieval") );
  mFreeBusyFullDomainRetrievalItem->setWhatsThis( i18nd("libakonadi-calendar6", "With this setting, you can change the filename that will be fetched from the server. With this checked, it will download a free/busy file called user@domain.ifb, for example nn@kde.org.ifb. Without this set, it will download user.ifb, for example nn.ifb.") );
  addItem( mFreeBusyFullDomainRetrievalItem, QStringLiteral( "FreeBusyFullDomainRetrieval" ) );
  KConfigSkeleton::ItemString  *innerItemFreeBusyRetrieveUrl;
  innerItemFreeBusyRetrieveUrl = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "FreeBusyRetrieveUrl" ), mFreeBusyRetrieveUrl );
  mFreeBusyRetrieveUrlItem = new KConfigCompilerSignallingItem(innerItemFreeBusyRetrieveUrl, this, notifyFunction, signalFreeBusyRetrieveUrlChanged);
  mFreeBusyRetrieveUrlItem->setLabel( i18nd("libakonadi-calendar6", "Free/Busy Retrieval URL") );
  addItem( mFreeBusyRetrieveUrlItem, QStringLiteral( "FreeBusyRetrieveUrl" ) );
  KConfigSkeleton::ItemString  *innerItemFreeBusyRetrieveUser;
  innerItemFreeBusyRetrieveUser = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "FreeBusyRetrieveUser" ), mFreeBusyRetrieveUser );
  mFreeBusyRetrieveUserItem = new KConfigCompilerSignallingItem(innerItemFreeBusyRetrieveUser, this, notifyFunction, signalFreeBusyRetrieveUserChanged);
  mFreeBusyRetrieveUserItem->setLabel( i18nd("libakonadi-calendar6", "Free/Busy Retrieval Username") );
  addItem( mFreeBusyRetrieveUserItem, QStringLiteral( "FreeBusyRetrieveUser" ) );
  KConfigSkeleton::ItemPassword  *innerItemFreeBusyRetrievePassword;
  innerItemFreeBusyRetrievePassword = new KConfigSkeleton::ItemPassword( currentGroup(), QStringLiteral( "FreeBusyRetrievePassword" ), mFreeBusyRetrievePassword );
  mFreeBusyRetrievePasswordItem = new KConfigCompilerSignallingItem(innerItemFreeBusyRetrievePassword, this, notifyFunction, signalFreeBusyRetrievePasswordChanged);
  mFreeBusyRetrievePasswordItem->setLabel( i18nd("libakonadi-calendar6", "Free/Busy Retrieval Password") );
  mFreeBusyRetrievePasswordItem->setWhatsThis( i18nd("libakonadi-calendar6", "Password for retrieving free/busy information") );
  addItem( mFreeBusyRetrievePasswordItem, QStringLiteral( "FreeBusyRetrievePassword" ) );
  KConfigSkeleton::ItemBool  *innerItemFreeBusyRetrieveSavePassword;
  innerItemFreeBusyRetrieveSavePassword = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "FreeBusyRetrieveSavePassword" ), mFreeBusyRetrieveSavePassword, false );
  mFreeBusyRetrieveSavePasswordItem = new KConfigCompilerSignallingItem(innerItemFreeBusyRetrieveSavePassword, this, notifyFunction, signalFreeBusyRetrieveSavePasswordChanged);
  mFreeBusyRetrieveSavePasswordItem->setLabel( i18nd("libakonadi-calendar6", "FreeBusyRetrieveSavePassword") );
  addItem( mFreeBusyRetrieveSavePasswordItem, QStringLiteral( "FreeBusyRetrieveSavePassword" ) );

  setCurrentGroup( QStringLiteral( "Group Scheduling" ) );

  KConfigSkeleton::ItemBool  *innerItemBcc;
  innerItemBcc = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Bcc" ), mBcc, false );
  mBccItem = new KConfigCompilerSignallingItem(innerItemBcc, this, notifyFunction, signalBccChanged);
  mBccItem->setLabel( i18nd("libakonadi-calendar6", "Send copy to owner when mailing events") );
  mBccItem->setWhatsThis( i18nd("libakonadi-calendar6", "Check this box to get a copy of all e-mail messages that KOrganizer sends at your request to event attendees.") );
  addItem( mBccItem, QStringLiteral( "Bcc" ) );
  KConfigSkeleton::ItemBool  *innerItemHideDeclinedInvitations;
  innerItemHideDeclinedInvitations = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Hide Declined Invitations" ), mHideDeclinedInvitations, false );
  mHideDeclinedInvitationsItem = new KConfigCompilerSignallingItem(innerItemHideDeclinedInvitations, this, notifyFunction, signalHideDeclinedInvitationsChanged);
  mHideDeclinedInvitationsItem->setLabel( i18nd("libakonadi-calendar6", "Hide declined invitations") );
  mHideDeclinedInvitationsItem->setWhatsThis( i18nd("libakonadi-calendar6", "Check this box to hide declined invitations in event views.") );
  addItem( mHideDeclinedInvitationsItem, QStringLiteral( "HideDeclinedInvitations" ) );

  setCurrentGroup( QStringLiteral( "Reminders" ) );

  KConfigSkeleton::ItemBool  *innerItemOnlyShowRemindersForMyEvents;
  innerItemOnlyShowRemindersForMyEvents = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "OnlyShowRemindersForMyEvents" ), mOnlyShowRemindersForMyEvents, false );
  mOnlyShowRemindersForMyEventsItem = new KConfigCompilerSignallingItem(innerItemOnlyShowRemindersForMyEvents, this, notifyFunction, signalOnlyShowRemindersForMyEventsChanged);
  mOnlyShowRemindersForMyEventsItem->setLabel( i18nd("libakonadi-calendar6", "Only show reminders for events I organize or attend") );
  mOnlyShowRemindersForMyEventsItem->setWhatsThis( i18nd("libakonadi-calendar6", "Check this to only receive reminders for events that you are the organizer of or that you are attending.") );
  addItem( mOnlyShowRemindersForMyEventsItem, QStringLiteral( "OnlyShowRemindersForMyEvents" ) );

  setCurrentGroup( QStringLiteral( "Hidden Options" ) );

  KConfigSkeleton::ItemBool  *innerItemOutlookCompatCounterProposals;
  innerItemOutlookCompatCounterProposals = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "OutlookCompatCounterProposals" ), mOutlookCompatCounterProposals, false );
  mOutlookCompatCounterProposalsItem = new KConfigCompilerSignallingItem(innerItemOutlookCompatCounterProposals, this, notifyFunction, signalOutlookCompatCounterProposalsChanged);
  mOutlookCompatCounterProposalsItem->setLabel( i18nd("libakonadi-calendar6", "Send Outlook-like pseudo counter proposals") );
  addItem( mOutlookCompatCounterProposalsItem, QStringLiteral( "OutlookCompatCounterProposals" ) );
  KConfigSkeleton::ItemBool  *innerItemFreeBusyCheckHostname;
  innerItemFreeBusyCheckHostname = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "FreeBusyCheckHostname" ), mFreeBusyCheckHostname, false );
  mFreeBusyCheckHostnameItem = new KConfigCompilerSignallingItem(innerItemFreeBusyCheckHostname, this, notifyFunction, signalFreeBusyCheckHostnameChanged);
  mFreeBusyCheckHostnameItem->setLabel( i18nd("libakonadi-calendar6", "Check whether hostname and retrieval email address match") );
  mFreeBusyCheckHostnameItem->setWhatsThis( i18nd("libakonadi-calendar6", "With this setting you can configure whether the domain part of the free/busy URL has to match the domain part of the user ID you are looking for. For example, if this option is set, then looking for the free/busy data of joe@mydomain.com on the server www.yourdomain.com will fail.") );
  addItem( mFreeBusyCheckHostnameItem, QStringLiteral( "FreeBusyCheckHostname" ) );
}

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


void CalendarSettings::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalFreeBusyPublishAutoChanged:
    Q_EMIT FreeBusyPublishAutoChanged();
    break;
  case signalFreeBusyPublishDelayChanged:
    Q_EMIT FreeBusyPublishDelayChanged();
    break;
  case signalFreeBusyPublishDaysChanged:
    Q_EMIT FreeBusyPublishDaysChanged();
    break;
  case signalFreeBusyPublishUrlChanged:
    Q_EMIT FreeBusyPublishUrlChanged();
    break;
  case signalFreeBusyPublishUserChanged:
    Q_EMIT FreeBusyPublishUserChanged();
    break;
  case signalFreeBusyPublishPasswordChanged:
    Q_EMIT FreeBusyPublishPasswordChanged();
    break;
  case signalFreeBusyPublishSavePasswordChanged:
    Q_EMIT FreeBusyPublishSavePasswordChanged();
    break;
  case signalFreeBusyRetrieveAutoChanged:
    Q_EMIT FreeBusyRetrieveAutoChanged();
    break;
  case signalFreeBusyFullDomainRetrievalChanged:
    Q_EMIT FreeBusyFullDomainRetrievalChanged();
    break;
  case signalFreeBusyRetrieveUrlChanged:
    Q_EMIT FreeBusyRetrieveUrlChanged();
    break;
  case signalFreeBusyRetrieveUserChanged:
    Q_EMIT FreeBusyRetrieveUserChanged();
    break;
  case signalFreeBusyRetrievePasswordChanged:
    Q_EMIT FreeBusyRetrievePasswordChanged();
    break;
  case signalFreeBusyRetrieveSavePasswordChanged:
    Q_EMIT FreeBusyRetrieveSavePasswordChanged();
    break;
  case signalBccChanged:
    Q_EMIT BccChanged();
    break;
  case signalHideDeclinedInvitationsChanged:
    Q_EMIT HideDeclinedInvitationsChanged();
    break;
  case signalOnlyShowRemindersForMyEventsChanged:
    Q_EMIT OnlyShowRemindersForMyEventsChanged();
    break;
  case signalOutlookCompatCounterProposalsChanged:
    Q_EMIT OutlookCompatCounterProposalsChanged();
    break;
  case signalFreeBusyCheckHostnameChanged:
    Q_EMIT FreeBusyCheckHostnameChanged();
    break;
  }
}
