Commit f2db7b52 authored by Eugene Popov's avatar Eugene Popov 🇺🇦 Committed by Albert Astals Cid
Browse files

[WelcomeView] Improve locating a file in the file manager

Use KIO::highlightInFileManager to highlight a file in the file manager.
parent 51633ac0
Pipeline #241744 passed with stage
in 15 minutes and 7 seconds
......@@ -7,13 +7,12 @@
#include "welcomescreen.h"
#include <KConfigGroup>
#include <KIO/OpenFileManagerWindowJob>
#include <KIconLoader>
#include <KSharedConfig>
#include <QAction>
#include <QClipboard>
#include <QDesktopServices>
#include <QDir>
#include <QGraphicsOpacityEffect>
#include <QGuiApplication>
#include <QMenu>
......@@ -79,10 +78,7 @@ public:
showDirectoryAction->setIcon(QIcon::fromTheme(QStringLiteral("document-open-folder")));
connect(showDirectoryAction, &QAction::triggered, this, [item]() {
if (item->url.isLocalFile()) {
QFileInfo fileInfo(item->url.toLocalFile());
QDir parentDir = fileInfo.dir();
QUrl parentDirUrl = QUrl::fromLocalFile(parentDir.absolutePath());
QDesktopServices::openUrl(parentDirUrl);
KIO::highlightInFileManager({item->url});
}
});
menu.addAction(showDirectoryAction);
......
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