1.0.19
This commit is contained in:
parent
aa19203702
commit
451491ea9a
15
CHANGELOG.md
15
CHANGELOG.md
|
@ -12,10 +12,23 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||
|
||||
## [1.0.19 / 5.55.19] - 2022-04-??
|
||||
|
||||
### Added
|
||||
- added drag and drop support for groups [#1775](https://github.com/sandboxie-plus/Sandboxie/issues/1775)
|
||||
- added del key support to the box view for all entry types [#1779](https://github.com/sandboxie-plus/Sandboxie/issues/1779)
|
||||
- added warnign when trying to run explorer.exe in a box with OpenCOM [#1716](https://github.com/sandboxie-plus/Sandboxie/issues/1716)
|
||||
|
||||
### Fixed
|
||||
- fixed crash issue in the sandman ui
|
||||
- fixed crash issue in the sandman ui [#1772](https://github.com/sandboxie-plus/Sandboxie/issues/1772)
|
||||
- fixed issue some installers when EnableObjectFiltering is enabled [#1795](https://github.com/sandboxie-plus/Sandboxie/issues/1795)
|
||||
- fixed to allow NtCreateSymbolicLinkObject to be used safely in the sandbox
|
||||
- added workaround for a vivaldi hooking issue [1783](https://github.com/sandboxie-plus/Sandboxie/issues/1783)
|
||||
-- Note: its a very provisional fix hence it can be disabled with UseVivaldiWorkaround=n
|
||||
- fixed registry issue with snapshots [#1782](https://github.com/sandboxie-plus/Sandboxie/issues/1782)
|
||||
- fixed issue with box grouping [#1778](https://github.com/sandboxie-plus/Sandboxie/issues/1778) [#1777](https://github.com/sandboxie-plus/Sandboxie/issues/1777) [#1776](https://github.com/sandboxie-plus/Sandboxie/issues/1776)
|
||||
- fixed more issue with box grouping [#1698](https://github.com/sandboxie-plus/Sandboxie/issues/1698) [#1697](https://github.com/sandboxie-plus/Sandboxie/issues/1697)
|
||||
- fixed issues with snadshot ui [#1696](https://github.com/sandboxie-plus/Sandboxie/issues/1696) [#1695](https://github.com/sandboxie-plus/Sandboxie/issues/1695)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -844,6 +844,16 @@ _FX ULONG_PTR Dll_Ordinal1(
|
|||
Proc_RestartProcessOutOfPcaJob();
|
||||
// does not return
|
||||
}
|
||||
|
||||
//
|
||||
// explorer needs sandboxed COM show warnign and terminate when COM is not sandboxies
|
||||
//
|
||||
|
||||
if (Dll_ImageType == DLL_IMAGE_SHELL_EXPLORER && SbieDll_IsOpenCOM()) {
|
||||
|
||||
SbieApi_Log(2195, NULL);
|
||||
ExitProcess(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -218,6 +218,7 @@ _FX BOOLEAN Gui_InitClass(void)
|
|||
// by forcing Gui_RenameClasses=TRUE in maxthon child processes
|
||||
//
|
||||
|
||||
// $Workaround$ - 3rd party fix
|
||||
if ((! Gui_OpenAllWinClasses) && (! Gui_RenameClasses)
|
||||
&& Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME
|
||||
&& _wcsicmp(Dll_ImageName, L"maxthon.exe") == 0) {
|
||||
|
@ -227,6 +228,22 @@ _FX BOOLEAN Gui_InitClass(void)
|
|||
Gui_RenameClasses = TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// vivaldi somehow screws up its hooks and its trampoline to NtCreateSection
|
||||
// ends up pointing to our RegisterClassW detour function
|
||||
// to work around this issue we disable Gui_RenameClasses for vivaldi.exe
|
||||
//
|
||||
|
||||
// $Workaround$ - 3rd party fix
|
||||
if (Gui_RenameClasses
|
||||
&& Dll_ImageType == DLL_IMAGE_GOOGLE_CHROME
|
||||
&& _wcsicmp(Dll_ImageName, L"vivaldi.exe") == 0
|
||||
&& SbieApi_QueryConfBool(NULL, L"UseVivaldiWorkaround", TRUE)) {
|
||||
|
||||
Gui_RenameClasses = FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// hook functions
|
||||
//
|
||||
|
|
|
@ -379,6 +379,10 @@ SBIE2193 Make sure to delete the sandbox after completing the update process.
|
|||
SBIE2194 MSI installer requires %2 option to be set in the ini, what however weakens the isolation.
|
||||
.
|
||||
|
||||
2195;pop;inf;01
|
||||
SBIE2195 To run Explorer.exe sandboxed the COM must not be Open.
|
||||
.
|
||||
|
||||
2198;pop;inf;01
|
||||
%0
|
||||
.
|
||||
|
|
|
@ -215,6 +215,9 @@ SB_STATUS CSandBox__MoveFolder(const QString& SourcePath, const QString& ParentF
|
|||
|
||||
SB_STATUS CSandBox::RenameBox(const QString& NewName)
|
||||
{
|
||||
if (NewName.compare(m_Name, Qt::CaseInsensitive) == 0)
|
||||
return SB_OK;
|
||||
|
||||
SB_STATUS Status = CSbieAPI::ValidateName(NewName);
|
||||
if (Status.IsError())
|
||||
return Status;
|
||||
|
@ -386,7 +389,7 @@ SB_PROGRESS CSandBox::TakeSnapshot(const QString& Name)
|
|||
if (BoxDataFile.Required)
|
||||
return SB_ERR(SB_SnapCopyDatFail);
|
||||
}
|
||||
else if (BoxDataFile.Required) // this one is incremental, hence delete it from the copy root, after it was copied to the snapshot
|
||||
else if (BoxDataFile.Recursive) // this one is incremental, hence delete it from the copy root, after it was copied to the snapshot
|
||||
QFile::remove(m_FilePath + "\\" + BoxDataFile.Name);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ CSbieModel::CSbieModel(QObject *parent)
|
|||
//m_BoxInUse = QIcon(":/BoxInUse");
|
||||
m_ExeIcon = QIcon(":/exeIcon32");
|
||||
|
||||
m_SbieModelMimeType = "application/x-sbie-data";
|
||||
|
||||
m_Root = MkNode(QVariant());
|
||||
}
|
||||
|
||||
|
@ -68,6 +70,11 @@ QString CSbieModel__AddGroupMark(const QString& Name)
|
|||
return Name.isEmpty() ? "" : ("!" + Name);
|
||||
}
|
||||
|
||||
bool CSbieModel__HasGroupMark(const QString& Name)
|
||||
{
|
||||
return Name.left(1) == "!";
|
||||
}
|
||||
|
||||
QString CSbieModel__RemoveGroupMark(const QString& Name)
|
||||
{
|
||||
return Name.left(1) == "!" ? Name.mid(1) : Name;
|
||||
|
@ -410,6 +417,20 @@ CBoxedProcessPtr CSbieModel::GetProcess(const QModelIndex &index) const
|
|||
return pNode->pProcess;
|
||||
}
|
||||
|
||||
QString CSbieModel::GetGroup(const QModelIndex& index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QString();
|
||||
|
||||
SSandBoxNode* pNode = static_cast<SSandBoxNode*>(index.internalPointer());
|
||||
ASSERT(pNode);
|
||||
|
||||
if(!CSbieModel__HasGroupMark(pNode->ID.toString()))
|
||||
return QString();
|
||||
|
||||
return pNode->ID.toString();
|
||||
}
|
||||
|
||||
QVariant CSbieModel::GetID(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
|
@ -466,3 +487,50 @@ QVariant CSbieModel::headerData(int section, Qt::Orientation orientation, int ro
|
|||
{
|
||||
return g_ExeIcon;
|
||||
}*/
|
||||
|
||||
Qt::ItemFlags CSbieModel::flags(const QModelIndex& index) const
|
||||
{
|
||||
Qt::ItemFlags Flags = CTreeItemModel::flags(index);
|
||||
|
||||
Flags |= Qt::ItemIsDragEnabled;
|
||||
|
||||
SSandBoxNode* pNode = static_cast<SSandBoxNode*>(index.internalPointer());
|
||||
if (!pNode || (pNode && CSbieModel__HasGroupMark(pNode->ID.toString())) || pNode == m_Root)
|
||||
Flags |= Qt::ItemIsDropEnabled;
|
||||
|
||||
return Flags;
|
||||
}
|
||||
|
||||
QMimeData* CSbieModel::mimeData(const QModelIndexList &indexes) const
|
||||
{
|
||||
QStringList Boxes;
|
||||
for (int i = 0; i < indexes.count(); i++) {
|
||||
if (indexes[i].column() != 0)
|
||||
continue;
|
||||
SSandBoxNode* pNode = static_cast<SSandBoxNode*>(indexes[i].internalPointer());
|
||||
Boxes.append(pNode->ID.toString());
|
||||
}
|
||||
|
||||
QMimeData *data = new QMimeData();
|
||||
data->setData(m_SbieModelMimeType, Boxes.join(",").toLatin1());
|
||||
return data;
|
||||
}
|
||||
|
||||
bool CSbieModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) {
|
||||
|
||||
QStringList Boxes = QString::fromLatin1(data->data(m_SbieModelMimeType)).split(",");
|
||||
QString To = ""; // root
|
||||
|
||||
SSandBoxNode* pNode = static_cast<SSandBoxNode*>(parent.internalPointer());
|
||||
if (pNode)
|
||||
To = CSbieModel__RemoveGroupMark(pNode->ID.toString());
|
||||
|
||||
foreach(const QString & Name, Boxes) {
|
||||
if(CSbieModel__HasGroupMark(Name))
|
||||
MoveGroup(CSbieModel__RemoveGroupMark(Name), To);
|
||||
else
|
||||
MoveBox(Name, To);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
#include "../SbiePlusAPI.h"
|
||||
#include "../SbieProcess.h"
|
||||
#include "../../MiscHelpers/Common/TreeItemModel.h"
|
||||
#include <QMimeData>
|
||||
|
||||
|
||||
class CSbieModel : public CTreeItemModel
|
||||
|
@ -17,6 +18,7 @@ public:
|
|||
|
||||
CSandBoxPtr GetSandBox(const QModelIndex &index) const;
|
||||
CBoxedProcessPtr GetProcess(const QModelIndex &index) const;
|
||||
QString GetGroup(const QModelIndex &index) const;
|
||||
QVariant GetID(const QModelIndex &index) const;
|
||||
|
||||
enum ETypes
|
||||
|
@ -27,6 +29,13 @@ public:
|
|||
eProcess
|
||||
} GetType(const QModelIndex &index) const;
|
||||
|
||||
Qt::DropActions supportedDropActions() const { return Qt::MoveAction; }
|
||||
Qt::ItemFlags flags(const QModelIndex& index) const;
|
||||
QStringList mimeTypes() { return QStringList() << m_SbieModelMimeType; }
|
||||
QMimeData* mimeData(const QModelIndexList& indexes) const;
|
||||
bool canDropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) const { return true; }
|
||||
bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
|
||||
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
|
||||
|
@ -42,6 +51,10 @@ public:
|
|||
eCount
|
||||
};
|
||||
|
||||
signals:
|
||||
void MoveBox(const QString& Name, const QString& To);
|
||||
void MoveGroup(const QString& Name, const QString& To);
|
||||
|
||||
protected:
|
||||
bool Sync(const CSandBoxPtr& pBox, const QList<QVariant>& Path, const QMap<quint32, CBoxedProcessPtr>& ProcessList, QMap<QList<QVariant>, QList<STreeNode*> >& New, QHash<QVariant, STreeNode*>& Old, QList<QVariant>& Added);
|
||||
|
||||
|
@ -77,4 +90,6 @@ private:
|
|||
//QIcon m_BoxEmpty;
|
||||
//QIcon m_BoxInUse;
|
||||
QIcon m_ExeIcon;
|
||||
|
||||
QString m_SbieModelMimeType;
|
||||
};
|
|
@ -45,6 +45,8 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent)
|
|||
m_pSbieTree->setModel(m_pSortProxy);
|
||||
((CSortFilterProxyModel*)m_pSortProxy)->setView(m_pSbieTree);
|
||||
|
||||
m_pSbieTree->setDragDropMode(QAbstractItemView::InternalMove);
|
||||
|
||||
m_pSbieTree->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
m_pSbieTree->setSortingEnabled(true);
|
||||
//m_pSbieTree->setSortingEnabled(false);
|
||||
|
@ -63,6 +65,9 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent)
|
|||
|
||||
//connect(theGUI, SIGNAL(ReloadPanels()), m_pSbieModel, SLOT(Clear()));
|
||||
|
||||
connect(m_pSbieModel, SIGNAL(MoveBox(const QString&, const QString&)), this, SLOT(OnMoveItem(const QString&, const QString&)));
|
||||
connect(m_pSbieModel, SIGNAL(MoveGroup(const QString&, const QString&)), this, SLOT(OnMoveItem(const QString&, const QString&)));
|
||||
|
||||
//m_pSbieTree->setStyleSheet("QTreeView::item:focus {selection-background-color: yellow;}");
|
||||
//m_pSbieTree->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
|
@ -150,16 +155,16 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent)
|
|||
//UpdateRunMenu();
|
||||
|
||||
m_pMenuTerminate = m_pMenu->addAction(CSandMan::GetIcon("Remove"), tr("Terminate"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuTerminate->setShortcut(QKeySequence::Delete);
|
||||
m_pMenuTerminate->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
//m_pMenuTerminate->setShortcut(QKeySequence::Delete);
|
||||
//m_pMenuTerminate->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
this->addAction(m_pMenuTerminate);
|
||||
m_pMenuLinkTo = m_pMenu->addAction(CSandMan::GetIcon("MkLink"), tr("Create Shortcut"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuPreset = m_pMenu->addMenu(CSandMan::GetIcon("Presets"), tr("Preset"));
|
||||
m_pMenuPinToRun = m_pMenuPreset->addAction(tr("Pin to Run Menu"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuPinToRun->setCheckable(true);
|
||||
m_pMenuBlackList = m_pMenuPreset->addAction(tr("Block and Terminate"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuBlackList->setShortcut(QKeySequence("Shift+Del"));
|
||||
m_pMenuBlackList->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
//m_pMenuBlackList->setShortcut(QKeySequence("Shift+Del"));
|
||||
//m_pMenuBlackList->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
this->addAction(m_pMenuBlackList);
|
||||
m_pMenuAllowInternet = m_pMenuPreset->addAction(tr("Allow internet access"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuAllowInternet->setCheckable(true);
|
||||
|
@ -173,6 +178,12 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent)
|
|||
//m_pMenuResume = m_pMenu->addAction(tr("Resume"), this, SLOT(OnProcessAction()));
|
||||
m_iMenuProc = m_pMenu->actions().count();
|
||||
|
||||
m_pRemove = new QAction(this);
|
||||
m_pRemove->setShortcut(QKeySequence::Delete);
|
||||
m_pRemove->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
this->addAction(m_pRemove);
|
||||
connect(m_pRemove, SIGNAL(triggered()), this, SLOT(OnRemoveItem()));
|
||||
|
||||
|
||||
// menu for the tray
|
||||
m_pMenu2 = new QMenu();
|
||||
|
@ -506,11 +517,21 @@ void CSbieView::RenameGroup(const QString OldName, const QString NewName)
|
|||
auto Group = m_Groups.take(OldName);
|
||||
m_Groups.insert(NewName, Group);
|
||||
|
||||
RenameItem(OldName, NewName);
|
||||
}
|
||||
|
||||
bool CSbieView::RenameItem(const QString OldName, const QString NewName)
|
||||
{
|
||||
if (m_Groups.contains(NewName))
|
||||
return false;
|
||||
|
||||
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I)
|
||||
{
|
||||
if (I.value().removeOne(OldName))
|
||||
I.value().append(NewName);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString CSbieView__SerializeGroup(QMap<QString, QStringList>& m_Groups, const QString& Parent = "", QSet<QString> Test = QSet<QString>())
|
||||
|
@ -571,26 +592,23 @@ QStringList CSbieView::GetSelectedGroups(bool bAndBoxes)
|
|||
|
||||
void CSbieView::OnGroupAction()
|
||||
{
|
||||
QAction* Action = qobject_cast<QAction*>(sender());
|
||||
OnGroupAction(qobject_cast<QAction*>(sender()));
|
||||
}
|
||||
|
||||
if (Action == m_pNewBox)
|
||||
void CSbieView::OnGroupAction(QAction* Action)
|
||||
{
|
||||
if (Action == m_pNewBox || Action == m_pAddGroupe)
|
||||
{
|
||||
QString Name = AddNewBox();
|
||||
QStringList List = GetSelectedGroups();
|
||||
|
||||
QString Name = Action == m_pNewBox ? AddNewBox() : AddNewGroup();
|
||||
if (Name.isEmpty())
|
||||
return;
|
||||
|
||||
QStringList List = GetSelectedGroups();
|
||||
if (List.isEmpty())
|
||||
return;
|
||||
|
||||
m_Groups[List.first()].append(Name);
|
||||
|
||||
m_pSbieModel->Clear(); //todo improve that
|
||||
}
|
||||
else if (Action == m_pAddGroupe)
|
||||
{
|
||||
AddNewGroup();
|
||||
return;
|
||||
m_Groups[List.first()].append(Name);
|
||||
}
|
||||
else if (Action == m_pRenGroupe)
|
||||
{
|
||||
|
@ -603,14 +621,10 @@ void CSbieView::OnGroupAction()
|
|||
QString Value = QInputDialog::getText(this, "Sandboxie-Plus", tr("Please enter a new name for the Group."), QLineEdit::Normal, OldValue);
|
||||
if (Value.isEmpty() || Value == OldValue)
|
||||
return;
|
||||
if (m_Groups.contains(Value)) {
|
||||
QMessageBox("Sandboxie-Plus", tr("This Group name is already in use."), QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton, this).exec();
|
||||
if (!TestNameAndWarn(Value))
|
||||
return;
|
||||
}
|
||||
|
||||
RenameGroup(OldValue, Value);
|
||||
|
||||
m_pSbieModel->Clear(); //todo improve that
|
||||
RenameGroup(OldValue, Value);
|
||||
}
|
||||
else if (Action == m_pDelGroupe)
|
||||
{
|
||||
|
@ -636,8 +650,6 @@ void CSbieView::OnGroupAction()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_pSbieModel->Clear(); //todo improve that, also move boxes to grant parent?
|
||||
}
|
||||
else if (Action == m_pMenuMoveUp /*|| Action == m_pMenuMoveBy*/ || Action == m_pMenuMoveDown)
|
||||
{
|
||||
|
@ -685,23 +697,29 @@ void CSbieView::OnGroupAction()
|
|||
continue;
|
||||
}
|
||||
|
||||
// remove from old
|
||||
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I)
|
||||
I.value().removeAll(Name);
|
||||
|
||||
// add to new
|
||||
m_Groups[Group].append(Name);
|
||||
MoveItem(Name, Group);
|
||||
}
|
||||
|
||||
m_pSbieModel->Clear(); //todo improve that
|
||||
}
|
||||
|
||||
if (!(Action == m_pMenuMoveUp /*|| Action == m_pMenuMoveBy*/ || Action == m_pMenuMoveDown))
|
||||
m_pSbieModel->Clear(); //todo improve that
|
||||
|
||||
//m_UserConfigChanged = true;
|
||||
UpdateGroupMenu();
|
||||
|
||||
SaveUserConfig();
|
||||
}
|
||||
|
||||
void CSbieView::MoveItem(const QString& Name, const QString& To)
|
||||
{
|
||||
// remove from old
|
||||
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I)
|
||||
I.value().removeAll(Name);
|
||||
|
||||
// add to new
|
||||
m_Groups[To].append(Name);
|
||||
}
|
||||
|
||||
QString CSbieView::AddNewBox()
|
||||
{
|
||||
CNewBoxWindow NewBoxWindow(this);
|
||||
|
@ -722,6 +740,9 @@ QString CSbieView::AddNewGroup()
|
|||
QString Name = QInputDialog::getText(this, "Sandboxie-Plus", tr("Please enter a new group name"), QLineEdit::Normal);
|
||||
if (Name.isEmpty() || m_Groups.contains(Name))
|
||||
return "";
|
||||
if (!TestNameAndWarn(Name))
|
||||
return "";
|
||||
|
||||
m_Groups[Name] = QStringList();
|
||||
|
||||
QModelIndex ModelIndex = m_pSortProxy->mapToSource(m_pSbieTree->currentIndex());
|
||||
|
@ -740,6 +761,21 @@ QString CSbieView::AddNewGroup()
|
|||
return Name;
|
||||
}
|
||||
|
||||
bool CSbieView::TestNameAndWarn(const QString& Name)
|
||||
{
|
||||
if (m_Groups.contains(Name)) {
|
||||
QMessageBox::critical(this, "Sandboxie-Plus", tr("This name is already used for a Box Group."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!theAPI->GetBoxByName(QString(Name).replace(" ", "_")).isNull()) {
|
||||
QMessageBox::critical(this, "Sandboxie-Plus", tr("This name is already used for a Sandbox."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSbieView::OnSandBoxAction()
|
||||
{
|
||||
OnSandBoxAction(qobject_cast<QAction*>(sender()));
|
||||
|
@ -979,9 +1015,12 @@ void CSbieView::OnSandBoxAction(QAction* Action)
|
|||
QString Value = QInputDialog::getText(this, "Sandboxie-Plus", tr("Please enter a new name for the Sandbox."), QLineEdit::Normal, OldValue);
|
||||
if (Value.isEmpty() || Value == OldValue)
|
||||
return;
|
||||
if (!TestNameAndWarn(Value))
|
||||
return;
|
||||
|
||||
Results.append((SandBoxes.first()->RenameBox(Value.replace(" ", "_"))));
|
||||
|
||||
RenameGroup(OldValue, Value);
|
||||
RenameItem(OldValue, Value);
|
||||
}
|
||||
else if (Action == m_pMenuRecover)
|
||||
{
|
||||
|
@ -1112,12 +1151,16 @@ void CSbieView::OnSandBoxAction(QAction* Action)
|
|||
}
|
||||
|
||||
void CSbieView::OnProcessAction()
|
||||
{
|
||||
OnProcessAction(qobject_cast<QAction*>(sender()));
|
||||
}
|
||||
|
||||
void CSbieView::OnProcessAction(QAction* Action)
|
||||
{
|
||||
QList<SB_STATUS> Results;
|
||||
|
||||
QList<CBoxedProcessPtr> Processes = CSbieView::GetSelectedProcesses();
|
||||
|
||||
QAction* Action = qobject_cast<QAction*>(sender());
|
||||
if (Action == m_pMenuTerminate || Action == m_pMenuBlackList)
|
||||
{
|
||||
if (theConf->GetInt("Options/WarnTerminate", -1) == -1)
|
||||
|
@ -1418,4 +1461,26 @@ void CSbieView::SaveUserConfig()
|
|||
theAPI->GetUserSettings()->SetText("BoxDisplayOrder", Grouping);
|
||||
|
||||
theAPI->GetUserSettings()->SetText("BoxCollapsedView", m_Collapsed.toList().join(","));
|
||||
}
|
||||
|
||||
void CSbieView::OnMoveItem(const QString& Name, const QString& To)
|
||||
{
|
||||
MoveItem(Name, To);
|
||||
|
||||
m_pSbieModel->Clear(); //todo improve that
|
||||
|
||||
//m_UserConfigChanged = true;
|
||||
UpdateGroupMenu();
|
||||
|
||||
SaveUserConfig();
|
||||
}
|
||||
|
||||
void CSbieView::OnRemoveItem()
|
||||
{
|
||||
if (!GetSelectedProcesses().isEmpty())
|
||||
OnProcessAction(m_pMenuTerminate);
|
||||
else if (!GetSelectedBoxes().isEmpty())
|
||||
OnSandBoxAction(m_pMenuRemove);
|
||||
else if (!GetSelectedGroups().isEmpty())
|
||||
OnGroupAction(m_pDelGroupe);
|
||||
}
|
|
@ -21,6 +21,7 @@ public:
|
|||
|
||||
virtual QString AddNewBox();
|
||||
virtual QString AddNewGroup();
|
||||
virtual bool TestNameAndWarn(const QString& Name);
|
||||
virtual void SelectBox(const QString& Name);
|
||||
|
||||
virtual void PopUpMenu(const QString& Name);
|
||||
|
@ -43,13 +44,19 @@ private slots:
|
|||
void ProcessSelection(const QItemSelection& selected, const QItemSelection& deselected);
|
||||
|
||||
void OnGroupAction();
|
||||
void OnGroupAction(QAction* pAction);
|
||||
void OnSandBoxAction();
|
||||
void OnSandBoxAction(QAction* pAction);
|
||||
void OnProcessAction();
|
||||
void OnProcessAction(QAction* pAction);
|
||||
|
||||
void OnExpanded(const QModelIndex& index) { ChangeExpand(index, true); }
|
||||
void OnCollapsed(const QModelIndex& index) { ChangeExpand(index, false); }
|
||||
|
||||
void OnMoveItem(const QString& Name, const QString& To);
|
||||
|
||||
void OnRemoveItem();
|
||||
|
||||
protected:
|
||||
virtual void OnMenu(const QPoint& Point);
|
||||
virtual QTreeView* GetView() { return m_pSbieTree; }
|
||||
|
@ -66,6 +73,9 @@ private:
|
|||
bool UpdateMenu();
|
||||
void UpdateGroupMenu();
|
||||
void RenameGroup(const QString OldName, const QString NewName);
|
||||
bool RenameItem(const QString OldName, const QString NewName);
|
||||
|
||||
void MoveItem(const QString& Name, const QString& To);
|
||||
|
||||
QString FindParent(const QString& Name);
|
||||
bool IsParentOf(const QString& Name, const QString& Group);
|
||||
|
@ -139,5 +149,7 @@ private:
|
|||
//QAction* m_pMenuResume;
|
||||
int m_iMenuProc;
|
||||
|
||||
QAction* m_pRemove;
|
||||
|
||||
int m_iMenuRun;
|
||||
};
|
|
@ -107,7 +107,7 @@ CMonitorList::CMonitorList(QWidget* parent)
|
|||
m_pTreeList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
m_pMonitorModel = new CMonitorModel();
|
||||
connect(m_pMonitorModel, SIGNAL(NewBranche()), this, SLOT(UpdateFilters()));
|
||||
//connect(m_pMonitorModel, SIGNAL(NewBranche()), this, SLOT(UpdateFilters()));
|
||||
|
||||
m_pSortProxy = new CSortFilterProxyModel(false, this);
|
||||
m_pSortProxy->setSortRole(Qt::EditRole);
|
||||
|
|
|
@ -69,10 +69,13 @@ void CNewBoxWindow::OnBoxTypChanged()
|
|||
void CNewBoxWindow::CreateBox()
|
||||
{
|
||||
m_Name = ui.txtName->text();
|
||||
m_Name.replace(" ", "_");
|
||||
|
||||
int BoxType = ui.cmbBoxType->currentData().toInt();
|
||||
|
||||
if (!theGUI->GetBoxView()->TestNameAndWarn(m_Name))
|
||||
return;
|
||||
|
||||
m_Name.replace(" ", "_");
|
||||
|
||||
SB_STATUS Status = theAPI->CreateBox(m_Name, true);
|
||||
|
||||
if (!Status.IsError())
|
||||
|
|
|
@ -179,10 +179,7 @@ void CSnapshotsWindow::OnTakeSnapshot()
|
|||
|
||||
void CSnapshotsWindow::OnSelectSnapshot()
|
||||
{
|
||||
QModelIndex Index = ui.treeSnapshots->currentIndex();
|
||||
//QModelIndex ModelIndex = m_pSortProxy->mapToSource(Index);
|
||||
//QVariant ID = m_pSnapshotModel->GetItemID(ModelIndex);
|
||||
QVariant ID = m_pSnapshotModel->GetItemID(Index);
|
||||
QVariant ID = GetCurrentItem();
|
||||
|
||||
SelectSnapshot(ID.toString());
|
||||
}
|
||||
|
@ -202,10 +199,7 @@ void CSnapshotsWindow::SelectSnapshot(const QString& ID)
|
|||
|
||||
void CSnapshotsWindow::OnChangeDefault()
|
||||
{
|
||||
QModelIndex Index = ui.treeSnapshots->currentIndex();
|
||||
//QModelIndex ModelIndex = m_pSortProxy->mapToSource(Index);
|
||||
//QVariant ID = m_pSnapshotModel->GetItemID(ModelIndex);
|
||||
QVariant ID = m_pSnapshotModel->GetItemID(Index);
|
||||
QVariant ID = GetCurrentItem();
|
||||
|
||||
if (ui.chkDefault->isChecked())
|
||||
m_DefaultSnapshot = ID.toString();
|
||||
|
@ -217,12 +211,19 @@ void CSnapshotsWindow::OnChangeDefault()
|
|||
UpdateSnapshots();
|
||||
}
|
||||
|
||||
void CSnapshotsWindow::OnRemoveSnapshot()
|
||||
QVariant CSnapshotsWindow::GetCurrentItem()
|
||||
{
|
||||
QModelIndex Index = ui.treeSnapshots->currentIndex();
|
||||
if (!Index.isValid() && !ui.treeSnapshots->selectionModel()->selectedIndexes().isEmpty())
|
||||
Index = ui.treeSnapshots->selectionModel()->selectedIndexes().first();
|
||||
//QModelIndex ModelIndex = m_pSortProxy->mapToSource(Index);
|
||||
//QVariant ID = m_pSnapshotModel->GetItemID(ModelIndex);
|
||||
QVariant ID = m_pSnapshotModel->GetItemID(Index);
|
||||
return m_pSnapshotModel->GetItemID(Index);
|
||||
}
|
||||
|
||||
void CSnapshotsWindow::OnRemoveSnapshot()
|
||||
{
|
||||
QVariant ID = GetCurrentItem();
|
||||
|
||||
if (QMessageBox("Sandboxie-Plus", tr("Do you really want to delete the selected snapshot?"), QMessageBox::Question, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape, QMessageBox::NoButton, this).exec() != QMessageBox::Yes)
|
||||
return;
|
||||
|
|
|
@ -39,6 +39,8 @@ protected:
|
|||
void SelectSnapshot(const QString& ID);
|
||||
void HandleResult(SB_PROGRESS Status);
|
||||
|
||||
QVariant GetCurrentItem();
|
||||
|
||||
CSandBoxPtr m_pBox;
|
||||
QString m_CurSnapshot;
|
||||
QString m_DefaultSnapshot;
|
||||
|
|
Loading…
Reference in New Issue