fix: Wallet storage path creation broken (#49)

This commit is contained in:
Ilya Kitaev 2016-09-05 22:07:53 +03:00
parent c87eed558f
commit 3280fe389a
4 changed files with 21 additions and 2 deletions

View File

@ -41,7 +41,8 @@ lupdate_only {
SOURCES = *.qml \ SOURCES = *.qml \
components/*.qml \ components/*.qml \
pages/*.qml \ pages/*.qml \
wizard/*.qml wizard/*.qml \
wizard/*js
} }
LIBS += -L$$WALLET_ROOT/lib \ LIBS += -L$$WALLET_ROOT/lib \

View File

@ -132,6 +132,8 @@ QString WalletManager::maximumAllowedAmountAsSting() const
return WalletManager::displayAmount(WalletManager::maximumAllowedAmount()); return WalletManager::displayAmount(WalletManager::maximumAllowedAmount());
} }
QString WalletManager::displayAmount(quint64 amount) const QString WalletManager::displayAmount(quint64 amount) const
{ {
return QString::fromStdString(Bitmonero::Wallet::displayAmount(amount)); return QString::fromStdString(Bitmonero::Wallet::displayAmount(amount));
@ -152,6 +154,16 @@ void WalletManager::setLogLevel(int logLevel)
Bitmonero::WalletManagerFactory::setLogLevel(logLevel); Bitmonero::WalletManagerFactory::setLogLevel(logLevel);
} }
QString WalletManager::urlToLocalPath(const QUrl &url) const
{
return QDir::toNativeSeparators(url.toLocalFile());
}
QUrl WalletManager::localPathToUrl(const QString &path) const
{
return QUrl::fromLocalFile(path);
}
WalletManager::WalletManager(QObject *parent) : QObject(parent) WalletManager::WalletManager(QObject *parent) : QObject(parent)
{ {
m_pimpl = Bitmonero::WalletManagerFactory::getWalletManager(); m_pimpl = Bitmonero::WalletManagerFactory::getWalletManager();

View File

@ -2,6 +2,7 @@
#define WALLETMANAGER_H #define WALLETMANAGER_H
#include <QObject> #include <QObject>
#include <QUrl>
#include <wallet/wallet2_api.h> #include <wallet/wallet2_api.h>
class Wallet; class Wallet;
@ -88,6 +89,10 @@ public:
// QML JS engine doesn't support unsigned integers // QML JS engine doesn't support unsigned integers
Q_INVOKABLE QString maximumAllowedAmountAsSting() const; Q_INVOKABLE QString maximumAllowedAmountAsSting() const;
// QML missing such functionality, implementing these helpers here
Q_INVOKABLE QString urlToLocalPath(const QUrl &url) const;
Q_INVOKABLE QUrl localPathToUrl(const QString &path) const;
void setLogLevel(int logLevel); void setLogLevel(int logLevel);
signals: signals:

View File

@ -186,7 +186,7 @@ Item {
selectFolder: true selectFolder: true
title: qsTr("Please choose a directory") + translationManager.emptyString title: qsTr("Please choose a directory") + translationManager.emptyString
onAccepted: { onAccepted: {
fileUrlInput.text = fileDialog.folder fileUrlInput.text = walletManager.urlToLocalPath(fileDialog.folder)
fileDialog.visible = false fileDialog.visible = false
} }
onRejected: { onRejected: {
@ -213,6 +213,7 @@ Item {
fileDialog.open() fileDialog.open()
} }
} }
} }
Rectangle { Rectangle {