mirror of
https://github.com/feather-wallet/feather.git
synced 2025-03-12 09:37:47 +00:00
wizard: add toggle to change wallet dir
This commit is contained in:
parent
41ac670edb
commit
a4e81953da
5 changed files with 25 additions and 15 deletions
|
@ -24,20 +24,25 @@ PageWalletFile::PageWalletFile(WizardFields *fields, QWidget *parent)
|
|||
connect(ui->btnChange, &QPushButton::clicked, [=] {
|
||||
QString currentWalletDir = config()->get(Config::walletDirectory).toString();
|
||||
QString walletDir = QFileDialog::getExistingDirectory(this, "Select wallet directory ", currentWalletDir, QFileDialog::ShowDirsOnly);
|
||||
if(walletDir.isEmpty()) return;
|
||||
if (walletDir.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ui->line_walletDir->setText(walletDir);
|
||||
config()->set(Config::walletDirectory, walletDir);
|
||||
emit defaultWalletDirChanged(walletDir);
|
||||
});
|
||||
|
||||
connect(ui->line_walletName, &QLineEdit::textChanged, this, &PageWalletFile::validateWidgets);
|
||||
connect(ui->line_walletDir, &QLineEdit::textChanged, this, &PageWalletFile::validateWidgets);
|
||||
connect(ui->line_walletDir, &QLineEdit::textChanged, this, [this](){
|
||||
ui->check_defaultWalletDirectory->setVisible(true);
|
||||
this->validateWidgets();
|
||||
});
|
||||
}
|
||||
|
||||
void PageWalletFile::initializePage() {
|
||||
this->setTitle(m_fields->modeText);
|
||||
ui->line_walletDir->setText(config()->get(Config::walletDirectory).toString());
|
||||
ui->line_walletName->setText(this->defaultWalletName());
|
||||
ui->check_defaultWalletDirectory->setVisible(false);
|
||||
ui->check_defaultWalletDirectory->setChecked(false);
|
||||
}
|
||||
|
||||
bool PageWalletFile::validateWidgets(){
|
||||
|
@ -85,6 +90,12 @@ bool PageWalletFile::validatePage() {
|
|||
m_fields->walletName = ui->line_walletName->text();
|
||||
m_fields->walletDir = ui->line_walletDir->text();
|
||||
|
||||
QString walletDir = ui->line_walletDir->text();
|
||||
bool dirChanged = config()->get(Config::walletDirectory).toString() != walletDir;
|
||||
if (dirChanged && ui->check_defaultWalletDirectory->isChecked()) {
|
||||
config()->set(Config::walletDirectory, walletDir);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,6 @@ public:
|
|||
int nextId() const override;
|
||||
bool isComplete() const override;
|
||||
|
||||
signals:
|
||||
void defaultWalletDirChanged(QString walletDir);
|
||||
|
||||
private:
|
||||
QString defaultWalletName();
|
||||
bool walletPathExists(const QString &walletName);
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>486</width>
|
||||
<height>317</height>
|
||||
<width>849</width>
|
||||
<height>579</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -113,11 +113,19 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="check_defaultWalletDirectory">
|
||||
<property name="text">
|
||||
<string>Set as default wallet directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>label_9</zorder>
|
||||
<zorder>label</zorder>
|
||||
<zorder>line_walletName</zorder>
|
||||
<zorder>frame</zorder>
|
||||
<zorder>check_defaultWalletDirectory</zorder>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>line_walletName</tabstop>
|
||||
|
|
|
@ -73,11 +73,6 @@ WalletWizard::WalletWizard(QWidget *parent)
|
|||
|
||||
connect(walletSetPasswordPage, &PageSetPassword::createWallet, this, &WalletWizard::onCreateWallet);
|
||||
|
||||
|
||||
connect(createWallet, &PageWalletFile::defaultWalletDirChanged, [this](const QString &walletDir){
|
||||
emit defaultWalletDirChanged(walletDir);
|
||||
});
|
||||
|
||||
connect(openWalletPage, &PageOpenWallet::openWallet, [=](const QString &path){
|
||||
emit openWallet(path, "");
|
||||
});
|
||||
|
|
|
@ -93,7 +93,6 @@ signals:
|
|||
void initialNetworkConfigured();
|
||||
void showSettings();
|
||||
void openWallet(QString path, QString password);
|
||||
void defaultWalletDirChanged(QString walletDir);
|
||||
|
||||
void createWalletFromDevice(const QString &path, const QString &password, const QString &deviceName, int restoreHeight, const QString &subaddressLookahead);
|
||||
void createWalletFromKeys(const QString &path, const QString &password, const QString &address, const QString &viewkey, const QString &spendkey, quint64 restoreHeight, const QString subaddressLookahead = "");
|
||||
|
|
Loading…
Reference in a new issue