mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kioslave: return KIO::ERR_DOES_NOT_EXIST as error when the specified URL does not exist
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f5e1f7f166
commit
ee110b2d91
5 changed files with 10 additions and 34 deletions
|
@ -1,8 +1,7 @@
|
|||
project(kio_network)
|
||||
|
||||
set(kio_network_SRCS
|
||||
networkslave.cpp
|
||||
main.cpp
|
||||
networkslave.cpp
|
||||
)
|
||||
|
||||
add_executable(kio_network ${kio_network_SRCS})
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
This file is part of the network kioslave, part of the KDE project.
|
||||
|
||||
Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "networkslave.h"
|
||||
|
||||
|
||||
|
||||
|
|
@ -141,6 +141,12 @@ void NetworkSlave::listDir(const KUrl &url)
|
|||
error(KIO::ERR_UNSUPPORTED_ACTION, url.prettyUrl());
|
||||
return;
|
||||
}
|
||||
// this slave has only one directory - the root directory
|
||||
const QString urlpath = url.path();
|
||||
if (!urlpath.isEmpty() && urlpath != QLatin1String("/")) {
|
||||
error(KIO::ERR_DOES_NOT_EXIST, url.prettyUrl());
|
||||
return;
|
||||
}
|
||||
if (!m_kdnssd) {
|
||||
m_kdnssd = new KDNSSD();
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ void RemoteProtocol::listDir(const KUrl &url)
|
|||
return;
|
||||
}
|
||||
|
||||
error(KIO::ERR_MALFORMED_URL, url.prettyUrl());
|
||||
error(KIO::ERR_DOES_NOT_EXIST, url.prettyUrl());
|
||||
}
|
||||
|
||||
void RemoteProtocol::listRoot()
|
||||
|
@ -175,7 +175,7 @@ void RemoteProtocol::stat(const KUrl &url)
|
|||
}
|
||||
}
|
||||
|
||||
error(KIO::ERR_MALFORMED_URL, url.prettyUrl());
|
||||
error(KIO::ERR_DOES_NOT_EXIST, url.prettyUrl());
|
||||
}
|
||||
|
||||
void RemoteProtocol::del(const KUrl &url, bool /*isFile*/)
|
||||
|
@ -209,7 +209,7 @@ void RemoteProtocol::get(const KUrl &url)
|
|||
return;
|
||||
}
|
||||
|
||||
error(KIO::ERR_MALFORMED_URL, url.prettyUrl());
|
||||
error(KIO::ERR_DOES_NOT_EXIST, url.prettyUrl());
|
||||
}
|
||||
|
||||
void RemoteProtocol::rename(const KUrl &src, const KUrl &dest,
|
||||
|
|
|
@ -256,12 +256,10 @@ void TrashProtocol::stat(const KUrl& url)
|
|||
bool ok = TrashImpl::parseURL( url, trashId, fileId, relativePath );
|
||||
|
||||
if ( !ok ) {
|
||||
// ######## do we still need this?
|
||||
kDebug() << url << " looks fishy, returning does-not-exist";
|
||||
// A URL like trash:/file simply means that CopyJob is trying to see if
|
||||
// the destination exists already (it made up the URL by itself).
|
||||
error( KIO::ERR_DOES_NOT_EXIST, url.prettyUrl() );
|
||||
//error( KIO::ERR_SLAVE_DEFINED, i18n( "Malformed URL %1" ).arg( url.prettyUrl() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue