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 \
components/*.qml \
pages/*.qml \
wizard/*.qml
wizard/*.qml \
wizard/*js
}
LIBS += -L$$WALLET_ROOT/lib \

View file

@ -132,6 +132,8 @@ QString WalletManager::maximumAllowedAmountAsSting() const
return WalletManager::displayAmount(WalletManager::maximumAllowedAmount());
}
QString WalletManager::displayAmount(quint64 amount) const
{
return QString::fromStdString(Bitmonero::Wallet::displayAmount(amount));
@ -152,6 +154,16 @@ void WalletManager::setLogLevel(int 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)
{
m_pimpl = Bitmonero::WalletManagerFactory::getWalletManager();

View file

@ -2,6 +2,7 @@
#define WALLETMANAGER_H
#include <QObject>
#include <QUrl>
#include <wallet/wallet2_api.h>
class Wallet;
@ -88,6 +89,10 @@ public:
// QML JS engine doesn't support unsigned integers
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);
signals:

View file

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