-rw-r--r-- | kabc/addressbook.cpp | 2 | ||||
-rw-r--r-- | kabc/stdaddressbook.cpp | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index c61b387..47d298a 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -398,65 +398,65 @@ AddressBook::Iterator AddressBook::find( const Addressee &a ) | |||
398 | { | 398 | { |
399 | Iterator it; | 399 | Iterator it; |
400 | for ( it = begin(); it != end(); ++it ) { | 400 | for ( it = begin(); it != end(); ++it ) { |
401 | if ( a.uid() == (*it).uid() ) { | 401 | if ( a.uid() == (*it).uid() ) { |
402 | return it; | 402 | return it; |
403 | } | 403 | } |
404 | } | 404 | } |
405 | return end(); | 405 | return end(); |
406 | } | 406 | } |
407 | 407 | ||
408 | Addressee AddressBook::findByUid( const QString &uid ) | 408 | Addressee AddressBook::findByUid( const QString &uid ) |
409 | { | 409 | { |
410 | Iterator it; | 410 | Iterator it; |
411 | for ( it = begin(); it != end(); ++it ) { | 411 | for ( it = begin(); it != end(); ++it ) { |
412 | if ( uid == (*it).uid() ) { | 412 | if ( uid == (*it).uid() ) { |
413 | return *it; | 413 | return *it; |
414 | } | 414 | } |
415 | } | 415 | } |
416 | return Addressee(); | 416 | return Addressee(); |
417 | } | 417 | } |
418 | 418 | ||
419 | Addressee::List AddressBook::allAddressees() | 419 | Addressee::List AddressBook::allAddressees() |
420 | { | 420 | { |
421 | return d->mAddressees; | 421 | return d->mAddressees; |
422 | } | 422 | } |
423 | 423 | ||
424 | Addressee::List AddressBook::findByName( const QString &name ) | 424 | Addressee::List AddressBook::findByName( const QString &name ) |
425 | { | 425 | { |
426 | Addressee::List results; | 426 | Addressee::List results; |
427 | 427 | ||
428 | Iterator it; | 428 | Iterator it; |
429 | for ( it = begin(); it != end(); ++it ) { | 429 | for ( it = begin(); it != end(); ++it ) { |
430 | if ( name == (*it).name() ) { | 430 | if ( name == (*it).realName() ) { |
431 | results.append( *it ); | 431 | results.append( *it ); |
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | return results; | 435 | return results; |
436 | } | 436 | } |
437 | 437 | ||
438 | Addressee::List AddressBook::findByEmail( const QString &email ) | 438 | Addressee::List AddressBook::findByEmail( const QString &email ) |
439 | { | 439 | { |
440 | Addressee::List results; | 440 | Addressee::List results; |
441 | QStringList mailList; | 441 | QStringList mailList; |
442 | 442 | ||
443 | Iterator it; | 443 | Iterator it; |
444 | for ( it = begin(); it != end(); ++it ) { | 444 | for ( it = begin(); it != end(); ++it ) { |
445 | mailList = (*it).emails(); | 445 | mailList = (*it).emails(); |
446 | for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { | 446 | for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { |
447 | if ( email == (*ite) ) { | 447 | if ( email == (*ite) ) { |
448 | results.append( *it ); | 448 | results.append( *it ); |
449 | } | 449 | } |
450 | } | 450 | } |
451 | } | 451 | } |
452 | 452 | ||
453 | return results; | 453 | return results; |
454 | } | 454 | } |
455 | 455 | ||
456 | Addressee::List AddressBook::findByCategory( const QString &category ) | 456 | Addressee::List AddressBook::findByCategory( const QString &category ) |
457 | { | 457 | { |
458 | Addressee::List results; | 458 | Addressee::List results; |
459 | 459 | ||
460 | Iterator it; | 460 | Iterator it; |
461 | for ( it = begin(); it != end(); ++it ) { | 461 | for ( it = begin(); it != end(); ++it ) { |
462 | if ( (*it).hasCategory( category) ) { | 462 | if ( (*it).hasCategory( category) ) { |
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index 760820e..9f38f08 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp | |||
@@ -34,101 +34,111 @@ $Id$ | |||
34 | #include <kstandarddirs.h> | 34 | #include <kstandarddirs.h> |
35 | 35 | ||
36 | #include "stdaddressbook.h" | 36 | #include "stdaddressbook.h" |
37 | 37 | ||
38 | using namespace KABC; | 38 | using namespace KABC; |
39 | 39 | ||
40 | StdAddressBook *StdAddressBook::mSelf = 0; | 40 | StdAddressBook *StdAddressBook::mSelf = 0; |
41 | bool StdAddressBook::mAutomaticSave = true; | 41 | bool StdAddressBook::mAutomaticSave = true; |
42 | 42 | ||
43 | static KStaticDeleter<StdAddressBook> addressBookDeleter; | 43 | static KStaticDeleter<StdAddressBook> addressBookDeleter; |
44 | 44 | ||
45 | QString StdAddressBook::fileName() | 45 | QString StdAddressBook::fileName() |
46 | { | 46 | { |
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 | 59 | ||
60 | StdAddressBook *StdAddressBook::self() | 60 | StdAddressBook *StdAddressBook::self() |
61 | { | 61 | { |
62 | 62 | ||
63 | if ( !mSelf ) | 63 | if ( !mSelf ) |
64 | { | 64 | { |
65 | QString appdir = StdAddressBook::setTempAppDir(); | 65 | QString appdir = StdAddressBook::setTempAppDir(); |
66 | 66 | qDebug("****************************************************** "); | |
67 | kdDebug(5700) << "StdAddressBook::self()" << endl; | 67 | qDebug("****************************************************** "); |
68 | qDebug("****************************************************** "); | ||
69 | qDebug("****************************************************** "); | ||
70 | qDebug("****************************************************** "); | ||
68 | // US im am not sure why I have to use the other format here?? | 71 | // US im am not sure why I have to use the other format here?? |
69 | #ifdef KAB_EMBEDDED | 72 | #ifdef KAB_EMBEDDED |
70 | mSelf = addressBookDeleter.setObject( new StdAddressBook ); | 73 | mSelf = addressBookDeleter.setObject( new StdAddressBook ); |
71 | #else //KAB_EMBEDDED | 74 | #else //KAB_EMBEDDED |
72 | addressBookDeleter.setObject( mSelf, new StdAddressBook ); | 75 | addressBookDeleter.setObject( mSelf, new StdAddressBook ); |
73 | #endif //KAB_EMBEDDED | 76 | #endif //KAB_EMBEDDED |
74 | KStandardDirs::setAppDir( appdir ); | 77 | KStandardDirs::setAppDir( appdir ); |
75 | } | 78 | } |
76 | 79 | ||
77 | return mSelf; | 80 | return mSelf; |
78 | } | 81 | } |
79 | 82 | ||
80 | QString StdAddressBook::setTempAppDir() | 83 | QString StdAddressBook::setTempAppDir() |
81 | { | 84 | { |
82 | QString appDIR = KStandardDirs::appDir(); | 85 | QString appDIR = KStandardDirs::appDir(); |
83 | #ifdef DESKTOP_VERSION | 86 | #ifdef DESKTOP_VERSION |
84 | QString appdir = QDir::homeDirPath(); | 87 | QString appdir = QDir::homeDirPath(); |
85 | if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) | 88 | if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) |
86 | appdir += "kaddressbook/"; | 89 | appdir += "kaddressbook/"; |
87 | else | 90 | else |
88 | appdir += "/kaddressbook/"; | 91 | appdir += "/kaddressbook/"; |
89 | KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); | 92 | KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); |
90 | #else | 93 | #else |
91 | QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook"; | 94 | QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook"; |
92 | 95 | ||
93 | KStandardDirs::setAppDir( appdir ); | 96 | KStandardDirs::setAppDir( appdir ); |
94 | #endif | 97 | #endif |
95 | 98 | ||
96 | return appDIR; | 99 | return appDIR; |
97 | } | 100 | } |
98 | StdAddressBook *StdAddressBook::self( bool onlyFastResources ) | 101 | StdAddressBook *StdAddressBook::self( bool onlyFastResources ) |
99 | { | 102 | { |
100 | 103 | ||
101 | if ( !mSelf ) | 104 | if ( !mSelf ) |
102 | { | 105 | { |
106 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
107 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
108 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
109 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
110 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
111 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
112 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
103 | QString appdir =StdAddressBook::setTempAppDir(); | 113 | QString appdir =StdAddressBook::setTempAppDir(); |
104 | #ifdef KAB_EMBEDDED | 114 | #ifdef KAB_EMBEDDED |
105 | mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); | 115 | mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); |
106 | #else //KAB_EMBEDDED | 116 | #else //KAB_EMBEDDED |
107 | addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) ); | 117 | addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) ); |
108 | #endif //KAB_EMBEDDED | 118 | #endif //KAB_EMBEDDED |
109 | KStandardDirs::setAppDir( appdir ); | 119 | KStandardDirs::setAppDir( appdir ); |
110 | } | 120 | } |
111 | return mSelf; | 121 | return mSelf; |
112 | } | 122 | } |
113 | 123 | ||
114 | StdAddressBook::StdAddressBook() | 124 | StdAddressBook::StdAddressBook() |
115 | : AddressBook( "kabcrc" ) | 125 | : AddressBook( "kabcrc" ) |
116 | { | 126 | { |
117 | 127 | ||
118 | init( false ); | 128 | init( false ); |
119 | } | 129 | } |
120 | 130 | ||
121 | StdAddressBook::StdAddressBook( bool onlyFastResources ) | 131 | StdAddressBook::StdAddressBook( bool onlyFastResources ) |
122 | : AddressBook( "kabcrc" ) | 132 | : AddressBook( "kabcrc" ) |
123 | { | 133 | { |
124 | 134 | ||
125 | init( onlyFastResources ); | 135 | init( onlyFastResources ); |
126 | } | 136 | } |
127 | 137 | ||
128 | StdAddressBook::~StdAddressBook() | 138 | StdAddressBook::~StdAddressBook() |
129 | { | 139 | { |
130 | if ( mAutomaticSave ) | 140 | if ( mAutomaticSave ) |
131 | save(); | 141 | save(); |
132 | } | 142 | } |
133 | 143 | ||
134 | void StdAddressBook::init( bool ) | 144 | void StdAddressBook::init( bool ) |