author | zautrix <zautrix> | 2005-08-23 14:22:11 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-23 14:22:11 (UTC) |
commit | e6d678229580cd712ff82ea989e7b151be546dbd (patch) (unidiff) | |
tree | 1cf32674db62993bcdc636d90b3994e9343a8b5f | |
parent | 02fa432f183ad2b18380de0e41399efe3b867dba (diff) | |
download | kdepimpi-e6d678229580cd712ff82ea989e7b151be546dbd.zip kdepimpi-e6d678229580cd712ff82ea989e7b151be546dbd.tar.gz kdepimpi-e6d678229580cd712ff82ea989e7b151be546dbd.tar.bz2 |
stdab fix
-rw-r--r-- | kabc/stdaddressbook.cpp | 27 | ||||
-rw-r--r-- | kabc/stdaddressbook.h | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 |
3 files changed, 27 insertions, 4 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() | |||
47 | return locateLocal( "data", "kabc/std.vcf" ); | 47 | return locateLocal( "data", "kabc/std.vcf" ); |
48 | } | 48 | } |
49 | 49 | ||
50 | QString StdAddressBook::directoryName() | 50 | QString StdAddressBook::directoryName() |
51 | { | 51 | { |
52 | return locateLocal( "data", "kabc/stdvcf" ); | 52 | return locateLocal( "data", "kabc/stdvcf" ); |
53 | } | 53 | } |
54 | 54 | ||
55 | void StdAddressBook::handleCrash() | 55 | void StdAddressBook::handleCrash() |
56 | { | 56 | { |
57 | StdAddressBook::self()->cleanUp(); | 57 | StdAddressBook::self()->cleanUp(); |
58 | } | 58 | } |
59 | StdAddressBook *StdAddressBook::selfNoLoad() | ||
60 | { | ||
61 | |||
62 | if ( !mSelf ) | ||
63 | { | ||
64 | QString appdir = StdAddressBook::setTempAppDir(); | ||
65 | // US im am not sure why I have to use the other format here?? | ||
66 | #ifdef KAB_EMBEDDED | ||
67 | mSelf = addressBookDeleter.setObject( new StdAddressBook ( QString() ) ); | ||
68 | #else //KAB_EMBEDDED | ||
69 | addressBookDeleter.setObject( mSelf, new StdAddressBook( QString() ) ); | ||
70 | #endif //KAB_EMBEDDED | ||
71 | KStandardDirs::setAppDir( appdir ); | ||
72 | } | ||
73 | |||
74 | return mSelf; | ||
75 | } | ||
59 | 76 | ||
60 | StdAddressBook *StdAddressBook::self() | 77 | StdAddressBook *StdAddressBook::self() |
61 | { | 78 | { |
62 | 79 | ||
63 | if ( !mSelf ) | 80 | if ( !mSelf ) |
64 | { | 81 | { |
65 | QString appdir = StdAddressBook::setTempAppDir(); | 82 | QString appdir = StdAddressBook::setTempAppDir(); |
66 | // US im am not sure why I have to use the other format here?? | 83 | // US im am not sure why I have to use the other format here?? |
67 | #ifdef KAB_EMBEDDED | 84 | #ifdef KAB_EMBEDDED |
68 | mSelf = addressBookDeleter.setObject( new StdAddressBook ); | 85 | mSelf = addressBookDeleter.setObject( new StdAddressBook ); |
69 | #else //KAB_EMBEDDED | 86 | #else //KAB_EMBEDDED |
70 | addressBookDeleter.setObject( mSelf, new StdAddressBook ); | 87 | addressBookDeleter.setObject( mSelf, new StdAddressBook ); |
@@ -99,38 +116,42 @@ StdAddressBook *StdAddressBook::self( bool onlyFastResources ) | |||
99 | if ( !mSelf ) | 116 | if ( !mSelf ) |
100 | { | 117 | { |
101 | QString appdir =StdAddressBook::setTempAppDir(); | 118 | QString appdir =StdAddressBook::setTempAppDir(); |
102 | #ifdef KAB_EMBEDDED | 119 | #ifdef KAB_EMBEDDED |
103 | mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); | 120 | mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); |
104 | #else //KAB_EMBEDDED | 121 | #else //KAB_EMBEDDED |
105 | addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) ); | 122 | addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) ); |
106 | #endif //KAB_EMBEDDED | 123 | #endif //KAB_EMBEDDED |
107 | KStandardDirs::setAppDir( appdir ); | 124 | KStandardDirs::setAppDir( appdir ); |
108 | } | 125 | } |
109 | return mSelf; | 126 | return mSelf; |
110 | } | 127 | } |
128 | StdAddressBook::StdAddressBook( QString ) | ||
129 | : AddressBook( "kabcrc" ) | ||
130 | { | ||
131 | |||
132 | } | ||
111 | 133 | ||
112 | StdAddressBook::StdAddressBook() | 134 | StdAddressBook::StdAddressBook() |
113 | : AddressBook( "kabcrc" ) | 135 | : AddressBook( "kabcrc" ) |
114 | { | 136 | { |
115 | 137 | ||
116 | //init( false ); | 138 | init( false ); |
117 | } | 139 | } |
118 | 140 | ||
119 | StdAddressBook::StdAddressBook( bool onlyFastResources ) | 141 | StdAddressBook::StdAddressBook( bool onlyFastResources ) |
120 | : AddressBook( "kabcrc" ) | 142 | : AddressBook( "kabcrc" ) |
121 | { | 143 | { |
122 | 144 | ||
123 | if ( onlyFastResources ) | 145 | init( onlyFastResources ); |
124 | init( onlyFastResources ); | ||
125 | } | 146 | } |
126 | 147 | ||
127 | StdAddressBook::~StdAddressBook() | 148 | StdAddressBook::~StdAddressBook() |
128 | { | 149 | { |
129 | if ( mAutomaticSave ) | 150 | if ( mAutomaticSave ) |
130 | save(); | 151 | save(); |
131 | } | 152 | } |
132 | 153 | ||
133 | void StdAddressBook::init( bool ) | 154 | void StdAddressBook::init( bool ) |
134 | { | 155 | { |
135 | KRES::Manager<Resource> *manager = resourceManager(); | 156 | KRES::Manager<Resource> *manager = resourceManager(); |
136 | KRES::Manager<Resource>::ActiveIterator it; | 157 | KRES::Manager<Resource>::ActiveIterator it; |
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 | |||
61 | public: | 61 | public: |
62 | 62 | ||
63 | /** | 63 | /** |
64 | Destructor. | 64 | Destructor. |
65 | */ | 65 | */ |
66 | ~StdAddressBook(); | 66 | ~StdAddressBook(); |
67 | 67 | ||
68 | /** | 68 | /** |
69 | Return the standard addressbook object. It also loads slow resources. | 69 | Return the standard addressbook object. It also loads slow resources. |
70 | It is the same as self(false); . | 70 | It is the same as self(false); . |
71 | */ | 71 | */ |
72 | static StdAddressBook *self(); | 72 | static StdAddressBook *self(); |
73 | static StdAddressBook *selfNoLoad(); | ||
73 | 74 | ||
74 | /** | 75 | /** |
75 | This is the same as above, but with specified | 76 | This is the same as above, but with specified |
76 | behaviour of resource loading. | 77 | behaviour of resource loading. |
77 | 78 | ||
78 | @param onlyFastResource Only resources marked as 'fast' should be loaded | 79 | @param onlyFastResource Only resources marked as 'fast' should be loaded |
79 | */ | 80 | */ |
80 | // FIXME for KDE4 return StdAddressBook and merge with the metod above -zecke | 81 | // FIXME for KDE4 return StdAddressBook and merge with the metod above -zecke |
81 | static StdAddressBook *self( bool onlyFastResources ); | 82 | static StdAddressBook *self( bool onlyFastResources ); |
82 | 83 | ||
83 | /** | 84 | /** |
84 | Save the standard address book to disk. | 85 | Save the standard address book to disk. |
@@ -129,23 +130,24 @@ class StdAddressBook : public AddressBook | |||
129 | Addressee whoAmI(); | 130 | Addressee whoAmI(); |
130 | 131 | ||
131 | /** | 132 | /** |
132 | Sets the users contact. See @ref whoAmI() for more information. | 133 | Sets the users contact. See @ref whoAmI() for more information. |
133 | 134 | ||
134 | @param uid The uid of the users contact. | 135 | @param uid The uid of the users contact. |
135 | */ | 136 | */ |
136 | void setWhoAmI( const Addressee &addr ); | 137 | void setWhoAmI( const Addressee &addr ); |
137 | void init( bool onlyFastResources ); | 138 | void init( bool onlyFastResources ); |
138 | 139 | ||
139 | protected: | 140 | protected: |
140 | StdAddressBook(); | 141 | StdAddressBook(); |
142 | StdAddressBook( QString ); | ||
141 | StdAddressBook( bool onlyFastResources ); | 143 | StdAddressBook( bool onlyFastResources ); |
142 | 144 | ||
143 | 145 | ||
144 | private: | 146 | private: |
145 | static QString setTempAppDir(); | 147 | static QString setTempAppDir(); |
146 | static StdAddressBook *mSelf; | 148 | static StdAddressBook *mSelf; |
147 | static bool mAutomaticSave; | 149 | static bool mAutomaticSave; |
148 | }; | 150 | }; |
149 | 151 | ||
150 | } | 152 | } |
151 | #endif | 153 | #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 | |||
294 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 294 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
295 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 295 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
296 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 296 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
297 | mReadWrite( readWrite ), mModified( false ) | 297 | mReadWrite( readWrite ), mModified( false ) |
298 | #endif //KAB_EMBEDDED | 298 | #endif //KAB_EMBEDDED |
299 | { | 299 | { |
300 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 300 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
301 | // syncManager->setBlockSave(false); | 301 | // syncManager->setBlockSave(false); |
302 | mIncSearchWidget = 0; | 302 | mIncSearchWidget = 0; |
303 | mMiniSplitter = 0; | 303 | mMiniSplitter = 0; |
304 | mExtensionBarSplitter = 0; | 304 | mExtensionBarSplitter = 0; |
305 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 305 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
306 | mAddressBook = KABC::StdAddressBook::self(); | 306 | mAddressBook = KABC::StdAddressBook::selfNoLoad(); |
307 | KABC::StdAddressBook::setAutomaticSave( false ); | 307 | KABC::StdAddressBook::setAutomaticSave( false ); |
308 | 308 | ||
309 | #ifndef KAB_EMBEDDED | 309 | #ifndef KAB_EMBEDDED |
310 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 310 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
311 | #endif //KAB_EMBEDDED | 311 | #endif //KAB_EMBEDDED |
312 | 312 | ||
313 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 313 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
314 | SLOT( addressBookChanged() ) ); | 314 | SLOT( addressBookChanged() ) ); |
315 | 315 | ||
316 | #if 0 | 316 | #if 0 |
317 | // LR moved to addressbook init method | 317 | // LR moved to addressbook init method |
318 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 318 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |