23 #include <QtCore/QList>
24 #include <QtCore/QRegExp>
25 #include <QtCore/QSharedData>
26 #include <QtCore/QUuid>
30 #include <klocalizedstring.h>
32 #include "addresseehelper.h"
34 #ifndef KDEPIM_NO_KRESOURCES
39 #include "addressee.h"
43 static bool matchBinaryPattern(
int value,
int pattern );
54 #ifndef KDEPIM_NO_KRESOURCES
57 mEmpty( true ), mChanged( false )
61 Private(
const Private &other )
63 #ifndef KDEPIM_NO_KRESOURCES
69 mFormattedName = other.mFormattedName;
70 mFamilyName = other.mFamilyName;
71 mGivenName = other.mGivenName;
72 mAdditionalName = other.mAdditionalName;
73 mPrefix = other.mPrefix;
74 mSuffix = other.mSuffix;
75 mNickName = other.mNickName;
76 mBirthday = other.mBirthday;
77 mMailer = other.mMailer;
78 mTimeZone = other.mTimeZone;
80 mTitle = other.mTitle;
82 mOrganization = other.mOrganization;
83 mDepartment = other.mDepartment;
85 mProductId = other.mProductId;
86 mRevision = other.mRevision;
87 mSortString = other.mSortString;
89 mSecrecy = other.mSecrecy;
91 mPhoto = other.mPhoto;
92 mSound = other.mSound;
94 mPhoneNumbers = other.mPhoneNumbers;
95 mAddresses = other.mAddresses;
97 mEmails = other.mEmails;
98 mLangs = other.mLangs;
99 mGender = other.mGender;
100 mCategories = other.mCategories;
101 mCustomFields = other.mCustomFields;
102 mCalendarUrl = other.mCalendarUrl;
103 mSoundListExtra = other.mSoundListExtra;
104 mPhotoListExtra = other.mPhotoListExtra;
105 mLogoListExtra = other.mLogoListExtra;
106 mUrlListExtra = other.mUrlListExtra;
107 mSources = other.mSources;
108 mMembers = other.mMembers;
109 mRelationShips = other.mRelationShips;
111 #ifndef KDEPIM_NO_KRESOURCES
112 mResource = other.mResource;
114 mEmpty = other.mEmpty;
115 mChanged = other.mChanged;
168 #ifndef KDEPIM_NO_KRESOURCES
196 if (
this != &other )
204 if ( d->mUid != addressee.d->mUid ) {
205 kDebug() <<
"uid differs";
209 if ( d->mName != addressee.d->mName &&
210 !( d->mName.isEmpty() && addressee.d->mName.isEmpty() ) ) {
211 kDebug(5700) <<
"name differs";
215 if ( d->mFormattedName != addressee.d->mFormattedName &&
216 !( d->mFormattedName.isEmpty() && addressee.d->mFormattedName.isEmpty() ) ) {
217 kDebug(5700) <<
"formattedName differs";
221 if ( d->mFamilyName != addressee.d->mFamilyName &&
222 !( d->mFamilyName.isEmpty() && addressee.d->mFamilyName.isEmpty() ) ) {
223 kDebug(5700) <<
"familyName differs";
227 if ( d->mGivenName != addressee.d->mGivenName &&
228 !( d->mGivenName.isEmpty() && addressee.d->mGivenName.isEmpty() ) ) {
229 kDebug(5700) <<
"givenName differs";
233 if ( d->mAdditionalName != addressee.d->mAdditionalName &&
234 !( d->mAdditionalName.isEmpty() && addressee.d->mAdditionalName.isEmpty() ) ) {
235 kDebug(5700) <<
"additionalName differs";
239 if ( d->mPrefix != addressee.d->mPrefix &&
240 !( d->mPrefix.isEmpty() && addressee.d->mPrefix.isEmpty() ) ) {
241 kDebug(5700) <<
"prefix differs";
245 if ( d->mSuffix != addressee.d->mSuffix &&
246 !( d->mSuffix.isEmpty() && addressee.d->mSuffix.isEmpty() ) ) {
247 kDebug(5700) <<
"suffix differs";
251 if ( d->mNickName != addressee.d->mNickName &&
252 !( d->mNickName.isEmpty() && addressee.d->mNickName.isEmpty() ) ) {
253 kDebug(5700) <<
"nickName differs";
257 if ( d->mBirthday != addressee.d->mBirthday ) {
258 kDebug(5700) <<
"birthday differs";
262 if ( d->mMailer != addressee.d->mMailer &&
263 !( d->mMailer.isEmpty() && addressee.d->mMailer.isEmpty() ) ) {
264 kDebug(5700) <<
"mailer differs";
268 if ( d->mTimeZone != addressee.d->mTimeZone ) {
269 kDebug(5700) <<
"timeZone differs";
273 if ( d->mGeo != addressee.d->mGeo ) {
274 kDebug(5700) <<
"geo differs";
278 if ( d->mTitle != addressee.d->mTitle &&
279 !( d->mTitle.isEmpty() && addressee.d->mTitle.isEmpty() ) ) {
280 kDebug(5700) <<
"title differs";
284 if ( d->mRole != addressee.d->mRole &&
285 !( d->mRole.isEmpty() && addressee.d->mRole.isEmpty() ) ) {
286 kDebug(5700) <<
"role differs";
290 if ( d->mOrganization != addressee.d->mOrganization &&
291 !( d->mOrganization.isEmpty() && addressee.d->mOrganization.isEmpty() ) ) {
292 kDebug(5700) <<
"organization differs";
296 if ( d->mDepartment != addressee.d->mDepartment &&
297 !( d->mDepartment.isEmpty() && addressee.d->mDepartment.isEmpty() ) ) {
298 kDebug(5700) <<
"department differs";
302 if ( d->mNote != addressee.d->mNote &&
303 !( d->mNote.isEmpty() && addressee.d->mNote.isEmpty() ) ) {
304 kDebug(5700) <<
"note differs";
308 if ( d->mProductId != addressee.d->mProductId &&
309 !( d->mProductId.isEmpty() && addressee.d->mProductId.isEmpty() ) ) {
310 kDebug(5700) <<
"productId differs";
314 if ( d->mSortString != addressee.d->mSortString &&
315 !( d->mSortString.isEmpty() && addressee.d->mSortString.isEmpty() ) ) {
316 kDebug(5700) <<
"sortString differs";
320 if ( d->mSecrecy != addressee.d->mSecrecy ) {
321 kDebug(5700) <<
"secrecy differs";
325 if ( d->mLogo != addressee.d->mLogo ) {
326 kDebug(5700) <<
"logo differs";
330 if ( d->mPhoto != addressee.d->mPhoto ) {
331 kDebug(5700) <<
"photo differs";
335 if ( d->mSound != addressee.d->mSound ) {
336 kDebug(5700) <<
"sound differs";
340 if ( ( d->mUrl.isValid() || addressee.d->mUrl.isValid() ) &&
341 ( d->mUrl != addressee.d->mUrl ) ) {
342 kDebug() <<
"url differs";
346 if ( !listEquals( d->mPhoneNumbers, addressee.d->mPhoneNumbers ) ) {
347 kDebug() <<
"phoneNumbers differs";
351 if ( !listEquals( d->mAddresses, addressee.d->mAddresses ) ) {
352 kDebug() <<
"addresses differs";
356 if ( !listEquals( d->mKeys, addressee.d->mKeys ) ) {
357 kDebug() <<
"keys differs";
361 if ( !listEquals( d->mEmails, addressee.d->mEmails ) ) {
362 kDebug() <<
"emails differs";
366 if ( !listEquals( d->mCategories, addressee.d->mCategories ) ) {
367 kDebug() <<
"categories differs";
371 if ( d->mCustomFields != addressee.d->mCustomFields ) {
372 kDebug() <<
"custom differs";
376 if (d->mLangs != addressee.d->mLangs) {
377 kDebug() <<
"langs differs";
380 if (d->mGender != addressee.d->mGender) {
381 kDebug() <<
"gender differs";
384 if ( d->mKind != addressee.d->mKind ) {
385 kDebug() <<
"kind differs";
388 if ( !listEquals( d->mCalendarUrl, addressee.d->mCalendarUrl ) ) {
389 kDebug() <<
"calendarUrl differs";
392 if ( !listEquals( d->mSoundListExtra, addressee.d->mSoundListExtra ) ) {
393 kDebug() <<
"Extra sound differs";
396 if ( !listEquals( d->mPhotoListExtra, addressee.d->mPhotoListExtra ) ) {
397 kDebug() <<
"Extra photo differs";
400 if ( !listEquals( d->mLogoListExtra, addressee.d->mLogoListExtra ) ) {
401 kDebug() <<
"Extra logo differs";
404 if ( !listEquals( d->mUrlListExtra, addressee.d->mUrlListExtra ) ) {
405 kDebug() <<
"Extra url differs";
408 if (!listEquals( d->mMembers, addressee.d->mMembers)) {
409 kDebug() <<
"Members differs";
412 if (!listEquals( d->mRelationShips, addressee.d->mRelationShips)) {
413 kDebug() <<
"RelationShips differs";
416 if (!listEquals( d->mSources, addressee.d->mSources)) {
417 kDebug() <<
"Sources differs";
425 return !( a == *this );
449 return i18n(
"Unique Identifier" );
454 if ( name == d->mName )
468 return i18n(
"Name" );
471 void Addressee::setKind(
const QString &kind )
473 if ( kind == d->mKind )
480 void Addressee::insertCalendarUrl(
const CalendarUrl &calendarUrl)
484 if (calendarUrl.isValid()) {
485 d->mCalendarUrl.append(calendarUrl);
489 void Addressee::insertExtraSound(
const Sound &sound)
491 d->mSoundListExtra.append(sound);
496 d->mSoundListExtra = soundList;
501 return d->mSoundListExtra;
504 void Addressee::insertExtraPhoto(
const Picture &picture)
506 d->mPhotoListExtra.append(picture);
509 void Addressee::setExtraPhotoList(
const Picture::List &pictureList)
511 d->mPhotoListExtra = pictureList;
516 return d->mPhotoListExtra;
519 void Addressee::insertExtraLogo(
const Picture &logo)
521 d->mLogoListExtra.append(logo);
524 void Addressee::setExtraLogoList(
const Picture::List &logoList)
526 d->mLogoListExtra = logoList;
531 return d->mLogoListExtra;
534 void Addressee::insertExtraUrl(
const KUrl &url)
536 d->mUrlListExtra.append(url);
539 void Addressee::setExtraUrlList(
const QList<KUrl> &urlList)
541 d->mUrlListExtra = urlList;
546 return d->mUrlListExtra;
549 void Addressee::insertSourceUrl(
const KUrl &url)
551 d->mSources.append(url);
554 void Addressee::setSourcesUrlList(
const QList<KUrl> &urlList)
556 d->mSources = urlList;
565 QString Addressee::kind()
const
572 if ( formattedName == d->mFormattedName )
581 return d->mFormattedName;
586 return i18n(
"Formatted Name" );
592 if ( familyName == d->mFamilyName )
601 return d->mFamilyName;
606 return i18n(
"Family Name" );
612 if ( givenName == d->mGivenName )
621 return d->mGivenName;
626 return i18n(
"Given Name" );
632 if ( additionalName == d->mAdditionalName )
641 return d->mAdditionalName;
646 return i18n(
"Additional Names" );
652 if ( prefix == d->mPrefix )
666 return i18n(
"Honorific Prefixes" );
672 if ( suffix == d->mSuffix )
686 return i18n(
"Honorific Suffixes" );
692 if ( nickName == d->mNickName )
706 return i18n(
"Nick Name" );
712 if ( birthday == d->mBirthday )
726 return i18n(
"Birthday" );
732 return i18n(
"Home Address Street" );
738 return i18n(
"Home Address Post Office Box" );
744 return i18n(
"Home Address City" );
750 return i18n(
"Home Address State" );
756 return i18n(
"Home Address Zip Code" );
762 return i18n(
"Home Address Country" );
768 return i18n(
"Home Address Label" );
774 return i18n(
"Business Address Street" );
780 return i18n(
"Business Address Post Office Box" );
786 return i18n(
"Business Address City" );
792 return i18n(
"Business Address State" );
798 return i18n(
"Business Address Zip Code" );
804 return i18n(
"Business Address Country" );
810 return i18n(
"Business Address Label" );
816 return i18n(
"Home Phone" );
822 return i18n(
"Business Phone" );
828 return i18n(
"Mobile Phone" );
834 return i18n(
"Home Fax" );
840 return i18n(
"Business Fax" );
846 return i18n(
"Car Phone" );
852 return i18n(
"ISDN" );
858 return i18n(
"Pager" );
864 return i18n(
"Email Address" );
870 if ( mailer == d->mMailer )
884 return i18n(
"Mail Client" );
890 if ( timeZone == d->mTimeZone )
904 return i18n(
"Time Zone" );
910 if ( geo == d->mGeo )
924 return i18n(
"Geographic Position" );
930 if ( title == d->mTitle )
944 return i18nc(
"a person's title",
"Title" );
950 if ( role == d->mRole )
964 return i18nc(
"of a person in an organization",
"Role" );
970 if ( organization == d->mOrganization )
979 return d->mOrganization;
984 return i18n(
"Organization" );
990 if ( department == d->mDepartment )
999 return d->mDepartment;
1004 return i18n(
"Department" );
1010 if ( note == d->mNote )
1024 return i18n(
"Note" );
1030 if ( productId == d->mProductId )
1039 return d->mProductId;
1044 return i18n(
"Product Identifier" );
1050 if ( revision == d->mRevision )
1059 return d->mRevision;
1064 return i18n(
"Revision Date" );
1070 if ( sortString == d->mSortString )
1079 return d->mSortString;
1084 return i18n(
"Sort String" );
1090 if ( url == d->mUrl )
1104 return i18n(
"Homepage" );
1110 if ( secrecy == d->mSecrecy )
1124 return i18n(
"Security Class" );
1130 if ( logo == d->mLogo )
1144 return i18n(
"Logo" );
1150 if ( photo == d->mPhoto )
1164 return i18n(
"Photo" );
1170 if ( sound == d->mSound )
1184 return i18n(
"Sound" );
1219 int rightOffset = parts.
count() - 1;
1222 while ( rightOffset >= 0 ) {
1224 suffix.
prepend( parts[ rightOffset ] + ( suffix.
isEmpty() ? emptyStr : spaceStr ) );
1231 if ( rightOffset < 0 )
1234 if ( rightOffset - 1 >= 0 && helper->
containsPrefix( parts[ rightOffset - 1 ].toLower() ) ) {
1235 setFamilyName( parts[ rightOffset - 1 ] + spaceStr + parts[ rightOffset ] );
1245 while ( leftOffset < rightOffset ) {
1247 prefix.
append( ( prefix.
isEmpty() ? emptyStr : spaceStr ) + parts[ leftOffset ] );
1254 if ( leftOffset < rightOffset ) {
1260 while ( leftOffset < rightOffset ) {
1261 additionalName.
append( ( additionalName.
isEmpty() ? emptyStr : spaceStr ) + parts[ leftOffset ] );
1271 int rightOffset = parts.
count() - 1;
1273 if ( parts.
count() > 0 ) {
1276 while ( rightOffset >= 0 ) {
1278 suffix.
prepend( parts[ rightOffset ] + ( suffix.
isEmpty() ? emptyStr : spaceStr ) );
1285 if ( rightOffset - 1 >= 0 && helper->
containsPrefix( parts[ rightOffset - 1 ].toLower() ) ) {
1286 setFamilyName( parts[ rightOffset - 1 ] + spaceStr + parts[ rightOffset ] );
1292 while ( leftOffset < rightOffset ) {
1294 prefix.
append( ( prefix.
isEmpty() ? emptyStr : spaceStr ) + parts[ leftOffset ] );
1305 parts = part2.
split( spaceStr );
1308 rightOffset = parts.
count();
1310 if ( parts.
count() > 0 ) {
1313 while ( leftOffset < rightOffset ) {
1315 prefix.
append( ( prefix.
isEmpty() ? emptyStr : spaceStr ) + parts[ leftOffset ] );
1322 if ( leftOffset < rightOffset ) {
1328 while ( leftOffset < rightOffset ) {
1329 additionalName.
append( ( additionalName.
isEmpty() ? emptyStr : spaceStr ) + parts[ leftOffset ] );
1383 if (
realName().indexOf( needQuotes ) != -1 ) {
1399 for (
int i = 0; i < d->mEmails.size(); ++i) {
1400 if (d->mEmails.at(i).mail() == email) {
1401 if (!preferred || i == 0) {
1404 Email tempMail = d->mEmails.takeAt(i);
1405 d->mEmails.prepend( tempMail );
1411 mail.setParameters(param);
1414 d->mEmails.prepend( mail );
1416 d->mEmails.append( mail );
1427 for (
int i = 0; i < d->mEmails.size(); ++i) {
1428 if (d->mEmails.at(i).mail() == email) {
1429 d->mEmails.removeAt(i);
1436 if ( d->mEmails.count() == 0 )
1439 return d->mEmails.first().mail();
1445 const int numberOfEmail(d->mEmails.size());
1446 for (
int i = 0; i < numberOfEmail; ++i) {
1447 list << d->mEmails.at(i).mail();
1458 void Addressee::setEmailList(
const Email::List &list)
1467 for (
int i = 0; i < emails.
size(); ++i) {
1468 d->mEmails.append(Email(emails.
at(i)));
1473 void Addressee::removeLang(
const QString &language )
1475 for (
int i = 0; i < d->mLangs.size(); ++i) {
1476 if (d->mLangs.at(i).language() == language) {
1477 d->mLangs.removeAt(i);
1482 void Addressee::insertLang(
const Lang &language )
1484 const QString languageStr = language.language();
1491 for ( it = d->mLangs.begin(); it != end; ++it ) {
1492 if ( ( *it ).language() == languageStr ) {
1493 (*it).setParameters(language.parameters());
1497 d->mLangs.append( language );
1500 void Addressee::setLangs(
const Lang::List &langs)
1511 void Addressee::setGender(
const Gender &gender)
1513 if ( gender == d->mGender )
1517 d->mGender = gender;
1520 Gender Addressee::gender()
const
1530 for ( it = d->mPhoneNumbers.begin(); it != d->mPhoneNumbers.end(); ++it ) {
1531 if ( ( *it ).id() == phoneNumber.
id() ) {
1537 d->mPhoneNumbers.append( phoneNumber );
1543 for ( it = d->mPhoneNumbers.begin(); it != d->mPhoneNumbers.end(); ++it ) {
1544 if ( ( *it ).id() == phoneNumber.
id() ) {
1545 d->mPhoneNumbers.erase( it );
1555 for ( it = d->mPhoneNumbers.constBegin(); it != d->mPhoneNumbers.constEnd(); ++it ) {
1556 if ( matchBinaryPattern( ( *it ).type(), type ) ) {
1560 phoneNumber = ( *it );
1570 return d->mPhoneNumbers;
1579 for ( it = d->mPhoneNumbers.constBegin(); it != end; ++it ) {
1580 if ( matchBinaryPattern( ( *it ).type(), type ) ) {
1591 for ( it = d->mPhoneNumbers.constBegin(); it != end; ++it ) {
1592 if ( ( *it ).id() == id ) {
1604 for ( it = d->mKeys.begin(); it != d->mKeys.end(); ++it ) {
1605 if ( ( *it ).id() == key.
id() ) {
1610 d->mKeys.append( key );
1616 for ( it = d->mKeys.begin(); it != d->mKeys.end(); ++it ) {
1617 if ( ( *it ).id() == key.
id() ) {
1618 d->mKeys.removeAll( key );
1628 for ( it = d->mKeys.constBegin(); it != end; ++it ) {
1629 if ( ( *it ).type() == type ) {
1631 if ( customTypeString.
isEmpty() ) {
1634 if ( ( *it ).customTypeString() == customTypeString )
1662 for ( it = d->mKeys.constBegin(); it != end; ++it ) {
1663 if ( ( *it ).type() == type ) {
1665 if ( customTypeString.
isEmpty() ) {
1668 if ( ( *it ).customTypeString() == customTypeString )
1683 for ( it = d->mKeys.constBegin(); it != end; ++it ) {
1684 if ( ( *it ).id() == id ) {
1729 for ( it5 = listEmail.
begin(); it5 != listEmail.
end(); ++it5 ) {
1730 str += ( *it5 ).toString();
1737 for ( it6 = listLang.
begin(); it6 != listLang.
end(); ++it6 ) {
1738 str += ( *it6 ).toString();
1746 for ( it2 = p.
begin(); it2 != p.
end(); ++it2 ) {
1747 str += ( *it2 ).toString();
1754 for ( it3 = a.
begin(); it3 != a.
end(); ++it3 ) {
1755 str += ( *it3 ).toString();
1762 for ( it4 = k.
begin(); it4 != k.
end(); ++it4 ) {
1763 str += ( *it4 ).toString();
1781 for ( it = d->mAddresses.begin(); it != d->mAddresses.end(); ++it ) {
1782 if ( ( *it ).id() == address.
id() ) {
1788 d->mAddresses.append( address );
1794 for ( it = d->mAddresses.begin(); it != d->mAddresses.end(); ++it ) {
1795 if ( ( *it ).id() == address.
id() ) {
1796 d->mAddresses.erase( it );
1807 for ( it = d->mAddresses.constBegin(); it != end; ++it ) {
1808 if ( matchBinaryPattern( ( *it ).type(), type ) ) {
1811 }
else if ( address.
isEmpty() ) {
1822 return d->mAddresses;
1831 for ( it = d->mAddresses.constBegin(); it != end; ++it ) {
1832 if ( matchBinaryPattern( ( *it ).type(), type ) ) {
1844 for ( it = d->mAddresses.constBegin(); it != end; ++it ) {
1845 if ( ( *it ).id() == id ) {
1852 void Addressee::insertMember(
const QString & member)
1856 if ( d->mMembers.contains( member ) )
1859 d->mMembers.append( member );
1862 void Addressee::setMembers(
const QStringList &m )
1873 void Addressee::insertRelationShip(
const QString &relation)
1877 if ( d->mRelationShips.contains( relation ) )
1880 d->mRelationShips.append( relation );
1883 void Addressee::setRelationShips(
const QStringList &c)
1886 d->mRelationShips = c;
1891 return d->mRelationShips;
1898 if ( d->mCategories.contains( c ) )
1901 d->mCategories.append( c );
1906 if ( d->mCategories.contains( category ) ) {
1907 d->mCategories.removeAll( category );
1913 return d->mCategories.contains( category );
1925 return d->mCategories;
1939 d->mCustomFields.insert( qualifiedName, value );
1946 d->mCustomFields.remove( qualifiedName );
1953 return d->mCustomFields.value( qualifiedName );
1960 d->mCustomFields.clear();
1967 const QString qualifiedName = custom.
left( index );
1968 const QString value = custom.
mid( index + 1 );
1970 d->mCustomFields.insert( qualifiedName, value );
2008 enum { TopLevel, InComment, InAngleAddress } context = TopLevel;
2009 bool inQuotedString =
false;
2010 int commentLevel = 0;
2013 for (
char* p = address.
data(); *p && !stop; ++p ) {
2014 switch ( context ) {
2017 case '"' : inQuotedString = !inQuotedString;
2020 case '(' :
if ( !inQuotedString ) {
2021 context = InComment;
2027 case '<' :
if ( !inQuotedString ) {
2028 context = InAngleAddress;
2042 case ',' :
if ( !inQuotedString ) {
2052 default : displayName += *p;
2058 case '(' : ++commentLevel;
2061 case ')' : --commentLevel;
2062 if ( commentLevel == 0 ) {
2078 default : comment += *p;
2082 case InAngleAddress : {
2084 case '"' : inQuotedString = !inQuotedString;
2087 case '>' :
if ( !inQuotedString ) {
2102 default : addrSpec += *p;
2110 displayName = displayName.
trimmed();
2112 addrSpec = addrSpec.
trimmed();
2118 if ( inQuotedString )
2120 if ( context == InComment )
2122 if ( context == InAngleAddress )
2140 unsigned int len = fullName.
length();
2142 fullName = fullName.
mid( 1, len - 2 );
2146 #ifndef KDEPIM_NO_KRESOURCES
2154 return d->mResource;
2160 d->mChanged = value;
2170 Private::mSortMode = mode;
2175 if ( !Private::mSortMode )
2178 return Private::mSortMode->lesser( *
this, addr );
2191 s << a.d->mFormattedName;
2192 s << a.d->mFamilyName;
2193 s << a.d->mGivenName;
2194 s << a.d->mAdditionalName;
2197 s << a.d->mNickName;
2198 s << a.d->mBirthday;
2200 s << a.d->mTimeZone;
2204 s << a.d->mOrganization;
2205 s << a.d->mDepartment;
2207 s << a.d->mProductId;
2208 s << a.d->mRevision;
2209 s << a.d->mSortString;
2215 s << a.d->mPhoneNumbers;
2216 s << a.d->mAddresses;
2218 s << a.d->mCategories;
2224 s << a.d->mCalendarUrl;
2225 s << a.d->mSoundListExtra;
2226 s << a.d->mPhotoListExtra;
2227 s << a.d->mLogoListExtra;
2228 s << a.d->mUrlListExtra;
2230 s << a.d->mRelationShips;
2240 s >> a.d->mFormattedName;
2241 s >> a.d->mFamilyName;
2242 s >> a.d->mGivenName;
2243 s >> a.d->mAdditionalName;
2246 s >> a.d->mNickName;
2247 s >> a.d->mBirthday;
2249 s >> a.d->mTimeZone;
2253 s >> a.d->mOrganization;
2254 s >> a.d->mDepartment;
2256 s >> a.d->mProductId;
2257 s >> a.d->mRevision;
2258 s >> a.d->mSortString;
2264 s >> a.d->mPhoneNumbers;
2265 s >> a.d->mAddresses;
2267 s >> a.d->mCategories;
2275 s >> a.d->mCalendarUrl;
2276 s >> a.d->mSoundListExtra;
2277 s >> a.d->mPhotoListExtra;
2278 s >> a.d->mLogoListExtra;
2279 s >> a.d->mUrlListExtra;
2281 s >> a.d->mRelationShips;
2283 a.d->mEmpty =
false;
2288 bool matchBinaryPattern(
int value,
int pattern )
2297 return ( value == 0 );
2299 return ( pattern == ( pattern & value ) );
2307 const int numberOfElement( list.
count() );
2308 for (
int i = 0; i < numberOfElement; ++i ) {
2309 if ( !pattern.
contains( list[ i ] ) ) {
2322 const int numberOfElement( list.
count() );
2323 for (
int i = 0; i < numberOfElement; ++i ) {
2324 if ( !pattern.
contains( list[ i ] ) ) {
Class that holds a Sound clip for a contact.
QStringList customs() const
Return list of all custom entries.
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
static QString homePhoneLabel()
Return translated label for homePhone field.
QString custom(const QString &app, const QString &name) const
Return value of custom entry, identified by app and entry name.
QString department() const
Return department.
Postal address information.
static QString geoLabel()
Return translated label for geo field.
void setNickName(const QString &nickName)
Set nick name.
Picture photo() const
Return photo.
QString & append(QChar ch)
QString name() const
Return name.
static QString pagerLabel()
Return translated label for pager field.
bool operator!=(const Addressee &) const
Not-equal operator.
void insertEmail(const QString &email, bool preferred=false)
Insert an email address.
A class to store a picture of an addressee.
static QString noteLabel()
Return translated label for note field.
void removeEmail(const QString &email)
Remove email address.
bool containsPrefix(const QString &prefix) const
Queries the list of inclusions.
QString title() const
Return title.
void setMailer(const QString &mailer)
Set mail client.
Address findAddress(const QString &id) const
Return address with the given id.
void insertPhoneNumber(const PhoneNumber &phoneNumber)
Insert a phone number.
QString number() const
Returns the phone number.
QByteArray trimmed() const
static QString homeAddressCountryLabel()
Return translated label for homeAddressCountry field.
void setSuffix(const QString &suffix)
Set honorific suffixes.
Addressee()
Construct an empty address book entry.
void setPhoto(const Picture &photo)
Set photo.
Sort method for sorting an addressee list.
static QString homeAddressLocalityLabel()
Return translated label for homeAddressLocality field.
void setResource(Resource *resource)
Set resource where the addressee is from.
void setFormattedName(const QString &formattedName)
Set formatted name.
static QString revisionLabel()
Return translated label for revision field.
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
A class to store an encryption key.
void setRole(const QString &role)
Set role.
QString & prepend(QChar ch)
Secrecy secrecy() const
Return security class.
static QString nameLabel()
Return translated label for name field.
static QString organizationLabel()
Return translated label for organization field.
void removeAddress(const Address &address)
Remove address.
QString fullEmail(const QString &email=QString()) const
Return email address including real name.
const T & at(int i) const
QString familyName() const
Return family name.
void removeKey(const Key &key)
Remove a key.
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QString simplified() const
This singleton class stores static data, which is shared by all Addressee objects.
Key findKey(const QString &id) const
Return key with the given id.
void setCategories(const QStringList &)
Set categories to given value.
QString prefix() const
Return honorific prefixes.
void setGivenName(const QString &givenName)
Set given name.
PhoneNumber findPhoneNumber(const QString &id) const
Return phone number with the given id.
static QString photoLabel()
Return translated label for photo field.
QString formattedName() const
Return formatted name.
static void setSortMode(KABC::SortMode *mode)
Sets the sort mode implementation.
QString note() const
Return note.
static QString nickNameLabel()
Return translated label for nickName field.
Sound sound() const
Return sound.
static QString homeFaxLabel()
Return translated label for homeFax field.
void setSortString(const QString &sortString)
Set sort string.
void setAdditionalName(const QString &additionalName)
Set additional names.
bool containsSuffix(const QString &suffix) const
Queries the list of honoric suffixes.
static QString uidLabel()
Return translated label for uid field.
void setLogo(const Picture &logo)
Set logo.
void setChanged(bool value)
Mark addressee as changed.
static QString homeAddressStreetLabel()
Return translated label for homeAddressStreet field.
void setFamilyName(const QString &familyName)
Set family name.
Address::List addresses() const
Return list of all addresses.
QString realName() const
Return the name of the addressee.
Custom or IANA conform key.
QDateTime birthday() const
Return birthday.
QString preferredEmail() const
Return preferred email address.
QStringList emails() const
Return list of all email addresses.
QString sortString() const
Return sort string.
void insertCategory(const QString &)
Insert category.
QDataStream & operator<<(QDataStream &stream, const Address &address)
Serializes the address object into the stream.
static QString formattedNameLabel()
Return translated label for formattedName field.
void setPrefix(const QString &prefix)
Set honorific prefixes.
void removeCustom(const QString &app, const QString &name)
Remove custom entry.
QString assembledName() const
Return the name that consists of all name parts.
static QString homeAddressPostalCodeLabel()
Return translated label for homeAddressPostalCode field.
static QString suffixLabel()
Return translated label for suffix field.
int count(const T &value) const
void append(const T &value)
QString fromUtf8(const char *str, int size)
QString role() const
Return role.
PhoneNumber phoneNumber(PhoneNumber::Type type) const
Return phone number, which matches the given type.
static QString soundLabel()
Return translated label for sound field.
static QString roleLabel()
Return translated label for role field.
bool containsTitle(const QString &title) const
Queries the list of honoric prefixes.
void setTitle(const QString &title)
Set title.
static QString businessAddressLabelLabel()
Return translated label for businessAddressLabel field.
static QString businessAddressPostOfficeBoxLabel()
Return translated label for businessAddressPostOfficeBox field.
void setCustoms(const QStringList &)
Set all custom entries.
bool operator<(const Addressee &addr) const
Return whether this addressee is "less-than" a given one.
QString mailer() const
Return mail client.
void setDepartment(const QString &department)
Set department.
static QString logoLabel()
Return translated label for logo field.
static QString homeAddressRegionLabel()
Return translated label for homeAddressRegion field.
void setSound(const Sound &sound)
Set sound.
QString additionalName() const
Return additional names.
QString id() const
Returns the unique identifier.
void setUid(const QString &uid)
Set unique identifier.
static QString businessAddressRegionLabel()
Return translated label for businessAddressRegion field.
void insertKey(const Key &key)
Insert a key.
PhoneNumber::List phoneNumbers() const
Return list of all phone numbers.
static QString sortStringLabel()
Return translated label for sortString field.
static AddresseeHelper * self()
Singleton interface to this class.
static QString businessFaxLabel()
Return translated label for businessFax field.
void setOrganization(const QString &organization)
Set organization.
QStringList categories() const
Return list of all set categories.
void setGeo(const Geo &geo)
Set geographic position.
void setUrl(const KUrl &url)
Set homepage.
static QString businessAddressLocalityLabel()
Return translated label for businessAddressLocality field.
QString givenName() const
Return given name.
static QString homeAddressLabelLabel()
Return translated label for homeAddressLabel field.
static QString carPhoneLabel()
Return translated label for carPhone field.
Key key(Key::Type type, QString customTypeString=QString()) const
Return key, which matches the given type.
static void parseEmailAddress(const QString &rawEmail, QString &fullName, QString &email)
Parse full email address.
static QString birthdayLabel()
Return translated label for birthday field.
void setName(const QString &name)
Set name.
bool isEmpty() const
Return, if the address book entry is empty.
bool contains(const T &value) const
static QString businessAddressCountryLabel()
Return translated label for businessAddressCountry field.
void removeCategory(const QString &)
Remove category.
static QString titleLabel()
Return translated label for title field.
TimeZone timeZone() const
Return time zone.
void setNote(const QString ¬e)
Set note.
Addressee & operator=(const Addressee &)
Assignment operator.
static QString mimeType()
Returns the MIME type used for Addressees.
QDataStream & operator>>(QDataStream &stream, Address &address)
Initializes the address object from the stream.
void setNameFromString(const QString &)
Set name fields by parsing the given string and trying to associate the parts of the string with acco...
void insertAddress(const Address &address)
Insert an address.
static QString departmentLabel()
Return translated label for department field.
QString & replace(int position, int n, QChar after)
void insertCustom(const QString &app, const QString &name, const QString &value)
Insert custom entry.
QString organization() const
Return organization.
QString productId() const
Return product identifier.
static QString productIdLabel()
Return translated label for productId field.
static QString emailLabel()
Return translated label for email field.
QString mid(int position, int n) const
static QString additionalNameLabel()
Return translated label for additionalName field.
void setEmails(const QStringList &list)
Set the emails to list.
static QString businessPhoneLabel()
Return translated label for businessPhone field.
static QString secrecyLabel()
Return translated label for secrecy field.
Resource * resource() const
Return pointer to resource.
void removePhoneNumber(const PhoneNumber &phoneNumber)
Remove phone number.
bool changed() const
Return whether the addressee is changed.
void setRevision(const QDateTime &revision)
Set revision date.
void setProductId(const QString &productId)
Set product identifier.
QString id() const
Returns the unique identifier.
QString uid() const
Return unique identifier.
static QString urlLabel()
Return translated label for url field.
bool tradeAsFamilyName() const
Returns whether or not a single name component should be interpreted as a family name.
Picture logo() const
Return logo.
~Addressee()
Destroys the address book entry.
void setBirthday(const QDateTime &birthday)
Set birthday.
QString id() const
Returns the unique identifier.
QString left(int n) const
QString fromLatin1(const char *str, int size)
void setTimeZone(const TimeZone &timeZone)
Set time zone.
QString suffix() const
Return honorific suffixes.
static QString timeZoneLabel()
Return translated label for timeZone field.
KUrl url() const
Return homepage.
static QString prefixLabel()
Return translated label for prefix field.
static QString familyNameLabel()
Return translated label for familyName field.
bool isEmpty() const
Returns true, if the address is empty.
QDateTime revision() const
Return revision date.
void setSecrecy(const Secrecy &secrecy)
Set security class.
void setKeys(const Key::List &keys)
Set the list of keys.
Key::List keys() const
Return list of all keys.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
static QString givenNameLabel()
Return translated label for givenName field.
static QString homeAddressPostOfficeBoxLabel()
Return translated label for homeAddressPostOfficeBox field.
bool hasCategory(const QString &) const
Return, if addressee has the given category.
static QString mobilePhoneLabel()
Return translated label for mobilePhone field.
bool operator==(const Addressee &) const
Equality operator.
static QString isdnLabel()
Return translated label for isdn field.
QString toString() const
Returns string representation of the addressee.
Address address(Address::Type type) const
Return address, which matches the given type.
static QString businessAddressStreetLabel()
Return translated label for businessAddressStreet field.
QString nickName() const
Return nick name.
Geo geo() const
Return geographic position.
static QString mailerLabel()
Return translated label for mailer field.
static QString businessAddressPostalCodeLabel()
Return translated label for businessAddressPostalCode field.
QByteArray toUtf8() const