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

#include "prefs.h"

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

class PrefsHelper
{
  public:
    PrefsHelper() : q(nullptr) {}
    ~PrefsHelper() { delete q; }
    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( "kapptemplaterc" ) )
{
  Q_ASSERT(!s_globalPrefs()->q);
  s_globalPrefs()->q = this;
  setCurrentGroup( QStringLiteral( "Project" ) );

  KConfigSkeleton::ItemString  *itemAppName;
  itemAppName = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "appName" ), mAppName, QStringLiteral( "KApp4" ) );
  addItem( itemAppName, QStringLiteral( "appName" ) );
  KConfigSkeleton::ItemString  *itemAppVersion;
  itemAppVersion = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "appVersion" ), mAppVersion, QStringLiteral( "0.1" ) );
  addItem( itemAppVersion, QStringLiteral( "appVersion" ) );
QString defaultDir = KUser().homeDir()+"/src";
      
  KConfigSkeleton::ItemString  *itemUrl;
  itemUrl = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "url" ), mUrl, defaultDir );
  addItem( itemUrl, QStringLiteral( "url" ) );

  setCurrentGroup( QStringLiteral( "User" ) );

QString name;
      {
        KEMailSettings emailConfig;
        emailConfig.setProfile( emailConfig.defaultProfileName() );
        name = emailConfig.getSetting( KEMailSettings::RealName );
      }
      
  KConfigSkeleton::ItemString  *itemName;
  itemName = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "name" ), mName, name );
  addItem( itemName, QStringLiteral( "name" ) );
QString address;
      {
        KEMailSettings emailConfig;
        emailConfig.setProfile( emailConfig.defaultProfileName() );
        address = emailConfig.getSetting( KEMailSettings::EmailAddress );
      }
      
  KConfigSkeleton::ItemString  *itemEmail;
  itemEmail = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "email" ), mEmail, address );
  addItem( itemEmail, QStringLiteral( "email" ) );
}

Prefs::~Prefs()
{
  s_globalPrefs()->q = nullptr;
}

