|
|
|
@ -2355,25 +2355,24 @@ void KDirLister::handleError( TDEIO::Job *job )
|
|
|
|
|
|
|
|
|
|
void KDirLister::addNewItem( const KFileItem *item )
|
|
|
|
|
{
|
|
|
|
|
if ( ( d->dirOnlyMode && !item->isDir() ) || !matchesFilter( item ) ) {
|
|
|
|
|
return; // No reason to continue... bailing out here prevents a mimetype scan.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((item->url().internalReferenceURL() != "")
|
|
|
|
|
&& (d->m_referenceURLMap.contains(item->url().internalReferenceURL()))) {
|
|
|
|
|
TQString refURL = item->url().internalReferenceURL();
|
|
|
|
|
if (!refURL.isEmpty() && d->m_referenceURLMap.contains(refURL) &&
|
|
|
|
|
item->url().path().startsWith(d->m_referenceURLMap[refURL]))
|
|
|
|
|
{
|
|
|
|
|
// Likely a media:/ tdeioslave URL or similar
|
|
|
|
|
// Rewrite the URL to ensure that the user remains within the media:/ tree!
|
|
|
|
|
TQString itemPath = item->url().path();
|
|
|
|
|
if (itemPath.startsWith(d->m_referenceURLMap[item->url().internalReferenceURL()])) {
|
|
|
|
|
itemPath = itemPath.remove(0, d->m_referenceURLMap[item->url().internalReferenceURL()].length());
|
|
|
|
|
TQString newPath = item->url().internalReferenceURL();
|
|
|
|
|
if (!newPath.endsWith("/")) newPath = newPath + "/";
|
|
|
|
|
while (itemPath.startsWith("/")) itemPath = itemPath.remove(0,1);
|
|
|
|
|
while (itemPath.endsWith("/")) itemPath.truncate(itemPath.length()-1);
|
|
|
|
|
newPath = newPath + itemPath;
|
|
|
|
|
const_cast<KFileItem*>(item)->setListerURL(item->url());
|
|
|
|
|
const_cast<KFileItem*>(item)->setURL(newPath);
|
|
|
|
|
if (!refURL.endsWith("/"))
|
|
|
|
|
{
|
|
|
|
|
refURL.append("/");
|
|
|
|
|
}
|
|
|
|
|
KURL newItemURL(refURL);
|
|
|
|
|
newItemURL.addPath(item->url().fileName());
|
|
|
|
|
const_cast<KFileItem*>(item)->setListerURL(newItemURL);
|
|
|
|
|
const_cast<KFileItem*>(item)->setURL(newItemURL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( ( d->dirOnlyMode && !item->isDir() ) || !matchesFilter( item ) ) {
|
|
|
|
|
return; // No reason to continue... bailing out here prevents a mimetype scan.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( matchesMimeFilter( item ) )
|
|
|
|
@ -2420,21 +2419,20 @@ void KDirLister::addRefreshItem( const KFileItem *item )
|
|
|
|
|
{
|
|
|
|
|
bool isExcluded = (d->dirOnlyMode && !item->isDir()) || !matchesFilter( item );
|
|
|
|
|
|
|
|
|
|
if ((item->url().internalReferenceURL() != "")
|
|
|
|
|
&& (d->m_referenceURLMap.contains(item->url().internalReferenceURL()))) {
|
|
|
|
|
TQString refURL = item->url().internalReferenceURL();
|
|
|
|
|
if (!refURL.isEmpty() && d->m_referenceURLMap.contains(refURL) &&
|
|
|
|
|
item->url().path().startsWith(d->m_referenceURLMap[refURL]))
|
|
|
|
|
{
|
|
|
|
|
// Likely a media:/ tdeioslave URL or similar
|
|
|
|
|
// Rewrite the URL to ensure that the user remains within the media:/ tree!
|
|
|
|
|
TQString itemPath = item->url().path();
|
|
|
|
|
if (itemPath.startsWith(d->m_referenceURLMap[item->url().internalReferenceURL()])) {
|
|
|
|
|
itemPath = itemPath.remove(0, d->m_referenceURLMap[item->url().internalReferenceURL()].length());
|
|
|
|
|
TQString newPath = item->url().internalReferenceURL();
|
|
|
|
|
if (!newPath.endsWith("/")) newPath = newPath + "/";
|
|
|
|
|
while (itemPath.startsWith("/")) itemPath = itemPath.remove(0,1);
|
|
|
|
|
while (itemPath.endsWith("/")) itemPath.truncate(itemPath.length()-1);
|
|
|
|
|
newPath = newPath + itemPath;
|
|
|
|
|
const_cast<KFileItem*>(item)->setListerURL(item->url());
|
|
|
|
|
const_cast<KFileItem*>(item)->setURL(newPath);
|
|
|
|
|
if (!refURL.endsWith("/"))
|
|
|
|
|
{
|
|
|
|
|
refURL.append("/");
|
|
|
|
|
}
|
|
|
|
|
KURL newItemURL(refURL);
|
|
|
|
|
newItemURL.addPath(item->url().fileName());
|
|
|
|
|
const_cast<KFileItem*>(item)->setListerURL(newItemURL);
|
|
|
|
|
const_cast<KFileItem*>(item)->setURL(newItemURL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !isExcluded && matchesMimeFilter( item ) )
|
|
|
|
@ -2658,25 +2656,24 @@ void KDirLister::connectJob( TDEIO::ListJob *job )
|
|
|
|
|
|
|
|
|
|
void KDirLister::emitCompleted( const KURL& _url )
|
|
|
|
|
{
|
|
|
|
|
KURL emitURL = _url;
|
|
|
|
|
|
|
|
|
|
if ((_url.internalReferenceURL() != "")
|
|
|
|
|
&& (d->m_referenceURLMap.contains(_url.internalReferenceURL()))) {
|
|
|
|
|
TQString refURL = _url.internalReferenceURL();
|
|
|
|
|
if (!refURL.isEmpty() && d->m_referenceURLMap.contains(refURL) &&
|
|
|
|
|
_url.path().startsWith(d->m_referenceURLMap[refURL]))
|
|
|
|
|
{
|
|
|
|
|
// Likely a media:/ tdeioslave URL or similar
|
|
|
|
|
// Rewrite the URL to ensure that the user remains within the media:/ tree!
|
|
|
|
|
TQString itemPath = _url.path();
|
|
|
|
|
if (itemPath.startsWith(d->m_referenceURLMap[_url.internalReferenceURL()])) {
|
|
|
|
|
itemPath = itemPath.remove(0, d->m_referenceURLMap[_url.internalReferenceURL()].length());
|
|
|
|
|
TQString newPath = _url.internalReferenceURL();
|
|
|
|
|
if (!newPath.endsWith("/")) newPath = newPath + "/";
|
|
|
|
|
while (itemPath.startsWith("/")) itemPath = itemPath.remove(0,1);
|
|
|
|
|
while (itemPath.endsWith("/")) itemPath.truncate(itemPath.length()-1);
|
|
|
|
|
newPath = newPath + itemPath;
|
|
|
|
|
emitURL = newPath;
|
|
|
|
|
if (!refURL.endsWith("/"))
|
|
|
|
|
{
|
|
|
|
|
refURL.append("/");
|
|
|
|
|
}
|
|
|
|
|
KURL newItemURL(refURL);
|
|
|
|
|
newItemURL.addPath(_url.fileName());
|
|
|
|
|
emit completed(newItemURL);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
emit completed(_url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit completed( emitURL );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KDirLister::setMainWindow( TQWidget *window )
|
|
|
|
|