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

#include "settings.h"

#include <klocalizedstring.h>

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

class SettingsHelper
{
  public:
    SettingsHelper() : q(nullptr) {}
    ~SettingsHelper() { delete q; q = nullptr; }
    SettingsHelper(const SettingsHelper&) = delete;
    SettingsHelper& operator=(const SettingsHelper&) = delete;
    Settings *q;
};
Q_GLOBAL_STATIC(SettingsHelper, s_globalSettings)
Settings *Settings::self()
{
  if (!s_globalSettings()->q) {
    new Settings;
    s_globalSettings()->q->read();
  }

  return s_globalSettings()->q;
}

Settings::Settings( )
  : KConfigSkeleton( QStringLiteral( "kaddressbookrc" ) )
{
  Q_ASSERT(!s_globalSettings()->q);
  s_globalSettings()->q = this;
  setCurrentGroup( QStringLiteral( "Printing" ) );

  mDefaultFileNameItem = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "DefaultFileName" ), mDefaultFileName, QStringLiteral( "addressbook.pdf" ) );
  mDefaultFileNameItem->setLabel( i18nd("kaddressbook", "DefaultFileName") );
  mDefaultFileNameItem->setToolTip( i18nd("kaddressbook", "Default print file name") );
  mDefaultFileNameItem->setWhatsThis( i18nd("kaddressbook", "Set the name of the default print file.") );
  addItem( mDefaultFileNameItem, QStringLiteral( "DefaultFileName" ) );
  mPrintingStyleItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "PrintingStyle" ), mPrintingStyle, 0 );
  mPrintingStyleItem->setLabel( i18nd("kaddressbook", "Printing style") );
  mPrintingStyleItem->setToolTip( i18nd("kaddressbook", "Set the printing style") );
  mPrintingStyleItem->setWhatsThis( i18nd("kaddressbook", "KAddressBook can print the contacts in several styles. With this combobox you can choose one of these.") );
  addItem( mPrintingStyleItem, QStringLiteral( "PrintingStyle" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesSortOrder;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Ascending");
    valuesSortOrder.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Descending");
    valuesSortOrder.append( choice );
  }
  mSortOrderItem = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "SortOrder" ), mSortOrder, valuesSortOrder, Ascending );
  mSortOrderItem->setLabel( i18nd("kaddressbook", "Default sort order") );
  mSortOrderItem->setToolTip( i18nd("kaddressbook", "Sort order") );
  mSortOrderItem->setWhatsThis( i18nd("kaddressbook", "Choose the sorting order for the printed contacts.") );
  addItem( mSortOrderItem, QStringLiteral( "SortOrder" ) );

  setCurrentGroup( QStringLiteral( "Views" ) );

  QList<int> defaultContactModelColumns;
  defaultContactModelColumns.append( 0 );

  mContactModelColumnsItem = new KConfigSkeleton::ItemIntList( currentGroup(), QStringLiteral( "ContactModelColumns" ), mContactModelColumns, defaultContactModelColumns );
  mContactModelColumnsItem->setLabel( i18nd("kaddressbook", "ContactModelColumns") );
  mContactModelColumnsItem->setToolTip( i18nd("kaddressbook", "View columns") );
  mContactModelColumnsItem->setWhatsThis( i18nd("kaddressbook", "Set the number of contact model view columns.") );
  addItem( mContactModelColumnsItem, QStringLiteral( "ContactModelColumns" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesViewMode;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Dummy");
    valuesViewMode.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Simple");
    valuesViewMode.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("TwoColumn");
    valuesViewMode.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("ThreeColumn");
    valuesViewMode.append( choice );
  }
  mViewModeItem = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "ViewMode" ), mViewMode, valuesViewMode, 3 );
  mViewModeItem->setLabel( i18nd("kaddressbook", "Viewing mode") );
  mViewModeItem->setToolTip( i18nd("kaddressbook", "Viewing mode (number of columns)") );
  mViewModeItem->setWhatsThis( i18nd("kaddressbook", "Choose the layout for the main view") );
  addItem( mViewModeItem, QStringLiteral( "ViewMode" ) );
  mShowMenuBarItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowMenuBar" ), mShowMenuBar, true );
  mShowMenuBarItem->setLabel( i18nd("kaddressbook", "ShowMenuBar") );
  addItem( mShowMenuBarItem, QStringLiteral( "ShowMenuBar" ) );
}

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

