4 #include "recentcontactscollectionssettings.h" 
    7 #include <QtCore/QFile> 
   11 using namespace Akonadi;
 
   15 class RecentContactsCollectionsSettingsHelper
 
   18     RecentContactsCollectionsSettingsHelper() : q(0) {}
 
   19     ~RecentContactsCollectionsSettingsHelper() { 
delete q; }
 
   20     RecentContactsCollectionsSettings *q;
 
   24 K_GLOBAL_STATIC(RecentContactsCollectionsSettingsHelper, s_globalRecentContactsCollectionsSettings)
 
   25 RecentContactsCollectionsSettings *RecentContactsCollectionsSettings::self()
 
   27   if (!s_globalRecentContactsCollectionsSettings->q)
 
   28      kFatal() << 
"you need to call RecentContactsCollectionsSettings::instance before using";
 
   29   return s_globalRecentContactsCollectionsSettings->q;
 
   32 void RecentContactsCollectionsSettings::instance(
const QString& cfgfilename)
 
   34   if (s_globalRecentContactsCollectionsSettings->q) {
 
   35      kDebug() << 
"RecentContactsCollectionsSettings::instance called after the first use - ignoring";
 
   38   new RecentContactsCollectionsSettings(cfgfilename);
 
   39   s_globalRecentContactsCollectionsSettings->q->readConfig();
 
   42 RecentContactsCollectionsSettings::RecentContactsCollectionsSettings(  
const QString& config  )
 
   43   : KConfigSkeleton( config )
 
   45   Q_ASSERT(!s_globalRecentContactsCollectionsSettings->q);
 
   46   s_globalRecentContactsCollectionsSettings->q = 
this;
 
   47   setCurrentGroup( QLatin1String( 
"SpecialCollections" ) );
 
   49   mDefaultResourceIdItem = 
new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( 
"DefaultResourceId" ), mDefaultResourceId );
 
   50   addItem( mDefaultResourceIdItem, QLatin1String( 
"DefaultResourceId" ) );
 
   53 RecentContactsCollectionsSettings::~RecentContactsCollectionsSettings()
 
   55   if (!s_globalRecentContactsCollectionsSettings.isDestroyed()) {
 
   56     s_globalRecentContactsCollectionsSettings->q = 0;