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

#include "globalsettings_messagecore.h"

#include <klocalizedstring.h>

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

using namespace MessageCore;

namespace MessageCore {

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

}
Q_GLOBAL_STATIC(MessageCoreSettingsBaseHelper, s_globalMessageCoreSettingsBase)
MessageCoreSettingsBase *MessageCoreSettingsBase::self()
{
  if (!s_globalMessageCoreSettingsBase()->q) {
    new MessageCoreSettingsBase;
    s_globalMessageCoreSettingsBase()->q->read();
  }

  return s_globalMessageCoreSettingsBase()->q;
}

MessageCoreSettingsBase::MessageCoreSettingsBase( )
  : KConfigSkeleton( QStringLiteral( "messagecorerc" ) )
{
  Q_ASSERT(!s_globalMessageCoreSettingsBase()->q);
  s_globalMessageCoreSettingsBase()->q = this;
  setCurrentGroup( QStringLiteral( "General" ) );

  mDateFormatItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "dateFormat" ), mDateFormat, int( MessageCore::DateFormatter::Fancy ) );
  mDateFormatItem->setLabel( i18nd("libmessagecore6", "dateFormat") );
  addItem( mDateFormatItem, QStringLiteral( "dateFormat" ) );
  mCustomDateFormatItem = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "customDateFormat" ), mCustomDateFormat );
  mCustomDateFormatItem->setLabel( i18nd("libmessagecore6", "customDateFormat") );
  addItem( mCustomDateFormatItem, QStringLiteral( "customDateFormat" ) );

  setCurrentGroup( QStringLiteral( "Fonts" ) );

  mUseDefaultFontsItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "defaultFonts" ), mUseDefaultFonts, true );
  mUseDefaultFontsItem->setLabel( i18nd("libmessagecore6", "defaultFonts") );
  addItem( mUseDefaultFontsItem, QStringLiteral( "UseDefaultFonts" ) );

  setCurrentGroup( QStringLiteral( "Reader" ) );

  mUseDefaultColorsItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "defaultColors" ), mUseDefaultColors, true );
  mUseDefaultColorsItem->setLabel( i18nd("libmessagecore6", "defaultColors") );
  addItem( mUseDefaultColorsItem, QStringLiteral( "UseDefaultColors" ) );
  mUseRealHtmlMailColorItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "realHtmlMailColor" ), mUseRealHtmlMailColor, true );
  mUseRealHtmlMailColorItem->setLabel( i18nd("libmessagecore6", "realHtmlMailColor") );
  addItem( mUseRealHtmlMailColorItem, QStringLiteral( "UseRealHtmlMailColor" ) );
  mOverrideCharacterEncodingItem = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "encoding" ), mOverrideCharacterEncoding );
  mOverrideCharacterEncodingItem->setLabel( i18nd("libmessagecore6", "encoding") );
  mOverrideCharacterEncodingItem->setWhatsThis( i18nd("libmessagecore6", "Changing this from its default 'Auto' will force the use of the specified encoding for all emails, regardless of what they specify themselves.") );
  addItem( mOverrideCharacterEncodingItem, QStringLiteral( "OverrideCharacterEncoding" ) );
  mQuotedText3Item = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "QuotedText3" ), mQuotedText3, MessageCore::ColorUtil::self()->quoteLevel3DefaultTextColor() );
  mQuotedText3Item->setLabel( i18nd("libmessagecore6", "This is the color used in the 3rd level of quoted text") );
  addItem( mQuotedText3Item, QStringLiteral( "QuotedText3" ) );
  mQuotedText2Item = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "QuotedText2" ), mQuotedText2, MessageCore::ColorUtil::self()->quoteLevel2DefaultTextColor() );
  mQuotedText2Item->setLabel( i18nd("libmessagecore6", "This is the color used in the 2nd level of quoted text") );
  addItem( mQuotedText2Item, QStringLiteral( "QuotedText2" ) );
  mQuotedText1Item = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "QuotedText1" ), mQuotedText1, MessageCore::ColorUtil::self()->quoteLevel1DefaultTextColor() );
  mQuotedText1Item->setLabel( i18nd("libmessagecore6", "This is the color used in the 1st level of quoted text") );
  addItem( mQuotedText1Item, QStringLiteral( "QuotedText1" ) );
  mDisplayOwnIdentityItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "DisplayOwnIdentity" ), mDisplayOwnIdentity, false );
  mDisplayOwnIdentityItem->setLabel( i18nd("libmessagecore6", "Display Own Identity") );
  addItem( mDisplayOwnIdentityItem, QStringLiteral( "DisplayOwnIdentity" ) );

  setCurrentGroup( QStringLiteral( "Composer" ) );

  QStringList defaultReplyPrefixes;
  defaultReplyPrefixes.append( QString::fromUtf8( "Re\\s*:" ) );
  defaultReplyPrefixes.append( QString::fromUtf8( "Re\\[\\d+\\]:" ) );
  defaultReplyPrefixes.append( QString::fromUtf8( "Re\\d+:" ) );

  mReplyPrefixesItem = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "reply-prefixes" ), mReplyPrefixes, defaultReplyPrefixes );
  mReplyPrefixesItem->setLabel( i18nd("libmessagecore6", "reply-prefixes") );
  addItem( mReplyPrefixesItem, QStringLiteral( "ReplyPrefixes" ) );
  mReplaceReplyPrefixItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "replace-reply-prefix" ), mReplaceReplyPrefix, true );
  mReplaceReplyPrefixItem->setLabel( i18nd("libmessagecore6", "Replace recognized prefi&x with \"Re:\"") );
  addItem( mReplaceReplyPrefixItem, QStringLiteral( "ReplaceReplyPrefix" ) );
  QStringList defaultForwardPrefixes;
  defaultForwardPrefixes.append( QString::fromUtf8( "Fwd:" ) );
  defaultForwardPrefixes.append( QString::fromUtf8( "FW:" ) );

  mForwardPrefixesItem = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "forward-prefixes" ), mForwardPrefixes, defaultForwardPrefixes );
  mForwardPrefixesItem->setLabel( i18nd("libmessagecore6", "forward-prefixes") );
  addItem( mForwardPrefixesItem, QStringLiteral( "ForwardPrefixes" ) );
  mReplaceForwardPrefixItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "replace-forward-prefix" ), mReplaceForwardPrefix, true );
  mReplaceForwardPrefixItem->setLabel( i18nd("libmessagecore6", "Replace recognized prefix with \"&Fwd:\"") );
  addItem( mReplaceForwardPrefixItem, QStringLiteral( "ReplaceForwardPrefix" ) );
  mMaximumAttachmentSizeItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "MaximumAttachmentSize" ), mMaximumAttachmentSize, -1 );
  mMaximumAttachmentSizeItem->setLabel( i18nd("libmessagecore6", "The maximum size in bits that email attachments are allowed to have (-1 for no limit)") );
  addItem( mMaximumAttachmentSizeItem, QStringLiteral( "MaximumAttachmentSize" ) );
}

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

