|
|
|
@ -1946,44 +1946,47 @@ bool KDirLister::openURL( const KURL& _url, bool _keep, bool _reload )
|
|
|
|
|
|
|
|
|
|
d->changes = NONE;
|
|
|
|
|
|
|
|
|
|
// Some ioslaves like media:/ or home:/ can provide a local url istead of a remote one
|
|
|
|
|
// If a local path is available, monitor that instead of the given remote URL...
|
|
|
|
|
if (!_url.isLocalFile()) {
|
|
|
|
|
TDEIO::LocalURLJob* localURLJob = TDEIO::localURL(_url);
|
|
|
|
|
if (localURLJob) {
|
|
|
|
|
d->openURL_url[localURLJob] = _url;
|
|
|
|
|
d->openURL_keep[localURLJob] = _keep;
|
|
|
|
|
d->openURL_reload[localURLJob] = _reload;
|
|
|
|
|
connect(localURLJob, TQ_SIGNAL(localURL(TDEIO::LocalURLJob*, const KURL&, bool)), this, TQ_SLOT(slotOpenURLGotLocalURL(TDEIO::LocalURLJob*, const KURL&, bool)));
|
|
|
|
|
connect(localURLJob, TQ_SIGNAL(destroyed()), this, TQ_SLOT(slotLocalURLKIODestroyed()));
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
TDEIO::LocalURLJob* localURLJob = TDEIO::localURL(_url);
|
|
|
|
|
if (localURLJob) {
|
|
|
|
|
d->openURLContext[localURLJob] = KDirListerPrivate::OpenURLContext{_url, _keep, _reload};
|
|
|
|
|
connect(localURLJob, TQ_SIGNAL(localURL(TDEIO::LocalURLJob*, const KURL&, bool)),
|
|
|
|
|
this, TQ_SLOT(slotOpenURLGotLocalURL(TDEIO::LocalURLJob*, const KURL&, bool)));
|
|
|
|
|
connect(localURLJob, TQ_SIGNAL(destroyed()), this, TQ_SLOT(slotLocalURLKIODestroyed()));
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return s_pCache->listDir( this, _url, _keep, _reload );
|
|
|
|
|
return s_pCache->listDir( this, _url, _keep, _reload );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KDirLister::slotOpenURLGotLocalURL(TDEIO::LocalURLJob *job, const KURL& url, bool isLocal) {
|
|
|
|
|
KURL realURL = d->openURL_url[job];
|
|
|
|
|
auto jobIt = d->openURLContext.find(job);
|
|
|
|
|
|
|
|
|
|
Q_ASSERT( jobIt != d->openURLContext.end() );
|
|
|
|
|
|
|
|
|
|
auto ctx = jobIt.data();
|
|
|
|
|
KURL realURL = ctx.url;
|
|
|
|
|
if (isLocal) {
|
|
|
|
|
realURL = url;
|
|
|
|
|
realURL.setInternalReferenceURL(d->openURL_url[job].url());
|
|
|
|
|
d->m_referenceURLMap[d->openURL_url[job].url()] = url.path();
|
|
|
|
|
realURL = url;
|
|
|
|
|
realURL.setInternalReferenceURL(ctx.url.url());
|
|
|
|
|
d->m_referenceURLMap[ctx.url.url()] = url.path();
|
|
|
|
|
}
|
|
|
|
|
s_pCache->listDir( this, realURL, d->openURL_keep[job], d->openURL_reload[job] );
|
|
|
|
|
d->openURL_url.remove(job);
|
|
|
|
|
d->openURL_keep.remove(job);
|
|
|
|
|
d->openURL_reload.remove(job);
|
|
|
|
|
d->openURLContext.remove(jobIt);
|
|
|
|
|
s_pCache->listDir( this, realURL, ctx.keep, ctx.reload );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KDirLister::slotLocalURLKIODestroyed() {
|
|
|
|
|
TDEIO::LocalURLJob* terminatedJob = const_cast<TDEIO::LocalURLJob*>(static_cast<const TDEIO::LocalURLJob*>(sender()));
|
|
|
|
|
TDEIO::Job* terminatedJob = const_cast<TDEIO::Job*>(static_cast<const TDEIO::Job*>(sender()));
|
|
|
|
|
auto jobIt = d->openURLContext.find(terminatedJob);
|
|
|
|
|
|
|
|
|
|
if (d->openURL_url.contains(terminatedJob)) {
|
|
|
|
|
s_pCache->listDir( this, d->openURL_url[terminatedJob], d->openURL_keep[terminatedJob], d->openURL_reload[terminatedJob] );
|
|
|
|
|
d->openURL_url.remove(terminatedJob);
|
|
|
|
|
d->openURL_keep.remove(terminatedJob);
|
|
|
|
|
d->openURL_reload.remove(terminatedJob);
|
|
|
|
|
if (jobIt != d->openURLContext.end()) {
|
|
|
|
|
auto ctx = jobIt.data();
|
|
|
|
|
d->openURLContext.remove(jobIt);
|
|
|
|
|
s_pCache->listDir( this, ctx.url, ctx.keep, ctx.reload );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|