kio: fix regression since e993c547

prior to e993c547 the address did not matter for local connections (a
temporary file was used for the socket) - now it does and if it is empty
the connection is not made at all, to fix this get the address from the
backend to support the old behaviour

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-10-28 17:19:20 +00:00
parent 5470c1b18c
commit 07cc8f1395

View file

@ -389,22 +389,22 @@ bool Connection::suspended() const
void Connection::connectToRemote(const QString &address)
{
//kDebug(7017) << "Connection requested to " << address;
KUrl url = address;
QString scheme = url.protocol();
/*
establish the server to get its address if address is empty
for compatibilty with local mode (which is no more, but it's
uses are still present)
*/
d->setBackend(new SocketConnectionBackend(this));
d->backend->listenForRemote();
if (scheme == QLatin1String("tcp")) {
d->setBackend(new SocketConnectionBackend(this));
} else {
kWarning(7017) << "Unknown requested KIO::Connection protocol='" << scheme
<< "' (" << address << ")";
Q_ASSERT(0);
return;
}
kDebug(7017) << "Connection requested to " << address;
KUrl url = address;
if (address.isEmpty() && d->backend)
url = d->backend->address;
// connection succeeded
if (!d->backend->connectToRemote(url)) {
//kWarning(7017) << "could not connect to " << url << "using scheme" << scheme ;
kWarning(7017) << "could not connect to " << url;
delete d->backend;
d->backend = 0;
return;