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

#include "newmailnotifieragentsettings.h"

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

#include <QDebug>

class NewMailNotifierAgentSettingsHelper
{
  public:
    NewMailNotifierAgentSettingsHelper() : q(nullptr) {}
    ~NewMailNotifierAgentSettingsHelper() { delete q; q = nullptr; }
    NewMailNotifierAgentSettingsHelper(const NewMailNotifierAgentSettingsHelper&) = delete;
    NewMailNotifierAgentSettingsHelper& operator=(const NewMailNotifierAgentSettingsHelper&) = delete;
    NewMailNotifierAgentSettings *q;
};
Q_GLOBAL_STATIC(NewMailNotifierAgentSettingsHelper, s_globalNewMailNotifierAgentSettings)
NewMailNotifierAgentSettings *NewMailNotifierAgentSettings::self()
{
  if (!s_globalNewMailNotifierAgentSettings()->q)
     qFatal("you need to call NewMailNotifierAgentSettings::instance before using");
  return s_globalNewMailNotifierAgentSettings()->q;
}

void NewMailNotifierAgentSettings::instance(const QString& cfgfilename)
{
  if (s_globalNewMailNotifierAgentSettings()->q) {
     qDebug() << "NewMailNotifierAgentSettings::instance called after the first use - ignoring";
     return;
  }
  new NewMailNotifierAgentSettings(KSharedConfig::openConfig(cfgfilename));
  s_globalNewMailNotifierAgentSettings()->q->read();
}

void NewMailNotifierAgentSettings::instance(KSharedConfig::Ptr config)
{
  if (s_globalNewMailNotifierAgentSettings()->q) {
     qDebug() << "NewMailNotifierAgentSettings::instance called after the first use - ignoring";
     return;
  }
  new NewMailNotifierAgentSettings(std::move(config));
  s_globalNewMailNotifierAgentSettings()->q->read();
}

NewMailNotifierAgentSettings::NewMailNotifierAgentSettings( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalNewMailNotifierAgentSettings()->q);
  s_globalNewMailNotifierAgentSettings()->q = this;
  setCurrentGroup( QStringLiteral( "General" ) );

  mVerboseNotificationItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "verboseNotification" ), mVerboseNotification, true );
  addItem( mVerboseNotificationItem, QStringLiteral( "verboseNotification" ) );
  mEnabledItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "enabled" ), mEnabled, true );
  addItem( mEnabledItem, QStringLiteral( "enabled" ) );
  mShowPhotoItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showPhoto" ), mShowPhoto, true );
  addItem( mShowPhotoItem, QStringLiteral( "showPhoto" ) );
  mShowFromItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showFrom" ), mShowFrom, true );
  addItem( mShowFromItem, QStringLiteral( "showFrom" ) );
  mShowSubjectItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showSubject" ), mShowSubject, true );
  addItem( mShowSubjectItem, QStringLiteral( "showSubject" ) );
  mShowFolderItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showFolder" ), mShowFolder, true );
  addItem( mShowFolderItem, QStringLiteral( "showFolder" ) );
  mExcludeEmailsFromMeItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "excludeEmailsFromMe" ), mExcludeEmailsFromMe, false );
  addItem( mExcludeEmailsFromMeItem, QStringLiteral( "excludeEmailsFromMe" ) );
  mTextToSpeakEnabledItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "textToSpeakEnabled" ), mTextToSpeakEnabled, false );
  addItem( mTextToSpeakEnabledItem, QStringLiteral( "textToSpeakEnabled" ) );
  mTextToSpeakItem = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "textToSpeak" ), mTextToSpeak, i18nc("%f is a variable for agent. Do not change it", "A message was received from %f") );
  addItem( mTextToSpeakItem, QStringLiteral( "textToSpeak" ) );
  mShowButtonToDisplayMailItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showButtonToDisplayMail" ), mShowButtonToDisplayMail, false );
  addItem( mShowButtonToDisplayMailItem, QStringLiteral( "showButtonToDisplayMail" ) );
  mKeepPersistentNotificationItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "keepPersistentNotification" ), mKeepPersistentNotification, false );
  addItem( mKeepPersistentNotificationItem, QStringLiteral( "keepPersistentNotification" ) );
  mReplyMailItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "replyMail" ), mReplyMail, false );
  addItem( mReplyMailItem, QStringLiteral( "replyMail" ) );
  mReplyMailTypeItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "replyMailType" ), mReplyMailType, 0 );
  addItem( mReplyMailTypeItem, QStringLiteral( "replyMailType" ) );
}

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

