summaryrefslogtreecommitdiffabout
path: root/kabc/plugins
authorzautrix <zautrix>2004-09-19 11:32:40 (UTC)
committer zautrix <zautrix>2004-09-19 11:32:40 (UTC)
commiteea0ff04703dffdbe8b67a0dc9f592597d7450c1 (patch) (unidiff)
tree874549d9c1c6239304fe1540d1b56269652954c0 /kabc/plugins
parent953277a85e6ec5630ab0d64b4d68815e4e4f9906 (diff)
downloadkdepimpi-eea0ff04703dffdbe8b67a0dc9f592597d7450c1.zip
kdepimpi-eea0ff04703dffdbe8b67a0dc9f592597d7450c1.tar.gz
kdepimpi-eea0ff04703dffdbe8b67a0dc9f592597d7450c1.tar.bz2
more AB sync
Diffstat (limited to 'kabc/plugins') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/qtopia/qtopiaconverter.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/kabc/plugins/qtopia/qtopiaconverter.cpp b/kabc/plugins/qtopia/qtopiaconverter.cpp
index ac513b6..7d00a3f 100644
--- a/kabc/plugins/qtopia/qtopiaconverter.cpp
+++ b/kabc/plugins/qtopia/qtopiaconverter.cpp
@@ -14,129 +14,136 @@
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#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 catDB = new Categories(); 51 catDB = new Categories();
52 52
53 if (!catDB) 53 if (!catDB)
54 return false; 54 return false;
55 55
56 catDB->load( categoryFileName() ); 56 catDB->load( categoryFileName() );
57 return true; 57 return true;
58} 58}
59 59
60void QtopiaConverter::deinit() 60void QtopiaConverter::deinit()
61{ 61{
62 if (catDB) 62 if (catDB)
63 { 63 {
64 delete catDB; 64 delete catDB;
65 catDB = 0; 65 catDB = 0;
66 } 66 }
67} 67}
68 68
69bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr ) 69bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr )
70{ 70{
71 // name 71 // name
72 addr.setFormattedName(contact.fileAs()); 72 addr.setFormattedName(contact.fileAs());
73 addr.setFamilyName( contact.lastName() ); 73 addr.setFamilyName( contact.lastName() );
74 addr.setGivenName( contact.firstName() ); 74 addr.setGivenName( contact.firstName() );
75 addr.setAdditionalName( contact.middleName() ); 75 addr.setAdditionalName( contact.middleName() );
76 addr.setPrefix( contact.nameTitle() ); 76 addr.setPrefix( contact.nameTitle() );
77 addr.setSuffix( contact.suffix() ); 77 addr.setSuffix( contact.suffix() );
78 78 QString exuid = contact.uid().toString();
79 int ente = exuid.find( "-0000");
80 if ( exuid.left(1) == "{" )
81 exuid = exuid.mid(1);
82 if ( ente > -1 )
83 exuid = exuid.left( ente-1 );
84 addr.setExternalUID( exuid );
85 //qDebug("QtopiaConverter:set uid %s ",addr.externalUID().latin1() );
79 86
80 // email 87 // email
81 QStringList emails = contact.emailList(); 88 QStringList emails = contact.emailList();
82 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { 89 for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
83 addr.insertEmail( *it, ((*it) == contact.defaultEmail()) ); 90 addr.insertEmail( *it, ((*it) == contact.defaultEmail()) );
84 } 91 }
85 92
86 if (!contact.defaultEmail().isEmpty()) 93 if (!contact.defaultEmail().isEmpty())
87 addr.insertEmail(contact.defaultEmail(), true); 94 addr.insertEmail(contact.defaultEmail(), true);
88 95
89 // home 96 // home
90 if ((!contact.homeStreet().isEmpty()) || 97 if ((!contact.homeStreet().isEmpty()) ||
91 (!contact.homeCity().isEmpty()) || 98 (!contact.homeCity().isEmpty()) ||
92 (!contact.homeState().isEmpty()) || 99 (!contact.homeState().isEmpty()) ||
93 (!contact.homeZip().isEmpty()) || 100 (!contact.homeZip().isEmpty()) ||
94 (!contact.homeCountry().isEmpty())) 101 (!contact.homeCountry().isEmpty()))
95 { 102 {
96 Address homeaddress; 103 Address homeaddress;
97 homeaddress.setType(Address::Home); 104 homeaddress.setType(Address::Home);
98//US homeaddress.setPostOfficeBox( "" ); 105//US homeaddress.setPostOfficeBox( "" );
99//US homeaddress.setExtended( "" ); 106//US homeaddress.setExtended( "" );
100 homeaddress.setStreet( contact.homeStreet() ); 107 homeaddress.setStreet( contact.homeStreet() );
101 homeaddress.setLocality( contact.homeCity() ); 108 homeaddress.setLocality( contact.homeCity() );
102 homeaddress.setRegion( contact.homeState() ); 109 homeaddress.setRegion( contact.homeState() );
103 homeaddress.setPostalCode( contact.homeZip() ); 110 homeaddress.setPostalCode( contact.homeZip() );
104 homeaddress.setCountry( contact.homeCountry() ); 111 homeaddress.setCountry( contact.homeCountry() );
105 112
106 addr.insertAddress( homeaddress ); 113 addr.insertAddress( homeaddress );
107 } 114 }
108 115
109 if (!contact.homePhone().isEmpty()) 116 if (!contact.homePhone().isEmpty())
110 { 117 {
111 PhoneNumber homephone; 118 PhoneNumber homephone;
112 homephone.setType( PhoneNumber::Home ); 119 homephone.setType( PhoneNumber::Home );
113 homephone.setNumber( contact.homePhone() ); 120 homephone.setNumber( contact.homePhone() );
114 addr.insertPhoneNumber( homephone ); 121 addr.insertPhoneNumber( homephone );
115 } 122 }
116 123
117 if (!contact.homeFax().isEmpty()) 124 if (!contact.homeFax().isEmpty())
118 { 125 {
119 PhoneNumber homefax; 126 PhoneNumber homefax;
120 homefax.setType( PhoneNumber::Home | PhoneNumber::Fax ); 127 homefax.setType( PhoneNumber::Home | PhoneNumber::Fax );
121 homefax.setNumber( contact.homeFax() ); 128 homefax.setNumber( contact.homeFax() );
122 addr.insertPhoneNumber( homefax ); 129 addr.insertPhoneNumber( homefax );
123 } 130 }
124 131
125 if (!contact.homeMobile().isEmpty()) 132 if (!contact.homeMobile().isEmpty())
126 { 133 {
127 PhoneNumber homemobile; 134 PhoneNumber homemobile;
128 homemobile.setType( PhoneNumber::Home | PhoneNumber::Cell ); 135 homemobile.setType( PhoneNumber::Home | PhoneNumber::Cell );
129 homemobile.setNumber( contact.homeMobile() ); 136 homemobile.setNumber( contact.homeMobile() );
130 addr.insertPhoneNumber( homemobile ); 137 addr.insertPhoneNumber( homemobile );
131 } 138 }
132 139
133 addr.setUrl( contact.homeWebpage() ); 140 addr.setUrl( contact.homeWebpage() );
134 141
135 142
136 // business 143 // business
137 if ((!contact.businessStreet().isEmpty()) || 144 if ((!contact.businessStreet().isEmpty()) ||
138 (!contact.businessCity().isEmpty()) || 145 (!contact.businessCity().isEmpty()) ||
139 (!contact.businessState().isEmpty()) || 146 (!contact.businessState().isEmpty()) ||
140 (!contact.businessZip().isEmpty()) || 147 (!contact.businessZip().isEmpty()) ||
141 (!contact.businessCountry().isEmpty())) 148 (!contact.businessCountry().isEmpty()))
142 { 149 {