From eff6207dd2b2cbd8624845782b24f00fd6a2b64a Mon Sep 17 00:00:00 2001 From: ulf69 Date: Wed, 14 Jul 2004 14:58:04 +0000 Subject: added support for kdirwatch --- diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp index 3a40ea2..1436508 100644 --- a/kabc/plugins/opie/resourceopie.cpp +++ b/kabc/plugins/opie/resourceopie.cpp @@ -89,11 +89,10 @@ ResourceOpie::ResourceOpie( const QString &fileName ) void ResourceOpie::init( const QString &fileName ) { -/*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); -*/ + //US opie addressbook is always readonly //US setReadOnly( true ); @@ -285,9 +284,6 @@ bool ResourceOpie::save( Ticket *ticket ) bool ResourceOpie::lock( const QString &fileName ) { - qDebug("ResourceOpie::lock() has to be fixed - %s", mFileName.latin1()); - -/*US // qDebug("ResourceOpie::lock() %s", fileName.latin1()); kdDebug(5700) << "ResourceOpie::lock()" << endl; @@ -318,9 +314,11 @@ bool ResourceOpie::lock( const QString &fileName ) file.close(); // Create lock file - int result = ::link( QFile::encodeName( mLockUniqueName ), + int result = 0; +#ifndef _WIN32_ + result = ::link( QFile::encodeName( mLockUniqueName ), QFile::encodeName( lockName ) ); - +#endif if ( result == 0 ) { addressBook()->emitAddressBookLocked(); return true; @@ -329,15 +327,10 @@ bool ResourceOpie::lock( const QString &fileName ) // TODO: check stat return false; -*/ - - return true; } void ResourceOpie::unlock( const QString &fileName ) { - qDebug("ResourceOpie::unlock() has to be fixed - %s", mFileName.latin1()); -/*US // qDebug("ResourceOpie::unlock() %s", fileName.latin1()); QString fn = fileName; @@ -351,24 +344,20 @@ void ResourceOpie::unlock( const QString &fileName ) QFile::remove( lockName ); QFile::remove( mLockUniqueName ); addressBook()->emitAddressBookUnlocked(); -*/ } void ResourceOpie::setFileName( const QString &fileName ) { -/*US ToDo: no synchronization so far. Has to be changed in the future mDirWatch.stopScan(); mDirWatch.removeFile( mFileName ); -*/ + mFileName = fileName; - -/*US ToDo: no synchronization so far. Has to be changed in the future mDirWatch.addFile( mFileName ); mDirWatch.startScan(); -*/ + //US simulate KDirWatch event - fileChanged(); +//US fileChanged(); } QString ResourceOpie::fileName() const @@ -388,11 +377,6 @@ void ResourceOpie::fileChanged() void ResourceOpie::removeAddressee( const Addressee &addr ) { -/*US - QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) ); - QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) ); - QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) ); -*/ } void ResourceOpie::cleanUp() -- cgit v0.9.0.2