Diffstat (limited to 'kabc/plugins/qtopia/resourceqtopia.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index 7475685..7e10e46 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp @@ -68,3 +68,3 @@ ResourceQtopia::ResourceQtopia( const KConfig *config ) QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; - + init( fileName ); @@ -139,3 +139,3 @@ bool ResourceQtopia::doOpen() bool ok = true; - + file.close(); @@ -145,3 +145,3 @@ bool ResourceQtopia::doOpen() */ - return true; + return true; } @@ -157,3 +157,3 @@ bool ResourceQtopia::load() // qDebug("ResourceQtopia::load: Try to load file() %s", mFileName.latin1()); - + AddressBookAccess* access = new AddressBookAccess(); @@ -165,3 +165,3 @@ bool ResourceQtopia::load() } - + bool res = false; @@ -173,4 +173,5 @@ bool ResourceQtopia::load() { - qDebug("Unable to initialize qtopia converter. Most likely a problem with the category file"); - addressBook()->error( i18n( "Unable to initialize qtopia converter. Most likely a problem with the category file" ) ); + QString msg("Unable to initialize qtopia converter. Most likely a problem with the category file"); + qDebug(msg); + addressBook()->error( i18n( msg ) ); delete access; @@ -179,4 +180,4 @@ bool ResourceQtopia::load() } - - { //create a new scope + + { //create a new scope AddressBookIterator it(*access); @@ -186,7 +187,7 @@ bool ResourceQtopia::load() contact = it.current(); - + KABC::Addressee addressee; - - res = mConverter->qtopiaToAddressee( (*contact), addressee ); - + + res = mConverter->qtopiaToAddressee( (*contact), addressee ); + if ( !addressee.isEmpty() && res ) @@ -198,3 +199,3 @@ bool ResourceQtopia::load() } - + delete access; @@ -211,5 +212,5 @@ bool ResourceQtopia::save( Ticket *ticket ) QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() ); - + /*US we use a simpler method to create a backupfile - + (void) KSaveFile::backupFile( mFileName, QString::null @@ -227,3 +228,3 @@ bool ResourceQtopia::save( Ticket *ticket ) /*US -//US ToDo: write backupfile +//US ToDo: write backupfile QFile info; @@ -233,3 +234,3 @@ bool ResourceQtopia::save( Ticket *ticket ) //US mFormat->saveAll( addressBook(), this, &info ); - + info.close(); @@ -238,11 +239,11 @@ bool ResourceQtopia::save( Ticket *ticket ) else { - + } - + if ( !ok ) addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) ); - + delete ticket; unlock( mFileName ); - + return ok; @@ -250,3 +251,3 @@ bool ResourceQtopia::save( Ticket *ticket ) qDebug("ResourceQtopia::save has to be changed"); -*/ +*/ return true; @@ -263,6 +264,6 @@ bool ResourceQtopia::lock( const QString &fileName ) //US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); - - KURL url(fn); + + KURL url(fn); QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); - + kdDebug(5700) << "-- lock name: " << lockName << endl; @@ -273,4 +274,4 @@ bool ResourceQtopia::lock( const QString &fileName ) lockUniqueName = fn + KApplication::randomString( 8 ); - - url = lockUniqueName; + + url = lockUniqueName; //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); @@ -305,5 +306,5 @@ void ResourceQtopia::unlock( const QString &fileName ) //US QString lockName = fn + ".lock"; - KURL url(fn); + KURL url(fn); QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); - + QFile::remove( lockName ); @@ -317,3 +318,3 @@ void ResourceQtopia::setFileName( const QString &fileName ) mDirWatch.removeFile( mFileName ); - + mFileName = fileName; @@ -323,3 +324,3 @@ void ResourceQtopia::setFileName( const QString &fileName ) -//US simulate KDirWatch event +//US simulate KDirWatch event //US fileChanged(); @@ -338,3 +339,3 @@ void ResourceQtopia::fileChanged() return; - + QString text( i18n( "Qtopia resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mFileName ) ); |