aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-04-28 15:16:57 -0500
committerluigi1111 <luigi1111w@gmail.com>2020-04-28 15:16:57 -0500
commit1b7844ec345033b7809ef69ad941bd8a4a3986fb (patch)
treea3f1646f51bc47502f1ee764add39bad9f57f0d0
parent8f63e8870f6ef859f3f1500653a028aca2278274 (diff)
parenta99eef68f5e621f78df3b8f54e0b44a6178437f5 (diff)
downloadmonzero-gui-1b7844ec345033b7809ef69ad941bd8a4a3986fb.tar.gz
monzero-gui-1b7844ec345033b7809ef69ad941bd8a4a3986fb.tar.xz
monzero-gui-1b7844ec345033b7809ef69ad941bd8a4a3986fb.zip
Merge pull request #2854
a99eef6 always use native directory separators in paths (xiphon)
-rw-r--r--js/Wizard.js5
-rw-r--r--main.qml9
-rw-r--r--pages/settings/SettingsInfo.qml10
-rw-r--r--src/libwalletqt/Wallet.cpp2
-rw-r--r--src/main/main.cpp3
-rw-r--r--src/qt/KeysFiles.cpp22
-rw-r--r--src/qt/KeysFiles.h7
-rw-r--r--wizard/WizardController.qml2
-rw-r--r--wizard/WizardOpenWallet1.qml15
-rw-r--r--wizard/WizardWalletInput.qml2
10 files changed, 35 insertions, 42 deletions
diff --git a/js/Wizard.js b/js/Wizard.js
index a41864d4..a3d892cb 100644
--- a/js/Wizard.js
+++ b/js/Wizard.js
@@ -58,11 +58,6 @@ function switchPage(next) {
}
function createWalletPath(isIOS, folder_path,account_name){
- // Remove trailing slash - (default on windows and mac)
- if (folder_path.substring(folder_path.length -1) === "/"){
- folder_path = folder_path.substring(0,folder_path.length -1)
- }
-
// Store releative path on ios.
if(isIOS)
folder_path = "";
diff --git a/main.qml b/main.qml
index 841dcb22..7db130f5 100644
--- a/main.qml
+++ b/main.qml
@@ -215,7 +215,7 @@ ApplicationWindow {
appWindow.viewState = prevState;
}
};
- passwordDialog.open(usefulName(walletPath()));
+ passwordDialog.open(usefulName(persistentSettings.wallet_path));
}
function initialize() {
@@ -254,7 +254,7 @@ ApplicationWindow {
simpleModeConnectionTimer.running = true;
// wallet already opened with wizard, we just need to initialize it
- var wallet_path = walletPath();
+ var wallet_path = persistentSettings.wallet_path;
if(isIOS)
wallet_path = moneroAccountsDir + wallet_path;
// console.log("opening wallet at: ", wallet_path, "with password: ", appWindow.walletPassword);
@@ -393,11 +393,6 @@ ApplicationWindow {
return !persistentSettings.useRemoteNode || persistentSettings.is_trusted_daemon;
}
- function walletPath() {
- var wallet_path = persistentSettings.wallet_path
- return wallet_path;
- }
-
function usefulName(path) {
// arbitrary "short enough" limit
if (path.length < 32)
diff --git a/pages/settings/SettingsInfo.qml b/pages/settings/SettingsInfo.qml
index 84d066e7..861f0d39 100644
--- a/pages/settings/SettingsInfo.qml
+++ b/pages/settings/SettingsInfo.qml
@@ -131,10 +131,11 @@ Rectangle {
}
MoneroComponents.TextBlock {
+ id: walletLocation
Layout.fillWidth: true
color: MoneroComponents.Style.dimmedFontColor
font.pixelSize: 14
- property string walletPath: (isIOS ? moneroAccountsDir : "") + appWindow.walletPath()
+ property string walletPath: (isIOS ? moneroAccountsDir : "") + persistentSettings.wallet_path
text: "\
<style type='text/css'>\
a {cursor:pointer;text-decoration: none; color: #FF6C3C}\
@@ -389,12 +390,7 @@ Rectangle {
var data = "";
data += "GUI version: " + Version.GUI_VERSION + " (Qt " + qtRuntimeVersion + ")";
data += "\nEmbedded Monero version: " + Version.GUI_MONERO_VERSION;
- data += "\nWallet path: ";
-
- var wallet_path = walletPath();
- if(isIOS)
- wallet_path = moneroAccountsDir + wallet_path;
- data += wallet_path;
+ data += "\nWallet path: " + walletLocation.walletPath;
data += "\nWallet creation height: ";
if(currentWallet)
diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp
index c3f7cb97..8eacb113 100644
--- a/src/libwalletqt/Wallet.cpp
+++ b/src/libwalletqt/Wallet.cpp
@@ -227,7 +227,7 @@ QString Wallet::address(quint32 accountIndex, quint32 addressIndex) const
QString Wallet::path() const
{
- return QString::fromStdString(m_walletImpl->path());
+ return QDir::toNativeSeparators(QString::fromStdString(m_walletImpl->path()));
}
bool Wallet::store(const QString &path)
diff --git a/src/main/main.cpp b/src/main/main.cpp
index 2a64abdd..9de20ce4 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -210,6 +210,7 @@ int main(int argc, char *argv[])
qCritical() << "Error: accounts root directory could not be set";
return 1;
}
+ moneroAccountsDir = QDir::toNativeSeparators(moneroAccountsDir);
#if defined(Q_OS_LINUX)
if (isDesktop) app.setWindowIcon(QIcon(":/images/appicon.ico"));
@@ -241,7 +242,7 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
Monero::Utils::onStartup();
// Log settings
- const QString logPath = getLogPath(parser.value(logPathOption));
+ const QString logPath = QDir::toNativeSeparators(getLogPath(parser.value(logPathOption)));
Monero::Wallet::init(argv[0], "monero-wallet-gui", logPath.toStdString().c_str(), true);
qInstallMessageHandler(messageHandler);
diff --git a/src/qt/KeysFiles.cpp b/src/qt/KeysFiles.cpp
index e3d8810a..edfed985 100644
--- a/src/qt/KeysFiles.cpp
+++ b/src/qt/KeysFiles.cpp
@@ -43,11 +43,20 @@
#include "KeysFiles.h"
-WalletKeysFiles::WalletKeysFiles(const qint64 &modified, const QString &path, const quint8 &networkType, const QString &address)
- : m_modified(modified), m_path(path), m_networkType(networkType), m_address(address)
+WalletKeysFiles::WalletKeysFiles(const QFileInfo &info, quint8 networkType, QString address)
+ : m_fileName(info.fileName())
+ , m_modified(info.lastModified().toSecsSinceEpoch())
+ , m_path(QDir::toNativeSeparators(info.absoluteFilePath()))
+ , m_networkType(networkType)
+ , m_address(std::move(address))
{
}
+QString WalletKeysFiles::fileName() const
+{
+ return m_fileName;
+}
+
qint64 WalletKeysFiles::modified() const
{
return m_modified;
@@ -127,11 +136,7 @@ void WalletKeysFilesModel::findWallets(const QString &moneroAccountsDir)
file.close();
}
- const QFileInfo info(wallet);
- const QDateTime modifiedAt = info.lastModified();
-
- this->addWalletKeysFile(WalletKeysFiles(modifiedAt.toSecsSinceEpoch(),
- info.absoluteFilePath(), networkType, address));
+ this->addWalletKeysFile(WalletKeysFiles(wallet, networkType, std::move(address)));
}
}
@@ -152,6 +157,8 @@ QVariant WalletKeysFilesModel::data(const QModelIndex & index, int role) const {
return QVariant();
const WalletKeysFiles &walletKeyFile = m_walletKeyFiles[index.row()];
+ if (role == FileNameRole)
+ return walletKeyFile.fileName();
if (role == ModifiedRole)
return walletKeyFile.modified();
else if (role == PathRole)
@@ -165,6 +172,7 @@ QVariant WalletKeysFilesModel::data(const QModelIndex & index, int role) const {
QHash<int, QByteArray> WalletKeysFilesModel::roleNames() const {
QHash<int, QByteArray> roles;
+ roles[FileNameRole] = "fileName";
roles[ModifiedRole] = "modified";
roles[PathRole] = "path";
roles[NetworkTypeRole] = "networktype";
diff --git a/src/qt/KeysFiles.h b/src/qt/KeysFiles.h
index 6a9339e3..fca10003 100644
--- a/src/qt/KeysFiles.h
+++ b/src/qt/KeysFiles.h
@@ -37,14 +37,16 @@
class WalletKeysFiles
{
public:
- WalletKeysFiles(const qint64 &modified, const QString &path, const quint8 &networkType, const QString &address);
+ WalletKeysFiles(const QFileInfo &info, quint8 networkType, QString address);
+ QString fileName() const;
qint64 modified() const;
QString path() const;
quint8 networkType() const;
QString address() const;
private:
+ QString m_fileName;
qint64 m_modified;
QString m_path;
quint8 m_networkType;
@@ -56,7 +58,8 @@ class WalletKeysFilesModel : public QAbstractListModel
Q_OBJECT
public:
enum KeysFilesRoles {
- ModifiedRole = Qt::UserRole + 1,
+ FileNameRole = Qt::UserRole + 1,
+ ModifiedRole,
PathRole,
NetworkTypeRole,
AddressRole
diff --git a/wizard/WizardController.qml b/wizard/WizardController.qml
index 992ae2fb..3ec9dc79 100644
--- a/wizard/WizardController.qml
+++ b/wizard/WizardController.qml
@@ -371,7 +371,7 @@ Rectangle {
persistentSettings.locale = wizardController.language_locale
persistentSettings.account_name = wizardController.walletOptionsName
- persistentSettings.wallet_path = new_wallet_filename
+ persistentSettings.wallet_path = wizardController.m_wallet.path;
persistentSettings.restore_height = (isNaN(walletOptionsRestoreHeight))? 0 : walletOptionsRestoreHeight
persistentSettings.allow_background_mining = false
diff --git a/wizard/WizardOpenWallet1.qml b/wizard/WizardOpenWallet1.qml
index a3d0bcbc..85bc48d7 100644
--- a/wizard/WizardOpenWallet1.qml
+++ b/wizard/WizardOpenWallet1.qml
@@ -119,7 +119,7 @@ Rectangle {
delegate: Rectangle {
// inherited roles from walletKeysFilesModel:
- // index, modified, accessed, path, networktype, address
+ // index, fileName, modified, accessed, path, networktype, address
id: item
height: flow.itemHeight
width: {
@@ -133,11 +133,6 @@ Rectangle {
else if(networktype === 2) return qsTr("Stagenet");
return "";
}
- property string fileName: {
- var spl = path.split("/");
- return spl[spl.length - 1].replace(".keys", "");
- }
- property string filePath: { return path }
color: "transparent"
Rectangle {
@@ -202,9 +197,9 @@ Rectangle {
text: {
// truncate on window width
var maxLength = wizardController.layoutScale <= 1 ? 12 : 16
- if(item.fileName.length > maxLength)
- return item.fileName.substring(0, maxLength) + "...";
- return item.fileName;
+ if (fileName.length > maxLength)
+ return fileName.substring(0, maxLength) + "...";
+ return fileName;
}
Layout.preferredHeight: 26
@@ -270,7 +265,7 @@ Rectangle {
onClicked: {
persistentSettings.nettype = parseInt(networktype)
- wizardController.openWalletFile(item.filePath);
+ wizardController.openWalletFile(path);
}
}
}
diff --git a/wizard/WizardWalletInput.qml b/wizard/WizardWalletInput.qml
index e0d705cf..64356c89 100644
--- a/wizard/WizardWalletInput.qml
+++ b/wizard/WizardWalletInput.qml
@@ -55,7 +55,7 @@ GridLayout {
function reset() {
walletName.error = !walletName.verify();
walletLocation.error = walletLocation.text === "";
- walletLocation.text = moneroAccountsDir + "/";
+ walletLocation.text = moneroAccountsDir;
walletName.text = defaultAccountName;
}