diff --git a/pages/settings/SettingsInfo.qml b/pages/settings/SettingsInfo.qml index c7ca7dc0..3d5f779b 100644 --- a/pages/settings/SettingsInfo.qml +++ b/pages/settings/SettingsInfo.qml @@ -132,14 +132,21 @@ Rectangle { MoneroComponents.TextBlock { Layout.fillWidth: true - Layout.maximumWidth: 360 color: MoneroComponents.Style.dimmedFontColor font.pixelSize: 14 - text: { - var wallet_path = walletPath(); - if(isIOS) - wallet_path = moneroAccountsDir + wallet_path; - return wallet_path; + property string walletPath: (isIOS ? moneroAccountsDir : "") + appWindow.walletPath() + text: "\ + \ + %1".arg(walletPath) + textFormat: Text.RichText + onLinkActivated: oshelper.openContainingFolder(walletPath) + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor } } @@ -262,7 +269,19 @@ Rectangle { Layout.fillWidth: true color: MoneroComponents.Style.dimmedFontColor font.pixelSize: 14 - text: walletLogPath + text: "\ + \ + %1".arg(walletLogPath) + textFormat: Text.RichText + onLinkActivated: oshelper.openContainingFolder(walletLogPath) + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + } } Rectangle { diff --git a/src/main/oshelper.cpp b/src/main/oshelper.cpp index c1326c0f..313fd233 100644 --- a/src/main/oshelper.cpp +++ b/src/main/oshelper.cpp @@ -30,7 +30,10 @@ #include #include #include +#include +#include #include +#include #ifdef Q_OS_MAC #include "qt/macoshelper.h" #endif @@ -51,6 +54,19 @@ OSHelper::OSHelper(QObject *parent) : QObject(parent) } +bool OSHelper::openContainingFolder(const QString &filePath) const +{ + QUrl prepared; + prepared.setScheme("file"); + prepared.setPath(QFileInfo(filePath).absolutePath()); + if (!prepared.isValid()) + { + qWarning() << "malformed file path" << filePath << prepared.errorString(); + return false; + } + return QDesktopServices::openUrl(prepared); +} + QString OSHelper::temporaryFilename() const { QString tempFileName; diff --git a/src/main/oshelper.h b/src/main/oshelper.h index 4d378a9d..72f284af 100644 --- a/src/main/oshelper.h +++ b/src/main/oshelper.h @@ -39,6 +39,7 @@ class OSHelper : public QObject public: explicit OSHelper(QObject *parent = 0); + Q_INVOKABLE bool openContainingFolder(const QString &filePath) const; Q_INVOKABLE QString temporaryFilename() const; Q_INVOKABLE QString temporaryPath() const; Q_INVOKABLE bool removeTemporaryWallet(const QString &walletName) const;