1.7.1
This commit is contained in:
parent
ae7a92d65a
commit
a89d87badc
|
@ -16,6 +16,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||
- the SandMan UI now indicates if a sandboxed process has a Elevated(Admin) or System token
|
||||
- DropAdminRights can now be configured per process [#2293](https://github.com/sandboxie-plus/Sandboxie/issues/2293)
|
||||
- added self removing boxes [#1936](https://github.com/sandboxie-plus/Sandboxie/issues/1936)
|
||||
- added Ctrl+F search filter to the box picker dialog, this allows quickly to find a particular box
|
||||
|
||||
|
||||
### Changed
|
||||
- refactored network blocking code in driver
|
||||
|
|
|
@ -366,6 +366,20 @@ void COptionsWindow::OnBrowseFolder()
|
|||
OnOptChanged();
|
||||
}
|
||||
|
||||
QString COptionsWindow::ExpandPath(EAccessType Type, const QString& Path)
|
||||
{
|
||||
QString sPath = Path;
|
||||
if (CSandBox* pBox = qobject_cast<CSandBox*>(m_pBox.data()))
|
||||
sPath = theAPI->Nt2DosPath(pBox->Expand(sPath));
|
||||
if ((Type == eFile || Type == eKey) && !sPath.isEmpty()) {
|
||||
if (sPath.left(1) == "|")
|
||||
return sPath.mid(1);
|
||||
else if (!sPath.contains("*") && sPath.right(1) != "*")
|
||||
return sPath + "*";
|
||||
}
|
||||
return sPath;
|
||||
}
|
||||
|
||||
void COptionsWindow::AddAccessEntry(EAccessType Type, EAccessMode Mode, QString Program, const QString& Path, bool disabled, const QString& Template)
|
||||
{
|
||||
QTreeWidgetItem* pItem = new QTreeWidgetItem();
|
||||
|
@ -395,12 +409,7 @@ void COptionsWindow::AddAccessEntry(EAccessType Type, EAccessMode Mode, QString
|
|||
// Prepending '|' disables this behaviour
|
||||
//
|
||||
|
||||
QString sPath = Path;
|
||||
if (Type == eFile || Type == eKey) {
|
||||
if (!sPath.isEmpty() && sPath.left(1) != "|" && !sPath.contains("*") && sPath.right(1) != "*")
|
||||
sPath.append("*");
|
||||
}
|
||||
pItem->setText(3, sPath);
|
||||
pItem->setText(3, ExpandPath(Type, Path));
|
||||
pItem->setData(3, Qt::UserRole, Path);
|
||||
|
||||
if(Template.isEmpty())
|
||||
|
@ -554,11 +563,12 @@ void COptionsWindow::CloseAccessEdit(QTreeWidgetItem* pItem, bool bSave)
|
|||
Path = "*";
|
||||
}
|
||||
|
||||
EAccessType Type = (EAccessType)pItem->data(0, Qt::UserRole).toInt();
|
||||
pItem->setText(1, (pNot->isChecked() ? "NOT " : "") + pCombo->currentText());
|
||||
pItem->setData(1, Qt::UserRole, (pNot->isChecked() ? "!" : "") + Program);
|
||||
pItem->setText(2, GetAccessModeStr(Mode));
|
||||
pItem->setData(2, Qt::UserRole, (int)Mode);
|
||||
pItem->setText(3, Path);
|
||||
pItem->setText(3, ExpandPath(Type, Path));
|
||||
pItem->setData(3, Qt::UserRole, Path);
|
||||
|
||||
m_AccessChanged = true;
|
||||
|
|
|
@ -78,8 +78,11 @@ void COptionsWindow::LoadRecIgnoreListTmpl(bool bUpdate)
|
|||
void COptionsWindow::AddRecoveryEntry(const QString& Name, const QString& Template)
|
||||
{
|
||||
QTreeWidgetItem* pItem = new QTreeWidgetItem();
|
||||
pItem->setText(0, Name + (Template.isEmpty() ? "" : " (" + Template + ")"));
|
||||
pItem->setData(0, Qt::UserRole, Template.isEmpty() ? 0 : -1);
|
||||
QString sName = Name;
|
||||
if (CSandBox* pBox = qobject_cast<CSandBox*>(m_pBox.data()))
|
||||
sName = theAPI->Nt2DosPath(pBox->Expand(sName));
|
||||
pItem->setText(0, sName + (Template.isEmpty() ? "" : " (" + Template + ")"));
|
||||
pItem->setData(0, Qt::UserRole, Template.isEmpty() ? QVariant(Name) : QVariant(-1));
|
||||
ui.treeRecovery->addTopLevelItem(pItem);
|
||||
}
|
||||
|
||||
|
@ -87,7 +90,7 @@ void COptionsWindow::AddRecIgnoreEntry(const QString& Name, const QString& Templ
|
|||
{
|
||||
QTreeWidgetItem* pItem = new QTreeWidgetItem();
|
||||
pItem->setText(0, Name + (Template.isEmpty() ? "" : " (" + Template + ")"));
|
||||
pItem->setData(0, Qt::UserRole, Template.isEmpty() ? 0 : -1);
|
||||
pItem->setData(0, Qt::UserRole, Template.isEmpty() ? QVariant(Name) : QVariant(-1));
|
||||
ui.treeRecIgnore->addTopLevelItem(pItem);
|
||||
}
|
||||
|
||||
|
@ -100,7 +103,7 @@ void COptionsWindow::SaveRecoveryList()
|
|||
int Type = pItem->data(0, Qt::UserRole).toInt();
|
||||
if (Type == -1)
|
||||
continue; // entry from template
|
||||
RecoverFolder.append(pItem->text(0));
|
||||
RecoverFolder.append(pItem->data(0, Qt::UserRole).toString());
|
||||
}
|
||||
WriteTextList("RecoverFolder", RecoverFolder);
|
||||
|
||||
|
@ -113,7 +116,7 @@ void COptionsWindow::SaveRecoveryList()
|
|||
int Type = pItem->data(0, Qt::UserRole).toInt();
|
||||
if (Type == -1)
|
||||
continue; // entry from template
|
||||
AutoRecoverIgnore.append(pItem->text(0));
|
||||
AutoRecoverIgnore.append(pItem->data(0, Qt::UserRole).toString());
|
||||
}
|
||||
WriteTextList("AutoRecoverIgnore", AutoRecoverIgnore);
|
||||
|
||||
|
|
|
@ -413,6 +413,7 @@ protected:
|
|||
QString GetAccessModeTip(EAccessMode Mode);
|
||||
void ParseAndAddAccessEntry(EAccessEntry EntryType, const QString& Value, bool disabled = false, const QString& Template = QString());
|
||||
void ParseAndAddAccessEntry(EAccessType Type, EAccessMode Mode, const QString& Value, bool disabled = false, const QString& Template = QString());
|
||||
QString ExpandPath(EAccessType Type, const QString& Path);
|
||||
void AddAccessEntry(EAccessType Type, EAccessMode Mode, QString Program, const QString& Path, bool disabled = false, const QString& Template = QString());
|
||||
QString MakeAccessStr(EAccessType Type, EAccessMode Mode);
|
||||
void SaveAccessList();
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "../MiscHelpers/Common/Settings.h"
|
||||
#include "../SbiePlusAPI.h"
|
||||
#include "../Views/SbieView.h"
|
||||
#include "../MiscHelpers/Common/Finder.h"
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <wtypes.h>
|
||||
|
@ -98,6 +99,42 @@ CSelectBoxWindow::CSelectBoxWindow(const QStringList& Commands, const QString& B
|
|||
|
||||
connect(ui.treeBoxes, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(OnBoxDblClick(QTreeWidgetItem*)));
|
||||
|
||||
QWidget* pWidget = new QWidget();
|
||||
QVBoxLayout* pLayout = new QVBoxLayout(pWidget);
|
||||
pLayout->setContentsMargins(0, 0, 0, 0);
|
||||
pLayout->addWidget(new CFinder(this, pWidget, 0));
|
||||
ui.treeBoxes->parentWidget()->layout()->replaceWidget(ui.treeBoxes, pWidget);
|
||||
pLayout->insertWidget(0, ui.treeBoxes);
|
||||
|
||||
LoadBoxed("", BoxName);
|
||||
|
||||
ui.treeBoxes->setFocus();
|
||||
|
||||
//ui.treeBoxes->sortByColumn(0, Qt::AscendingOrder);
|
||||
|
||||
//restoreGeometry(theConf->GetBlob("SelectBoxWindow/Window_Geometry"));
|
||||
}
|
||||
|
||||
CSelectBoxWindow::~CSelectBoxWindow()
|
||||
{
|
||||
//theConf->SetBlob("SelectBoxWindow/Window_Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
void CSelectBoxWindow::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
//emit Closed();
|
||||
this->deleteLater();
|
||||
}
|
||||
|
||||
void CSelectBoxWindow::SetFilter(const QString& Exp, int iOptions, int Column)
|
||||
{
|
||||
LoadBoxed(Exp);
|
||||
}
|
||||
|
||||
void CSelectBoxWindow::LoadBoxed(const QString& Filter, const QString& SelectBox)
|
||||
{
|
||||
ui.treeBoxes->clear();
|
||||
|
||||
QList<CSandBoxPtr> Boxes = theAPI->GetAllBoxes().values(); // map is sorted by key (box name)
|
||||
QMap<QString, QStringList> Groups = theGUI->GetBoxView()->GetGroups();
|
||||
|
||||
|
@ -118,6 +155,9 @@ CSelectBoxWindow::CSelectBoxWindow(const QStringList& Commands, const QString& B
|
|||
if (!pBox->IsEnabled() || !pBox->GetBool("ShowForRunIn", true))
|
||||
continue;
|
||||
|
||||
if (!Filter.isEmpty() && !pBox->GetName().contains(Filter, Qt::CaseInsensitive))
|
||||
continue;
|
||||
|
||||
CSandBoxPlus* pBoxEx = qobject_cast<CSandBoxPlus*>(pBox.data());
|
||||
|
||||
QTreeWidgetItem* pParent = CSelectBoxWindow__GetBoxParent(Groups, GroupItems, ui.treeBoxes, pBox->GetName());
|
||||
|
@ -139,26 +179,11 @@ CSelectBoxWindow::CSelectBoxWindow(const QStringList& Commands, const QString& B
|
|||
else
|
||||
ui.treeBoxes->addTopLevelItem(pItem);
|
||||
|
||||
if (pBox->GetName().compare(BoxName, Qt::CaseInsensitive) == 0)
|
||||
if (pBox->GetName().compare(SelectBox, Qt::CaseInsensitive) == 0)
|
||||
ui.treeBoxes->setCurrentItem(pItem);
|
||||
}
|
||||
|
||||
ui.treeBoxes->expandAll();
|
||||
|
||||
//ui.treeBoxes->sortByColumn(0, Qt::AscendingOrder);
|
||||
|
||||
//restoreGeometry(theConf->GetBlob("SelectBoxWindow/Window_Geometry"));
|
||||
}
|
||||
|
||||
CSelectBoxWindow::~CSelectBoxWindow()
|
||||
{
|
||||
//theConf->SetBlob("SelectBoxWindow/Window_Geometry", saveGeometry());
|
||||
}
|
||||
|
||||
void CSelectBoxWindow::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
//emit Closed();
|
||||
this->deleteLater();
|
||||
}
|
||||
|
||||
void CSelectBoxWindow::OnBoxType()
|
||||
|
|
|
@ -13,6 +13,8 @@ public:
|
|||
~CSelectBoxWindow();
|
||||
|
||||
private slots:
|
||||
void SetFilter(const QString& Exp, int iOptions, int Column);
|
||||
|
||||
void OnBoxDblClick(QTreeWidgetItem*);
|
||||
void OnBoxType();
|
||||
void OnRun();
|
||||
|
@ -20,6 +22,8 @@ private slots:
|
|||
protected:
|
||||
void closeEvent(QCloseEvent* e);
|
||||
|
||||
void LoadBoxed(const QString& Filter = QString(), const QString& SelectBox = QString());
|
||||
|
||||
QStringList m_Commands;
|
||||
QString m_WrkDir;
|
||||
|
||||
|
|
Loading…
Reference in New Issue