-rw-r--r-- | kabc/addressee.cpp | 4 | ||||
-rw-r--r-- | kabc/addressee.h | 2 | ||||
-rw-r--r-- | kabc/field.cpp | 6 |
3 files changed, 11 insertions, 1 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index eec0f1f..3ce733d 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -1935,128 +1935,132 @@ void Addressee::parseEmailAddress( const QString &rawEmail, QString &fullName, | |||
1935 | startPos = rawEmail.find('<'); | 1935 | startPos = rawEmail.find('<'); |
1936 | if (startPos < 0) | 1936 | if (startPos < 0) |
1937 | { | 1937 | { |
1938 | startPos = rawEmail.find('('); | 1938 | startPos = rawEmail.find('('); |
1939 | endCh = ')'; | 1939 | endCh = ')'; |
1940 | } | 1940 | } |
1941 | if (startPos < 0) | 1941 | if (startPos < 0) |
1942 | { | 1942 | { |
1943 | // We couldn't find any separators, so we assume the whole string | 1943 | // We couldn't find any separators, so we assume the whole string |
1944 | // is the email address | 1944 | // is the email address |
1945 | email = rawEmail; | 1945 | email = rawEmail; |
1946 | fullName = ""; | 1946 | fullName = ""; |
1947 | } | 1947 | } |
1948 | else | 1948 | else |
1949 | { | 1949 | { |
1950 | // We have a start position, try to find an end | 1950 | // We have a start position, try to find an end |
1951 | endPos = rawEmail.find(endCh, startPos+1); | 1951 | endPos = rawEmail.find(endCh, startPos+1); |
1952 | 1952 | ||
1953 | if (endPos < 0) | 1953 | if (endPos < 0) |
1954 | { | 1954 | { |
1955 | // We couldn't find the end of the email address. We can only | 1955 | // We couldn't find the end of the email address. We can only |
1956 | // assume the entire string is the email address. | 1956 | // assume the entire string is the email address. |
1957 | email = rawEmail; | 1957 | email = rawEmail; |
1958 | fullName = ""; | 1958 | fullName = ""; |
1959 | } | 1959 | } |
1960 | else | 1960 | else |
1961 | { | 1961 | { |
1962 | // We have a start and end to the email address | 1962 | // We have a start and end to the email address |
1963 | 1963 | ||
1964 | // Grab the name part | 1964 | // Grab the name part |
1965 | fullName = rawEmail.left(startPos).stripWhiteSpace(); | 1965 | fullName = rawEmail.left(startPos).stripWhiteSpace(); |
1966 | 1966 | ||
1967 | // grab the email part | 1967 | // grab the email part |
1968 | email = rawEmail.mid(startPos+1, endPos-startPos-1).stripWhiteSpace(); | 1968 | email = rawEmail.mid(startPos+1, endPos-startPos-1).stripWhiteSpace(); |
1969 | 1969 | ||
1970 | // Check that we do not have any extra characters on the end of the | 1970 | // Check that we do not have any extra characters on the end of the |
1971 | // strings | 1971 | // strings |
1972 | len = fullName.length(); | 1972 | len = fullName.length(); |
1973 | if (fullName[0]=='"' && fullName[len-1]=='"') | 1973 | if (fullName[0]=='"' && fullName[len-1]=='"') |
1974 | fullName = fullName.mid(1, len-2); | 1974 | fullName = fullName.mid(1, len-2); |
1975 | else if (fullName[0]=='<' && fullName[len-1]=='>') | 1975 | else if (fullName[0]=='<' && fullName[len-1]=='>') |
1976 | fullName = fullName.mid(1, len-2); | 1976 | fullName = fullName.mid(1, len-2); |
1977 | else if (fullName[0]=='(' && fullName[len-1]==')') | 1977 | else if (fullName[0]=='(' && fullName[len-1]==')') |
1978 | fullName = fullName.mid(1, len-2); | 1978 | fullName = fullName.mid(1, len-2); |
1979 | } | 1979 | } |
1980 | } | 1980 | } |
1981 | } | 1981 | } |
1982 | 1982 | ||
1983 | void Addressee::setResource( Resource *resource ) | 1983 | void Addressee::setResource( Resource *resource ) |
1984 | { | 1984 | { |
1985 | detach(); | 1985 | detach(); |
1986 | mData->resource = resource; | 1986 | mData->resource = resource; |
1987 | } | 1987 | } |
1988 | 1988 | ||
1989 | Resource *Addressee::resource() const | 1989 | Resource *Addressee::resource() const |
1990 | { | 1990 | { |
1991 | return mData->resource; | 1991 | return mData->resource; |
1992 | } | 1992 | } |
1993 | 1993 | ||
1994 | //US | 1994 | //US |
1995 | QString Addressee::resourceLabel() | 1995 | QString Addressee::resourceLabel() |
1996 | { | 1996 | { |
1997 | return i18n("Resource"); | 1997 | return i18n("Resource"); |
1998 | } | 1998 | } |
1999 | QString Addressee::categoryLabel() | ||
2000 | { | ||
2001 | return i18n("Category"); | ||
2002 | } | ||
1999 | 2003 | ||
2000 | void Addressee::setChanged( bool value ) | 2004 | void Addressee::setChanged( bool value ) |
2001 | { | 2005 | { |
2002 | detach(); | 2006 | detach(); |
2003 | mData->changed = value; | 2007 | mData->changed = value; |
2004 | } | 2008 | } |
2005 | 2009 | ||
2006 | bool Addressee::changed() const | 2010 | bool Addressee::changed() const |
2007 | { | 2011 | { |
2008 | return mData->changed; | 2012 | return mData->changed; |
2009 | } | 2013 | } |
2010 | 2014 | ||
2011 | void Addressee::setTagged( bool value ) | 2015 | void Addressee::setTagged( bool value ) |
2012 | { | 2016 | { |
2013 | detach(); | 2017 | detach(); |
2014 | mData->tagged = value; | 2018 | mData->tagged = value; |
2015 | } | 2019 | } |
2016 | 2020 | ||
2017 | bool Addressee::tagged() const | 2021 | bool Addressee::tagged() const |
2018 | { | 2022 | { |
2019 | return mData->tagged; | 2023 | return mData->tagged; |
2020 | } | 2024 | } |
2021 | 2025 | ||
2022 | QDataStream &KABC::operator<<( QDataStream &s, const Addressee &a ) | 2026 | QDataStream &KABC::operator<<( QDataStream &s, const Addressee &a ) |
2023 | { | 2027 | { |
2024 | if (!a.mData) return s; | 2028 | if (!a.mData) return s; |
2025 | 2029 | ||
2026 | s << a.uid(); | 2030 | s << a.uid(); |
2027 | 2031 | ||
2028 | s << a.mData->name; | 2032 | s << a.mData->name; |
2029 | s << a.mData->formattedName; | 2033 | s << a.mData->formattedName; |
2030 | s << a.mData->familyName; | 2034 | s << a.mData->familyName; |
2031 | s << a.mData->givenName; | 2035 | s << a.mData->givenName; |
2032 | s << a.mData->additionalName; | 2036 | s << a.mData->additionalName; |
2033 | s << a.mData->prefix; | 2037 | s << a.mData->prefix; |
2034 | s << a.mData->suffix; | 2038 | s << a.mData->suffix; |
2035 | s << a.mData->nickName; | 2039 | s << a.mData->nickName; |
2036 | s << a.mData->birthday; | 2040 | s << a.mData->birthday; |
2037 | s << a.mData->mailer; | 2041 | s << a.mData->mailer; |
2038 | s << a.mData->timeZone; | 2042 | s << a.mData->timeZone; |
2039 | s << a.mData->geo; | 2043 | s << a.mData->geo; |
2040 | s << a.mData->title; | 2044 | s << a.mData->title; |
2041 | s << a.mData->role; | 2045 | s << a.mData->role; |
2042 | s << a.mData->organization; | 2046 | s << a.mData->organization; |
2043 | s << a.mData->note; | 2047 | s << a.mData->note; |
2044 | s << a.mData->productId; | 2048 | s << a.mData->productId; |
2045 | s << a.mData->revision; | 2049 | s << a.mData->revision; |
2046 | s << a.mData->sortString; | 2050 | s << a.mData->sortString; |
2047 | s << a.mData->url; | 2051 | s << a.mData->url; |
2048 | s << a.mData->secrecy; | 2052 | s << a.mData->secrecy; |
2049 | s << a.mData->logo; | 2053 | s << a.mData->logo; |
2050 | s << a.mData->photo; | 2054 | s << a.mData->photo; |
2051 | s << a.mData->sound; | 2055 | s << a.mData->sound; |
2052 | s << a.mData->agent; | 2056 | s << a.mData->agent; |
2053 | s << a.mData->phoneNumbers; | 2057 | s << a.mData->phoneNumbers; |
2054 | s << a.mData->addresses; | 2058 | s << a.mData->addresses; |
2055 | s << a.mData->emails; | 2059 | s << a.mData->emails; |
2056 | s << a.mData->categories; | 2060 | s << a.mData->categories; |
2057 | s << a.mData->custom; | 2061 | s << a.mData->custom; |
2058 | s << a.mData->keys; | 2062 | s << a.mData->keys; |
2059 | return s; | 2063 | return s; |
2060 | } | 2064 | } |
2061 | 2065 | ||
2062 | QDataStream &KABC::operator>>( QDataStream &s, Addressee &a ) | 2066 | QDataStream &KABC::operator>>( QDataStream &s, Addressee &a ) |
diff --git a/kabc/addressee.h b/kabc/addressee.h index 2c81c1a..08d2f56 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h | |||
@@ -762,92 +762,92 @@ class Addressee | |||
762 | /** | 762 | /** |
763 | Return list of all set categories. | 763 | Return list of all set categories. |
764 | */ | 764 | */ |
765 | QStringList categories() const; | 765 | QStringList categories() const; |
766 | 766 | ||
767 | /** | 767 | /** |
768 | Insert custom entry. The entry is identified by the name of the inserting | 768 | Insert custom entry. The entry is identified by the name of the inserting |
769 | application and a unique name. If an entry with the given app and name | 769 | application and a unique name. If an entry with the given app and name |
770 | already exists its value is replaced with the new given value. | 770 | already exists its value is replaced with the new given value. |
771 | */ | 771 | */ |
772 | void insertCustom( const QString &app, const QString &name, | 772 | void insertCustom( const QString &app, const QString &name, |
773 | const QString &value ); | 773 | const QString &value ); |
774 | 774 | ||
775 | /** | 775 | /** |
776 | Remove custom entry. | 776 | Remove custom entry. |
777 | */ | 777 | */ |
778 | void removeCustom( const QString &app, const QString &name ); | 778 | void removeCustom( const QString &app, const QString &name ); |
779 | 779 | ||
780 | /** | 780 | /** |
781 | Return value of custom entry, identified by app and entry name. | 781 | Return value of custom entry, identified by app and entry name. |
782 | */ | 782 | */ |
783 | QString custom( const QString &app, const QString &name ) const; | 783 | QString custom( const QString &app, const QString &name ) const; |
784 | 784 | ||
785 | /** | 785 | /** |
786 | Set all custom entries. | 786 | Set all custom entries. |
787 | */ | 787 | */ |
788 | void setCustoms( const QStringList & ); | 788 | void setCustoms( const QStringList & ); |
789 | 789 | ||
790 | /** | 790 | /** |
791 | Return list of all custom entries. | 791 | Return list of all custom entries. |
792 | */ | 792 | */ |
793 | QStringList customs() const; | 793 | QStringList customs() const; |
794 | 794 | ||
795 | /** | 795 | /** |
796 | Parse full email address. The result is given back in fullName and email. | 796 | Parse full email address. The result is given back in fullName and email. |
797 | */ | 797 | */ |
798 | static void parseEmailAddress( const QString &rawEmail, QString &fullName, | 798 | static void parseEmailAddress( const QString &rawEmail, QString &fullName, |
799 | QString &email ); | 799 | QString &email ); |
800 | 800 | ||
801 | /** | 801 | /** |
802 | Debug output. | 802 | Debug output. |
803 | */ | 803 | */ |
804 | void dump() const; | 804 | void dump() const; |
805 | 805 | ||
806 | /** | 806 | /** |
807 | Returns string representation of the addressee. | 807 | Returns string representation of the addressee. |
808 | */ | 808 | */ |
809 | QString asString() const; | 809 | QString asString() const; |
810 | 810 | ||
811 | /** | 811 | /** |
812 | Set resource where the addressee is from. | 812 | Set resource where the addressee is from. |
813 | */ | 813 | */ |
814 | void setResource( Resource *resource ); | 814 | void setResource( Resource *resource ); |
815 | 815 | ||
816 | /** | 816 | /** |
817 | Return pointer to resource. | 817 | Return pointer to resource. |
818 | */ | 818 | */ |
819 | Resource *resource() const; | 819 | Resource *resource() const; |
820 | 820 | ||
821 | /** | 821 | /** |
822 | Return resourcelabel. | 822 | Return resourcelabel. |
823 | */ | 823 | */ |
824 | //US | 824 | //US |
825 | static QString resourceLabel(); | 825 | static QString resourceLabel(); |
826 | 826 | static QString categoryLabel(); | |
827 | /** | 827 | /** |
828 | Mark addressee as changed. | 828 | Mark addressee as changed. |
829 | */ | 829 | */ |
830 | void setChanged( bool value ); | 830 | void setChanged( bool value ); |
831 | 831 | ||
832 | /** | 832 | /** |
833 | Return whether the addressee is changed. | 833 | Return whether the addressee is changed. |
834 | */ | 834 | */ |
835 | bool changed() const; | 835 | bool changed() const; |
836 | 836 | ||
837 | void setTagged( bool value ); | 837 | void setTagged( bool value ); |
838 | bool tagged() const; | 838 | bool tagged() const; |
839 | 839 | ||
840 | private: | 840 | private: |
841 | Addressee copy(); | 841 | Addressee copy(); |
842 | void detach(); | 842 | void detach(); |
843 | 843 | ||
844 | struct AddresseeData; | 844 | struct AddresseeData; |
845 | mutable KSharedPtr<AddresseeData> mData; | 845 | mutable KSharedPtr<AddresseeData> mData; |
846 | }; | 846 | }; |
847 | 847 | ||
848 | QDataStream &operator<<( QDataStream &, const Addressee & ); | 848 | QDataStream &operator<<( QDataStream &, const Addressee & ); |
849 | QDataStream &operator>>( QDataStream &, Addressee & ); | 849 | QDataStream &operator>>( QDataStream &, Addressee & ); |
850 | 850 | ||
851 | } | 851 | } |
852 | 852 | ||
853 | #endif | 853 | #endif |
diff --git a/kabc/field.cpp b/kabc/field.cpp index d95cd19..89d0b77 100644 --- a/kabc/field.cpp +++ b/kabc/field.cpp | |||
@@ -1,123 +1,124 @@ | |||
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 | HomeAddressStreet, | 61 | HomeAddressStreet, |
61 | HomeAddressLocality, | 62 | HomeAddressLocality, |
62 | HomeAddressRegion, | 63 | HomeAddressRegion, |
63 | HomeAddressPostalCode, | 64 | HomeAddressPostalCode, |
64 | HomeAddressCountry, | 65 | HomeAddressCountry, |
65 | HomeAddressLabel, | 66 | HomeAddressLabel, |
66 | BusinessAddressStreet, | 67 | BusinessAddressStreet, |
67 | BusinessAddressLocality, | 68 | BusinessAddressLocality, |
68 | BusinessAddressRegion, | 69 | BusinessAddressRegion, |
69 | BusinessAddressPostalCode, | 70 | BusinessAddressPostalCode, |
70 | BusinessAddressCountry, | 71 | BusinessAddressCountry, |
71 | BusinessAddressLabel, | 72 | BusinessAddressLabel, |
72 | HomePhone, | 73 | HomePhone, |
73 | BusinessPhone, | 74 | BusinessPhone, |
74 | MobilePhone, | 75 | MobilePhone, |
75 | HomeFax, | 76 | HomeFax, |
76 | BusinessFax, | 77 | BusinessFax, |
77 | CarPhone, | 78 | CarPhone, |
78 | Isdn, | 79 | Isdn, |
79 | Pager, | 80 | Pager, |
80 | Email, | 81 | Email, |
81 | Mailer, | 82 | Mailer, |
82 | Title, | 83 | Title, |
83 | Role, | 84 | Role, |
84 | Organization, | 85 | Organization, |
85 | Note, | 86 | Note, |
86 | Url, | 87 | Url, |
87 | Resource, | 88 | Resource, |
88 | Sip | 89 | Sip |
89 | }; | 90 | }; |
90 | 91 | ||
91 | int fieldId() { return mFieldId; } | 92 | int fieldId() { return mFieldId; } |
92 | int category() { return mCategory; } | 93 | int category() { return mCategory; } |
93 | 94 | ||
94 | QString label() { return mLabel; } | 95 | QString label() { return mLabel; } |
95 | QString key() { return mKey; } | 96 | QString key() { return mKey; } |
96 | QString app() { return mApp; } | 97 | QString app() { return mApp; } |
97 | 98 | ||
98 | private: | 99 | private: |
99 | int mFieldId; | 100 | int mFieldId; |
100 | int mCategory; | 101 | int mCategory; |
101 | 102 | ||
102 | QString mLabel; | 103 | QString mLabel; |
103 | QString mKey; | 104 | QString mKey; |
104 | QString mApp; | 105 | QString mApp; |
105 | }; | 106 | }; |
106 | 107 | ||
107 | 108 | ||
108 | Field::List Field::mAllFields; | 109 | Field::List Field::mAllFields; |
109 | Field::List Field::mDefaultFields; | 110 | Field::List Field::mDefaultFields; |
110 | Field::List Field::mCustomFields; | 111 | Field::List Field::mCustomFields; |
111 | 112 | ||
112 | 113 | ||
113 | Field::Field( FieldImpl *impl ) | 114 | Field::Field( FieldImpl *impl ) |
114 | { | 115 | { |
115 | mImpl = impl; | 116 | mImpl = impl; |
116 | } | 117 | } |
117 | 118 | ||
118 | Field::~Field() | 119 | Field::~Field() |
119 | { | 120 | { |
120 | delete mImpl; | 121 | delete mImpl; |
121 | } | 122 | } |
122 | 123 | ||
123 | QString Field::label() | 124 | QString Field::label() |
@@ -134,328 +135,333 @@ QString Field::label() | |||
134 | case FieldImpl::Prefix: | 135 | case FieldImpl::Prefix: |
135 | return Addressee::prefixLabel(); | 136 | return Addressee::prefixLabel(); |
136 | case FieldImpl::Suffix: | 137 | case FieldImpl::Suffix: |
137 | return Addressee::suffixLabel(); | 138 | return Addressee::suffixLabel(); |
138 | case FieldImpl::NickName: | 139 | case FieldImpl::NickName: |
139 | return Addressee::nickNameLabel(); | 140 | return Addressee::nickNameLabel(); |
140 | case FieldImpl::Birthday: | 141 | case FieldImpl::Birthday: |
141 | return Addressee::birthdayLabel(); | 142 | return Addressee::birthdayLabel(); |
142 | case FieldImpl::HomeAddressStreet: | 143 | case FieldImpl::HomeAddressStreet: |
143 | return Addressee::homeAddressStreetLabel(); | 144 | return Addressee::homeAddressStreetLabel(); |
144 | case FieldImpl::HomeAddressLocality: | 145 | case FieldImpl::HomeAddressLocality: |
145 | return Addressee::homeAddressLocalityLabel(); | 146 | return Addressee::homeAddressLocalityLabel(); |
146 | case FieldImpl::HomeAddressRegion: | 147 | case FieldImpl::HomeAddressRegion: |
147 | return Addressee::homeAddressRegionLabel(); | 148 | return Addressee::homeAddressRegionLabel(); |
148 | case FieldImpl::HomeAddressPostalCode: | 149 | case FieldImpl::HomeAddressPostalCode: |
149 | return Addressee::homeAddressPostalCodeLabel(); | 150 | return Addressee::homeAddressPostalCodeLabel(); |
150 | case FieldImpl::HomeAddressCountry: | 151 | case FieldImpl::HomeAddressCountry: |
151 | return Addressee::homeAddressCountryLabel(); | 152 | return Addressee::homeAddressCountryLabel(); |
152 | case FieldImpl::HomeAddressLabel: | 153 | case FieldImpl::HomeAddressLabel: |
153 | return Addressee::homeAddressLabelLabel(); | 154 | return Addressee::homeAddressLabelLabel(); |
154 | case FieldImpl::BusinessAddressStreet: | 155 | case FieldImpl::BusinessAddressStreet: |
155 | return Addressee::businessAddressStreetLabel(); | 156 | return Addressee::businessAddressStreetLabel(); |
156 | case FieldImpl::BusinessAddressLocality: | 157 | case FieldImpl::BusinessAddressLocality: |
157 | return Addressee::businessAddressLocalityLabel(); | 158 | return Addressee::businessAddressLocalityLabel(); |
158 | case FieldImpl::BusinessAddressRegion: | 159 | case FieldImpl::BusinessAddressRegion: |
159 | return Addressee::businessAddressRegionLabel(); | 160 | return Addressee::businessAddressRegionLabel(); |
160 | case FieldImpl::BusinessAddressPostalCode: | 161 | case FieldImpl::BusinessAddressPostalCode: |
161 | return Addressee::businessAddressPostalCodeLabel(); | 162 | return Addressee::businessAddressPostalCodeLabel(); |
162 | case FieldImpl::BusinessAddressCountry: | 163 | case FieldImpl::BusinessAddressCountry: |
163 | return Addressee::businessAddressCountryLabel(); | 164 | return Addressee::businessAddressCountryLabel(); |
164 | case FieldImpl::BusinessAddressLabel: | 165 | case FieldImpl::BusinessAddressLabel: |
165 | return Addressee::businessAddressLabelLabel(); | 166 | return Addressee::businessAddressLabelLabel(); |
166 | case FieldImpl::HomePhone: | 167 | case FieldImpl::HomePhone: |
167 | return Addressee::homePhoneLabel(); | 168 | return Addressee::homePhoneLabel(); |
168 | case FieldImpl::BusinessPhone: | 169 | case FieldImpl::BusinessPhone: |
169 | return Addressee::businessPhoneLabel(); | 170 | return Addressee::businessPhoneLabel(); |
170 | case FieldImpl::MobilePhone: | 171 | case FieldImpl::MobilePhone: |
171 | return Addressee::mobilePhoneLabel(); | 172 | return Addressee::mobilePhoneLabel(); |
172 | case FieldImpl::HomeFax: | 173 | case FieldImpl::HomeFax: |
173 | return Addressee::homeFaxLabel(); | 174 | return Addressee::homeFaxLabel(); |
174 | case FieldImpl::BusinessFax: | 175 | case FieldImpl::BusinessFax: |
175 | return Addressee::businessFaxLabel(); | 176 | return Addressee::businessFaxLabel(); |
176 | case FieldImpl::CarPhone: | 177 | case FieldImpl::CarPhone: |
177 | return Addressee::carPhoneLabel(); | 178 | return Addressee::carPhoneLabel(); |
178 | case FieldImpl::Isdn: | 179 | case FieldImpl::Isdn: |
179 | return Addressee::isdnLabel(); | 180 | return Addressee::isdnLabel(); |
180 | case FieldImpl::Pager: | 181 | case FieldImpl::Pager: |
181 | return Addressee::pagerLabel(); | 182 | return Addressee::pagerLabel(); |
182 | case FieldImpl::Email: | 183 | case FieldImpl::Email: |
183 | return Addressee::emailLabel(); | 184 | return Addressee::emailLabel(); |
184 | case FieldImpl::Mailer: | 185 | case FieldImpl::Mailer: |
185 | return Addressee::mailerLabel(); | 186 | return Addressee::mailerLabel(); |
186 | case FieldImpl::Title: | 187 | case FieldImpl::Title: |
187 | return Addressee::titleLabel(); | 188 | return Addressee::titleLabel(); |
188 | case FieldImpl::Role: | 189 | case FieldImpl::Role: |
189 | return Addressee::roleLabel(); | 190 | return Addressee::roleLabel(); |
190 | case FieldImpl::Organization: | 191 | case FieldImpl::Organization: |
191 | return Addressee::organizationLabel(); | 192 | return Addressee::organizationLabel(); |
192 | case FieldImpl::Note: | 193 | case FieldImpl::Note: |
193 | return Addressee::noteLabel(); | 194 | return Addressee::noteLabel(); |
194 | case FieldImpl::Url: | 195 | case FieldImpl::Url: |
195 | return Addressee::urlLabel(); | 196 | return Addressee::urlLabel(); |
196 | case FieldImpl::Resource: | 197 | case FieldImpl::Resource: |
197 | return Addressee::resourceLabel(); | 198 | return Addressee::resourceLabel(); |
199 | case FieldImpl::Category: | ||
200 | return Addressee::categoryLabel(); | ||
198 | case FieldImpl::Sip: | 201 | case FieldImpl::Sip: |
199 | return Addressee::sipLabel(); | 202 | return Addressee::sipLabel(); |
200 | case FieldImpl::CustomField: | 203 | case FieldImpl::CustomField: |
201 | return mImpl->label(); | 204 | return mImpl->label(); |
202 | default: | 205 | default: |
203 | return i18n("Unknown Field"); | 206 | return i18n("Unknown Field"); |
204 | } | 207 | } |
205 | } | 208 | } |
206 | 209 | ||
207 | int Field::category() | 210 | int Field::category() |
208 | { | 211 | { |
209 | return mImpl->category(); | 212 | return mImpl->category(); |
210 | } | 213 | } |
211 | 214 | ||
212 | QString Field::categoryLabel( int category ) | 215 | QString Field::categoryLabel( int category ) |
213 | { | 216 | { |
214 | switch ( category ) { | 217 | switch ( category ) { |
215 | case All: | 218 | case All: |
216 | return i18n("All"); | 219 | return i18n("All"); |
217 | case Frequent: | 220 | case Frequent: |
218 | return i18n("Frequent"); | 221 | return i18n("Frequent"); |
219 | case Address: | 222 | case Address: |
220 | return i18n("Address"); | 223 | return i18n("Address"); |
221 | case Email: | 224 | case Email: |
222 | return i18n("Email"); | 225 | return i18n("Email"); |
223 | case Personal: | 226 | case Personal: |
224 | return i18n("Personal"); | 227 | return i18n("Personal"); |
225 | case Organization: | 228 | case Organization: |
226 | return i18n("Organization"); | 229 | return i18n("Organization"); |
227 | case CustomCategory: | 230 | case CustomCategory: |
228 | return i18n("Custom"); | 231 | return i18n("Custom"); |
229 | default: | 232 | default: |
230 | return i18n("Undefined"); | 233 | return i18n("Undefined"); |
231 | } | 234 | } |
232 | } | 235 | } |
233 | 236 | ||
234 | QString Field::value( const KABC::Addressee &a ) | 237 | QString Field::value( const KABC::Addressee &a ) |
235 | { | 238 | { |
236 | switch ( mImpl->fieldId() ) { | 239 | switch ( mImpl->fieldId() ) { |
237 | case FieldImpl::FormattedName: | 240 | case FieldImpl::FormattedName: |
238 | return a.formattedName(); | 241 | return a.formattedName(); |
239 | case FieldImpl::FamilyName: | 242 | case FieldImpl::FamilyName: |
240 | return a.familyName(); | 243 | return a.familyName(); |
241 | case FieldImpl::GivenName: | 244 | case FieldImpl::GivenName: |
242 | return a.givenName(); | 245 | return a.givenName(); |
243 | case FieldImpl::AdditionalName: | 246 | case FieldImpl::AdditionalName: |
244 | return a.additionalName(); | 247 | return a.additionalName(); |
245 | case FieldImpl::Prefix: | 248 | case FieldImpl::Prefix: |
246 | return a.prefix(); | 249 | return a.prefix(); |
247 | case FieldImpl::Suffix: | 250 | case FieldImpl::Suffix: |
248 | return a.suffix(); | 251 | return a.suffix(); |
249 | case FieldImpl::NickName: | 252 | case FieldImpl::NickName: |
250 | return a.nickName(); | 253 | return a.nickName(); |
251 | case FieldImpl::Mailer: | 254 | case FieldImpl::Mailer: |
252 | return a.mailer(); | 255 | return a.mailer(); |
253 | case FieldImpl::Title: | 256 | case FieldImpl::Title: |
254 | return a.title(); | 257 | return a.title(); |
255 | case FieldImpl::Role: | 258 | case FieldImpl::Role: |
256 | return a.role(); | 259 | return a.role(); |
257 | case FieldImpl::Organization: | 260 | case FieldImpl::Organization: |
258 | return a.organization(); | 261 | return a.organization(); |
259 | case FieldImpl::Note: | 262 | case FieldImpl::Note: |
260 | return a.note(); | 263 | return a.note(); |
261 | case FieldImpl::Email: | 264 | case FieldImpl::Email: |
262 | return a.preferredEmail(); | 265 | return a.preferredEmail(); |
263 | case FieldImpl::Birthday: | 266 | case FieldImpl::Birthday: |
264 | if ( a.birthday().isValid() ) { | 267 | if ( a.birthday().isValid() ) { |
265 | //the generated code had the following format: return a.birthday().date().toString( Qt::ISODate ); | 268 | //the generated code had the following format: return a.birthday().date().toString( Qt::ISODate ); |
266 | // But Qt::IsoDate was not specified. | 269 | // But Qt::IsoDate was not specified. |
267 | // QString _oldFormat = KGlobal::locale()->dateFormat(); | 270 | // QString _oldFormat = KGlobal::locale()->dateFormat(); |
268 | // KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate | 271 | // KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate |
269 | QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false, KLocale::ISODate); | 272 | QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false, KLocale::ISODate); |
270 | // KGlobal::locale()->setDateFormat(_oldFormat); | 273 | // KGlobal::locale()->setDateFormat(_oldFormat); |
271 | return dt; | 274 | return dt; |
272 | } | 275 | } |
273 | else | 276 | else |
274 | return QString::null; | 277 | return QString::null; |
275 | case FieldImpl::Url: | 278 | case FieldImpl::Url: |
276 | return a.url().prettyURL(); | 279 | return a.url().prettyURL(); |
277 | //US | 280 | //US |
278 | case FieldImpl::Resource: | 281 | case FieldImpl::Resource: |
279 | return a.resource()->resourceName(); | 282 | return a.resource()->resourceName(); |
283 | case FieldImpl::Category: | ||
284 | return a.categories().join(","); | ||
280 | case FieldImpl::HomePhone: | 285 | case FieldImpl::HomePhone: |
281 | return a.phoneNumber( PhoneNumber::Home ).number(); | 286 | return a.phoneNumber( PhoneNumber::Home ).number(); |
282 | case FieldImpl::BusinessPhone: | 287 | case FieldImpl::BusinessPhone: |
283 | return a.phoneNumber( PhoneNumber::Work ).number(); | 288 | return a.phoneNumber( PhoneNumber::Work ).number(); |
284 | case FieldImpl::MobilePhone: | 289 | case FieldImpl::MobilePhone: |
285 | return a.phoneNumber( PhoneNumber::Cell ).number(); | 290 | return a.phoneNumber( PhoneNumber::Cell ).number(); |
286 | case FieldImpl::HomeFax: | 291 | case FieldImpl::HomeFax: |
287 | return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); | 292 | return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); |
288 | case FieldImpl::BusinessFax: | 293 | case FieldImpl::BusinessFax: |
289 | return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); | 294 | return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); |
290 | case FieldImpl::CarPhone: | 295 | case FieldImpl::CarPhone: |
291 | return a.phoneNumber( PhoneNumber::Car ).number(); | 296 | return a.phoneNumber( PhoneNumber::Car ).number(); |
292 | case FieldImpl::Isdn: | 297 | case FieldImpl::Isdn: |
293 | return a.phoneNumber( PhoneNumber::Isdn ).number(); | 298 | return a.phoneNumber( PhoneNumber::Isdn ).number(); |
294 | case FieldImpl::Pager: | 299 | case FieldImpl::Pager: |
295 | return a.phoneNumber( PhoneNumber::Pager ).number(); | 300 | return a.phoneNumber( PhoneNumber::Pager ).number(); |
296 | case FieldImpl::Sip: | 301 | case FieldImpl::Sip: |
297 | return a.phoneNumber( PhoneNumber::Sip ).number(); | 302 | return a.phoneNumber( PhoneNumber::Sip ).number(); |
298 | case FieldImpl::HomeAddressStreet: | 303 | case FieldImpl::HomeAddressStreet: |
299 | return a.address( Address::Home ).street(); | 304 | return a.address( Address::Home ).street(); |
300 | case FieldImpl::HomeAddressLocality: | 305 | case FieldImpl::HomeAddressLocality: |
301 | return a.address( Address::Home ).locality(); | 306 | return a.address( Address::Home ).locality(); |
302 | case FieldImpl::HomeAddressRegion: | 307 | case FieldImpl::HomeAddressRegion: |
303 | return a.address( Address::Home ).region(); | 308 | return a.address( Address::Home ).region(); |
304 | case FieldImpl::HomeAddressPostalCode: | 309 | case FieldImpl::HomeAddressPostalCode: |
305 | return a.address( Address::Home ).postalCode(); | 310 | return a.address( Address::Home ).postalCode(); |
306 | case FieldImpl::HomeAddressCountry: | 311 | case FieldImpl::HomeAddressCountry: |
307 | return a.address( Address::Home ).country(); | 312 | return a.address( Address::Home ).country(); |
308 | case FieldImpl::BusinessAddressStreet: | 313 | case FieldImpl::BusinessAddressStreet: |
309 | return a.address( Address::Work ).street(); | 314 | return a.address( Address::Work ).street(); |
310 | case FieldImpl::BusinessAddressLocality: | 315 | case FieldImpl::BusinessAddressLocality: |
311 | return a.address( Address::Work ).locality(); | 316 | return a.address( Address::Work ).locality(); |
312 | case FieldImpl::BusinessAddressRegion: | 317 | case FieldImpl::BusinessAddressRegion: |
313 | return a.address( Address::Work ).region(); | 318 | return a.address( Address::Work ).region(); |
314 | case FieldImpl::BusinessAddressPostalCode: | 319 | case FieldImpl::BusinessAddressPostalCode: |
315 | return a.address( Address::Work ).postalCode(); | 320 | return a.address( Address::Work ).postalCode(); |
316 | case FieldImpl::BusinessAddressCountry: | 321 | case FieldImpl::BusinessAddressCountry: |
317 | return a.address( Address::Work ).country(); | 322 | return a.address( Address::Work ).country(); |
318 | case FieldImpl::CustomField: | 323 | case FieldImpl::CustomField: |
319 | return a.custom( mImpl->app(), mImpl->key() ); | 324 | return a.custom( mImpl->app(), mImpl->key() ); |
320 | default: | 325 | default: |
321 | return QString::null; | 326 | return QString::null; |
322 | } | 327 | } |
323 | } | 328 | } |
324 | 329 | ||
325 | bool Field::setValue( KABC::Addressee &a, const QString &value ) | 330 | bool Field::setValue( KABC::Addressee &a, const QString &value ) |
326 | { | 331 | { |
327 | switch ( mImpl->fieldId() ) { | 332 | switch ( mImpl->fieldId() ) { |
328 | case FieldImpl::FormattedName: | 333 | case FieldImpl::FormattedName: |
329 | a.setFormattedName( value ); | 334 | a.setFormattedName( value ); |
330 | return true; | 335 | return true; |
331 | case FieldImpl::FamilyName: | 336 | case FieldImpl::FamilyName: |
332 | a.setFamilyName( value ); | 337 | a.setFamilyName( value ); |
333 | return true; | 338 | return true; |
334 | case FieldImpl::GivenName: | 339 | case FieldImpl::GivenName: |
335 | a.setGivenName( value ); | 340 | a.setGivenName( value ); |
336 | return true; | 341 | return true; |
337 | case FieldImpl::AdditionalName: | 342 | case FieldImpl::AdditionalName: |
338 | a.setAdditionalName( value ); | 343 | a.setAdditionalName( value ); |
339 | return true; | 344 | return true; |
340 | case FieldImpl::Prefix: | 345 | case FieldImpl::Prefix: |
341 | a.setPrefix( value ); | 346 | a.setPrefix( value ); |
342 | return true; | 347 | return true; |
343 | case FieldImpl::Suffix: | 348 | case FieldImpl::Suffix: |
344 | a.setSuffix( value ); | 349 | a.setSuffix( value ); |
345 | return true; | 350 | return true; |
346 | case FieldImpl::NickName: | 351 | case FieldImpl::NickName: |
347 | a.setNickName( value ); | 352 | a.setNickName( value ); |
348 | return true; | 353 | return true; |
349 | case FieldImpl::Mailer: | 354 | case FieldImpl::Mailer: |
350 | a.setMailer( value ); | 355 | a.setMailer( value ); |
351 | return true; | 356 | return true; |
352 | case FieldImpl::Title: | 357 | case FieldImpl::Title: |
353 | a.setTitle( value ); | 358 | a.setTitle( value ); |
354 | return true; | 359 | return true; |
355 | case FieldImpl::Role: | 360 | case FieldImpl::Role: |
356 | a.setRole( value ); | 361 | a.setRole( value ); |
357 | return true; | 362 | return true; |
358 | case FieldImpl::Organization: | 363 | case FieldImpl::Organization: |
359 | a.setOrganization( value ); | 364 | a.setOrganization( value ); |
360 | return true; | 365 | return true; |
361 | case FieldImpl::Note: | 366 | case FieldImpl::Note: |
362 | a.setNote( value ); | 367 | a.setNote( value ); |
363 | return true; | 368 | return true; |
364 | case FieldImpl::Birthday: | 369 | case FieldImpl::Birthday: |
365 | //US | 370 | //US |
366 | //the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); | 371 | //the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); |
367 | // But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? | 372 | // But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? |
368 | { | 373 | { |
369 | QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate | 374 | QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate |
370 | a.setBirthday(dt); | 375 | a.setBirthday(dt); |
371 | } | 376 | } |
372 | return true; | 377 | return true; |
373 | case FieldImpl::CustomField: | 378 | case FieldImpl::CustomField: |
374 | a.insertCustom( mImpl->app(), mImpl->key(), value ); | 379 | a.insertCustom( mImpl->app(), mImpl->key(), value ); |
375 | //US never copy the resourcename back to the adressee. | 380 | //US never copy the resourcename back to the adressee. |
376 | case FieldImpl::Resource: | 381 | case FieldImpl::Resource: |
377 | default: | 382 | default: |
378 | return false; | 383 | return false; |
379 | } | 384 | } |
380 | } | 385 | } |
381 | 386 | ||
382 | bool Field::isCustom() | 387 | bool Field::isCustom() |
383 | { | 388 | { |
384 | return mImpl->fieldId() == FieldImpl::CustomField; | 389 | return mImpl->fieldId() == FieldImpl::CustomField; |
385 | } | 390 | } |
386 | 391 | ||
387 | Field::List Field::allFields() | 392 | Field::List Field::allFields() |
388 | { | 393 | { |
389 | if ( mAllFields.isEmpty() ) { | 394 | if ( mAllFields.isEmpty() ) { |
390 | createField( FieldImpl::FormattedName, Frequent ); | 395 | createField( FieldImpl::FormattedName, Frequent ); |
391 | createField( FieldImpl::FamilyName, Frequent ); | 396 | createField( FieldImpl::FamilyName, Frequent ); |
392 | createField( FieldImpl::GivenName, Frequent ); | 397 | createField( FieldImpl::GivenName, Frequent ); |
393 | createField( FieldImpl::AdditionalName ); | 398 | createField( FieldImpl::AdditionalName ); |
394 | createField( FieldImpl::Prefix ); | 399 | createField( FieldImpl::Prefix ); |
395 | createField( FieldImpl::Suffix ); | 400 | createField( FieldImpl::Suffix ); |
396 | createField( FieldImpl::NickName, Personal ); | 401 | createField( FieldImpl::NickName, Personal ); |
397 | createField( FieldImpl::Birthday, Personal ); | 402 | createField( FieldImpl::Birthday, Personal ); |
403 | createField( FieldImpl::Category ); | ||
398 | createField( FieldImpl::HomeAddressStreet, Address|Personal ); | 404 | createField( FieldImpl::HomeAddressStreet, Address|Personal ); |
399 | createField( FieldImpl::HomeAddressLocality, Address|Personal ); | 405 | createField( FieldImpl::HomeAddressLocality, Address|Personal ); |
400 | createField( FieldImpl::HomeAddressRegion, Address|Personal ); | 406 | createField( FieldImpl::HomeAddressRegion, Address|Personal ); |
401 | createField( FieldImpl::HomeAddressPostalCode, Address|Personal ); | 407 | createField( FieldImpl::HomeAddressPostalCode, Address|Personal ); |
402 | createField( FieldImpl::HomeAddressCountry, Address|Personal ); | 408 | createField( FieldImpl::HomeAddressCountry, Address|Personal ); |
403 | createField( FieldImpl::HomeAddressLabel, Address|Personal ); | 409 | createField( FieldImpl::HomeAddressLabel, Address|Personal ); |
404 | createField( FieldImpl::BusinessAddressStreet, Address|Organization ); | 410 | createField( FieldImpl::BusinessAddressStreet, Address|Organization ); |
405 | createField( FieldImpl::BusinessAddressLocality, Address|Organization ); | 411 | createField( FieldImpl::BusinessAddressLocality, Address|Organization ); |
406 | createField( FieldImpl::BusinessAddressRegion, Address|Organization ); | 412 | createField( FieldImpl::BusinessAddressRegion, Address|Organization ); |
407 | createField( FieldImpl::BusinessAddressPostalCode, Address|Organization ); | 413 | createField( FieldImpl::BusinessAddressPostalCode, Address|Organization ); |
408 | createField( FieldImpl::BusinessAddressCountry, Address|Organization ); | 414 | createField( FieldImpl::BusinessAddressCountry, Address|Organization ); |
409 | createField( FieldImpl::BusinessAddressLabel, Address|Organization ); | 415 | createField( FieldImpl::BusinessAddressLabel, Address|Organization ); |
410 | createField( FieldImpl::HomePhone, Personal|Frequent ); | 416 | createField( FieldImpl::HomePhone, Personal|Frequent ); |
411 | createField( FieldImpl::BusinessPhone, Organization|Frequent ); | 417 | createField( FieldImpl::BusinessPhone, Organization|Frequent ); |
412 | createField( FieldImpl::MobilePhone, Frequent ); | 418 | createField( FieldImpl::MobilePhone, Frequent ); |
413 | createField( FieldImpl::HomeFax ); | 419 | createField( FieldImpl::HomeFax ); |
414 | createField( FieldImpl::BusinessFax ); | 420 | createField( FieldImpl::BusinessFax ); |
415 | createField( FieldImpl::CarPhone ); | 421 | createField( FieldImpl::CarPhone ); |
416 | createField( FieldImpl::Isdn ); | 422 | createField( FieldImpl::Isdn ); |
417 | createField( FieldImpl::Pager ); | 423 | createField( FieldImpl::Pager ); |
418 | createField( FieldImpl::Email, Email|Frequent ); | 424 | createField( FieldImpl::Email, Email|Frequent ); |
419 | createField( FieldImpl::Mailer, Email ); | 425 | createField( FieldImpl::Mailer, Email ); |
420 | createField( FieldImpl::Title, Organization ); | 426 | createField( FieldImpl::Title, Organization ); |
421 | createField( FieldImpl::Role, Organization ); | 427 | createField( FieldImpl::Role, Organization ); |
422 | createField( FieldImpl::Organization, Organization ); | 428 | createField( FieldImpl::Organization, Organization ); |
423 | createField( FieldImpl::Note ); | 429 | createField( FieldImpl::Note ); |
424 | createField( FieldImpl::Url ); | 430 | createField( FieldImpl::Url ); |
425 | createField( FieldImpl::Resource ); | 431 | createField( FieldImpl::Resource ); |
426 | createField( FieldImpl::Sip ); | 432 | createField( FieldImpl::Sip ); |
427 | } | 433 | } |
428 | 434 | ||
429 | return mAllFields; | 435 | return mAllFields; |
430 | } | 436 | } |
431 | 437 | ||
432 | Field::List Field::defaultFields() | 438 | Field::List Field::defaultFields() |
433 | { | 439 | { |
434 | if ( mDefaultFields.isEmpty() ) { | 440 | if ( mDefaultFields.isEmpty() ) { |
435 | createDefaultField( FieldImpl::GivenName ); | 441 | createDefaultField( FieldImpl::GivenName ); |
436 | createDefaultField( FieldImpl::FamilyName ); | 442 | createDefaultField( FieldImpl::FamilyName ); |
437 | createDefaultField( FieldImpl::Email ); | 443 | createDefaultField( FieldImpl::Email ); |
438 | } | 444 | } |
439 | 445 | ||
440 | return mDefaultFields; | 446 | return mDefaultFields; |
441 | } | 447 | } |
442 | 448 | ||
443 | void Field::createField( int id, int category ) | 449 | void Field::createField( int id, int category ) |
444 | { | 450 | { |
445 | mAllFields.append( new Field( new FieldImpl( id, category ) ) ); | 451 | mAllFields.append( new Field( new FieldImpl( id, category ) ) ); |
446 | } | 452 | } |
447 | 453 | ||
448 | void Field::createDefaultField( int id, int category ) | 454 | void Field::createDefaultField( int id, int category ) |
449 | { | 455 | { |
450 | mDefaultFields.append( new Field( new FieldImpl( id, category ) ) ); | 456 | mDefaultFields.append( new Field( new FieldImpl( id, category ) ) ); |
451 | } | 457 | } |
452 | 458 | ||
453 | void Field::deleteFields() | 459 | void Field::deleteFields() |
454 | { | 460 | { |
455 | Field::List::ConstIterator it; | 461 | Field::List::ConstIterator it; |
456 | 462 | ||
457 | for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) { | 463 | for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) { |
458 | delete (*it); | 464 | delete (*it); |
459 | } | 465 | } |
460 | mAllFields.clear(); | 466 | mAllFields.clear(); |
461 | 467 | ||