summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-29 23:13:22 (UTC)
committer zautrix <zautrix>2004-10-29 23:13:22 (UTC)
commitda80b510e4643fa3f78cf3f97af108e87097583d (patch) (unidiff)
tree01c328362a6bf1898853ba26fd5d48eb5cff1e27
parentaafa695508796e86e9f267633ea5e6965d876031 (diff)
downloadkdepimpi-da80b510e4643fa3f78cf3f97af108e87097583d.zip
kdepimpi-da80b510e4643fa3f78cf3f97af108e87097583d.tar.gz
kdepimpi-da80b510e4643fa3f78cf3f97af108e87097583d.tar.bz2
added better category handling to kapi
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp4
-rw-r--r--kabc/addressee.h2
-rw-r--r--kabc/field.cpp6
-rw-r--r--kaddressbook/kabcore.cpp54
-rw-r--r--kaddressbook/kabcore.h5
5 files changed, 68 insertions, 3 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
1983void Addressee::setResource( Resource *resource ) 1983void Addressee::setResource( Resource *resource )
1984{ 1984{
1985 detach(); 1985 detach();
1986 mData->resource = resource; 1986 mData->resource = resource;
1987} 1987}
1988 1988
1989Resource *Addressee::resource() const 1989Resource *Addressee::resource() const
1990{ 1990{
1991 return mData->resource; 1991 return mData->resource;
1992} 1992}
1993 1993
1994//US 1994//US
1995QString Addressee::resourceLabel() 1995QString Addressee::resourceLabel()
1996{ 1996{
1997 return i18n("Resource"); 1997 return i18n("Resource");
1998} 1998}
1999QString Addressee::categoryLabel()
2000{
2001 return i18n("Category");
2002}
1999 2003
2000void Addressee::setChanged( bool value ) 2004void Addressee::setChanged( bool value )
2001{ 2005{
2002 detach(); 2006 detach();
2003 mData->changed = value; 2007 mData->changed = value;
2004} 2008}
2005 2009
2006bool Addressee::changed() const 2010bool Addressee::changed() const
2007{ 2011{
2008 return mData->changed; 2012 return mData->changed;
2009} 2013}
2010 2014
2011void Addressee::setTagged( bool value ) 2015void Addressee::setTagged( bool value )
2012{ 2016{
2013 detach(); 2017 detach();
2014 mData->tagged = value; 2018 mData->tagged = value;
2015} 2019}
2016 2020
2017bool Addressee::tagged() const 2021bool Addressee::tagged() const
2018{ 2022{
2019 return mData->tagged; 2023 return mData->tagged;
2020} 2024}
2021 2025
2022QDataStream &KABC::operator<<( QDataStream &s, const Addressee &a ) 2026QDataStream &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
2062QDataStream &KABC::operator>>( QDataStream &s, Addressee &a ) 2066QDataStream &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
848QDataStream &operator<<( QDataStream &, const Addressee & ); 848QDataStream &operator<<( QDataStream &, const Addressee & );
849QDataStream &operator>>( QDataStream &, Addressee & ); 849QDataStream &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/*
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 <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
37using namespace KABC; 37using namespace KABC;
38 38
39class Field::FieldImpl 39class 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
108Field::List Field::mAllFields; 109Field::List Field::mAllFields;
109Field::List Field::mDefaultFields; 110Field::List Field::mDefaultFields;
110Field::List Field::mCustomFields; 111Field::List Field::mCustomFields;
111 112
112 113
113Field::Field( FieldImpl *impl ) 114Field::Field( FieldImpl *impl )
114{ 115{
115 mImpl = impl; 116 mImpl = impl;
116} 117}
117 118
118Field::~Field() 119Field::~Field()
119{ 120{
120 delete mImpl; 121 delete mImpl;
121} 122}
122 123
123QString Field::label() 124QString 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
207int Field::category() 210int Field::category()
208{ 211{
209 return mImpl->category(); 212 return mImpl->category();
210} 213}
211 214
212QString Field::categoryLabel( int category ) 215QString 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
234QString Field::value( const KABC::Addressee &a ) 237QString 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
325bool Field::setValue( KABC::Addressee &a, const QString &value ) 330bool 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
382bool Field::isCustom() 387bool Field::isCustom()
383{ 388{
384 return mImpl->fieldId() == FieldImpl::CustomField; 389 return mImpl->fieldId() == FieldImpl::CustomField;
385} 390}
386 391
387Field::List Field::allFields() 392Field::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
432Field::List Field::defaultFields() 438Field::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
443void Field::createField( int id, int category ) 449void 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
448void Field::createDefaultField( int id, int category ) 454void 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
453void Field::deleteFields() 459void 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
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index e6bdde9..2c2f1a0 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1815,137 +1815,145 @@ void KABCore::initActions()
1815 mActionRedo->setEnabled( false ); 1815 mActionRedo->setEnabled( false );
1816 1816
1817 // settings menu 1817 // settings menu
1818#ifdef KAB_EMBEDDED 1818#ifdef KAB_EMBEDDED
1819//US special menuentry to configure the addressbook resources. On KDE 1819//US special menuentry to configure the addressbook resources. On KDE
1820// you do that through the control center !!! 1820// you do that through the control center !!!
1821 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1821 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1822 SLOT( configureResources() ), actionCollection(), 1822 SLOT( configureResources() ), actionCollection(),
1823 "kaddressbook_configure_resources" ); 1823 "kaddressbook_configure_resources" );
1824#endif //KAB_EMBEDDED 1824#endif //KAB_EMBEDDED
1825 1825
1826 if ( mIsPart ) { 1826 if ( mIsPart ) {
1827 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1827 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1828 SLOT( openConfigDialog() ), actionCollection(), 1828 SLOT( openConfigDialog() ), actionCollection(),
1829 "kaddressbook_configure" ); 1829 "kaddressbook_configure" );
1830 1830
1831 //US not implemented yet 1831 //US not implemented yet
1832 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1832 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1833 // this, SLOT( configureKeyBindings() ), actionCollection(), 1833 // this, SLOT( configureKeyBindings() ), actionCollection(),
1834 // "kaddressbook_configure_shortcuts" ); 1834 // "kaddressbook_configure_shortcuts" );
1835#ifdef KAB_EMBEDDED 1835#ifdef KAB_EMBEDDED
1836 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1836 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1837 mActionConfigureToolbars->setEnabled( false ); 1837 mActionConfigureToolbars->setEnabled( false );
1838#endif //KAB_EMBEDDED 1838#endif //KAB_EMBEDDED
1839 1839
1840 } else { 1840 } else {
1841 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1841 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1842 1842
1843 //US not implemented yet 1843 //US not implemented yet
1844 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1844 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1845 } 1845 }
1846 1846
1847 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1847 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1848 actionCollection(), "options_show_jump_bar" ); 1848 actionCollection(), "options_show_jump_bar" );
1849 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1849 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1850 1850
1851 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1851 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1852 actionCollection(), "options_show_details" ); 1852 actionCollection(), "options_show_details" );
1853 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1853 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1854 1854
1855 1855
1856 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 1856 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
1857 SLOT( toggleBeamReceive() ), actionCollection(), 1857 SLOT( toggleBeamReceive() ), actionCollection(),
1858 "kaddressbook_beam_rec" ); 1858 "kaddressbook_beam_rec" );
1859 1859
1860 1860
1861 // misc 1861 // misc
1862 // only enable LDAP lookup if we can handle the protocol 1862 // only enable LDAP lookup if we can handle the protocol
1863#ifndef KAB_EMBEDDED 1863#ifndef KAB_EMBEDDED
1864 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1864 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1865 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1865 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1866 this, SLOT( openLDAPDialog() ), actionCollection(), 1866 this, SLOT( openLDAPDialog() ), actionCollection(),
1867 "ldap_lookup" ); 1867 "ldap_lookup" );
1868 } 1868 }
1869#else //KAB_EMBEDDED 1869#else //KAB_EMBEDDED
1870 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1870 //qDebug("KABCore::initActions() LDAP has to be implemented");
1871#endif //KAB_EMBEDDED 1871#endif //KAB_EMBEDDED
1872 1872
1873 1873
1874 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1874 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1875 SLOT( setWhoAmI() ), actionCollection(), 1875 SLOT( setWhoAmI() ), actionCollection(),
1876 "set_personal" ); 1876 "set_personal" );
1877 1877
1878 1878
1879
1880
1881 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1879 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1882 SLOT( setCategories() ), actionCollection(), 1880 SLOT( setCategories() ), actionCollection(),
1883 "edit_set_categories" ); 1881 "edit_set_categories" );
1884 1882
1885 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1883 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1886 SLOT( removeVoice() ), actionCollection(), 1884 SLOT( removeVoice() ), actionCollection(),
1887 "remove_voice" ); 1885 "remove_voice" );
1886
1887 mActionSetCat= new KAction( i18n( "Set categories..." ), 0, this,
1888 SLOT( setCat() ), actionCollection(),
1889 "remove_voice" );
1890
1891
1892 mActionAddCat= new KAction( i18n( "Add categories..." ), 0, this,
1893 SLOT( addCat() ), actionCollection(),
1894 "remove_voice" );
1895
1888 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 1896 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1889 SLOT( importFromOL() ), actionCollection(), 1897 SLOT( importFromOL() ), actionCollection(),
1890 "import_OL" ); 1898 "import_OL" );
1891#ifdef KAB_EMBEDDED 1899#ifdef KAB_EMBEDDED
1892 mActionLicence = new KAction( i18n( "Licence" ), 0, 1900 mActionLicence = new KAction( i18n( "Licence" ), 0,
1893 this, SLOT( showLicence() ), actionCollection(), 1901 this, SLOT( showLicence() ), actionCollection(),
1894 "licence_about_data" ); 1902 "licence_about_data" );
1895 mActionFaq = new KAction( i18n( "Faq" ), 0, 1903 mActionFaq = new KAction( i18n( "Faq" ), 0,
1896 this, SLOT( faq() ), actionCollection(), 1904 this, SLOT( faq() ), actionCollection(),
1897 "faq_about_data" ); 1905 "faq_about_data" );
1898 mActionWN = new KAction( i18n( "What's New?" ), 0, 1906 mActionWN = new KAction( i18n( "What's New?" ), 0,
1899 this, SLOT( whatsnew() ), actionCollection(), 1907 this, SLOT( whatsnew() ), actionCollection(),
1900 "wn" ); 1908 "wn" );
1901 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 1909 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
1902 this, SLOT( synchowto() ), actionCollection(), 1910 this, SLOT( synchowto() ), actionCollection(),
1903 "sync" ); 1911 "sync" );
1904 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 1912 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
1905 this, SLOT( kdesynchowto() ), actionCollection(), 1913 this, SLOT( kdesynchowto() ), actionCollection(),
1906 "kdesync" ); 1914 "kdesync" );
1907 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 1915 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
1908 this, SLOT( multisynchowto() ), actionCollection(), 1916 this, SLOT( multisynchowto() ), actionCollection(),
1909 "multisync" ); 1917 "multisync" );
1910 1918
1911 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1919 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1912 this, SLOT( createAboutData() ), actionCollection(), 1920 this, SLOT( createAboutData() ), actionCollection(),
1913 "kaddressbook_about_data" ); 1921 "kaddressbook_about_data" );
1914#endif //KAB_EMBEDDED 1922#endif //KAB_EMBEDDED
1915 1923
1916 clipboardDataChanged(); 1924 clipboardDataChanged();
1917 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1925 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1918 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1926 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1919} 1927}
1920 1928
1921//US we need this function, to plug all actions into the correct menues. 1929//US we need this function, to plug all actions into the correct menues.
1922// KDE uses a XML format to plug the actions, but we work her without this overhead. 1930// KDE uses a XML format to plug the actions, but we work her without this overhead.
1923void KABCore::addActionsManually() 1931void KABCore::addActionsManually()
1924{ 1932{
1925//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1933//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1926 1934
1927#ifdef KAB_EMBEDDED 1935#ifdef KAB_EMBEDDED
1928 QPopupMenu *fileMenu = new QPopupMenu( this ); 1936 QPopupMenu *fileMenu = new QPopupMenu( this );
1929 QPopupMenu *editMenu = new QPopupMenu( this ); 1937 QPopupMenu *editMenu = new QPopupMenu( this );
1930 QPopupMenu *helpMenu = new QPopupMenu( this ); 1938 QPopupMenu *helpMenu = new QPopupMenu( this );
1931 1939
1932 KToolBar* tb = mMainWindow->toolBar(); 1940 KToolBar* tb = mMainWindow->toolBar();
1933 1941
1934#ifndef DESKTOP_VERSION 1942#ifndef DESKTOP_VERSION
1935 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 1943 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
1936#endif 1944#endif
1937 QMenuBar* mb = mMainWindow->menuBar(); 1945 QMenuBar* mb = mMainWindow->menuBar();
1938 1946
1939 //US setup menubar. 1947 //US setup menubar.
1940 //Disable the following block if you do not want to have a menubar. 1948 //Disable the following block if you do not want to have a menubar.
1941 mb->insertItem( "&File", fileMenu ); 1949 mb->insertItem( "&File", fileMenu );
1942 mb->insertItem( "&Edit", editMenu ); 1950 mb->insertItem( "&Edit", editMenu );
1943 mb->insertItem( "&View", viewMenu ); 1951 mb->insertItem( "&View", viewMenu );
1944 mb->insertItem( "&Settings", settingsMenu ); 1952 mb->insertItem( "&Settings", settingsMenu );
1945 mb->insertItem( i18n("Synchronize"), syncMenu ); 1953 mb->insertItem( i18n("Synchronize"), syncMenu );
1946 mb->insertItem( "&Change selected", changeMenu ); 1954 mb->insertItem( "&Change selected", changeMenu );
1947 mb->insertItem( "&Help", helpMenu ); 1955 mb->insertItem( "&Help", helpMenu );
1948 mIncSearchWidget = new IncSearchWidget( tb ); 1956 mIncSearchWidget = new IncSearchWidget( tb );
1949 // tb->insertWidget(-1, 0, mIncSearchWidget); 1957 // tb->insertWidget(-1, 0, mIncSearchWidget);
1950#ifndef DESKTOP_VERSION 1958#ifndef DESKTOP_VERSION
1951 } else { 1959 } else {
@@ -1953,210 +1961,252 @@ void KABCore::addActionsManually()
1953 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 1961 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
1954 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1962 QPopupMenu *popupBarTB = new QPopupMenu( this );
1955 menuBarTB->insertItem( "ME", popupBarTB); 1963 menuBarTB->insertItem( "ME", popupBarTB);
1956 tb->insertWidget(-1, 0, menuBarTB); 1964 tb->insertWidget(-1, 0, menuBarTB);
1957 mIncSearchWidget = new IncSearchWidget( tb ); 1965 mIncSearchWidget = new IncSearchWidget( tb );
1958 1966
1959 tb->enableMoving(false); 1967 tb->enableMoving(false);
1960 popupBarTB->insertItem( "&File", fileMenu ); 1968 popupBarTB->insertItem( "&File", fileMenu );
1961 popupBarTB->insertItem( "&Edit", editMenu ); 1969 popupBarTB->insertItem( "&Edit", editMenu );
1962 popupBarTB->insertItem( "&View", viewMenu ); 1970 popupBarTB->insertItem( "&View", viewMenu );
1963 popupBarTB->insertItem( "&Settings", settingsMenu ); 1971 popupBarTB->insertItem( "&Settings", settingsMenu );
1964 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 1972 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
1965 mViewManager->getFilterAction()->plug ( popupBarTB); 1973 mViewManager->getFilterAction()->plug ( popupBarTB);
1966 popupBarTB->insertItem( "&Change selected", changeMenu ); 1974 popupBarTB->insertItem( "&Change selected", changeMenu );
1967 popupBarTB->insertItem( "&Help", helpMenu ); 1975 popupBarTB->insertItem( "&Help", helpMenu );
1968 if (QApplication::desktop()->width() > 320 ) { 1976 if (QApplication::desktop()->width() > 320 ) {
1969 // mViewManager->getFilterAction()->plug ( tb); 1977 // mViewManager->getFilterAction()->plug ( tb);
1970 } 1978 }
1971 } 1979 }
1972#endif 1980#endif
1973 // mActionQuit->plug ( mMainWindow->toolBar()); 1981 // mActionQuit->plug ( mMainWindow->toolBar());
1974 1982
1975 1983
1976 1984
1977 //US Now connect the actions with the menue entries. 1985 //US Now connect the actions with the menue entries.
1978 mActionPrint->plug( fileMenu ); 1986 mActionPrint->plug( fileMenu );
1979 mActionMail->plug( fileMenu ); 1987 mActionMail->plug( fileMenu );
1980 fileMenu->insertSeparator(); 1988 fileMenu->insertSeparator();
1981 1989
1982 mActionNewContact->plug( fileMenu ); 1990 mActionNewContact->plug( fileMenu );
1983 mActionNewContact->plug( tb ); 1991 mActionNewContact->plug( tb );
1984 1992
1985 mActionEditAddressee->plug( fileMenu ); 1993 mActionEditAddressee->plug( fileMenu );
1986 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 1994 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
1987 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 1995 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
1988 mActionEditAddressee->plug( tb ); 1996 mActionEditAddressee->plug( tb );
1989 1997
1990 fileMenu->insertSeparator(); 1998 fileMenu->insertSeparator();
1991 mActionSave->plug( fileMenu ); 1999 mActionSave->plug( fileMenu );
1992 fileMenu->insertItem( "&Import", ImportMenu ); 2000 fileMenu->insertItem( "&Import", ImportMenu );
1993 fileMenu->insertItem( "&Export", ExportMenu ); 2001 fileMenu->insertItem( "&Export", ExportMenu );
1994 fileMenu->insertSeparator(); 2002 fileMenu->insertSeparator();
1995 mActionMailVCard->plug( fileMenu ); 2003 mActionMailVCard->plug( fileMenu );
1996#ifndef DESKTOP_VERSION 2004#ifndef DESKTOP_VERSION
1997 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 2005 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1998 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 2006 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1999#endif 2007#endif
2000 fileMenu->insertSeparator(); 2008 fileMenu->insertSeparator();
2001 mActionQuit->plug( fileMenu ); 2009 mActionQuit->plug( fileMenu );
2002#ifdef _WIN32_ 2010#ifdef _WIN32_
2003 mActionImportOL->plug( ImportMenu ); 2011 mActionImportOL->plug( ImportMenu );
2004#endif 2012#endif
2005 // edit menu 2013 // edit menu
2006 mActionUndo->plug( editMenu ); 2014 mActionUndo->plug( editMenu );
2007 mActionRedo->plug( editMenu ); 2015 mActionRedo->plug( editMenu );
2008 editMenu->insertSeparator(); 2016 editMenu->insertSeparator();
2009 mActionCut->plug( editMenu ); 2017 mActionCut->plug( editMenu );
2010 mActionCopy->plug( editMenu ); 2018 mActionCopy->plug( editMenu );
2011 mActionPaste->plug( editMenu ); 2019 mActionPaste->plug( editMenu );
2012 mActionDelete->plug( editMenu ); 2020 mActionDelete->plug( editMenu );
2013 editMenu->insertSeparator(); 2021 editMenu->insertSeparator();
2014 mActionSelectAll->plug( editMenu ); 2022 mActionSelectAll->plug( editMenu );
2015 2023
2016 mActionRemoveVoice->plug( changeMenu ); 2024 mActionRemoveVoice->plug( changeMenu );
2025 mActionSetCat->plug( changeMenu );
2026 mActionAddCat->plug( changeMenu );
2017 // settings menu 2027 // settings menu
2018//US special menuentry to configure the addressbook resources. On KDE 2028//US special menuentry to configure the addressbook resources. On KDE
2019// you do that through the control center !!! 2029// you do that through the control center !!!
2020 mActionConfigResources->plug( settingsMenu ); 2030 mActionConfigResources->plug( settingsMenu );
2021 settingsMenu->insertSeparator(); 2031 settingsMenu->insertSeparator();
2022 2032
2023 mActionConfigKAddressbook->plug( settingsMenu ); 2033 mActionConfigKAddressbook->plug( settingsMenu );
2024 2034
2025 if ( mIsPart ) { 2035 if ( mIsPart ) {
2026 //US not implemented yet 2036 //US not implemented yet
2027 //mActionConfigShortcuts->plug( settingsMenu ); 2037 //mActionConfigShortcuts->plug( settingsMenu );
2028 //mActionConfigureToolbars->plug( settingsMenu ); 2038 //mActionConfigureToolbars->plug( settingsMenu );
2029 2039
2030 } else { 2040 } else {
2031 //US not implemented yet 2041 //US not implemented yet
2032 //mActionKeyBindings->plug( settingsMenu ); 2042 //mActionKeyBindings->plug( settingsMenu );
2033 } 2043 }
2034 2044
2035 settingsMenu->insertSeparator(); 2045 settingsMenu->insertSeparator();
2036 2046
2037 mActionJumpBar->plug( settingsMenu ); 2047 mActionJumpBar->plug( settingsMenu );
2038 mActionDetails->plug( settingsMenu ); 2048 mActionDetails->plug( settingsMenu );
2039 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2049 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2040 mActionDetails->plug( tb ); 2050 mActionDetails->plug( tb );
2041 settingsMenu->insertSeparator(); 2051 settingsMenu->insertSeparator();
2042 mActionBR->plug(settingsMenu ); 2052 mActionBR->plug(settingsMenu );
2043 settingsMenu->insertSeparator(); 2053 settingsMenu->insertSeparator();
2044 2054
2045 mActionWhoAmI->plug( settingsMenu ); 2055 mActionWhoAmI->plug( settingsMenu );
2046 mActionCategories->plug( settingsMenu ); 2056 mActionCategories->plug( settingsMenu );
2047 2057
2048 2058
2049 mActionWN->plug( helpMenu ); 2059 mActionWN->plug( helpMenu );
2050 mActionSyncHowto->plug( helpMenu ); 2060 mActionSyncHowto->plug( helpMenu );
2051 mActionKdeSyncHowto->plug( helpMenu ); 2061 mActionKdeSyncHowto->plug( helpMenu );
2052 mActionMultiSyncHowto->plug( helpMenu ); 2062 mActionMultiSyncHowto->plug( helpMenu );
2053 mActionFaq->plug( helpMenu ); 2063 mActionFaq->plug( helpMenu );
2054 mActionLicence->plug( helpMenu ); 2064 mActionLicence->plug( helpMenu );
2055 mActionAboutKAddressbook->plug( helpMenu ); 2065 mActionAboutKAddressbook->plug( helpMenu );
2056 2066
2057 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2067 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2058 2068
2059 mActionSave->plug( tb ); 2069 mActionSave->plug( tb );
2060 mViewManager->getFilterAction()->plug ( tb); 2070 mViewManager->getFilterAction()->plug ( tb);
2061 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2071 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
2062 mActionUndo->plug( tb ); 2072 mActionUndo->plug( tb );
2063 mActionDelete->plug( tb ); 2073 mActionDelete->plug( tb );
2064 mActionRedo->plug( tb ); 2074 mActionRedo->plug( tb );
2065 } 2075 }
2066 } else { 2076 } else {
2067 mActionSave->plug( tb ); 2077 mActionSave->plug( tb );
2068 tb->enableMoving(false); 2078 tb->enableMoving(false);
2069 } 2079 }
2070 //mActionQuit->plug ( tb ); 2080 //mActionQuit->plug ( tb );
2071 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2081 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2072 2082
2073 //US link the searchwidget first to this. 2083 //US link the searchwidget first to this.
2074 // The real linkage to the toolbar happens later. 2084 // The real linkage to the toolbar happens later.
2075//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2085//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2076//US tb->insertItem( mIncSearchWidget ); 2086//US tb->insertItem( mIncSearchWidget );
2077/*US 2087/*US
2078 mIncSearchWidget = new IncSearchWidget( tb ); 2088 mIncSearchWidget = new IncSearchWidget( tb );
2079 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2089 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2080 SLOT( incrementalSearch( const QString& ) ) ); 2090 SLOT( incrementalSearch( const QString& ) ) );
2081 2091
2082 mJumpButtonBar = new JumpButtonBar( this, this ); 2092 mJumpButtonBar = new JumpButtonBar( this, this );
2083 2093
2084//US topLayout->addWidget( mJumpButtonBar ); 2094//US topLayout->addWidget( mJumpButtonBar );
2085 this->layout()->add( mJumpButtonBar ); 2095 this->layout()->add( mJumpButtonBar );
2086*/ 2096*/
2087 2097
2088#endif //KAB_EMBEDDED 2098#endif //KAB_EMBEDDED
2089 2099
2090 mActionExport2phone->plug( ExportMenu ); 2100 mActionExport2phone->plug( ExportMenu );
2091 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2101 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2092 syncManager->fillSyncMenu(); 2102 syncManager->fillSyncMenu();
2093 2103
2094} 2104}
2095void KABCore::showLicence() 2105void KABCore::showLicence()
2096{ 2106{
2097 KApplication::showLicence(); 2107 KApplication::showLicence();
2098} 2108}
2109void KABCore::setCat()
2110{
2111 setCategories( true );
2112}
2113void KABCore::addCat()
2114{
2115 setCategories( false );
2116}
2117void KABCore::setCategories( bool removeOld )
2118{
2119 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KABPrefs::instance(), 0 );
2120 if (! csd->exec()) {
2121 message( i18n("Setting categories cancelled") );
2122 delete csd;
2123 return;
2124 }
2125 message( i18n("Setting categories ... please wait!") );
2126 QStringList catList = csd->selectedCategories();
2127 delete csd;
2128 catList.sort();
2129 QStringList newList;
2130 KABC::Addressee::List list = mViewManager->selectedAddressees();
2131 KABC::Addressee::List::Iterator it;
2132 for ( it = list.begin(); it != list.end(); ++it ) {
2133 if ( removeOld ) {
2134 (*it).setCategories( catList );
2135 } else {
2136 newList = (*it).categories();
2137 int i;
2138 for( i = 0; i< catList.count(); ++i ) {
2139 if ( !newList.contains (catList[i]))
2140 newList.append( catList[i] );
2141 }
2142 newList.sort();
2143 (*it).setCategories( newList );
2144 }
2145 contactModified((*it) );
2146 }
2147 message( i18n("Setting categories completed!") );
2148}
2099void KABCore::removeVoice() 2149void KABCore::removeVoice()
2100{ 2150{
2101 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2151 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2102 return; 2152 return;
2103 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2153 KABC::Addressee::List list = mViewManager->selectedAddressees();
2104 KABC::Addressee::List::Iterator it; 2154 KABC::Addressee::List::Iterator it;
2105 for ( it = list.begin(); it != list.end(); ++it ) { 2155 for ( it = list.begin(); it != list.end(); ++it ) {
2106 2156
2107 if ( (*it).removeVoice() ) 2157 if ( (*it).removeVoice() )
2108 contactModified((*it) ); 2158 contactModified((*it) );
2109 } 2159 }
2110} 2160}
2111 2161
2112 2162
2113 2163
2114void KABCore::clipboardDataChanged() 2164void KABCore::clipboardDataChanged()
2115{ 2165{
2116 2166
2117 if ( mReadWrite ) 2167 if ( mReadWrite )
2118 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2168 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2119 2169
2120} 2170}
2121 2171
2122void KABCore::updateActionMenu() 2172void KABCore::updateActionMenu()
2123{ 2173{
2124 UndoStack *undo = UndoStack::instance(); 2174 UndoStack *undo = UndoStack::instance();
2125 RedoStack *redo = RedoStack::instance(); 2175 RedoStack *redo = RedoStack::instance();
2126 2176
2127 if ( undo->isEmpty() ) 2177 if ( undo->isEmpty() )
2128 mActionUndo->setText( i18n( "Undo" ) ); 2178 mActionUndo->setText( i18n( "Undo" ) );
2129 else 2179 else
2130 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2180 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2131 2181
2132 mActionUndo->setEnabled( !undo->isEmpty() ); 2182 mActionUndo->setEnabled( !undo->isEmpty() );
2133 2183
2134 if ( !redo->top() ) 2184 if ( !redo->top() )
2135 mActionRedo->setText( i18n( "Redo" ) ); 2185 mActionRedo->setText( i18n( "Redo" ) );
2136 else 2186 else
2137 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2187 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2138 2188
2139 mActionRedo->setEnabled( !redo->isEmpty() ); 2189 mActionRedo->setEnabled( !redo->isEmpty() );
2140} 2190}
2141 2191
2142void KABCore::configureKeyBindings() 2192void KABCore::configureKeyBindings()
2143{ 2193{
2144#ifndef KAB_EMBEDDED 2194#ifndef KAB_EMBEDDED
2145 KKeyDialog::configure( actionCollection(), true ); 2195 KKeyDialog::configure( actionCollection(), true );
2146#else //KAB_EMBEDDED 2196#else //KAB_EMBEDDED
2147 qDebug("KABCore::configureKeyBindings() not implemented"); 2197 qDebug("KABCore::configureKeyBindings() not implemented");
2148#endif //KAB_EMBEDDED 2198#endif //KAB_EMBEDDED
2149} 2199}
2150 2200
2151#ifdef KAB_EMBEDDED 2201#ifdef KAB_EMBEDDED
2152void KABCore::configureResources() 2202void KABCore::configureResources()
2153{ 2203{
2154 KRES::KCMKResources dlg( this, "" , 0 ); 2204 KRES::KCMKResources dlg( this, "" , 0 );
2155 2205
2156 if ( !dlg.exec() ) 2206 if ( !dlg.exec() )
2157 return; 2207 return;
2158 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2208 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2159} 2209}
2160#endif //KAB_EMBEDDED 2210#endif //KAB_EMBEDDED
2161 2211
2162 2212
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c01d598..1bdae5f 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -309,200 +309,205 @@ class KABCore : public QWidget, public KSyncInterface
309 309
310 /** 310 /**
311 Shows the edit dialog for the given uid. If the uid is QString::null, 311 Shows the edit dialog for the given uid. If the uid is QString::null,
312 the method will try to find a selected addressee in the view. 312 the method will try to find a selected addressee in the view.
313 */ 313 */
314 void editContact( const QString &uid /*US = QString::null*/ ); 314 void editContact( const QString &uid /*US = QString::null*/ );
315//US added a second method without defaultparameter 315//US added a second method without defaultparameter
316 void editContact2(); 316 void editContact2();
317 317
318 /** 318 /**
319 Shows or edits the detail view for the given uid. If the uid is QString::null, 319 Shows or edits the detail view for the given uid. If the uid is QString::null,
320 the method will try to find a selected addressee in the view. 320 the method will try to find a selected addressee in the view.
321 */ 321 */
322 void executeContact( const QString &uid /*US = QString::null*/ ); 322 void executeContact( const QString &uid /*US = QString::null*/ );
323 323
324 /** 324 /**
325 Launches the configuration dialog. 325 Launches the configuration dialog.
326 */ 326 */
327 void openConfigDialog(); 327 void openConfigDialog();
328 328
329 /** 329 /**
330 Launches the ldap search dialog. 330 Launches the ldap search dialog.
331 */ 331 */
332 void openLDAPDialog(); 332 void openLDAPDialog();
333 333
334 /** 334 /**
335 Creates a KAddressBookPrinter, which will display the print 335 Creates a KAddressBookPrinter, which will display the print
336 dialog and do the printing. 336 dialog and do the printing.
337 */ 337 */
338 void print(); 338 void print();
339 339
340 /** 340 /**
341 Registers a new GUI client, so plugins can register its actions. 341 Registers a new GUI client, so plugins can register its actions.
342 */ 342 */
343 void addGUIClient( KXMLGUIClient *client ); 343 void addGUIClient( KXMLGUIClient *client );
344 344
345 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 345 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
346 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 346 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
347 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 347 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
348 348
349 349
350 signals: 350 signals:
351 void contactSelected( const QString &name ); 351 void contactSelected( const QString &name );
352 void contactSelected( const QPixmap &pixmap ); 352 void contactSelected( const QPixmap &pixmap );
353 public slots: 353 public slots:
354 void recieve(QString cmsg ); 354 void recieve(QString cmsg );
355 void getFile( bool success ); 355 void getFile( bool success );
356 void syncFileRequest(); 356 void syncFileRequest();
357 void setDetailsVisible( bool visible ); 357 void setDetailsVisible( bool visible );
358 void setDetailsToState(); 358 void setDetailsToState();
359 // void slotSyncMenu( int ); 359 // void slotSyncMenu( int );
360 private slots: 360 private slots:
361 void receive( const QCString& cmsg, const QByteArray& data ); 361 void receive( const QCString& cmsg, const QByteArray& data );
362 void toggleBeamReceive( ); 362 void toggleBeamReceive( );
363 void disableBR(bool); 363 void disableBR(bool);
364 void setJumpButtonBarVisible( bool visible ); 364 void setJumpButtonBarVisible( bool visible );
365 void setCaptionBack(); 365 void setCaptionBack();
366 void importFromOL(); 366 void importFromOL();
367 void extensionModified( const KABC::Addressee::List &list ); 367 void extensionModified( const KABC::Addressee::List &list );
368 void extensionChanged( int id ); 368 void extensionChanged( int id );
369 void clipboardDataChanged(); 369 void clipboardDataChanged();
370 void updateActionMenu(); 370 void updateActionMenu();
371 void configureKeyBindings(); 371 void configureKeyBindings();
372 void removeVoice(); 372 void removeVoice();
373 void setCat();
374 void addCat();
375 void setCategories( bool removeOld );
373#ifdef KAB_EMBEDDED 376#ifdef KAB_EMBEDDED
374 void configureResources(); 377 void configureResources();
375#endif //KAB_EMBEDDED 378#endif //KAB_EMBEDDED
376 379
377 void slotEditorDestroyed( const QString &uid ); 380 void slotEditorDestroyed( const QString &uid );
378 void configurationChanged(); 381 void configurationChanged();
379 void addressBookChanged(); 382 void addressBookChanged();
380 383
381 private: 384 private:
382 bool mBRdisabled; 385 bool mBRdisabled;
383#ifndef DESKTOP_VERSION 386#ifndef DESKTOP_VERSION
384 QCopChannel* infrared; 387 QCopChannel* infrared;
385#endif 388#endif
386 QTimer *mMessageTimer; 389 QTimer *mMessageTimer;
387 void initGUI(); 390 void initGUI();
388 void initActions(); 391 void initActions();
389 QString getPhoneFile(); 392 QString getPhoneFile();
390 393
391 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 394 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
392 const char *name = 0 ); 395 const char *name = 0 );
393 396
394 KXMLGUIClient *mGUIClient; 397 KXMLGUIClient *mGUIClient;
395 398
396 KABC::AddressBook *mAddressBook; 399 KABC::AddressBook *mAddressBook;
397 400
398 ViewManager *mViewManager; 401 ViewManager *mViewManager;
399 // QSplitter *mDetailsSplitter; 402 // QSplitter *mDetailsSplitter;
400 KDGanttMinimizeSplitter *mExtensionBarSplitter; 403 KDGanttMinimizeSplitter *mExtensionBarSplitter;
401 ViewContainer *mDetails; 404 ViewContainer *mDetails;
402 KDGanttMinimizeSplitter* mMiniSplitter; 405 KDGanttMinimizeSplitter* mMiniSplitter;
403 XXPortManager *mXXPortManager; 406 XXPortManager *mXXPortManager;
404 JumpButtonBar *mJumpButtonBar; 407 JumpButtonBar *mJumpButtonBar;
405 IncSearchWidget *mIncSearchWidget; 408 IncSearchWidget *mIncSearchWidget;
406 ExtensionManager *mExtensionManager; 409 ExtensionManager *mExtensionManager;
407 410
408 KCMultiDialog *mConfigureDialog; 411 KCMultiDialog *mConfigureDialog;
409 412
410#ifndef KAB_EMBEDDED 413#ifndef KAB_EMBEDDED
411 LDAPSearchDialog *mLdapSearchDialog; 414 LDAPSearchDialog *mLdapSearchDialog;
412#endif //KAB_EMBEDDED 415#endif //KAB_EMBEDDED
413 // QDict<AddresseeEditorDialog> mEditorDict; 416 // QDict<AddresseeEditorDialog> mEditorDict;
414 AddresseeEditorDialog *mEditorDialog; 417 AddresseeEditorDialog *mEditorDialog;
415 bool mReadWrite; 418 bool mReadWrite;
416 bool mModified; 419 bool mModified;
417 bool mIsPart; 420 bool mIsPart;
418 bool mMultipleViewsAtOnce; 421 bool mMultipleViewsAtOnce;
419 422
420 423
421 //US file menu 424 //US file menu
422 KAction *mActionMail; 425 KAction *mActionMail;
423 KAction *mActionBeam; 426 KAction *mActionBeam;
424 KToggleAction *mActionBR; 427 KToggleAction *mActionBR;
425 KAction *mActionExport2phone; 428 KAction *mActionExport2phone;
426 KAction* mActionPrint; 429 KAction* mActionPrint;
427 KAction* mActionNewContact; 430 KAction* mActionNewContact;
428 KAction *mActionSave; 431 KAction *mActionSave;
429 KAction *mActionEditAddressee; 432 KAction *mActionEditAddressee;
430 KAction *mActionMailVCard; 433 KAction *mActionMailVCard;
431 KAction *mActionBeamVCard; 434 KAction *mActionBeamVCard;
432 435
433 KAction *mActionQuit; 436 KAction *mActionQuit;
434 437
435 //US edit menu 438 //US edit menu
436 KAction *mActionCopy; 439 KAction *mActionCopy;
437 KAction *mActionCut; 440 KAction *mActionCut;
438 KAction *mActionPaste; 441 KAction *mActionPaste;
439 KAction *mActionSelectAll; 442 KAction *mActionSelectAll;
440 KAction *mActionUndo; 443 KAction *mActionUndo;
441 KAction *mActionRedo; 444 KAction *mActionRedo;
442 KAction *mActionDelete; 445 KAction *mActionDelete;
443 446
444 //US settings menu 447 //US settings menu
445 KAction *mActionConfigResources; 448 KAction *mActionConfigResources;
446 KAction *mActionConfigKAddressbook; 449 KAction *mActionConfigKAddressbook;
447 KAction *mActionConfigShortcuts; 450 KAction *mActionConfigShortcuts;
448 KAction *mActionConfigureToolbars; 451 KAction *mActionConfigureToolbars;
449 KAction *mActionKeyBindings; 452 KAction *mActionKeyBindings;
450 KToggleAction *mActionJumpBar; 453 KToggleAction *mActionJumpBar;
451 KToggleAction *mActionDetails; 454 KToggleAction *mActionDetails;
452 KAction *mActionWhoAmI; 455 KAction *mActionWhoAmI;
453 KAction *mActionCategories; 456 KAction *mActionCategories;
454 KAction *mActionAboutKAddressbook; 457 KAction *mActionAboutKAddressbook;
455 KAction *mActionLicence; 458 KAction *mActionLicence;
456 KAction *mActionFaq; 459 KAction *mActionFaq;
457 KAction *mActionWN; 460 KAction *mActionWN;
458 KAction *mActionSyncHowto; 461 KAction *mActionSyncHowto;
459 KAction *mActionKdeSyncHowto; 462 KAction *mActionKdeSyncHowto;
460 KAction *mActionMultiSyncHowto; 463 KAction *mActionMultiSyncHowto;
461 464
462 KAction *mActionDeleteView; 465 KAction *mActionDeleteView;
463 466
464 QPopupMenu *viewMenu; 467 QPopupMenu *viewMenu;
465 QPopupMenu *filterMenu; 468 QPopupMenu *filterMenu;
466 QPopupMenu *settingsMenu; 469 QPopupMenu *settingsMenu;
467 QPopupMenu *changeMenu; 470 QPopupMenu *changeMenu;
468//US QAction *mActionSave; 471//US QAction *mActionSave;
469 QPopupMenu *ImportMenu; 472 QPopupMenu *ImportMenu;
470 QPopupMenu *ExportMenu; 473 QPopupMenu *ExportMenu;
471 //LR additional methods 474 //LR additional methods
472 KAction *mActionRemoveVoice; 475 KAction *mActionRemoveVoice;
476 KAction *mActionSetCat;
477 KAction *mActionAddCat;
473 KAction * mActionImportOL; 478 KAction * mActionImportOL;
474 479
475#ifndef KAB_EMBEDDED 480#ifndef KAB_EMBEDDED
476 KAddressBookService *mAddressBookService; 481 KAddressBookService *mAddressBookService;
477#endif //KAB_EMBEDDED 482#endif //KAB_EMBEDDED
478 483
479 class KABCorePrivate; 484 class KABCorePrivate;
480 KABCorePrivate *d; 485 KABCorePrivate *d;
481 //US bool mBlockSaveFlag; 486 //US bool mBlockSaveFlag;
482 487
483#ifdef KAB_EMBEDDED 488#ifdef KAB_EMBEDDED
484 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 489 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
485#endif //KAB_EMBEDDED 490#endif //KAB_EMBEDDED
486 491
487 //this are the overwritten callbackmethods from the syncinterface 492 //this are the overwritten callbackmethods from the syncinterface
488 virtual bool sync(KSyncManager* manager, QString filename, int mode); 493 virtual bool sync(KSyncManager* manager, QString filename, int mode);
489 virtual bool syncExternal(KSyncManager* manager, QString resource); 494 virtual bool syncExternal(KSyncManager* manager, QString resource);
490 virtual void removeSyncInfo( QString syncProfile); 495 virtual void removeSyncInfo( QString syncProfile);
491 bool syncPhone(); 496 bool syncPhone();
492 void message( QString m ); 497 void message( QString m );
493 498
494 // LR ******************************* 499 // LR *******************************
495 // sync stuff! 500 // sync stuff!
496 QString sentSyncFile(); 501 QString sentSyncFile();
497 QPopupMenu *syncMenu; 502 QPopupMenu *syncMenu;
498 KSyncManager* syncManager; 503 KSyncManager* syncManager;
499 int mGlobalSyncMode; 504 int mGlobalSyncMode;
500 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 505 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
501 KABC::Addressee getLastSyncAddressee(); 506 KABC::Addressee getLastSyncAddressee();
502 QDateTime mLastAddressbookSync; 507 QDateTime mLastAddressbookSync;
503 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 508 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
504 // ********************* 509 // *********************
505 510
506}; 511};
507 512
508#endif 513#endif