Commit 667fc709 authored by David Faure's avatar David Faure
Browse files

Merged KIO::JobFlags branch

svn path=/trunk/KDE/kdebase/runtime/; revision=721447
parent ba7a3358
......@@ -157,7 +157,7 @@ void FilterProtocol::get( const KUrl & )
finished();
}
void FilterProtocol::put( const KUrl &/*url*/, int, bool /*_overwrite*/, bool /*_resume*/ )
void FilterProtocol::put( const KUrl &/*url*/, int, KIO::JobFlags /* _flags */ )
{
error( KIO::ERR_UNSUPPORTED_ACTION, QString::fromLatin1("put"));
}
......
......@@ -38,8 +38,7 @@ public:
FilterProtocol( const QByteArray & protocol, const QByteArray &pool, const QByteArray &app );
virtual void get( const KUrl &url );
virtual void put( const KUrl &url, int _mode, bool _overwrite,
bool _resume );
virtual void put( const KUrl &url, int _mode, KIO::JobFlags _flags );
virtual void setSubURL(const KUrl &url);
private:
......
......@@ -1279,8 +1279,8 @@ void fishProtocol::get(const KUrl& u){
}
/** put a file */
void fishProtocol::put(const KUrl& u, int permissions, bool overwrite, bool /*resume*/){
myDebug( << "@@@@@@@@@ put " << u << " " << permissions << " " << overwrite << " " /* << resume */ << endl);
void fishProtocol::put(const KUrl& u, int permissions, KIO::JobFlags flags) {
myDebug( << "@@@@@@@@@ put " << u << " " << permissions << " " << (flags & KIO::Overwrite) << " " /* << resume */ << endl);
setHost(u.host(),u.port(),u.user(),u.pass());
url = u;
openConnection();
......@@ -1291,7 +1291,7 @@ void fishProtocol::put(const KUrl& u, int permissions, bool overwrite, bool /*re
} else {
putPerm = permissions;
checkOverwrite = overwrite;
checkOverwrite = flags & KIO::Overwrite;
checkExist = false;
putPos = 0;
listReason = CHECK;
......@@ -1471,8 +1471,8 @@ void fishProtocol::mkdir(const KUrl& u, int permissions) {
run();
}
/** rename a file */
void fishProtocol::rename(const KUrl& s, const KUrl& d, bool overwrite) {
myDebug( << "@@@@@@@@@ rename " << s << " " << d << " " << overwrite << endl);
void fishProtocol::rename(const KUrl& s, const KUrl& d, KIO::JobFlags flags) {
myDebug( << "@@@@@@@@@ rename " << s << " " << d << " " << (flags & KIO::Overwrite) << endl);
if (s.host() != d.host() || s.port() != d.port() || s.user() != d.user()) {
error(ERR_UNSUPPORTED_ACTION,s.prettyUrl());
return;
......@@ -1487,7 +1487,7 @@ void fishProtocol::rename(const KUrl& s, const KUrl& d, bool overwrite) {
if (!url.hasPath()) {
sendCommand(FISH_PWD);
} else {
if (!overwrite) {
if (!(flags & KIO::Overwrite)) {
listReason = CHECK;
checkOverwrite = false;
sendCommand(FISH_LIST,E(url.path()));
......@@ -1497,8 +1497,8 @@ void fishProtocol::rename(const KUrl& s, const KUrl& d, bool overwrite) {
run();
}
/** create a symlink */
void fishProtocol::symlink(const QString& target, const KUrl& u, bool overwrite) {
myDebug( << "@@@@@@@@@ symlink " << target << " " << u << " " << overwrite << endl);
void fishProtocol::symlink(const QString& target, const KUrl& u, KIO::JobFlags flags) {
myDebug( << "@@@@@@@@@ symlink " << target << " " << u << " " << (flags & KIO::Overwrite) << endl);
setHost(u.host(),u.port(),u.user(),u.pass());
url = u;
openConnection();
......@@ -1507,7 +1507,7 @@ void fishProtocol::symlink(const QString& target, const KUrl& u, bool overwrite)
if (!url.hasPath()) {
sendCommand(FISH_PWD);
} else {
if (!overwrite) {
if (!(flags & KIO::Overwrite)) {
listReason = CHECK;
checkOverwrite = false;
sendCommand(FISH_LIST,E(url.path()));
......@@ -1532,8 +1532,8 @@ void fishProtocol::chmod(const KUrl& u, int permissions){
run();
}
/** copies a file */
void fishProtocol::copy(const KUrl &s, const KUrl &d, int permissions, bool overwrite) {
myDebug( << "@@@@@@@@@ copy " << s << " " << d << " " << permissions << " " << overwrite << endl);
void fishProtocol::copy(const KUrl &s, const KUrl &d, int permissions, KIO::JobFlags flags) {
myDebug( << "@@@@@@@@@ copy " << s << " " << d << " " << permissions << " " << (flags & KIO::Overwrite) << endl);
if (s.host() != d.host() || s.port() != d.port() || s.user() != d.user()) {
error(ERR_UNSUPPORTED_ACTION,s.prettyUrl());
return;
......@@ -1549,7 +1549,7 @@ void fishProtocol::copy(const KUrl &s, const KUrl &d, int permissions, bool over
if (!src.hasPath()) {
sendCommand(FISH_PWD);
} else {
if (!overwrite) {
if (!(flags & KIO::Overwrite)) {
listReason = CHECK;
checkOverwrite = false;
sendCommand(FISH_LIST,E(url.path()));
......
......@@ -52,7 +52,7 @@ It is set to false if the connection becomes closed.
/** get a file */
void get(const KUrl& url);
/** put a file */
void put(const KUrl& url, int permissions, bool overwrite, bool resume);
void put(const KUrl& url, int permissions, KIO::JobFlags flags );
/** aborts command sequence and calls error() */
void error(int type, const QString &detail);
/** executes next command in sequence or calls finished() if all is done */
......@@ -66,13 +66,13 @@ It is set to false if the connection becomes closed.
/** create a directory */
void mkdir(const KUrl&url, int permissions);
/** rename a file */
void rename(const KUrl& src, const KUrl& dest, bool overwrite);
void rename(const KUrl& src, const KUrl& dest, KIO::JobFlags flags);
/** create a symlink */
void symlink(const QString& target, const KUrl& dest, bool overwrite);
void symlink(const QString& target, const KUrl& dest, KIO::JobFlags flags);
/** change file permissions */
void chmod(const KUrl& url, int permissions);
/** copies a file */
void copy(const KUrl &src, const KUrl &dest, int permissions, bool overwrite);
void copy(const KUrl &src, const KUrl &dest, int permissions, KIO::JobFlags flags);
/** report status */
void slave_status();
/** removes a file or directory */
......
......@@ -852,7 +852,7 @@ void FloppyProtocol::del( const KUrl& url, bool isfile)
finished();
}
void FloppyProtocol::rename( const KUrl &src, const KUrl &dest, bool _overwrite )
void FloppyProtocol::rename( const KUrl &src, const KUrl &dest, KIO::JobFlags flags )
{
QString srcPath(src.path());
QString destPath(dest.path());
......@@ -888,7 +888,7 @@ void FloppyProtocol::rename( const KUrl &src, const KUrl &dest, bool _overwrite
//kDebug(7101)<<"Floppy::stat(): create args";
QStringList args;
if (_overwrite)
if (flags & KIO::Overwrite)
args<<"mren"<<"-o"<<(srcDrive+srcFloppyPath)<<(destDrive+destFloppyPath);
else
args<<"mren"<<"-D"<<"s"<<(srcDrive+srcFloppyPath)<<(destDrive+destFloppyPath);
......@@ -1034,7 +1034,7 @@ void FloppyProtocol::get( const KUrl& url )
finished();
}
void FloppyProtocol::put( const KUrl& url, int , bool overwrite, bool )
void FloppyProtocol::put( const KUrl& url, int , JobFlags flags )
{
QString path(url.path());
kDebug(7101)<<"Floppy::put() -"<<path<<"-";
......@@ -1063,7 +1063,7 @@ void FloppyProtocol::put( const KUrl& url, int , bool overwrite, bool )
delete m_mtool;
//kDebug(7101)<<"Floppy::stat(): create args";
QStringList args;
if (overwrite)
if (flags & KIO::Overwrite)
args<<"mcopy"<<"-o"<<"-"<<(drive+floppyPath);
else
args<<"mcopy"<<"-s"<<"-"<<(drive+floppyPath);
......
......@@ -49,9 +49,9 @@ class FloppyProtocol : public KIO::SlaveBase
virtual void stat( const KUrl & url);
virtual void mkdir( const KUrl& url, int);
virtual void del( const KUrl& url, bool isfile);
virtual void rename(const KUrl &src, const KUrl &dest, bool overwrite);
virtual void rename(const KUrl &src, const KUrl &dest, KIO::JobFlags _flags);
virtual void get( const KUrl& url );
virtual void put( const KUrl& url, int _mode,bool overwrite, bool _resume );
virtual void put( const KUrl& url, int _mode, KIO::JobFlags _flags );
//virtual void copy( const KUrl& src, const KUrl &dest, int, bool overwrite );
protected:
Program *m_mtool;
......
......@@ -93,7 +93,7 @@ bool KManPart::openFile()
url.setProtocol( "man" );
url.setPath( localFilePath() );
m_job = KIO::get( url, true, false );
m_job = KIO::get( url, KIO::NoReload, KIO::HideProgressInfo );
connect( m_job, SIGNAL( data( KIO::Job *, const QByteArray &) ), SLOT( readData( KIO::Job *, const QByteArray &) ) );
connect( m_job, SIGNAL( result(KJob*) ), SLOT( jobDone(KJob*) ) );
return true;
......
......@@ -88,7 +88,7 @@ bool MediaProtocol::rewriteUrl(const KUrl &url, KUrl &newUrl)
}
void MediaProtocol::put(const KUrl &url, int permissions,
bool overwrite, bool resume)
KIO::JobFlags flags)
{
kDebug(1219) << "MediaProtocol::put: " << url;
......@@ -101,14 +101,14 @@ void MediaProtocol::put(const KUrl &url, int permissions,
}
else
{
ForwardingSlaveBase::put(url, permissions, overwrite, resume);
ForwardingSlaveBase::put(url, permissions, flags);
}
}
void MediaProtocol::rename(const KUrl &src, const KUrl &dest, bool overwrite)
void MediaProtocol::rename(const KUrl &src, const KUrl &dest, KIO::JobFlags flags)
{
kDebug(1219) << "MediaProtocol::rename: " << src << ", " << dest << ", "
<< overwrite << endl;
<< (flags & KIO::Overwrite) << endl;
QString src_name, src_path;
bool ok = m_impl.parseURL(src, src_name, src_path);
......@@ -129,7 +129,7 @@ void MediaProtocol::rename(const KUrl &src, const KUrl &dest, bool overwrite)
}
else
{
ForwardingSlaveBase::rename(src, dest, overwrite);
ForwardingSlaveBase::rename(src, dest, flags);
}
}
......
......@@ -35,8 +35,8 @@ public:
virtual bool rewriteUrl(const KUrl &url, KUrl &newUrl);
virtual void put(const KUrl &url, int permissions,
bool overwrite, bool resume);
virtual void rename(const KUrl &src, const KUrl &dest, bool overwrite);
KIO::JobFlags flags);
virtual void rename(const KUrl &src, const KUrl &dest, KIO::JobFlags flags);
virtual void mkdir(const KUrl &url, int permissions);
virtual void del(const KUrl &url, bool isFile);
virtual void stat(const KUrl &url);
......
......@@ -302,7 +302,7 @@ void MediaImpl::extractUrlInfos(const KUrl &url, KIO::UDSEntry& infos)
{
m_entryBuffer.clear();
KIO::StatJob *job = KIO::stat(url, false);
KIO::StatJob *job = KIO::stat(url, KIO::HideProgressInfo);
job->uiDelegate()->setAutoWarningHandlingEnabled( false );
connect( job, SIGNAL( result(KJob*) ),
this, SLOT( slotStatResult(KJob*) ) );
......
......@@ -103,7 +103,7 @@ void MediaNotifier::onMediumChange( const QString &name, bool allowNotification
KUrl url( "system:/media/"+name );
KIO::SimpleJob *job = KIO::stat( url, false );
KIO::SimpleJob *job = KIO::stat( url, KIO::HideProgressInfo );
job->setUiDelegate(0);
m_allowNotificationMap[job] = allowNotification;
......
......@@ -1157,7 +1157,7 @@ void NFSProtocol::get( const KUrl& url )
}
//TODO the partial putting thing is not yet implemented
void NFSProtocol::put( const KUrl& url, int _mode, bool _overwrite, bool /*_resume*/ )
void NFSProtocol::put( const KUrl& url, int _mode, KIO::JobFlags flags )
{
QString destPath( QFile::encodeName(url.path()));
kDebug( 7121 ) << "Put -" << destPath <<"-";
......@@ -1178,7 +1178,7 @@ void NFSProtocol::put( const KUrl& url, int _mode, bool _overwrite, bool /*_resu
kDebug(7121)<<"file handle for -"<<destPath<<"- is "<<destFH;
//the file exists and we don't want to overwrite
if ((!_overwrite) && (!destFH.isInvalid()))
if ((!(flags & KIO::Overwrite)) && (!destFH.isInvalid()))
{
error(ERR_FILE_ALREADY_EXIST,destPath);
return;
......@@ -1283,7 +1283,7 @@ void NFSProtocol::put( const KUrl& url, int _mode, bool _overwrite, bool /*_resu
finished();
}
void NFSProtocol::rename( const KUrl &src, const KUrl &dest, bool _overwrite )
void NFSProtocol::rename( const KUrl &src, const KUrl &dest, KIO::JobFlags _flags )
{
QString srcPath( QFile::encodeName(src.path()));
QString destPath( QFile::encodeName(dest.path()));
......@@ -1297,7 +1297,7 @@ void NFSProtocol::rename( const KUrl &src, const KUrl &dest, bool _overwrite )
return;
}
if (!_overwrite)
if (!(_flags & KIO::Overwrite))
{
NFSFileHandle testFH;
testFH=getFileHandle(destPath);
......@@ -1341,7 +1341,7 @@ void NFSProtocol::rename( const KUrl &src, const KUrl &dest, bool _overwrite )
finished();
}
void NFSProtocol::copy( const KUrl &src, const KUrl &dest, int _mode, bool _overwrite )
void NFSProtocol::copy( const KUrl &src, const KUrl &dest, int _mode, KIO::JobFlags _flags )
{
//prepare the source
QString thePath( QFile::encodeName(src.path()));
......@@ -1369,7 +1369,7 @@ void NFSProtocol::copy( const KUrl &src, const KUrl &dest, int _mode, bool _over
kDebug(7121)<<"file handle for -"<<destPath<<"- is "<<destFH;
//the file exists and we don't want to overwrite
if ((!_overwrite) && (!destFH.isInvalid()))
if ((!(_flags & KIO::Overwrite)) && (!destFH.isInvalid()))
{
error(ERR_FILE_ALREADY_EXIST,destPath);
return;
......@@ -1464,7 +1464,7 @@ void NFSProtocol::copy( const KUrl &src, const KUrl &dest, int _mode, bool _over
}
//TODO why isn't this even called ?
void NFSProtocol::symlink( const QString &target, const KUrl &dest, bool )
void NFSProtocol::symlink( const QString &target, const KUrl &dest, KIO::JobFlags )
{
kDebug(7121)<<"symlinking ";
QString destPath=dest.path();
......
......@@ -69,16 +69,16 @@ class NFSProtocol : public KIO::SlaveBase
virtual void setHost( const QString& host, quint16 port, const QString& user, const QString& pass );
virtual void put( const KUrl& url, int _mode,bool _overwrite, bool _resume );
virtual void put( const KUrl& url, int _mode, KIO::JobFlags _flags );
virtual void get( const KUrl& url );
virtual void listDir( const KUrl& url);
virtual void symlink( const QString &target, const KUrl &dest, bool );
virtual void symlink( const QString &target, const KUrl &dest, KIO::JobFlags );
virtual void stat( const KUrl & url);
virtual void mkdir( const KUrl& url, int permissions );
virtual void del( const KUrl& url, bool isfile);
virtual void chmod(const KUrl& url, int permissions );
virtual void rename(const KUrl &src, const KUrl &dest, bool overwrite);
virtual void copy( const KUrl& src, const KUrl &dest, int mode, bool overwrite );
virtual void rename(const KUrl &src, const KUrl &dest, KIO::JobFlags flags);
virtual void copy( const KUrl& src, const KUrl &dest, int mode, KIO::JobFlags flags );
protected:
// void createVirtualDirEntry(KIO::UDSEntry & entry);
bool checkForError(int clientStat, int nfsStat, const QString& text);
......
......@@ -211,7 +211,7 @@ void RemoteProtocol::get(const KUrl &url)
}
void RemoteProtocol::rename(const KUrl &src, const KUrl &dest,
bool overwrite)
KIO::JobFlags flags)
{
if (src.protocol()!="remote" || dest.protocol()!="remote"
|| m_impl.isWizardURL(src) || m_impl.isWizardURL(dest))
......@@ -220,7 +220,7 @@ void RemoteProtocol::rename(const KUrl &src, const KUrl &dest,
return;
}
if (m_impl.renameFolders(src.fileName(), dest.fileName(), overwrite))
if (m_impl.renameFolders(src.fileName(), dest.fileName(), flags & KIO::Overwrite))
{
finished();
return;
......
......@@ -34,7 +34,7 @@ public:
virtual void stat(const KUrl &url);
virtual void del(const KUrl &url, bool isFile);
virtual void get(const KUrl &url);
virtual void rename(const KUrl &src, const KUrl &dest, bool overwrite);
virtual void rename(const KUrl &src, const KUrl &dest, KIO::JobFlags flags);
private:
void listRoot();
......
......@@ -187,7 +187,7 @@ bool sftpProtocol::isSupportedOperation(int type) {
return false;
}
void sftpProtocol::copy(const KUrl &src, const KUrl &dest, int permissions, bool overwrite)
void sftpProtocol::copy(const KUrl &src, const KUrl &dest, int permissions, KIO::JobFlags flags)
{
kDebug(KIO_SFTP_DB) << "copy(): " << src << " -> " << dest;
......@@ -195,14 +195,14 @@ void sftpProtocol::copy(const KUrl &src, const KUrl &dest, int permissions, bool
bool destLocal = dest.isLocalFile();
if ( srcLocal && !destLocal ) // Copy file -> sftp
sftpCopyPut(src, dest, permissions, overwrite);
sftpCopyPut(src, dest, permissions, flags);
else if ( destLocal && !srcLocal ) // Copy sftp -> file
sftpCopyGet(dest, src, permissions, overwrite);
sftpCopyGet(dest, src, permissions, flags);
else
error(ERR_UNSUPPORTED_ACTION, QString());
}
void sftpProtocol::sftpCopyGet(const KUrl& dest, const KUrl& src, int mode, bool overwrite)
void sftpProtocol::sftpCopyGet(const KUrl& dest, const KUrl& src, int mode, KIO::JobFlags flags)
{
kDebug(KIO_SFTP_DB) << "sftpCopyGet(): " << src << " -> " << dest;
......@@ -223,7 +223,7 @@ void sftpProtocol::sftpCopyGet(const KUrl& dest, const KUrl& src, int mode, bool
return;
}
if (!overwrite)
if (!(flags & KIO::Overwrite))
{
error(ERR_FILE_ALREADY_EXIST, dest.prettyUrl());
return;
......@@ -956,8 +956,7 @@ void sftpProtocol::closeConnection() {
mConnected = false;
}
void sftpProtocol::sftpCopyPut(const KUrl& src, const KUrl& dest, int permissions, bool overwrite) {
void sftpProtocol::sftpCopyPut(const KUrl& src, const KUrl& dest, int permissions, KIO::JobFlags flags) {
KDE_struct_stat buff;
QByteArray file (QFile::encodeName(src.path()));
......@@ -979,21 +978,21 @@ void sftpProtocol::sftpCopyPut(const KUrl& src, const KUrl& dest, int permission
totalSize (buff.st_size);
sftpPut (dest, permissions, false, overwrite, fd);
sftpPut (dest, permissions, (flags & ~KIO::Resume), fd);
// Close the file descriptor...
::close( fd );
}
void sftpProtocol::sftpPut( const KUrl& dest, int permissions, bool resume, bool overwrite, int fd ) {
void sftpProtocol::sftpPut( const KUrl& dest, int permissions, KIO::JobFlags flags, int fd ) {
openConnection();
if( !mConnected )
return;
kDebug(KIO_SFTP_DB) << "sftpPut(): " << dest
<< ", resume=" << resume
<< ", overwrite=" << overwrite << endl;
<< ", resume=" << (flags & KIO::Resume)
<< ", overwrite=" << (flags & KIO::Overwrite) << endl;
KUrl origUrl( dest );
sftpFileAttr origAttr(remoteEncoding());
......@@ -1023,7 +1022,7 @@ void sftpProtocol::sftpPut( const KUrl& dest, int permissions, bool resume, bool
// Do not waste time/resources with more remote stat calls if the file exists
// and we weren't instructed to overwrite it...
if( origExists && !overwrite ) {
if( origExists && !(flags & KIO::Overwrite) ) {
error(ERR_FILE_ALREADY_EXIST, origUrl.prettyUrl());
return;
}
......@@ -1063,16 +1062,16 @@ void sftpProtocol::sftpPut( const KUrl& dest, int permissions, bool resume, bool
offset = 0;
}
else if( !overwrite && !resume ) {
else if( !(flags & KIO::Overwrite) && !(flags & KIO::Resume) ) {
if (fd != -1)
resume = (KDE_lseek(fd, offset, SEEK_SET) != -1);
flags |= (KDE_lseek(fd, offset, SEEK_SET) != -1) ? KIO::Resume : KIO::DefaultFlags;
else
resume = canResume( offset );
flags |= canResume( offset ) ? KIO::Resume : KIO::DefaultFlags;
kDebug(KIO_SFTP_DB) << "sftpPut(): can resume = " << resume
kDebug(KIO_SFTP_DB) << "sftpPut(): can resume = " << (flags & KIO::Resume)
<< ", offset = " << offset;
if( !resume ) {
if( !(flags & KIO::Resume) ) {
error(ERR_FILE_ALREADY_EXIST, partUrl.prettyUrl());
return;
}
......@@ -1097,13 +1096,13 @@ void sftpProtocol::sftpPut( const KUrl& dest, int permissions, bool resume, bool
KUrl writeUrl (markPartial ? partUrl:origUrl);
quint32 pflags = 0;
if( overwrite && !resume )
if( (flags & KIO::Overwrite) && !(flags & KIO::Resume) )
pflags = SSH2_FXF_WRITE | SSH2_FXF_CREAT | SSH2_FXF_TRUNC;
else if( !overwrite && !resume )
else if( !(flags & KIO::Overwrite) && !(flags & KIO::Resume) )
pflags = SSH2_FXF_WRITE | SSH2_FXF_CREAT | SSH2_FXF_EXCL;
else if( overwrite && resume )
else if( (flags & KIO::Overwrite) && (flags & KIO::Resume) )
pflags = SSH2_FXF_WRITE | SSH2_FXF_CREAT;
else if( !overwrite && resume )
else if( !(flags & KIO::Overwrite) && (flags & KIO::Resume) )
pflags = SSH2_FXF_WRITE | SSH2_FXF_CREAT | SSH2_FXF_APPEND;
sftpFileAttr attr(remoteEncoding());
......@@ -1119,7 +1118,7 @@ void sftpProtocol::sftpPut( const KUrl& dest, int permissions, bool resume, bool
// Rename the file back to its original name if a
// put fails due to permissions problems...
if( markPartial && overwrite ) {
if( markPartial && (flags & KIO::Overwrite) ) {
(void) sftpRename(partUrl, origUrl);
writeUrl = origUrl;
}
......@@ -1208,11 +1207,11 @@ void sftpProtocol::sftpPut( const KUrl& dest, int permissions, bool resume, bool
finished();
}
void sftpProtocol::put ( const KUrl& url, int permissions, bool overwrite, bool resume ){
kDebug(KIO_SFTP_DB) << "put(): " << url << ", overwrite = " << overwrite
<< ", resume = " << resume << endl;
void sftpProtocol::put ( const KUrl& url, int permissions, KIO::JobFlags flags ) {
kDebug(KIO_SFTP_DB) << "put(): " << url << ", overwrite = " << (flags & KIO::Overwrite)
<< ", resume = " << (flags & KIO::Resume) << endl;
sftpPut( url, permissions, resume, overwrite );
sftpPut( url, permissions, flags );
}
void sftpProtocol::stat ( const KUrl& url ){
......@@ -1419,7 +1418,7 @@ void sftpProtocol::mkdir(const KUrl&url, int permissions){
finished();
}
void sftpProtocol::rename(const KUrl& src, const KUrl& dest, bool overwrite){
void sftpProtocol::rename(const KUrl& src, const KUrl& dest, KIO::JobFlags flags) {
kDebug(KIO_SFTP_DB) << "rename(" << src << " -> " << dest << ")";
if (!isSupportedOperation(SSH2_FXP_RENAME)) {
......@@ -1441,7 +1440,7 @@ void sftpProtocol::rename(const KUrl& src, const KUrl& dest, bool overwrite){
// so it the proper action can be presented to the user...
if( code == SSH2_FX_OK )
{
if (!overwrite)
if (!(flags & KIO::Overwrite))
{
if ( S_ISDIR(attr.permissions()) )
error( KIO::ERR_DIR_ALREADY_EXIST, dest.url() );
......@@ -1468,7 +1467,7 @@ void sftpProtocol::rename(const KUrl& src, const KUrl& dest, bool overwrite){
kDebug(KIO_SFTP_DB) << "rename(): END";
}
void sftpProtocol::symlink(const QString& target, const KUrl& dest, bool overwrite){
void sftpProtocol::symlink(const QString& target, const KUrl& dest, KIO::JobFlags flags) {
kDebug(KIO_SFTP_DB) << "symlink()";
if (!isSupportedOperation(SSH2_FXP_SYMLINK)) {
......@@ -1484,7 +1483,7 @@ void sftpProtocol::symlink(const QString& target, const KUrl& dest, bool overwri
int code;
bool failed = false;
if( (code = sftpSymLink(target, dest)) != SSH2_FX_OK ) {
if( overwrite ) { // try to delete the destination
if( flags & KIO::Overwrite ) { // try to delete the destination
sftpFileAttr attr(remoteEncoding());
if( (code = sftpStat(dest, attr)) != SSH2_FX_OK ) {
failed = true;
......
......@@ -43,14 +43,14 @@ public:
virtual void listDir(const KUrl& url) ;
virtual void mimetype(const KUrl& url);
virtual void stat(const KUrl& url);
virtual void copy(const KUrl &src, const KUrl &dest, int permissions, bool overwrite);
virtual void put(const KUrl& url, int permissions, bool overwrite, bool resume);
virtual void copy(const KUrl &src, const KUrl &dest, int permissions, KIO::JobFlags flags);
virtual void put(const KUrl& url, int permissions, KIO::JobFlags flags);
virtual void closeConnection();
virtual void slave_status();
virtual void del(const KUrl &url, bool isfile);
virtual void chmod(const KUrl& url, int permissions);
virtual void symlink(const QString& target, const KUrl& dest, bool overwrite);
virtual void rename(const KUrl& src, const KUrl& dest, bool overwrite);
virtual void symlink(const QString& target, const KUrl& dest, KIO::JobFlags flags);
virtual void rename(const KUrl& src, const KUrl& dest, KIO::JobFlags flags);
virtual void mkdir(const KUrl&url, int permissions);
virtual void openConnection();
......@@ -150,12 +150,12 @@ private: // private methods
int sftpWrite(const QByteArray& handle, KIO::filesize_t offset, const QByteArray& data);
/** Performs faster upload when the source is a local file... */
void sftpCopyPut(const KUrl& src, const KUrl& dest, int mode, bool overwrite);
void sftpCopyPut(const KUrl& src, const KUrl& dest, int mode, KIO::JobFlags flags);
/** Performs faster download when the destination is a local file... */
void sftpCopyGet(const KUrl& dest, const KUrl& src, int mode, bool overwrite);
void sftpCopyGet(const KUrl& dest, const KUrl& src, int mode, KIO::JobFlags flags);
/** */
Status sftpGet( const KUrl& src, KIO::filesize_t offset = 0, int fd = -1);
void sftpPut( const KUrl& dest, int permissions, bool resume, bool overwrite, int fd = -1);
void sftpPut( const KUrl& dest, int permissions, KIO::JobFlags flags, int fd = -1);
};
#endif
......@@ -245,14 +245,14 @@ public:
virtual void reparseConfiguration();
// Functions overwritten in kio_smb_dir.cpp
virtual void copy( const KUrl& src, const KUrl &dest, int permissions, bool overwrite );
virtual void copy( const KUrl& src, const KUrl &dest, int permissions, KIO::JobFlags flags );