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 <kconfig.h>
00025 #include <klocale.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 KConfigSkeleton::setCurrentGroup( "General" );
00037
00038 QStringList defaultMap;
00039 defaultMap << "http://world.maporama.com/idl/maporama/drawaddress.aspx?MD_scale=0.0002&MD_size=500x380&GC_country=%c&GC_address=%s&GC_zip=%z&GC_state=%r&GC_city=%l";
00040 defaultMap << "http://link2.map24.com/?lid=9cc343ae&maptype=CGI&lang=%1&street0=%s&zip0=%z&city0=%l&country0=%c";
00041 defaultMap << "http://www.mapquest.com/maps/map.adp?country=%c&address=%s&state=%r&zipcode=%z&city=%l";
00042 addItemString( "LocationMapURL", mLocationMapURL, defaultMap[ 0 ] );
00043 addItemStringList( "LocationMapURLs", mLocationMapURLs, defaultMap );
00044 }
00045
00046 KABPrefs::~KABPrefs()
00047 {
00048 }
00049
00050 KABPrefs *KABPrefs::instance()
00051 {
00052 if ( !mInstance ) {
00053 staticDeleter.setObject( mInstance, new KABPrefs() );
00054 mInstance->readConfig();
00055 }
00056
00057 return mInstance;
00058 }
00059
00060 void KABPrefs::setCategoryDefaults()
00061 {
00062 mCustomCategories.clear();
00063 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
00064 << i18n( "Customer" ) << i18n( "Friend" );
00065 }
00066
00067 void KABPrefs::usrReadConfig()
00068 {
00069 config()->setGroup( "General" );
00070 mCustomCategories = config()->readListEntry( "Custom Categories" );
00071 if ( mCustomCategories.isEmpty() )
00072 setCategoryDefaults();
00073
00074 KPimPrefs::usrReadConfig();
00075 }
00076
00077
00078 void KABPrefs::usrWriteConfig()
00079 {
00080 config()->setGroup( "General" );
00081 config()->writeEntry( "Custom Categories", mCustomCategories );
00082
00083 KPimPrefs::usrWriteConfig();
00084 }
|