Commit 13de60ae authored by Ahmad Samir's avatar Ahmad Samir
Browse files

ExternalToolsPlugin: fix drag and drop to change a tool's category

parent 9bcc98e8
......@@ -248,10 +248,7 @@ KateExternalToolsConfigWidget::KateExternalToolsConfigWidget(QWidget *parent, Ka
reset();
slotSelectionChanged();
connect(&m_toolsModel, &QStandardItemModel::itemChanged, [this]() {
m_changed = true;
Q_EMIT changed();
});
connect(&m_toolsModel, &QStandardItemModel::itemChanged, this, &KateExternalToolsConfigWidget::slotItemChanged);
}
KateExternalToolsConfigWidget::~KateExternalToolsConfigWidget()
......@@ -529,6 +526,22 @@ void KateExternalToolsConfigWidget::slotEdit()
}
}
void KateExternalToolsConfigWidget::slotItemChanged(QStandardItem *item)
{
// If a tool was drag and dropped to some other category, we need
// to update the tool's category
if (KateExternalTool *tool = toolForItem(item)) {
if (QStandardItem *parentCategory = item->parent()) {
tool->category = parentCategory != m_noCategory ? parentCategory->text() : QString{};
// Changes will be saved in apply()
m_changedTools.push_back({tool, {}});
}
}
m_changed = true;
Q_EMIT changed();
}
// END KateExternalToolsConfigWidget
// kate: space-indent on; indent-width 4; replace-tabs on;
......@@ -56,6 +56,7 @@ private Q_SLOTS:
void slotEdit();
void slotRemove();
void slotSelectionChanged();
void slotItemChanged(QStandardItem *item);
/**
* Helper to open the ToolDialog.
......
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