Commit 4e3ed5db authored by Jonathan Marten's avatar Jonathan Marten
Browse files

man: When listing, set UDS_DISPLAY_NAME formatted with section

Do not set it as UDS_NAME, see commit d27defbd.
parent d27defbd
Pipeline #183555 passed with stage
in 2 minutes and 35 seconds
......@@ -1366,15 +1366,21 @@ void MANProtocol::listDir(const QUrl &url)
{
// Remove any compression suffix present
QString name = stripCompression(page);
QString displayName;
// Remove any preceding pathname components, just leave the base name
int pos = name.lastIndexOf('/');
if (pos>0) name = name.mid(pos+1);
// Remove the section suffix
pos = name.lastIndexOf('.');
if (pos>0) name.truncate(pos);
if (pos>0)
{
displayName = name.left(pos)+" ("+name.mid(pos+1)+')';
name.truncate(pos);
}
uds_entry.clear();
uds_entry.fastInsert(KIO::UDSEntry::UDS_NAME, name);
if (!displayName.isEmpty()) uds_entry.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME, displayName);
uds_entry.fastInsert(KIO::UDSEntry::UDS_URL, ("man:" + page));
uds_entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);
uds_entry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("text/html"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment