-rw-r--r-- | kabc/addressbook.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 1a06956..1050f55 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -1,170 +1,171 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | /*US | 28 | /*US |
29 | 29 | ||
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | 33 | ||
34 | #include <kapplication.h> | 34 | #include <kapplication.h> |
35 | #include <kinstance.h> | 35 | #include <kinstance.h> |
36 | #include <kstandarddirs.h> | 36 | #include <kstandarddirs.h> |
37 | 37 | ||
38 | #include "errorhandler.h" | 38 | #include "errorhandler.h" |
39 | */ | 39 | */ |
40 | #include <qptrlist.h> | 40 | #include <qptrlist.h> |
41 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
42 | #include <qfile.h> | 42 | #include <qfile.h> |
43 | #include <qregexp.h> | ||
43 | 44 | ||
44 | #include <kglobal.h> | 45 | #include <kglobal.h> |
45 | #include <klocale.h> | 46 | #include <klocale.h> |
46 | #include <kmessagebox.h> | 47 | #include <kmessagebox.h> |
47 | #include <kdebug.h> | 48 | #include <kdebug.h> |
48 | #include <libkcal/syncdefines.h> | 49 | #include <libkcal/syncdefines.h> |
49 | #include "addressbook.h" | 50 | #include "addressbook.h" |
50 | #include "resource.h" | 51 | #include "resource.h" |
51 | #include "vcardconverter.h" | 52 | #include "vcardconverter.h" |
52 | #include "vcardparser/vcardtool.h" | 53 | #include "vcardparser/vcardtool.h" |
53 | 54 | ||
54 | //US #include "addressbook.moc" | 55 | //US #include "addressbook.moc" |
55 | 56 | ||
56 | using namespace KABC; | 57 | using namespace KABC; |
57 | 58 | ||
58 | struct AddressBook::AddressBookData | 59 | struct AddressBook::AddressBookData |
59 | { | 60 | { |
60 | Addressee::List mAddressees; | 61 | Addressee::List mAddressees; |
61 | Addressee::List mRemovedAddressees; | 62 | Addressee::List mRemovedAddressees; |
62 | Field::List mAllFields; | 63 | Field::List mAllFields; |
63 | KConfig *mConfig; | 64 | KConfig *mConfig; |
64 | KRES::Manager<Resource> *mManager; | 65 | KRES::Manager<Resource> *mManager; |
65 | //US ErrorHandler *mErrorHandler; | 66 | //US ErrorHandler *mErrorHandler; |
66 | }; | 67 | }; |
67 | 68 | ||
68 | struct AddressBook::Iterator::IteratorData | 69 | struct AddressBook::Iterator::IteratorData |
69 | { | 70 | { |
70 | Addressee::List::Iterator mIt; | 71 | Addressee::List::Iterator mIt; |
71 | }; | 72 | }; |
72 | 73 | ||
73 | struct AddressBook::ConstIterator::ConstIteratorData | 74 | struct AddressBook::ConstIterator::ConstIteratorData |
74 | { | 75 | { |
75 | Addressee::List::ConstIterator mIt; | 76 | Addressee::List::ConstIterator mIt; |
76 | }; | 77 | }; |
77 | 78 | ||
78 | AddressBook::Iterator::Iterator() | 79 | AddressBook::Iterator::Iterator() |
79 | { | 80 | { |
80 | d = new IteratorData; | 81 | d = new IteratorData; |
81 | } | 82 | } |
82 | 83 | ||
83 | AddressBook::Iterator::Iterator( const AddressBook::Iterator &i ) | 84 | AddressBook::Iterator::Iterator( const AddressBook::Iterator &i ) |
84 | { | 85 | { |
85 | d = new IteratorData; | 86 | d = new IteratorData; |
86 | d->mIt = i.d->mIt; | 87 | d->mIt = i.d->mIt; |
87 | } | 88 | } |
88 | 89 | ||
89 | AddressBook::Iterator &AddressBook::Iterator::operator=( const AddressBook::Iterator &i ) | 90 | AddressBook::Iterator &AddressBook::Iterator::operator=( const AddressBook::Iterator &i ) |
90 | { | 91 | { |
91 | if( this == &i ) return *this; // guard against self assignment | 92 | if( this == &i ) return *this; // guard against self assignment |
92 | delete d; // delete the old data the Iterator was completely constructed before | 93 | delete d; // delete the old data the Iterator was completely constructed before |
93 | d = new IteratorData; | 94 | d = new IteratorData; |
94 | d->mIt = i.d->mIt; | 95 | d->mIt = i.d->mIt; |
95 | return *this; | 96 | return *this; |
96 | } | 97 | } |
97 | 98 | ||
98 | AddressBook::Iterator::~Iterator() | 99 | AddressBook::Iterator::~Iterator() |
99 | { | 100 | { |
100 | delete d; | 101 | delete d; |
101 | } | 102 | } |
102 | 103 | ||
103 | const Addressee &AddressBook::Iterator::operator*() const | 104 | const Addressee &AddressBook::Iterator::operator*() const |
104 | { | 105 | { |
105 | return *(d->mIt); | 106 | return *(d->mIt); |
106 | } | 107 | } |
107 | 108 | ||
108 | Addressee &AddressBook::Iterator::operator*() | 109 | Addressee &AddressBook::Iterator::operator*() |
109 | { | 110 | { |
110 | return *(d->mIt); | 111 | return *(d->mIt); |
111 | } | 112 | } |
112 | 113 | ||
113 | Addressee *AddressBook::Iterator::operator->() | 114 | Addressee *AddressBook::Iterator::operator->() |
114 | { | 115 | { |
115 | return &(*(d->mIt)); | 116 | return &(*(d->mIt)); |
116 | } | 117 | } |
117 | 118 | ||
118 | AddressBook::Iterator &AddressBook::Iterator::operator++() | 119 | AddressBook::Iterator &AddressBook::Iterator::operator++() |
119 | { | 120 | { |
120 | (d->mIt)++; | 121 | (d->mIt)++; |
121 | return *this; | 122 | return *this; |
122 | } | 123 | } |
123 | 124 | ||
124 | AddressBook::Iterator &AddressBook::Iterator::operator++(int) | 125 | AddressBook::Iterator &AddressBook::Iterator::operator++(int) |
125 | { | 126 | { |
126 | (d->mIt)++; | 127 | (d->mIt)++; |
127 | return *this; | 128 | return *this; |
128 | } | 129 | } |
129 | 130 | ||
130 | AddressBook::Iterator &AddressBook::Iterator::operator--() | 131 | AddressBook::Iterator &AddressBook::Iterator::operator--() |
131 | { | 132 | { |
132 | (d->mIt)--; | 133 | (d->mIt)--; |
133 | return *this; | 134 | return *this; |
134 | } | 135 | } |
135 | 136 | ||
136 | AddressBook::Iterator &AddressBook::Iterator::operator--(int) | 137 | AddressBook::Iterator &AddressBook::Iterator::operator--(int) |
137 | { | 138 | { |
138 | (d->mIt)--; | 139 | (d->mIt)--; |
139 | return *this; | 140 | return *this; |
140 | } | 141 | } |
141 | 142 | ||
142 | bool AddressBook::Iterator::operator==( const Iterator &it ) | 143 | bool AddressBook::Iterator::operator==( const Iterator &it ) |
143 | { | 144 | { |
144 | return ( d->mIt == it.d->mIt ); | 145 | return ( d->mIt == it.d->mIt ); |
145 | } | 146 | } |
146 | 147 | ||
147 | bool AddressBook::Iterator::operator!=( const Iterator &it ) | 148 | bool AddressBook::Iterator::operator!=( const Iterator &it ) |
148 | { | 149 | { |
149 | return ( d->mIt != it.d->mIt ); | 150 | return ( d->mIt != it.d->mIt ); |
150 | } | 151 | } |
151 | 152 | ||
152 | 153 | ||
153 | AddressBook::ConstIterator::ConstIterator() | 154 | AddressBook::ConstIterator::ConstIterator() |
154 | { | 155 | { |
155 | d = new ConstIteratorData; | 156 | d = new ConstIteratorData; |
156 | } | 157 | } |
157 | 158 | ||
158 | AddressBook::ConstIterator::ConstIterator( const AddressBook::ConstIterator &i ) | 159 | AddressBook::ConstIterator::ConstIterator( const AddressBook::ConstIterator &i ) |
159 | { | 160 | { |
160 | d = new ConstIteratorData; | 161 | d = new ConstIteratorData; |
161 | d->mIt = i.d->mIt; | 162 | d->mIt = i.d->mIt; |
162 | } | 163 | } |
163 | 164 | ||
164 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator=( const AddressBook::ConstIterator &i ) | 165 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator=( const AddressBook::ConstIterator &i ) |
165 | { | 166 | { |
166 | if( this == &i ) return *this; // guard for self assignment | 167 | if( this == &i ) return *this; // guard for self assignment |
167 | delete d; // delete the old data because the Iterator was really constructed before | 168 | delete d; // delete the old data because the Iterator was really constructed before |
168 | d = new ConstIteratorData; | 169 | d = new ConstIteratorData; |
169 | d->mIt = i.d->mIt; | 170 | d->mIt = i.d->mIt; |
170 | return *this; | 171 | return *this; |