Commit 951e2f2d authored by Méven Car's avatar Méven Car
Browse files

filenamesearch: Implement stat to display metainfo

Summary:
filenamesearch ioslave needed a stat implementation to be rendered properly in dolphin information panel.

BUG: 420354
FIXED-IN: 20.08

Test Plan: Open filenamsearch:/ in dolphin and search something

Reviewers: #dolphin, #frameworks, ngraham, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: kde-frameworks-devel, kfm-devel

Tags: #dolphin, #frameworks

Differential Revision: https://phabricator.kde.org/D29197
parent 7c7590a2
add_library(kio_filenamesearch MODULE kio_filenamesearch.cpp)
target_link_libraries(kio_filenamesearch KF5::KIOCore KF5::DBusAddons Qt5::Network)
target_link_libraries(kio_filenamesearch KF5::KIOCore KF5::DBusAddons Qt5::Network KF5::KIOCore KF5::I18n)
set_target_properties(kio_filenamesearch PROPERTIES OUTPUT_NAME "filenamesearch")
install(TARGETS kio_filenamesearch DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio)
......
......@@ -30,6 +30,7 @@
#include <QUrl>
#include <QUrlQuery>
#include <QDBusInterface>
#include <KLocalizedString>
Q_LOGGING_CATEGORY(KIO_FILENAMESEARCH, "kio_filenamesearch")
......@@ -44,6 +45,28 @@ FileNameSearchProtocol::~FileNameSearchProtocol()
{
}
void FileNameSearchProtocol::stat(const QUrl& url)
{
KIO::UDSEntry uds;
uds.reserve(9);
uds.fastInsert(KIO::UDSEntry::UDS_ACCESS, 0700);
uds.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
uds.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("inode/directory"));
uds.fastInsert(KIO::UDSEntry::UDS_ICON_OVERLAY_NAMES, QStringLiteral("baloo"));
uds.fastInsert(KIO::UDSEntry::UDS_DISPLAY_TYPE, i18n("Search Folder"));
uds.fastInsert(KIO::UDSEntry::UDS_URL, url.url());
QUrlQuery query(url);
QString title = query.queryItemValue(QStringLiteral("title"), QUrl::FullyDecoded);
if (!title.isEmpty()) {
uds.fastInsert(KIO::UDSEntry::UDS_NAME, title);
uds.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME, title);
}
statEntry(uds);
finished();
}
void FileNameSearchProtocol::listDir(const QUrl &url)
{
const QUrlQuery urlQuery(url);
......
......@@ -46,6 +46,7 @@ public:
FileNameSearchProtocol(const QByteArray &pool, const QByteArray &app);
~FileNameSearchProtocol() override;
void stat(const QUrl& url) override;
void listDir(const QUrl &url) override;
private:
......
Markdown is supported
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