Commit c422786b authored by con's avatar con
Browse files

Save category changes for custom tools in their xml.

parent 6f991cb6
......@@ -329,7 +329,7 @@ QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex)
category = categoryForIndex(atIndex.parent());
ExternalTool *tool = new ExternalTool;
tool->setCategory(category);
tool->setDisplayCategory(category);
tool->setDisplayName(tr("New tool"));
tool->setDescription(tr("This tool prints a line of useful text"));
tool->setExecutables(QStringList() << "echo");
......
......@@ -125,6 +125,7 @@ ExternalTool &ExternalTool::operator=(const ExternalTool &other)
m_modifiesCurrentDocument = other.m_modifiesCurrentDocument;
m_fileName = other.m_fileName;
m_presetTool = other.m_presetTool;
return *this;
}
ExternalTool::~ExternalTool()
......@@ -216,7 +217,7 @@ void ExternalTool::setId(const QString &id)
m_id = id;
}
void ExternalTool::setCategory(const QString &category)
void ExternalTool::setDisplayCategory(const QString &category)
{
m_displayCategory = category;
}
......
......@@ -93,7 +93,7 @@ public:
ExternalTool &operator=(const ExternalTool &other);
void setId(const QString &id);
void setCategory(const QString &category);
void setDisplayCategory(const QString &category);
void setDisplayName(const QString &name);
void setDescription(const QString &description);
void setOutputHandling(OutputHandling handling);
......
......@@ -169,6 +169,10 @@ void ToolSettings::apply()
foreach (ExternalTool *tool, it.value()) {
ExternalTool *toolToAdd = 0;
if (ExternalTool *originalTool = originalTools.take(tool->id())) {
// check if it has different category and is custom tool
if (tool->displayCategory() != it.key() && !tool->preset()) {
tool->setDisplayCategory(it.key());
}
// check if the tool has changed
if ((*originalTool) == (*tool)) {
toolToAdd = originalTool;
......
Markdown is supported
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