async device open and create from device, passphrase

- passphrase entry on host added, requires early listener setting monero pull #5355
- wallet open and create from device shows splash to indicate possible long process
- create from device is async to support passphrase entry
This commit is contained in:
Dusan Klinec
2019-03-27 09:28:42 +01:00
parent 19c2208dc4
commit 1a2675b246
10 changed files with 607 additions and 14 deletions

View File

@@ -7,6 +7,8 @@
#include <wallet/api/wallet2_api.h>
#include <QMutex>
#include <QPointer>
#include <QWaitCondition>
#include <QMutex>
#include "NetworkType.h"
class Wallet;
@@ -70,6 +72,13 @@ public:
const QString &deviceName,
quint64 restoreHeight = 0,
const QString &subaddressLookahead = "");
Q_INVOKABLE void createWalletFromDeviceAsync(const QString &path,
const QString &password,
NetworkType::Type nettype,
const QString &deviceName,
quint64 restoreHeight = 0,
const QString &subaddressLookahead = "");
/*!
* \brief closeWallet - closes current open wallet and frees memory
* \return wallet address
@@ -152,14 +161,22 @@ public:
// clear/rename wallet cache
Q_INVOKABLE bool clearWalletCache(const QString &fileName) const;
Q_INVOKABLE void onWalletPassphraseNeeded(Monero::Wallet * wallet);
Q_INVOKABLE void onPassphraseEntered(const QString &passphrase, bool entry_abort=false);
signals:
void walletOpened(Wallet * wallet);
void walletCreated(Wallet * wallet);
void walletPassphraseNeeded();
void deviceButtonRequest(quint64 buttonCode);
void deviceButtonPressed();
void walletClosed(const QString &walletAddress);
void checkUpdatesComplete(const QString &result) const;
public slots:
private:
friend class WalletPassphraseListenerImpl;
explicit WalletManager(QObject *parent = 0);
static WalletManager * m_instance;
@@ -167,6 +184,10 @@ private:
QMutex m_mutex;
QPointer<Wallet> m_currentWallet;
QWaitCondition m_cond_pass;
QMutex m_mutex_pass;
QString m_passphrase;
bool m_passphrase_abort;
};
#endif // WALLETMANAGER_H