UI: Add ability to "Open Folder" of selected app.

This commit is contained in:
Nodir Temirkhodjaev 2019-04-22 15:06:43 +05:00
parent d766d0084a
commit 65991e7fe3
8 changed files with 43 additions and 4 deletions

View File

@ -18,6 +18,7 @@
<file>images/cross.png</file>
<file>images/cut.png</file>
<file>images/database_save.png</file>
<file>images/folder_go.png</file>
<file>images/link.png</file>
<file>images/page_copy.png</file>
<file>images/page_paste.png</file>

View File

@ -35,6 +35,7 @@
<file>qml/pages/apps/AppsColumn.qml</file>
<file>qml/pages/apps/AppsTextColumn.qml</file>
<file>qml/pages/apps/GroupOptionsButton.qml</file>
<file>qml/pages/log/AppInfoRow.qml</file>
<file>qml/pages/log/AppListView.qml</file>
<file>qml/pages/log/GraphButton.qml</file>
<file>qml/pages/log/IpListView.qml</file>

BIN
src/ui/images/folder_go.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 B

View File

@ -144,9 +144,9 @@ BasePage {
}
}
TextFieldFrame {
AppInfoRow {
Layout.fillWidth: true
text: currentAppPath || ""
appPath: currentAppPath
}
}
}

View File

@ -264,9 +264,9 @@ BasePage {
}
}
TextFieldFrame {
AppInfoRow {
Layout.fillWidth: true
text: currentAppPath || ""
appPath: currentAppPath
}
}
}

View File

@ -0,0 +1,24 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "../../controls"
import com.fortfirewall 1.0
RowLayout {
visible: !!appPath
property string appPath
TextFieldFrame {
Layout.fillWidth: true
text: appPath
}
RoundButtonTip {
icon.source: "qrc:/images/folder_go.png"
tipText: translationManager.trTrigger
&& qsTranslate("qml", "Open Folder")
onClicked: osUtil.openFolder(appPath)
}
}

View File

@ -1,5 +1,8 @@
#include "osutil.h"
#include <QDir>
#include <QProcess>
#define WIN32_LEAN_AND_MEAN
#include <qt_windows.h>
@ -16,6 +19,14 @@ QString OsUtil::pidToPath(quint32 pid, bool isKernelPath)
return pi.path(isKernelPath);
}
void OsUtil::openFolder(const QString &filePath)
{
const QString nativePath = QDir::toNativeSeparators(filePath);
QProcess::execute(QString("explorer.exe /select,%1")
.arg(nativePath));
}
bool OsUtil::createGlobalMutex(const char *name)
{
return CreateMutexA(nullptr, FALSE, name)

View File

@ -12,6 +12,8 @@ public:
Q_INVOKABLE static QString pidToPath(quint32 pid, bool isKernelPath = false);
Q_INVOKABLE static void openFolder(const QString &filePath);
static bool createGlobalMutex(const char *name);
static quint32 lastErrorCode();