From db018055635958bc0abf09324a97af4912ad9f0f Mon Sep 17 00:00:00 2001 From: reionwong Date: Thu, 29 Jul 2021 03:44:29 +0800 Subject: [PATCH] Binary executable --- model/foldermodel.cpp | 18 ++++++++++++++++++ qml/FolderPage.qml | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/model/foldermodel.cpp b/model/foldermodel.cpp index 895ca4c..94486b2 100644 --- a/model/foldermodel.cpp +++ b/model/foldermodel.cpp @@ -716,6 +716,24 @@ void FolderModel::openSelected() for (const QUrl &url : urls) { KFileItem item(url); + QString mimeType = item.mimetype(); + + // runnable + if (mimeType == "application/x-executable" || + mimeType == "application/x-sharedlib" || + mimeType == "application/x-iso9660-appimage" || + mimeType == "application/vnd.appimage") { + QFileInfo fileInfo(url.toLocalFile()); + if (!fileInfo.isExecutable()) { + QFile file(url.toLocalFile()); + file.setPermissions(file.permissions() | QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther); + } + + FileLauncher::self()->launchExecutable(url.toLocalFile()); + + continue; + } + QString defaultAppDesktopFile = m_mimeAppManager->getDefaultAppByMimeType(item.currentMimeType()); // If no default application is found, diff --git a/qml/FolderPage.qml b/qml/FolderPage.qml index 3e1382d..c6da573 100644 --- a/qml/FolderPage.qml +++ b/qml/FolderPage.qml @@ -179,7 +179,7 @@ Item { } Item { - visible: settings.viewMethod === 0 + visible: true height: statusBarHeight } }