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

@ -748,6 +748,14 @@ std::optional<QSqlError> ConnectionTreeModel::removeGroup(int row)
m_groups.remove(row);
return {};
}
int ConnectionTreeModel::findGroup(int conngroup_id) const
{
auto find_res = std::find_if(m_groups.begin(), m_groups.end(),
[conngroup_id] (auto item) { return item->conngroup_id == conngroup_id; });
if (find_res == m_groups.end())
return -1;
return find_res - m_groups.begin();
}
std::optional<QSqlError> ConnectionTreeModel::saveToDb(const ConnectionConfig &cc)