|
|
|
@ -378,7 +378,7 @@ void kio_digikamalbums::get( const KURL& url )
|
|
|
|
|
TQString libraryPath = url.user();
|
|
|
|
|
if (libraryPath.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -389,28 +389,28 @@ void kio_digikamalbums::get( const KURL& url )
|
|
|
|
|
if ( KDE_stat( path.data(), &buff ) == -1 )
|
|
|
|
|
{
|
|
|
|
|
if ( errno == EACCES )
|
|
|
|
|
error( KIO::ERR_ACCESS_DENIED, url.url() );
|
|
|
|
|
error( TDEIO::ERR_ACCESS_DENIED, url.url() );
|
|
|
|
|
else
|
|
|
|
|
error( KIO::ERR_DOES_NOT_EXIST, url.url() );
|
|
|
|
|
error( TDEIO::ERR_DOES_NOT_EXIST, url.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( S_ISDIR( buff.st_mode ) )
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_IS_DIRECTORY, url.url() );
|
|
|
|
|
error( TDEIO::ERR_IS_DIRECTORY, url.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !S_ISREG( buff.st_mode ) )
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_CANNOT_OPEN_FOR_READING, url.url() );
|
|
|
|
|
error( TDEIO::ERR_CANNOT_OPEN_FOR_READING, url.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int fd = KDE_open( path.data(), O_RDONLY);
|
|
|
|
|
if ( fd < 0 )
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_CANNOT_OPEN_FOR_READING, url.url() );
|
|
|
|
|
error( TDEIO::ERR_CANNOT_OPEN_FOR_READING, url.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -424,7 +424,7 @@ void kio_digikamalbums::get( const KURL& url )
|
|
|
|
|
|
|
|
|
|
char buffer[ MAX_IPC_SIZE ];
|
|
|
|
|
TQByteArray array;
|
|
|
|
|
KIO::filesize_t processed_size = 0;
|
|
|
|
|
TDEIO::filesize_t processed_size = 0;
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
@ -433,7 +433,7 @@ void kio_digikamalbums::get( const KURL& url )
|
|
|
|
|
{
|
|
|
|
|
if (errno == EINTR)
|
|
|
|
|
continue;
|
|
|
|
|
error( KIO::ERR_COULD_NOT_READ, url.url());
|
|
|
|
|
error( TDEIO::ERR_COULD_NOT_READ, url.url());
|
|
|
|
|
close(fd);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -464,7 +464,7 @@ void kio_digikamalbums::put(const KURL& url, int permissions, bool overwrite, bo
|
|
|
|
|
TQString libraryPath = url.user();
|
|
|
|
|
if (libraryPath.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -483,7 +483,7 @@ void kio_digikamalbums::put(const KURL& url, int permissions, bool overwrite, bo
|
|
|
|
|
AlbumInfo album = findAlbum(url.directory());
|
|
|
|
|
if (album.id == -1)
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, i18n("Source album %1 not found in database")
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, i18n("Source album %1 not found in database")
|
|
|
|
|
.arg(url.directory()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -498,9 +498,9 @@ void kio_digikamalbums::put(const KURL& url, int permissions, bool overwrite, bo
|
|
|
|
|
if ( origExists && !overwrite)
|
|
|
|
|
{
|
|
|
|
|
if (S_ISDIR(buff.st_mode))
|
|
|
|
|
error( KIO::ERR_DIR_ALREADY_EXIST, url.url() );
|
|
|
|
|
error( TDEIO::ERR_DIR_ALREADY_EXIST, url.url() );
|
|
|
|
|
else
|
|
|
|
|
error( KIO::ERR_FILE_ALREADY_EXIST, url.url() );
|
|
|
|
|
error( TDEIO::ERR_FILE_ALREADY_EXIST, url.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -517,9 +517,9 @@ void kio_digikamalbums::put(const KURL& url, int permissions, bool overwrite, bo
|
|
|
|
|
{
|
|
|
|
|
kdWarning() << "####################### COULD NOT OPEN " << dest << endl;
|
|
|
|
|
if ( errno == EACCES )
|
|
|
|
|
error( KIO::ERR_WRITE_ACCESS_DENIED, url.url() );
|
|
|
|
|
error( TDEIO::ERR_WRITE_ACCESS_DENIED, url.url() );
|
|
|
|
|
else
|
|
|
|
|
error( KIO::ERR_CANNOT_OPEN_FOR_WRITING, url.url() );
|
|
|
|
|
error( TDEIO::ERR_CANNOT_OPEN_FOR_WRITING, url.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -538,13 +538,13 @@ void kio_digikamalbums::put(const KURL& url, int permissions, bool overwrite, bo
|
|
|
|
|
{
|
|
|
|
|
if ( errno == ENOSPC ) // disk full
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_DISK_FULL, url.url());
|
|
|
|
|
error( TDEIO::ERR_DISK_FULL, url.url());
|
|
|
|
|
result = -1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
kdWarning() << "Couldn't write. Error:" << strerror(errno) << endl;
|
|
|
|
|
error( KIO::ERR_COULD_NOT_WRITE, url.url());
|
|
|
|
|
error( TDEIO::ERR_COULD_NOT_WRITE, url.url());
|
|
|
|
|
result = -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -566,7 +566,7 @@ void kio_digikamalbums::put(const KURL& url, int permissions, bool overwrite, bo
|
|
|
|
|
if ( close(fd) )
|
|
|
|
|
{
|
|
|
|
|
kdWarning() << "Error when closing file descriptor:" << strerror(errno) << endl;
|
|
|
|
|
error( KIO::ERR_COULD_NOT_WRITE, url.url());
|
|
|
|
|
error( TDEIO::ERR_COULD_NOT_WRITE, url.url());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -576,7 +576,7 @@ void kio_digikamalbums::put(const KURL& url, int permissions, bool overwrite, bo
|
|
|
|
|
if (::chmod(_dest.data(), permissions) != 0)
|
|
|
|
|
{
|
|
|
|
|
// couldn't chmod. Eat the error if the filesystem apparently doesn't support it.
|
|
|
|
|
if ( KIO::testFileSystemFlag( _dest, KIO::SupportsChmod ) )
|
|
|
|
|
if ( TDEIO::testFileSystemFlag( _dest, TDEIO::SupportsChmod ) )
|
|
|
|
|
warning( i18n( "Could not change permissions for\n%1" ).arg( url.url() ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -618,7 +618,7 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
TQString libraryPath = src.user();
|
|
|
|
|
if (libraryPath.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -626,7 +626,7 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
TQString dstLibraryPath = dst.user();
|
|
|
|
|
if (libraryPath != dstLibraryPath)
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN,
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN,
|
|
|
|
|
TQString("Source and Destination have different Album Library Paths. ") +
|
|
|
|
|
TQString("Src: ") + src.user() +
|
|
|
|
|
TQString(", Dest: ") + dst.user());
|
|
|
|
@ -648,7 +648,7 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
AlbumInfo srcAlbum = findAlbum(src.directory());
|
|
|
|
|
if (srcAlbum.id == -1)
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, TQString("Source album %1 not found in database")
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, TQString("Source album %1 not found in database")
|
|
|
|
|
.arg(src.directory()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -657,7 +657,7 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
AlbumInfo dstAlbum = findAlbum(dst.directory());
|
|
|
|
|
if (dstAlbum.id == -1)
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, TQString("Destination album %1 not found in database")
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, TQString("Destination album %1 not found in database")
|
|
|
|
|
.arg(dst.directory()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -688,23 +688,23 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
if ( KDE_stat( _src.data(), &buff_src ) == -1 )
|
|
|
|
|
{
|
|
|
|
|
if ( errno == EACCES )
|
|
|
|
|
error( KIO::ERR_ACCESS_DENIED, src.url() );
|
|
|
|
|
error( TDEIO::ERR_ACCESS_DENIED, src.url() );
|
|
|
|
|
else
|
|
|
|
|
error( KIO::ERR_DOES_NOT_EXIST, src.url() );
|
|
|
|
|
error( TDEIO::ERR_DOES_NOT_EXIST, src.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// bail out if its a directory
|
|
|
|
|
if ( S_ISDIR( buff_src.st_mode ) )
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_IS_DIRECTORY, src.url() );
|
|
|
|
|
error( TDEIO::ERR_IS_DIRECTORY, src.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// bail out if its a socket or fifo
|
|
|
|
|
if ( S_ISFIFO( buff_src.st_mode ) || S_ISSOCK ( buff_src.st_mode ) )
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_CANNOT_OPEN_FOR_READING, src.url() );
|
|
|
|
|
error( TDEIO::ERR_CANNOT_OPEN_FOR_READING, src.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -716,14 +716,14 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
// bail out if its a directory
|
|
|
|
|
if (S_ISDIR(buff_dest.st_mode))
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_DIR_ALREADY_EXIST, dst.url() );
|
|
|
|
|
error( TDEIO::ERR_DIR_ALREADY_EXIST, dst.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if !overwrite bail out
|
|
|
|
|
if (!overwrite)
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_FILE_ALREADY_EXIST, dst.url() );
|
|
|
|
|
error( TDEIO::ERR_FILE_ALREADY_EXIST, dst.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -740,7 +740,7 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
int src_fd = KDE_open( _src.data(), O_RDONLY);
|
|
|
|
|
if ( src_fd < 0 )
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_CANNOT_OPEN_FOR_READING, src.path() );
|
|
|
|
|
error( TDEIO::ERR_CANNOT_OPEN_FOR_READING, src.path() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -758,11 +758,11 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
kdDebug() << "###### COULD NOT WRITE " << dst.url() << endl;
|
|
|
|
|
if ( errno == EACCES )
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_WRITE_ACCESS_DENIED, dst.url() );
|
|
|
|
|
error( TDEIO::ERR_WRITE_ACCESS_DENIED, dst.url() );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_CANNOT_OPEN_FOR_WRITING, dst.url() );
|
|
|
|
|
error( TDEIO::ERR_CANNOT_OPEN_FOR_WRITING, dst.url() );
|
|
|
|
|
}
|
|
|
|
|
close(src_fd);
|
|
|
|
|
return;
|
|
|
|
@ -771,7 +771,7 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
// emit the total size for copying
|
|
|
|
|
totalSize( buff_src.st_size );
|
|
|
|
|
|
|
|
|
|
KIO::filesize_t processed_size = 0;
|
|
|
|
|
TDEIO::filesize_t processed_size = 0;
|
|
|
|
|
char buffer[ MAX_IPC_SIZE ];
|
|
|
|
|
int n;
|
|
|
|
|
|
|
|
|
@ -784,7 +784,7 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
{
|
|
|
|
|
if (errno == EINTR)
|
|
|
|
|
continue;
|
|
|
|
|
error( KIO::ERR_COULD_NOT_READ, src.path());
|
|
|
|
|
error( TDEIO::ERR_COULD_NOT_READ, src.path());
|
|
|
|
|
close(src_fd);
|
|
|
|
|
close(dest_fd);
|
|
|
|
|
return;
|
|
|
|
@ -802,13 +802,13 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
|
|
|
|
|
if ( errno == ENOSPC ) // disk full
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_DISK_FULL, dst.url());
|
|
|
|
|
error( TDEIO::ERR_DISK_FULL, dst.url());
|
|
|
|
|
remove( _dst.data() );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
kdWarning() << "Couldn't write[2]. Error:" << strerror(errno) << endl;
|
|
|
|
|
error( KIO::ERR_COULD_NOT_WRITE, dst.url());
|
|
|
|
|
error( TDEIO::ERR_COULD_NOT_WRITE, dst.url());
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -822,7 +822,7 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
if (close( dest_fd))
|
|
|
|
|
{
|
|
|
|
|
kdWarning() << "Error when closing file descriptor[2]:" << strerror(errno) << endl;
|
|
|
|
|
error( KIO::ERR_COULD_NOT_WRITE, dst.url());
|
|
|
|
|
error( TDEIO::ERR_COULD_NOT_WRITE, dst.url());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -832,7 +832,7 @@ void kio_digikamalbums::copy( const KURL &src, const KURL &dst, int mode, bool o
|
|
|
|
|
if (::chmod(_dst.data(), mode) != 0)
|
|
|
|
|
{
|
|
|
|
|
// Eat the error if the filesystem apparently doesn't support chmod.
|
|
|
|
|
if ( KIO::testFileSystemFlag( _dst, KIO::SupportsChmod ) )
|
|
|
|
|
if ( TDEIO::testFileSystemFlag( _dst, TDEIO::SupportsChmod ) )
|
|
|
|
|
warning( i18n( "Could not change permissions for\n%1" ).arg( dst.url() ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -869,14 +869,14 @@ void kio_digikamalbums::rename( const KURL& src, const KURL& dst, bool overwrite
|
|
|
|
|
TQString libraryPath = src.user();
|
|
|
|
|
if (libraryPath.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQString dstLibraryPath = dst.user();
|
|
|
|
|
if (libraryPath != dstLibraryPath)
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN,
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN,
|
|
|
|
|
i18n("Source and Destination have different Album Library Paths.\n"
|
|
|
|
|
"Source: %1\n"
|
|
|
|
|
"Destination: %2")
|
|
|
|
@ -901,9 +901,9 @@ void kio_digikamalbums::rename( const KURL& src, const KURL& dst, bool overwrite
|
|
|
|
|
if ( KDE_stat( csrc.data(), &buff_src ) == -1 )
|
|
|
|
|
{
|
|
|
|
|
if ( errno == EACCES )
|
|
|
|
|
error( KIO::ERR_ACCESS_DENIED, src.url() );
|
|
|
|
|
error( TDEIO::ERR_ACCESS_DENIED, src.url() );
|
|
|
|
|
else
|
|
|
|
|
error( KIO::ERR_DOES_NOT_EXIST, src.url() );
|
|
|
|
|
error( TDEIO::ERR_DOES_NOT_EXIST, src.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -914,13 +914,13 @@ void kio_digikamalbums::rename( const KURL& src, const KURL& dst, bool overwrite
|
|
|
|
|
{
|
|
|
|
|
if (S_ISDIR(buff_dest.st_mode))
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_DIR_ALREADY_EXIST, dst.url() );
|
|
|
|
|
error( TDEIO::ERR_DIR_ALREADY_EXIST, dst.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!overwrite)
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_FILE_ALREADY_EXIST, dst.url() );
|
|
|
|
|
error( TDEIO::ERR_FILE_ALREADY_EXIST, dst.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -939,7 +939,7 @@ void kio_digikamalbums::rename( const KURL& src, const KURL& dst, bool overwrite
|
|
|
|
|
srcAlbum = findAlbum(src.path());
|
|
|
|
|
if (srcAlbum.id == -1)
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, i18n("Source album %1 not found in database")
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, i18n("Source album %1 not found in database")
|
|
|
|
|
.arg(src.url()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -949,7 +949,7 @@ void kio_digikamalbums::rename( const KURL& src, const KURL& dst, bool overwrite
|
|
|
|
|
srcAlbum = findAlbum(src.directory());
|
|
|
|
|
if (srcAlbum.id == -1)
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, i18n("Source album %1 not found in database")
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, i18n("Source album %1 not found in database")
|
|
|
|
|
.arg(src.directory()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -957,7 +957,7 @@ void kio_digikamalbums::rename( const KURL& src, const KURL& dst, bool overwrite
|
|
|
|
|
dstAlbum = findAlbum(dst.directory());
|
|
|
|
|
if (dstAlbum.id == -1)
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, i18n("Destination album %1 not found in database")
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, i18n("Destination album %1 not found in database")
|
|
|
|
|
.arg(dst.directory()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -970,23 +970,23 @@ void kio_digikamalbums::rename( const KURL& src, const KURL& dst, bool overwrite
|
|
|
|
|
{
|
|
|
|
|
TQFileInfo toCheck(libraryPath + src.path());
|
|
|
|
|
if (!toCheck.isWritable())
|
|
|
|
|
error( KIO::ERR_CANNOT_RENAME_ORIGINAL, src.path() );
|
|
|
|
|
error( TDEIO::ERR_CANNOT_RENAME_ORIGINAL, src.path() );
|
|
|
|
|
else
|
|
|
|
|
error( KIO::ERR_ACCESS_DENIED, dst.path() );
|
|
|
|
|
error( TDEIO::ERR_ACCESS_DENIED, dst.path() );
|
|
|
|
|
}
|
|
|
|
|
else if (errno == EXDEV)
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_UNSUPPORTED_ACTION, i18n("This file/folder is on a different "
|
|
|
|
|
error( TDEIO::ERR_UNSUPPORTED_ACTION, i18n("This file/folder is on a different "
|
|
|
|
|
"filesystem through symlinks. "
|
|
|
|
|
"Moving/Renaming files between "
|
|
|
|
|
"them is currently unsupported "));
|
|
|
|
|
}
|
|
|
|
|
else if (errno == EROFS)
|
|
|
|
|
{ // The file is on a read-only filesystem
|
|
|
|
|
error( KIO::ERR_CANNOT_DELETE, src.url() );
|
|
|
|
|
error( TDEIO::ERR_CANNOT_DELETE, src.url() );
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
error( KIO::ERR_CANNOT_RENAME, src.url() );
|
|
|
|
|
error( TDEIO::ERR_CANNOT_RENAME, src.url() );
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1010,14 +1010,14 @@ void kio_digikamalbums::stat( const KURL& url )
|
|
|
|
|
TQString libraryPath = url.user();
|
|
|
|
|
if (libraryPath.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KIO::UDSEntry entry;
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
|
if (!createUDSEntry(libraryPath + url.path(), entry))
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_DOES_NOT_EXIST, url.path(-1));
|
|
|
|
|
error(TDEIO::ERR_DOES_NOT_EXIST, url.path(-1));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1033,7 +1033,7 @@ void kio_digikamalbums::listDir( const KURL& url )
|
|
|
|
|
TQString libraryPath = url.user();
|
|
|
|
|
if (libraryPath.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
kdWarning() << "Album Library Path not supplied to kioslave" << endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1042,14 +1042,14 @@ void kio_digikamalbums::listDir( const KURL& url )
|
|
|
|
|
TQString path = libraryPath + url.path();
|
|
|
|
|
if (KDE_stat(TQFile::encodeName(path), &stbuf) != 0)
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_DOES_NOT_EXIST, url.path(-1));
|
|
|
|
|
error(TDEIO::ERR_DOES_NOT_EXIST, url.path(-1));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQDir dir(path);
|
|
|
|
|
if (!dir.isReadable())
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_CANNOT_ENTER_DIRECTORY, url.path());
|
|
|
|
|
error( TDEIO::ERR_CANNOT_ENTER_DIRECTORY, url.path());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1057,7 +1057,7 @@ void kio_digikamalbums::listDir( const KURL& url )
|
|
|
|
|
TQFileInfoListIterator it( *list );
|
|
|
|
|
TQFileInfo *fi;
|
|
|
|
|
|
|
|
|
|
KIO::UDSEntry entry;
|
|
|
|
|
TDEIO::UDSEntry entry;
|
|
|
|
|
createDigikamPropsUDSEntry(entry);
|
|
|
|
|
listEntry(entry, false);
|
|
|
|
|
while ((fi = it.current()) != 0)
|
|
|
|
@ -1083,7 +1083,7 @@ void kio_digikamalbums::mkdir( const KURL& url, int permissions )
|
|
|
|
|
TQString libraryPath = url.user();
|
|
|
|
|
if (libraryPath.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1104,17 +1104,17 @@ void kio_digikamalbums::mkdir( const KURL& url, int permissions )
|
|
|
|
|
{
|
|
|
|
|
if ( errno == EACCES )
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_ACCESS_DENIED, path );
|
|
|
|
|
error( TDEIO::ERR_ACCESS_DENIED, path );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if ( errno == ENOSPC )
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_DISK_FULL, path );
|
|
|
|
|
error( TDEIO::ERR_DISK_FULL, path );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_COULD_NOT_MKDIR, path );
|
|
|
|
|
error( TDEIO::ERR_COULD_NOT_MKDIR, path );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1129,7 +1129,7 @@ void kio_digikamalbums::mkdir( const KURL& url, int permissions )
|
|
|
|
|
if ( permissions != -1 )
|
|
|
|
|
{
|
|
|
|
|
if ( ::chmod( _path.data(), permissions ) == -1 )
|
|
|
|
|
error( KIO::ERR_CANNOT_CHMOD, path );
|
|
|
|
|
error( TDEIO::ERR_CANNOT_CHMOD, path );
|
|
|
|
|
else
|
|
|
|
|
finished();
|
|
|
|
|
}
|
|
|
|
@ -1141,11 +1141,11 @@ void kio_digikamalbums::mkdir( const KURL& url, int permissions )
|
|
|
|
|
|
|
|
|
|
if ( S_ISDIR( buff.st_mode ) )
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_DIR_ALREADY_EXIST, path );
|
|
|
|
|
error( TDEIO::ERR_DIR_ALREADY_EXIST, path );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
error( KIO::ERR_FILE_ALREADY_EXIST, path );
|
|
|
|
|
error( TDEIO::ERR_FILE_ALREADY_EXIST, path );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::chmod( const KURL& url, int permissions )
|
|
|
|
@ -1157,13 +1157,13 @@ void kio_digikamalbums::chmod( const KURL& url, int permissions )
|
|
|
|
|
TQString libraryPath = url.user();
|
|
|
|
|
if (libraryPath.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQCString path( TQFile::encodeName(libraryPath + url.path()));
|
|
|
|
|
if ( ::chmod( path.data(), permissions ) == -1 )
|
|
|
|
|
error( KIO::ERR_CANNOT_CHMOD, url.url() );
|
|
|
|
|
error( TDEIO::ERR_CANNOT_CHMOD, url.url() );
|
|
|
|
|
else
|
|
|
|
|
finished();
|
|
|
|
|
}
|
|
|
|
@ -1177,7 +1177,7 @@ void kio_digikamalbums::del( const KURL& url, bool isfile)
|
|
|
|
|
TQString libraryPath = url.user();
|
|
|
|
|
if (libraryPath.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, "Album Library Path not supplied to kioslave");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1209,7 +1209,7 @@ void kio_digikamalbums::del( const KURL& url, bool isfile)
|
|
|
|
|
AlbumInfo album = findAlbum(url.directory());
|
|
|
|
|
if (album.id == -1)
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, i18n("Source album %1 not found in database")
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, i18n("Source album %1 not found in database")
|
|
|
|
|
.arg(url.directory()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1218,11 +1218,11 @@ void kio_digikamalbums::del( const KURL& url, bool isfile)
|
|
|
|
|
if ( unlink( path.data() ) == -1 )
|
|
|
|
|
{
|
|
|
|
|
if ((errno == EACCES) || (errno == EPERM))
|
|
|
|
|
error( KIO::ERR_ACCESS_DENIED, url.url());
|
|
|
|
|
error( TDEIO::ERR_ACCESS_DENIED, url.url());
|
|
|
|
|
else if (errno == EISDIR)
|
|
|
|
|
error( KIO::ERR_IS_DIRECTORY, url.url());
|
|
|
|
|
error( TDEIO::ERR_IS_DIRECTORY, url.url());
|
|
|
|
|
else
|
|
|
|
|
error( KIO::ERR_CANNOT_DELETE, url.url() );
|
|
|
|
|
error( TDEIO::ERR_CANNOT_DELETE, url.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1237,7 +1237,7 @@ void kio_digikamalbums::del( const KURL& url, bool isfile)
|
|
|
|
|
AlbumInfo album = findAlbum(url.path());
|
|
|
|
|
if (album.id == -1)
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, i18n("Source album %1 not found in database")
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, i18n("Source album %1 not found in database")
|
|
|
|
|
.arg(url.path()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1248,13 +1248,13 @@ void kio_digikamalbums::del( const KURL& url, bool isfile)
|
|
|
|
|
|
|
|
|
|
if ((errno == EACCES) || (errno == EPERM))
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_ACCESS_DENIED, url.url());
|
|
|
|
|
error( TDEIO::ERR_ACCESS_DENIED, url.url());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "could not rmdir " << perror << endl;
|
|
|
|
|
error( KIO::ERR_COULD_NOT_RMDIR, url.url() );
|
|
|
|
|
error( TDEIO::ERR_COULD_NOT_RMDIR, url.url() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1267,7 +1267,7 @@ void kio_digikamalbums::del( const KURL& url, bool isfile)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool kio_digikamalbums::createUDSEntry(const TQString& path, KIO::UDSEntry& entry)
|
|
|
|
|
bool kio_digikamalbums::createUDSEntry(const TQString& path, TDEIO::UDSEntry& entry)
|
|
|
|
|
{
|
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
|
@ -1275,40 +1275,40 @@ bool kio_digikamalbums::createUDSEntry(const TQString& path, KIO::UDSEntry& entr
|
|
|
|
|
if (KDE_stat(TQFile::encodeName(path), &stbuf) != 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
KIO::UDSAtom atom;
|
|
|
|
|
TDEIO::UDSAtom atom;
|
|
|
|
|
|
|
|
|
|
atom.m_uds = KIO::UDS_FILE_TYPE;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_FILE_TYPE;
|
|
|
|
|
atom.m_long = stbuf.st_mode & S_IFMT;
|
|
|
|
|
entry.append( atom );
|
|
|
|
|
|
|
|
|
|
atom.m_uds = KIO::UDS_ACCESS;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_ACCESS;
|
|
|
|
|
atom.m_long = stbuf.st_mode & 07777;
|
|
|
|
|
entry.append( atom );
|
|
|
|
|
|
|
|
|
|
atom.m_uds = KIO::UDS_SIZE;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_SIZE;
|
|
|
|
|
atom.m_long = stbuf.st_size;
|
|
|
|
|
entry.append( atom );
|
|
|
|
|
|
|
|
|
|
atom.m_uds = KIO::UDS_MODIFICATION_TIME;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_MODIFICATION_TIME;
|
|
|
|
|
atom.m_long = stbuf.st_mtime;
|
|
|
|
|
entry.append( atom );
|
|
|
|
|
|
|
|
|
|
atom.m_uds = KIO::UDS_ACCESS_TIME;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_ACCESS_TIME;
|
|
|
|
|
atom.m_long = stbuf.st_atime;
|
|
|
|
|
entry.append( atom );
|
|
|
|
|
|
|
|
|
|
atom.m_uds = KIO::UDS_NAME;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_NAME;
|
|
|
|
|
atom.m_str = TQFileInfo(path).fileName();
|
|
|
|
|
entry.append(atom);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// If we provide the local path, a KIO::CopyJob will optimize away
|
|
|
|
|
// If we provide the local path, a TDEIO::CopyJob will optimize away
|
|
|
|
|
// the use of our custom digikamalbums:/ ioslave, which breaks
|
|
|
|
|
// copying the database entry:
|
|
|
|
|
// Disabling this as a temporary solution for bug #137282
|
|
|
|
|
// This code is intended as a fix for bug #122653.
|
|
|
|
|
#if KDE_IS_VERSION(3,4,0)
|
|
|
|
|
atom.m_uds = KIO::UDS_LOCAL_PATH;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_LOCAL_PATH;
|
|
|
|
|
atom.m_str = path;
|
|
|
|
|
entry.append(atom);
|
|
|
|
|
#endif
|
|
|
|
@ -1317,33 +1317,33 @@ bool kio_digikamalbums::createUDSEntry(const TQString& path, KIO::UDSEntry& entr
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kio_digikamalbums::createDigikamPropsUDSEntry(KIO::UDSEntry& entry)
|
|
|
|
|
void kio_digikamalbums::createDigikamPropsUDSEntry(TDEIO::UDSEntry& entry)
|
|
|
|
|
{
|
|
|
|
|
entry.clear();
|
|
|
|
|
|
|
|
|
|
KIO::UDSAtom atom;
|
|
|
|
|
TDEIO::UDSAtom atom;
|
|
|
|
|
|
|
|
|
|
atom.m_uds = KIO::UDS_FILE_TYPE;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_FILE_TYPE;
|
|
|
|
|
atom.m_long = S_IFREG;
|
|
|
|
|
entry.append( atom );
|
|
|
|
|
|
|
|
|
|
atom.m_uds = KIO::UDS_ACCESS;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_ACCESS;
|
|
|
|
|
atom.m_long = 00666;
|
|
|
|
|
entry.append( atom );
|
|
|
|
|
|
|
|
|
|
atom.m_uds = KIO::UDS_SIZE;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_SIZE;
|
|
|
|
|
atom.m_long = 0;
|
|
|
|
|
entry.append( atom );
|
|
|
|
|
|
|
|
|
|
atom.m_uds = KIO::UDS_MODIFICATION_TIME;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_MODIFICATION_TIME;
|
|
|
|
|
atom.m_long = TQDateTime::currentDateTime().toTime_t();
|
|
|
|
|
entry.append( atom );
|
|
|
|
|
|
|
|
|
|
atom.m_uds = KIO::UDS_ACCESS_TIME;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_ACCESS_TIME;
|
|
|
|
|
atom.m_long = TQDateTime::currentDateTime().toTime_t();
|
|
|
|
|
entry.append( atom );
|
|
|
|
|
|
|
|
|
|
atom.m_uds = KIO::UDS_NAME;
|
|
|
|
|
atom.m_uds = TDEIO::UDS_NAME;
|
|
|
|
|
atom.m_str = ".digikam_properties";
|
|
|
|
|
entry.append(atom);
|
|
|
|
|
}
|
|
|
|
@ -1749,7 +1749,7 @@ void kio_digikamalbums::copyImage(int srcAlbumID, const TQString& srcName,
|
|
|
|
|
// check for src == dest
|
|
|
|
|
if (srcAlbumID == dstAlbumID && srcName == dstName)
|
|
|
|
|
{
|
|
|
|
|
error( KIO::ERR_FILE_ALREADY_EXIST, dstName );
|
|
|
|
|
error( TDEIO::ERR_FILE_ALREADY_EXIST, dstName );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1762,7 +1762,7 @@ void kio_digikamalbums::copyImage(int srcAlbumID, const TQString& srcName,
|
|
|
|
|
|
|
|
|
|
if (values.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
error(KIO::ERR_UNKNOWN, i18n("Source image %1 not found in database")
|
|
|
|
|
error(TDEIO::ERR_UNKNOWN, i18n("Source image %1 not found in database")
|
|
|
|
|
.arg(srcName));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|