summaryrefslogtreecommitdiffabout
path: root/kabc/addressee.cpp
Unidiff
Diffstat (limited to 'kabc/addressee.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp17
1 files changed, 0 insertions, 17 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 7f592e9..155ce24 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -6,97 +6,96 @@
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;
55 QString familyName; 54 QString familyName;
56 QString givenName; 55 QString givenName;
57 QString additionalName; 56 QString additionalName;
58 QString prefix; 57 QString prefix;
59 QString suffix; 58 QString suffix;
60 QString nickName; 59 QString nickName;
61 QDateTime birthday; 60 QDateTime birthday;
62 QString mailer; 61 QString mailer;
63 TimeZone timeZone; 62 TimeZone timeZone;
64 Geo geo; 63 Geo geo;
65 QString title; 64 QString title;
66 QString role; 65 QString role;
67 QString organization; 66 QString organization;
68 QString note; 67 QString note;
69 QString productId; 68 QString productId;
70 QDateTime revision; 69 QDateTime revision;
71 QString sortString; 70 QString sortString;
72 QString externalUID; 71 QString externalUID;
73 QString originalExternalUID; 72 QString originalExternalUID;
74 KURL url; 73 KURL url;
75 Secrecy secrecy; 74 Secrecy secrecy;
76 Picture logo; 75 Picture logo;
77 Picture photo; 76 Picture photo;
78 Sound sound; 77 Sound sound;
79 Agent agent; 78 Agent agent;
80 QString mExternalId; 79 QString mExternalId;
81 PhoneNumber::List phoneNumbers; 80 PhoneNumber::List phoneNumbers;
82 Address::List addresses; 81 Address::List addresses;
83 Key::List keys; 82 Key::List keys;
84 QStringList emails; 83 QStringList emails;
85 QStringList categories; 84 QStringList categories;
86 QStringList custom; 85 QStringList custom;
87 int mTempSyncStat; 86 int mTempSyncStat;
88 Resource *resource; 87 Resource *resource;
89 88
90 bool empty :1; 89 bool empty :1;
91 bool changed :1; 90 bool changed :1;
92 bool tagged :1; 91 bool tagged :1;
93}; 92};
94 93
95Addressee::Addressee() 94Addressee::Addressee()
96{ 95{
97 mData = new AddresseeData; 96 mData = new AddresseeData;
98 mData->empty = true; 97 mData->empty = true;
99 mData->changed = false; 98 mData->changed = false;
100 mData->resource = 0; 99 mData->resource = 0;
101 mData->mExternalId = ":"; 100 mData->mExternalId = ":";
102 mData->revision = QDateTime ( QDate( 2003,1,1)); 101 mData->revision = QDateTime ( QDate( 2003,1,1));
@@ -703,123 +702,107 @@ QString Addressee::originalExternalUID() const
703void Addressee::setUid( const QString &id ) 702void Addressee::setUid( const QString &id )
704{ 703{
705 if ( id == mData->uid ) return; 704 if ( id == mData->uid ) return;
706 detach(); 705 detach();
707 //qDebug("****setuid %s ", id.latin1()); 706 //qDebug("****setuid %s ", id.latin1());
708 mData->empty = false; 707 mData->empty = false;
709 mData->uid = id; 708 mData->uid = id;
710} 709}
711 710
712const QString Addressee::uid() const 711const QString Addressee::uid() const
713{ 712{
714 if ( mData->uid.isEmpty() ) 713 if ( mData->uid.isEmpty() )
715 mData->uid = KApplication::randomString( 10 ); 714 mData->uid = KApplication::randomString( 10 );
716 715
717 return mData->uid; 716 return mData->uid;
718} 717}
719 718
720QString Addressee::uidLabel() 719QString Addressee::uidLabel()
721{ 720{
722 return i18n("Unique Identifier"); 721 return i18n("Unique Identifier");
723} 722}
724 723
725void Addressee::setName( const QString &name ) 724void Addressee::setName( const QString &name )
726{ 725{
727 if ( name == mData->name ) return; 726 if ( name == mData->name ) return;
728 detach(); 727 detach();
729 mData->empty = false; 728 mData->empty = false;
730 mData->name = name; 729 mData->name = name;
731} 730}
732 731
733QString Addressee::name() const 732QString Addressee::name() const
734{ 733{
735 return mData->name; 734 return mData->name;
736} 735}
737 736
738QString Addressee::nameLabel() 737QString Addressee::nameLabel()
739{ 738{
740 return i18n("Name"); 739 return i18n("Name");
741} 740}
742 741
743 742
744void Addressee::setFormattedName( const QString &formattedName ) 743void Addressee::setFormattedName( const QString &formattedName )
745{ 744{
746 if ( formattedName == mData->formattedName ) return; 745 if ( formattedName == mData->formattedName ) return;
747 detach(); 746 detach();
748 mData->empty = false; 747 mData->empty = false;
749 mData->formattedName = formattedName; 748 mData->formattedName = formattedName;
750} 749}
751void Addressee::setDefaultFormattedName( const QString &formattedName )
752{
753 if ( formattedName == mData->defaultFormattedName ) return;
754 detach();
755 mData->empty = false;
756 mData->defaultFormattedName = formattedName;
757}
758 750
759QString Addressee::formattedName() const 751QString Addressee::formattedName() const
760{ 752{
761 return mData->formattedName; 753 return mData->formattedName;
762} 754}
763QString Addressee::defaultFormattedName() const
764{
765 return mData->defaultFormattedName;
766}
767 755
768QString Addressee::formattedNameLabel() 756QString Addressee::formattedNameLabel()
769{ 757{
770 return i18n("Formatted Name"); 758 return i18n("Formatted Name");
771} 759}
772 760
773QString Addressee::defaultFormattedNameLabel()
774{
775 return i18n("Def.Formatted Name");
776}
777
778 761
779void Addressee::setFamilyName( const QString &familyName ) 762void Addressee::setFamilyName( const QString &familyName )
780{ 763{
781 if ( familyName == mData->familyName ) return; 764 if ( familyName == mData->familyName ) return;
782 detach(); 765 detach();
783 mData->empty = false; 766 mData->empty = false;
784 mData->familyName = familyName; 767 mData->familyName = familyName;
785} 768}
786 769
787QString Addressee::familyName() const 770QString Addressee::familyName() const
788{ 771{
789 return mData->familyName; 772 return mData->familyName;
790} 773}
791 774
792QString Addressee::familyNameLabel() 775QString Addressee::familyNameLabel()
793{ 776{
794 return i18n("Family Name"); 777 return i18n("Family Name");
795} 778}
796 779
797 780
798void Addressee::setGivenName( const QString &givenName ) 781void Addressee::setGivenName( const QString &givenName )
799{ 782{
800 if ( givenName == mData->givenName ) return; 783 if ( givenName == mData->givenName ) return;
801 detach(); 784 detach();
802 mData->empty = false; 785 mData->empty = false;
803 mData->givenName = givenName; 786 mData->givenName = givenName;
804} 787}
805 788
806QString Addressee::givenName() const 789QString Addressee::givenName() const
807{ 790{
808 return mData->givenName; 791 return mData->givenName;
809} 792}
810 793
811QString Addressee::givenNameLabel() 794QString Addressee::givenNameLabel()
812{ 795{
813 return i18n("Given Name"); 796 return i18n("Given Name");
814} 797}
815 798
816 799
817void Addressee::setAdditionalName( const QString &additionalName ) 800void Addressee::setAdditionalName( const QString &additionalName )
818{ 801{
819 if ( additionalName == mData->additionalName ) return; 802 if ( additionalName == mData->additionalName ) return;
820 detach(); 803 detach();
821 mData->empty = false; 804 mData->empty = false;
822 mData->additionalName = additionalName; 805 mData->additionalName = additionalName;
823} 806}
824 807
825QString Addressee::additionalName() const 808QString Addressee::additionalName() const