summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile.Embedded16
-rw-r--r--kabc/converter/qtopia/qtopiaE.pro12
-rw-r--r--kabc/converter/qtopia/qtopiaconverter.cpp52
-rw-r--r--kabc/converter/qtopia/qtopiaconverter.h4
4 files changed, 49 insertions, 35 deletions
diff --git a/Makefile.Embedded b/Makefile.Embedded
index aaba10a..3160017 100644
--- a/Makefile.Embedded
+++ b/Makefile.Embedded
@@ -1,108 +1,114 @@
1DISTPATH = $(shell pwd) 1DISTPATH = $(shell pwd)
2DISTDIR = $(shell basename $(DISTPATH)) 2DISTDIR = $(shell basename $(DISTPATH))
3 3
4SUBDIRS = libical/src/libical libical/src/libicalss qtcompat microkde \ 4SUBDIRS = libical/src/libical libical/src/libicalss qtcompat microkde \
5 libkcal libkdepim kabc kabc/converter/opie kabc/formats/binary kabc/plugins/file kabc/plugins/dir \ 5 libkcal libkdepim kabc kabc/converter/opie kabc/converter/qtopia kabc/formats/binary \
6 kabc/plugins/file kabc/plugins/dir \
6 kabc/plugins/ldap kabc/plugins/opie kabc/plugins/qtopia \ 7 kabc/plugins/ldap kabc/plugins/opie kabc/plugins/qtopia \
7 korganizer kalarmd kaddressbook/xxport/opie kaddressbook 8 korganizer kalarmd kaddressbook/xxport/opie kaddressbook
8all: tmake 9all: tmake
9 for i in $(SUBDIRS); do pushd $$i; \ 10 for i in $(SUBDIRS); do pushd $$i; \
10 make -f Makefile$(PLATFORM) || exit 1; popd; \ 11 make -f Makefile$(PLATFORM) || exit 1; popd; \
11 done 12 done
12 13
13objects: 14objects:
14 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done 15 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done
15 for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done 16 for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done
16 mkdir -p libical/lib/$(PLATFORM) 17 mkdir -p libical/lib/$(PLATFORM)
17 18
18clean: 19clean:
19 rm -f libical/lib/$(PLATFORM)/*; 20 rm -f libical/lib/$(PLATFORM)/*;
20 for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ 21 for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\
21 rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \ 22 rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \
22 done 23 done
23install: 24install:
24 cd bin/kdepim; make install 25 cd bin/kdepim; make install
25 cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop 26 cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop
26 cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop 27 cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop
27 28
28dist: 29dist:
29 @echo Dont forget to do "make install" before "make dist" 30 @echo Dont forget to do "make install" before "make dist"
30 rm -f *arm.ipk 31 rm -f *arm.ipk
31 rm -f *~ 32 rm -f *~
32 cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc kdepim 33 cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc kdepim
33 mkipks kdepim.control 34 mkipks kdepim.control
34 mkipks korganizer-alarm.control 35 mkipks korganizer-alarm.control
35 36
36tmake: objects qtcompat/Makefile$(PLATFORM) microkde/Makefile$(PLATFORM) \ 37tmake: objects qtcompat/Makefile$(PLATFORM) microkde/Makefile$(PLATFORM) \
37 libkcal/Makefile$(PLATFORM) \ 38 libkcal/Makefile$(PLATFORM) \
38 libkdepim/Makefile$(PLATFORM) korganizer/Makefile$(PLATFORM) \ 39 libkdepim/Makefile$(PLATFORM) korganizer/Makefile$(PLATFORM) \
39 kalarmd/Makefile$(PLATFORM) \ 40 kalarmd/Makefile$(PLATFORM) \
40 libical/src/libical/Makefile$(PLATFORM) \ 41 libical/src/libical/Makefile$(PLATFORM) \
41 libical/src/libicalss/Makefile$(PLATFORM) \ 42 libical/src/libicalss/Makefile$(PLATFORM) \
42 kabc/Makefile$(PLATFORM) \ 43 kabc/Makefile$(PLATFORM) \
43 kabc/converter/opie/Makefile$(PLATFORM) \ 44 kabc/converter/opie/Makefile$(PLATFORM) \
45 kabc/converter/qtopia/Makefile$(PLATFORM) \
44 kabc/formats/binary/Makefile$(PLATFORM) \ 46 kabc/formats/binary/Makefile$(PLATFORM) \
45 kabc/plugins/file/Makefile$(PLATFORM) \ 47 kabc/plugins/file/Makefile$(PLATFORM) \
46 kabc/plugins/dir/Makefile$(PLATFORM) \ 48 kabc/plugins/dir/Makefile$(PLATFORM) \
47 kabc/plugins/ldap/Makefile$(PLATFORM) \ 49 kabc/plugins/ldap/Makefile$(PLATFORM) \
48 kabc/plugins/opie/Makefile$(PLATFORM) \ 50 kabc/plugins/opie/Makefile$(PLATFORM) \
49 kabc/plugins/qtopia/Makefile$(PLATFORM) kaddressbook/xxport/opie/Makefile$(PLATFORM) \ 51 kabc/plugins/qtopia/Makefile$(PLATFORM) \
52 kaddressbook/xxport/opie/Makefile$(PLATFORM) \
50 kaddressbook/Makefile$(PLATFORM) 53 kaddressbook/Makefile$(PLATFORM)
51 54
52 55
53 56
54qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro 57qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro
55 cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM) 58 cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM)
56 59
57microkde/Makefile$(PLATFORM): microkde/microkdeE.pro 60microkde/Makefile$(PLATFORM): microkde/microkdeE.pro
58 cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM) 61 cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM)
59 62
60libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro 63libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro
61 cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM) 64 cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM)
62 65
63 66
64libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro 67libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro
65 cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" libkdepimE.pro -o Makefile$(PLATFORM) 68 cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" libkdepimE.pro -o Makefile$(PLATFORM)
66 69
67kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro 70kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro
68 cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" kalarmdE.pro -o Makefile$(PLATFORM) 71 cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" kalarmdE.pro -o Makefile$(PLATFORM)
69 72
70korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro 73korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro
71 cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM) 74 cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM)
72 75
73libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro 76libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro
74 cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM) 77 cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM)
75 78
76libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro 79libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro
77 cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM) 80 cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM)
78 81
79kabc/Makefile$(PLATFORM): kabc/kabcE.pro 82kabc/Makefile$(PLATFORM): kabc/kabcE.pro
80 cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM) 83 cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM)
81 84
82kabc/converter/opie/Makefile$(PLATFORM): kabc/converter/opie/opieconverterE.pro 85kabc/converter/opie/Makefile$(PLATFORM): kabc/converter/opie/opieE.pro
83 cd kabc/converter/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieconverterE.pro -o Makefile$(PLATFORM) 86 cd kabc/converter/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM)
84 87
88kabc/converter/qtopia/Makefile$(PLATFORM): kabc/converter/qtopia/qtopiaE.pro
89 cd kabc/converter/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM)
90
85kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro 91kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro
86 cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM) 92 cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM)
87 93
88kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro 94kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro
89 cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" fileE.pro -o Makefile$(PLATFORM) 95 cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" fileE.pro -o Makefile$(PLATFORM)
90 96
91kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro 97kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro
92 cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" dirE.pro -o Makefile$(PLATFORM) 98 cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" dirE.pro -o Makefile$(PLATFORM)
93 99
94kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro 100kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro
95 cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" ldapE.pro -o Makefile$(PLATFORM) 101 cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" ldapE.pro -o Makefile$(PLATFORM)
96 102
97kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro 103kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro
98 cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) 104 cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM)
99 105
100kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro 106kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro
101 cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) 107 cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM)
102 108
103kaddressbook/xxport/opie/Makefile$(PLATFORM): kaddressbook/xxport/opie/opieE.pro 109kaddressbook/xxport/opie/Makefile$(PLATFORM): kaddressbook/xxport/opie/opieE.pro
104 cd kaddressbook/xxport/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) 110 cd kaddressbook/xxport/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM)
105 111
106kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro 112kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro
107 cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM) 113 cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM)
108 114
diff --git a/kabc/converter/qtopia/qtopiaE.pro b/kabc/converter/qtopia/qtopiaE.pro
index e026f2a..4241b8b 100644
--- a/kabc/converter/qtopia/qtopiaE.pro
+++ b/kabc/converter/qtopia/qtopiaE.pro
@@ -1,32 +1,30 @@
1TEMPLATE = lib 1TEMPLATE = lib
2INCLUDEPATH += . ../.. ../../../microkde ../../../microkde/kdecore $(OPIEDIR)/include $(OPEDIR)/include 2INCLUDEPATH += . ../.. ../../../microkde ../../../microkde/kdecore $(QPEDIR)/include
3#CONFIG += staticlib 3#CONFIG += staticlib
4OBJECTS_DIR = obj/$(PLATFORM) 4OBJECTS_DIR = obj/$(PLATFORM)
5MOC_DIR = moc/$(PLATFORM) 5MOC_DIR = moc/$(PLATFORM)
6 6
7#for static linkage, put it here 7#for static linkage, put it here
8#DESTDIR=../../lib/$(PLATFORM) 8#DESTDIR=../../lib/$(PLATFORM)
9 9
10#for dynamic linkage, put it here 10#for dynamic linkage, put it here
11DESTDIR=$(QPEDIR)/lib 11DESTDIR=$(QPEDIR)/lib
12 12
13LIBS += -lmicrokde 13LIBS += -lmicrokde
14LIBS += -lmicrokabc 14LIBS += -lmicrokabc
15LIBS += -L$(QPEDIR)/lib 15LIBS += -L$(QPEDIR)/lib
16LIBS += -L$(OPIEDIR)/lib 16LIBS += -L$(OPIEDIR)/lib
17LIBS += -lopie 17LIBS += -lqpepim
18LIBS += -lqpe 18LIBS += -lqpe
19LIBS += -lqte
20 19
21 20TARGET = microkabc_qtopiaconverter
22TARGET = microkabc_opieconverter
23 21
24# Input 22# Input
25 23
26HEADERS += \ 24HEADERS += \
27 opieconverter.h \ 25 qtopiaconverter.h \
28 26
29 27
30SOURCES += \ 28SOURCES += \
31 opieconverter.cpp \ 29 qtopiaconverter.cpp \
32 30
diff --git a/kabc/converter/qtopia/qtopiaconverter.cpp b/kabc/converter/qtopia/qtopiaconverter.cpp
index 7aa76fe..e3dd3e6 100644
--- a/kabc/converter/qtopia/qtopiaconverter.cpp
+++ b/kabc/converter/qtopia/qtopiaconverter.cpp
@@ -10,99 +10,94 @@
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28//US 28//US
29#include "kglobal.h" 29#include "kglobal.h"
30 30
31 31
32#include "qtopiaconverter.h" 32#include "qtopiaconverter.h"
33 33
34//US #include <qpe/categories.h> 34#include <qpe/categories.h>
35//US #include <qpe/categoryselect.h> 35//US #include <qpe/categoryselect.h>
36 36
37 37
38using namespace KABC; 38using namespace KABC;
39 39
40QtopiaConverter::QtopiaConverter() : catDB(0) 40QtopiaConverter::QtopiaConverter() : catDB(0)
41{ 41{
42} 42}
43 43
44QtopiaConverter::~QtopiaConverter() 44QtopiaConverter::~QtopiaConverter()
45{ 45{
46 deinit(); 46 deinit();
47} 47}
48 48
49bool QtopiaConverter::init() 49bool QtopiaConverter::init()
50{ 50{
51/*US
52 catDB = new Categories(); 51 catDB = new Categories();
53 if (catDB) 52 if (catDB)
54 { 53 {
55 catDB->load( categoryFileName() ); 54 catDB->load( categoryFileName() );
56 return true; 55 return true;
57 } 56 }
58 else 57 else
59 { 58 {
60 return false; 59 return false;
61 } 60 }
62*/
63return true;
64} 61}
65 62
66void QtopiaConverter::deinit() 63void QtopiaConverter::deinit()
67{ 64{
68/*US
69 if (catDB) 65 if (catDB)
70 { 66 {
71 delete catDB; 67 delete catDB;
72 catDB = 0; 68 catDB = 0;
73 } 69 }
74*/
75} 70}
76 71
77bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr ) 72bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr )
78{ 73{
79 // name 74 // name
80 addr.setFormattedName(contact.fileAs()); 75 addr.setFormattedName(contact.fileAs());
81 addr.setFamilyName( contact.lastName() ); 76 addr.setFamilyName( contact.lastName() );
82 addr.setGivenName( contact.firstName() ); 77 addr.setGivenName( contact.firstName() );
83 addr.setAdditionalName( contact.middleName() ); 78 addr.setAdditionalName( contact.middleName() );
84 addr.setPrefix( contact.title() ); 79 addr.setPrefix( contact.nameTitle() );
85 addr.setSuffix( contact.suffix() ); 80 addr.setSuffix( contact.suffix() );
86 81
87 82
88 // email 83 // email
89 QStringList emails = contact.emailList(); 84 QStringList emails = contact.emailList();
90 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { 85 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
91 addr.insertEmail( *it, ((*it) == contact.defaultEmail()) ); 86 addr.insertEmail( *it, ((*it) == contact.defaultEmail()) );
92 } 87 }
93 88
94 if (!contact.defaultEmail().isEmpty()) 89 if (!contact.defaultEmail().isEmpty())
95 addr.insertEmail(contact.defaultEmail(), true); 90 addr.insertEmail(contact.defaultEmail(), true);
96 91
97 // home 92 // home
98 if ((!contact.homeStreet().isEmpty()) || 93 if ((!contact.homeStreet().isEmpty()) ||
99 (!contact.homeCity().isEmpty()) || 94 (!contact.homeCity().isEmpty()) ||
100 (!contact.homeState().isEmpty()) || 95 (!contact.homeState().isEmpty()) ||
101 (!contact.homeZip().isEmpty()) || 96 (!contact.homeZip().isEmpty()) ||
102 (!contact.homeCountry().isEmpty())) 97 (!contact.homeCountry().isEmpty()))
103 { 98 {
104 Address homeaddress; 99 Address homeaddress;
105 homeaddress.setType(Address::Home); 100 homeaddress.setType(Address::Home);
106//US homeaddress.setPostOfficeBox( "" ); 101//US homeaddress.setPostOfficeBox( "" );
107//US homeaddress.setExtended( "" ); 102//US homeaddress.setExtended( "" );
108 homeaddress.setStreet( contact.homeStreet() ); 103 homeaddress.setStreet( contact.homeStreet() );
@@ -183,92 +178,99 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
183 PhoneNumber businessmobile; 178 PhoneNumber businessmobile;
184 businessmobile.setType( PhoneNumber::Work | PhoneNumber::Cell ); 179 businessmobile.setType( PhoneNumber::Work | PhoneNumber::Cell );
185 businessmobile.setNumber( contact.businessMobile() ); 180 businessmobile.setNumber( contact.businessMobile() );
186 addr.insertPhoneNumber( businessmobile ); 181 addr.insertPhoneNumber( businessmobile );
187 } 182 }
188 183
189 if (!contact.businessPager().isEmpty()) 184 if (!contact.businessPager().isEmpty())
190 { 185 {
191 PhoneNumber businesspager; 186 PhoneNumber businesspager;
192 businesspager.setType( PhoneNumber::Work | PhoneNumber::Pager ); 187 businesspager.setType( PhoneNumber::Work | PhoneNumber::Pager );
193 businesspager.setNumber( contact.businessPager() ); 188 businesspager.setNumber( contact.businessPager() );
194 addr.insertPhoneNumber( businesspager ); 189 addr.insertPhoneNumber( businesspager );
195 } 190 }
196 191
197 addr.setRole( contact.jobTitle() ); //? 192 addr.setRole( contact.jobTitle() ); //?
198 addr.setOrganization( contact.company() ); 193 addr.setOrganization( contact.company() );
199 addr.insertCustom( "KADDRESSBOOK", "X-Profession", contact.profession() ); 194 addr.insertCustom( "KADDRESSBOOK", "X-Profession", contact.profession() );
200 addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", contact.assistant() ); 195 addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", contact.assistant() );
201 addr.insertCustom( "KADDRESSBOOK", "X-Department", contact.department() ); 196 addr.insertCustom( "KADDRESSBOOK", "X-Department", contact.department() );
202 addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", contact.manager() ); 197 addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", contact.manager() );
203 addr.insertCustom( "KADDRESSBOOK", "X-Office", contact.office() ); 198 addr.insertCustom( "KADDRESSBOOK", "X-Office", contact.office() );
204 199
205 //personal 200 //personal
206 addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() ); 201 addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() );
207 addr.insertCustom( "KADDRESSBOOK", "X-Gender", contact.gender() ); 202 // qtopia uses this categorization:
208 203 // enum GenderType { UnspecifiedGender=0, Male, Female };
204 if (contact.gender() == PimContact::Male)
205 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
206 else if (contact.gender() == PimContact::Female)
207 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female");
208
209 if (contact.anniversary().isValid()) { 209 if (contact.anniversary().isValid()) {
210 QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate); 210 QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate);
211//US 211//US
212 qDebug("OpieConverter::opieToAddressee found:%s", dt.latin1()); 212 qDebug("OpieConverter::opieToAddressee found:%s", dt.latin1());
213 addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 213 addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
214 } 214 }
215 215
216 addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); 216 addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() );
217 if (contact.birthday().isValid()) 217 if (contact.birthday().isValid())
218 addr.setBirthday( contact.birthday() ); 218 addr.setBirthday( contact.birthday() );
219 219
220 addr.setNickName( contact.nickname() ); 220 addr.setNickName( contact.nickname() );
221 221
222 // others 222 // others
223 //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available. 223 //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available.
224 QString notes = contact.notes(); 224 QString notes = contact.notes();
225 notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; 225 notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n";
226 226
227 addr.setNote( contact.notes() ); 227 addr.setNote( contact.notes() );
228 228
229 229
230 230
231//US QString groups() const { return find( Qtopia::Groups ); } 231//US QString groups() const { return find( Qtopia::Groups ); }
232//US QStringList groupList() const; 232//US QStringList groupList() const;
233 233
234 234 QArray<int> catArray = contact.categories();
235 QStringList cats = contact.categoryNames("Contacts"); 235 QString cat;
236 addr.setCategories( cats ); 236
237// for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { 237 for ( unsigned int i=0; i < catArray.size(); i++ ) {
238// qDebug("Cat: %s", (*it).latin1()); 238 cat = catDB->label("contact", catArray[i]);
239// } 239 if ( !cat.isEmpty() )
240 addr.insertCategory( cat );
241 }
240 242
241 return true; 243 return true;
242} 244}
243 245
244bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &contact ) 246bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &contact )
245{ 247{
246 // name 248 // name
247 contact.setLastName(addr.familyName()); 249 contact.setLastName(addr.familyName());
248 contact.setFirstName(addr.givenName()); 250 contact.setFirstName(addr.givenName());
249 contact.setMiddleName(addr.additionalName()); 251 contact.setMiddleName(addr.additionalName());
250 contact.setTitle(addr.prefix()); 252 contact.setNameTitle(addr.prefix());
251 contact.setSuffix(addr.suffix()); 253 contact.setSuffix(addr.suffix());
252 contact.setFileAs(); 254 contact.setFileAs();
253 255
254 256
255 // email 257 // email
256 QStringList emails = addr.emails(); 258 QStringList emails = addr.emails();
257 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { 259 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
258 contact.insertEmail(*it); 260 contact.insertEmail(*it);
259 } 261 }
260 contact.setDefaultEmail( addr.preferredEmail() ); 262 contact.setDefaultEmail( addr.preferredEmail() );
261 263
262 264
263 // home 265 // home
264 const Address homeaddress = addr.address(Address::Home); 266 const Address homeaddress = addr.address(Address::Home);
265 if (!homeaddress.isEmpty()) { 267 if (!homeaddress.isEmpty()) {
266 contact.setHomeStreet(homeaddress.street()); 268 contact.setHomeStreet(homeaddress.street());
267 contact.setHomeCity(homeaddress.locality()); 269 contact.setHomeCity(homeaddress.locality());
268 contact.setHomeState(homeaddress.region()); 270 contact.setHomeState(homeaddress.region());
269 contact.setHomeZip(homeaddress.postalCode()); 271 contact.setHomeZip(homeaddress.postalCode());
270 contact.setHomeCountry(homeaddress.country()); 272 contact.setHomeCountry(homeaddress.country());
271 } 273 }
272 274
273 PhoneNumber homephone = addr.phoneNumber( PhoneNumber::Home ); 275 PhoneNumber homephone = addr.phoneNumber( PhoneNumber::Home );
274 if (!homephone.number().isEmpty()) 276 if (!homephone.number().isEmpty())
@@ -301,53 +303,61 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont
301 303
302 PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ); 304 PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax );
303 if (!businessfax.number().isEmpty()) 305 if (!businessfax.number().isEmpty())
304 contact.setBusinessFax(businessfax.number()); 306 contact.setBusinessFax(businessfax.number());
305 307
306 PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell ); 308 PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell );
307 if (!businessmobile.number().isEmpty()) 309 if (!businessmobile.number().isEmpty())
308 contact.setBusinessMobile(businessmobile.number()); 310 contact.setBusinessMobile(businessmobile.number());
309 311
310 PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager ); 312 PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager );
311 if (!businesspager.number().isEmpty()) 313 if (!businesspager.number().isEmpty())
312 contact.setBusinessPager(businesspager.number()); 314 contact.setBusinessPager(businesspager.number());
313 315
314 contact.setJobTitle(addr.role()); 316 contact.setJobTitle(addr.role());
315 contact.setCompany(addr.organization()); 317 contact.setCompany(addr.organization());
316 318
317 contact.setProfession(addr.custom( "KADDRESSBOOK", "X-Profession" )); 319 contact.setProfession(addr.custom( "KADDRESSBOOK", "X-Profession" ));
318 contact.setAssistant(addr.custom( "KADDRESSBOOK", "X-AssistantsName" )); 320 contact.setAssistant(addr.custom( "KADDRESSBOOK", "X-AssistantsName" ));
319 contact.setDepartment(addr.custom( "KADDRESSBOOK", "X-Department" )); 321 contact.setDepartment(addr.custom( "KADDRESSBOOK", "X-Department" ));
320 contact.setManager(addr.custom( "KADDRESSBOOK", "X-ManagersName" )); 322 contact.setManager(addr.custom( "KADDRESSBOOK", "X-ManagersName" ));
321 contact.setOffice(addr.custom( "KADDRESSBOOK", "X-Office" )); 323 contact.setOffice(addr.custom( "KADDRESSBOOK", "X-Office" ));
322 324
323 //personal 325 //personal
324 contact.setSpouse(addr.custom( "KADDRESSBOOK", "X-Spouse" )); 326 contact.setSpouse(addr.custom( "KADDRESSBOOK", "X-Spouse" ));
325 contact.setGender(addr.custom( "KADDRESSBOOK", "X-Gender" )); 327 // qtopia uses this categorization:
326 328 // enum GenderType { UnspecifiedGender=0, Male, Female };
329 QString gt = addr.custom( "KADDRESSBOOK", "X-Gender" );
330 if (gt = "male")
331 contact.setGender(PimContact::Male);
332 else if (gt = "female")
333 contact.setGender(PimContact::Female);
334 else
335 contact.setGender(PimContact::UnspecifiedGender);
336
337
327 QDate dt = KGlobal::locale()->readDate( 338 QDate dt = KGlobal::locale()->readDate(
328 addr.custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); // = Qt::ISODate 339 addr.custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); // = Qt::ISODate
329 contact.setAnniversary( dt ); 340 contact.setAnniversary( dt );
330 341
331 contact.setChildren(addr.custom( "KADDRESSBOOK", "X-Children" )); 342 contact.setChildren(addr.custom( "KADDRESSBOOK", "X-Children" ));
332 343
333 contact.setBirthday(addr.birthday().date()); 344 contact.setBirthday(addr.birthday().date());
334 contact.setNickname(addr.nickName()); 345 contact.setNickname(addr.nickName());
335 346
336 // other 347 // other
337 contact.setNotes(addr.note()); 348 contact.setNotes(addr.note());
338 349
339//US QString groups() const { return find( Qtopia::Groups ); } 350//US QString groups() const { return find( Qtopia::Groups ); }
340//US QStringList groupList() const; 351//US QStringList groupList() const;
341 352
342 353
343/*US
344 QStringList cats = addr.categories(); 354 QStringList cats = addr.categories();
345 355
346 QArray<int> iar; 356 QArray<int> iar;
347 if ( !cats.isEmpty() ) { 357 if ( !cats.isEmpty() ) {
348 QArray<int> iar = catDB.ids("contact", cats); 358 QArray<int> iar = catDB->ids("contact", cats);
349 contact.setCategories(iar); 359 contact.setCategories(iar);
350 } 360 }
351*/ 361
352 return true; 362 return true;
353} 363}
diff --git a/kabc/converter/qtopia/qtopiaconverter.h b/kabc/converter/qtopia/qtopiaconverter.h
index aaa267a..7397113 100644
--- a/kabc/converter/qtopia/qtopiaconverter.h
+++ b/kabc/converter/qtopia/qtopiaconverter.h
@@ -11,69 +11,69 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24$Id$ 24$Id$
25*/ 25*/
26 26
27#ifndef KABC_QTOPIACONVERTER_H 27#ifndef KABC_QTOPIACONVERTER_H
28#define KABC_QTOPIACONVERTER_H 28#define KABC_QTOPIACONVERTER_H
29 29
30#include <qstring.h> 30#include <qstring.h>
31 31
32#include "addressee.h" 32#include "addressee.h"
33#include <qpe/pim/contact.h> 33#include <qpe/pim/contact.h>
34 34
35//US class Categories; 35class Categories;
36 36
37namespace KABC { 37namespace KABC {
38 38
39class QtopiaConverter 39class QtopiaConverter
40{ 40{
41public: 41public:
42 42
43 /** 43 /**
44 * Constructor. 44 * Constructor.
45 */ 45 */
46 QtopiaConverter(); 46 QtopiaConverter();
47 47
48 /** 48 /**
49 * Destructor. 49 * Destructor.
50 */ 50 */
51 virtual ~QtopiaConverter(); 51 virtual ~QtopiaConverter();
52 52
53 virtual bool init(); 53 virtual bool init();
54 virtual void deinit(); 54 virtual void deinit();
55 55
56 /** 56 /**
57 * Converts a vcard string to an addressee. 57 * Converts a vcard string to an addressee.
58 * 58 *
59 * @param contact The qtopia contact. 59 * @param contact The qtopia contact.
60 * @param addr The addressee. 60 * @param addr The addressee.
61 */ 61 */
62 bool qtopiaToAddressee( const PimContact &contact, Addressee &addr ); 62 bool qtopiaToAddressee( const PimContact &contact, Addressee &addr );
63 63
64 /** 64 /**
65 * Converts an addressee to a vcard string. 65 * Converts an addressee to a vcard string.
66 * 66 *
67 * @param addr The addressee. 67 * @param addr The addressee.
68 * @param contact The qtopia contact. 68 * @param contact The qtopia contact.
69 */ 69 */
70 bool addresseeToQtopia( const Addressee &addr, PimContact &contact ); 70 bool addresseeToQtopia( const Addressee &addr, PimContact &contact );
71 71
72 private: 72 private:
73//US Categories* catDB; 73 Categories* catDB;
74 74
75 75
76}; 76};
77 77
78} 78}
79#endif 79#endif