kaddressbook Library API Documentation

kabprefs.cpp

00001 /*                                                                      
00002     This file is part of KAddressBook.                                  
00003     Copyright (c) 2002 Mike Pilone <mpilone@slac.com>                   
00004                                                                         
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or   
00008     (at your option) any later version.                                 
00009                                                                         
00010     This program is distributed in the hope that it will be useful,     
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of      
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the        
00013     GNU General Public License for more details.                        
00014                                                                         
00015     You should have received a copy of the GNU General Public License   
00016     along with this program; if not, write to the Free Software         
00017     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           
00018                                                                         
00019     As a special exception, permission is given to link this program    
00020     with any edition of Qt, and distribute the resulting executable,    
00021     without including the source code for Qt in the source distribution.
00022 */                                                                      
00023 
00024 #include <kconfig.h>
00025 #include <klocale.h>
00026 #include <kstaticdeleter.h>
00027 
00028 #include "kabprefs.h"
00029 
00030 KABPrefs *KABPrefs::sInstance = 0;
00031 static KStaticDeleter<KABPrefs> staticDeleter;
00032 
00033 KABPrefs::KABPrefs()
00034   : KPimPrefs("kaddressbookrc")
00035 {
00036   KConfigSkeleton::setCurrentGroup( "Views" );
00037   addItemBool( "HonorSingleClick", mHonorSingleClick, false );
00038 
00039   KConfigSkeleton::setCurrentGroup( "General" );
00040   addItemBool( "AutomaticNameParsing", mAutomaticNameParsing, true );
00041   addItemInt( "CurrentIncSearchField", mCurrentIncSearchField, 0 );
00042   addItemString( "PhoneHookApplication", mPhoneHookApplication, "" );
00043   addItemString( "FaxHookApplication", mFaxHookApplication,
00044                  "kdeprintfax --phone %N" );
00045 
00046   QStringList defaultMaps;
00047   defaultMaps << "http://link2.map24.com/?lid=9cc343ae&maptype=CGI&lang=%1&street0=%s&zip0=%z&city0=%l&country0=%c";
00048   defaultMaps << "http://www.mapquest.com/main.adp?searchtab=address&searchtype=address&country=%c&address=%s&state=%r&zipcode=%z&city=%l&search=1";
00049   addItemString( "LocationMapURL", mLocationMapURL, defaultMaps[ 0 ] );
00050   addItemStringList( "LocationMapURLs", mLocationMapURLs, defaultMaps );
00051 
00052   KConfigSkeleton::setCurrentGroup( "MainWindow" );
00053   addItemBool( "JumpButtonBarVisible", mJumpButtonBarVisible, false );
00054   addItemBool( "DetailsPageVisible", mDetailsPageVisible, true );
00055   addItemIntList( "ExtensionsSplitter", mExtensionsSplitter );
00056   addItemIntList( "DetailsSplitter", mDetailsSplitter );
00057 
00058   KConfigSkeleton::setCurrentGroup( "Extensions_General" );
00059   addItemString( "CurrentExtension", mCurrentExtension, "resourceselection" );
00060 
00061   KConfigSkeleton::setCurrentGroup( "Views" );
00062   QString defaultView = i18n( "Default Table View" );
00063   addItemString( "CurrentView", mCurrentView, defaultView );
00064   addItemStringList( "ViewNames", mViewNames, defaultView );
00065 
00066   KConfigSkeleton::setCurrentGroup( "Filters" );
00067   addItemInt( "CurrentFilter", mCurrentFilter, 0 );
00068 
00069   KConfigSkeleton::setCurrentGroup( "AddresseeEditor" );
00070   addItemInt( "EditorType", mEditorType, 0 );
00071   addItemStringList( "GlobalCustomFields", mGlobalCustomFields );
00072   addItemStringList( "AdvancedCustomFields", mAdvancedCustomFields );
00073 }
00074 
00075 KABPrefs::~KABPrefs()
00076 {
00077 }
00078 
00079 KABPrefs *KABPrefs::instance()
00080 {
00081   if ( !sInstance ) {
00082     staticDeleter.setObject( sInstance, new KABPrefs() );
00083     sInstance->readConfig();
00084   }
00085 
00086   return sInstance;
00087 }
00088 
00089 void KABPrefs::setCategoryDefaults()
00090 {
00091   mCustomCategories.clear();
00092   
00093   mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
00094                     << i18n( "Customer" ) << i18n( "Friend" );
00095 }
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Aug 2 09:54:31 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003