-rw-r--r-- | kabc/distributionlist.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/kabc/distributionlist.cpp b/kabc/distributionlist.cpp index aa2725d..45b9dda 100644 --- a/kabc/distributionlist.cpp +++ b/kabc/distributionlist.cpp | |||
@@ -154,52 +154,49 @@ QStringList DistributionListManager::listNames() | |||
154 | DistributionList *list; | 154 | DistributionList *list; |
155 | for( list = mLists.first(); list; list = mLists.next() ) { | 155 | for( list = mLists.first(); list; list = mLists.next() ) { |
156 | names.append( list->name() ); | 156 | names.append( list->name() ); |
157 | } | 157 | } |
158 | 158 | ||
159 | return names; | 159 | return names; |
160 | } | 160 | } |
161 | 161 | ||
162 | bool DistributionListManager::load() | 162 | bool DistributionListManager::load() |
163 | { | 163 | { |
164 | KSimpleConfig cfg( locateLocal( "data", "kabc/distlists" ) ); | 164 | KSimpleConfig cfg( locateLocal( "data", "kabc/distlists" ) ); |
165 | 165 | ||
166 | #ifndef KAB_EMBEDDED | 166 | /*US |
167 | |||
168 | QMap<QString,QString> entryMap = cfg.entryMap( mAddressBook->identifier() ); | 167 | QMap<QString,QString> entryMap = cfg.entryMap( mAddressBook->identifier() ); |
169 | if ( entryMap.isEmpty() ) { | 168 | if ( entryMap.isEmpty() ) { |
170 | kdDebug(5700) << "No distlists for '" << mAddressBook->identifier() << "'" << endl; | 169 | kdDebug(5700) << "No distlists for '" << mAddressBook->identifier() << "'" << endl; |
171 | return false; | 170 | return false; |
172 | } | 171 | } |
173 | 172 | ||
174 | cfg.setGroup( mAddressBook->identifier() ); | 173 | cfg.setGroup( mAddressBook->identifier() ); |
175 | 174 | ||
176 | QMap<QString,QString>::ConstIterator it; | 175 | QMap<QString,QString>::ConstIterator it; |
177 | for( it = entryMap.begin(); it != entryMap.end(); ++it ) { | 176 | for( it = entryMap.begin(); it != entryMap.end(); ++it ) { |
178 | QString name = it.key(); | 177 | QString name = it.key(); |
179 | 178 | */ | |
180 | #else //KAB_EMBEDDED | ||
181 | cfg.setGroup( mAddressBook->identifier() ); | 179 | cfg.setGroup( mAddressBook->identifier() ); |
182 | //US we work in microkde with a list of distributionlists | 180 | //US we work in microkde with a list of distributionlists |
183 | QStringList distlists = cfg.readListEntry( "Lists" ); | 181 | QStringList distlists = cfg.readListEntry( "Lists" ); |
184 | if ( distlists.isEmpty() ) { | 182 | if ( distlists.isEmpty() ) { |
185 | kdDebug(5700) << "No distlists for '" << mAddressBook->identifier() << "'" << endl; | 183 | kdDebug(5700) << "No distlists for '" << mAddressBook->identifier() << "'" << endl; |
186 | return false; | 184 | return false; |
187 | } | 185 | } |
188 | 186 | ||
189 | QStringList::ConstIterator it; | 187 | QStringList::ConstIterator it; |
190 | for( it = distlists.begin(); it != distlists.end(); ++it ) { | 188 | for( it = distlists.begin(); it != distlists.end(); ++it ) { |
191 | QString name = *it; | 189 | QString name = *it; |
192 | 190 | ||
193 | #endif //KAB_EMBEDDED | ||
194 | 191 | ||
195 | QStringList value = cfg.readListEntry( name ); | 192 | QStringList value = cfg.readListEntry( name ); |
196 | 193 | ||
197 | kdDebug(5700) << "DLM::load(): " << name << ": " << value.join(",") << endl; | 194 | kdDebug(5700) << "DLM::load(): " << name << ": " << value.join(",") << endl; |
198 | 195 | ||
199 | DistributionList *list = new DistributionList( this, name ); | 196 | DistributionList *list = new DistributionList( this, name ); |
200 | 197 | ||
201 | QStringList::ConstIterator it2 = value.begin(); | 198 | QStringList::ConstIterator it2 = value.begin(); |
202 | while( it2 != value.end() ) { | 199 | while( it2 != value.end() ) { |
203 | QString id = *it2++; | 200 | QString id = *it2++; |
204 | QString email = *it2; | 201 | QString email = *it2; |
205 | 202 | ||
@@ -231,63 +228,62 @@ bool DistributionListManager::save() | |||
231 | for( list = mLists.first(); list; list = mLists.next() ) { | 228 | for( list = mLists.first(); list; list = mLists.next() ) { |
232 | kdDebug(5700) << " Saving '" << list->name() << "'" << endl; | 229 | kdDebug(5700) << " Saving '" << list->name() << "'" << endl; |
233 | QStringList value; | 230 | QStringList value; |
234 | DistributionList::Entry::List entries = list->entries(); | 231 | DistributionList::Entry::List entries = list->entries(); |
235 | DistributionList::Entry::List::ConstIterator it; | 232 | DistributionList::Entry::List::ConstIterator it; |
236 | for( it = entries.begin(); it != entries.end(); ++it ) { | 233 | for( it = entries.begin(); it != entries.end(); ++it ) { |
237 | value.append( (*it).addressee.uid() ); | 234 | value.append( (*it).addressee.uid() ); |
238 | value.append( (*it).email ); | 235 | value.append( (*it).email ); |
239 | } | 236 | } |
240 | cfg.writeEntry( list->name(), value ); | 237 | cfg.writeEntry( list->name(), value ); |
241 | } | 238 | } |
242 | 239 | ||
243 | #ifdef KAB_EMBEDDED | ||
244 | //US for microKDE we have not yet sophisticated methods to load maps. | 240 | //US for microKDE we have not yet sophisticated methods to load maps. |
245 | // Because of that we store also a list of all distributionlists. | 241 | // Because of that we store also a list of all distributionlists. |
246 | QStringList namelist; | 242 | QStringList namelist; |
247 | for( list = mLists.first(); list; list = mLists.next() ) { | 243 | for( list = mLists.first(); list; list = mLists.next() ) { |
248 | namelist.append( list->name() ); | 244 | namelist.append( list->name() ); |
249 | } | 245 | } |
250 | cfg.writeEntry( "Lists", namelist ); | 246 | cfg.writeEntry( "Lists", namelist ); |
251 | 247 | ||
252 | #endif //KAB_EMBEDDED | 248 | |
253 | 249 | ||
250 | |||
251 | |||
252 | |||
254 | cfg.sync(); | 253 | cfg.sync(); |
255 | 254 | ||
256 | return true; | 255 | return true; |
257 | } | 256 | } |
258 | 257 | ||
259 | DistributionListWatcher* DistributionListWatcher::mSelf = 0; | 258 | DistributionListWatcher* DistributionListWatcher::mSelf = 0; |
260 | 259 | ||
261 | DistributionListWatcher::DistributionListWatcher() | 260 | DistributionListWatcher::DistributionListWatcher() |
262 | : QObject( 0, "DistributionListWatcher" ) | 261 | : QObject( 0, "DistributionListWatcher" ) |
263 | { | 262 | { |
264 | #ifndef KAB_EMBEDDED | 263 | /*US |
265 | mDirWatch = new KDirWatch; | 264 | mDirWatch = new KDirWatch; |
266 | mDirWatch->addFile( locateLocal( "data", "kabc/distlists" ) ); | 265 | mDirWatch->addFile( locateLocal( "data", "kabc/distlists" ) ); |
267 | 266 | ||
268 | connect( mDirWatch, SIGNAL( dirty( const QString& ) ), SIGNAL( changed() ) ); | 267 | connect( mDirWatch, SIGNAL( dirty( const QString& ) ), SIGNAL( changed() ) ); |
269 | mDirWatch->startScan(); | 268 | mDirWatch->startScan(); |
270 | #endif //KAB_EMBEDDED | 269 | */ |
271 | } | 270 | } |
272 | 271 | ||
273 | DistributionListWatcher::~DistributionListWatcher() | 272 | DistributionListWatcher::~DistributionListWatcher() |
274 | { | 273 | { |
275 | #ifndef KAB_EMBEDDED | 274 | /*US |
276 | delete mDirWatch; | 275 | delete mDirWatch; |
277 | mDirWatch = 0; | 276 | mDirWatch = 0; |
278 | #endif //KAB_EMBEDDED | 277 | */ |
279 | } | 278 | } |
280 | 279 | ||
281 | DistributionListWatcher *DistributionListWatcher::self() | 280 | DistributionListWatcher *DistributionListWatcher::self() |
282 | { | 281 | { |
283 | if ( !mSelf ) | 282 | if ( !mSelf ) |
284 | mSelf = new DistributionListWatcher(); | 283 | mSelf = new DistributionListWatcher(); |
285 | 284 | ||
286 | return mSelf; | 285 | return mSelf; |
287 | } | 286 | } |
288 | 287 | ||
289 | 288 | //US #include "distributionlist.moc" | |
290 | #ifndef KAB_EMBEDDED | ||
291 | #include "distributionlist.moc" | ||
292 | #endif //KAB_EMBEDDED | ||
293 | 289 | ||