create new wallet name suggestion and pre-select and focus the textfield
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
|
import QtQuick 2.6
|
||||||
import QtQuick.Layouts 1.0
|
import QtQuick.Layouts 1.0
|
||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
|
|
||||||
|
import org.electrum 1.0
|
||||||
|
|
||||||
WizardComponent {
|
WizardComponent {
|
||||||
valid: wallet_name.text.length > 0
|
valid: wallet_name.text.length > 0
|
||||||
|
|
||||||
@@ -13,6 +16,12 @@ WizardComponent {
|
|||||||
Label { text: qsTr('Wallet name') }
|
Label { text: qsTr('Wallet name') }
|
||||||
TextField {
|
TextField {
|
||||||
id: wallet_name
|
id: wallet_name
|
||||||
|
focus: true
|
||||||
|
text: Daemon.suggestWalletName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
wallet_name.selectAll()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,12 @@ class QEAvailableWalletListModel(QEWalletListModel):
|
|||||||
wallet = self.daemon.get_wallet(path)
|
wallet = self.daemon.get_wallet(path)
|
||||||
self.add_wallet(wallet_path = path, wallet = wallet)
|
self.add_wallet(wallet_path = path, wallet = wallet)
|
||||||
|
|
||||||
|
def wallet_name_exists(self, name):
|
||||||
|
for wallet_name, wallet_path, wallet in self.wallets:
|
||||||
|
if name == wallet_name:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
class QEDaemon(AuthMixin, QObject):
|
class QEDaemon(AuthMixin, QObject):
|
||||||
def __init__(self, daemon, parent=None):
|
def __init__(self, daemon, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
@@ -181,3 +187,11 @@ class QEDaemon(AuthMixin, QObject):
|
|||||||
@pyqtProperty(QEFX, notify=fxChanged)
|
@pyqtProperty(QEFX, notify=fxChanged)
|
||||||
def fx(self):
|
def fx(self):
|
||||||
return self.qefx
|
return self.qefx
|
||||||
|
|
||||||
|
@pyqtSlot(result=str)
|
||||||
|
def suggestWalletName(self):
|
||||||
|
i = 1
|
||||||
|
while self.availableWallets.wallet_name_exists(f'wallet_{i}'):
|
||||||
|
i = i + 1
|
||||||
|
return f'wallet_{i}'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user