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) void Connection::connectToRemote(const QString &address)
{ {
//kDebug(7017) << "Connection requested to " << address; /*
KUrl url = address; establish the server to get its address if address is empty
QString scheme = url.protocol(); 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")) { kDebug(7017) << "Connection requested to " << address;
d->setBackend(new SocketConnectionBackend(this)); KUrl url = address;
} else { if (address.isEmpty() && d->backend)
kWarning(7017) << "Unknown requested KIO::Connection protocol='" << scheme url = d->backend->address;
<< "' (" << address << ")";
Q_ASSERT(0);
return;
}
// connection succeeded // connection succeeded
if (!d->backend->connectToRemote(url)) { 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; delete d->backend;
d->backend = 0; d->backend = 0;
return; return;