diff --git a/libsearch/file-utils.cpp b/libsearch/file-utils.cpp index 3221ad4..32e2e25 100644 --- a/libsearch/file-utils.cpp +++ b/libsearch/file-utils.cpp @@ -23,6 +23,8 @@ #include #include #include +#include +#include using namespace Zeeker; size_t FileUtils::_max_index_count = 0; @@ -773,8 +775,20 @@ void FileUtils::getTxtContent(QString &path, QString &textcontent) { int FileUtils::openFile(QString &path, bool openInDir) { if(openInDir) { - QDesktopServices::openUrl(QUrl::fromLocalFile(path.left(path.lastIndexOf("/")))); - return 0; + QStringList list; + list.append(path); + QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.FileManager1", + "/org/freedesktop/FileManager1", + "org.freedesktop.FileManager1", + "ShowItems"); + message.setArguments({list, "ukui-search"}); + QDBusMessage res = QDBusConnection::sessionBus().call(message); + if (QDBusMessage::ReplyMessage == res.ReplyMessage) { + return 0; + } else { + qDebug() << "Error! QDBusMessage reply error! ReplyMessage:" << res.ReplyMessage; + return -1; + } } else { auto file = wrapGFile(g_file_new_for_uri(QUrl::fromLocalFile(path).toString().toUtf8().constData())); auto fileInfo = wrapGFileInfo(g_file_query_info(file.get()->get(),