diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index 602d3950..04205596 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -165,7 +165,6 @@ void CSbieView::CreateMenu() m_pMenuContent->addSeparator(); m_pMenuExplore = m_pMenuContent->addAction(CSandMan::GetIcon("Explore"), tr("Explore Content"), this, SLOT(OnSandBoxAction())); m_pMenuRegEdit = m_pMenuContent->addAction(CSandMan::GetIcon("RegEdit"), tr("Open Registry"), this, SLOT(OnSandBoxAction())); - m_pMenuSnapshots = m_pMenu->addAction(CSandMan::GetIcon("Snapshots"), tr("Snapshots Manager"), this, SLOT(OnSandBoxAction())); m_pMenuRecover = m_pMenu->addAction(CSandMan::GetIcon("Recover"), tr("Recover Files"), this, SLOT(OnSandBoxAction())); m_pMenuCleanUp = m_pMenu->addAction(CSandMan::GetIcon("Erase"), tr("Delete Content"), this, SLOT(OnSandBoxAction())); m_pMenu->addSeparator(); @@ -193,6 +192,8 @@ void CSbieView::CreateMenu() m_pMenuPresetsRecovery->setCheckable(true); m_pMenuTools = m_pMenu->addMenu(CSandMan::GetIcon("Maintenance"), tr("Sandbox Tools")); + m_pMenuSnapshots = m_pMenuTools->addAction(CSandMan::GetIcon("Snapshots"), tr("Snapshots Manager"), this, SLOT(OnSandBoxAction())); + m_pMenuTools->addSeparator(); m_pMenuDuplicate = m_pMenuTools->addAction(CSandMan::GetIcon("Duplicate"), tr("Duplicate Box Config"), this, SLOT(OnSandBoxAction())); m_pMenuRename = m_pMenu->addAction(CSandMan::GetIcon("Rename"), tr("Rename Sandbox"), this, SLOT(OnSandBoxAction())); @@ -666,6 +667,9 @@ bool CSbieView::UpdateMenu() iGroupe = 0; } + m_CurSandBoxes = GetSelectedBoxes(); + m_CurProcesses = GetSelectedProcesses(); + bool bAdvanced = theConf->GetInt("Options/ViewMode", 1) == 1 || (QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier) != 0; @@ -974,14 +978,13 @@ bool CSbieView::TestNameAndWarn(const QString& Name) void CSbieView::OnSandBoxAction() { - OnSandBoxAction(qobject_cast(sender())); + OnSandBoxAction(qobject_cast(sender()), m_CurSandBoxes); } -void CSbieView::OnSandBoxAction(QAction* Action) +void CSbieView::OnSandBoxAction(QAction* Action, const QList& SandBoxes) { QList Results; - QList SandBoxes = CSbieView::GetSelectedBoxes(); if (SandBoxes.isEmpty()) return; if (Action == m_pStopAsync) @@ -1341,15 +1344,13 @@ void CSbieView::OnSandBoxAction(QAction* Action) void CSbieView::OnProcessAction() { - OnProcessAction(qobject_cast(sender())); + OnProcessAction(qobject_cast(sender()), m_CurProcesses); } -void CSbieView::OnProcessAction(QAction* Action) +void CSbieView::OnProcessAction(QAction* Action, const QList& Processes) { QList Results; - QList Processes = CSbieView::GetSelectedProcesses(); - if (Action == m_pMenuTerminate || Action == m_pMenuBlackList) { if (theConf->GetInt("Options/WarnTerminate", -1) == -1) @@ -1489,7 +1490,7 @@ void CSbieView::OnDoubleClicked(const QModelIndex& index) if ((QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier) == 0) { if (index.column() == CSbieModel::ePath) { - OnSandBoxAction(m_pMenuExplore); + OnSandBoxAction(m_pMenuExplore, QList() << pBox); return; } } @@ -1629,6 +1630,7 @@ void CSbieView::PopUpMenu(const QString& Name) { //SelectBox(Name); CSandBoxPtr pBox = theAPI->GetBoxByName(Name); + m_CurSandBoxes = QList() << pBox; if (pBox.isNull() || !UpdateMenu(false, pBox)) return; m_pMenu2->exec(QCursor::pos()); //m_pMenu2->popup(QCursor::pos()); @@ -1637,7 +1639,9 @@ void CSbieView::PopUpMenu(const QString& Name) QMenu* CSbieView::GetMenu(const QString& Name) { + //SelectBox(Name); CSandBoxPtr pBox = theAPI->GetBoxByName(Name); + m_CurSandBoxes = QList() << pBox; if (pBox.isNull()) return NULL; UpdateMenu(false, pBox); return m_pMenu; @@ -1727,10 +1731,10 @@ void CSbieView::OnMoveItem(const QString& Name, const QString& To, int row) void CSbieView::OnRemoveItem() { - if (!GetSelectedProcesses().isEmpty()) - OnProcessAction(m_pMenuTerminate); - else if (!GetSelectedBoxes().isEmpty()) - OnSandBoxAction(m_pMenuRemove); + if (!m_CurProcesses.isEmpty()) + OnProcessAction(m_pMenuTerminate, m_CurProcesses); + else if (!m_CurSandBoxes.isEmpty()) + OnSandBoxAction(m_pMenuRemove, m_CurSandBoxes); else if (!GetSelectedGroups().isEmpty()) OnGroupAction(m_pDelGroupe); } diff --git a/SandboxiePlus/SandMan/Views/SbieView.h b/SandboxiePlus/SandMan/Views/SbieView.h index aff7ed8d..c3cf6e54 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.h +++ b/SandboxiePlus/SandMan/Views/SbieView.h @@ -50,9 +50,9 @@ private slots: void OnGroupAction(); void OnGroupAction(QAction* pAction); void OnSandBoxAction(); - void OnSandBoxAction(QAction* pAction); + void OnSandBoxAction(QAction* pAction, const QList& SandBoxes); void OnProcessAction(); - void OnProcessAction(QAction* pAction); + void OnProcessAction(QAction* pAction, const QList& Processes); void OnExpanded(const QModelIndex& index) { ChangeExpand(index, true); } void OnCollapsed(const QModelIndex& index) { ChangeExpand(index, false); } @@ -167,4 +167,7 @@ private: int m_iMenuRun; QFileIconProvider m_IconProvider; + + QList m_CurSandBoxes; + QList m_CurProcesses; }; \ No newline at end of file