summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/olaccess/olaccessconverter.cpp
Unidiff
Diffstat (limited to 'kabc/plugins/olaccess/olaccessconverter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/olaccess/olaccessconverter.cpp54
1 files changed, 28 insertions, 26 deletions
diff --git a/kabc/plugins/olaccess/olaccessconverter.cpp b/kabc/plugins/olaccess/olaccessconverter.cpp
index 4adcae4..e95f3cb 100644
--- a/kabc/plugins/olaccess/olaccessconverter.cpp
+++ b/kabc/plugins/olaccess/olaccessconverter.cpp
@@ -29,46 +29,48 @@ $Id$
29#include <qregexp.h> 29#include <qregexp.h>
30 30
31 31
32#include "sharpdtmconverter.h" 32#include "olaccessconverter.h"
33 33
34#include <sl/slcategories.h>
35#include <libkdepim/ksyncprofile.h> 34#include <libkdepim/ksyncprofile.h>
36//US #include <qpe/categoryselect.h> 35//US #include <qpe/categoryselect.h>
37 36
38 37
39using namespace KABC; 38using namespace KABC;
40using namespace SlCategory;
41 39
42SharpDTMConverter::SharpDTMConverter() : catDB(0) 40OlaccessConverter::OlaccessConverter()
43{ 41{
44} 42}
45 43
46SharpDTMConverter::~SharpDTMConverter() 44OlaccessConverter::~OlaccessConverter()
47{ 45{
48 deinit(); 46 deinit();
49} 47}
50 48
51bool SharpDTMConverter::init() 49bool OlaccessConverter::init()
52{ 50{
51#if 0
53 catDB = new SlCategory::SlCategories(); 52 catDB = new SlCategory::SlCategories();
54 53
55 if (!catDB) 54 if (!catDB)
56 return false; 55 return false;
57 56
58// catDB->load( categoryFileName() ); 57// catDB->load( categoryFileName() );
58#endif
59 return true; 59 return true;
60} 60}
61 61
62void SharpDTMConverter::deinit() 62void OlaccessConverter::deinit()
63{ 63{
64#if 0
64 if (catDB) 65 if (catDB)
65 { 66 {
66 delete catDB; 67 delete catDB;
67 catDB = 0; 68 catDB = 0;
68 } 69 }
70#endif
69} 71}
70 72#if 0
71bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBase* database, Addressee &addr ) 73bool OlaccessConverter::sharpToAddressee( const CardId &contact, const SlZDataBase* database, Addressee &addr )
72{ 74{
73 SlZDataBase* db = (SlZDataBase*)database; 75 SlZDataBase* db = (SlZDataBase*)database;
74 76
@@ -79,7 +81,7 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
79 81
80 82
81 // name 83 // name
82 //qDebug("SharpDTMConverter::sharpToAddressee check if the fileAs transformation works!!"); 84 //qDebug("OlaccessConverter::sharpToAddressee check if the fileAs transformation works!!");
83 addr.setFormattedName(db->readField(ZdbAdrs::FileAs)); 85 addr.setFormattedName(db->readField(ZdbAdrs::FileAs));
84 //addr.setName(db->readField(ZdbAdrs::FullName)); 86 //addr.setName(db->readField(ZdbAdrs::FullName));
85 87
@@ -94,7 +96,7 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
94 emailstr.replace( QRegExp(","), " " ); 96 emailstr.replace( QRegExp(","), " " );
95 emailstr.replace( QRegExp(";"), " " ); 97 emailstr.replace( QRegExp(";"), " " );
96 emailstr.replace( QRegExp(":"), " " ); 98 emailstr.replace( QRegExp(":"), " " );
97 //qDebug("SharpDTMConverter::sharpToAddressee whats the character to seperate the emailadresses? %s ", emailstr.latin1()); 99 //qDebug("OlaccessConverter::sharpToAddressee whats the character to seperate the emailadresses? %s ", emailstr.latin1());
98 QStringList emails = QStringList::split(" ", emailstr.simplifyWhiteSpace()); 100 QStringList emails = QStringList::split(" ", emailstr.simplifyWhiteSpace());
99 bool defE = false; 101 bool defE = false;
100 bool found = false; 102 bool found = false;
@@ -221,8 +223,8 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
221 addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", db->readField(ZdbAdrs::Spouse) ); 223 addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", db->readField(ZdbAdrs::Spouse) );
222 224
223 QString gen = db->readField(ZdbAdrs::Gender); 225 QString gen = db->readField(ZdbAdrs::Gender);
224 //qDebug("SharpDTMConverter::sharpToAddressee pleas check that gender works!! : Gender: %s", gen.latin1()); 226 //qDebug("OlaccessConverter::sharpToAddressee pleas check that gender works!! : Gender: %s", gen.latin1());
225 //qDebug("SharpDTMConverter::sharpToAddressee: may be int db->readUshortField(\"ZdbAdrs::Gender\") is here better suited"); 227 //qDebug("OlaccessConverter::sharpToAddressee: may be int db->readUshortField(\"ZdbAdrs::Gender\") is here better suited");
226 if (gen == "1") 228 if (gen == "1")
227 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); 229 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
228 else if (gen == "2") 230 else if (gen == "2")
@@ -264,7 +266,7 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
264//US QString groups() const { return find( Qtopia::Groups ); } 266//US QString groups() const { return find( Qtopia::Groups ); }
265//US QStringList groupList() const; 267//US QStringList groupList() const;
266 268
267 //qDebug("SharpDTMConverter::sharpToAddressee please check that the categories will be converted" ); 269 //qDebug("OlaccessConverter::sharpToAddressee please check that the categories will be converted" );
268 QArray<int> catArray = db->readCategories(); 270 QArray<int> catArray = db->readCategories();
269 QString cat; 271 QString cat;
270 272
@@ -279,7 +281,7 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa
279 return true; 281 return true;
280} 282}
281 283
282bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* database , const CardId &contact ) 284bool OlaccessConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* database , const CardId &contact )
283{ 285{
284 bool cellHome = false, cellWork = false; 286 bool cellHome = false, cellWork = false;
285 // name 287 // name
@@ -289,7 +291,7 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* da
289 database->writeField(ZdbAdrs::Title, addr.prefix()); 291 database->writeField(ZdbAdrs::Title, addr.prefix());
290 database->writeField(ZdbAdrs::Suffix, addr.suffix()); 292 database->writeField(ZdbAdrs::Suffix, addr.suffix());
291 293
292 //qDebug("SharpDTMConverter::addresseeToSharp check if the fileAs transformation works!!\n%s",addr.formattedName().latin1() ); 294 //qDebug("OlaccessConverter::addresseeToSharp check if the fileAs transformation works!!\n%s",addr.formattedName().latin1() );
293 QString formattedName = addr.formattedName(); 295 QString formattedName = addr.formattedName();
294 if ( formattedName.isEmpty() ) { 296 if ( formattedName.isEmpty() ) {
295 if ( !addr.familyName().isEmpty() ) { 297 if ( !addr.familyName().isEmpty() ) {
@@ -305,8 +307,8 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* da
305 database->writeField(ZdbAdrs::FullName, formattedName); 307 database->writeField(ZdbAdrs::FullName, formattedName);
306 308
307 // email 309 // email
308 //qDebug("SharpDTMConverter::addresseeToSharp check which seperator we need here for the emails!!"); 310 //qDebug("OlaccessConverter::addresseeToSharp check which seperator we need here for the emails!!");
309 //qDebug("SharpDTMConverter::addresseeToSharp its probably the same from sharpToAddressee"); 311 //qDebug("OlaccessConverter::addresseeToSharp its probably the same from sharpToAddressee");
310 QString emails = addr.emails().join(" "); 312 QString emails = addr.emails().join(" ");
311 database->writeField(ZdbAdrs::Emails, emails ); 313 database->writeField(ZdbAdrs::Emails, emails );
312 314
@@ -373,9 +375,9 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* da
373 database->writeField(ZdbAdrs::Spouse, addr.custom( "KADDRESSBOOK", "X-Spouse" )); 375 database->writeField(ZdbAdrs::Spouse, addr.custom( "KADDRESSBOOK", "X-Spouse" ));
374 376
375 QString gt = addr.custom( "KADDRESSBOOK", "X-Gender" ); 377 QString gt = addr.custom( "KADDRESSBOOK", "X-Gender" );
376 //qDebug("SharpDTMConverter::addresseeToSharp please check that gender works!! : Gender: %s", gt.latin1()); 378 //qDebug("OlaccessConverter::addresseeToSharp please check that gender works!! : Gender: %s", gt.latin1());
377 //qDebug("SharpDTMConverter::addresseeToSharp: may be writeField(\"ZdbAdrs::Gender\", ushort) is here better suited?"); 379 //qDebug("OlaccessConverter::addresseeToSharp: may be writeField(\"ZdbAdrs::Gender\", ushort) is here better suited?");
378 //qDebug("SharpDTMConverter::addresseeToSharp: check also the reverse functionality in sharpToAddressee"); 380 //qDebug("OlaccessConverter::addresseeToSharp: check also the reverse functionality in sharpToAddressee");
379 if (gt == "male") 381 if (gt == "male")
380 database->writeField(ZdbAdrs::Gender, "1"); 382 database->writeField(ZdbAdrs::Gender, "1");
381 else if (gt == "female") 383 else if (gt == "female")
@@ -405,13 +407,13 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* da
405//US QStringList groupList() const; 407//US QStringList groupList() const;
406 408
407 409
408 //qDebug("SharpDTMConverter::addresseeToSharp please check if category transformation works"); 410 //qDebug("OlaccessConverter::addresseeToSharp please check if category transformation works");
409 411
410 return true; 412 return true;
411} 413}
412 414
413 415
414bool SharpDTMConverter::setCategories( const Addressee &addr, SlZDataBase* database , const CardId &contact ) 416bool OlaccessConverter::setCategories( const Addressee &addr, SlZDataBase* database , const CardId &contact )
415{ 417{
416 QStringList list = addr.categories(); 418 QStringList list = addr.categories();
417 419
@@ -431,12 +433,12 @@ bool SharpDTMConverter::setCategories( const Addressee &addr, SlZDataBase* datab
431 bool res ; 433 bool res ;
432 434
433 if ( !(res = database->updateCategories(contact, ids) )) 435 if ( !(res = database->updateCategories(contact, ids) ))
434 qDebug("SharpDTMConverter::Error updating categories"); 436 qDebug("OlaccessConverter::Error updating categories");
435 437
436 return res; 438 return res;
437} 439}
438 440#endif
439QDate SharpDTMConverter::convertDate( QString s) 441QDate OlaccessConverter::convertDate( QString s)
440{ 442{
441 QDate dt = KGlobal::locale()->readDate( s ); 443 QDate dt = KGlobal::locale()->readDate( s );
442 return dt; 444 return dt;