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

#include "prefs.h"

#include <klocalizedstring.h>

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

using namespace Kontact;

namespace Kontact {

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

}
Q_GLOBAL_STATIC(PrefsHelper, s_globalPrefs)
Prefs *Prefs::self()
{
  if (!s_globalPrefs()->q) {
    new Prefs;
    s_globalPrefs()->q->read();
  }

  return s_globalPrefs()->q;
}

Prefs::Prefs( )
  : KConfigSkeleton( QStringLiteral( "kontactrc" ) )
{
  Q_ASSERT(!s_globalPrefs()->q);
  s_globalPrefs()->q = this;
  setCurrentGroup( QStringLiteral( "View" ) );

  mActivePluginItem = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "ActivePlugin" ), mActivePlugin, QStringLiteral( "kontact_summaryplugin" ) );
  mActivePluginItem->setLabel( i18n("ActivePlugin") );
  mActivePluginItem->setToolTip( i18n("The currently active plugin") );
  mActivePluginItem->setWhatsThis( i18n("The currently active plugin") );
  addItem( mActivePluginItem, QStringLiteral( "ActivePlugin" ) );
  mForceStartupPluginItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ForceStartupPlugin" ), mForceStartupPlugin, false );
  mForceStartupPluginItem->setLabel( i18n("Always start with plugin:") );
  mForceStartupPluginItem->setToolTip( i18n("Set the initial plugin on each start") );
  mForceStartupPluginItem->setWhatsThis( i18n("Usually Kontact will come up with the plugin used before shutdown. Check this box if you would like the specified plugin to come up on start instead.") );
  addItem( mForceStartupPluginItem, QStringLiteral( "ForceStartupPlugin" ) );
  mForcedStartupPluginItem = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "ForcedStartupPlugin" ), mForcedStartupPlugin );
  mForcedStartupPluginItem->setLabel( i18n("ForcedStartupPlugin") );
  addItem( mForcedStartupPluginItem, QStringLiteral( "ForcedStartupPlugin" ) );
  mSideBarOpenItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "SideBarOpen" ), mSideBarOpen, true );
  mSideBarOpenItem->setLabel( i18n("Show the component sidebar") );
  mSideBarOpenItem->setToolTip( i18n("Show/Hide the icon sidebar") );
  mSideBarOpenItem->setWhatsThis( i18n("To save screen real estate you might choose to hide the icon sidebar. Uncheck this box to hide the component sidebar. Note that the F9 key will hide/show the icon sidebar.") );
  addItem( mSideBarOpenItem, QStringLiteral( "SideBarOpen" ) );
  QList<int> defaultSidePaneSplitter;
  defaultSidePaneSplitter.append( 1 );

  mSidePaneSplitterItem = new KConfigSkeleton::ItemIntList( currentGroup(), QStringLiteral( "SidePaneSplitter" ), mSidePaneSplitter, defaultSidePaneSplitter );
  mSidePaneSplitterItem->setLabel( i18n("SidePaneSplitter") );
  addItem( mSidePaneSplitterItem, QStringLiteral( "SidePaneSplitter" ) );
  mSidePaneIconSizeItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "SidePaneIconSize" ), mSidePaneIconSize, 32 );
  mSidePaneIconSizeItem->setLabel( i18n("SidePaneIconSize") );
  addItem( mSidePaneIconSizeItem, QStringLiteral( "SidePaneIconSize" ) );
  mSidePaneShowIconsItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "SidePaneShowIcons" ), mSidePaneShowIcons, true );
  mSidePaneShowIconsItem->setLabel( i18n("SidePaneShowIcons") );
  addItem( mSidePaneShowIconsItem, QStringLiteral( "SidePaneShowIcons" ) );
  mSidePaneShowTextItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "SidePaneShowText" ), mSidePaneShowText, true );
  mSidePaneShowTextItem->setLabel( i18n("SidePaneShowText") );
  addItem( mSidePaneShowTextItem, QStringLiteral( "SidePaneShowText" ) );
  mLastVersionSeenItem = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "LastVersionSeen" ), mLastVersionSeen );
  mLastVersionSeenItem->setLabel( i18n("LastVersionSeen") );
  addItem( mLastVersionSeenItem, QStringLiteral( "LastVersionSeen" ) );
}

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

