From e254b95cb26c8cde0e783eb05fd11d49237b05ad Mon Sep 17 00:00:00 2001 From: okrc <29057533+okrc@users.noreply.github.com> Date: Thu, 15 Sep 2022 16:09:48 +0800 Subject: [PATCH] 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. --- SandboxiePlus/SandMan/Views/SbieView.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index b5d1ebf3..d9bb7f6b 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -1198,14 +1198,14 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList& 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& 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& SandB } CSandMan::CheckResults(Results); + + //m_UserConfigChanged = true; + SaveUserConfig(); } void CSbieView::OnProcessAction()