Commit 5d0c1a41 authored by dt's avatar dt
Browse files

Toolchainsoptions page: Treat adding/removing correctly

Reviewed-By: hunger
parent 5e2171bd
...@@ -307,7 +307,6 @@ void ToolChainModel::apply() ...@@ -307,7 +307,6 @@ void ToolChainModel::apply()
foreach (ToolChainNode *n, nodes) { foreach (ToolChainNode *n, nodes) {
ToolChainManager::instance()->registerToolChain(n->toolChain); ToolChainManager::instance()->registerToolChain(n->toolChain);
} }
Q_ASSERT(m_toAddList.isEmpty());
} }
void ToolChainModel::discard() void ToolChainModel::discard()
...@@ -339,6 +338,7 @@ void ToolChainModel::discard() ...@@ -339,6 +338,7 @@ void ToolChainModel::discard()
n->widget->discard(); n->widget->discard();
n->changed = false; n->changed = false;
} }
reset();
} }
void ToolChainModel::markForRemoval(ToolChain *tc) void ToolChainModel::markForRemoval(ToolChain *tc)
...@@ -351,9 +351,15 @@ void ToolChainModel::markForRemoval(ToolChain *tc) ...@@ -351,9 +351,15 @@ void ToolChainModel::markForRemoval(ToolChain *tc)
} }
} }
if (node) { if (node) {
m_toRemoveList.append(node);
emit beginRemoveRows(index(m_manualRoot), m_manualRoot->childNodes.indexOf(node), m_manualRoot->childNodes.indexOf(node)); emit beginRemoveRows(index(m_manualRoot), m_manualRoot->childNodes.indexOf(node), m_manualRoot->childNodes.indexOf(node));
m_manualRoot->childNodes.removeOne(node); m_manualRoot->childNodes.removeOne(node);
if (m_toAddList.contains(node)) {
delete node->toolChain;
node->toolChain = 0;
m_toAddList.removeOne(node);
} else {
m_toRemoveList.append(node);
}
emit endRemoveRows(); emit endRemoveRows();
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment