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   KConfigSkeleton::setCurrentGroup( "MainWindow" );
00047   addItemBool( "JumpButtonBarVisible", mJumpButtonBarVisible, false );
00048   addItemBool( "DetailsPageVisible", mDetailsPageVisible, true );
00049   addItemIntList( "ExtensionsSplitter", mExtensionsSplitter );
00050   addItemIntList( "DetailsSplitter", mDetailsSplitter );
00051 
00052   KConfigSkeleton::setCurrentGroup( "Extensions_General" );
00053   QStringList defaultExtensions;
00054   defaultExtensions << "merge";
00055   defaultExtensions << "distribution_list_editor";
00056   addItemInt( "CurrentExtension", mCurrentExtension, 0 );
00057   addItemStringList( "ActiveExtensions", mActiveExtensions, defaultExtensions );
00058 
00059   KConfigSkeleton::setCurrentGroup( "Views" );
00060   QString defaultView = i18n( "Default Table View" );
00061   addItemString( "CurrentView", mCurrentView, defaultView );
00062   addItemStringList( "ViewNames", mViewNames, defaultView );
00063 
00064   KConfigSkeleton::setCurrentGroup( "Filters" );
00065   addItemInt( "CurrentFilter", mCurrentFilter, 0 );
00066 }
00067 
00068 KABPrefs::~KABPrefs()
00069 {
00070 }
00071 
00072 KABPrefs *KABPrefs::instance()
00073 {
00074   if ( !sInstance ) {
00075     staticDeleter.setObject( sInstance, new KABPrefs() );
00076     sInstance->readConfig();
00077   }
00078 
00079   return sInstance;
00080 }
00081 
00082 void KABPrefs::setCategoryDefaults()
00083 {
00084   mCustomCategories.clear();
00085   
00086   mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
00087                     << i18n( "Customer" ) << i18n( "Friend" );
00088 }
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:52 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003