void RemoteProtocol::listDir(const KUrl &url) { kDebug(1220) << "RemoteProtocol::listDir: " << url; if ( url.path().length() <= 1 ) { listRoot(); return; } int second_slash_idx = url.path().indexOf( '/', 1 ); const QString root_dirname = url.path().mid( 1, second_slash_idx-1 ); KUrl target = m_impl.findBaseURL( root_dirname ); kDebug(1220) << "possible redirection target : " << target; if( target.isValid() ) { if ( second_slash_idx < 0 ) { second_slash_idx = url.path().size(); } target.addPath( url.path().remove(0, second_slash_idx) ); kDebug(1220) << "complete redirection target : " << target; redirection(target); finished(); return; } error(KIO::ERR_MALFORMED_URL, url.prettyUrl()); }
void RemoteProtocol::listDir(const KURL &url) { kdDebug(1220) << "RemoteProtocol::listDir: " << url << endl; if(url.path().length() <= 1) { listRoot(); return; } int second_slash_idx = url.path().find('/', 1); QString root_dirname = url.path().mid(1, second_slash_idx - 1); KURL target = m_impl.findBaseURL(root_dirname); kdDebug(1220) << "possible redirection target : " << target << endl; if(target.isValid()) { target.addPath(url.path().remove(0, second_slash_idx)); redirection(target); finished(); return; } error(KIO::ERR_MALFORMED_URL, url.prettyURL()); }
void TrashProtocol::listDir(const KUrl& url) { INIT_IMPL; kDebug() << "listdir: " << url; if ( url.path(KUrl::AddTrailingSlash) == QLatin1String("/") ) { listRoot(); return; } int trashId; QString fileId; QString relativePath; bool ok = TrashImpl::parseURL( url, trashId, fileId, relativePath ); if ( !ok ) { error( KIO::ERR_SLAVE_DEFINED, i18n( "Malformed URL %1", url.prettyUrl() ) ); return; } //was: const QString physicalPath = impl.physicalPath( trashId, fileId, relativePath ); // Get info for deleted directory - the date of deletion and orig path will be used // for all the items in it, and we need the physicalPath. TrashedFileInfo info; ok = impl.infoForFile( trashId, fileId, info ); if ( !ok || info.physicalPath.isEmpty() ) { error( impl.lastErrorCode(), impl.lastErrorMessage() ); return; } if ( !relativePath.isEmpty() ) { info.physicalPath += QLatin1Char('/'); info.physicalPath += relativePath; } // List subdir. Can't use kio_file here since we provide our own info... kDebug() << "listing " << info.physicalPath; const QStringList entryNames = impl.listDir( info.physicalPath ); totalSize( entryNames.count() ); KIO::UDSEntry entry; for ( QStringList::const_iterator entryIt = entryNames.begin(), entryEnd = entryNames.end(); entryIt != entryEnd ; ++entryIt ) { const QString fileName = *entryIt; if (fileName == QLatin1String("..")) continue; const QString filePath = info.physicalPath + QLatin1Char('/') + fileName; // shouldn't be necessary //const QString url = TrashImpl::makeURL( trashId, fileId, relativePath + '/' + fileName ); entry.clear(); TrashedFileInfo infoForItem( info ); infoForItem.origPath += QLatin1Char('/'); infoForItem.origPath += fileName; if (createUDSEntry(filePath, fileName, fileName, entry, infoForItem)) { listEntry( entry, false ); } } entry.clear(); listEntry( entry, true ); finished(); }
void MediaProtocol::listDir(const KURL &url) { kdDebug(1219) << "MediaProtocol::listDir: " << url << endl; if ( url.path().length() <= 1 ) { listRoot(); return; } QString name, path; bool ok = m_impl.parseURL(url, name, path); if ( !ok ) { error(KIO::ERR_MALFORMED_URL, url.prettyURL()); return; } ForwardingSlaveBase::listDir(url); }
void TrashProtocol::listDir(const KURL &url) { INIT_IMPL; kdDebug() << "listdir: " << url << endl; if(url.path().length() <= 1) { listRoot(); return; } int trashId; QString fileId; QString relativePath; bool ok = TrashImpl::parseURL(url, trashId, fileId, relativePath); if(!ok) { error(KIO::ERR_SLAVE_DEFINED, i18n("Malformed URL %1").arg(url.prettyURL())); return; } // was: const QString physicalPath = impl.physicalPath( trashId, fileId, relativePath ); // Get info for deleted directory - the date of deletion and orig path will be used // for all the items in it, and we need the physicalPath. TrashedFileInfo info; ok = impl.infoForFile(trashId, fileId, info); if(!ok || info.physicalPath.isEmpty()) { error(impl.lastErrorCode(), impl.lastErrorMessage()); return; } if(!relativePath.isEmpty()) { info.physicalPath += "/"; info.physicalPath += relativePath; } // List subdir. Can't use kio_file here since we provide our own info... kdDebug() << k_funcinfo << "listing " << info.physicalPath << endl; QStrList entryNames = impl.listDir(info.physicalPath); totalSize(entryNames.count()); KIO::UDSEntry entry; QStrListIterator entryIt(entryNames); for(; entryIt.current(); ++entryIt) { QString fileName = QFile::decodeName(entryIt.current()); if(fileName == "..") continue; const QString filePath = info.physicalPath + "/" + fileName; // shouldn't be necessary // const QString url = TrashImpl::makeURL( trashId, fileId, relativePath + "/" + fileName ); entry.clear(); TrashedFileInfo infoForItem(info); infoForItem.origPath += '/'; infoForItem.origPath += fileName; if(ok && createUDSEntry(filePath, fileName, QString::null /*url*/, entry, infoForItem)) { listEntry(entry, false); } } entry.clear(); listEntry(entry, true); finished(); }