select new address immediately after creation
This commit is contained in:
parent
2351a3fc9f
commit
ffccb56914
3 changed files with 24 additions and 6 deletions
|
@ -116,7 +116,19 @@ void AddressBookPage::on_newAddressButton_clicked()
|
||||||
EditAddressDialog::NewSendingAddress :
|
EditAddressDialog::NewSendingAddress :
|
||||||
EditAddressDialog::NewReceivingAddress);
|
EditAddressDialog::NewReceivingAddress);
|
||||||
dlg.setModel(model);
|
dlg.setModel(model);
|
||||||
dlg.exec();
|
if(dlg.exec())
|
||||||
|
{
|
||||||
|
// Select row for newly created address
|
||||||
|
QString address = dlg.getAddress();
|
||||||
|
QModelIndexList lst = proxyModel->match(proxyModel->index(0,
|
||||||
|
AddressTableModel::Address, QModelIndex()),
|
||||||
|
Qt::EditRole, address, 1, Qt::MatchExactly);
|
||||||
|
if(!lst.isEmpty())
|
||||||
|
{
|
||||||
|
ui->tableView->setFocus();
|
||||||
|
ui->tableView->selectRow(lst.at(0).row());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressBookPage::on_deleteButton_clicked()
|
void AddressBookPage::on_deleteButton_clicked()
|
||||||
|
|
|
@ -54,9 +54,8 @@ void EditAddressDialog::loadRow(int row)
|
||||||
mapper->setCurrentIndex(row);
|
mapper->setCurrentIndex(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString EditAddressDialog::saveCurrentRow()
|
bool EditAddressDialog::saveCurrentRow()
|
||||||
{
|
{
|
||||||
QString address;
|
|
||||||
switch(mode)
|
switch(mode)
|
||||||
{
|
{
|
||||||
case NewReceivingAddress:
|
case NewReceivingAddress:
|
||||||
|
@ -74,12 +73,12 @@ QString EditAddressDialog::saveCurrentRow()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return address;
|
return !address.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditAddressDialog::accept()
|
void EditAddressDialog::accept()
|
||||||
{
|
{
|
||||||
if(saveCurrentRow().isEmpty())
|
if(!saveCurrentRow())
|
||||||
{
|
{
|
||||||
switch(model->getEditStatus())
|
switch(model->getEditStatus())
|
||||||
{
|
{
|
||||||
|
@ -100,3 +99,7 @@ void EditAddressDialog::accept()
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString EditAddressDialog::getAddress() const
|
||||||
|
{
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
|
@ -32,13 +32,16 @@ public:
|
||||||
|
|
||||||
void accept();
|
void accept();
|
||||||
|
|
||||||
|
QString getAddress() const;
|
||||||
private:
|
private:
|
||||||
QString saveCurrentRow();
|
bool saveCurrentRow();
|
||||||
|
|
||||||
Ui::EditAddressDialog *ui;
|
Ui::EditAddressDialog *ui;
|
||||||
QDataWidgetMapper *mapper;
|
QDataWidgetMapper *mapper;
|
||||||
Mode mode;
|
Mode mode;
|
||||||
AddressTableModel *model;
|
AddressTableModel *model;
|
||||||
|
|
||||||
|
QString address;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EDITADDRESSDIALOG_H
|
#endif // EDITADDRESSDIALOG_H
|
||||||
|
|
Loading…
Reference in a new issue