-rw-r--r-- | Makefile.Embedded | 8 | ||||
-rw-r--r-- | kabc/converter/opie/opieconverter.h | 4 | ||||
-rw-r--r-- | kabc/converter/qtopia/qtopiaconverter.cpp | 19 | ||||
-rw-r--r-- | kabc/converter/qtopia/qtopiaconverter.h | 4 | ||||
-rw-r--r-- | kaddressbook/xxportmanager.cpp | 10 |
5 files changed, 26 insertions, 19 deletions
diff --git a/Makefile.Embedded b/Makefile.Embedded index 3160017..143e965 100644 --- a/Makefile.Embedded +++ b/Makefile.Embedded | |||
@@ -1,114 +1,118 @@ | |||
1 | DISTPATH = $(shell pwd) | 1 | DISTPATH = $(shell pwd) |
2 | DISTDIR = $(shell basename $(DISTPATH)) | 2 | DISTDIR = $(shell basename $(DISTPATH)) |
3 | 3 | ||
4 | SUBDIRS = libical/src/libical libical/src/libicalss qtcompat microkde \ | 4 | SUBDIRS = libical/src/libical libical/src/libicalss qtcompat microkde \ |
5 | libkcal libkdepim kabc kabc/converter/opie kabc/converter/qtopia kabc/formats/binary \ | 5 | libkcal libkdepim kabc kabc/converter/opie kabc/converter/qtopia kabc/formats/binary \ |
6 | kabc/plugins/file kabc/plugins/dir \ | 6 | kabc/plugins/file kabc/plugins/dir \ |
7 | kabc/plugins/ldap kabc/plugins/opie kabc/plugins/qtopia \ | 7 | kabc/plugins/ldap kabc/plugins/opie kabc/plugins/qtopia \ |
8 | korganizer kalarmd kaddressbook/xxport/opie kaddressbook | 8 | korganizer kalarmd kaddressbook/xxport/opie kaddressbook/xxport/qtopia kaddressbook |
9 | all: tmake | 9 | all: tmake |
10 | for i in $(SUBDIRS); do pushd $$i; \ | 10 | for i in $(SUBDIRS); do pushd $$i; \ |
11 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 11 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
12 | done | 12 | done |
13 | 13 | ||
14 | objects: | 14 | objects: |
15 | for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done | 15 | for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done |
16 | for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done | 16 | for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done |
17 | mkdir -p libical/lib/$(PLATFORM) | 17 | mkdir -p libical/lib/$(PLATFORM) |
18 | 18 | ||
19 | clean: | 19 | clean: |
20 | rm -f libical/lib/$(PLATFORM)/*; | 20 | rm -f libical/lib/$(PLATFORM)/*; |
21 | for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ | 21 | for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ |
22 | 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; \ |
23 | done | 23 | done |
24 | install: | 24 | install: |
25 | cd bin/kdepim; make install | 25 | cd bin/kdepim; make install |
26 | cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop | 26 | cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop |
27 | cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop | 27 | cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop |
28 | 28 | ||
29 | dist: | 29 | dist: |
30 | @echo Dont forget to do "make install" before "make dist" | 30 | @echo Dont forget to do "make install" before "make dist" |
31 | rm -f *arm.ipk | 31 | rm -f *arm.ipk |
32 | rm -f *~ | 32 | rm -f *~ |
33 | 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 |
34 | mkipks kdepim.control | 34 | mkipks kdepim.control |
35 | mkipks korganizer-alarm.control | 35 | mkipks korganizer-alarm.control |
36 | 36 | ||
37 | tmake: objects qtcompat/Makefile$(PLATFORM) microkde/Makefile$(PLATFORM) \ | 37 | tmake: objects qtcompat/Makefile$(PLATFORM) microkde/Makefile$(PLATFORM) \ |
38 | libkcal/Makefile$(PLATFORM) \ | 38 | libkcal/Makefile$(PLATFORM) \ |
39 | libkdepim/Makefile$(PLATFORM) korganizer/Makefile$(PLATFORM) \ | 39 | libkdepim/Makefile$(PLATFORM) korganizer/Makefile$(PLATFORM) \ |
40 | kalarmd/Makefile$(PLATFORM) \ | 40 | kalarmd/Makefile$(PLATFORM) \ |
41 | libical/src/libical/Makefile$(PLATFORM) \ | 41 | libical/src/libical/Makefile$(PLATFORM) \ |
42 | libical/src/libicalss/Makefile$(PLATFORM) \ | 42 | libical/src/libicalss/Makefile$(PLATFORM) \ |
43 | kabc/Makefile$(PLATFORM) \ | 43 | kabc/Makefile$(PLATFORM) \ |
44 | kabc/converter/opie/Makefile$(PLATFORM) \ | 44 | kabc/converter/opie/Makefile$(PLATFORM) \ |
45 | kabc/converter/qtopia/Makefile$(PLATFORM) \ | 45 | kabc/converter/qtopia/Makefile$(PLATFORM) \ |
46 | kabc/formats/binary/Makefile$(PLATFORM) \ | 46 | kabc/formats/binary/Makefile$(PLATFORM) \ |
47 | kabc/plugins/file/Makefile$(PLATFORM) \ | 47 | kabc/plugins/file/Makefile$(PLATFORM) \ |
48 | kabc/plugins/dir/Makefile$(PLATFORM) \ | 48 | kabc/plugins/dir/Makefile$(PLATFORM) \ |
49 | kabc/plugins/ldap/Makefile$(PLATFORM) \ | 49 | kabc/plugins/ldap/Makefile$(PLATFORM) \ |
50 | kabc/plugins/opie/Makefile$(PLATFORM) \ | 50 | kabc/plugins/opie/Makefile$(PLATFORM) \ |
51 | kabc/plugins/qtopia/Makefile$(PLATFORM) \ | 51 | kabc/plugins/qtopia/Makefile$(PLATFORM) \ |
52 | kaddressbook/xxport/opie/Makefile$(PLATFORM) \ | 52 | kaddressbook/xxport/opie/Makefile$(PLATFORM) \ |
53 | kaddressbook/xxport/qtopia/Makefile$(PLATFORM) \ | ||
53 | kaddressbook/Makefile$(PLATFORM) | 54 | kaddressbook/Makefile$(PLATFORM) |
54 | 55 | ||
55 | 56 | ||
56 | 57 | ||
57 | qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro | 58 | qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro |
58 | cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM) | 59 | cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM) |
59 | 60 | ||
60 | microkde/Makefile$(PLATFORM): microkde/microkdeE.pro | 61 | microkde/Makefile$(PLATFORM): microkde/microkdeE.pro |
61 | cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM) | 62 | cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM) |
62 | 63 | ||
63 | libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro | 64 | libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro |
64 | cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM) | 65 | cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM) |
65 | 66 | ||
66 | 67 | ||
67 | libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro | 68 | libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro |
68 | cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" libkdepimE.pro -o Makefile$(PLATFORM) | 69 | cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" libkdepimE.pro -o Makefile$(PLATFORM) |
69 | 70 | ||
70 | kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro | 71 | kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro |
71 | cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" kalarmdE.pro -o Makefile$(PLATFORM) | 72 | cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" kalarmdE.pro -o Makefile$(PLATFORM) |
72 | 73 | ||
73 | korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro | 74 | korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro |
74 | cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM) | 75 | cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM) |
75 | 76 | ||
76 | libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro | 77 | libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro |
77 | cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM) | 78 | cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM) |
78 | 79 | ||
79 | libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro | 80 | libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro |
80 | cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM) | 81 | cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM) |
81 | 82 | ||
82 | kabc/Makefile$(PLATFORM): kabc/kabcE.pro | 83 | kabc/Makefile$(PLATFORM): kabc/kabcE.pro |
83 | cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM) | 84 | cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM) |
84 | 85 | ||
85 | kabc/converter/opie/Makefile$(PLATFORM): kabc/converter/opie/opieE.pro | 86 | kabc/converter/opie/Makefile$(PLATFORM): kabc/converter/opie/opieE.pro |
86 | cd kabc/converter/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) | 87 | cd kabc/converter/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) |
87 | 88 | ||
88 | kabc/converter/qtopia/Makefile$(PLATFORM): kabc/converter/qtopia/qtopiaE.pro | 89 | kabc/converter/qtopia/Makefile$(PLATFORM): kabc/converter/qtopia/qtopiaE.pro |
89 | cd kabc/converter/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) | 90 | cd kabc/converter/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) |
90 | 91 | ||
91 | kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro | 92 | kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro |
92 | cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM) | 93 | cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM) |
93 | 94 | ||
94 | kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro | 95 | kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro |
95 | cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" fileE.pro -o Makefile$(PLATFORM) | 96 | cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" fileE.pro -o Makefile$(PLATFORM) |
96 | 97 | ||
97 | kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro | 98 | kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro |
98 | cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" dirE.pro -o Makefile$(PLATFORM) | 99 | cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" dirE.pro -o Makefile$(PLATFORM) |
99 | 100 | ||
100 | kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro | 101 | kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro |
101 | cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" ldapE.pro -o Makefile$(PLATFORM) | 102 | cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" ldapE.pro -o Makefile$(PLATFORM) |
102 | 103 | ||
103 | kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro | 104 | kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro |
104 | cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) | 105 | cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) |
105 | 106 | ||
106 | kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro | 107 | kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro |
107 | cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) | 108 | cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) |
108 | 109 | ||
109 | kaddressbook/xxport/opie/Makefile$(PLATFORM): kaddressbook/xxport/opie/opieE.pro | 110 | kaddressbook/xxport/opie/Makefile$(PLATFORM): kaddressbook/xxport/opie/opieE.pro |
110 | cd kaddressbook/xxport/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) | 111 | cd kaddressbook/xxport/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) |
111 | 112 | ||
113 | kaddressbook/xxport/qtopia/Makefile$(PLATFORM): kaddressbook/xxport/qtopia/qtopiaE.pro | ||
114 | cd kaddressbook/xxport/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) | ||
115 | |||
112 | kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro | 116 | kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro |
113 | cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM) | 117 | cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM) |
114 | 118 | ||
diff --git a/kabc/converter/opie/opieconverter.h b/kabc/converter/opie/opieconverter.h index c7e691f..d251a24 100644 --- a/kabc/converter/opie/opieconverter.h +++ b/kabc/converter/opie/opieconverter.h | |||
@@ -1,80 +1,80 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
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 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_OPIECONVERTER_H | 28 | #ifndef KABC_OPIECONVERTER_H |
29 | #define KABC_OPIECONVERTER_H | 29 | #define KABC_OPIECONVERTER_H |
30 | 30 | ||
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | 32 | ||
33 | #include "addressee.h" | 33 | #include "addressee.h" |
34 | #include <opie/ocontact.h> | 34 | #include <opie/ocontact.h> |
35 | 35 | ||
36 | class Categories; | 36 | class Categories; |
37 | 37 | ||
38 | namespace KABC { | 38 | namespace KABC { |
39 | 39 | ||
40 | class OpieConverter | 40 | class OpieConverter |
41 | { | 41 | { |
42 | public: | 42 | public: |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Constructor. | 45 | * Constructor. |
46 | */ | 46 | */ |
47 | OpieConverter(); | 47 | OpieConverter(); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Destructor. | 50 | * Destructor. |
51 | */ | 51 | */ |
52 | virtual ~OpieConverter(); | 52 | virtual ~OpieConverter(); |
53 | 53 | ||
54 | virtual bool init(); | 54 | bool init(); |
55 | virtual void deinit(); | 55 | void deinit(); |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Converts a vcard string to an addressee. | 58 | * Converts a vcard string to an addressee. |
59 | * | 59 | * |
60 | * @param contact The opie contact. | 60 | * @param contact The opie contact. |
61 | * @param addr The addressee. | 61 | * @param addr The addressee. |
62 | */ | 62 | */ |
63 | bool opieToAddressee( const OContact &contact, Addressee &addr ); | 63 | bool opieToAddressee( const OContact &contact, Addressee &addr ); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Converts an addressee to a vcard string. | 66 | * Converts an addressee to a vcard string. |
67 | * | 67 | * |
68 | * @param addr The addressee. | 68 | * @param addr The addressee. |
69 | * @param contact The opie contact. | 69 | * @param contact The opie contact. |
70 | */ | 70 | */ |
71 | bool addresseeToOpie( const Addressee &addr, OContact &contact ); | 71 | bool addresseeToOpie( const Addressee &addr, OContact &contact ); |
72 | 72 | ||
73 | private: | 73 | private: |
74 | Categories* catDB; | 74 | Categories* catDB; |
75 | 75 | ||
76 | 76 | ||
77 | }; | 77 | }; |
78 | 78 | ||
79 | } | 79 | } |
80 | #endif | 80 | #endif |
diff --git a/kabc/converter/qtopia/qtopiaconverter.cpp b/kabc/converter/qtopia/qtopiaconverter.cpp index e3dd3e6..f451b8b 100644 --- a/kabc/converter/qtopia/qtopiaconverter.cpp +++ b/kabc/converter/qtopia/qtopiaconverter.cpp | |||
@@ -1,338 +1,335 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
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 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (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 | #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 | ||
38 | using namespace KABC; | 38 | using namespace KABC; |
39 | 39 | ||
40 | QtopiaConverter::QtopiaConverter() : catDB(0) | 40 | QtopiaConverter::QtopiaConverter() : catDB(0) |
41 | { | 41 | { |
42 | } | 42 | } |
43 | 43 | ||
44 | QtopiaConverter::~QtopiaConverter() | 44 | QtopiaConverter::~QtopiaConverter() |
45 | { | 45 | { |
46 | deinit(); | 46 | deinit(); |
47 | } | 47 | } |
48 | 48 | ||
49 | bool QtopiaConverter::init() | 49 | bool QtopiaConverter::init() |
50 | { | 50 | { |
51 | catDB = new Categories(); | 51 | catDB = new Categories(); |
52 | if (catDB) | 52 | |
53 | { | 53 | if (!catDB) |
54 | catDB->load( categoryFileName() ); | ||
55 | return true; | ||
56 | } | ||
57 | else | ||
58 | { | ||
59 | return false; | 54 | return false; |
60 | } | 55 | |
56 | catDB->load( categoryFileName() ); | ||
57 | return true; | ||
61 | } | 58 | } |
62 | 59 | ||
63 | void QtopiaConverter::deinit() | 60 | void QtopiaConverter::deinit() |
64 | { | 61 | { |
65 | if (catDB) | 62 | if (catDB) |
66 | { | 63 | { |
67 | delete catDB; | 64 | delete catDB; |
68 | catDB = 0; | 65 | catDB = 0; |
69 | } | 66 | } |
70 | } | 67 | } |
71 | 68 | ||
72 | bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr ) | 69 | bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr ) |
73 | { | 70 | { |
74 | // name | 71 | // name |
75 | addr.setFormattedName(contact.fileAs()); | 72 | addr.setFormattedName(contact.fileAs()); |
76 | addr.setFamilyName( contact.lastName() ); | 73 | addr.setFamilyName( contact.lastName() ); |
77 | addr.setGivenName( contact.firstName() ); | 74 | addr.setGivenName( contact.firstName() ); |
78 | addr.setAdditionalName( contact.middleName() ); | 75 | addr.setAdditionalName( contact.middleName() ); |
79 | addr.setPrefix( contact.nameTitle() ); | 76 | addr.setPrefix( contact.nameTitle() ); |
80 | addr.setSuffix( contact.suffix() ); | 77 | addr.setSuffix( contact.suffix() ); |
81 | 78 | ||
82 | 79 | ||
83 | 80 | ||
84 | QStringList emails = contact.emailList(); | 81 | QStringList emails = contact.emailList(); |
85 | for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { | 82 | for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { |
86 | addr.insertEmail( *it, ((*it) == contact.defaultEmail()) ); | 83 | addr.insertEmail( *it, ((*it) == contact.defaultEmail()) ); |
87 | } | 84 | } |
88 | 85 | ||
89 | if (!contact.defaultEmail().isEmpty()) | 86 | if (!contact.defaultEmail().isEmpty()) |
90 | addr.insertEmail(contact.defaultEmail(), true); | 87 | addr.insertEmail(contact.defaultEmail(), true); |
91 | 88 | ||
92 | // home | 89 | // home |
93 | if ((!contact.homeStreet().isEmpty()) || | 90 | if ((!contact.homeStreet().isEmpty()) || |
94 | (!contact.homeCity().isEmpty()) || | 91 | (!contact.homeCity().isEmpty()) || |
95 | (!contact.homeState().isEmpty()) || | 92 | (!contact.homeState().isEmpty()) || |
96 | (!contact.homeZip().isEmpty()) || | 93 | (!contact.homeZip().isEmpty()) || |
97 | (!contact.homeCountry().isEmpty())) | 94 | (!contact.homeCountry().isEmpty())) |
98 | { | 95 | { |
99 | Address homeaddress; | 96 | Address homeaddress; |
100 | homeaddress.setType(Address::Home); | 97 | homeaddress.setType(Address::Home); |
101 | //US homeaddress.setPostOfficeBox( "" ); | 98 | //US homeaddress.setPostOfficeBox( "" ); |
102 | //US homeaddress.setExtended( "" ); | 99 | //US homeaddress.setExtended( "" ); |
103 | homeaddress.setStreet( contact.homeStreet() ); | 100 | homeaddress.setStreet( contact.homeStreet() ); |
104 | homeaddress.setLocality( contact.homeCity() ); | 101 | homeaddress.setLocality( contact.homeCity() ); |
105 | homeaddress.setRegion( contact.homeState() ); | 102 | homeaddress.setRegion( contact.homeState() ); |
106 | homeaddress.setPostalCode( contact.homeZip() ); | 103 | homeaddress.setPostalCode( contact.homeZip() ); |
107 | homeaddress.setCountry( contact.homeCountry() ); | 104 | homeaddress.setCountry( contact.homeCountry() ); |
108 | 105 | ||
109 | addr.insertAddress( homeaddress ); | 106 | addr.insertAddress( homeaddress ); |
110 | } | 107 | } |
111 | 108 | ||
112 | if (!contact.homePhone().isEmpty()) | 109 | if (!contact.homePhone().isEmpty()) |
113 | { | 110 | { |
114 | PhoneNumber homephone; | 111 | PhoneNumber homephone; |
115 | homephone.setType( PhoneNumber::Home ); | 112 | homephone.setType( PhoneNumber::Home ); |
116 | homephone.setNumber( contact.homePhone() ); | 113 | homephone.setNumber( contact.homePhone() ); |
117 | addr.insertPhoneNumber( homephone ); | 114 | addr.insertPhoneNumber( homephone ); |
118 | } | 115 | } |
119 | 116 | ||
120 | if (!contact.homeFax().isEmpty()) | 117 | if (!contact.homeFax().isEmpty()) |
121 | { | 118 | { |
122 | PhoneNumber homefax; | 119 | PhoneNumber homefax; |
123 | homefax.setType( PhoneNumber::Home | PhoneNumber::Fax ); | 120 | homefax.setType( PhoneNumber::Home | PhoneNumber::Fax ); |
124 | homefax.setNumber( contact.homeFax() ); | 121 | homefax.setNumber( contact.homeFax() ); |
125 | addr.insertPhoneNumber( homefax ); | 122 | addr.insertPhoneNumber( homefax ); |
126 | } | 123 | } |
127 | 124 | ||
128 | if (!contact.homeMobile().isEmpty()) | 125 | if (!contact.homeMobile().isEmpty()) |
129 | { | 126 | { |
130 | PhoneNumber homemobile; | 127 | PhoneNumber homemobile; |
131 | homemobile.setType( PhoneNumber::Home | PhoneNumber::Cell ); | 128 | homemobile.setType( PhoneNumber::Home | PhoneNumber::Cell ); |
132 | homemobile.setNumber( contact.homeMobile() ); | 129 | homemobile.setNumber( contact.homeMobile() ); |
133 | addr.insertPhoneNumber( homemobile ); | 130 | addr.insertPhoneNumber( homemobile ); |
134 | } | 131 | } |
135 | 132 | ||
136 | addr.setUrl( contact.homeWebpage() ); | 133 | addr.setUrl( contact.homeWebpage() ); |
137 | 134 | ||
138 | 135 | ||
139 | // business | 136 | // business |
140 | if ((!contact.businessStreet().isEmpty()) || | 137 | if ((!contact.businessStreet().isEmpty()) || |
141 | (!contact.businessCity().isEmpty()) || | 138 | (!contact.businessCity().isEmpty()) || |
142 | (!contact.businessState().isEmpty()) || | 139 | (!contact.businessState().isEmpty()) || |
143 | (!contact.businessZip().isEmpty()) || | 140 | (!contact.businessZip().isEmpty()) || |
144 | (!contact.businessCountry().isEmpty())) | 141 | (!contact.businessCountry().isEmpty())) |
145 | { | 142 | { |
146 | Address businessaddress; | 143 | Address businessaddress; |
147 | businessaddress.setType(Address::Work); | 144 | businessaddress.setType(Address::Work); |
148 | //US businessaddress.setPostOfficeBox( "" ); | 145 | //US businessaddress.setPostOfficeBox( "" ); |
149 | //US businessaddress.setExtended( "" ); | 146 | //US businessaddress.setExtended( "" ); |
150 | businessaddress.setStreet( contact.businessStreet() ); | 147 | businessaddress.setStreet( contact.businessStreet() ); |
151 | businessaddress.setLocality( contact.businessCity() ); | 148 | businessaddress.setLocality( contact.businessCity() ); |
152 | businessaddress.setRegion( contact.businessState() ); | 149 | businessaddress.setRegion( contact.businessState() ); |
153 | businessaddress.setPostalCode( contact.businessZip() ); | 150 | businessaddress.setPostalCode( contact.businessZip() ); |
154 | businessaddress.setCountry( contact.businessCountry() ); | 151 | businessaddress.setCountry( contact.businessCountry() ); |
155 | 152 | ||
156 | addr.insertAddress( businessaddress ); | 153 | addr.insertAddress( businessaddress ); |
157 | } | 154 | } |
158 | 155 | ||
159 | 156 | ||
160 | if (!contact.businessPhone().isEmpty()) | 157 | if (!contact.businessPhone().isEmpty()) |
161 | { | 158 | { |
162 | PhoneNumber businessphone; | 159 | PhoneNumber businessphone; |
163 | businessphone.setType( PhoneNumber::Work ); | 160 | businessphone.setType( PhoneNumber::Work ); |
164 | businessphone.setNumber( contact.businessPhone() ); | 161 | businessphone.setNumber( contact.businessPhone() ); |
165 | addr.insertPhoneNumber( businessphone ); | 162 | addr.insertPhoneNumber( businessphone ); |
166 | } | 163 | } |
167 | 164 | ||
168 | if (!contact.businessFax().isEmpty()) | 165 | if (!contact.businessFax().isEmpty()) |
169 | { | 166 | { |
170 | PhoneNumber businessfax; | 167 | PhoneNumber businessfax; |
171 | businessfax.setType( PhoneNumber::Work | PhoneNumber::Fax ); | 168 | businessfax.setType( PhoneNumber::Work | PhoneNumber::Fax ); |
172 | businessfax.setNumber( contact.businessFax() ); | 169 | businessfax.setNumber( contact.businessFax() ); |
173 | addr.insertPhoneNumber( businessfax ); | 170 | addr.insertPhoneNumber( businessfax ); |
174 | } | 171 | } |
175 | 172 | ||
176 | if (!contact.businessMobile().isEmpty()) | 173 | if (!contact.businessMobile().isEmpty()) |
177 | { | 174 | { |
178 | PhoneNumber businessmobile; | 175 | PhoneNumber businessmobile; |
179 | businessmobile.setType( PhoneNumber::Work | PhoneNumber::Cell ); | 176 | businessmobile.setType( PhoneNumber::Work | PhoneNumber::Cell ); |
180 | businessmobile.setNumber( contact.businessMobile() ); | 177 | businessmobile.setNumber( contact.businessMobile() ); |
181 | addr.insertPhoneNumber( businessmobile ); | 178 | addr.insertPhoneNumber( businessmobile ); |
182 | } | 179 | } |
183 | 180 | ||
184 | if (!contact.businessPager().isEmpty()) | 181 | if (!contact.businessPager().isEmpty()) |
185 | { | 182 | { |
186 | PhoneNumber businesspager; | 183 | PhoneNumber businesspager; |
187 | businesspager.setType( PhoneNumber::Work | PhoneNumber::Pager ); | 184 | businesspager.setType( PhoneNumber::Work | PhoneNumber::Pager ); |
188 | businesspager.setNumber( contact.businessPager() ); | 185 | businesspager.setNumber( contact.businessPager() ); |
189 | addr.insertPhoneNumber( businesspager ); | 186 | addr.insertPhoneNumber( businesspager ); |
190 | } | 187 | } |
191 | 188 | ||
192 | addr.setRole( contact.jobTitle() ); //? | 189 | addr.setRole( contact.jobTitle() ); //? |
193 | addr.setOrganization( contact.company() ); | 190 | addr.setOrganization( contact.company() ); |
194 | addr.insertCustom( "KADDRESSBOOK", "X-Profession", contact.profession() ); | 191 | addr.insertCustom( "KADDRESSBOOK", "X-Profession", contact.profession() ); |
195 | addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", contact.assistant() ); | 192 | addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", contact.assistant() ); |
196 | addr.insertCustom( "KADDRESSBOOK", "X-Department", contact.department() ); | 193 | addr.insertCustom( "KADDRESSBOOK", "X-Department", contact.department() ); |
197 | addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", contact.manager() ); | 194 | addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", contact.manager() ); |
198 | addr.insertCustom( "KADDRESSBOOK", "X-Office", contact.office() ); | 195 | addr.insertCustom( "KADDRESSBOOK", "X-Office", contact.office() ); |
199 | 196 | ||
200 | //personal | 197 | //personal |
201 | addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() ); | 198 | addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() ); |
202 | // qtopia uses this categorization: | 199 | // qtopia uses this categorization: |
203 | // enum GenderType { UnspecifiedGender=0, Male, Female }; | 200 | // enum GenderType { UnspecifiedGender=0, Male, Female }; |
204 | if (contact.gender() == PimContact::Male) | 201 | if (contact.gender() == PimContact::Male) |
205 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); | 202 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); |
206 | else if (contact.gender() == PimContact::Female) | 203 | else if (contact.gender() == PimContact::Female) |
207 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); | 204 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); |
208 | 205 | ||
209 | if (contact.anniversary().isValid()) { | 206 | if (contact.anniversary().isValid()) { |
210 | QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate); | 207 | QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate); |
211 | //US | 208 | //US |
212 | qDebug("OpieConverter::opieToAddressee found:%s", dt.latin1()); | 209 | qDebug("OpieConverter::qtopiaToAddressee found:%s", dt.latin1()); |
213 | addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); | 210 | addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); |
214 | } | 211 | } |
215 | 212 | ||
216 | addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); | 213 | addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); |
217 | if (contact.birthday().isValid()) | 214 | if (contact.birthday().isValid()) |
218 | addr.setBirthday( contact.birthday() ); | 215 | addr.setBirthday( contact.birthday() ); |
219 | 216 | ||
220 | addr.setNickName( contact.nickname() ); | 217 | addr.setNickName( contact.nickname() ); |
221 | 218 | ||
222 | // others | 219 | // others |
223 | //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available. | 220 | //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available. |
224 | QString notes = contact.notes(); | 221 | QString notes = contact.notes(); |
225 | notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; | 222 | notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; |
226 | 223 | ||
227 | addr.setNote( contact.notes() ); | 224 | addr.setNote( contact.notes() ); |
228 | 225 | ||
229 | 226 | ||
230 | 227 | ||
231 | //US QString groups() const { return find( Qtopia::Groups ); } | 228 | //US QString groups() const { return find( Qtopia::Groups ); } |
232 | //US QStringList groupList() const; | 229 | //US QStringList groupList() const; |
233 | 230 | ||
234 | QArray<int> catArray = contact.categories(); | 231 | QArray<int> catArray = contact.categories(); |
235 | QString cat; | 232 | QString cat; |
236 | 233 | ||
237 | for ( unsigned int i=0; i < catArray.size(); i++ ) { | 234 | for ( unsigned int i=0; i < catArray.size(); i++ ) { |
238 | cat = catDB->label("contact", catArray[i]); | 235 | cat = catDB->label("contact", catArray[i]); |
239 | if ( !cat.isEmpty() ) | 236 | if ( !cat.isEmpty() ) |
240 | addr.insertCategory( cat ); | 237 | addr.insertCategory( cat ); |
241 | } | 238 | } |
242 | 239 | ||
243 | return true; | 240 | return true; |
244 | } | 241 | } |
245 | 242 | ||
246 | bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &contact ) | 243 | bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &contact ) |
247 | { | 244 | { |
248 | // name | 245 | // name |
249 | contact.setLastName(addr.familyName()); | 246 | contact.setLastName(addr.familyName()); |
250 | contact.setFirstName(addr.givenName()); | 247 | contact.setFirstName(addr.givenName()); |
251 | contact.setMiddleName(addr.additionalName()); | 248 | contact.setMiddleName(addr.additionalName()); |
252 | contact.setNameTitle(addr.prefix()); | 249 | contact.setNameTitle(addr.prefix()); |
253 | contact.setSuffix(addr.suffix()); | 250 | contact.setSuffix(addr.suffix()); |
254 | contact.setFileAs(); | 251 | contact.setFileAs(); |
255 | 252 | ||
256 | 253 | ||
257 | 254 | ||
258 | QStringList emails = addr.emails(); | 255 | QStringList emails = addr.emails(); |
259 | for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { | 256 | for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { |
260 | contact.insertEmail(*it); | 257 | contact.insertEmail(*it); |
261 | } | 258 | } |
262 | contact.setDefaultEmail( addr.preferredEmail() ); | 259 | contact.setDefaultEmail( addr.preferredEmail() ); |
263 | 260 | ||
264 | 261 | ||
265 | // home | 262 | // home |
266 | const Address homeaddress = addr.address(Address::Home); | 263 | const Address homeaddress = addr.address(Address::Home); |
267 | if (!homeaddress.isEmpty()) { | 264 | if (!homeaddress.isEmpty()) { |
268 | contact.setHomeStreet(homeaddress.street()); | 265 | contact.setHomeStreet(homeaddress.street()); |
269 | contact.setHomeCity(homeaddress.locality()); | 266 | contact.setHomeCity(homeaddress.locality()); |
270 | contact.setHomeState(homeaddress.region()); | 267 | contact.setHomeState(homeaddress.region()); |
271 | contact.setHomeZip(homeaddress.postalCode()); | 268 | contact.setHomeZip(homeaddress.postalCode()); |
272 | contact.setHomeCountry(homeaddress.country()); | 269 | contact.setHomeCountry(homeaddress.country()); |
273 | } | 270 | } |
274 | 271 | ||
275 | PhoneNumber homephone = addr.phoneNumber( PhoneNumber::Home ); | 272 | PhoneNumber homephone = addr.phoneNumber( PhoneNumber::Home ); |
276 | if (!homephone.number().isEmpty()) | 273 | if (!homephone.number().isEmpty()) |
277 | contact.setHomePhone(homephone.number()); | 274 | contact.setHomePhone(homephone.number()); |
278 | 275 | ||
279 | PhoneNumber homefax = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ); | 276 | PhoneNumber homefax = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ); |
280 | if (!homefax.number().isEmpty()) | 277 | if (!homefax.number().isEmpty()) |
281 | contact.setHomeFax(homefax.number()); | 278 | contact.setHomeFax(homefax.number()); |
282 | 279 | ||
283 | PhoneNumber homemobile = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Cell ); | 280 | PhoneNumber homemobile = addr.phoneNumber( PhoneNumber::Home | PhoneNumber::Cell ); |
284 | if (!homemobile.number().isEmpty()) | 281 | if (!homemobile.number().isEmpty()) |
285 | contact.setHomeMobile(homemobile.number()); | 282 | contact.setHomeMobile(homemobile.number()); |
286 | 283 | ||
287 | contact.setHomeWebpage(addr.url().url()); | 284 | contact.setHomeWebpage(addr.url().url()); |
288 | 285 | ||
289 | 286 | ||
290 | // business | 287 | // business |
291 | const Address businessaddress = addr.address(Address::Work); | 288 | const Address businessaddress = addr.address(Address::Work); |
292 | if (!businessaddress.isEmpty()) { | 289 | if (!businessaddress.isEmpty()) { |
293 | contact.setBusinessStreet(businessaddress.street()); | 290 | contact.setBusinessStreet(businessaddress.street()); |
294 | contact.setBusinessCity(businessaddress.locality()); | 291 | contact.setBusinessCity(businessaddress.locality()); |
295 | contact.setBusinessState(businessaddress.region()); | 292 | contact.setBusinessState(businessaddress.region()); |
296 | contact.setBusinessZip(businessaddress.postalCode()); | 293 | contact.setBusinessZip(businessaddress.postalCode()); |
297 | contact.setBusinessCountry(businessaddress.country()); | 294 | contact.setBusinessCountry(businessaddress.country()); |
298 | } | 295 | } |
299 | 296 | ||
300 | PhoneNumber businessphone = addr.phoneNumber( PhoneNumber::Work ); | 297 | PhoneNumber businessphone = addr.phoneNumber( PhoneNumber::Work ); |
301 | if (!businessphone.number().isEmpty()) | 298 | if (!businessphone.number().isEmpty()) |
302 | contact.setBusinessPhone(businessphone.number()); | 299 | contact.setBusinessPhone(businessphone.number()); |
303 | 300 | ||
304 | PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ); | 301 | PhoneNumber businessfax = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ); |
305 | if (!businessfax.number().isEmpty()) | 302 | if (!businessfax.number().isEmpty()) |
306 | contact.setBusinessFax(businessfax.number()); | 303 | contact.setBusinessFax(businessfax.number()); |
307 | 304 | ||
308 | PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell ); | 305 | PhoneNumber businessmobile = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Cell ); |
309 | if (!businessmobile.number().isEmpty()) | 306 | if (!businessmobile.number().isEmpty()) |
310 | contact.setBusinessMobile(businessmobile.number()); | 307 | contact.setBusinessMobile(businessmobile.number()); |
311 | 308 | ||
312 | PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager ); | 309 | PhoneNumber businesspager = addr.phoneNumber( PhoneNumber::Work | PhoneNumber::Pager ); |
313 | if (!businesspager.number().isEmpty()) | 310 | if (!businesspager.number().isEmpty()) |
314 | contact.setBusinessPager(businesspager.number()); | 311 | contact.setBusinessPager(businesspager.number()); |
315 | 312 | ||
316 | contact.setJobTitle(addr.role()); | 313 | contact.setJobTitle(addr.role()); |
317 | contact.setCompany(addr.organization()); | 314 | contact.setCompany(addr.organization()); |
318 | 315 | ||
319 | contact.setProfession(addr.custom( "KADDRESSBOOK", "X-Profession" )); | 316 | contact.setProfession(addr.custom( "KADDRESSBOOK", "X-Profession" )); |
320 | contact.setAssistant(addr.custom( "KADDRESSBOOK", "X-AssistantsName" )); | 317 | contact.setAssistant(addr.custom( "KADDRESSBOOK", "X-AssistantsName" )); |
321 | contact.setDepartment(addr.custom( "KADDRESSBOOK", "X-Department" )); | 318 | contact.setDepartment(addr.custom( "KADDRESSBOOK", "X-Department" )); |
322 | contact.setManager(addr.custom( "KADDRESSBOOK", "X-ManagersName" )); | 319 | contact.setManager(addr.custom( "KADDRESSBOOK", "X-ManagersName" )); |
323 | contact.setOffice(addr.custom( "KADDRESSBOOK", "X-Office" )); | 320 | contact.setOffice(addr.custom( "KADDRESSBOOK", "X-Office" )); |
324 | 321 | ||
325 | //personal | 322 | //personal |
326 | contact.setSpouse(addr.custom( "KADDRESSBOOK", "X-Spouse" )); | 323 | contact.setSpouse(addr.custom( "KADDRESSBOOK", "X-Spouse" )); |
327 | // qtopia uses this categorization: | 324 | // qtopia uses this categorization: |
328 | // enum GenderType { UnspecifiedGender=0, Male, Female }; | 325 | // enum GenderType { UnspecifiedGender=0, Male, Female }; |
329 | QString gt = addr.custom( "KADDRESSBOOK", "X-Gender" ); | 326 | QString gt = addr.custom( "KADDRESSBOOK", "X-Gender" ); |
330 | if (gt = "male") | 327 | if (gt = "male") |
331 | contact.setGender(PimContact::Male); | 328 | contact.setGender(PimContact::Male); |
332 | else if (gt = "female") | 329 | else if (gt = "female") |
333 | contact.setGender(PimContact::Female); | 330 | contact.setGender(PimContact::Female); |
334 | else | 331 | else |
335 | contact.setGender(PimContact::UnspecifiedGender); | 332 | contact.setGender(PimContact::UnspecifiedGender); |
336 | 333 | ||
337 | 334 | ||
338 | QDate dt = KGlobal::locale()->readDate( | 335 | QDate dt = KGlobal::locale()->readDate( |
diff --git a/kabc/converter/qtopia/qtopiaconverter.h b/kabc/converter/qtopia/qtopiaconverter.h index 7397113..8f4c698 100644 --- a/kabc/converter/qtopia/qtopiaconverter.h +++ b/kabc/converter/qtopia/qtopiaconverter.h | |||
@@ -1,79 +1,79 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
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 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (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 | class Categories; | 35 | class Categories; |
36 | 36 | ||
37 | namespace KABC { | 37 | namespace KABC { |
38 | 38 | ||
39 | class QtopiaConverter | 39 | class QtopiaConverter |
40 | { | 40 | { |
41 | public: | 41 | public: |
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 | bool init(); |
54 | virtual void deinit(); | 54 | 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 | Categories* catDB; | 73 | Categories* catDB; |
74 | 74 | ||
75 | 75 | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | } | 78 | } |
79 | #endif | 79 | #endif |
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp index 248fcab..4798ffe 100644 --- a/kaddressbook/xxportmanager.cpp +++ b/kaddressbook/xxportmanager.cpp | |||
@@ -103,143 +103,149 @@ void XXPortManager::importVCard( const QString &vCard, bool showPreview ) | |||
103 | { | 103 | { |
104 | importData = vCard; | 104 | importData = vCard; |
105 | mShowPreview = showPreview; | 105 | mShowPreview = showPreview; |
106 | slotImport( "vcard", "<empty>" ); | 106 | slotImport( "vcard", "<empty>" ); |
107 | mShowPreview = false; | 107 | mShowPreview = false; |
108 | importData = ""; | 108 | importData = ""; |
109 | } | 109 | } |
110 | 110 | ||
111 | void XXPortManager::slotImport( const QString &identifier, const QString &data ) | 111 | void XXPortManager::slotImport( const QString &identifier, const QString &data ) |
112 | { | 112 | { |
113 | XXPortObject *obj = mXXPortObjects[ identifier ]; | 113 | XXPortObject *obj = mXXPortObjects[ identifier ]; |
114 | if ( !obj ) { | 114 | if ( !obj ) { |
115 | KMessageBox::error( mCore, i18n( "<qt>No import plugin available for <b>%1</b>.</qt>" ).arg( identifier ) ); | 115 | KMessageBox::error( mCore, i18n( "<qt>No import plugin available for <b>%1</b>.</qt>" ).arg( identifier ) ); |
116 | return; | 116 | return; |
117 | } | 117 | } |
118 | 118 | ||
119 | KABC::Resource *resource = mCore->requestResource( mCore ); | 119 | KABC::Resource *resource = mCore->requestResource( mCore ); |
120 | if ( !resource ) | 120 | if ( !resource ) |
121 | return; | 121 | return; |
122 | 122 | ||
123 | KABC::AddresseeList list = obj->importContacts( data ); | 123 | KABC::AddresseeList list = obj->importContacts( data ); |
124 | KABC::AddresseeList::Iterator it; | 124 | KABC::AddresseeList::Iterator it; |
125 | bool imported = false; | 125 | bool imported = false; |
126 | for ( it = list.begin(); it != list.end(); ++it ) { | 126 | for ( it = list.begin(); it != list.end(); ++it ) { |
127 | if ( mShowPreview ) { | 127 | if ( mShowPreview ) { |
128 | PreviewDialog dlg( *it, mCore ); | 128 | PreviewDialog dlg( *it, mCore ); |
129 | if ( !dlg.exec() ) | 129 | if ( !dlg.exec() ) |
130 | continue; | 130 | continue; |
131 | } | 131 | } |
132 | 132 | ||
133 | (*it).setResource( resource ); | 133 | (*it).setResource( resource ); |
134 | // We use a PwNewCommand so the user can undo it. | 134 | // We use a PwNewCommand so the user can undo it. |
135 | PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it ); | 135 | PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it ); |
136 | UndoStack::instance()->push( command ); | 136 | UndoStack::instance()->push( command ); |
137 | RedoStack::instance()->clear(); | 137 | RedoStack::instance()->clear(); |
138 | imported = true; | 138 | imported = true; |
139 | } | 139 | } |
140 | 140 | ||
141 | if ( imported ) { | 141 | if ( imported ) { |
142 | KMessageBox::information( mCore, i18n( "contacts successfully imported." ) ); | 142 | KMessageBox::information( mCore, i18n( "contacts successfully imported." ) ); |
143 | 143 | ||
144 | emit modified(); | 144 | emit modified(); |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | void XXPortManager::slotExport( const QString &identifier, const QString &data ) | 148 | void XXPortManager::slotExport( const QString &identifier, const QString &data ) |
149 | { | 149 | { |
150 | XXPortObject *obj = mXXPortObjects[ identifier ]; | 150 | XXPortObject *obj = mXXPortObjects[ identifier ]; |
151 | if ( !obj ) { | 151 | if ( !obj ) { |
152 | KMessageBox::error( mCore, i18n( "<qt>No export plugin available for <b>%1</b>.</qt>" ).arg( identifier ) ); | 152 | KMessageBox::error( mCore, i18n( "<qt>No export plugin available for <b>%1</b>.</qt>" ).arg( identifier ) ); |
153 | return; | 153 | return; |
154 | } | 154 | } |
155 | 155 | ||
156 | KABC::AddresseeList addrList; | 156 | KABC::AddresseeList addrList; |
157 | XXPortSelectDialog dlg( mCore, obj->requiresSorting(), mCore ); | 157 | XXPortSelectDialog dlg( mCore, obj->requiresSorting(), mCore ); |
158 | if ( dlg.exec() ) | 158 | if ( dlg.exec() ) |
159 | addrList = dlg.contacts(); | 159 | addrList = dlg.contacts(); |
160 | else | 160 | else |
161 | return; | 161 | return; |
162 | 162 | ||
163 | if ( !obj->exportContacts( addrList, data ) ) | 163 | if ( !obj->exportContacts( addrList, data ) ) |
164 | KMessageBox::error( mCore, i18n( "Unable to export contacts." ) ); | 164 | KMessageBox::error( mCore, i18n( "Unable to export contacts." ) ); |
165 | else | 165 | else |
166 | KMessageBox::information( mCore, i18n( "contacts successfully exported." ) ); | 166 | KMessageBox::information( mCore, i18n( "contacts successfully exported." ) ); |
167 | } | 167 | } |
168 | 168 | ||
169 | void XXPortManager::loadPlugins() | 169 | void XXPortManager::loadPlugins() |
170 | { | 170 | { |
171 | mXXPortObjects.clear(); | 171 | mXXPortObjects.clear(); |
172 | 172 | ||
173 | #ifndef KAB_EMBEDDED | 173 | #ifndef KAB_EMBEDDED |
174 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" ); | 174 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" ); |
175 | KTrader::OfferList::ConstIterator it; | 175 | KTrader::OfferList::ConstIterator it; |
176 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 176 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
177 | if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) ) | 177 | if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) ) |
178 | continue; | 178 | continue; |
179 | 179 | ||
180 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); | 180 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); |
181 | if ( !factory ) { | 181 | if ( !factory ) { |
182 | kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; | 182 | kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; |
183 | continue; | 183 | continue; |
184 | } | 184 | } |
185 | 185 | ||
186 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); | 186 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); |
187 | 187 | ||
188 | if ( !xxportFactory ) { | 188 | if ( !xxportFactory ) { |
189 | kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; | 189 | kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; |
190 | continue; | 190 | continue; |
191 | } | 191 | } |
192 | 192 | ||
193 | #else //KAB_EMBEDDED | 193 | #else //KAB_EMBEDDED |
194 | QList<XXPortFactory> factorylist; | 194 | QList<XXPortFactory> factorylist; |
195 | factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_csv_xxport())); | 195 | factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_csv_xxport())); |
196 | factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_kde2_xxport())); | 196 | factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_kde2_xxport())); |
197 | factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_vcard_xxport())); | 197 | factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_vcard_xxport())); |
198 | 198 | ||
199 | //now add the opie import library dynamically | 199 | //add the opie import library dynamically |
200 | KLibFactory *factory = KLibLoader::self()->factory( "microkaddrbk_opie_xxport" ); | 200 | KLibFactory *factory = KLibLoader::self()->factory( "microkaddrbk_opie_xxport" ); |
201 | if ( factory ) { | 201 | if ( factory ) { |
202 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); | 202 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); |
203 | factorylist.append(xxportFactory); | 203 | factorylist.append(xxportFactory); |
204 | } | 204 | } |
205 | 205 | ||
206 | //add the qtopia import library dynamically | ||
207 | factory = KLibLoader::self()->factory( "microkaddrbk_qtopia_xxport" ); | ||
208 | if ( factory ) { | ||
209 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); | ||
210 | factorylist.append(xxportFactory); | ||
211 | } | ||
212 | |||
206 | QListIterator<XXPortFactory> it(factorylist); | 213 | QListIterator<XXPortFactory> it(factorylist); |
207 | for ( ; it.current(); ++it ) | 214 | for ( ; it.current(); ++it ) |
208 | { | 215 | { |
209 | XXPortFactory *xxportFactory = it.current(); | 216 | XXPortFactory *xxportFactory = it.current(); |
210 | #endif //KAB_EMBEDDED | 217 | #endif //KAB_EMBEDDED |
211 | 218 | ||
212 | XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore ); | 219 | XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore ); |
213 | if ( obj ) { | 220 | if ( obj ) { |
214 | mCore->addGUIClient( obj ); | 221 | mCore->addGUIClient( obj ); |
215 | mXXPortObjects.insert( obj->identifier(), obj ); | 222 | mXXPortObjects.insert( obj->identifier(), obj ); |
216 | connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ), | 223 | connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ), |
217 | this, SLOT( slotExport( const QString&, const QString& ) ) ); | 224 | this, SLOT( slotExport( const QString&, const QString& ) ) ); |
218 | connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ), | 225 | connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ), |
219 | this, SLOT( slotImport( const QString&, const QString& ) ) ); | 226 | this, SLOT( slotImport( const QString&, const QString& ) ) ); |
220 | } | 227 | } |
221 | } | 228 | } |
222 | |||
223 | } | 229 | } |
224 | 230 | ||
225 | 231 | ||
226 | PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, | 232 | PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, |
227 | const char *name ) | 233 | const char *name ) |
228 | : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, | 234 | : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, |
229 | name, true, true ) | 235 | name, true, true ) |
230 | { | 236 | { |
231 | QWidget *page = plainPage(); | 237 | QWidget *page = plainPage(); |
232 | QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); | 238 | QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); |
233 | 239 | ||
234 | KPIM::AddresseeView *view = new KPIM::AddresseeView( page ); | 240 | KPIM::AddresseeView *view = new KPIM::AddresseeView( page ); |
235 | view->setAddressee( addr ); | 241 | view->setAddressee( addr ); |
236 | 242 | ||
237 | layout->addWidget( view ); | 243 | layout->addWidget( view ); |
238 | 244 | ||
239 | resize( 400, 300 ); | 245 | resize( 400, 300 ); |
240 | } | 246 | } |
241 | 247 | ||
242 | #ifndef KAB_EMBEDDED | 248 | #ifndef KAB_EMBEDDED |
243 | #include "xxportmanager.moc" | 249 | #include "xxportmanager.moc" |
244 | #endif //KAB_EMBEDDED | 250 | #endif //KAB_EMBEDDED |
245 | 251 | ||