summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.cpp67
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
@@ -67,5 +67,5 @@ ResourceQtopia::ResourceQtopia( const KConfig *config )
// we can not choose the filename. Therefore use the default to display
QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml";
-
+
init( fileName );
}
@@ -138,5 +138,5 @@ bool ResourceQtopia::doOpen()
//US bool ok = mFormat->checkFormat( &file );
bool ok = true;
-
+
file.close();
@@ -144,5 +144,5 @@ bool ResourceQtopia::doOpen()
}
*/
- return true;
+ return true;
}
@@ -156,5 +156,5 @@ bool ResourceQtopia::load()
// qDebug("ResourceQtopia::load: Try to load file() %s", mFileName.latin1());
-
+
AddressBookAccess* access = new AddressBookAccess();
@@ -164,5 +164,5 @@ bool ResourceQtopia::load()
return false;
}
-
+
bool res = false;
if (mConverter == 0)
@@ -172,12 +172,13 @@ bool ResourceQtopia::load()
if ( !res )
{
- 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;
return false;
}
}
-
- { //create a new scope
+
+ { //create a new scope
AddressBookIterator it(*access);
const PimContact* contact;
@@ -185,9 +186,9 @@ bool ResourceQtopia::load()
for (contact=it.toFirst(); it.current(); ++it) {
contact = it.current();
-
+
KABC::Addressee addressee;
-
- res = mConverter->qtopiaToAddressee( (*contact), addressee );
-
+
+ res = mConverter->qtopiaToAddressee( (*contact), addressee );
+
if ( !addressee.isEmpty() && res )
{
@@ -197,5 +198,5 @@ bool ResourceQtopia::load()
}
}
-
+
delete access;
return true;
@@ -210,7 +211,7 @@ bool ResourceQtopia::save( Ticket *ticket )
// create backup file
QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() );
-
+
/*US we use a simpler method to create a backupfile
-
+
(void) KSaveFile::backupFile( mFileName, QString::null
,extension );
@@ -226,5 +227,5 @@ bool ResourceQtopia::save( Ticket *ticket )
/*US
-//US ToDo: write backupfile
+//US ToDo: write backupfile
QFile info;
info.setName( mFileName );
@@ -232,22 +233,22 @@ bool ResourceQtopia::save( Ticket *ticket )
if ( ok ) {
//US mFormat->saveAll( addressBook(), this, &info );
-
+
info.close();
ok = true;
}
else {
-
+
}
-
+
if ( !ok )
addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) );
-
+
delete ticket;
unlock( mFileName );
-
+
return ok;
qDebug("ResourceQtopia::save has to be changed");
-*/
+*/
return true;
}
@@ -262,8 +263,8 @@ bool ResourceQtopia::lock( const QString &fileName )
//US fn.replace( QRegExp("/"), "_" );
//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;
@@ -272,6 +273,6 @@ bool ResourceQtopia::lock( const QString &fileName )
QString lockUniqueName;
lockUniqueName = fn + KApplication::randomString( 8 );
-
- url = lockUniqueName;
+
+ url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
@@ -304,7 +305,7 @@ void ResourceQtopia::unlock( const QString &fileName )
//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
//US QString lockName = fn + ".lock";
- KURL url(fn);
+ KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
-
+
QFile::remove( lockName );
QFile::remove( mLockUniqueName );
@@ -316,5 +317,5 @@ void ResourceQtopia::setFileName( const QString &fileName )
mDirWatch.stopScan();
mDirWatch.removeFile( mFileName );
-
+
mFileName = fileName;
@@ -322,5 +323,5 @@ void ResourceQtopia::setFileName( const QString &fileName )
mDirWatch.startScan();
-//US simulate KDirWatch event
+//US simulate KDirWatch event
//US fileChanged();
}
@@ -337,5 +338,5 @@ void ResourceQtopia::fileChanged()
if (!addressBook())
return;
-
+
QString text( i18n( "Qtopia resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mFileName ) );
if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) {