This commit is contained in:
DavidXanatos 2021-06-15 18:53:00 +02:00
parent 54afe9c803
commit 282420c813
3 changed files with 46 additions and 5 deletions

View File

@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed ### Fixed
- properly fixed an issue with Driver Verifier and user handles - properly fixed an issue with Driver Verifier and user handles
- fixed an issue with CreateWindow function introduced with 0.8.0 - fixed an issue with CreateWindow function introduced with 0.8.0
- fixed issue with outdated BoxDisplayOrder entries being retained

View File

@ -500,9 +500,23 @@ void CSbieView::OnGroupAction()
m_pSbieModel->Clear(); //todo improve that m_pSbieModel->Clear(); //todo improve that
} }
StoreGroups();
UpdateGroupMenu();
}
void CSbieView::StoreGroups()
{
QMap<QString, CSandBoxPtr> Boxes = theAPI->GetAllBoxes();
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I) {
for (auto J = I->begin(); J != I->end(); ) {
if (!Boxes.take(J->toLower()).isNull() || m_Groups.contains(*J)) ++J;
else J = I->erase(J);
}
}
QString Grouping = CSbieView__SerializeGroup(m_Groups); QString Grouping = CSbieView__SerializeGroup(m_Groups);
theAPI->GetUserSettings()->SetText("BoxDisplayOrder", Grouping); theAPI->GetUserSettings()->SetText("BoxDisplayOrder", Grouping);
UpdateGroupMenu();
} }
QString CSbieView::AddNewBox() QString CSbieView::AddNewBox()
@ -625,11 +639,22 @@ void CSbieView::OnSandBoxAction(QAction* Action)
} }
else if (Action == m_pMenuRename) else if (Action == m_pMenuRename)
{ {
QString OldValue = SandBoxes.first()->GetName().replace("_", " "); QString OldName = SandBoxes.first()->GetName();
QString OldValue = OldName.replace("_", " ");
QString Value = QInputDialog::getText(this, "Sandboxie-Plus", tr("Please enter a new name for the Sandbox."), QLineEdit::Normal, OldValue); QString Value = QInputDialog::getText(this, "Sandboxie-Plus", tr("Please enter a new name for the Sandbox."), QLineEdit::Normal, OldValue);
if (Value.isEmpty() || Value == OldValue) if (Value.isEmpty() || Value == OldValue)
return; return;
Results.append((SandBoxes.first()->RenameBox(Value.replace(" ", "_")))); QString NewName = Value.replace(" ", "_");
Results.append((SandBoxes.first()->RenameBox(NewName)));
// update grouping
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I) {
int pos = I->indexOf(OldName);
if (pos != -1)
I->replace(pos, NewName);
}
StoreGroups();
} }
else if (Action == m_pMenuRemove) else if (Action == m_pMenuRemove)
{ {
@ -637,7 +662,21 @@ void CSbieView::OnSandBoxAction(QAction* Action)
return; return;
foreach(const CSandBoxPtr & pBox, SandBoxes) foreach(const CSandBoxPtr & pBox, SandBoxes)
Results.append(pBox->RemoveBox()); {
QString Name = pBox->GetName();
SB_STATUS Status = pBox->RemoveBox();
// update grouping
if (!Status.IsError()) {
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I) {
I->removeAll(Name);
}
}
Results.append(Status);
}
StoreGroups();
} }
else if (Action == m_pMenuRecover) else if (Action == m_pMenuRecover)
{ {

View File

@ -27,6 +27,7 @@ signals:
public slots: public slots:
void Clear(); void Clear();
void Refresh(); void Refresh();
void StoreGroups();
void ReloadGroups(); void ReloadGroups();
private slots: private slots: