When editing connection the dialog is now initialized on the correct connection group.

This commit is contained in:
eelke 2019-09-01 06:44:48 +02:00
parent 2823297482
commit 0fb1d89aee
4 changed files with 18 additions and 4 deletions

View file

@ -41,22 +41,21 @@ void ConnectionConfigurationWidget::editExistingInWindow(ConnectionController *c
win->accept();
});
win->connect(btn_hbox, &QDialogButtonBox::rejected, [win] ()
{
{
win->reject();
});
});
win->show();
}
ConnectionConfigurationWidget::ConnectionConfigurationWidget(ConnectionTreeModel *connection_model, QWidget *parent)
: QWidget(parent)
, m_connectionModel(connection_model)
{
lblGroup = new QLabel;
cmbbxGroup = new QComboBox;
cmbbxGroup->setModel(connection_model);
cmbbxGroup->setModelColumn(0);
// cmbbxGroup->setEditable(true);
// cmbbxGroup->setInsertPolicy(QComboBox::NoInsert);
lblGroup->setBuddy(cmbbxGroup);
lblName = new QLabel;
@ -158,6 +157,10 @@ void ConnectionConfigurationWidget::retranslateUi()
void ConnectionConfigurationWidget::setData(const ConnectionConfig &cfg)
{
auto group = cfg.parent();
auto group_idx = m_connectionModel->findGroup(group->conngroup_id);
cmbbxGroup->setCurrentIndex(group_idx);
m_uuid = cfg.uuid();
edtName->setText(stdStrToQ(cfg.name()));
edtHost->setText(stdStrToQ(cfg.host()));