mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
parent
2ca2376d45
commit
00aa23162c
5 changed files with 58 additions and 4 deletions
|
@ -35,6 +35,7 @@ Item {
|
|||
property alias validator: input.validator
|
||||
property alias readOnly : input.readOnly
|
||||
property alias cursorPosition: input.cursorPosition
|
||||
property alias echoMode: input.echoMode
|
||||
property int fontSize: 18
|
||||
property bool error: false
|
||||
signal editingFinished()
|
||||
|
|
6
main.qml
6
main.qml
|
@ -257,6 +257,10 @@ ApplicationWindow {
|
|||
console.log("initializing with daemon address: ", persistentSettings.daemon_address)
|
||||
console.log("Recovering from seed: ", persistentSettings.is_recovering)
|
||||
console.log("restore Height", persistentSettings.restore_height)
|
||||
|
||||
// Use saved daemon rpc login settings
|
||||
currentWallet.setDaemonLogin(persistentSettings.daemonUsername, persistentSettings.daemonPassword);
|
||||
|
||||
currentWallet.initAsync(persistentSettings.daemon_address, 0, persistentSettings.is_recovering, persistentSettings.restore_height);
|
||||
}
|
||||
|
||||
|
@ -800,6 +804,8 @@ ApplicationWindow {
|
|||
property string daemonFlags
|
||||
property int logLevel: 0
|
||||
property string logCategories: ""
|
||||
property string daemonUsername: ""
|
||||
property string daemonPassword: ""
|
||||
}
|
||||
|
||||
// Information dialog
|
||||
|
|
|
@ -236,7 +236,35 @@ Rectangle {
|
|||
text: (daemonAddress !== undefined) ? daemonAddress[1] : "18081"
|
||||
placeholderText: qsTr("Port")
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
||||
Label {
|
||||
id: daemonLoginLabel
|
||||
Layout.fillWidth: true
|
||||
color: "#4A4949"
|
||||
text: qsTr("Login (optional)") + translationManager.emptyString
|
||||
fontSize: 16
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
id: daemonUsername
|
||||
Layout.preferredWidth: 100
|
||||
Layout.fillWidth: true
|
||||
text: persistentSettings.daemonUsername
|
||||
placeholderText: qsTr("Username")
|
||||
}
|
||||
|
||||
|
||||
LineEdit {
|
||||
id: daemonPassword
|
||||
Layout.preferredWidth: 100
|
||||
Layout.fillWidth: true
|
||||
text: persistentSettings.daemonPassword
|
||||
placeholderText: qsTr("Password")
|
||||
echoMode: TextInput.Password
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: daemonAddrSave
|
||||
|
@ -253,12 +281,17 @@ Rectangle {
|
|||
var newDaemon = daemonAddr.text + ":" + daemonPort.text
|
||||
if(persistentSettings.daemon_address != newDaemon) {
|
||||
persistentSettings.daemon_address = newDaemon
|
||||
//Reinit wallet
|
||||
currentWallet.initAsync(newDaemon)
|
||||
}
|
||||
|
||||
// Update daemon login
|
||||
persistentSettings.daemonUsername = daemonUsername.text;
|
||||
persistentSettings.daemonPassword = daemonPassword.text;
|
||||
currentWallet.setDaemonLogin(persistentSettings.daemonUsername, persistentSettings.daemonPassword);
|
||||
|
||||
//Reinit wallet
|
||||
currentWallet.initAsync(newDaemon);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
|
|
@ -178,10 +178,17 @@ bool Wallet::init(const QString &daemonAddress, quint64 upperTransactionLimit, b
|
|||
m_walletImpl->setRecoveringFromSeed(true);
|
||||
m_walletImpl->setRefreshFromBlockHeight(restoreHeight);
|
||||
}
|
||||
m_walletImpl->init(daemonAddress.toStdString(), upperTransactionLimit);
|
||||
m_walletImpl->init(daemonAddress.toStdString(), upperTransactionLimit, m_daemonUsername.toStdString(), m_daemonPassword.toStdString());
|
||||
return true;
|
||||
}
|
||||
|
||||
void Wallet::setDaemonLogin(const QString &daemonUsername, const QString &daemonPassword)
|
||||
{
|
||||
// store daemon login
|
||||
m_daemonUsername = daemonUsername;
|
||||
m_daemonPassword = daemonPassword;
|
||||
}
|
||||
|
||||
void Wallet::initAsync(const QString &daemonAddress, quint64 upperTransactionLimit, bool isRecovering, quint64 restoreHeight)
|
||||
{
|
||||
qDebug() << "initAsync: " + daemonAddress;
|
||||
|
@ -593,6 +600,8 @@ Wallet::Wallet(Monero::Wallet *w, QObject *parent)
|
|||
m_daemonBlockChainTargetHeightTime.restart();
|
||||
m_initialized = false;
|
||||
m_connectionStatusRunning = false;
|
||||
m_daemonUsername = "";
|
||||
m_daemonPassword = "";
|
||||
}
|
||||
|
||||
Wallet::~Wallet()
|
||||
|
|
|
@ -106,6 +106,9 @@ public:
|
|||
//! initializes wallet asynchronously
|
||||
Q_INVOKABLE void initAsync(const QString &daemonAddress, quint64 upperTransactionLimit = 0, bool isRecovering = false, quint64 restoreHeight = 0);
|
||||
|
||||
// Set daemon rpc user/pass
|
||||
Q_INVOKABLE void setDaemonLogin(const QString &daemonUsername = "", const QString &daemonPassword = "");
|
||||
|
||||
//! create a view only wallet
|
||||
Q_INVOKABLE bool createViewOnly(const QString &path, const QString &password) const;
|
||||
|
||||
|
@ -271,6 +274,8 @@ private:
|
|||
mutable AddressBookModel * m_addressBookModel;
|
||||
QMutex m_connectionStatusMutex;
|
||||
bool m_connectionStatusRunning;
|
||||
QString m_daemonUsername;
|
||||
QString m_daemonPassword;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue