author | llornkcor <llornkcor> | 2003-11-05 09:36:35 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-11-05 09:36:35 (UTC) |
commit | d0226f311bb994d377f1d653010e5a8441ebaad5 (patch) (unidiff) | |
tree | 8ee0b87e7d9db0419950dd22e2156e63b82708a1 /library | |
parent | dcb673c3b856bc0392414116d36659f5f4bf18a5 (diff) | |
download | opie-d0226f311bb994d377f1d653010e5a8441ebaad5.zip opie-d0226f311bb994d377f1d653010e5a8441ebaad5.tar.gz opie-d0226f311bb994d377f1d653010e5a8441ebaad5.tar.bz2 |
remove ======
-rw-r--r-- | library/filemanager.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/library/filemanager.cpp b/library/filemanager.cpp index 1c1c998..c51ca2f 100644 --- a/library/filemanager.cpp +++ b/library/filemanager.cpp | |||
@@ -289,65 +289,64 @@ bool FileManager::copyFile( const QString & src, const QString & dest ) { | |||
289 | #endif /* Q_OS_MACX */ | 289 | #endif /* Q_OS_MACX */ |
290 | if( !success ) | 290 | if( !success ) |
291 | qWarning( msg ); | 291 | qWarning( msg ); |
292 | } else { | 292 | } else { |
293 | qWarning("open write failed %s, %s",src.latin1(), dest.latin1()); | 293 | qWarning("open write failed %s, %s",src.latin1(), dest.latin1()); |
294 | success = false; | 294 | success = false; |
295 | } | 295 | } |
296 | } else { | 296 | } else { |
297 | qWarning("open read failed %s, %s",src.latin1(), dest.latin1()); | 297 | qWarning("open read failed %s, %s",src.latin1(), dest.latin1()); |
298 | success = false; | 298 | success = false; |
299 | } | 299 | } |
300 | srcFile.close(); | 300 | srcFile.close(); |
301 | destFile.close(); | 301 | destFile.close(); |
302 | // Set file permissions | 302 | // Set file permissions |
303 | if( stat( (const char *) src, &status ) == 0 ) { | 303 | if( stat( (const char *) src, &status ) == 0 ) { |
304 | chmod( (const char *) dest, status.st_mode ); | 304 | chmod( (const char *) dest, status.st_mode ); |
305 | } | 305 | } |
306 | 306 | ||
307 | return success; | 307 | return success; |
308 | } | 308 | } |
309 | 309 | ||
310 | 310 | ||
311 | bool FileManager::renameFile( const QString & src, const QString & dest ) { | 311 | bool FileManager::renameFile( const QString & src, const QString & dest ) { |
312 | if(copyFile( src, dest )) { | 312 | if(copyFile( src, dest )) { |
313 | if(QFile::remove(src) ) { | 313 | if(QFile::remove(src) ) { |
314 | return true; | 314 | return true; |
315 | } | 315 | } |
316 | } | 316 | } |
317 | return false; | 317 | return false; |
318 | } | 318 | } |
319 | 319 | ||
320 | 320 | ||
321 | ======= | ||
322 | bool FileManager::copyFile( const QString & src, const QString & dest ) { | 321 | bool FileManager::copyFile( const QString & src, const QString & dest ) { |
323 | bool success = true; | 322 | bool success = true; |
324 | struct stat status; | 323 | struct stat status; |
325 | int read_fd=0; | 324 | int read_fd=0; |
326 | int write_fd=0; | 325 | int write_fd=0; |
327 | struct stat stat_buf; | 326 | struct stat stat_buf; |
328 | off_t offset = 0; | 327 | off_t offset = 0; |
329 | QFile srcFile(src); | 328 | QFile srcFile(src); |
330 | QFile destFile(dest); | 329 | QFile destFile(dest); |
331 | 330 | ||
332 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { | 331 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { |
333 | return success = false; | 332 | return success = false; |
334 | } | 333 | } |
335 | read_fd = srcFile.handle(); | 334 | read_fd = srcFile.handle(); |
336 | if(read_fd != -1) { | 335 | if(read_fd != -1) { |
337 | fstat (read_fd, &stat_buf); | 336 | fstat (read_fd, &stat_buf); |
338 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) | 337 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) |
339 | return success = false; | 338 | return success = false; |
340 | write_fd = destFile.handle(); | 339 | write_fd = destFile.handle(); |
341 | if(write_fd != -1) { | 340 | if(write_fd != -1) { |
342 | int err=0; | 341 | int err=0; |
343 | QString msg; | 342 | QString msg; |
344 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); | 343 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); |
345 | if( err == -1) { | 344 | if( err == -1) { |
346 | switch(err) { | 345 | switch(err) { |
347 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; | 346 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; |
348 | case EINVAL: msg = "Descriptor is not valid or locked. "; | 347 | case EINVAL: msg = "Descriptor is not valid or locked. "; |
349 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; | 348 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; |
350 | case EIO: msg = "Unspecified error while reading from in_fd."; | 349 | case EIO: msg = "Unspecified error while reading from in_fd."; |
351 | }; | 350 | }; |
352 | success = false; | 351 | success = false; |
353 | } | 352 | } |