-rw-r--r-- | kabc/stdaddressbook.cpp | 5 | ||||
-rw-r--r-- | kabc/stdaddressbook.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index f17f366..a14ae20 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp @@ -84,72 +84,73 @@ QString StdAddressBook::setTempAppDir() appdir += "kaddressbook/"; else appdir += "/kaddressbook/"; KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); #else QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook"; KStandardDirs::setAppDir( appdir ); #endif return appDIR; } StdAddressBook *StdAddressBook::self( bool onlyFastResources ) { if ( !mSelf ) { QString appdir =StdAddressBook::setTempAppDir(); #ifdef KAB_EMBEDDED mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); #else //KAB_EMBEDDED addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) ); #endif //KAB_EMBEDDED KStandardDirs::setAppDir( appdir ); } return mSelf; } StdAddressBook::StdAddressBook() : AddressBook( "kabcrc" ) { - init( false ); + //init( false ); } StdAddressBook::StdAddressBook( bool onlyFastResources ) : AddressBook( "kabcrc" ) { - init( onlyFastResources ); + if ( onlyFastResources ) + init( onlyFastResources ); } StdAddressBook::~StdAddressBook() { if ( mAutomaticSave ) save(); } void StdAddressBook::init( bool ) { KRES::Manager<Resource> *manager = resourceManager(); KRES::Manager<Resource>::ActiveIterator it; for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { (*it)->setAddressBook( this ); if ( !(*it)->open() ) error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); } Resource *res = standardResource(); if ( !res ) { res = manager->createResource( "file" ); if ( res ) { addResource( res ); } else qDebug(" No resource available!!!"); } setStandardResource( res ); manager->writeConfig(); diff --git a/kabc/stdaddressbook.h b/kabc/stdaddressbook.h index 9ec53b0..cf130b3 100644 --- a/kabc/stdaddressbook.h +++ b/kabc/stdaddressbook.h @@ -105,47 +105,47 @@ class StdAddressBook : public AddressBook Set the automatic save property of the address book. If @p enable is TRUE (default) the address book is saved at destruction time otherwise you have to call @ref save() to explicitely save it. */ static void setAutomaticSave( bool enable ); /** Closes the address book. Depending on @ref automaticSave() it will save the address book first. */ static void close(); /** Returns whether the address book is saved at destruction time. See also @ref setAutomaticSave(). */ static bool automaticSave(); /** Returns the contact, that is associated with the owner of the address book. This contact should be used by other programs to access user specific data. */ Addressee whoAmI(); /** Sets the users contact. See @ref whoAmI() for more information. @param uid The uid of the users contact. */ void setWhoAmI( const Addressee &addr ); + void init( bool onlyFastResources ); protected: StdAddressBook(); StdAddressBook( bool onlyFastResources ); - void init( bool onlyFastResources ); private: static QString setTempAppDir(); static StdAddressBook *mSelf; static bool mAutomaticSave; }; } #endif |