-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index 242e0c6..5565580 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp | |||
@@ -206,65 +206,65 @@ bool ResourceQtopia::save( Ticket *ticket ) | |||
206 | // if (res == false) | 206 | // if (res == false) |
207 | // qDebug("Unable to append Contact %s", c.fullName().latin1()); | 207 | // qDebug("Unable to append Contact %s", c.fullName().latin1()); |
208 | } | 208 | } |
209 | else | 209 | else |
210 | { | 210 | { |
211 | qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); | 211 | qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); |
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | // mAccess->addressBookUpdated(); | 215 | // mAccess->addressBookUpdated(); |
216 | 216 | ||
217 | delete ticket; | 217 | delete ticket; |
218 | unlock( fileName() ); | 218 | unlock( fileName() ); |
219 | 219 | ||
220 | return true; | 220 | return true; |
221 | } | 221 | } |
222 | 222 | ||
223 | bool ResourceQtopia::lock( const QString &lockfileName ) | 223 | bool ResourceQtopia::lock( const QString &lockfileName ) |
224 | { | 224 | { |
225 | qDebug("ResourceQtopia::lock: %s", fileName().latin1()); | 225 | qDebug("ResourceQtopia::lock: %s", fileName().latin1()); |
226 | 226 | ||
227 | kdDebug(5700) << "ResourceQtopia::lock()" << endl; | 227 | kdDebug(5700) << "ResourceQtopia::lock()" << endl; |
228 | 228 | ||
229 | QString fn = lockfileName; | 229 | QString fn = lockfileName; |
230 | 230 | ||
231 | KURL url(fn); | 231 | KURL url(fn); |
232 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 232 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
233 | 233 | ||
234 | kdDebug(5700) << "-- lock name: " << lockName << endl; | 234 | kdDebug(5700) << "-- lock name: " << lockName << endl; |
235 | 235 | ||
236 | if (QFile::exists( lockName )) | 236 | if (QFile::exists( lockName )) |
237 | { | 237 | { |
238 | qDebug("ResourceOpie::lock: lockfile %s already exists. (Delete it before continuing if nobody else is accessing the resourcefile %s)", lockName.latin1(), fileName()); | 238 | qDebug("ResourceOpie::lock: lockfile %s already exists. (Delete it before continuing if nobody else is accessing the resourcefile %s)", lockName.latin1(), fileName().latin1()); |
239 | return false; | 239 | return false; |
240 | } | 240 | } |
241 | 241 | ||
242 | QString lockUniqueName; | 242 | QString lockUniqueName; |
243 | lockUniqueName = fn + KApplication::randomString( 8 ); | 243 | lockUniqueName = fn + KApplication::randomString( 8 ); |
244 | 244 | ||
245 | url = lockUniqueName; | 245 | url = lockUniqueName; |
246 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); | 246 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); |
247 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); | 247 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); |
248 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; | 248 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; |
249 | 249 | ||
250 | // Create unique file | 250 | // Create unique file |
251 | QFile file( mLockUniqueName ); | 251 | QFile file( mLockUniqueName ); |
252 | file.open( IO_WriteOnly ); | 252 | file.open( IO_WriteOnly ); |
253 | file.close(); | 253 | file.close(); |
254 | 254 | ||
255 | // Create lock file | 255 | // Create lock file |
256 | int result = 0; | 256 | int result = 0; |
257 | #ifndef _WIN32_ | 257 | #ifndef _WIN32_ |
258 | result = ::link( QFile::encodeName( mLockUniqueName ), | 258 | result = ::link( QFile::encodeName( mLockUniqueName ), |
259 | QFile::encodeName( lockName ) ); | 259 | QFile::encodeName( lockName ) ); |
260 | #endif | 260 | #endif |
261 | if ( result == 0 ) { | 261 | if ( result == 0 ) { |
262 | addressBook()->emitAddressBookLocked(); | 262 | addressBook()->emitAddressBookLocked(); |
263 | return true; | 263 | return true; |
264 | } | 264 | } |
265 | 265 | ||
266 | // TODO: check stat | 266 | // TODO: check stat |
267 | 267 | ||
268 | return false; | 268 | return false; |
269 | } | 269 | } |
270 | 270 | ||