kaddressbook
kabprefs.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <tdeconfig.h>
00025 #include <tdelocale.h>
00026 #include <kstaticdeleter.h>
00027
00028 #include "kabprefs.h"
00029
00030 KABPrefs *KABPrefs::mInstance = 0;
00031 static KStaticDeleter<KABPrefs> staticDeleter;
00032
00033 KABPrefs::KABPrefs()
00034 : KABPrefsBase()
00035 {
00036 TDEConfigSkeleton::setCurrentGroup( "General" );
00037
00038 TQStringList defaultMap;
00039 defaultMap << "http://maps.google.com/maps?f=q&hl=%1&q=%n,%l,%s";
00040 addItemString( "LocationMapURL", mLocationMapURL, defaultMap[ 0 ] );
00041 addItemStringList( "LocationMapURLs", mLocationMapURLs, defaultMap );
00042 }
00043
00044 KABPrefs::~KABPrefs()
00045 {
00046 }
00047
00048 KABPrefs *KABPrefs::instance()
00049 {
00050 if ( !mInstance ) {
00051 staticDeleter.setObject( mInstance, new KABPrefs() );
00052 mInstance->readConfig();
00053 }
00054
00055 return mInstance;
00056 }
00057
00058 void KABPrefs::setCategoryDefaults()
00059 {
00060 mCustomCategories.clear();
00061 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
00062 << i18n( "Customer" ) << i18n( "Friend" );
00063 }
00064
00065 void KABPrefs::usrReadConfig()
00066 {
00067 config()->setGroup( "General" );
00068 mCustomCategories = config()->readListEntry( "Custom Categories" );
00069 if ( mCustomCategories.isEmpty() )
00070 setCategoryDefaults();
00071
00072 KPimPrefs::usrReadConfig();
00073 }
00074
00075
00076 void KABPrefs::usrWriteConfig()
00077 {
00078 config()->setGroup( "General" );
00079 config()->writeEntry( "Custom Categories", mCustomCategories );
00080
00081 KPimPrefs::usrWriteConfig();
00082 }
|