Fixed issue about Local Template.

This commit is contained in:
okrc 2022-10-11 20:56:07 +08:00
parent b488b1bfeb
commit fab6e7465d
No known key found for this signature in database
GPG Key ID: 7BFFDD3B3BF40F01
1 changed files with 3 additions and 2 deletions

View File

@ -129,6 +129,7 @@ void COptionsWindow::ShowTemplates()
QString Name = I.value().first.mid(9);
QTreeWidgetItem* pItem = new QTreeWidgetItem();
pItem->setData(0, Qt::UserRole, I.key());
pItem->setText(0, GetCategoryName(I.key()));
pItem->setData(1, Qt::UserRole, I.value().first);
pItem->setText(1, I.value().second);
@ -179,7 +180,7 @@ void COptionsWindow::OnTemplateDoubleClicked(QTreeWidgetItem* pItem, int Column)
COptionsWindow OptionsWindow(pTemplate, pItem->text(1));
OptionsWindow.exec();
if(pItem->text(0) == "Local")
if (pItem->data(0, Qt::UserRole).toString() == "Local")
LoadTemplates();
}
@ -211,7 +212,7 @@ void COptionsWindow::OnAddTemplates()
void COptionsWindow::OnDelTemplates()
{
QTreeWidgetItem* pItem = ui.treeTemplates->currentItem();
if (!pItem || pItem->text(0) != "Local")
if (!pItem || pItem->data(0, Qt::UserRole).toString() != "Local")
{
QMessageBox::critical(this, "Sandboxie-Plus", tr("Only local templates can be removed!"));
return;