summaryrefslogtreecommitdiffabout
path: root/kabc/addressee.cpp
Unidiff
Diffstat (limited to 'kabc/addressee.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 39d14bb..7f592e9 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -6,96 +6,97 @@
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/*
23Enhanced Version of the file for platform independent KDE tools. 23Enhanced Version of the file for platform independent KDE tools.
24Copyright (c) 2004 Ulf Schenk 24Copyright (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
43using namespace KABC; 43using namespace KABC;
44 44
45static bool matchBinaryPattern( int value, int pattern ); 45static bool matchBinaryPattern( int value, int pattern );
46static bool matchBinaryPatternA( int value, int pattern ); 46static bool matchBinaryPatternA( int value, int pattern );
47static bool matchBinaryPatternP( int value, int pattern ); 47static bool matchBinaryPatternP( int value, int pattern );
48 48
49struct Addressee::AddresseeData : public KShared 49struct 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
94Addressee::Addressee() 95Addressee::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));
@@ -702,107 +703,123 @@ QString Addressee::originalExternalUID() const
702void Addressee::setUid( const QString &id ) 703void 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
711const QString Addressee::uid() const 712const 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
719QString Addressee::uidLabel() 720QString Addressee::uidLabel()
720{ 721{
721 return i18n("Unique Identifier"); 722 return i18n("Unique Identifier");
722} 723}
723 724
724void Addressee::setName( const QString &name ) 725void 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
732QString Addressee::name() const 733QString Addressee::name() const
733{ 734{
734 return mData->name; 735 return mData->name;
735} 736}
736 737
737QString Addressee::nameLabel() 738QString Addressee::nameLabel()
738{ 739{
739 return i18n("Name"); 740 return i18n("Name");
740} 741}
741 742
742 743
743void Addressee::setFormattedName( const QString &formattedName ) 744void 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}
751void 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
751QString Addressee::formattedName() const 759QString Addressee::formattedName() const
752{ 760{
753 return mData->formattedName; 761 return mData->formattedName;
754} 762}
763QString Addressee::defaultFormattedName() const
764{
765 return mData->defaultFormattedName;
766}
755 767
756QString Addressee::formattedNameLabel() 768QString Addressee::formattedNameLabel()
757{ 769{
758 return i18n("Formatted Name"); 770 return i18n("Formatted Name");
759} 771}
760 772
773QString Addressee::defaultFormattedNameLabel()
774{
775 return i18n("Def.Formatted Name");
776}
777
761 778
762void Addressee::setFamilyName( const QString &familyName ) 779void 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
770QString Addressee::familyName() const 787QString Addressee::familyName() const
771{ 788{
772 return mData->familyName; 789 return mData->familyName;
773} 790}
774 791
775QString Addressee::familyNameLabel() 792QString Addressee::familyNameLabel()
776{ 793{
777 return i18n("Family Name"); 794 return i18n("Family Name");
778} 795}
779 796
780 797
781void Addressee::setGivenName( const QString &givenName ) 798void 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
789QString Addressee::givenName() const 806QString Addressee::givenName() const
790{ 807{
791 return mData->givenName; 808 return mData->givenName;
792} 809}
793 810
794QString Addressee::givenNameLabel() 811QString Addressee::givenNameLabel()
795{ 812{
796 return i18n("Given Name"); 813 return i18n("Given Name");
797} 814}
798 815
799 816
800void Addressee::setAdditionalName( const QString &additionalName ) 817void 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
808QString Addressee::additionalName() const 825QString Addressee::additionalName() const
@@ -935,96 +952,104 @@ QString Addressee::businessAddressStreetLabel()
935 952
936 953
937QString Addressee::businessAddressLocalityLabel() 954QString Addressee::businessAddressLocalityLabel()
938{ 955{
939 return i18n("Business Address Locality"); 956 return i18n("Business Address Locality");
940} 957}
941 958
942 959
943QString Addressee::businessAddressRegionLabel() 960QString Addressee::businessAddressRegionLabel()
944{ 961{
945 return i18n("Business Address Region"); 962 return i18n("Business Address Region");
946} 963}
947 964
948 965
949QString Addressee::businessAddressPostalCodeLabel() 966QString Addressee::businessAddressPostalCodeLabel()
950{ 967{
951 return i18n("Business Address Postal Code"); 968 return i18n("Business Address Postal Code");
952} 969}
953 970
954 971
955QString Addressee::businessAddressCountryLabel() 972QString Addressee::businessAddressCountryLabel()
956{ 973{
957 return i18n("Business Address Country"); 974 return i18n("Business Address Country");
958} 975}
959 976
960 977
961QString Addressee::businessAddressLabelLabel() 978QString Addressee::businessAddressLabelLabel()
962{ 979{
963 return i18n("Business Address Label"); 980 return i18n("Business Address Label");
964} 981}
965 982
966 983
967QString Addressee::homePhoneLabel() 984QString Addressee::homePhoneLabel()
968{ 985{
969 return i18n("Home Phone"); 986 return i18n("Home Phone");
970} 987}
971 988
972 989
973QString Addressee::businessPhoneLabel() 990QString Addressee::businessPhoneLabel()
974{ 991{
975 return i18n("Business Phone"); 992 return i18n("Business Phone");
976} 993}
977 994
978 995
979QString Addressee::mobilePhoneLabel() 996QString Addressee::mobilePhoneLabel()
980{ 997{
981 return i18n("Mobile Phone"); 998 return i18n("Mobile Phone");
982} 999}
1000QString Addressee::mobileWorkPhoneLabel()
1001{
1002 return i18n("Mobile (work)");
1003}
1004QString Addressee::mobileHomePhoneLabel()
1005{
1006 return i18n("Mobile (home)");
1007}
983 1008
984 1009
985QString Addressee::homeFaxLabel() 1010QString Addressee::homeFaxLabel()
986{ 1011{
987 return i18n("Home Fax"); 1012 return i18n("Home Fax");
988} 1013}
989 1014
990 1015
991QString Addressee::businessFaxLabel() 1016QString Addressee::businessFaxLabel()
992{ 1017{
993 return i18n("Business Fax"); 1018 return i18n("Business Fax");
994} 1019}
995 1020
996 1021
997QString Addressee::carPhoneLabel() 1022QString Addressee::carPhoneLabel()
998{ 1023{
999 return i18n("Car Phone"); 1024 return i18n("Car Phone");
1000} 1025}
1001 1026
1002 1027
1003QString Addressee::isdnLabel() 1028QString Addressee::isdnLabel()
1004{ 1029{
1005 return i18n("ISDN"); 1030 return i18n("ISDN");
1006} 1031}
1007 1032
1008 1033
1009QString Addressee::pagerLabel() 1034QString Addressee::pagerLabel()
1010{ 1035{
1011 return i18n("Pager"); 1036 return i18n("Pager");
1012} 1037}
1013 1038
1014QString Addressee::sipLabel() 1039QString Addressee::sipLabel()
1015{ 1040{
1016 return i18n("SIP"); 1041 return i18n("SIP");
1017} 1042}
1018 1043
1019QString Addressee::emailLabel() 1044QString Addressee::emailLabel()
1020{ 1045{
1021 return i18n("Email Address"); 1046 return i18n("Email Address");
1022} 1047}
1023 1048
1024 1049
1025void Addressee::setMailer( const QString &mailer ) 1050void 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;