mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-24 19:45:55 +00:00
SettingsInfo: open containing folder on wallet log path click
This commit is contained in:
parent
46227bdad0
commit
ba24fd79bb
3 changed files with 43 additions and 7 deletions
|
@ -132,14 +132,21 @@ Rectangle {
|
||||||
|
|
||||||
MoneroComponents.TextBlock {
|
MoneroComponents.TextBlock {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: 360
|
|
||||||
color: MoneroComponents.Style.dimmedFontColor
|
color: MoneroComponents.Style.dimmedFontColor
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
text: {
|
property string walletPath: (isIOS ? moneroAccountsDir : "") + appWindow.walletPath()
|
||||||
var wallet_path = walletPath();
|
text: "\
|
||||||
if(isIOS)
|
<style type='text/css'>\
|
||||||
wallet_path = moneroAccountsDir + wallet_path;
|
a {cursor:pointer;text-decoration: none; color: #FF6C3C}\
|
||||||
return wallet_path;
|
</style>\
|
||||||
|
<a href='#'>%1</a>".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
|
Layout.fillWidth: true
|
||||||
color: MoneroComponents.Style.dimmedFontColor
|
color: MoneroComponents.Style.dimmedFontColor
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
text: walletLogPath
|
text: "\
|
||||||
|
<style type='text/css'>\
|
||||||
|
a {cursor:pointer;text-decoration: none; color: #FF6C3C}\
|
||||||
|
</style>\
|
||||||
|
<a href='#'>%1</a>".arg(walletLogPath)
|
||||||
|
textFormat: Text.RichText
|
||||||
|
onLinkActivated: oshelper.openContainingFolder(walletLogPath)
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -30,7 +30,10 @@
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QUrl>
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include "qt/macoshelper.h"
|
#include "qt/macoshelper.h"
|
||||||
#endif
|
#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 OSHelper::temporaryFilename() const
|
||||||
{
|
{
|
||||||
QString tempFileName;
|
QString tempFileName;
|
||||||
|
|
|
@ -39,6 +39,7 @@ class OSHelper : public QObject
|
||||||
public:
|
public:
|
||||||
explicit OSHelper(QObject *parent = 0);
|
explicit OSHelper(QObject *parent = 0);
|
||||||
|
|
||||||
|
Q_INVOKABLE bool openContainingFolder(const QString &filePath) const;
|
||||||
Q_INVOKABLE QString temporaryFilename() const;
|
Q_INVOKABLE QString temporaryFilename() const;
|
||||||
Q_INVOKABLE QString temporaryPath() const;
|
Q_INVOKABLE QString temporaryPath() const;
|
||||||
Q_INVOKABLE bool removeTemporaryWallet(const QString &walletName) const;
|
Q_INVOKABLE bool removeTemporaryWallet(const QString &walletName) const;
|
||||||
|
|
Loading…
Reference in a new issue