Update SbieView.cpp

Fix https://github.com/sandboxie-plus/Sandboxie/issues/2231
OldValue should be the underlined version, which should be in the same format as m_Groups Value. Otherwise OldValue can never be found in m_Groups.
Fix BoxDisplayOrder not being refreshed in time when renaming and deleting sandbox operations.
This commit is contained in:
okrc 2022-09-15 16:09:48 +08:00 committed by GitHub
parent 138387328a
commit e254b95cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 3 deletions

View File

@ -1198,14 +1198,14 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList<CSandBoxPtr>& SandB
}
else if (Action == m_pMenuRename)
{
QString OldValue = SandBoxes.first()->GetName().replace("_", " ");
QString Value = QInputDialog::getText(this, "Sandboxie-Plus", tr("Please enter a new name for the Sandbox."), QLineEdit::Normal, OldValue);
QString OldValue = SandBoxes.first()->GetName();
QString Value = QInputDialog::getText(this, "Sandboxie-Plus", tr("Please enter a new name for the Sandbox."), QLineEdit::Normal, OldValue).replace(" ", "_");
if (Value.isEmpty() || Value == OldValue)
return;
if (!TestNameAndWarn(Value))
return;
Results.append((SandBoxes.first()->RenameBox(Value.replace(" ", "_"))));
Results.append((SandBoxes.first()->RenameBox(Value)));
RenameItem(OldValue, Value);
}
@ -1226,6 +1226,12 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList<CSandBoxPtr>& SandB
if (!Status.IsError())
Status = pBox->RemoveBox();
Results.append(Status);
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I)
{
if (I.value().removeOne(pBox->GetName()))
break;
}
}
}
else if (Action == m_pMenuCleanUp)
@ -1345,6 +1351,9 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList<CSandBoxPtr>& SandB
}
CSandMan::CheckResults(Results);
//m_UserConfigChanged = true;
SaveUserConfig();
}
void CSbieView::OnProcessAction()