-rw-r--r-- | kabc/stdaddressbook.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index 1e00cc6..760820e 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp @@ -56,25 +56,25 @@ void StdAddressBook::handleCrash() { StdAddressBook::self()->cleanUp(); } StdAddressBook *StdAddressBook::self() { - + if ( !mSelf ) - { + { QString appdir = StdAddressBook::setTempAppDir(); kdDebug(5700) << "StdAddressBook::self()" << endl; // US im am not sure why I have to use the other format here?? #ifdef KAB_EMBEDDED mSelf = addressBookDeleter.setObject( new StdAddressBook ); #else //KAB_EMBEDDED addressBookDeleter.setObject( mSelf, new StdAddressBook ); -#endif //KAB_EMBEDDED - KStandardDirs::setAppDir( appdir ); +#endif //KAB_EMBEDDED + KStandardDirs::setAppDir( appdir ); } return mSelf; } QString StdAddressBook::setTempAppDir() @@ -86,47 +86,45 @@ QString StdAddressBook::setTempAppDir() appdir += "kaddressbook/"; else appdir += "/kaddressbook/"; KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); #else QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook"; - - KStandardDirs::setAppDir( appdir ); + + 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 ); +#endif //KAB_EMBEDDED + KStandardDirs::setAppDir( appdir ); } return mSelf; } StdAddressBook::StdAddressBook() -//US : AddressBook( "kabcrc" ) - : AddressBook( locateLocal( "config", "kabcrc") ) + : AddressBook( "kabcrc" ) { - + init( false ); } StdAddressBook::StdAddressBook( bool onlyFastResources ) -//US : AddressBook( "kabcrc" ) - : AddressBook( locateLocal( "config", "kabcrc") ) + : AddressBook( "kabcrc" ) { - + init( onlyFastResources ); } StdAddressBook::~StdAddressBook() { if ( mAutomaticSave ) @@ -140,13 +138,13 @@ void StdAddressBook::init( bool ) 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 ); @@ -183,22 +181,22 @@ bool StdAddressBook::save() } if ( !ab->save( ticket ) ) ok = false; } } - + return ok; } void StdAddressBook::close() { //US destructObject is not defined on my system???. Is setObject(0) the same ??? //US addressBookDeleter.destructObject(); addressBookDeleter.setObject(0); - + } void StdAddressBook::setAutomaticSave( bool enable ) { mAutomaticSave = enable; } |