mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
kio: implement listing of directory links for KIO::ListJob
tested with dolphin file search slave, more hammering will be done in the future for reference: https://ivailo-monev.atlassian.net/browse/KDE-20 Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
175aba2477
commit
1aa97c216a
4 changed files with 61 additions and 42 deletions
|
@ -1705,6 +1705,7 @@ public:
|
|||
QString m_displayPrefix;
|
||||
unsigned long m_processedEntries;
|
||||
KUrl m_redirectionURL;
|
||||
KUrl::List m_visited;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
@ -1778,7 +1779,7 @@ void ListJobPrivate::slotListEntries(const KIO::UDSEntryList &list)
|
|||
itemURL.addPath(fileName);
|
||||
}
|
||||
|
||||
if (entry.isDir() && !entry.isLink()) {
|
||||
if (entry.isDir()) {
|
||||
const QString filename = itemURL.fileName();
|
||||
QString displayName = entry.stringValue(KIO::UDSEntry::UDS_DISPLAY_NAME);
|
||||
if (displayName.isEmpty()) {
|
||||
|
@ -1786,6 +1787,22 @@ void ListJobPrivate::slotListEntries(const KIO::UDSEntryList &list)
|
|||
}
|
||||
// skip hidden dirs when listing if requested
|
||||
if (filename != ".." && filename != "." && (includeHidden || filename[0] != '.')) {
|
||||
bool listItem = true;
|
||||
if (entry.isLink()) {
|
||||
const KUrl linkDest(itemURL, entry.stringValue(KIO::UDSEntry::UDS_LINK_DEST));
|
||||
if (!m_visited.contains(linkDest.path())) {
|
||||
m_visited.append(linkDest);
|
||||
} else {
|
||||
// the link was already listed
|
||||
listItem = false;
|
||||
}
|
||||
}
|
||||
if (m_visited.contains(itemURL)) {
|
||||
// the directory was already listed
|
||||
listItem = false;
|
||||
}
|
||||
if (listItem) {
|
||||
m_visited.append(itemURL);
|
||||
ListJob *job = ListJobPrivate::newJobNoUi(
|
||||
itemURL,
|
||||
true /*recursive*/,
|
||||
|
@ -1793,6 +1810,7 @@ void ListJobPrivate::slotListEntries(const KIO::UDSEntryList &list)
|
|||
m_displayPrefix + displayName + '/',
|
||||
includeHidden
|
||||
);
|
||||
job->d_func()->m_visited = m_visited;
|
||||
q->connect(
|
||||
job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)),
|
||||
SLOT(gotEntries(KIO::Job*,KIO::UDSEntryList))
|
||||
|
@ -1802,6 +1820,7 @@ void ListJobPrivate::slotListEntries(const KIO::UDSEntryList &list)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Not recursive, or top-level of recursive listing : return now (send . and .. as well)
|
||||
// exclusion of hidden files also requires the full sweep, but the case for full-listing
|
||||
|
|
Loading…
Add table
Reference in a new issue