summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kabc/stdaddressbook.cpp25
-rw-r--r--kabc/stdaddressbook.h2
-rw-r--r--kaddressbook/kabcore.cpp2
3 files changed, 26 insertions, 3 deletions
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp
index a14ae20..43d9fde 100644
--- a/kabc/stdaddressbook.cpp
+++ b/kabc/stdaddressbook.cpp
@@ -47,24 +47,41 @@ QString StdAddressBook::fileName()
return locateLocal( "data", "kabc/std.vcf" );
}
QString StdAddressBook::directoryName()
{
return locateLocal( "data", "kabc/stdvcf" );
}
void StdAddressBook::handleCrash()
{
StdAddressBook::self()->cleanUp();
}
+StdAddressBook *StdAddressBook::selfNoLoad()
+{
+
+ if ( !mSelf )
+ {
+ QString appdir = StdAddressBook::setTempAppDir();
+// US im am not sure why I have to use the other format here??
+#ifdef KAB_EMBEDDED
+ mSelf = addressBookDeleter.setObject( new StdAddressBook ( QString() ) );
+#else //KAB_EMBEDDED
+ addressBookDeleter.setObject( mSelf, new StdAddressBook( QString() ) );
+#endif //KAB_EMBEDDED
+ KStandardDirs::setAppDir( appdir );
+ }
+
+ return mSelf;
+}
StdAddressBook *StdAddressBook::self()
{
if ( !mSelf )
{
QString appdir = StdAddressBook::setTempAppDir();
// 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 );
@@ -99,37 +116,41 @@ 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( QString )
+ : AddressBook( "kabcrc" )
+{
+
+}
StdAddressBook::StdAddressBook()
: AddressBook( "kabcrc" )
{
- //init( false );
+ init( false );
}
StdAddressBook::StdAddressBook( bool onlyFastResources )
: AddressBook( "kabcrc" )
{
- if ( onlyFastResources )
init( onlyFastResources );
}
StdAddressBook::~StdAddressBook()
{
if ( mAutomaticSave )
save();
}
void StdAddressBook::init( bool )
{
KRES::Manager<Resource> *manager = resourceManager();
diff --git a/kabc/stdaddressbook.h b/kabc/stdaddressbook.h
index cf130b3..3cd6363 100644
--- a/kabc/stdaddressbook.h
+++ b/kabc/stdaddressbook.h
@@ -61,24 +61,25 @@ class StdAddressBook : public AddressBook
public:
/**
Destructor.
*/
~StdAddressBook();
/**
Return the standard addressbook object. It also loads slow resources.
It is the same as self(false); .
*/
static StdAddressBook *self();
+ static StdAddressBook *selfNoLoad();
/**
This is the same as above, but with specified
behaviour of resource loading.
@param onlyFastResource Only resources marked as 'fast' should be loaded
*/
// FIXME for KDE4 return StdAddressBook and merge with the metod above -zecke
static StdAddressBook *self( bool onlyFastResources );
/**
Save the standard address book to disk.
@@ -129,23 +130,24 @@ class StdAddressBook : public AddressBook
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( QString );
StdAddressBook( bool onlyFastResources );
private:
static QString setTempAppDir();
static StdAddressBook *mSelf;
static bool mAutomaticSave;
};
}
#endif
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index c670b1f..77321aa 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -294,25 +294,25 @@ KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, con
KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
: QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
mReadWrite( readWrite ), mModified( false )
#endif //KAB_EMBEDDED
{
// syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
// syncManager->setBlockSave(false);
mIncSearchWidget = 0;
mMiniSplitter = 0;
mExtensionBarSplitter = 0;
mIsPart = !parent->inherits( "KAddressBookMain" );
- mAddressBook = KABC::StdAddressBook::self();
+ mAddressBook = KABC::StdAddressBook::selfNoLoad();
KABC::StdAddressBook::setAutomaticSave( false );
#ifndef KAB_EMBEDDED
mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
#endif //KAB_EMBEDDED
connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
SLOT( addressBookChanged() ) );
#if 0
// LR moved to addressbook init method
mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,