Wladimir J. van der Laan
14 years ago
5 changed files with 84 additions and 4 deletions
@ -1,17 +1,56 @@ |
|||||||
#include "editaddressdialog.h" |
#include "editaddressdialog.h" |
||||||
#include "ui_editaddressdialog.h" |
#include "ui_editaddressdialog.h" |
||||||
|
#include "addresstablemodel.h" |
||||||
#include "guiutil.h" |
#include "guiutil.h" |
||||||
|
|
||||||
|
#include <QDataWidgetMapper> |
||||||
|
#include <QDebug> |
||||||
|
|
||||||
EditAddressDialog::EditAddressDialog(Mode mode, QWidget *parent) : |
EditAddressDialog::EditAddressDialog(Mode mode, QWidget *parent) : |
||||||
QDialog(parent), |
QDialog(parent), |
||||||
ui(new Ui::EditAddressDialog) |
ui(new Ui::EditAddressDialog), mapper(0) |
||||||
{ |
{ |
||||||
ui->setupUi(this); |
ui->setupUi(this); |
||||||
|
|
||||||
GUIUtil::setupAddressWidget(ui->addressEdit, this); |
GUIUtil::setupAddressWidget(ui->addressEdit, this); |
||||||
|
|
||||||
|
switch(mode) |
||||||
|
{ |
||||||
|
case NewReceivingAddress: |
||||||
|
setWindowTitle(tr("New receiving address")); |
||||||
|
ui->addressEdit->setEnabled(false); |
||||||
|
break; |
||||||
|
case NewSendingAddress: |
||||||
|
setWindowTitle(tr("New sending address")); |
||||||
|
break; |
||||||
|
case EditReceivingAddress: |
||||||
|
setWindowTitle(tr("Edit receiving address")); |
||||||
|
ui->addressEdit->setReadOnly(true); |
||||||
|
break; |
||||||
|
case EditSendingAddress: |
||||||
|
setWindowTitle(tr("Edit sending address")); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
mapper = new QDataWidgetMapper(this); |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
EditAddressDialog::~EditAddressDialog() |
EditAddressDialog::~EditAddressDialog() |
||||||
{ |
{ |
||||||
delete ui; |
delete ui; |
||||||
} |
} |
||||||
|
|
||||||
|
void EditAddressDialog::setModel(AddressTableModel *model) |
||||||
|
{ |
||||||
|
qDebug() << "setModel " << model; |
||||||
|
mapper->setModel(model); |
||||||
|
mapper->addMapping(ui->labelEdit, AddressTableModel::Label); |
||||||
|
mapper->addMapping(ui->addressEdit, AddressTableModel::Address); |
||||||
|
} |
||||||
|
|
||||||
|
void EditAddressDialog::loadRow(int row) |
||||||
|
{ |
||||||
|
qDebug() << "loadRow " << row; |
||||||
|
mapper->setCurrentIndex(row); |
||||||
|
} |
||||||
|
Loading…
Reference in new issue