author | zautrix <zautrix> | 2005-04-07 07:42:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-07 07:42:53 (UTC) |
commit | c82f9b40f6023dc7b39ac555cba8c4c313f15ca8 (patch) (unidiff) | |
tree | e9e4f0c0ed3243ec060a475983b271bd27b40d15 /kabc | |
parent | 76e220bf1236ae6afa9d91f18f0cd9ced730cff0 (diff) | |
download | kdepimpi-c82f9b40f6023dc7b39ac555cba8c4c313f15ca8.zip kdepimpi-c82f9b40f6023dc7b39ac555cba8c4c313f15ca8.tar.gz kdepimpi-c82f9b40f6023dc7b39ac555cba8c4c313f15ca8.tar.bz2 |
added fields to kapi
-rw-r--r-- | kabc/addressee.cpp | 25 | ||||
-rw-r--r-- | kabc/addressee.h | 5 | ||||
-rw-r--r-- | kabc/field.cpp | 20 | ||||
-rw-r--r-- | kabc/phonenumber.cpp | 13 |
4 files changed, 55 insertions, 8 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 39d14bb..7f592e9 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -1,181 +1,182 @@ | |||
1 | /*** Warning! This file has been generated by the script makeaddressee ***/ | 1 | /*** Warning! This file has been generated by the script makeaddressee ***/ |
2 | /* | 2 | /* |
3 | This file is part of libkabc. | 3 | This file is part of libkabc. |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | Enhanced Version of the file for platform independent KDE tools. | 23 | Enhanced Version of the file for platform independent KDE tools. |
24 | Copyright (c) 2004 Ulf Schenk | 24 | Copyright (c) 2004 Ulf Schenk |
25 | 25 | ||
26 | $Id$ | 26 | $Id$ |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <kconfig.h> | 29 | #include <kconfig.h> |
30 | 30 | ||
31 | #include <ksharedptr.h> | 31 | #include <ksharedptr.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <kapplication.h> | 33 | #include <kapplication.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kidmanager.h> | 35 | #include <kidmanager.h> |
36 | //US | 36 | //US |
37 | #include <kstandarddirs.h> | 37 | #include <kstandarddirs.h> |
38 | #include <libkcal/syncdefines.h> | 38 | #include <libkcal/syncdefines.h> |
39 | 39 | ||
40 | //US #include "resource.h" | 40 | //US #include "resource.h" |
41 | #include "addressee.h" | 41 | #include "addressee.h" |
42 | 42 | ||
43 | using namespace KABC; | 43 | using namespace KABC; |
44 | 44 | ||
45 | static bool matchBinaryPattern( int value, int pattern ); | 45 | static bool matchBinaryPattern( int value, int pattern ); |
46 | static bool matchBinaryPatternA( int value, int pattern ); | 46 | static bool matchBinaryPatternA( int value, int pattern ); |
47 | static bool matchBinaryPatternP( int value, int pattern ); | 47 | static bool matchBinaryPatternP( int value, int pattern ); |
48 | 48 | ||
49 | struct Addressee::AddresseeData : public KShared | 49 | struct Addressee::AddresseeData : public KShared |
50 | { | 50 | { |
51 | QString uid; | 51 | QString uid; |
52 | QString name; | 52 | QString name; |
53 | QString formattedName; | 53 | QString formattedName; |
54 | QString defaultFormattedName; | ||
54 | QString familyName; | 55 | QString familyName; |
55 | QString givenName; | 56 | QString givenName; |
56 | QString additionalName; | 57 | QString additionalName; |
57 | QString prefix; | 58 | QString prefix; |
58 | QString suffix; | 59 | QString suffix; |
59 | QString nickName; | 60 | QString nickName; |
60 | QDateTime birthday; | 61 | QDateTime birthday; |
61 | QString mailer; | 62 | QString mailer; |
62 | TimeZone timeZone; | 63 | TimeZone timeZone; |
63 | Geo geo; | 64 | Geo geo; |
64 | QString title; | 65 | QString title; |
65 | QString role; | 66 | QString role; |
66 | QString organization; | 67 | QString organization; |
67 | QString note; | 68 | QString note; |
68 | QString productId; | 69 | QString productId; |
69 | QDateTime revision; | 70 | QDateTime revision; |
70 | QString sortString; | 71 | QString sortString; |
71 | QString externalUID; | 72 | QString externalUID; |
72 | QString originalExternalUID; | 73 | QString originalExternalUID; |
73 | KURL url; | 74 | KURL url; |
74 | Secrecy secrecy; | 75 | Secrecy secrecy; |
75 | Picture logo; | 76 | Picture logo; |
76 | Picture photo; | 77 | Picture photo; |
77 | Sound sound; | 78 | Sound sound; |
78 | Agent agent; | 79 | Agent agent; |
79 | QString mExternalId; | 80 | QString mExternalId; |
80 | PhoneNumber::List phoneNumbers; | 81 | PhoneNumber::List phoneNumbers; |
81 | Address::List addresses; | 82 | Address::List addresses; |
82 | Key::List keys; | 83 | Key::List keys; |
83 | QStringList emails; | 84 | QStringList emails; |
84 | QStringList categories; | 85 | QStringList categories; |
85 | QStringList custom; | 86 | QStringList custom; |
86 | int mTempSyncStat; | 87 | int mTempSyncStat; |
87 | Resource *resource; | 88 | Resource *resource; |
88 | 89 | ||
89 | bool empty :1; | 90 | bool empty :1; |
90 | bool changed :1; | 91 | bool changed :1; |
91 | bool tagged :1; | 92 | bool tagged :1; |
92 | }; | 93 | }; |
93 | 94 | ||
94 | Addressee::Addressee() | 95 | Addressee::Addressee() |
95 | { | 96 | { |
96 | mData = new AddresseeData; | 97 | mData = new AddresseeData; |
97 | mData->empty = true; | 98 | mData->empty = true; |
98 | mData->changed = false; | 99 | mData->changed = false; |
99 | mData->resource = 0; | 100 | mData->resource = 0; |
100 | mData->mExternalId = ":"; | 101 | mData->mExternalId = ":"; |
101 | mData->revision = QDateTime ( QDate( 2003,1,1)); | 102 | mData->revision = QDateTime ( QDate( 2003,1,1)); |
102 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 103 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
103 | } | 104 | } |
104 | 105 | ||
105 | Addressee::~Addressee() | 106 | Addressee::~Addressee() |
106 | { | 107 | { |
107 | } | 108 | } |
108 | 109 | ||
109 | Addressee::Addressee( const Addressee &a ) | 110 | Addressee::Addressee( const Addressee &a ) |
110 | { | 111 | { |
111 | mData = a.mData; | 112 | mData = a.mData; |
112 | } | 113 | } |
113 | 114 | ||
114 | Addressee &Addressee::operator=( const Addressee &a ) | 115 | Addressee &Addressee::operator=( const Addressee &a ) |
115 | { | 116 | { |
116 | mData = a.mData; | 117 | mData = a.mData; |
117 | return (*this); | 118 | return (*this); |
118 | } | 119 | } |
119 | 120 | ||
120 | Addressee Addressee::copy() | 121 | Addressee Addressee::copy() |
121 | { | 122 | { |
122 | Addressee a; | 123 | Addressee a; |
123 | *(a.mData) = *mData; | 124 | *(a.mData) = *mData; |
124 | return a; | 125 | return a; |
125 | } | 126 | } |
126 | 127 | ||
127 | void Addressee::detach() | 128 | void Addressee::detach() |
128 | { | 129 | { |
129 | if ( mData.count() == 1 ) return; | 130 | if ( mData.count() == 1 ) return; |
130 | *this = copy(); | 131 | *this = copy(); |
131 | } | 132 | } |
132 | 133 | ||
133 | bool Addressee::operator==( const Addressee &a ) const | 134 | bool Addressee::operator==( const Addressee &a ) const |
134 | { | 135 | { |
135 | if ( uid() != a.uid() ) return false; | 136 | if ( uid() != a.uid() ) return false; |
136 | if ( mData->name != a.mData->name ) return false; | 137 | if ( mData->name != a.mData->name ) return false; |
137 | if ( mData->formattedName != a.mData->formattedName ) return false; | 138 | if ( mData->formattedName != a.mData->formattedName ) return false; |
138 | if ( mData->familyName != a.mData->familyName ) return false; | 139 | if ( mData->familyName != a.mData->familyName ) return false; |
139 | if ( mData->givenName != a.mData->givenName ) return false; | 140 | if ( mData->givenName != a.mData->givenName ) return false; |
140 | if ( mData->additionalName != a.mData->additionalName ) return false; | 141 | if ( mData->additionalName != a.mData->additionalName ) return false; |
141 | if ( mData->prefix != a.mData->prefix ) return false; | 142 | if ( mData->prefix != a.mData->prefix ) return false; |
142 | if ( mData->suffix != a.mData->suffix ) return false; | 143 | if ( mData->suffix != a.mData->suffix ) return false; |
143 | if ( mData->nickName != a.mData->nickName ) return false; | 144 | if ( mData->nickName != a.mData->nickName ) return false; |
144 | if ( mData->birthday != a.mData->birthday ) return false; | 145 | if ( mData->birthday != a.mData->birthday ) return false; |
145 | if ( mData->mailer != a.mData->mailer ) return false; | 146 | if ( mData->mailer != a.mData->mailer ) return false; |
146 | if ( mData->timeZone != a.mData->timeZone ) return false; | 147 | if ( mData->timeZone != a.mData->timeZone ) return false; |
147 | if ( mData->geo != a.mData->geo ) return false; | 148 | if ( mData->geo != a.mData->geo ) return false; |
148 | if ( mData->title != a.mData->title ) return false; | 149 | if ( mData->title != a.mData->title ) return false; |
149 | if ( mData->role != a.mData->role ) return false; | 150 | if ( mData->role != a.mData->role ) return false; |
150 | if ( mData->organization != a.mData->organization ) return false; | 151 | if ( mData->organization != a.mData->organization ) return false; |
151 | if ( mData->note != a.mData->note ) return false; | 152 | if ( mData->note != a.mData->note ) return false; |
152 | if ( mData->productId != a.mData->productId ) return false; | 153 | if ( mData->productId != a.mData->productId ) return false; |
153 | //if ( mData->revision != a.mData->revision ) return false; | 154 | //if ( mData->revision != a.mData->revision ) return false; |
154 | if ( mData->sortString != a.mData->sortString ) return false; | 155 | if ( mData->sortString != a.mData->sortString ) return false; |
155 | if ( mData->secrecy != a.mData->secrecy ) return false; | 156 | if ( mData->secrecy != a.mData->secrecy ) return false; |
156 | if ( mData->logo != a.mData->logo ) return false; | 157 | if ( mData->logo != a.mData->logo ) return false; |
157 | if ( mData->photo != a.mData->photo ) return false; | 158 | if ( mData->photo != a.mData->photo ) return false; |
158 | if ( mData->sound != a.mData->sound ) return false; | 159 | if ( mData->sound != a.mData->sound ) return false; |
159 | if ( mData->agent != a.mData->agent ) return false; | 160 | if ( mData->agent != a.mData->agent ) return false; |
160 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && | 161 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && |
161 | ( mData->url != a.mData->url ) ) return false; | 162 | ( mData->url != a.mData->url ) ) return false; |
162 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; | 163 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; |
163 | if ( mData->addresses != a.mData->addresses ) return false; | 164 | if ( mData->addresses != a.mData->addresses ) return false; |
164 | if ( mData->keys != a.mData->keys ) return false; | 165 | if ( mData->keys != a.mData->keys ) return false; |
165 | if ( mData->emails != a.mData->emails ) return false; | 166 | if ( mData->emails != a.mData->emails ) return false; |
166 | if ( mData->categories != a.mData->categories ) return false; | 167 | if ( mData->categories != a.mData->categories ) return false; |
167 | if ( mData->custom != a.mData->custom ) return false; | 168 | if ( mData->custom != a.mData->custom ) return false; |
168 | 169 | ||
169 | return true; | 170 | return true; |
170 | } | 171 | } |
171 | 172 | ||
172 | bool Addressee::operator!=( const Addressee &a ) const | 173 | bool Addressee::operator!=( const Addressee &a ) const |
173 | { | 174 | { |
174 | return !( a == *this ); | 175 | return !( a == *this ); |
175 | } | 176 | } |
176 | 177 | ||
177 | bool Addressee::isEmpty() const | 178 | bool Addressee::isEmpty() const |
178 | { | 179 | { |
179 | return mData->empty; | 180 | return mData->empty; |
180 | } | 181 | } |
181 | ulong Addressee::getCsum4List( const QStringList & attList) | 182 | ulong Addressee::getCsum4List( const QStringList & attList) |
@@ -622,489 +623,513 @@ void Addressee::removeID(const QString &prof) | |||
622 | { | 623 | { |
623 | detach(); | 624 | detach(); |
624 | if ( prof.isEmpty() ) | 625 | if ( prof.isEmpty() ) |
625 | mData->mExternalId = ":"; | 626 | mData->mExternalId = ":"; |
626 | else | 627 | else |
627 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 628 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
628 | 629 | ||
629 | } | 630 | } |
630 | void Addressee::setID( const QString & prof , const QString & id ) | 631 | void Addressee::setID( const QString & prof , const QString & id ) |
631 | { | 632 | { |
632 | detach(); | 633 | detach(); |
633 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 634 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
634 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 635 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
635 | } | 636 | } |
636 | void Addressee::setTempSyncStat( int id ) | 637 | void Addressee::setTempSyncStat( int id ) |
637 | { | 638 | { |
638 | if ( mData->mTempSyncStat == id ) return; | 639 | if ( mData->mTempSyncStat == id ) return; |
639 | detach(); | 640 | detach(); |
640 | mData->mTempSyncStat = id; | 641 | mData->mTempSyncStat = id; |
641 | } | 642 | } |
642 | int Addressee::tempSyncStat() const | 643 | int Addressee::tempSyncStat() const |
643 | { | 644 | { |
644 | return mData->mTempSyncStat; | 645 | return mData->mTempSyncStat; |
645 | } | 646 | } |
646 | 647 | ||
647 | const QString Addressee::getID( const QString & prof) const | 648 | const QString Addressee::getID( const QString & prof) const |
648 | { | 649 | { |
649 | return KIdManager::getId ( mData->mExternalId, prof ); | 650 | return KIdManager::getId ( mData->mExternalId, prof ); |
650 | } | 651 | } |
651 | 652 | ||
652 | void Addressee::setCsum( const QString & prof , const QString & id ) | 653 | void Addressee::setCsum( const QString & prof , const QString & id ) |
653 | { | 654 | { |
654 | detach(); | 655 | detach(); |
655 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 656 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
656 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 657 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
657 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 658 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
658 | } | 659 | } |
659 | 660 | ||
660 | const QString Addressee::getCsum( const QString & prof) const | 661 | const QString Addressee::getCsum( const QString & prof) const |
661 | { | 662 | { |
662 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 663 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
663 | } | 664 | } |
664 | 665 | ||
665 | void Addressee::setIDStr( const QString & s ) | 666 | void Addressee::setIDStr( const QString & s ) |
666 | { | 667 | { |
667 | detach(); | 668 | detach(); |
668 | mData->mExternalId = s; | 669 | mData->mExternalId = s; |
669 | } | 670 | } |
670 | 671 | ||
671 | const QString Addressee::IDStr() const | 672 | const QString Addressee::IDStr() const |
672 | { | 673 | { |
673 | return mData->mExternalId; | 674 | return mData->mExternalId; |
674 | } | 675 | } |
675 | 676 | ||
676 | void Addressee::setExternalUID( const QString &id ) | 677 | void Addressee::setExternalUID( const QString &id ) |
677 | { | 678 | { |
678 | if ( id == mData->externalUID ) return; | 679 | if ( id == mData->externalUID ) return; |
679 | detach(); | 680 | detach(); |
680 | mData->empty = false; | 681 | mData->empty = false; |
681 | mData->externalUID = id; | 682 | mData->externalUID = id; |
682 | } | 683 | } |
683 | 684 | ||
684 | const QString Addressee::externalUID() const | 685 | const QString Addressee::externalUID() const |
685 | { | 686 | { |
686 | return mData->externalUID; | 687 | return mData->externalUID; |
687 | } | 688 | } |
688 | void Addressee::setOriginalExternalUID( const QString &id ) | 689 | void Addressee::setOriginalExternalUID( const QString &id ) |
689 | { | 690 | { |
690 | if ( id == mData->originalExternalUID ) return; | 691 | if ( id == mData->originalExternalUID ) return; |
691 | detach(); | 692 | detach(); |
692 | mData->empty = false; | 693 | mData->empty = false; |
693 | //qDebug("*******Set orig uid %s ", id.latin1()); | 694 | //qDebug("*******Set orig uid %s ", id.latin1()); |
694 | mData->originalExternalUID = id; | 695 | mData->originalExternalUID = id; |
695 | } | 696 | } |
696 | 697 | ||
697 | QString Addressee::originalExternalUID() const | 698 | QString Addressee::originalExternalUID() const |
698 | { | 699 | { |
699 | return mData->originalExternalUID; | 700 | return mData->originalExternalUID; |
700 | } | 701 | } |
701 | 702 | ||
702 | void Addressee::setUid( const QString &id ) | 703 | void Addressee::setUid( const QString &id ) |
703 | { | 704 | { |
704 | if ( id == mData->uid ) return; | 705 | if ( id == mData->uid ) return; |
705 | detach(); | 706 | detach(); |
706 | //qDebug("****setuid %s ", id.latin1()); | 707 | //qDebug("****setuid %s ", id.latin1()); |
707 | mData->empty = false; | 708 | mData->empty = false; |
708 | mData->uid = id; | 709 | mData->uid = id; |
709 | } | 710 | } |
710 | 711 | ||
711 | const QString Addressee::uid() const | 712 | const QString Addressee::uid() const |
712 | { | 713 | { |
713 | if ( mData->uid.isEmpty() ) | 714 | if ( mData->uid.isEmpty() ) |
714 | mData->uid = KApplication::randomString( 10 ); | 715 | mData->uid = KApplication::randomString( 10 ); |
715 | 716 | ||
716 | return mData->uid; | 717 | return mData->uid; |
717 | } | 718 | } |
718 | 719 | ||
719 | QString Addressee::uidLabel() | 720 | QString Addressee::uidLabel() |
720 | { | 721 | { |
721 | return i18n("Unique Identifier"); | 722 | return i18n("Unique Identifier"); |
722 | } | 723 | } |
723 | 724 | ||
724 | void Addressee::setName( const QString &name ) | 725 | void Addressee::setName( const QString &name ) |
725 | { | 726 | { |
726 | if ( name == mData->name ) return; | 727 | if ( name == mData->name ) return; |
727 | detach(); | 728 | detach(); |
728 | mData->empty = false; | 729 | mData->empty = false; |
729 | mData->name = name; | 730 | mData->name = name; |
730 | } | 731 | } |
731 | 732 | ||
732 | QString Addressee::name() const | 733 | QString Addressee::name() const |
733 | { | 734 | { |
734 | return mData->name; | 735 | return mData->name; |
735 | } | 736 | } |
736 | 737 | ||
737 | QString Addressee::nameLabel() | 738 | QString Addressee::nameLabel() |
738 | { | 739 | { |
739 | return i18n("Name"); | 740 | return i18n("Name"); |
740 | } | 741 | } |
741 | 742 | ||
742 | 743 | ||
743 | void Addressee::setFormattedName( const QString &formattedName ) | 744 | void Addressee::setFormattedName( const QString &formattedName ) |
744 | { | 745 | { |
745 | if ( formattedName == mData->formattedName ) return; | 746 | if ( formattedName == mData->formattedName ) return; |
746 | detach(); | 747 | detach(); |
747 | mData->empty = false; | 748 | mData->empty = false; |
748 | mData->formattedName = formattedName; | 749 | mData->formattedName = formattedName; |
749 | } | 750 | } |
751 | void Addressee::setDefaultFormattedName( const QString &formattedName ) | ||
752 | { | ||
753 | if ( formattedName == mData->defaultFormattedName ) return; | ||
754 | detach(); | ||
755 | mData->empty = false; | ||
756 | mData->defaultFormattedName = formattedName; | ||
757 | } | ||
750 | 758 | ||
751 | QString Addressee::formattedName() const | 759 | QString Addressee::formattedName() const |
752 | { | 760 | { |
753 | return mData->formattedName; | 761 | return mData->formattedName; |
754 | } | 762 | } |
763 | QString Addressee::defaultFormattedName() const | ||
764 | { | ||
765 | return mData->defaultFormattedName; | ||
766 | } | ||
755 | 767 | ||
756 | QString Addressee::formattedNameLabel() | 768 | QString Addressee::formattedNameLabel() |
757 | { | 769 | { |
758 | return i18n("Formatted Name"); | 770 | return i18n("Formatted Name"); |
759 | } | 771 | } |
760 | 772 | ||
773 | QString Addressee::defaultFormattedNameLabel() | ||
774 | { | ||
775 | return i18n("Def.Formatted Name"); | ||
776 | } | ||
777 | |||
761 | 778 | ||
762 | void Addressee::setFamilyName( const QString &familyName ) | 779 | void Addressee::setFamilyName( const QString &familyName ) |
763 | { | 780 | { |
764 | if ( familyName == mData->familyName ) return; | 781 | if ( familyName == mData->familyName ) return; |
765 | detach(); | 782 | detach(); |
766 | mData->empty = false; | 783 | mData->empty = false; |
767 | mData->familyName = familyName; | 784 | mData->familyName = familyName; |
768 | } | 785 | } |
769 | 786 | ||
770 | QString Addressee::familyName() const | 787 | QString Addressee::familyName() const |
771 | { | 788 | { |
772 | return mData->familyName; | 789 | return mData->familyName; |
773 | } | 790 | } |
774 | 791 | ||
775 | QString Addressee::familyNameLabel() | 792 | QString Addressee::familyNameLabel() |
776 | { | 793 | { |
777 | return i18n("Family Name"); | 794 | return i18n("Family Name"); |
778 | } | 795 | } |
779 | 796 | ||
780 | 797 | ||
781 | void Addressee::setGivenName( const QString &givenName ) | 798 | void Addressee::setGivenName( const QString &givenName ) |
782 | { | 799 | { |
783 | if ( givenName == mData->givenName ) return; | 800 | if ( givenName == mData->givenName ) return; |
784 | detach(); | 801 | detach(); |
785 | mData->empty = false; | 802 | mData->empty = false; |
786 | mData->givenName = givenName; | 803 | mData->givenName = givenName; |
787 | } | 804 | } |
788 | 805 | ||
789 | QString Addressee::givenName() const | 806 | QString Addressee::givenName() const |
790 | { | 807 | { |
791 | return mData->givenName; | 808 | return mData->givenName; |
792 | } | 809 | } |
793 | 810 | ||
794 | QString Addressee::givenNameLabel() | 811 | QString Addressee::givenNameLabel() |
795 | { | 812 | { |
796 | return i18n("Given Name"); | 813 | return i18n("Given Name"); |
797 | } | 814 | } |
798 | 815 | ||
799 | 816 | ||
800 | void Addressee::setAdditionalName( const QString &additionalName ) | 817 | void Addressee::setAdditionalName( const QString &additionalName ) |
801 | { | 818 | { |
802 | if ( additionalName == mData->additionalName ) return; | 819 | if ( additionalName == mData->additionalName ) return; |
803 | detach(); | 820 | detach(); |
804 | mData->empty = false; | 821 | mData->empty = false; |
805 | mData->additionalName = additionalName; | 822 | mData->additionalName = additionalName; |
806 | } | 823 | } |
807 | 824 | ||
808 | QString Addressee::additionalName() const | 825 | QString Addressee::additionalName() const |
809 | { | 826 | { |
810 | return mData->additionalName; | 827 | return mData->additionalName; |
811 | } | 828 | } |
812 | 829 | ||
813 | QString Addressee::additionalNameLabel() | 830 | QString Addressee::additionalNameLabel() |
814 | { | 831 | { |
815 | return i18n("Additional Names"); | 832 | return i18n("Additional Names"); |
816 | } | 833 | } |
817 | 834 | ||
818 | 835 | ||
819 | void Addressee::setPrefix( const QString &prefix ) | 836 | void Addressee::setPrefix( const QString &prefix ) |
820 | { | 837 | { |
821 | if ( prefix == mData->prefix ) return; | 838 | if ( prefix == mData->prefix ) return; |
822 | detach(); | 839 | detach(); |
823 | mData->empty = false; | 840 | mData->empty = false; |
824 | mData->prefix = prefix; | 841 | mData->prefix = prefix; |
825 | } | 842 | } |
826 | 843 | ||
827 | QString Addressee::prefix() const | 844 | QString Addressee::prefix() const |
828 | { | 845 | { |
829 | return mData->prefix; | 846 | return mData->prefix; |
830 | } | 847 | } |
831 | 848 | ||
832 | QString Addressee::prefixLabel() | 849 | QString Addressee::prefixLabel() |
833 | { | 850 | { |
834 | return i18n("Honorific Prefixes"); | 851 | return i18n("Honorific Prefixes"); |
835 | } | 852 | } |
836 | 853 | ||
837 | 854 | ||
838 | void Addressee::setSuffix( const QString &suffix ) | 855 | void Addressee::setSuffix( const QString &suffix ) |
839 | { | 856 | { |
840 | if ( suffix == mData->suffix ) return; | 857 | if ( suffix == mData->suffix ) return; |
841 | detach(); | 858 | detach(); |
842 | mData->empty = false; | 859 | mData->empty = false; |
843 | mData->suffix = suffix; | 860 | mData->suffix = suffix; |
844 | } | 861 | } |
845 | 862 | ||
846 | QString Addressee::suffix() const | 863 | QString Addressee::suffix() const |
847 | { | 864 | { |
848 | return mData->suffix; | 865 | return mData->suffix; |
849 | } | 866 | } |
850 | 867 | ||
851 | QString Addressee::suffixLabel() | 868 | QString Addressee::suffixLabel() |
852 | { | 869 | { |
853 | return i18n("Honorific Suffixes"); | 870 | return i18n("Honorific Suffixes"); |
854 | } | 871 | } |
855 | 872 | ||
856 | 873 | ||
857 | void Addressee::setNickName( const QString &nickName ) | 874 | void Addressee::setNickName( const QString &nickName ) |
858 | { | 875 | { |
859 | if ( nickName == mData->nickName ) return; | 876 | if ( nickName == mData->nickName ) return; |
860 | detach(); | 877 | detach(); |
861 | mData->empty = false; | 878 | mData->empty = false; |
862 | mData->nickName = nickName; | 879 | mData->nickName = nickName; |
863 | } | 880 | } |
864 | 881 | ||
865 | QString Addressee::nickName() const | 882 | QString Addressee::nickName() const |
866 | { | 883 | { |
867 | return mData->nickName; | 884 | return mData->nickName; |
868 | } | 885 | } |
869 | 886 | ||
870 | QString Addressee::nickNameLabel() | 887 | QString Addressee::nickNameLabel() |
871 | { | 888 | { |
872 | return i18n("Nick Name"); | 889 | return i18n("Nick Name"); |
873 | } | 890 | } |
874 | 891 | ||
875 | 892 | ||
876 | void Addressee::setBirthday( const QDateTime &birthday ) | 893 | void Addressee::setBirthday( const QDateTime &birthday ) |
877 | { | 894 | { |
878 | if ( birthday == mData->birthday ) return; | 895 | if ( birthday == mData->birthday ) return; |
879 | detach(); | 896 | detach(); |
880 | mData->empty = false; | 897 | mData->empty = false; |
881 | mData->birthday = birthday; | 898 | mData->birthday = birthday; |
882 | } | 899 | } |
883 | 900 | ||
884 | QDateTime Addressee::birthday() const | 901 | QDateTime Addressee::birthday() const |
885 | { | 902 | { |
886 | return mData->birthday; | 903 | return mData->birthday; |
887 | } | 904 | } |
888 | 905 | ||
889 | QString Addressee::birthdayLabel() | 906 | QString Addressee::birthdayLabel() |
890 | { | 907 | { |
891 | return i18n("Birthday"); | 908 | return i18n("Birthday"); |
892 | } | 909 | } |
893 | 910 | ||
894 | 911 | ||
895 | QString Addressee::homeAddressStreetLabel() | 912 | QString Addressee::homeAddressStreetLabel() |
896 | { | 913 | { |
897 | return i18n("Home Address Street"); | 914 | return i18n("Home Address Street"); |
898 | } | 915 | } |
899 | 916 | ||
900 | 917 | ||
901 | QString Addressee::homeAddressLocalityLabel() | 918 | QString Addressee::homeAddressLocalityLabel() |
902 | { | 919 | { |
903 | return i18n("Home Address Locality"); | 920 | return i18n("Home Address Locality"); |
904 | } | 921 | } |
905 | 922 | ||
906 | 923 | ||
907 | QString Addressee::homeAddressRegionLabel() | 924 | QString Addressee::homeAddressRegionLabel() |
908 | { | 925 | { |
909 | return i18n("Home Address Region"); | 926 | return i18n("Home Address Region"); |
910 | } | 927 | } |
911 | 928 | ||
912 | 929 | ||
913 | QString Addressee::homeAddressPostalCodeLabel() | 930 | QString Addressee::homeAddressPostalCodeLabel() |
914 | { | 931 | { |
915 | return i18n("Home Address Postal Code"); | 932 | return i18n("Home Address Postal Code"); |
916 | } | 933 | } |
917 | 934 | ||
918 | 935 | ||
919 | QString Addressee::homeAddressCountryLabel() | 936 | QString Addressee::homeAddressCountryLabel() |
920 | { | 937 | { |
921 | return i18n("Home Address Country"); | 938 | return i18n("Home Address Country"); |
922 | } | 939 | } |
923 | 940 | ||
924 | 941 | ||
925 | QString Addressee::homeAddressLabelLabel() | 942 | QString Addressee::homeAddressLabelLabel() |
926 | { | 943 | { |
927 | return i18n("Home Address Label"); | 944 | return i18n("Home Address Label"); |
928 | } | 945 | } |
929 | 946 | ||
930 | 947 | ||
931 | QString Addressee::businessAddressStreetLabel() | 948 | QString Addressee::businessAddressStreetLabel() |
932 | { | 949 | { |
933 | return i18n("Business Address Street"); | 950 | return i18n("Business Address Street"); |
934 | } | 951 | } |
935 | 952 | ||
936 | 953 | ||
937 | QString Addressee::businessAddressLocalityLabel() | 954 | QString Addressee::businessAddressLocalityLabel() |
938 | { | 955 | { |
939 | return i18n("Business Address Locality"); | 956 | return i18n("Business Address Locality"); |
940 | } | 957 | } |
941 | 958 | ||
942 | 959 | ||
943 | QString Addressee::businessAddressRegionLabel() | 960 | QString Addressee::businessAddressRegionLabel() |
944 | { | 961 | { |
945 | return i18n("Business Address Region"); | 962 | return i18n("Business Address Region"); |
946 | } | 963 | } |
947 | 964 | ||
948 | 965 | ||
949 | QString Addressee::businessAddressPostalCodeLabel() | 966 | QString Addressee::businessAddressPostalCodeLabel() |
950 | { | 967 | { |
951 | return i18n("Business Address Postal Code"); | 968 | return i18n("Business Address Postal Code"); |
952 | } | 969 | } |
953 | 970 | ||
954 | 971 | ||
955 | QString Addressee::businessAddressCountryLabel() | 972 | QString Addressee::businessAddressCountryLabel() |
956 | { | 973 | { |
957 | return i18n("Business Address Country"); | 974 | return i18n("Business Address Country"); |
958 | } | 975 | } |
959 | 976 | ||
960 | 977 | ||
961 | QString Addressee::businessAddressLabelLabel() | 978 | QString Addressee::businessAddressLabelLabel() |
962 | { | 979 | { |
963 | return i18n("Business Address Label"); | 980 | return i18n("Business Address Label"); |
964 | } | 981 | } |
965 | 982 | ||
966 | 983 | ||
967 | QString Addressee::homePhoneLabel() | 984 | QString Addressee::homePhoneLabel() |
968 | { | 985 | { |
969 | return i18n("Home Phone"); | 986 | return i18n("Home Phone"); |
970 | } | 987 | } |
971 | 988 | ||
972 | 989 | ||
973 | QString Addressee::businessPhoneLabel() | 990 | QString Addressee::businessPhoneLabel() |
974 | { | 991 | { |
975 | return i18n("Business Phone"); | 992 | return i18n("Business Phone"); |
976 | } | 993 | } |
977 | 994 | ||
978 | 995 | ||
979 | QString Addressee::mobilePhoneLabel() | 996 | QString Addressee::mobilePhoneLabel() |
980 | { | 997 | { |
981 | return i18n("Mobile Phone"); | 998 | return i18n("Mobile Phone"); |
982 | } | 999 | } |
1000 | QString Addressee::mobileWorkPhoneLabel() | ||
1001 | { | ||
1002 | return i18n("Mobile (work)"); | ||
1003 | } | ||
1004 | QString Addressee::mobileHomePhoneLabel() | ||
1005 | { | ||
1006 | return i18n("Mobile (home)"); | ||
1007 | } | ||
983 | 1008 | ||
984 | 1009 | ||
985 | QString Addressee::homeFaxLabel() | 1010 | QString Addressee::homeFaxLabel() |
986 | { | 1011 | { |
987 | return i18n("Home Fax"); | 1012 | return i18n("Home Fax"); |
988 | } | 1013 | } |
989 | 1014 | ||
990 | 1015 | ||
991 | QString Addressee::businessFaxLabel() | 1016 | QString Addressee::businessFaxLabel() |
992 | { | 1017 | { |
993 | return i18n("Business Fax"); | 1018 | return i18n("Business Fax"); |
994 | } | 1019 | } |
995 | 1020 | ||
996 | 1021 | ||
997 | QString Addressee::carPhoneLabel() | 1022 | QString Addressee::carPhoneLabel() |
998 | { | 1023 | { |
999 | return i18n("Car Phone"); | 1024 | return i18n("Car Phone"); |
1000 | } | 1025 | } |
1001 | 1026 | ||
1002 | 1027 | ||
1003 | QString Addressee::isdnLabel() | 1028 | QString Addressee::isdnLabel() |
1004 | { | 1029 | { |
1005 | return i18n("ISDN"); | 1030 | return i18n("ISDN"); |
1006 | } | 1031 | } |
1007 | 1032 | ||
1008 | 1033 | ||
1009 | QString Addressee::pagerLabel() | 1034 | QString Addressee::pagerLabel() |
1010 | { | 1035 | { |
1011 | return i18n("Pager"); | 1036 | return i18n("Pager"); |
1012 | } | 1037 | } |
1013 | 1038 | ||
1014 | QString Addressee::sipLabel() | 1039 | QString Addressee::sipLabel() |
1015 | { | 1040 | { |
1016 | return i18n("SIP"); | 1041 | return i18n("SIP"); |
1017 | } | 1042 | } |
1018 | 1043 | ||
1019 | QString Addressee::emailLabel() | 1044 | QString Addressee::emailLabel() |
1020 | { | 1045 | { |
1021 | return i18n("Email Address"); | 1046 | return i18n("Email Address"); |
1022 | } | 1047 | } |
1023 | 1048 | ||
1024 | 1049 | ||
1025 | void Addressee::setMailer( const QString &mailer ) | 1050 | void Addressee::setMailer( const QString &mailer ) |
1026 | { | 1051 | { |
1027 | if ( mailer == mData->mailer ) return; | 1052 | if ( mailer == mData->mailer ) return; |
1028 | detach(); | 1053 | detach(); |
1029 | mData->empty = false; | 1054 | mData->empty = false; |
1030 | mData->mailer = mailer; | 1055 | mData->mailer = mailer; |
1031 | } | 1056 | } |
1032 | 1057 | ||
1033 | QString Addressee::mailer() const | 1058 | QString Addressee::mailer() const |
1034 | { | 1059 | { |
1035 | return mData->mailer; | 1060 | return mData->mailer; |
1036 | } | 1061 | } |
1037 | 1062 | ||
1038 | QString Addressee::mailerLabel() | 1063 | QString Addressee::mailerLabel() |
1039 | { | 1064 | { |
1040 | return i18n("Mail Client"); | 1065 | return i18n("Mail Client"); |
1041 | } | 1066 | } |
1042 | 1067 | ||
1043 | 1068 | ||
1044 | void Addressee::setTimeZone( const TimeZone &timeZone ) | 1069 | void Addressee::setTimeZone( const TimeZone &timeZone ) |
1045 | { | 1070 | { |
1046 | if ( timeZone == mData->timeZone ) return; | 1071 | if ( timeZone == mData->timeZone ) return; |
1047 | detach(); | 1072 | detach(); |
1048 | mData->empty = false; | 1073 | mData->empty = false; |
1049 | mData->timeZone = timeZone; | 1074 | mData->timeZone = timeZone; |
1050 | } | 1075 | } |
1051 | 1076 | ||
1052 | TimeZone Addressee::timeZone() const | 1077 | TimeZone Addressee::timeZone() const |
1053 | { | 1078 | { |
1054 | return mData->timeZone; | 1079 | return mData->timeZone; |
1055 | } | 1080 | } |
1056 | 1081 | ||
1057 | QString Addressee::timeZoneLabel() | 1082 | QString Addressee::timeZoneLabel() |
1058 | { | 1083 | { |
1059 | return i18n("Time Zone"); | 1084 | return i18n("Time Zone"); |
1060 | } | 1085 | } |
1061 | 1086 | ||
1062 | 1087 | ||
1063 | void Addressee::setGeo( const Geo &geo ) | 1088 | void Addressee::setGeo( const Geo &geo ) |
1064 | { | 1089 | { |
1065 | if ( geo == mData->geo ) return; | 1090 | if ( geo == mData->geo ) return; |
1066 | detach(); | 1091 | detach(); |
1067 | mData->empty = false; | 1092 | mData->empty = false; |
1068 | mData->geo = geo; | 1093 | mData->geo = geo; |
1069 | } | 1094 | } |
1070 | 1095 | ||
1071 | Geo Addressee::geo() const | 1096 | Geo Addressee::geo() const |
1072 | { | 1097 | { |
1073 | return mData->geo; | 1098 | return mData->geo; |
1074 | } | 1099 | } |
1075 | 1100 | ||
1076 | QString Addressee::geoLabel() | 1101 | QString Addressee::geoLabel() |
1077 | { | 1102 | { |
1078 | return i18n("Geographic Position"); | 1103 | return i18n("Geographic Position"); |
1079 | } | 1104 | } |
1080 | 1105 | ||
1081 | 1106 | ||
1082 | void Addressee::setTitle( const QString &title ) | 1107 | void Addressee::setTitle( const QString &title ) |
1083 | { | 1108 | { |
1084 | if ( title == mData->title ) return; | 1109 | if ( title == mData->title ) return; |
1085 | detach(); | 1110 | detach(); |
1086 | mData->empty = false; | 1111 | mData->empty = false; |
1087 | mData->title = title; | 1112 | mData->title = title; |
1088 | } | 1113 | } |
1089 | 1114 | ||
1090 | QString Addressee::title() const | 1115 | QString Addressee::title() const |
1091 | { | 1116 | { |
1092 | return mData->title; | 1117 | return mData->title; |
1093 | } | 1118 | } |
1094 | 1119 | ||
1095 | QString Addressee::titleLabel() | 1120 | QString Addressee::titleLabel() |
1096 | { | 1121 | { |
1097 | return i18n("Title"); | 1122 | return i18n("Title"); |
1098 | } | 1123 | } |
1099 | 1124 | ||
1100 | 1125 | ||
1101 | void Addressee::setRole( const QString &role ) | 1126 | void Addressee::setRole( const QString &role ) |
1102 | { | 1127 | { |
1103 | if ( role == mData->role ) return; | 1128 | if ( role == mData->role ) return; |
1104 | detach(); | 1129 | detach(); |
1105 | mData->empty = false; | 1130 | mData->empty = false; |
1106 | mData->role = role; | 1131 | mData->role = role; |
1107 | } | 1132 | } |
1108 | 1133 | ||
1109 | QString Addressee::role() const | 1134 | QString Addressee::role() const |
1110 | { | 1135 | { |
diff --git a/kabc/addressee.h b/kabc/addressee.h index 8051fec..0d688f8 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h | |||
@@ -29,430 +29,435 @@ $Id$ | |||
29 | #ifndef KABC_ADDRESSEE_H | 29 | #ifndef KABC_ADDRESSEE_H |
30 | #define KABC_ADDRESSEE_H | 30 | #define KABC_ADDRESSEE_H |
31 | 31 | ||
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qstring.h> | 33 | #include <qstring.h> |
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | #include <qvaluelist.h> | 35 | #include <qvaluelist.h> |
36 | 36 | ||
37 | #include <ksharedptr.h> | 37 | #include <ksharedptr.h> |
38 | #include <kurl.h> | 38 | #include <kurl.h> |
39 | 39 | ||
40 | #include "address.h" | 40 | #include "address.h" |
41 | #include "agent.h" | 41 | #include "agent.h" |
42 | #include "geo.h" | 42 | #include "geo.h" |
43 | #include "key.h" | 43 | #include "key.h" |
44 | #include "phonenumber.h" | 44 | #include "phonenumber.h" |
45 | #include "picture.h" | 45 | #include "picture.h" |
46 | #include "secrecy.h" | 46 | #include "secrecy.h" |
47 | #include "sound.h" | 47 | #include "sound.h" |
48 | #include "timezone.h" | 48 | #include "timezone.h" |
49 | 49 | ||
50 | namespace KABC { | 50 | namespace KABC { |
51 | 51 | ||
52 | class Resource; | 52 | class Resource; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | @short address book entry | 55 | @short address book entry |
56 | 56 | ||
57 | This class represents an entry in the address book. | 57 | This class represents an entry in the address book. |
58 | 58 | ||
59 | The data of this class is implicitly shared. You can pass this class by value. | 59 | The data of this class is implicitly shared. You can pass this class by value. |
60 | 60 | ||
61 | If you need the name of a field for presenting it to the user you should use | 61 | If you need the name of a field for presenting it to the user you should use |
62 | the functions ending in Label(). They return a translated string which can be | 62 | the functions ending in Label(). They return a translated string which can be |
63 | used as label for the corresponding field. | 63 | used as label for the corresponding field. |
64 | 64 | ||
65 | About the name fields: | 65 | About the name fields: |
66 | 66 | ||
67 | givenName() is the first name and familyName() the last name. In some | 67 | givenName() is the first name and familyName() the last name. In some |
68 | countries the family name comes first, that's the reason for the | 68 | countries the family name comes first, that's the reason for the |
69 | naming. formattedName() is the full name with the correct formatting. | 69 | naming. formattedName() is the full name with the correct formatting. |
70 | It is used as an override, when the correct formatting can't be generated | 70 | It is used as an override, when the correct formatting can't be generated |
71 | from the other name fields automatically. | 71 | from the other name fields automatically. |
72 | 72 | ||
73 | realName() returns a fully formatted name(). It uses formattedName, if set, | 73 | realName() returns a fully formatted name(). It uses formattedName, if set, |
74 | otherwise it constucts the name from the name fields. As fallback, if | 74 | otherwise it constucts the name from the name fields. As fallback, if |
75 | nothing else is set it uses name(). | 75 | nothing else is set it uses name(). |
76 | 76 | ||
77 | name() is the NAME type of RFC2426. It can be used as internal name for the | 77 | name() is the NAME type of RFC2426. It can be used as internal name for the |
78 | data enty, but shouldn't be used for displaying the data to the user. | 78 | data enty, but shouldn't be used for displaying the data to the user. |
79 | */ | 79 | */ |
80 | class Addressee | 80 | class Addressee |
81 | { | 81 | { |
82 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); | 82 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); |
83 | friend QDataStream &operator>>( QDataStream &, Addressee & ); | 83 | friend QDataStream &operator>>( QDataStream &, Addressee & ); |
84 | 84 | ||
85 | public: | 85 | public: |
86 | typedef QValueList<Addressee> List; | 86 | typedef QValueList<Addressee> List; |
87 | 87 | ||
88 | /** | 88 | /** |
89 | Construct an empty address book entry. | 89 | Construct an empty address book entry. |
90 | */ | 90 | */ |
91 | Addressee(); | 91 | Addressee(); |
92 | ~Addressee(); | 92 | ~Addressee(); |
93 | 93 | ||
94 | Addressee( const Addressee & ); | 94 | Addressee( const Addressee & ); |
95 | Addressee &operator=( const Addressee & ); | 95 | Addressee &operator=( const Addressee & ); |
96 | 96 | ||
97 | bool operator==( const Addressee & ) const; | 97 | bool operator==( const Addressee & ) const; |
98 | bool operator!=( const Addressee & ) const; | 98 | bool operator!=( const Addressee & ) const; |
99 | // sync stuff | 99 | // sync stuff |
100 | void setTempSyncStat(int id); | 100 | void setTempSyncStat(int id); |
101 | int tempSyncStat() const; | 101 | int tempSyncStat() const; |
102 | void setIDStr( const QString & ); | 102 | void setIDStr( const QString & ); |
103 | const QString IDStr() const; | 103 | const QString IDStr() const; |
104 | void setID( const QString &, const QString & ); | 104 | void setID( const QString &, const QString & ); |
105 | const QString getID( const QString & ) const; | 105 | const QString getID( const QString & ) const; |
106 | void setCsum( const QString &, const QString & ); | 106 | void setCsum( const QString &, const QString & ); |
107 | const QString getCsum( const QString & ) const ; | 107 | const QString getCsum( const QString & ) const ; |
108 | void removeID(const QString &); | 108 | void removeID(const QString &); |
109 | void computeCsum(const QString &dev); | 109 | void computeCsum(const QString &dev); |
110 | ulong getCsum4List( const QStringList & attList); | 110 | ulong getCsum4List( const QStringList & attList); |
111 | /** | 111 | /** |
112 | Return, if the address book entry is empty. | 112 | Return, if the address book entry is empty. |
113 | */ | 113 | */ |
114 | bool isEmpty() const; | 114 | bool isEmpty() const; |
115 | void setExternalUID( const QString &id ); | 115 | void setExternalUID( const QString &id ); |
116 | const QString externalUID() const; | 116 | const QString externalUID() const; |
117 | void setOriginalExternalUID( const QString &id ); | 117 | void setOriginalExternalUID( const QString &id ); |
118 | QString originalExternalUID() const; | 118 | QString originalExternalUID() const; |
119 | void mergeContact( const Addressee& ad, bool isSubSet ); | 119 | void mergeContact( const Addressee& ad, bool isSubSet ); |
120 | void simplifyEmails(); | 120 | void simplifyEmails(); |
121 | void simplifyAddresses(); | 121 | void simplifyAddresses(); |
122 | void simplifyPhoneNumbers(); | 122 | void simplifyPhoneNumbers(); |
123 | void simplifyPhoneNumberTypes(); | 123 | void simplifyPhoneNumberTypes(); |
124 | bool removeVoice(); | 124 | bool removeVoice(); |
125 | bool containsAdr(const Addressee& addr ); | 125 | bool containsAdr(const Addressee& addr ); |
126 | 126 | ||
127 | /** | 127 | /** |
128 | Set unique identifier. | 128 | Set unique identifier. |
129 | */ | 129 | */ |
130 | void setUid( const QString &uid ); | 130 | void setUid( const QString &uid ); |
131 | /** | 131 | /** |
132 | Return unique identifier. | 132 | Return unique identifier. |
133 | */ | 133 | */ |
134 | const QString uid() const; | 134 | const QString uid() const; |
135 | /** | 135 | /** |
136 | Return translated label for uid field. | 136 | Return translated label for uid field. |
137 | */ | 137 | */ |
138 | static QString uidLabel(); | 138 | static QString uidLabel(); |
139 | 139 | ||
140 | /** | 140 | /** |
141 | Set name. | 141 | Set name. |
142 | */ | 142 | */ |
143 | void setName( const QString &name ); | 143 | void setName( const QString &name ); |
144 | /** | 144 | /** |
145 | Return name. | 145 | Return name. |
146 | */ | 146 | */ |
147 | QString name() const; | 147 | QString name() const; |
148 | /** | 148 | /** |
149 | Return translated label for name field. | 149 | Return translated label for name field. |
150 | */ | 150 | */ |
151 | static QString nameLabel(); | 151 | static QString nameLabel(); |
152 | 152 | ||
153 | /** | 153 | /** |
154 | Set formatted name. | 154 | Set formatted name. |
155 | */ | 155 | */ |
156 | void setFormattedName( const QString &formattedName ); | 156 | void setFormattedName( const QString &formattedName ); |
157 | void setDefaultFormattedName( const QString &formattedName ); | ||
157 | /** | 158 | /** |
158 | Return formatted name. | 159 | Return formatted name. |
159 | */ | 160 | */ |
160 | QString formattedName() const; | 161 | QString formattedName() const; |
162 | QString defaultFormattedName() const; | ||
161 | /** | 163 | /** |
162 | Return translated label for formattedName field. | 164 | Return translated label for formattedName field. |
163 | */ | 165 | */ |
164 | static QString formattedNameLabel(); | 166 | static QString formattedNameLabel(); |
167 | static QString defaultFormattedNameLabel(); | ||
165 | 168 | ||
166 | /** | 169 | /** |
167 | Set family name. | 170 | Set family name. |
168 | */ | 171 | */ |
169 | void setFamilyName( const QString &familyName ); | 172 | void setFamilyName( const QString &familyName ); |
170 | /** | 173 | /** |
171 | Return family name. | 174 | Return family name. |
172 | */ | 175 | */ |
173 | QString familyName() const; | 176 | QString familyName() const; |
174 | /** | 177 | /** |
175 | Return translated label for familyName field. | 178 | Return translated label for familyName field. |
176 | */ | 179 | */ |
177 | static QString familyNameLabel(); | 180 | static QString familyNameLabel(); |
178 | 181 | ||
179 | /** | 182 | /** |
180 | Set given name. | 183 | Set given name. |
181 | */ | 184 | */ |
182 | void setGivenName( const QString &givenName ); | 185 | void setGivenName( const QString &givenName ); |
183 | /** | 186 | /** |
184 | Return given name. | 187 | Return given name. |
185 | */ | 188 | */ |
186 | QString givenName() const; | 189 | QString givenName() const; |
187 | /** | 190 | /** |
188 | Return translated label for givenName field. | 191 | Return translated label for givenName field. |
189 | */ | 192 | */ |
190 | static QString givenNameLabel(); | 193 | static QString givenNameLabel(); |
191 | 194 | ||
192 | /** | 195 | /** |
193 | Set additional names. | 196 | Set additional names. |
194 | */ | 197 | */ |
195 | void setAdditionalName( const QString &additionalName ); | 198 | void setAdditionalName( const QString &additionalName ); |
196 | /** | 199 | /** |
197 | Return additional names. | 200 | Return additional names. |
198 | */ | 201 | */ |
199 | QString additionalName() const; | 202 | QString additionalName() const; |
200 | /** | 203 | /** |
201 | Return translated label for additionalName field. | 204 | Return translated label for additionalName field. |
202 | */ | 205 | */ |
203 | static QString additionalNameLabel(); | 206 | static QString additionalNameLabel(); |
204 | 207 | ||
205 | /** | 208 | /** |
206 | Set honorific prefixes. | 209 | Set honorific prefixes. |
207 | */ | 210 | */ |
208 | void setPrefix( const QString &prefix ); | 211 | void setPrefix( const QString &prefix ); |
209 | /** | 212 | /** |
210 | Return honorific prefixes. | 213 | Return honorific prefixes. |
211 | */ | 214 | */ |
212 | QString prefix() const; | 215 | QString prefix() const; |
213 | /** | 216 | /** |
214 | Return translated label for prefix field. | 217 | Return translated label for prefix field. |
215 | */ | 218 | */ |
216 | static QString prefixLabel(); | 219 | static QString prefixLabel(); |
217 | 220 | ||
218 | /** | 221 | /** |
219 | Set honorific suffixes. | 222 | Set honorific suffixes. |
220 | */ | 223 | */ |
221 | void setSuffix( const QString &suffix ); | 224 | void setSuffix( const QString &suffix ); |
222 | /** | 225 | /** |
223 | Return honorific suffixes. | 226 | Return honorific suffixes. |
224 | */ | 227 | */ |
225 | QString suffix() const; | 228 | QString suffix() const; |
226 | /** | 229 | /** |
227 | Return translated label for suffix field. | 230 | Return translated label for suffix field. |
228 | */ | 231 | */ |
229 | static QString suffixLabel(); | 232 | static QString suffixLabel(); |
230 | 233 | ||
231 | /** | 234 | /** |
232 | Set nick name. | 235 | Set nick name. |
233 | */ | 236 | */ |
234 | void setNickName( const QString &nickName ); | 237 | void setNickName( const QString &nickName ); |
235 | /** | 238 | /** |
236 | Return nick name. | 239 | Return nick name. |
237 | */ | 240 | */ |
238 | QString nickName() const; | 241 | QString nickName() const; |
239 | /** | 242 | /** |
240 | Return translated label for nickName field. | 243 | Return translated label for nickName field. |
241 | */ | 244 | */ |
242 | static QString nickNameLabel(); | 245 | static QString nickNameLabel(); |
243 | 246 | ||
244 | /** | 247 | /** |
245 | Set birthday. | 248 | Set birthday. |
246 | */ | 249 | */ |
247 | void setBirthday( const QDateTime &birthday ); | 250 | void setBirthday( const QDateTime &birthday ); |
248 | /** | 251 | /** |
249 | Return birthday. | 252 | Return birthday. |
250 | */ | 253 | */ |
251 | QDateTime birthday() const; | 254 | QDateTime birthday() const; |
252 | /** | 255 | /** |
253 | Return translated label for birthday field. | 256 | Return translated label for birthday field. |
254 | */ | 257 | */ |
255 | static QString birthdayLabel(); | 258 | static QString birthdayLabel(); |
256 | 259 | ||
257 | /** | 260 | /** |
258 | Return translated label for homeAddressStreet field. | 261 | Return translated label for homeAddressStreet field. |
259 | */ | 262 | */ |
260 | static QString homeAddressStreetLabel(); | 263 | static QString homeAddressStreetLabel(); |
261 | 264 | ||
262 | /** | 265 | /** |
263 | Return translated label for homeAddressLocality field. | 266 | Return translated label for homeAddressLocality field. |
264 | */ | 267 | */ |
265 | static QString homeAddressLocalityLabel(); | 268 | static QString homeAddressLocalityLabel(); |
266 | 269 | ||
267 | /** | 270 | /** |
268 | Return translated label for homeAddressRegion field. | 271 | Return translated label for homeAddressRegion field. |
269 | */ | 272 | */ |
270 | static QString homeAddressRegionLabel(); | 273 | static QString homeAddressRegionLabel(); |
271 | 274 | ||
272 | /** | 275 | /** |
273 | Return translated label for homeAddressPostalCode field. | 276 | Return translated label for homeAddressPostalCode field. |
274 | */ | 277 | */ |
275 | static QString homeAddressPostalCodeLabel(); | 278 | static QString homeAddressPostalCodeLabel(); |
276 | 279 | ||
277 | /** | 280 | /** |
278 | Return translated label for homeAddressCountry field. | 281 | Return translated label for homeAddressCountry field. |
279 | */ | 282 | */ |
280 | static QString homeAddressCountryLabel(); | 283 | static QString homeAddressCountryLabel(); |
281 | 284 | ||
282 | /** | 285 | /** |
283 | Return translated label for homeAddressLabel field. | 286 | Return translated label for homeAddressLabel field. |
284 | */ | 287 | */ |
285 | static QString homeAddressLabelLabel(); | 288 | static QString homeAddressLabelLabel(); |
286 | 289 | ||
287 | /** | 290 | /** |
288 | Return translated label for businessAddressStreet field. | 291 | Return translated label for businessAddressStreet field. |
289 | */ | 292 | */ |
290 | static QString businessAddressStreetLabel(); | 293 | static QString businessAddressStreetLabel(); |
291 | 294 | ||
292 | /** | 295 | /** |
293 | Return translated label for businessAddressLocality field. | 296 | Return translated label for businessAddressLocality field. |
294 | */ | 297 | */ |
295 | static QString businessAddressLocalityLabel(); | 298 | static QString businessAddressLocalityLabel(); |
296 | 299 | ||
297 | /** | 300 | /** |
298 | Return translated label for businessAddressRegion field. | 301 | Return translated label for businessAddressRegion field. |
299 | */ | 302 | */ |
300 | static QString businessAddressRegionLabel(); | 303 | static QString businessAddressRegionLabel(); |
301 | 304 | ||
302 | /** | 305 | /** |
303 | Return translated label for businessAddressPostalCode field. | 306 | Return translated label for businessAddressPostalCode field. |
304 | */ | 307 | */ |
305 | static QString businessAddressPostalCodeLabel(); | 308 | static QString businessAddressPostalCodeLabel(); |
306 | 309 | ||
307 | /** | 310 | /** |
308 | Return translated label for businessAddressCountry field. | 311 | Return translated label for businessAddressCountry field. |
309 | */ | 312 | */ |
310 | static QString businessAddressCountryLabel(); | 313 | static QString businessAddressCountryLabel(); |
311 | 314 | ||
312 | /** | 315 | /** |
313 | Return translated label for businessAddressLabel field. | 316 | Return translated label for businessAddressLabel field. |
314 | */ | 317 | */ |
315 | static QString businessAddressLabelLabel(); | 318 | static QString businessAddressLabelLabel(); |
316 | 319 | ||
317 | /** | 320 | /** |
318 | Return translated label for homePhone field. | 321 | Return translated label for homePhone field. |
319 | */ | 322 | */ |
320 | static QString homePhoneLabel(); | 323 | static QString homePhoneLabel(); |
321 | 324 | ||
322 | /** | 325 | /** |
323 | Return translated label for businessPhone field. | 326 | Return translated label for businessPhone field. |
324 | */ | 327 | */ |
325 | static QString businessPhoneLabel(); | 328 | static QString businessPhoneLabel(); |
326 | 329 | ||
327 | /** | 330 | /** |
328 | Return translated label for mobilePhone field. | 331 | Return translated label for mobilePhone field. |
329 | */ | 332 | */ |
330 | static QString mobilePhoneLabel(); | 333 | static QString mobilePhoneLabel(); |
334 | static QString mobileWorkPhoneLabel(); | ||
335 | static QString mobileHomePhoneLabel(); | ||
331 | 336 | ||
332 | /** | 337 | /** |
333 | Return translated label for homeFax field. | 338 | Return translated label for homeFax field. |
334 | */ | 339 | */ |
335 | static QString homeFaxLabel(); | 340 | static QString homeFaxLabel(); |
336 | 341 | ||
337 | /** | 342 | /** |
338 | Return translated label for businessFax field. | 343 | Return translated label for businessFax field. |
339 | */ | 344 | */ |
340 | static QString businessFaxLabel(); | 345 | static QString businessFaxLabel(); |
341 | 346 | ||
342 | /** | 347 | /** |
343 | Return translated label for carPhone field. | 348 | Return translated label for carPhone field. |
344 | */ | 349 | */ |
345 | static QString carPhoneLabel(); | 350 | static QString carPhoneLabel(); |
346 | 351 | ||
347 | /** | 352 | /** |
348 | Return translated label for isdn field. | 353 | Return translated label for isdn field. |
349 | */ | 354 | */ |
350 | static QString isdnLabel(); | 355 | static QString isdnLabel(); |
351 | 356 | ||
352 | /** | 357 | /** |
353 | Return translated label for pager field. | 358 | Return translated label for pager field. |
354 | */ | 359 | */ |
355 | static QString pagerLabel(); | 360 | static QString pagerLabel(); |
356 | 361 | ||
357 | /** | 362 | /** |
358 | Return translated label for sip field. | 363 | Return translated label for sip field. |
359 | */ | 364 | */ |
360 | static QString sipLabel(); | 365 | static QString sipLabel(); |
361 | 366 | ||
362 | /** | 367 | /** |
363 | Return translated label for email field. | 368 | Return translated label for email field. |
364 | */ | 369 | */ |
365 | static QString emailLabel(); | 370 | static QString emailLabel(); |
366 | 371 | ||
367 | /** | 372 | /** |
368 | Set mail client. | 373 | Set mail client. |
369 | */ | 374 | */ |
370 | void setMailer( const QString &mailer ); | 375 | void setMailer( const QString &mailer ); |
371 | /** | 376 | /** |
372 | Return mail client. | 377 | Return mail client. |
373 | */ | 378 | */ |
374 | QString mailer() const; | 379 | QString mailer() const; |
375 | /** | 380 | /** |
376 | Return translated label for mailer field. | 381 | Return translated label for mailer field. |
377 | */ | 382 | */ |
378 | static QString mailerLabel(); | 383 | static QString mailerLabel(); |
379 | 384 | ||
380 | /** | 385 | /** |
381 | Set time zone. | 386 | Set time zone. |
382 | */ | 387 | */ |
383 | void setTimeZone( const TimeZone &timeZone ); | 388 | void setTimeZone( const TimeZone &timeZone ); |
384 | /** | 389 | /** |
385 | Return time zone. | 390 | Return time zone. |
386 | */ | 391 | */ |
387 | TimeZone timeZone() const; | 392 | TimeZone timeZone() const; |
388 | /** | 393 | /** |
389 | Return translated label for timeZone field. | 394 | Return translated label for timeZone field. |
390 | */ | 395 | */ |
391 | static QString timeZoneLabel(); | 396 | static QString timeZoneLabel(); |
392 | 397 | ||
393 | /** | 398 | /** |
394 | Set geographic position. | 399 | Set geographic position. |
395 | */ | 400 | */ |
396 | void setGeo( const Geo &geo ); | 401 | void setGeo( const Geo &geo ); |
397 | /** | 402 | /** |
398 | Return geographic position. | 403 | Return geographic position. |
399 | */ | 404 | */ |
400 | Geo geo() const; | 405 | Geo geo() const; |
401 | /** | 406 | /** |
402 | Return translated label for geo field. | 407 | Return translated label for geo field. |
403 | */ | 408 | */ |
404 | static QString geoLabel(); | 409 | static QString geoLabel(); |
405 | 410 | ||
406 | /** | 411 | /** |
407 | Set title. | 412 | Set title. |
408 | */ | 413 | */ |
409 | void setTitle( const QString &title ); | 414 | void setTitle( const QString &title ); |
410 | /** | 415 | /** |
411 | Return title. | 416 | Return title. |
412 | */ | 417 | */ |
413 | QString title() const; | 418 | QString title() const; |
414 | /** | 419 | /** |
415 | Return translated label for title field. | 420 | Return translated label for title field. |
416 | */ | 421 | */ |
417 | static QString titleLabel(); | 422 | static QString titleLabel(); |
418 | 423 | ||
419 | /** | 424 | /** |
420 | Set role. | 425 | Set role. |
421 | */ | 426 | */ |
422 | void setRole( const QString &role ); | 427 | void setRole( const QString &role ); |
423 | /** | 428 | /** |
424 | Return role. | 429 | Return role. |
425 | */ | 430 | */ |
426 | QString role() const; | 431 | QString role() const; |
427 | /** | 432 | /** |
428 | Return translated label for role field. | 433 | Return translated label for role field. |
429 | */ | 434 | */ |
430 | static QString roleLabel(); | 435 | static QString roleLabel(); |
431 | 436 | ||
432 | /** | 437 | /** |
433 | Set organization. | 438 | Set organization. |
434 | */ | 439 | */ |
435 | void setOrganization( const QString &organization ); | 440 | void setOrganization( const QString &organization ); |
436 | /** | 441 | /** |
437 | Return organization. | 442 | Return organization. |
438 | */ | 443 | */ |
439 | QString organization() const; | 444 | QString organization() const; |
440 | /** | 445 | /** |
441 | Return translated label for organization field. | 446 | Return translated label for organization field. |
442 | */ | 447 | */ |
443 | static QString organizationLabel(); | 448 | static QString organizationLabel(); |
444 | 449 | ||
445 | /** | 450 | /** |
446 | Set note. | 451 | Set note. |
447 | */ | 452 | */ |
448 | void setNote( const QString ¬e ); | 453 | void setNote( const QString ¬e ); |
449 | /** | 454 | /** |
450 | Return note. | 455 | Return note. |
451 | */ | 456 | */ |
452 | QString note() const; | 457 | QString note() const; |
453 | /** | 458 | /** |
454 | Return translated label for note field. | 459 | Return translated label for note field. |
455 | */ | 460 | */ |
456 | static QString noteLabel(); | 461 | static QString noteLabel(); |
457 | 462 | ||
458 | /** | 463 | /** |
diff --git a/kabc/field.cpp b/kabc/field.cpp index 89d0b77..5c561c3 100644 --- a/kabc/field.cpp +++ b/kabc/field.cpp | |||
@@ -1,546 +1,564 @@ | |||
1 | /*** Warning! This file has been generated by the script makeaddressee ***/ | 1 | /*** Warning! This file has been generated by the script makeaddressee ***/ |
2 | /* | 2 | /* |
3 | This file is part of libkabc. | 3 | This file is part of libkabc. |
4 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | Enhanced Version of the file for platform independent KDE tools. | 23 | Enhanced Version of the file for platform independent KDE tools. |
24 | Copyright (c) 2004 Ulf Schenk | 24 | Copyright (c) 2004 Ulf Schenk |
25 | 25 | ||
26 | $Id$ | 26 | $Id$ |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | #include <kconfig.h> | 30 | #include <kconfig.h> |
31 | #include <kconfigbase.h> | 31 | #include <kconfigbase.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | 33 | ||
34 | #include "field.h" | 34 | #include "field.h" |
35 | #include "resource.h" | 35 | #include "resource.h" |
36 | 36 | ||
37 | using namespace KABC; | 37 | using namespace KABC; |
38 | 38 | ||
39 | class Field::FieldImpl | 39 | class Field::FieldImpl |
40 | { | 40 | { |
41 | public: | 41 | public: |
42 | FieldImpl( int fieldId, int category = 0, | 42 | FieldImpl( int fieldId, int category = 0, |
43 | const QString &label = QString::null, | 43 | const QString &label = QString::null, |
44 | const QString &key = QString::null, | 44 | const QString &key = QString::null, |
45 | const QString &app = QString::null ) | 45 | const QString &app = QString::null ) |
46 | : mFieldId( fieldId ), mCategory( category ), mLabel( label ), | 46 | : mFieldId( fieldId ), mCategory( category ), mLabel( label ), |
47 | mKey( key ), mApp( app ) {} | 47 | mKey( key ), mApp( app ) {} |
48 | 48 | ||
49 | enum FieldId | 49 | enum FieldId |
50 | { | 50 | { |
51 | CustomField, | 51 | CustomField, |
52 | FormattedName, | 52 | FormattedName, |
53 | FamilyName, | 53 | FamilyName, |
54 | GivenName, | 54 | GivenName, |
55 | AdditionalName, | 55 | AdditionalName, |
56 | Prefix, | 56 | Prefix, |
57 | Suffix, | 57 | Suffix, |
58 | NickName, | 58 | NickName, |
59 | Birthday, | 59 | Birthday, |
60 | Category, | 60 | Category, |
61 | HomeAddressStreet, | 61 | HomeAddressStreet, |
62 | HomeAddressLocality, | 62 | HomeAddressLocality, |
63 | HomeAddressRegion, | 63 | HomeAddressRegion, |
64 | HomeAddressPostalCode, | 64 | HomeAddressPostalCode, |
65 | HomeAddressCountry, | 65 | HomeAddressCountry, |
66 | HomeAddressLabel, | 66 | HomeAddressLabel, |
67 | BusinessAddressStreet, | 67 | BusinessAddressStreet, |
68 | BusinessAddressLocality, | 68 | BusinessAddressLocality, |
69 | BusinessAddressRegion, | 69 | BusinessAddressRegion, |
70 | BusinessAddressPostalCode, | 70 | BusinessAddressPostalCode, |
71 | BusinessAddressCountry, | 71 | BusinessAddressCountry, |
72 | BusinessAddressLabel, | 72 | BusinessAddressLabel, |
73 | HomePhone, | 73 | HomePhone, |
74 | BusinessPhone, | 74 | BusinessPhone, |
75 | MobilePhone, | 75 | MobilePhone, |
76 | HomeFax, | 76 | HomeFax, |
77 | BusinessFax, | 77 | BusinessFax, |
78 | CarPhone, | 78 | CarPhone, |
79 | Isdn, | 79 | Isdn, |
80 | Pager, | 80 | Pager, |
81 | Email, | 81 | Email, |
82 | Mailer, | 82 | Mailer, |
83 | Title, | 83 | Title, |
84 | Role, | 84 | Role, |
85 | Organization, | 85 | Organization, |
86 | Note, | 86 | Note, |
87 | Url, | 87 | Url, |
88 | Resource, | 88 | Resource, |
89 | Sip | 89 | Sip, |
90 | DefaultFormattedName, | ||
91 | MobileWorkPhone, | ||
92 | MobileHomePhone | ||
90 | }; | 93 | }; |
91 | 94 | ||
92 | int fieldId() { return mFieldId; } | 95 | int fieldId() { return mFieldId; } |
93 | int category() { return mCategory; } | 96 | int category() { return mCategory; } |
94 | 97 | ||
95 | QString label() { return mLabel; } | 98 | QString label() { return mLabel; } |
96 | QString key() { return mKey; } | 99 | QString key() { return mKey; } |
97 | QString app() { return mApp; } | 100 | QString app() { return mApp; } |
98 | 101 | ||
99 | private: | 102 | private: |
100 | int mFieldId; | 103 | int mFieldId; |
101 | int mCategory; | 104 | int mCategory; |
102 | 105 | ||
103 | QString mLabel; | 106 | QString mLabel; |
104 | QString mKey; | 107 | QString mKey; |
105 | QString mApp; | 108 | QString mApp; |
106 | }; | 109 | }; |
107 | 110 | ||
108 | 111 | ||
109 | Field::List Field::mAllFields; | 112 | Field::List Field::mAllFields; |
110 | Field::List Field::mDefaultFields; | 113 | Field::List Field::mDefaultFields; |
111 | Field::List Field::mCustomFields; | 114 | Field::List Field::mCustomFields; |
112 | 115 | ||
113 | 116 | ||
114 | Field::Field( FieldImpl *impl ) | 117 | Field::Field( FieldImpl *impl ) |
115 | { | 118 | { |
116 | mImpl = impl; | 119 | mImpl = impl; |
117 | } | 120 | } |
118 | 121 | ||
119 | Field::~Field() | 122 | Field::~Field() |
120 | { | 123 | { |
121 | delete mImpl; | 124 | delete mImpl; |
122 | } | 125 | } |
123 | 126 | ||
124 | QString Field::label() | 127 | QString Field::label() |
125 | { | 128 | { |
126 | switch ( mImpl->fieldId() ) { | 129 | switch ( mImpl->fieldId() ) { |
127 | case FieldImpl::FormattedName: | 130 | case FieldImpl::FormattedName: |
128 | return Addressee::formattedNameLabel(); | 131 | return Addressee::formattedNameLabel(); |
132 | case FieldImpl::DefaultFormattedName: | ||
133 | return Addressee::defaultFormattedNameLabel(); | ||
129 | case FieldImpl::FamilyName: | 134 | case FieldImpl::FamilyName: |
130 | return Addressee::familyNameLabel(); | 135 | return Addressee::familyNameLabel(); |
131 | case FieldImpl::GivenName: | 136 | case FieldImpl::GivenName: |
132 | return Addressee::givenNameLabel(); | 137 | return Addressee::givenNameLabel(); |
133 | case FieldImpl::AdditionalName: | 138 | case FieldImpl::AdditionalName: |
134 | return Addressee::additionalNameLabel(); | 139 | return Addressee::additionalNameLabel(); |
135 | case FieldImpl::Prefix: | 140 | case FieldImpl::Prefix: |
136 | return Addressee::prefixLabel(); | 141 | return Addressee::prefixLabel(); |
137 | case FieldImpl::Suffix: | 142 | case FieldImpl::Suffix: |
138 | return Addressee::suffixLabel(); | 143 | return Addressee::suffixLabel(); |
139 | case FieldImpl::NickName: | 144 | case FieldImpl::NickName: |
140 | return Addressee::nickNameLabel(); | 145 | return Addressee::nickNameLabel(); |
141 | case FieldImpl::Birthday: | 146 | case FieldImpl::Birthday: |
142 | return Addressee::birthdayLabel(); | 147 | return Addressee::birthdayLabel(); |
143 | case FieldImpl::HomeAddressStreet: | 148 | case FieldImpl::HomeAddressStreet: |
144 | return Addressee::homeAddressStreetLabel(); | 149 | return Addressee::homeAddressStreetLabel(); |
145 | case FieldImpl::HomeAddressLocality: | 150 | case FieldImpl::HomeAddressLocality: |
146 | return Addressee::homeAddressLocalityLabel(); | 151 | return Addressee::homeAddressLocalityLabel(); |
147 | case FieldImpl::HomeAddressRegion: | 152 | case FieldImpl::HomeAddressRegion: |
148 | return Addressee::homeAddressRegionLabel(); | 153 | return Addressee::homeAddressRegionLabel(); |
149 | case FieldImpl::HomeAddressPostalCode: | 154 | case FieldImpl::HomeAddressPostalCode: |
150 | return Addressee::homeAddressPostalCodeLabel(); | 155 | return Addressee::homeAddressPostalCodeLabel(); |
151 | case FieldImpl::HomeAddressCountry: | 156 | case FieldImpl::HomeAddressCountry: |
152 | return Addressee::homeAddressCountryLabel(); | 157 | return Addressee::homeAddressCountryLabel(); |
153 | case FieldImpl::HomeAddressLabel: | 158 | case FieldImpl::HomeAddressLabel: |
154 | return Addressee::homeAddressLabelLabel(); | 159 | return Addressee::homeAddressLabelLabel(); |
155 | case FieldImpl::BusinessAddressStreet: | 160 | case FieldImpl::BusinessAddressStreet: |
156 | return Addressee::businessAddressStreetLabel(); | 161 | return Addressee::businessAddressStreetLabel(); |
157 | case FieldImpl::BusinessAddressLocality: | 162 | case FieldImpl::BusinessAddressLocality: |
158 | return Addressee::businessAddressLocalityLabel(); | 163 | return Addressee::businessAddressLocalityLabel(); |
159 | case FieldImpl::BusinessAddressRegion: | 164 | case FieldImpl::BusinessAddressRegion: |
160 | return Addressee::businessAddressRegionLabel(); | 165 | return Addressee::businessAddressRegionLabel(); |
161 | case FieldImpl::BusinessAddressPostalCode: | 166 | case FieldImpl::BusinessAddressPostalCode: |
162 | return Addressee::businessAddressPostalCodeLabel(); | 167 | return Addressee::businessAddressPostalCodeLabel(); |
163 | case FieldImpl::BusinessAddressCountry: | 168 | case FieldImpl::BusinessAddressCountry: |
164 | return Addressee::businessAddressCountryLabel(); | 169 | return Addressee::businessAddressCountryLabel(); |
165 | case FieldImpl::BusinessAddressLabel: | 170 | case FieldImpl::BusinessAddressLabel: |
166 | return Addressee::businessAddressLabelLabel(); | 171 | return Addressee::businessAddressLabelLabel(); |
167 | case FieldImpl::HomePhone: | 172 | case FieldImpl::HomePhone: |
168 | return Addressee::homePhoneLabel(); | 173 | return Addressee::homePhoneLabel(); |
169 | case FieldImpl::BusinessPhone: | 174 | case FieldImpl::BusinessPhone: |
170 | return Addressee::businessPhoneLabel(); | 175 | return Addressee::businessPhoneLabel(); |
171 | case FieldImpl::MobilePhone: | 176 | case FieldImpl::MobilePhone: |
172 | return Addressee::mobilePhoneLabel(); | 177 | return Addressee::mobilePhoneLabel(); |
178 | case FieldImpl::MobileHomePhone: | ||
179 | return Addressee::mobileHomePhoneLabel(); | ||
180 | case FieldImpl::MobileWorkPhone: | ||
181 | return Addressee::mobileWorkPhoneLabel(); | ||
173 | case FieldImpl::HomeFax: | 182 | case FieldImpl::HomeFax: |
174 | return Addressee::homeFaxLabel(); | 183 | return Addressee::homeFaxLabel(); |
175 | case FieldImpl::BusinessFax: | 184 | case FieldImpl::BusinessFax: |
176 | return Addressee::businessFaxLabel(); | 185 | return Addressee::businessFaxLabel(); |
177 | case FieldImpl::CarPhone: | 186 | case FieldImpl::CarPhone: |
178 | return Addressee::carPhoneLabel(); | 187 | return Addressee::carPhoneLabel(); |
179 | case FieldImpl::Isdn: | 188 | case FieldImpl::Isdn: |
180 | return Addressee::isdnLabel(); | 189 | return Addressee::isdnLabel(); |
181 | case FieldImpl::Pager: | 190 | case FieldImpl::Pager: |
182 | return Addressee::pagerLabel(); | 191 | return Addressee::pagerLabel(); |
183 | case FieldImpl::Email: | 192 | case FieldImpl::Email: |
184 | return Addressee::emailLabel(); | 193 | return Addressee::emailLabel(); |
185 | case FieldImpl::Mailer: | 194 | case FieldImpl::Mailer: |
186 | return Addressee::mailerLabel(); | 195 | return Addressee::mailerLabel(); |
187 | case FieldImpl::Title: | 196 | case FieldImpl::Title: |
188 | return Addressee::titleLabel(); | 197 | return Addressee::titleLabel(); |
189 | case FieldImpl::Role: | 198 | case FieldImpl::Role: |
190 | return Addressee::roleLabel(); | 199 | return Addressee::roleLabel(); |
191 | case FieldImpl::Organization: | 200 | case FieldImpl::Organization: |
192 | return Addressee::organizationLabel(); | 201 | return Addressee::organizationLabel(); |
193 | case FieldImpl::Note: | 202 | case FieldImpl::Note: |
194 | return Addressee::noteLabel(); | 203 | return Addressee::noteLabel(); |
195 | case FieldImpl::Url: | 204 | case FieldImpl::Url: |
196 | return Addressee::urlLabel(); | 205 | return Addressee::urlLabel(); |
197 | case FieldImpl::Resource: | 206 | case FieldImpl::Resource: |
198 | return Addressee::resourceLabel(); | 207 | return Addressee::resourceLabel(); |
199 | case FieldImpl::Category: | 208 | case FieldImpl::Category: |
200 | return Addressee::categoryLabel(); | 209 | return Addressee::categoryLabel(); |
201 | case FieldImpl::Sip: | 210 | case FieldImpl::Sip: |
202 | return Addressee::sipLabel(); | 211 | return Addressee::sipLabel(); |
203 | case FieldImpl::CustomField: | 212 | case FieldImpl::CustomField: |
204 | return mImpl->label(); | 213 | return mImpl->label(); |
205 | default: | 214 | default: |
206 | return i18n("Unknown Field"); | 215 | return i18n("Unknown Field"); |
207 | } | 216 | } |
208 | } | 217 | } |
209 | 218 | ||
210 | int Field::category() | 219 | int Field::category() |
211 | { | 220 | { |
212 | return mImpl->category(); | 221 | return mImpl->category(); |
213 | } | 222 | } |
214 | 223 | ||
215 | QString Field::categoryLabel( int category ) | 224 | QString Field::categoryLabel( int category ) |
216 | { | 225 | { |
217 | switch ( category ) { | 226 | switch ( category ) { |
218 | case All: | 227 | case All: |
219 | return i18n("All"); | 228 | return i18n("All"); |
220 | case Frequent: | 229 | case Frequent: |
221 | return i18n("Frequent"); | 230 | return i18n("Frequent"); |
222 | case Address: | 231 | case Address: |
223 | return i18n("Address"); | 232 | return i18n("Address"); |
224 | case Email: | 233 | case Email: |
225 | return i18n("Email"); | 234 | return i18n("Email"); |
226 | case Personal: | 235 | case Personal: |
227 | return i18n("Personal"); | 236 | return i18n("Personal"); |
228 | case Organization: | 237 | case Organization: |
229 | return i18n("Organization"); | 238 | return i18n("Organization"); |
230 | case CustomCategory: | 239 | case CustomCategory: |
231 | return i18n("Custom"); | 240 | return i18n("Custom"); |
232 | default: | 241 | default: |
233 | return i18n("Undefined"); | 242 | return i18n("Undefined"); |
234 | } | 243 | } |
235 | } | 244 | } |
236 | 245 | ||
237 | QString Field::value( const KABC::Addressee &a ) | 246 | QString Field::value( const KABC::Addressee &a ) |
238 | { | 247 | { |
239 | switch ( mImpl->fieldId() ) { | 248 | switch ( mImpl->fieldId() ) { |
240 | case FieldImpl::FormattedName: | 249 | case FieldImpl::FormattedName: |
241 | return a.formattedName(); | 250 | return a.formattedName(); |
251 | case FieldImpl::DefaultFormattedName: | ||
252 | return a.defaultFormattedName(); | ||
242 | case FieldImpl::FamilyName: | 253 | case FieldImpl::FamilyName: |
243 | return a.familyName(); | 254 | return a.familyName(); |
244 | case FieldImpl::GivenName: | 255 | case FieldImpl::GivenName: |
245 | return a.givenName(); | 256 | return a.givenName(); |
246 | case FieldImpl::AdditionalName: | 257 | case FieldImpl::AdditionalName: |
247 | return a.additionalName(); | 258 | return a.additionalName(); |
248 | case FieldImpl::Prefix: | 259 | case FieldImpl::Prefix: |
249 | return a.prefix(); | 260 | return a.prefix(); |
250 | case FieldImpl::Suffix: | 261 | case FieldImpl::Suffix: |
251 | return a.suffix(); | 262 | return a.suffix(); |
252 | case FieldImpl::NickName: | 263 | case FieldImpl::NickName: |
253 | return a.nickName(); | 264 | return a.nickName(); |
254 | case FieldImpl::Mailer: | 265 | case FieldImpl::Mailer: |
255 | return a.mailer(); | 266 | return a.mailer(); |
256 | case FieldImpl::Title: | 267 | case FieldImpl::Title: |
257 | return a.title(); | 268 | return a.title(); |
258 | case FieldImpl::Role: | 269 | case FieldImpl::Role: |
259 | return a.role(); | 270 | return a.role(); |
260 | case FieldImpl::Organization: | 271 | case FieldImpl::Organization: |
261 | return a.organization(); | 272 | return a.organization(); |
262 | case FieldImpl::Note: | 273 | case FieldImpl::Note: |
263 | return a.note(); | 274 | return a.note(); |
264 | case FieldImpl::Email: | 275 | case FieldImpl::Email: |
265 | return a.preferredEmail(); | 276 | return a.preferredEmail(); |
266 | case FieldImpl::Birthday: | 277 | case FieldImpl::Birthday: |
267 | if ( a.birthday().isValid() ) { | 278 | if ( a.birthday().isValid() ) { |
268 | //the generated code had the following format: return a.birthday().date().toString( Qt::ISODate ); | 279 | //the generated code had the following format: return a.birthday().date().toString( Qt::ISODate ); |
269 | // But Qt::IsoDate was not specified. | 280 | // But Qt::IsoDate was not specified. |
270 | // QString _oldFormat = KGlobal::locale()->dateFormat(); | 281 | // QString _oldFormat = KGlobal::locale()->dateFormat(); |
271 | // KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate | 282 | // KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate |
272 | QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false, KLocale::ISODate); | 283 | QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false, KLocale::ISODate); |
273 | // KGlobal::locale()->setDateFormat(_oldFormat); | 284 | // KGlobal::locale()->setDateFormat(_oldFormat); |
274 | return dt; | 285 | return dt; |
275 | } | 286 | } |
276 | else | 287 | else |
277 | return QString::null; | 288 | return QString::null; |
278 | case FieldImpl::Url: | 289 | case FieldImpl::Url: |
279 | return a.url().prettyURL(); | 290 | return a.url().prettyURL(); |
280 | //US | 291 | //US |
281 | case FieldImpl::Resource: | 292 | case FieldImpl::Resource: |
282 | return a.resource()->resourceName(); | 293 | return a.resource()->resourceName(); |
283 | case FieldImpl::Category: | 294 | case FieldImpl::Category: |
284 | return a.categories().join(","); | 295 | return a.categories().join(","); |
285 | case FieldImpl::HomePhone: | 296 | case FieldImpl::HomePhone: |
286 | return a.phoneNumber( PhoneNumber::Home ).number(); | 297 | return a.phoneNumber( PhoneNumber::Home ).number(); |
287 | case FieldImpl::BusinessPhone: | 298 | case FieldImpl::BusinessPhone: |
288 | return a.phoneNumber( PhoneNumber::Work ).number(); | 299 | return a.phoneNumber( PhoneNumber::Work ).number(); |
289 | case FieldImpl::MobilePhone: | 300 | case FieldImpl::MobilePhone: |
290 | return a.phoneNumber( PhoneNumber::Cell ).number(); | 301 | return a.phoneNumber( PhoneNumber::Cell ).number(); |
302 | case FieldImpl::MobileWorkPhone: | ||
303 | return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Work ).number(); | ||
304 | case FieldImpl::MobileHomePhone: | ||
305 | return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Home ).number(); | ||
291 | case FieldImpl::HomeFax: | 306 | case FieldImpl::HomeFax: |
292 | return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); | 307 | return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); |
293 | case FieldImpl::BusinessFax: | 308 | case FieldImpl::BusinessFax: |
294 | return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); | 309 | return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); |
295 | case FieldImpl::CarPhone: | 310 | case FieldImpl::CarPhone: |
296 | return a.phoneNumber( PhoneNumber::Car ).number(); | 311 | return a.phoneNumber( PhoneNumber::Car ).number(); |
297 | case FieldImpl::Isdn: | 312 | case FieldImpl::Isdn: |
298 | return a.phoneNumber( PhoneNumber::Isdn ).number(); | 313 | return a.phoneNumber( PhoneNumber::Isdn ).number(); |
299 | case FieldImpl::Pager: | 314 | case FieldImpl::Pager: |
300 | return a.phoneNumber( PhoneNumber::Pager ).number(); | 315 | return a.phoneNumber( PhoneNumber::Pager ).number(); |
301 | case FieldImpl::Sip: | 316 | case FieldImpl::Sip: |
302 | return a.phoneNumber( PhoneNumber::Sip ).number(); | 317 | return a.phoneNumber( PhoneNumber::Sip ).number(); |
303 | case FieldImpl::HomeAddressStreet: | 318 | case FieldImpl::HomeAddressStreet: |
304 | return a.address( Address::Home ).street(); | 319 | return a.address( Address::Home ).street(); |
305 | case FieldImpl::HomeAddressLocality: | 320 | case FieldImpl::HomeAddressLocality: |
306 | return a.address( Address::Home ).locality(); | 321 | return a.address( Address::Home ).locality(); |
307 | case FieldImpl::HomeAddressRegion: | 322 | case FieldImpl::HomeAddressRegion: |
308 | return a.address( Address::Home ).region(); | 323 | return a.address( Address::Home ).region(); |
309 | case FieldImpl::HomeAddressPostalCode: | 324 | case FieldImpl::HomeAddressPostalCode: |
310 | return a.address( Address::Home ).postalCode(); | 325 | return a.address( Address::Home ).postalCode(); |
311 | case FieldImpl::HomeAddressCountry: | 326 | case FieldImpl::HomeAddressCountry: |
312 | return a.address( Address::Home ).country(); | 327 | return a.address( Address::Home ).country(); |
313 | case FieldImpl::BusinessAddressStreet: | 328 | case FieldImpl::BusinessAddressStreet: |
314 | return a.address( Address::Work ).street(); | 329 | return a.address( Address::Work ).street(); |
315 | case FieldImpl::BusinessAddressLocality: | 330 | case FieldImpl::BusinessAddressLocality: |
316 | return a.address( Address::Work ).locality(); | 331 | return a.address( Address::Work ).locality(); |
317 | case FieldImpl::BusinessAddressRegion: | 332 | case FieldImpl::BusinessAddressRegion: |
318 | return a.address( Address::Work ).region(); | 333 | return a.address( Address::Work ).region(); |
319 | case FieldImpl::BusinessAddressPostalCode: | 334 | case FieldImpl::BusinessAddressPostalCode: |
320 | return a.address( Address::Work ).postalCode(); | 335 | return a.address( Address::Work ).postalCode(); |
321 | case FieldImpl::BusinessAddressCountry: | 336 | case FieldImpl::BusinessAddressCountry: |
322 | return a.address( Address::Work ).country(); | 337 | return a.address( Address::Work ).country(); |
323 | case FieldImpl::CustomField: | 338 | case FieldImpl::CustomField: |
324 | return a.custom( mImpl->app(), mImpl->key() ); | 339 | return a.custom( mImpl->app(), mImpl->key() ); |
325 | default: | 340 | default: |
326 | return QString::null; | 341 | return QString::null; |
327 | } | 342 | } |
328 | } | 343 | } |
329 | 344 | ||
330 | bool Field::setValue( KABC::Addressee &a, const QString &value ) | 345 | bool Field::setValue( KABC::Addressee &a, const QString &value ) |
331 | { | 346 | { |
332 | switch ( mImpl->fieldId() ) { | 347 | switch ( mImpl->fieldId() ) { |
333 | case FieldImpl::FormattedName: | 348 | case FieldImpl::FormattedName: |
334 | a.setFormattedName( value ); | 349 | a.setFormattedName( value ); |
335 | return true; | 350 | return true; |
336 | case FieldImpl::FamilyName: | 351 | case FieldImpl::FamilyName: |
337 | a.setFamilyName( value ); | 352 | a.setFamilyName( value ); |
338 | return true; | 353 | return true; |
339 | case FieldImpl::GivenName: | 354 | case FieldImpl::GivenName: |
340 | a.setGivenName( value ); | 355 | a.setGivenName( value ); |
341 | return true; | 356 | return true; |
342 | case FieldImpl::AdditionalName: | 357 | case FieldImpl::AdditionalName: |
343 | a.setAdditionalName( value ); | 358 | a.setAdditionalName( value ); |
344 | return true; | 359 | return true; |
345 | case FieldImpl::Prefix: | 360 | case FieldImpl::Prefix: |
346 | a.setPrefix( value ); | 361 | a.setPrefix( value ); |
347 | return true; | 362 | return true; |
348 | case FieldImpl::Suffix: | 363 | case FieldImpl::Suffix: |
349 | a.setSuffix( value ); | 364 | a.setSuffix( value ); |
350 | return true; | 365 | return true; |
351 | case FieldImpl::NickName: | 366 | case FieldImpl::NickName: |
352 | a.setNickName( value ); | 367 | a.setNickName( value ); |
353 | return true; | 368 | return true; |
354 | case FieldImpl::Mailer: | 369 | case FieldImpl::Mailer: |
355 | a.setMailer( value ); | 370 | a.setMailer( value ); |
356 | return true; | 371 | return true; |
357 | case FieldImpl::Title: | 372 | case FieldImpl::Title: |
358 | a.setTitle( value ); | 373 | a.setTitle( value ); |
359 | return true; | 374 | return true; |
360 | case FieldImpl::Role: | 375 | case FieldImpl::Role: |
361 | a.setRole( value ); | 376 | a.setRole( value ); |
362 | return true; | 377 | return true; |
363 | case FieldImpl::Organization: | 378 | case FieldImpl::Organization: |
364 | a.setOrganization( value ); | 379 | a.setOrganization( value ); |
365 | return true; | 380 | return true; |
366 | case FieldImpl::Note: | 381 | case FieldImpl::Note: |
367 | a.setNote( value ); | 382 | a.setNote( value ); |
368 | return true; | 383 | return true; |
369 | case FieldImpl::Birthday: | 384 | case FieldImpl::Birthday: |
370 | //US | 385 | //US |
371 | //the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); | 386 | //the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); |
372 | // But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? | 387 | // But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? |
373 | { | 388 | { |
374 | QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate | 389 | QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate |
375 | a.setBirthday(dt); | 390 | a.setBirthday(dt); |
376 | } | 391 | } |
377 | return true; | 392 | return true; |
378 | case FieldImpl::CustomField: | 393 | case FieldImpl::CustomField: |
379 | a.insertCustom( mImpl->app(), mImpl->key(), value ); | 394 | a.insertCustom( mImpl->app(), mImpl->key(), value ); |
380 | //US never copy the resourcename back to the adressee. | 395 | //US never copy the resourcename back to the adressee. |
381 | case FieldImpl::Resource: | 396 | case FieldImpl::Resource: |
382 | default: | 397 | default: |
383 | return false; | 398 | return false; |
384 | } | 399 | } |
385 | } | 400 | } |
386 | 401 | ||
387 | bool Field::isCustom() | 402 | bool Field::isCustom() |
388 | { | 403 | { |
389 | return mImpl->fieldId() == FieldImpl::CustomField; | 404 | return mImpl->fieldId() == FieldImpl::CustomField; |
390 | } | 405 | } |
391 | 406 | ||
392 | Field::List Field::allFields() | 407 | Field::List Field::allFields() |
393 | { | 408 | { |
394 | if ( mAllFields.isEmpty() ) { | 409 | if ( mAllFields.isEmpty() ) { |
395 | createField( FieldImpl::FormattedName, Frequent ); | 410 | createField( FieldImpl::FormattedName, Frequent ); |
411 | createField( FieldImpl::DefaultFormattedName, Frequent ); | ||
396 | createField( FieldImpl::FamilyName, Frequent ); | 412 | createField( FieldImpl::FamilyName, Frequent ); |
397 | createField( FieldImpl::GivenName, Frequent ); | 413 | createField( FieldImpl::GivenName, Frequent ); |
398 | createField( FieldImpl::AdditionalName ); | 414 | createField( FieldImpl::AdditionalName ); |
399 | createField( FieldImpl::Prefix ); | 415 | createField( FieldImpl::Prefix ); |
400 | createField( FieldImpl::Suffix ); | 416 | createField( FieldImpl::Suffix ); |
401 | createField( FieldImpl::NickName, Personal ); | 417 | createField( FieldImpl::NickName, Personal ); |
402 | createField( FieldImpl::Birthday, Personal ); | 418 | createField( FieldImpl::Birthday, Personal ); |
403 | createField( FieldImpl::Category ); | 419 | createField( FieldImpl::Category ); |
404 | createField( FieldImpl::HomeAddressStreet, Address|Personal ); | 420 | createField( FieldImpl::HomeAddressStreet, Address|Personal ); |
405 | createField( FieldImpl::HomeAddressLocality, Address|Personal ); | 421 | createField( FieldImpl::HomeAddressLocality, Address|Personal ); |
406 | createField( FieldImpl::HomeAddressRegion, Address|Personal ); | 422 | createField( FieldImpl::HomeAddressRegion, Address|Personal ); |
407 | createField( FieldImpl::HomeAddressPostalCode, Address|Personal ); | 423 | createField( FieldImpl::HomeAddressPostalCode, Address|Personal ); |
408 | createField( FieldImpl::HomeAddressCountry, Address|Personal ); | 424 | createField( FieldImpl::HomeAddressCountry, Address|Personal ); |
409 | createField( FieldImpl::HomeAddressLabel, Address|Personal ); | 425 | createField( FieldImpl::HomeAddressLabel, Address|Personal ); |
410 | createField( FieldImpl::BusinessAddressStreet, Address|Organization ); | 426 | createField( FieldImpl::BusinessAddressStreet, Address|Organization ); |
411 | createField( FieldImpl::BusinessAddressLocality, Address|Organization ); | 427 | createField( FieldImpl::BusinessAddressLocality, Address|Organization ); |
412 | createField( FieldImpl::BusinessAddressRegion, Address|Organization ); | 428 | createField( FieldImpl::BusinessAddressRegion, Address|Organization ); |
413 | createField( FieldImpl::BusinessAddressPostalCode, Address|Organization ); | 429 | createField( FieldImpl::BusinessAddressPostalCode, Address|Organization ); |
414 | createField( FieldImpl::BusinessAddressCountry, Address|Organization ); | 430 | createField( FieldImpl::BusinessAddressCountry, Address|Organization ); |
415 | createField( FieldImpl::BusinessAddressLabel, Address|Organization ); | 431 | createField( FieldImpl::BusinessAddressLabel, Address|Organization ); |
416 | createField( FieldImpl::HomePhone, Personal|Frequent ); | 432 | createField( FieldImpl::HomePhone, Personal|Frequent ); |
417 | createField( FieldImpl::BusinessPhone, Organization|Frequent ); | 433 | createField( FieldImpl::BusinessPhone, Organization|Frequent ); |
418 | createField( FieldImpl::MobilePhone, Frequent ); | 434 | createField( FieldImpl::MobilePhone, Frequent ); |
435 | createField( FieldImpl::MobileHomePhone, Frequent ); | ||
436 | createField( FieldImpl::MobileWorkPhone, Frequent ); | ||
419 | createField( FieldImpl::HomeFax ); | 437 | createField( FieldImpl::HomeFax ); |
420 | createField( FieldImpl::BusinessFax ); | 438 | createField( FieldImpl::BusinessFax ); |
421 | createField( FieldImpl::CarPhone ); | 439 | createField( FieldImpl::CarPhone ); |
422 | createField( FieldImpl::Isdn ); | 440 | createField( FieldImpl::Isdn ); |
423 | createField( FieldImpl::Pager ); | 441 | createField( FieldImpl::Pager ); |
424 | createField( FieldImpl::Email, Email|Frequent ); | 442 | createField( FieldImpl::Email, Email|Frequent ); |
425 | createField( FieldImpl::Mailer, Email ); | 443 | createField( FieldImpl::Mailer, Email ); |
426 | createField( FieldImpl::Title, Organization ); | 444 | createField( FieldImpl::Title, Organization ); |
427 | createField( FieldImpl::Role, Organization ); | 445 | createField( FieldImpl::Role, Organization ); |
428 | createField( FieldImpl::Organization, Organization ); | 446 | createField( FieldImpl::Organization, Organization ); |
429 | createField( FieldImpl::Note ); | 447 | createField( FieldImpl::Note ); |
430 | createField( FieldImpl::Url ); | 448 | createField( FieldImpl::Url ); |
431 | createField( FieldImpl::Resource ); | 449 | createField( FieldImpl::Resource ); |
432 | createField( FieldImpl::Sip ); | 450 | createField( FieldImpl::Sip ); |
433 | } | 451 | } |
434 | 452 | ||
435 | return mAllFields; | 453 | return mAllFields; |
436 | } | 454 | } |
437 | 455 | ||
438 | Field::List Field::defaultFields() | 456 | Field::List Field::defaultFields() |
439 | { | 457 | { |
440 | if ( mDefaultFields.isEmpty() ) { | 458 | if ( mDefaultFields.isEmpty() ) { |
441 | createDefaultField( FieldImpl::GivenName ); | 459 | createDefaultField( FieldImpl::GivenName ); |
442 | createDefaultField( FieldImpl::FamilyName ); | 460 | createDefaultField( FieldImpl::FamilyName ); |
443 | createDefaultField( FieldImpl::Email ); | 461 | createDefaultField( FieldImpl::Email ); |
444 | } | 462 | } |
445 | 463 | ||
446 | return mDefaultFields; | 464 | return mDefaultFields; |
447 | } | 465 | } |
448 | 466 | ||
449 | void Field::createField( int id, int category ) | 467 | void Field::createField( int id, int category ) |
450 | { | 468 | { |
451 | mAllFields.append( new Field( new FieldImpl( id, category ) ) ); | 469 | mAllFields.append( new Field( new FieldImpl( id, category ) ) ); |
452 | } | 470 | } |
453 | 471 | ||
454 | void Field::createDefaultField( int id, int category ) | 472 | void Field::createDefaultField( int id, int category ) |
455 | { | 473 | { |
456 | mDefaultFields.append( new Field( new FieldImpl( id, category ) ) ); | 474 | mDefaultFields.append( new Field( new FieldImpl( id, category ) ) ); |
457 | } | 475 | } |
458 | 476 | ||
459 | void Field::deleteFields() | 477 | void Field::deleteFields() |
460 | { | 478 | { |
461 | Field::List::ConstIterator it; | 479 | Field::List::ConstIterator it; |
462 | 480 | ||
463 | for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) { | 481 | for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) { |
464 | delete (*it); | 482 | delete (*it); |
465 | } | 483 | } |
466 | mAllFields.clear(); | 484 | mAllFields.clear(); |
467 | 485 | ||
468 | for( it = mDefaultFields.begin(); it != mDefaultFields.end(); ++it ) { | 486 | for( it = mDefaultFields.begin(); it != mDefaultFields.end(); ++it ) { |
469 | delete (*it); | 487 | delete (*it); |
470 | } | 488 | } |
471 | mDefaultFields.clear(); | 489 | mDefaultFields.clear(); |
472 | 490 | ||
473 | for( it = mCustomFields.begin(); it != mCustomFields.end(); ++it ) { | 491 | for( it = mCustomFields.begin(); it != mCustomFields.end(); ++it ) { |
474 | delete (*it); | 492 | delete (*it); |
475 | } | 493 | } |
476 | mCustomFields.clear(); | 494 | mCustomFields.clear(); |
477 | } | 495 | } |
478 | 496 | ||
479 | void Field::saveFields( const QString &identifier, | 497 | void Field::saveFields( const QString &identifier, |
480 | const Field::List &fields ) | 498 | const Field::List &fields ) |
481 | { | 499 | { |
482 | KConfig *cfg = KGlobal::config(); | 500 | KConfig *cfg = KGlobal::config(); |
483 | KConfigGroupSaver( cfg, "KABCFields" ); | 501 | KConfigGroupSaver( cfg, "KABCFields" ); |
484 | saveFields( cfg, identifier, fields ); | 502 | saveFields( cfg, identifier, fields ); |
485 | } | 503 | } |
486 | 504 | ||
487 | void Field::saveFields( KConfig *cfg, const QString &identifier, | 505 | void Field::saveFields( KConfig *cfg, const QString &identifier, |
488 | const Field::List &fields ) | 506 | const Field::List &fields ) |
489 | { | 507 | { |
490 | QValueList<int> fieldIds; | 508 | QValueList<int> fieldIds; |
491 | 509 | ||
492 | //US | 510 | //US |
493 | // qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1()); | 511 | // qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1()); |
494 | 512 | ||
495 | int custom = 0; | 513 | int custom = 0; |
496 | Field::List::ConstIterator it; | 514 | Field::List::ConstIterator it; |
497 | for( it = fields.begin(); it != fields.end(); ++it ) { | 515 | for( it = fields.begin(); it != fields.end(); ++it ) { |
498 | //US | 516 | //US |
499 | // qDebug("Field::saveFields field:%i", (*it)->mImpl->fieldId()); | 517 | // qDebug("Field::saveFields field:%i", (*it)->mImpl->fieldId()); |
500 | 518 | ||
501 | fieldIds.append( (*it)->mImpl->fieldId() ); | 519 | fieldIds.append( (*it)->mImpl->fieldId() ); |
502 | if( (*it)->isCustom() ) { | 520 | if( (*it)->isCustom() ) { |
503 | QStringList customEntry; | 521 | QStringList customEntry; |
504 | customEntry << (*it)->mImpl->label(); | 522 | customEntry << (*it)->mImpl->label(); |
505 | customEntry << (*it)->mImpl->key(); | 523 | customEntry << (*it)->mImpl->key(); |
506 | customEntry << (*it)->mImpl->app(); | 524 | customEntry << (*it)->mImpl->app(); |
507 | cfg->writeEntry( "KABC_CustomEntry_" + identifier + "_" + | 525 | cfg->writeEntry( "KABC_CustomEntry_" + identifier + "_" + |
508 | QString::number( custom++ ), customEntry ); | 526 | QString::number( custom++ ), customEntry ); |
509 | } | 527 | } |
510 | } | 528 | } |
511 | cfg->writeEntry( identifier, fieldIds ); | 529 | cfg->writeEntry( identifier, fieldIds ); |
512 | } | 530 | } |
513 | 531 | ||
514 | Field::List Field::restoreFields( const QString &identifier ) | 532 | Field::List Field::restoreFields( const QString &identifier ) |
515 | { | 533 | { |
516 | //US | 534 | //US |
517 | // qDebug("Field::restoreFields, identifier: %s", identifier.latin1()); | 535 | // qDebug("Field::restoreFields, identifier: %s", identifier.latin1()); |
518 | 536 | ||
519 | KConfig *cfg = KGlobal::config(); | 537 | KConfig *cfg = KGlobal::config(); |
520 | KConfigGroupSaver( cfg, "KABCFields" ); | 538 | KConfigGroupSaver( cfg, "KABCFields" ); |
521 | cfg->setGroup( "KABCFields" ); | 539 | cfg->setGroup( "KABCFields" ); |
522 | 540 | ||
523 | Field::List l = restoreFields( cfg, identifier ); | 541 | Field::List l = restoreFields( cfg, identifier ); |
524 | 542 | ||
525 | return l; | 543 | return l; |
526 | } | 544 | } |
527 | 545 | ||
528 | Field::List Field::restoreFields( KConfig *cfg, const QString &identifier ) | 546 | Field::List Field::restoreFields( KConfig *cfg, const QString &identifier ) |
529 | { | 547 | { |
530 | QValueList<int> fieldIds = cfg->readIntListEntry( identifier); | 548 | QValueList<int> fieldIds = cfg->readIntListEntry( identifier); |
531 | //US | 549 | //US |
532 | // qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1()); | 550 | // qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1()); |
533 | 551 | ||
534 | Field::List fields; | 552 | Field::List fields; |
535 | 553 | ||
536 | int custom = 0; | 554 | int custom = 0; |
537 | QValueList<int>::ConstIterator it; | 555 | QValueList<int>::ConstIterator it; |
538 | for( it = fieldIds.begin(); it != fieldIds.end(); ++it ) { | 556 | for( it = fieldIds.begin(); it != fieldIds.end(); ++it ) { |
539 | FieldImpl *f = 0; | 557 | FieldImpl *f = 0; |
540 | if ( (*it) == FieldImpl::CustomField ) { | 558 | if ( (*it) == FieldImpl::CustomField ) { |
541 | QStringList customEntry = cfg->readListEntry( "KABC_CustomEntry_" + | 559 | QStringList customEntry = cfg->readListEntry( "KABC_CustomEntry_" + |
542 | identifier + "_" + | 560 | identifier + "_" + |
543 | QString::number( custom++ ) ); | 561 | QString::number( custom++ ) ); |
544 | f = new FieldImpl( *it, CustomCategory, customEntry[ 0 ], | 562 | f = new FieldImpl( *it, CustomCategory, customEntry[ 0 ], |
545 | customEntry[ 1 ], customEntry[ 2 ] ); | 563 | customEntry[ 1 ], customEntry[ 2 ] ); |
546 | } else { | 564 | } else { |
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 041effc..4c6231d 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp | |||
@@ -52,185 +52,184 @@ void PhoneNumber::init() | |||
52 | { | 52 | { |
53 | mId = KApplication::randomString( 8 ); | 53 | mId = KApplication::randomString( 8 ); |
54 | } | 54 | } |
55 | 55 | ||
56 | bool PhoneNumber::operator==( const PhoneNumber &p ) const | 56 | bool PhoneNumber::operator==( const PhoneNumber &p ) const |
57 | { | 57 | { |
58 | if ( mNumber != p.mNumber ) return false; | 58 | if ( mNumber != p.mNumber ) return false; |
59 | if ( mType != p.mType ) return false; | 59 | if ( mType != p.mType ) return false; |
60 | 60 | ||
61 | return true; | 61 | return true; |
62 | } | 62 | } |
63 | 63 | ||
64 | bool PhoneNumber::operator!=( const PhoneNumber &p ) const | 64 | bool PhoneNumber::operator!=( const PhoneNumber &p ) const |
65 | { | 65 | { |
66 | return !( p == *this ); | 66 | return !( p == *this ); |
67 | } | 67 | } |
68 | 68 | ||
69 | bool PhoneNumber::simplifyNumber() | 69 | bool PhoneNumber::simplifyNumber() |
70 | { | 70 | { |
71 | QString Number; | 71 | QString Number; |
72 | int i; | 72 | int i; |
73 | Number = mNumber.stripWhiteSpace (); | 73 | Number = mNumber.stripWhiteSpace (); |
74 | mNumber = ""; | 74 | mNumber = ""; |
75 | for ( i = 0; i < Number.length(); ++i) { | 75 | for ( i = 0; i < Number.length(); ++i) { |
76 | if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' ) | 76 | if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' ) |
77 | mNumber += Number.at(i); | 77 | mNumber += Number.at(i); |
78 | } | 78 | } |
79 | return ( mNumber.length() > 0 ); | 79 | return ( mNumber.length() > 0 ); |
80 | } | 80 | } |
81 | // make cellphone compatible | 81 | // make cellphone compatible |
82 | void PhoneNumber::simplifyType() | 82 | void PhoneNumber::simplifyType() |
83 | { | 83 | { |
84 | if ( mType & Fax ) mType = Fax; | 84 | if ( mType & Fax ) mType = Fax; |
85 | else if ( mType & Cell ) mType = Cell; | 85 | else if ( mType & Cell ) mType = Cell; |
86 | else if ( mType & Work ) mType = Work ; | 86 | else if ( mType & Work ) mType = Work ; |
87 | else if ( mType & Home ) mType = Home; | 87 | else if ( mType & Home ) mType = Home; |
88 | else mType = Pref; | 88 | else mType = Pref; |
89 | } | 89 | } |
90 | bool PhoneNumber::contains( const PhoneNumber &p ) | 90 | bool PhoneNumber::contains( const PhoneNumber &p ) |
91 | { | 91 | { |
92 | PhoneNumber myself; | 92 | PhoneNumber myself; |
93 | PhoneNumber other; | 93 | PhoneNumber other; |
94 | myself = *this; | 94 | myself = *this; |
95 | other = p; | 95 | other = p; |
96 | myself.simplifyNumber(); | 96 | myself.simplifyNumber(); |
97 | other.simplifyNumber(); | 97 | other.simplifyNumber(); |
98 | if ( myself.number() != other.number ()) | 98 | if ( myself.number() != other.number ()) |
99 | return false; | 99 | return false; |
100 | myself.simplifyType(); | 100 | myself.simplifyType(); |
101 | other.simplifyType(); | 101 | other.simplifyType(); |
102 | if ( myself.type() == other.type()) | 102 | if ( myself.type() == other.type()) |
103 | return true; | 103 | return true; |
104 | return false; | 104 | return false; |
105 | } | 105 | } |
106 | 106 | ||
107 | void PhoneNumber::setId( const QString &id ) | 107 | void PhoneNumber::setId( const QString &id ) |
108 | { | 108 | { |
109 | mId = id; | 109 | mId = id; |
110 | } | 110 | } |
111 | 111 | ||
112 | QString PhoneNumber::id() const | 112 | QString PhoneNumber::id() const |
113 | { | 113 | { |
114 | return mId; | 114 | return mId; |
115 | } | 115 | } |
116 | 116 | ||
117 | void PhoneNumber::setNumber( const QString &number ) | 117 | void PhoneNumber::setNumber( const QString &number ) |
118 | { | 118 | { |
119 | mNumber = number; | 119 | mNumber = number; |
120 | } | 120 | } |
121 | 121 | ||
122 | QString PhoneNumber::number() const | 122 | QString PhoneNumber::number() const |
123 | { | 123 | { |
124 | return mNumber; | 124 | return mNumber; |
125 | } | 125 | } |
126 | 126 | ||
127 | void PhoneNumber::setType( int type ) | 127 | void PhoneNumber::setType( int type ) |
128 | { | 128 | { |
129 | mType = type; | 129 | mType = type; |
130 | } | 130 | } |
131 | 131 | ||
132 | int PhoneNumber::type() const | 132 | int PhoneNumber::type() const |
133 | { | 133 | { |
134 | return mType; | 134 | return mType; |
135 | } | 135 | } |
136 | 136 | ||
137 | QString PhoneNumber::typeLabel() const | 137 | QString PhoneNumber::typeLabel() const |
138 | { | 138 | { |
139 | QString label; | 139 | QString label; |
140 | bool first = true; | 140 | bool first = true; |
141 | 141 | ||
142 | TypeList list = typeList(); | 142 | TypeList list = typeList(); |
143 | 143 | ||
144 | TypeList::Iterator it; | 144 | TypeList::Iterator it; |
145 | for ( it = list.begin(); it != list.end(); ++it ) { | 145 | for ( it = list.begin(); it != list.end(); ++it ) { |
146 | if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { | 146 | if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { |
147 | label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); | 147 | label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); |
148 | if ( first ) | 148 | if ( first ) |
149 | first = false; | 149 | first = false; |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | return label; | 153 | return label; |
154 | } | 154 | } |
155 | 155 | ||
156 | QString PhoneNumber::label() const | 156 | QString PhoneNumber::label() const |
157 | { | 157 | { |
158 | return typeLabel( type() ); | 158 | return typeLabel( type() ); |
159 | } | 159 | } |
160 | 160 | ||
161 | PhoneNumber::TypeList PhoneNumber::typeList() | 161 | PhoneNumber::TypeList PhoneNumber::typeList() |
162 | { | 162 | { |
163 | TypeList list; | 163 | TypeList list; |
164 | 164 | ||
165 | list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video | 165 | list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video |
166 | << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip; | 166 | << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip; |
167 | 167 | ||
168 | return list; | 168 | return list; |
169 | } | 169 | } |
170 | 170 | ||
171 | QString PhoneNumber::label( int type ) | 171 | QString PhoneNumber::label( int type ) |
172 | { | 172 | { |
173 | return typeLabel( type ); | 173 | return typeLabel( type ); |
174 | } | 174 | } |
175 | 175 | ||
176 | QString PhoneNumber::typeLabel( int type ) | 176 | QString PhoneNumber::typeLabel( int type ) |
177 | { | 177 | { |
178 | QString typeString; | 178 | QString typeString; |
179 | 179 | ||
180 | |||
181 | if ((type & Cell) == Cell) | ||
182 | typeString += i18n("Mobile") +" "; | ||
180 | if ((type & Home) == Home) | 183 | if ((type & Home) == Home) |
181 | typeString += i18n("Home"); | 184 | typeString += i18n("Home")+" "; |
182 | else if ((type & Work) == Work) | 185 | else if ((type & Work) == Work) |
183 | typeString += i18n("Work"); | 186 | typeString += i18n("Work")+" "; |
184 | 187 | ||
185 | if (!typeString.isEmpty()) | 188 | if ((type & Sip) == Sip) |
186 | typeString += " "; | ||
187 | if ((type & Cell) == Cell) | ||
188 | typeString += i18n("Mobile") +" "; | ||
189 | if ((type & Sip) == Sip) | ||
190 | typeString += i18n("SIP")+" "; | 189 | typeString += i18n("SIP")+" "; |
191 | if ((type & Car) == Car) | 190 | if ((type & Car) == Car) |
192 | typeString += i18n("Car")+" "; | 191 | typeString += i18n("Car")+" "; |
193 | 192 | ||
194 | if ((type & Fax) == Fax) | 193 | if ((type & Fax) == Fax) |
195 | typeString += i18n("Fax"); | 194 | typeString += i18n("Fax"); |
196 | else if ((type & Msg) == Msg) | 195 | else if ((type & Msg) == Msg) |
197 | typeString += i18n("Messenger"); | 196 | typeString += i18n("Messenger"); |
198 | else if ((type & Video) == Video) | 197 | else if ((type & Video) == Video) |
199 | typeString += i18n("Video"); | 198 | typeString += i18n("Video"); |
200 | else if ((type & Bbs) == Bbs) | 199 | else if ((type & Bbs) == Bbs) |
201 | typeString += i18n("Mailbox"); | 200 | typeString += i18n("Mailbox"); |
202 | else if ((type & Modem) == Modem) | 201 | else if ((type & Modem) == Modem) |
203 | typeString += i18n("Modem"); | 202 | typeString += i18n("Modem"); |
204 | else if ((type & Isdn) == Isdn) | 203 | else if ((type & Isdn) == Isdn) |
205 | typeString += i18n("ISDN"); | 204 | typeString += i18n("ISDN"); |
206 | else if ((type & Pcs) == Pcs) | 205 | else if ((type & Pcs) == Pcs) |
207 | typeString += i18n("PCS"); | 206 | typeString += i18n("PCS"); |
208 | else if ((type & Pager) == Pager) | 207 | else if ((type & Pager) == Pager) |
209 | typeString += i18n("Pager"); | 208 | typeString += i18n("Pager"); |
210 | // add the prefered flag | 209 | // add the prefered flag |
211 | /* | 210 | /* |
212 | if ((type & Pref) == Pref) | 211 | if ((type & Pref) == Pref) |
213 | typeString += i18n("(p)"); | 212 | typeString += i18n("(p)"); |
214 | */ | 213 | */ |
215 | //if we still have no match, return "other" | 214 | //if we still have no match, return "other" |
216 | if (typeString.isEmpty()) { | 215 | if (typeString.isEmpty()) { |
217 | if ((type & Voice) == Voice) | 216 | if ((type & Voice) == Voice) |
218 | return i18n("Voice"); | 217 | return i18n("Voice"); |
219 | else | 218 | else |
220 | return i18n("Other"); | 219 | return i18n("Other"); |
221 | } | 220 | } |
222 | 221 | ||
223 | return typeString.stripWhiteSpace(); | 222 | return typeString.stripWhiteSpace(); |
224 | } | 223 | } |
225 | 224 | ||
226 | QDataStream &KABC::operator<<( QDataStream &s, const PhoneNumber &phone ) | 225 | QDataStream &KABC::operator<<( QDataStream &s, const PhoneNumber &phone ) |
227 | { | 226 | { |
228 | return s << phone.mId << phone.mType << phone.mNumber; | 227 | return s << phone.mId << phone.mType << phone.mNumber; |
229 | } | 228 | } |
230 | 229 | ||
231 | QDataStream &KABC::operator>>( QDataStream &s, PhoneNumber &phone ) | 230 | QDataStream &KABC::operator>>( QDataStream &s, PhoneNumber &phone ) |
232 | { | 231 | { |
233 | s >> phone.mId >> phone.mType >> phone.mNumber; | 232 | s >> phone.mId >> phone.mType >> phone.mNumber; |
234 | 233 | ||
235 | return s; | 234 | return s; |
236 | } | 235 | } |