author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc/distributionlist.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kabc/distributionlist.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kabc/distributionlist.cpp b/kabc/distributionlist.cpp index d34ba0b..cf5afa6 100644 --- a/kabc/distributionlist.cpp +++ b/kabc/distributionlist.cpp | |||
@@ -10,84 +10,86 @@ | |||
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 | #include <ksimpleconfig.h> | 21 | #include <ksimpleconfig.h> |
22 | #include <kstandarddirs.h> | 22 | #include <kstandarddirs.h> |
23 | #include <kdebug.h> | 23 | #include <kdebug.h> |
24 | 24 | ||
25 | #include "distributionlist.h" | 25 | #include "distributionlist.h" |
26 | //Added by qt3to4: | ||
27 | #include <Q3ValueList> | ||
26 | 28 | ||
27 | using namespace KABC; | 29 | using namespace KABC; |
28 | 30 | ||
29 | DistributionList::DistributionList( DistributionListManager *manager, | 31 | DistributionList::DistributionList( DistributionListManager *manager, |
30 | const QString &name ) : | 32 | const QString &name ) : |
31 | mManager( manager ), mName( name ) | 33 | mManager( manager ), mName( name ) |
32 | { | 34 | { |
33 | mManager->insert( this ); | 35 | mManager->insert( this ); |
34 | } | 36 | } |
35 | 37 | ||
36 | DistributionList::~DistributionList() | 38 | DistributionList::~DistributionList() |
37 | { | 39 | { |
38 | mManager->remove( this ); | 40 | mManager->remove( this ); |
39 | } | 41 | } |
40 | 42 | ||
41 | void DistributionList::setName( const QString &name ) | 43 | void DistributionList::setName( const QString &name ) |
42 | { | 44 | { |
43 | mName = name; | 45 | mName = name; |
44 | } | 46 | } |
45 | 47 | ||
46 | QString DistributionList::name() const | 48 | QString DistributionList::name() const |
47 | { | 49 | { |
48 | return mName; | 50 | return mName; |
49 | } | 51 | } |
50 | 52 | ||
51 | void DistributionList::insertEntry( const Addressee &a, const QString &email ) | 53 | void DistributionList::insertEntry( const Addressee &a, const QString &email ) |
52 | { | 54 | { |
53 | QString em = email; | 55 | QString em = email; |
54 | if (em.isNull() ) | 56 | if (em.isNull() ) |
55 | em = a.preferredEmail(); | 57 | em = a.preferredEmail(); |
56 | Entry e( a, em ); | 58 | Entry e( a, em ); |
57 | QValueList<Entry>::Iterator it; | 59 | Q3ValueList<Entry>::Iterator it; |
58 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { | 60 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { |
59 | if ( (*it).addressee.uid() == a.uid() ) { | 61 | if ( (*it).addressee.uid() == a.uid() ) { |
60 | /** | 62 | /** |
61 | We have to check if both email addresses contains no data, | 63 | We have to check if both email addresses contains no data, |
62 | a simple 'email1 == email2' wont work here | 64 | a simple 'email1 == email2' wont work here |
63 | */ | 65 | */ |
64 | if ( ( (*it).email.isNull() && em.isEmpty() ) || | 66 | if ( ( (*it).email.isNull() && em.isEmpty() ) || |
65 | ( (*it).email.isEmpty() && em.isNull() ) || | 67 | ( (*it).email.isEmpty() && em.isNull() ) || |
66 | ( (*it).email == em ) ) { | 68 | ( (*it).email == em ) ) { |
67 | //*it = e; | 69 | //*it = e; |
68 | return; | 70 | return; |
69 | } | 71 | } |
70 | } | 72 | } |
71 | } | 73 | } |
72 | mEntries.append( e ); | 74 | mEntries.append( e ); |
73 | } | 75 | } |
74 | 76 | ||
75 | void DistributionList::removeEntry( const Addressee &a, const QString &email ) | 77 | void DistributionList::removeEntry( const Addressee &a, const QString &email ) |
76 | { | 78 | { |
77 | QValueList<Entry>::Iterator it; | 79 | Q3ValueList<Entry>::Iterator it; |
78 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { | 80 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { |
79 | if ( (*it).addressee.uid() == a.uid() && (*it).email == email ) { | 81 | if ( (*it).addressee.uid() == a.uid() && (*it).email == email ) { |
80 | mEntries.remove( it ); | 82 | mEntries.remove( it ); |
81 | return; | 83 | return; |
82 | } | 84 | } |
83 | } | 85 | } |
84 | } | 86 | } |
85 | 87 | ||
86 | QStringList DistributionList::emails() const | 88 | QStringList DistributionList::emails() const |
87 | { | 89 | { |
88 | QStringList emails; | 90 | QStringList emails; |
89 | 91 | ||
90 | Entry::List::ConstIterator it; | 92 | Entry::List::ConstIterator it; |
91 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { | 93 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { |
92 | Addressee a = (*it).addressee; | 94 | Addressee a = (*it).addressee; |
93 | QString email = (*it).email.isEmpty() ? a.fullEmail() : | 95 | QString email = (*it).email.isEmpty() ? a.fullEmail() : |