-rw-r--r-- | kabc/addressbook.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index fe59fcb..c700897 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -34,14 +34,14 @@ $Id$ | |||
34 | #include <kapplication.h> | 34 | #include <kapplication.h> |
35 | #include <kinstance.h> | 35 | #include <kinstance.h> |
36 | #include <kstandarddirs.h> | 36 | #include <kstandarddirs.h> |
37 | 37 | ||
38 | #include "errorhandler.h" | 38 | #include "errorhandler.h" |
39 | */ | 39 | */ |
40 | #include <qptrlist.h> | 40 | #include <q3ptrlist.h> |
41 | #include <qtextstream.h> | 41 | #include <q3textstream.h> |
42 | #include <qfile.h> | 42 | #include <qfile.h> |
43 | #include <qregexp.h> | 43 | #include <qregexp.h> |
44 | 44 | ||
45 | #include <kglobal.h> | 45 | #include <kglobal.h> |
46 | #include <klocale.h> | 46 | #include <klocale.h> |
47 | #include <kmessagebox.h> | 47 | #include <kmessagebox.h> |
@@ -241,13 +241,13 @@ AddressBook::AddressBook( const QString &config, const QString &family ) | |||
241 | // the default family is "contact" | 241 | // the default family is "contact" |
242 | void AddressBook::init(const QString &config, const QString &family ) | 242 | void AddressBook::init(const QString &config, const QString &family ) |
243 | { | 243 | { |
244 | blockLSEchange = false; | 244 | blockLSEchange = false; |
245 | d = new AddressBookData; | 245 | d = new AddressBookData; |
246 | QString fami = family; | 246 | QString fami = family; |
247 | if (config != 0) { | 247 | if (!config.isEmpty()) { |
248 | if ( family == "syncContact" ) { | 248 | if ( family == "syncContact" ) { |
249 | qDebug("creating sync config "); | 249 | qDebug("creating sync config "); |
250 | fami = "contact"; | 250 | fami = "contact"; |
251 | KConfig* con = new KConfig( locateLocal("config", "syncContactrc") ); | 251 | KConfig* con = new KConfig( locateLocal("config", "syncContactrc") ); |
252 | con->setGroup( "General" ); | 252 | con->setGroup( "General" ); |
253 | con->writeEntry( "ResourceKeys", QString("sync") ); | 253 | con->writeEntry( "ResourceKeys", QString("sync") ); |
@@ -378,19 +378,19 @@ bool AddressBook::save( Ticket *ticket ) | |||
378 | } | 378 | } |
379 | // exports all Addressees, which are syncable | 379 | // exports all Addressees, which are syncable |
380 | void AddressBook::export2File( QString fileName, QString resourceName ) | 380 | void AddressBook::export2File( QString fileName, QString resourceName ) |
381 | { | 381 | { |
382 | 382 | ||
383 | QFile outFile( fileName ); | 383 | QFile outFile( fileName ); |
384 | if ( !outFile.open( IO_WriteOnly ) ) { | 384 | if ( !outFile.open( QIODevice::WriteOnly ) ) { |
385 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); | 385 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); |
386 | KMessageBox::error( 0, text.arg( fileName ) ); | 386 | KMessageBox::error( 0, text.arg( fileName ) ); |
387 | return ; | 387 | return ; |
388 | } | 388 | } |
389 | QTextStream t( &outFile ); | 389 | Q3TextStream t( &outFile ); |
390 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 390 | t.setEncoding( Q3TextStream::UnicodeUTF8 ); |
391 | Iterator it; | 391 | Iterator it; |
392 | KABC::VCardConverter::Version version; | 392 | KABC::VCardConverter::Version version; |
393 | version = KABC::VCardConverter::v3_0; | 393 | version = KABC::VCardConverter::v3_0; |
394 | for ( it = begin(); it != end(); ++it ) { | 394 | for ( it = begin(); it != end(); ++it ) { |
395 | if ( (*it).resource() ) { | 395 | if ( (*it).resource() ) { |
396 | bool include = (*it).resource()->includeInSync(); | 396 | bool include = (*it).resource()->includeInSync(); |
@@ -465,16 +465,16 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) | |||
465 | vcard.replace ( QRegExp(";;") , "" ); | 465 | vcard.replace ( QRegExp(";;") , "" ); |
466 | datastream += vcard; | 466 | datastream += vcard; |
467 | 467 | ||
468 | } | 468 | } |
469 | 469 | ||
470 | QFile outFile(fileName); | 470 | QFile outFile(fileName); |
471 | if ( outFile.open(IO_WriteOnly) ) { | 471 | if ( outFile.open(QIODevice::WriteOnly) ) { |
472 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 472 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
473 | QTextStream t( &outFile ); // use a text stream | 473 | Q3TextStream t( &outFile ); // use a text stream |
474 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 474 | t.setEncoding( Q3TextStream::UnicodeUTF8 ); |
475 | t <<datastream; | 475 | t <<datastream; |
476 | t << "\r\n\r\n"; | 476 | t << "\r\n\r\n"; |
477 | outFile.close(); | 477 | outFile.close(); |
478 | 478 | ||
479 | } else { | 479 | } else { |
480 | qDebug("Error open temp file "); | 480 | qDebug("Error open temp file "); |
@@ -487,13 +487,13 @@ int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool remo | |||
487 | { | 487 | { |
488 | 488 | ||
489 | if ( removeOld ) | 489 | if ( removeOld ) |
490 | setUntagged( true, resource ); | 490 | setUntagged( true, resource ); |
491 | KABC::Addressee::List list; | 491 | KABC::Addressee::List list; |
492 | QFile file( fileName ); | 492 | QFile file( fileName ); |
493 | file.open( IO_ReadOnly ); | 493 | file.open( QIODevice::ReadOnly ); |
494 | QByteArray rawData = file.readAll(); | 494 | QByteArray rawData = file.readAll(); |
495 | file.close(); | 495 | file.close(); |
496 | QString data; | 496 | QString data; |
497 | if ( replaceLabel ) { | 497 | if ( replaceLabel ) { |
498 | data = QString::fromLatin1( rawData.data(), rawData.size() + 1 ); | 498 | data = QString::fromLatin1( rawData.data(), rawData.size() + 1 ); |
499 | data.replace ( QRegExp("LABEL") , "ADR" ); | 499 | data.replace ( QRegExp("LABEL") , "ADR" ); |
@@ -631,13 +631,13 @@ void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) | |||
631 | void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) | 631 | void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) |
632 | { | 632 | { |
633 | 633 | ||
634 | setUntagged(); | 634 | setUntagged(); |
635 | KABC::Addressee::List list; | 635 | KABC::Addressee::List list; |
636 | QFile file( fileName ); | 636 | QFile file( fileName ); |
637 | file.open( IO_ReadOnly ); | 637 | file.open( QIODevice::ReadOnly ); |
638 | QByteArray rawData = file.readAll(); | 638 | QByteArray rawData = file.readAll(); |
639 | file.close(); | 639 | file.close(); |
640 | QString data; | 640 | QString data; |
641 | 641 | ||
642 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); | 642 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); |
643 | KABC::VCardTool tool; | 643 | KABC::VCardTool tool; |
@@ -1215,15 +1215,15 @@ bool AddressBook::addResource( Resource *resource ) | |||
1215 | d->mManager->add( resource ); | 1215 | d->mManager->add( resource ); |
1216 | return true; | 1216 | return true; |
1217 | } | 1217 | } |
1218 | void AddressBook::removeResources() | 1218 | void AddressBook::removeResources() |
1219 | { | 1219 | { |
1220 | //remove all possible resources. This should cleanup the configfile. | 1220 | //remove all possible resources. This should cleanup the configfile. |
1221 | QPtrList<KABC::Resource> mResources = resources(); | 1221 | Q3PtrList<KABC::Resource> mResources = resources(); |
1222 | 1222 | ||
1223 | QPtrListIterator<KABC::Resource> it(mResources); | 1223 | Q3PtrListIterator<KABC::Resource> it(mResources); |
1224 | for ( ; it.current(); ++it ) { | 1224 | for ( ; it.current(); ++it ) { |
1225 | KABC::Resource *res = it.current(); | 1225 | KABC::Resource *res = it.current(); |
1226 | removeResource(res); | 1226 | removeResource(res); |
1227 | } | 1227 | } |
1228 | } | 1228 | } |
1229 | 1229 | ||
@@ -1237,15 +1237,15 @@ bool AddressBook::removeResource( Resource *resource ) | |||
1237 | resource->setAddressBook( 0 ); | 1237 | resource->setAddressBook( 0 ); |
1238 | 1238 | ||
1239 | d->mManager->remove( resource ); | 1239 | d->mManager->remove( resource ); |
1240 | return true; | 1240 | return true; |
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | QPtrList<Resource> AddressBook::resources() | 1243 | Q3PtrList<Resource> AddressBook::resources() |
1244 | { | 1244 | { |
1245 | QPtrList<Resource> list; | 1245 | Q3PtrList<Resource> list; |
1246 | 1246 | ||
1247 | // qDebug("AddressBook::resources() 1"); | 1247 | // qDebug("AddressBook::resources() 1"); |
1248 | 1248 | ||
1249 | KRES::Manager<Resource>::ActiveIterator it; | 1249 | KRES::Manager<Resource>::ActiveIterator it; |
1250 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) | 1250 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) |
1251 | list.append( *it ); | 1251 | list.append( *it ); |