1.1.0
This commit is contained in:
parent
b12128d10b
commit
24a13cc3b3
|
@ -69,7 +69,7 @@ void CSimpleListModel::Sync(QList<QVariantMap> List)
|
|||
Changed = true;
|
||||
ColValue.Raw = Value;
|
||||
|
||||
//ColValue.Formated =
|
||||
//ColValue.Formatted =
|
||||
}
|
||||
|
||||
if(State != Changed)
|
||||
|
@ -195,7 +195,7 @@ QVariant CListItemModel::Data(const QModelIndex &index, int role, int section) c
|
|||
case Qt::DisplayRole:
|
||||
{
|
||||
SListNode::SValue& Value = pNode->Values[section];
|
||||
return Value.Formated.isValid() ? Value.Formated : Value.Raw;
|
||||
return Value.Formatted.isValid() ? Value.Formatted : Value.Raw;
|
||||
}
|
||||
case Qt::EditRole: // sort role
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ protected:
|
|||
struct SValue
|
||||
{
|
||||
QVariant Raw;
|
||||
QVariant Formated;
|
||||
QVariant Formatted;
|
||||
};
|
||||
QVector<SValue> Values;
|
||||
};
|
||||
|
|
|
@ -110,7 +110,7 @@ void CSimpleTreeModel::Sync(const QMap<QVariant, QVariantMap>& List)
|
|||
Changed = true;
|
||||
ColValue.Raw = Value;
|
||||
|
||||
//ColValue.Formated =
|
||||
//ColValue.Formatted =
|
||||
}
|
||||
|
||||
if(State != Changed)
|
||||
|
@ -385,7 +385,7 @@ QVariant CTreeItemModel::NodeData(STreeNode* pNode, int role, int section) const
|
|||
case Qt::DisplayRole:
|
||||
{
|
||||
STreeNode::SValue& Value = pNode->Values[section];
|
||||
return Value.Formated.isValid() ? Value.Formated : Value.Raw;
|
||||
return Value.Formatted.isValid() ? Value.Formatted : Value.Raw;
|
||||
}
|
||||
case Qt::EditRole: // sort role
|
||||
{
|
||||
|
|
|
@ -80,7 +80,7 @@ protected:
|
|||
{
|
||||
QVariant Raw;
|
||||
QVariant SortKey;
|
||||
QVariant Formated;
|
||||
QVariant Formatted;
|
||||
};
|
||||
QVector<SValue> Values;
|
||||
};
|
||||
|
|
|
@ -106,7 +106,7 @@ CBoxBorder::CBoxBorder(CSbieAPI* pApi, QObject* parent) : QObject(parent)
|
|||
SetLayeredWindowAttributes(m->BorderWnd, 0, 192, LWA_ALPHA);
|
||||
::ShowWindow(m->BorderWnd, SW_HIDE);
|
||||
|
||||
m_uTimerID = startTimer(10);
|
||||
m_uTimerID = startTimer(100);
|
||||
}
|
||||
|
||||
CBoxBorder::~CBoxBorder()
|
||||
|
|
|
@ -119,6 +119,13 @@ void CSandBox::UpdateDetails()
|
|||
{
|
||||
}
|
||||
|
||||
void CSandBox::SetBoxPaths(const QString& FilePath, const QString& RegPath, const QString& IpcPath)
|
||||
{
|
||||
m_FilePath = FilePath;
|
||||
m_RegPath = RegPath;
|
||||
m_IpcPath = IpcPath;
|
||||
}
|
||||
|
||||
SB_STATUS CSandBox::RunStart(const QString& Command, bool Elevated)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
@ -140,7 +147,7 @@ SB_STATUS CSandBox::TerminateAll()
|
|||
|
||||
bool CSandBox::IsEmpty() const
|
||||
{
|
||||
return !QDir(m_FilePath).exists();
|
||||
return !QFile::exists(m_FilePath);
|
||||
}
|
||||
|
||||
SB_PROGRESS CSandBox::CleanBox()
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
|
||||
virtual void UpdateDetails();
|
||||
|
||||
virtual void SetBoxPaths(const QString& FilePath, const QString& RegPath, const QString& IpcPath);
|
||||
virtual QString GetFileRoot() const { return m_FilePath; }
|
||||
virtual QString GetRegRoot() const { return m_RegPath; }
|
||||
virtual QString GetIpcRoot() const { return m_IpcPath; }
|
||||
|
@ -54,6 +55,7 @@ public:
|
|||
virtual SB_STATUS RunSandboxed(const QString& Command);
|
||||
virtual SB_STATUS TerminateAll();
|
||||
|
||||
virtual void OpenBox() {}
|
||||
virtual void CloseBox() {}
|
||||
|
||||
virtual bool IsEnabled() const { return m_IsEnabled; }
|
||||
|
|
|
@ -129,7 +129,9 @@ CSbieAPI::CSbieAPI(QObject* parent) : QThread(parent)
|
|||
m_pGlobalSection = new CSbieIni("GlobalSettings", this, this);
|
||||
m_pUserSection = new CSbieIni("UserSettings", this, this); // dummy
|
||||
|
||||
m_IniReLoad = false;
|
||||
m_bReloadPending = false;
|
||||
m_bBoxesDirty = false;
|
||||
|
||||
m_LastTraceEntry = 0;
|
||||
|
||||
|
@ -357,6 +359,7 @@ SB_STATUS CSbieAPI::Disconnect()
|
|||
|
||||
m_SandBoxes.clear();
|
||||
m_BoxedProxesses.clear();
|
||||
m_bBoxesDirty = true;
|
||||
|
||||
emit StatusChanged();
|
||||
return SB_OK;
|
||||
|
@ -786,10 +789,12 @@ SB_STATUS CSbieAPI::TakeOver()
|
|||
return SB_OK;
|
||||
}
|
||||
|
||||
SB_STATUS CSbieAPI::WatchIni(bool bEnable)
|
||||
SB_STATUS CSbieAPI::WatchIni(bool bEnable, bool bReLoad)
|
||||
{
|
||||
if (bEnable)
|
||||
if (bEnable) {
|
||||
m_IniWatcher.addPath(m_IniPath);
|
||||
m_IniReLoad = bReLoad;
|
||||
}
|
||||
else
|
||||
m_IniWatcher.removePath(m_IniPath);
|
||||
return SB_OK;
|
||||
|
@ -807,7 +812,9 @@ void CSbieAPI::OnIniChanged(const QString &path)
|
|||
void CSbieAPI::OnReloadConfig()
|
||||
{
|
||||
m_bReloadPending = false;
|
||||
ReloadConfig();
|
||||
m_bBoxesDirty = true;
|
||||
if (m_IniReLoad)
|
||||
ReloadConfig();
|
||||
}
|
||||
|
||||
typedef struct _FILE_FS_VOLUME_INFORMATION {
|
||||
|
@ -1115,13 +1122,17 @@ quint32 CSbieAPI::GetSessionID() const
|
|||
return m->sessionId;
|
||||
}
|
||||
|
||||
SB_STATUS CSbieAPI::ReloadBoxes(bool bFullUpdate)
|
||||
SB_STATUS CSbieAPI::ReloadBoxes(bool bForceUpdate)
|
||||
{
|
||||
if (bForceUpdate || (!m_bBoxesDirty && !m_IniWatcher.files().isEmpty()))
|
||||
return SB_OK;
|
||||
m_bBoxesDirty = false;
|
||||
|
||||
QMap<QString, CSandBoxPtr> OldSandBoxes = m_SandBoxes;
|
||||
|
||||
for (int i = 0;;i++)
|
||||
{
|
||||
QString BoxName = SbieIniGet(QString(), QString(), (i | CONF_GET_NO_EXPAND));
|
||||
QString BoxName = SbieIniGet(QString(), QString(), (i | CONF_GET_NO_EXPAND | CONF_GET_NO_TEMPLS));
|
||||
if (BoxName.isNull())
|
||||
break;
|
||||
|
||||
|
@ -1134,10 +1145,8 @@ SB_STATUS CSbieAPI::ReloadBoxes(bool bFullUpdate)
|
|||
{
|
||||
pBox = CSandBoxPtr(NewSandBox(BoxName, this));
|
||||
m_SandBoxes.insert(BoxName.toLower(), pBox);
|
||||
UpdateBoxPaths(pBox);
|
||||
}
|
||||
else if(bFullUpdate)
|
||||
UpdateBoxPaths(pBox);
|
||||
UpdateBoxPaths(pBox);
|
||||
|
||||
pBox->m_IsEnabled = bIsEnabled;
|
||||
|
||||
|
@ -1238,6 +1247,8 @@ void CSbieAPI::CommitIniChanges()
|
|||
SbieIniSet("", "", ""); // commit and refresh
|
||||
|
||||
if (bRemoved) m_IniWatcher.addPath(m_IniPath);
|
||||
|
||||
m_bBoxesDirty = true;
|
||||
}
|
||||
|
||||
QString CSbieAPI::SbieIniGetEx(const QString& Section, const QString& Setting)
|
||||
|
@ -1405,6 +1416,12 @@ SB_STATUS CSbieAPI::UpdateProcesses(bool bKeep, bool bAllSessions)
|
|||
if (pBox.isNull())
|
||||
continue;
|
||||
|
||||
if (pBox->m_ActiveProcessCount == 0) {
|
||||
pBox->m_ActiveProcessCount = 1;
|
||||
pBox->OpenBox();
|
||||
emit BoxOpened(pBox->GetName());
|
||||
}
|
||||
|
||||
pProcess->m_pBox = pBox.data();
|
||||
pBox->m_ProcessList.insert(ProcessId, pProcess);
|
||||
m_BoxedProxesses.insert(ProcessId, pProcess);
|
||||
|
@ -1569,9 +1586,11 @@ SB_STATUS CSbieAPI::UpdateBoxPaths(const CSandBoxPtr& pSandBox)
|
|||
if (!Status)
|
||||
return Status;
|
||||
|
||||
pSandBox->m_FilePath = Nt2DosPath(QString::fromWCharArray(FileRoot.c_str(), wcslen(FileRoot.c_str())));
|
||||
pSandBox->m_RegPath = QString::fromWCharArray(KeyRoot.c_str(), wcslen(KeyRoot.c_str()));
|
||||
pSandBox->m_IpcPath = QString::fromWCharArray(IpcRoot.c_str(), wcslen(IpcRoot.c_str()));
|
||||
QString FilePath = Nt2DosPath(QString::fromWCharArray(FileRoot.c_str(), wcslen(FileRoot.c_str())));
|
||||
QString RegPath = QString::fromWCharArray(KeyRoot.c_str(), wcslen(KeyRoot.c_str()));
|
||||
QString IpcPath = QString::fromWCharArray(IpcRoot.c_str(), wcslen(IpcRoot.c_str()));
|
||||
|
||||
pSandBox->SetBoxPaths(FilePath, RegPath, IpcPath);
|
||||
return SB_OK;
|
||||
}
|
||||
|
||||
|
@ -2048,7 +2067,7 @@ SB_STATUS CSbieAPI::ReloadConf(quint32 flags, quint32 SessionId)
|
|||
//emit LogMessage("Sandboxie config has been reloaded.", false);
|
||||
emit LogSbieMessage(0, QStringList() << "Sandboxie config has been reloaded" << "" << "", 4);
|
||||
|
||||
ReloadBoxes(true);
|
||||
m_bBoxesDirty = true;
|
||||
|
||||
return SB_OK;
|
||||
}
|
||||
|
@ -2318,6 +2337,12 @@ CBoxedProcessPtr CSbieAPI::OnProcessBoxed(quint32 ProcessId, const QString& Path
|
|||
if (!pBox)
|
||||
return CBoxedProcessPtr();
|
||||
|
||||
if (pBox->m_ActiveProcessCount == 0) {
|
||||
pBox->m_ActiveProcessCount = 1;
|
||||
pBox->OpenBox();
|
||||
emit BoxOpened(pBox->GetName());
|
||||
}
|
||||
|
||||
pProcess = CBoxedProcessPtr(NewBoxedProcess(ProcessId, pBox.data()));
|
||||
pBox->m_ProcessList.insert(ProcessId, pProcess);
|
||||
m_BoxedProxesses.insert(ProcessId, pProcess);
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
virtual QString GetVersion();
|
||||
|
||||
virtual SB_STATUS TakeOver();
|
||||
virtual SB_STATUS WatchIni(bool bEnable = true);
|
||||
virtual SB_STATUS WatchIni(bool bEnable = true, bool bReLoad = true);
|
||||
|
||||
virtual QString GetSbiePath() const { return m_SbiePath; }
|
||||
virtual QString GetIniPath() const { return m_IniPath; }
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
virtual void UpdateDriveLetters();
|
||||
virtual QString Nt2DosPath(QString NtPath, bool* pOk = NULL) const;
|
||||
|
||||
virtual SB_STATUS ReloadBoxes(bool bFullUpdate = false);
|
||||
virtual SB_STATUS ReloadBoxes(bool bForceUpdate = false);
|
||||
static SB_STATUS ValidateName(const QString& BoxName);
|
||||
virtual SB_STATUS CreateBox(const QString& BoxName, bool bReLoad = true);
|
||||
|
||||
|
@ -158,6 +158,7 @@ signals:
|
|||
void LogSbieMessage(quint32 MsgCode, const QStringList& MsgData, quint32 ProcessId);
|
||||
void ProcessBoxed(quint32 ProcessId, const QString& Path, const QString& Box, quint32 ParentId);
|
||||
void FileToRecover(const QString& BoxName, const QString& FilePath, const QString& BoxPath, quint32 ProcessId);
|
||||
void BoxOpened(const QString& BoxName);
|
||||
void BoxClosed(const QString& BoxName);
|
||||
void NotAuthorized(bool bLoginRequired, bool &bRetry);
|
||||
void QueuedRequest(quint32 ClientPid, quint32 ClientTid, quint32 RequestId, const QVariantMap& Data);
|
||||
|
@ -228,8 +229,9 @@ protected:
|
|||
QString m_SbiePath;
|
||||
QString m_IniPath;
|
||||
QFileSystemWatcher m_IniWatcher;
|
||||
|
||||
bool m_IniReLoad;
|
||||
bool m_bReloadPending;
|
||||
bool m_bBoxesDirty;
|
||||
|
||||
bool m_bWithQueue;
|
||||
bool m_bTerminate;
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
#include "stdafx.h"
|
||||
#include "BoxMonitor.h"
|
||||
#include "MiscHelpers/Common/Common.h"
|
||||
|
||||
CBoxMonitor::CBoxMonitor()
|
||||
{
|
||||
m_bTerminate = false;
|
||||
start();
|
||||
}
|
||||
|
||||
CBoxMonitor::~CBoxMonitor()
|
||||
{
|
||||
m_bTerminate = true;
|
||||
if (!wait(10 * 1000))
|
||||
terminate();
|
||||
}
|
||||
|
||||
void CBoxMonitor::Notify(const wstring& strDirectory)
|
||||
{
|
||||
m_Mutex.lock();
|
||||
m_Boxes[QString::fromStdWString(strDirectory)].Changed = true;
|
||||
m_Mutex.unlock();
|
||||
}
|
||||
|
||||
quint64 CBoxMonitor::CounDirSize(const QString& Directory, SBox* Box)
|
||||
{
|
||||
quint64 TotalSize = 0;
|
||||
if (Box->pBox.isNull() || m_bTerminate)
|
||||
return TotalSize;
|
||||
|
||||
QDir Dir(Directory);
|
||||
foreach(const QFileInfo & Info, Dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot))
|
||||
{
|
||||
if (Info.isDir())
|
||||
TotalSize += CounDirSize(Info.filePath(), Box);
|
||||
else
|
||||
TotalSize += QFile(Info.filePath()).size();
|
||||
}
|
||||
|
||||
return TotalSize;
|
||||
}
|
||||
|
||||
void CBoxMonitor::run()
|
||||
{
|
||||
while (!m_bTerminate)
|
||||
{
|
||||
m_Mutex.lock();
|
||||
QList<QString> Keys = m_Boxes.keys();
|
||||
m_Mutex.unlock();
|
||||
|
||||
quint64 CurTick = GetCurTick();
|
||||
|
||||
foreach(const QString& Key, Keys) {
|
||||
|
||||
m_Mutex.lock();
|
||||
SBox* Box = &m_Boxes[Key];
|
||||
m_Mutex.unlock();
|
||||
|
||||
quint64 MinScanInterval = Box->ScanDuration * 100;
|
||||
if (MinScanInterval < 30 * 1000)
|
||||
MinScanInterval = 30 * 1000;
|
||||
if (MinScanInterval > 30 * 60 * 1000)
|
||||
MinScanInterval = 30 * 60 * 1000;
|
||||
|
||||
if (Box->Changed && (Box->Closed || Box->LastScan == 0 || (CurTick - Box->LastScan) > MinScanInterval)) {
|
||||
|
||||
qDebug() << "Rescanning:" << Key << "(" + QDateTime::currentDateTime().toString() + ")";
|
||||
|
||||
quint64 ScanStart = GetCurTick();
|
||||
|
||||
Box->TotalSize = CounDirSize(Key, Box);
|
||||
|
||||
Box->ScanDuration = GetCurTick() - ScanStart;
|
||||
Box->LastScan = GetCurTick();
|
||||
|
||||
QMetaObject::invokeMethod(this, "UpdateBox", Qt::QueuedConnection,
|
||||
//Q_RETURN_ARG(int, retVal),
|
||||
Q_ARG(QString, Key)
|
||||
);
|
||||
|
||||
Box->Changed = false;
|
||||
}
|
||||
|
||||
m_Mutex.lock();
|
||||
if (Box->pBox.isNull())
|
||||
m_Boxes.remove(Key);
|
||||
m_Mutex.unlock();
|
||||
}
|
||||
|
||||
Sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
void CBoxMonitor::UpdateBox(const QString& Path)
|
||||
{
|
||||
// Note: this functin runs in the main thread
|
||||
|
||||
m_Mutex.lock();
|
||||
SBox Box = m_Boxes.value(Path);
|
||||
m_Mutex.unlock();
|
||||
|
||||
if (Box.pBox)
|
||||
Box.pBox->SetSize(Box.TotalSize);
|
||||
}
|
||||
|
||||
void CBoxMonitor::AddBox(CSandBoxPlus* pBox, bool AndWatch)
|
||||
{
|
||||
QMutexLocker Lock(&m_Mutex);
|
||||
|
||||
m_Boxes[pBox->GetFileRoot()].pBox = pBox;
|
||||
|
||||
if (AndWatch) {
|
||||
m_Boxes[pBox->GetFileRoot()].Closed = false;
|
||||
AddDirectory(pBox->GetFileRoot().toStdWString().c_str(), true, FILE_NOTIFY_CHANGE_SIZE);
|
||||
}
|
||||
else
|
||||
m_Boxes[pBox->GetFileRoot()].Changed = true;
|
||||
}
|
||||
|
||||
void CBoxMonitor::CloseBox(CSandBoxPlus* pBox, bool AndClear)
|
||||
{
|
||||
QMutexLocker Lock(&m_Mutex);
|
||||
|
||||
if(AndClear)
|
||||
m_Boxes[pBox->GetFileRoot()].pBox.clear();
|
||||
m_Boxes[pBox->GetFileRoot()].Closed = true;
|
||||
|
||||
DetachDirectory(pBox->GetFileRoot().toStdWString().c_str());
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
#pragma once
|
||||
|
||||
#include "Helpers/ReadDirectoryChanges.h"
|
||||
#include "SbiePlusAPI.h"
|
||||
|
||||
class CBoxMonitor : public QThread, public CReadDirectoryChanges
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CBoxMonitor();
|
||||
~CBoxMonitor();
|
||||
|
||||
virtual void Notify(const wstring& strDirectory);
|
||||
|
||||
virtual void run();
|
||||
|
||||
void AddBox(CSandBoxPlus* pBox, bool AndWatch = false);
|
||||
void CloseBox(CSandBoxPlus* pBox, bool AndClear = false);
|
||||
|
||||
private slots:
|
||||
void UpdateBox(const QString& Path);
|
||||
|
||||
protected:
|
||||
|
||||
struct SBox
|
||||
{
|
||||
SBox() {
|
||||
Changed = false;
|
||||
Closed = false;
|
||||
LastScan = 0;
|
||||
ScanDuration = 0;
|
||||
TotalSize = 0;
|
||||
}
|
||||
|
||||
QPointer<CSandBoxPlus> pBox;
|
||||
bool Changed;
|
||||
bool Closed;
|
||||
quint64 LastScan;
|
||||
quint64 ScanDuration;
|
||||
|
||||
quint64 TotalSize;
|
||||
};
|
||||
|
||||
quint64 CounDirSize(const QString& Dir, SBox* Box);
|
||||
|
||||
QMutex m_Mutex;
|
||||
QMap<QString, SBox> m_Boxes;
|
||||
bool m_bTerminate;
|
||||
};
|
|
@ -54,6 +54,42 @@
|
|||
<layout class="QGridLayout" name="gridLayout_9">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<item row="11" column="1">
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkNotifications">
|
||||
<property name="text">
|
||||
<string>Show Notifications for relevant log Messages</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
|
@ -68,83 +104,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkAsyncBoxOps">
|
||||
<property name="text">
|
||||
<string>Run box operations asynchronously whenever possible (like content deletion)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="uiLang"/>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkShowRecovery">
|
||||
<property name="text">
|
||||
<string>Show first recovery window when emptying sandboxes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkDarkTheme">
|
||||
<property name="text">
|
||||
<string>Use Dark Theme (fully applied after a restart)</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkWatchConfig">
|
||||
<property name="text">
|
||||
<string>Watch Sandboxie.ini for changes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkNotifications">
|
||||
<property name="text">
|
||||
<string>Show Notifications for relevant log Messages</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="2">
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkNotifyRecovery">
|
||||
<property name="text">
|
||||
<string>Show recoverable files as notifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
|
@ -155,6 +114,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkAsyncBoxOps">
|
||||
<property name="text">
|
||||
<string>Run box operations asynchronously whenever possible (like content deletion)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkSandboxUrls">
|
||||
<property name="text">
|
||||
|
@ -165,6 +131,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkShowRecovery">
|
||||
<property name="text">
|
||||
<string>Show first recovery window when emptying sandboxes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="uiLang"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="font">
|
||||
|
@ -179,6 +155,37 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkDarkTheme">
|
||||
<property name="text">
|
||||
<string>Use Dark Theme (fully applied after a restart)</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkWatchConfig">
|
||||
<property name="text">
|
||||
<string>Watch Sandboxie.ini for changes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkNotifyRecovery">
|
||||
<property name="text">
|
||||
<string>Show recoverable files as notifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkMonitorSize">
|
||||
<property name="text">
|
||||
<string>Count and display the disk space ocupied by each sandbox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -71,8 +71,8 @@ QList<QVariant> CMonitorModel::Sync(const QMap<QString, CMonitorEntryPtr>& Entry
|
|||
|
||||
/*switch (section)
|
||||
{
|
||||
//case eType: ColValue.Formated = ; break;
|
||||
//case eValue: ColValue.Formated = ; break;
|
||||
//case eType: ColValue.Formatted = ; break;
|
||||
//case eValue: ColValue.Formatted = ; break;
|
||||
}*/
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include "SbieModel.h"
|
||||
#include "../../MiscHelpers/Common/Common.h"
|
||||
#include "../../MiscHelpers/Common/IconExtreactor.h"
|
||||
#include <QFileIconProvider>
|
||||
#include "../SandMan.h"
|
||||
|
||||
CSbieModel::CSbieModel(QObject *parent)
|
||||
|
@ -114,6 +113,8 @@ QList<QVariant> CSbieModel::Sync(const QMap<QString, CSandBoxPtr>& BoxList, cons
|
|||
QMap<QList<QVariant>, QList<STreeNode*> > New;
|
||||
QHash<QVariant, STreeNode*> Old = m_Map;
|
||||
|
||||
bool bWatchSize = theConf->GetBool("Options/WatchBoxSize", false);
|
||||
|
||||
foreach(const QString& Group, Groups.keys())
|
||||
{
|
||||
if (Group.isEmpty())
|
||||
|
@ -232,6 +233,7 @@ QList<QVariant> CSbieModel::Sync(const QMap<QString, CSandBoxPtr>& BoxList, cons
|
|||
{
|
||||
case eName: Value = pBox->GetName(); break;
|
||||
case eStatus: Value = pBox.objectCast<CSandBoxPlus>()->GetStatusStr(); break;
|
||||
case eInfo: Value = bWatchSize ? pBox.objectCast<CSandBoxPlus>()->GetSize() : 0; break;
|
||||
case ePath: Value = pBox->GetFileRoot(); break;
|
||||
}
|
||||
|
||||
|
@ -245,7 +247,8 @@ QList<QVariant> CSbieModel::Sync(const QMap<QString, CSandBoxPtr>& BoxList, cons
|
|||
|
||||
switch (section)
|
||||
{
|
||||
case eName: ColValue.Formated = Value.toString().replace("_", " "); break;
|
||||
case eName: ColValue.Formatted = Value.toString().replace("_", " "); break;
|
||||
case eInfo: ColValue.Formatted = Value.toULongLong() > 0 ? FormatSize(Value.toULongLong()) : ""; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,8 +276,6 @@ bool CSbieModel::Sync(const CSandBoxPtr& pBox, const QList<QVariant>& Path, cons
|
|||
|
||||
int ActiveCount = 0;
|
||||
|
||||
QFileIconProvider IconProvider;
|
||||
|
||||
foreach(const CBoxedProcessPtr& pProc, ProcessList)
|
||||
{
|
||||
QSharedPointer<CSbieProcess> pProcess = pProc.objectCast<CSbieProcess>();
|
||||
|
@ -326,7 +327,7 @@ bool CSbieModel::Sync(const CSandBoxPtr& pBox, const QList<QVariant>& Path, cons
|
|||
//else
|
||||
// pNode->Icon = icons.first().pixmap;
|
||||
|
||||
pNode->Icon = IconProvider.icon(QFileInfo(pProcess->GetFileName()));
|
||||
pNode->Icon = m_IconProvider.icon(QFileInfo(pProcess->GetFileName()));
|
||||
if (pNode->Icon.isNull() || !pNode->Icon.isValid())
|
||||
pNode->Icon = m_ExeIcon;
|
||||
Changed = 1;
|
||||
|
@ -345,7 +346,7 @@ bool CSbieModel::Sync(const CSandBoxPtr& pBox, const QList<QVariant>& Path, cons
|
|||
case eStatus: Value = pProcess->GetStatusStr(); break;
|
||||
case eTitle: Value = theAPI->GetProcessTitle(pProcess->GetProcessId()); break;
|
||||
//case eLogCount: break; // todo Value = pProcess->GetResourceLog().count(); break;
|
||||
case eTimeStamp: Value = pProcess->GetTimeStamp(); break;
|
||||
case eInfo: Value = pProcess->GetTimeStamp(); break;
|
||||
//case ePath: Value = pProcess->GetFileName(); break;
|
||||
case ePath: {
|
||||
QString CmdLine = pProcess->GetCommandLine();
|
||||
|
@ -364,9 +365,9 @@ bool CSbieModel::Sync(const CSandBoxPtr& pBox, const QList<QVariant>& Path, cons
|
|||
|
||||
switch (section)
|
||||
{
|
||||
case eProcessId: ColValue.Formated = QString::number(pProcess->GetProcessId()); break;
|
||||
//case eLogCount: ColValue.Formated = QString::number(Value.toInt()); break;
|
||||
case eTimeStamp: ColValue.Formated = pProcess->GetTimeStamp().toString("hh:mm:ss"); break;
|
||||
case eProcessId: ColValue.Formatted = QString::number(pProcess->GetProcessId()); break;
|
||||
//case eLogCount: ColValue.Formatted = QString::number(Value.toInt()); break;
|
||||
case eInfo: ColValue.Formatted = pProcess->GetTimeStamp().toString("hh:mm:ss"); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -475,8 +476,10 @@ QVariant CSbieModel::headerData(int section, Qt::Orientation orientation, int ro
|
|||
case eProcessId: return tr("Process ID");
|
||||
case eStatus: return tr("Status");
|
||||
case eTitle: return tr("Title");
|
||||
case eInfo: return tr("Info");
|
||||
//case eSize: return tr("Size");
|
||||
//case eLogCount: return tr("Log Count");
|
||||
case eTimeStamp: return tr("Start Time");
|
||||
//case eTimeStamp: return tr("Start Time");
|
||||
case ePath: return tr("Path / Command Line");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "../SbieProcess.h"
|
||||
#include "../../MiscHelpers/Common/TreeItemModel.h"
|
||||
#include <QMimeData>
|
||||
|
||||
#include <QFileIconProvider>
|
||||
|
||||
class CSbieModel : public CTreeItemModel
|
||||
{
|
||||
|
@ -45,8 +45,10 @@ public:
|
|||
eProcessId,
|
||||
eTitle,
|
||||
eStatus,
|
||||
eInfo,
|
||||
//eSize,
|
||||
//eLogCount,
|
||||
eTimeStamp,
|
||||
//eTimeStamp,
|
||||
ePath,
|
||||
eCount
|
||||
};
|
||||
|
@ -92,4 +94,5 @@ private:
|
|||
QIcon m_ExeIcon;
|
||||
|
||||
QString m_SbieModelMimeType;
|
||||
QFileIconProvider m_IconProvider;
|
||||
};
|
|
@ -155,20 +155,20 @@ QList<QVariant> CTraceModel::Sync(const QVector<CTraceEntryPtr>& EntryList, int
|
|||
/*case eProcess:
|
||||
{
|
||||
CBoxedProcessPtr pProcess = theAPI->GetProcessById(pEntry->GetProcessId());
|
||||
ColValue.Formated = QString("%1 (%2, %3)").arg(pProcess.isNull() ? tr("Unknown") : pProcess->GetProcessName()).arg(pEntry->GetProcessId()).arg(pEntry->GetThreadId());
|
||||
ColValue.Formatted = QString("%1 (%2, %3)").arg(pProcess.isNull() ? tr("Unknown") : pProcess->GetProcessName()).arg(pEntry->GetProcessId()).arg(pEntry->GetThreadId());
|
||||
break;
|
||||
}
|
||||
case eTimeStamp: ColValue.Formated = pEntry->GetTimeStamp().toString("hh:mm:ss.zzz"); break;*/
|
||||
case eTimeStamp: ColValue.Formatted = pEntry->GetTimeStamp().toString("hh:mm:ss.zzz"); break;*/
|
||||
case eProcess:
|
||||
if(!m_bTree) {
|
||||
QString Name = pEntry->GetProcessName();
|
||||
ColValue.Formated = QString("%1 (%2, %3) - %4").arg(Name.isEmpty() ? tr("Unknown") : Name)
|
||||
ColValue.Formatted = QString("%1 (%2, %3) - %4").arg(Name.isEmpty() ? tr("Unknown") : Name)
|
||||
.arg(pEntry->GetProcessId()).arg(pEntry->GetThreadId()).arg(pEntry->GetTimeStamp().toString("hh:mm:ss.zzz"));
|
||||
} else
|
||||
ColValue.Formated = pEntry->GetTimeStamp().toString("hh:mm:ss.zzz");
|
||||
ColValue.Formatted = pEntry->GetTimeStamp().toString("hh:mm:ss.zzz");
|
||||
break;
|
||||
//case eType: ColValue.Formated = ; break;
|
||||
//case eValue: ColValue.Formated = ; break;
|
||||
//case eType: ColValue.Formatted = ; break;
|
||||
//case eValue: ColValue.Formatted = ; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,9 +252,9 @@ CTraceModel::STreeNode* CTraceModel::MkVirtualNode(const QVariant& Id, STreeNode
|
|||
QString Name = GetProcessName(pid);
|
||||
pNode->Values[0].Raw = pid;
|
||||
if(!Name.isEmpty())
|
||||
pNode->Values[0].Formated = tr("%1 (%2)").arg(Name).arg(pid);
|
||||
pNode->Values[0].Formatted = tr("%1 (%2)").arg(Name).arg(pid);
|
||||
else
|
||||
pNode->Values[0].Formated = tr("Process %1").arg(pid);
|
||||
pNode->Values[0].Formatted = tr("Process %1").arg(pid);
|
||||
}
|
||||
else if (typeId.first == "tid")
|
||||
{
|
||||
|
@ -262,10 +262,10 @@ CTraceModel::STreeNode* CTraceModel::MkVirtualNode(const QVariant& Id, STreeNode
|
|||
quint32 pid = Split2(pParent->ID.toString(), "_").second.toUInt();
|
||||
LogThreadId(pid, tid);
|
||||
pNode->Values[0].Raw = tid;
|
||||
pNode->Values[0].Formated = tr("Thread %1").arg(tid);
|
||||
pNode->Values[0].Formatted = tr("Thread %1").arg(tid);
|
||||
}
|
||||
else*/
|
||||
pNode->Values[0].Raw = pNode->Values[0].Formated = Id;
|
||||
pNode->Values[0].Raw = pNode->Values[0].Formatted = Id;
|
||||
|
||||
return pNode;
|
||||
}
|
||||
|
|
|
@ -386,6 +386,8 @@ void CSandMan::CreateMenus()
|
|||
|
||||
m_pMenuView->addSeparator();
|
||||
|
||||
m_pRefreshAll = m_pMenuView->addAction(CSandMan::GetIcon("Recover"), tr("Refresh View"), this, SLOT(OnRefresh()));
|
||||
|
||||
m_pCleanUpMenu = m_pMenuView->addMenu(CSandMan::GetIcon("Clean"), tr("Clean Up"));
|
||||
m_pCleanUpProcesses = m_pCleanUpMenu->addAction(tr("Cleanup Processes"), this, SLOT(OnCleanUp()));
|
||||
m_pCleanUpMenu->addSeparator();
|
||||
|
@ -1029,8 +1031,10 @@ SB_STATUS CSandMan::DeleteBoxContent(const CSandBoxPtr& pBox, EDelMode Mode, boo
|
|||
Status = pBox->CleanBox();
|
||||
|
||||
Ret = Status;
|
||||
if (Status.GetStatus() == OP_ASYNC)
|
||||
if (Status.GetStatus() == OP_ASYNC) {
|
||||
Ret = AddAsyncOp(Status.GetValue(), true, tr("Auto Deleting %1 Content").arg(pBox->GetName()));
|
||||
pBox.objectCast<CSandBoxPlus>()->UpdateSize();
|
||||
}
|
||||
}
|
||||
|
||||
finish:
|
||||
|
@ -1144,8 +1148,7 @@ void CSandMan::OnStatusChanged()
|
|||
|
||||
OnIniReloaded();
|
||||
|
||||
if (theConf->GetBool("Options/WatchIni", true))
|
||||
theAPI->WatchIni(true);
|
||||
theAPI->WatchIni(true, theConf->GetBool("Options/WatchIni", true));
|
||||
|
||||
if (!theAPI->ReloadCert().IsError()) {
|
||||
CSettingsWindow::LoadCertificate();
|
||||
|
@ -1858,6 +1861,20 @@ void CSandMan::SetViewMode(bool bAdvanced)
|
|||
}
|
||||
}
|
||||
|
||||
void CSandMan::OnRefresh()
|
||||
{
|
||||
if (!theAPI->IsConnected())
|
||||
return;
|
||||
|
||||
theAPI->ReloadBoxes(true);
|
||||
|
||||
if (theConf->GetBool("Options/WatchBoxSize", false)) {
|
||||
QMap<QString, CSandBoxPtr> Boxes = theAPI->GetAllBoxes();
|
||||
foreach(const CSandBoxPtr & pBox, Boxes)
|
||||
pBox.objectCast<CSandBoxPlus>()->UpdateSize();
|
||||
}
|
||||
}
|
||||
|
||||
void CSandMan::OnCleanUp()
|
||||
{
|
||||
if (sender() == m_pCleanUpMsgLog || sender() == m_pCleanUpButton)
|
||||
|
|
|
@ -179,6 +179,7 @@ private slots:
|
|||
|
||||
void OnViewMode(QAction* action);
|
||||
void OnAlwaysTop();
|
||||
void OnRefresh();
|
||||
void OnCleanUp();
|
||||
void OnProcView();
|
||||
|
||||
|
@ -266,6 +267,7 @@ private:
|
|||
QAction* m_pShowHidden;
|
||||
QAction* m_pWndTopMost;
|
||||
int m_iMenuViewPos;
|
||||
QAction* m_pRefreshAll;
|
||||
QMenu* m_pCleanUpMenu;
|
||||
QAction* m_pCleanUpProcesses;
|
||||
QAction* m_pCleanUpMsgLog;
|
||||
|
|
|
@ -8,6 +8,7 @@ HEADERS += ./stdafx.h \
|
|||
./SbiePlusAPI.h \
|
||||
./SbieProcess.h \
|
||||
./BoxJob.h \
|
||||
./BoxMonitor.h \
|
||||
./Models/SbieModel.h \
|
||||
./Models/TraceModel.h \
|
||||
./Models/MonitorModel.h \
|
||||
|
@ -32,6 +33,7 @@ SOURCES += ./main.cpp \
|
|||
./SbiePlusAPI.cpp \
|
||||
./SbieProcess.cpp \
|
||||
./BoxJob.cpp \
|
||||
./BoxMonitor.cpp \
|
||||
./Models/TraceModel.cpp \
|
||||
./Models/MonitorModel.cpp \
|
||||
./Models/SbieModel.cpp \
|
||||
|
|
|
@ -196,8 +196,11 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="BoxJob.cpp" />
|
||||
<ClCompile Include="BoxMonitor.cpp" />
|
||||
<ClCompile Include="Dialogs\MultiErrorDialog.cpp" />
|
||||
<ClCompile Include="Helpers\FindTool.cpp" />
|
||||
<ClCompile Include="Helpers\ReadDirectoryChanges.cpp" />
|
||||
<ClCompile Include="Helpers\ReadDirectoryChangesPrivate.cpp" />
|
||||
<ClCompile Include="Helpers\WinAdmin.cpp" />
|
||||
<ClCompile Include="Helpers\WindowFromPointEx.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
|
@ -253,7 +256,11 @@
|
|||
<QtMoc Include="Dialogs\MultiErrorDialog.h" />
|
||||
<QtMoc Include="BoxJob.h" />
|
||||
<ClInclude Include="..\version.h" />
|
||||
<QtMoc Include="BoxMonitor.h" />
|
||||
<ClInclude Include="Helpers\FindTool.h" />
|
||||
<ClInclude Include="Helpers\ReadDirectoryChanges.h" />
|
||||
<ClInclude Include="Helpers\ReadDirectoryChangesPrivate.h" />
|
||||
<ClInclude Include="Helpers\ThreadSafeQueue.h" />
|
||||
<ClInclude Include="Helpers\WinAdmin.h" />
|
||||
<QtMoc Include="Models\MonitorModel.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
|
|
|
@ -153,6 +153,15 @@
|
|||
<ClCompile Include="Wizards\SetupWizard.cpp">
|
||||
<Filter>Wizards</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Helpers\ReadDirectoryChanges.cpp">
|
||||
<Filter>Helpers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Helpers\ReadDirectoryChangesPrivate.cpp">
|
||||
<Filter>Helpers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BoxMonitor.cpp">
|
||||
<Filter>SandMan</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
|
@ -170,6 +179,15 @@
|
|||
<ClInclude Include="..\version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Helpers\ReadDirectoryChanges.h">
|
||||
<Filter>Helpers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Helpers\ReadDirectoryChangesPrivate.h">
|
||||
<Filter>Helpers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Helpers\ThreadSafeQueue.h">
|
||||
<Filter>Helpers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="SandMan.h">
|
||||
|
@ -229,6 +247,9 @@
|
|||
<QtMoc Include="Wizards\SetupWizard.h">
|
||||
<Filter>Wizards</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="BoxMonitor.h">
|
||||
<Filter>SandMan</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="Resources\SandMan.qrc">
|
||||
|
|
|
@ -4,14 +4,18 @@
|
|||
#include "SandMan.h"
|
||||
#include "..\MiscHelpers\Common\Common.h"
|
||||
#include <windows.h>
|
||||
#include "BoxMonitor.h"
|
||||
|
||||
CSbiePlusAPI::CSbiePlusAPI(QObject* parent) : CSbieAPI(parent)
|
||||
{
|
||||
m_BoxMonitor = new CBoxMonitor();
|
||||
|
||||
m_JobCount = 0;
|
||||
}
|
||||
|
||||
CSbiePlusAPI::~CSbiePlusAPI()
|
||||
{
|
||||
delete m_BoxMonitor;
|
||||
}
|
||||
|
||||
CSandBox* CSbiePlusAPI::NewSandBox(const QString& BoxName, class CSbieAPI* pAPI)
|
||||
|
@ -94,7 +98,10 @@ CSandBoxPlus::CSandBoxPlus(const QString& BoxName, class CSbieAPI* pAPI) : CSand
|
|||
m_bApplicationCompartment = false;
|
||||
m_iUnsecureDebugging = 0;
|
||||
|
||||
m_TotalSize = theConf->GetValue("SizeCache/" + m_Name, -1).toLongLong();
|
||||
|
||||
m_SuspendRecovery = false;
|
||||
m_IsEmpty = false;
|
||||
|
||||
m_pOptionsWnd = NULL;
|
||||
m_pRecoveryWnd = NULL;
|
||||
|
@ -154,11 +161,56 @@ void CSandBoxPlus::UpdateDetails()
|
|||
CSandBox::UpdateDetails();
|
||||
}
|
||||
|
||||
void CSandBoxPlus::SetBoxPaths(const QString& FilePath, const QString& RegPath, const QString& IpcPath)
|
||||
{
|
||||
CSandBox::SetBoxPaths(FilePath, RegPath, IpcPath);
|
||||
m_IsEmpty = IsEmpty();
|
||||
|
||||
if (theConf->GetBool("Options/WatchBoxSize", false) && m_TotalSize == -1)
|
||||
((CSbiePlusAPI*)theAPI)->m_BoxMonitor->AddBox(this);
|
||||
}
|
||||
|
||||
void CSandBoxPlus::UpdateSize()
|
||||
{
|
||||
m_TotalSize = -1;
|
||||
if(theConf->GetBool("Options/WatchBoxSize", false))
|
||||
((CSbiePlusAPI*)theAPI)->m_BoxMonitor->AddBox(this);
|
||||
|
||||
m_IsEmpty = IsEmpty();
|
||||
}
|
||||
|
||||
void CSandBoxPlus::SetSize(quint64 Size)
|
||||
{
|
||||
m_TotalSize = Size;
|
||||
theConf->SetValue("SizeCache/" + m_Name, Size);
|
||||
}
|
||||
|
||||
void CSandBoxPlus::OpenBox()
|
||||
{
|
||||
CSandBox::OpenBox();
|
||||
|
||||
m_IsEmpty = false;
|
||||
|
||||
if (theConf->GetBool("Options/WatchBoxSize", false))
|
||||
((CSbiePlusAPI*)theAPI)->m_BoxMonitor->AddBox(this, true);
|
||||
}
|
||||
|
||||
void CSandBoxPlus::CloseBox()
|
||||
{
|
||||
CSandBox::CloseBox();
|
||||
|
||||
m_SuspendRecovery = false;
|
||||
|
||||
((CSbiePlusAPI*)theAPI)->m_BoxMonitor->CloseBox(this);
|
||||
}
|
||||
|
||||
SB_PROGRESS CSandBoxPlus::CleanBox()
|
||||
{
|
||||
((CSbiePlusAPI*)theAPI)->m_BoxMonitor->CloseBox(this, true);
|
||||
|
||||
SB_PROGRESS Status = CSandBox::CleanBox();
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
bool CSandBoxPlus::CheckUnsecureConfig() const
|
||||
|
@ -190,7 +242,7 @@ QString CSandBoxPlus::GetStatusStr() const
|
|||
|
||||
QStringList Status;
|
||||
|
||||
if (IsEmpty())
|
||||
if (m_IsEmpty)
|
||||
Status.append(tr("Empty"));
|
||||
|
||||
if (m_bApplicationCompartment)
|
||||
|
@ -513,6 +565,8 @@ void CSandBoxPlus::OnAsyncFinished()
|
|||
|
||||
if (!m_JobQueue.isEmpty())
|
||||
StartNextJob();
|
||||
else
|
||||
UpdateSize();
|
||||
}
|
||||
|
||||
void CSandBoxPlus::OnAsyncMessage(const QString& Text)
|
||||
|
|
|
@ -29,6 +29,9 @@ protected:
|
|||
|
||||
int m_JobCount;
|
||||
QMultiMap<quint32, QString> m_WindowMap;
|
||||
|
||||
friend class CSandBoxPlus;
|
||||
class CBoxMonitor* m_BoxMonitor;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -44,8 +47,13 @@ public:
|
|||
|
||||
virtual void UpdateDetails();
|
||||
|
||||
virtual void SetBoxPaths(const QString& FilePath, const QString& RegPath, const QString& IpcPath);
|
||||
|
||||
virtual void OpenBox();
|
||||
virtual void CloseBox();
|
||||
|
||||
virtual SB_PROGRESS CleanBox();
|
||||
|
||||
virtual QString GetStatusStr() const;
|
||||
|
||||
virtual void SetLogApi(bool bEnable);
|
||||
|
@ -72,6 +80,10 @@ public:
|
|||
virtual void SetLeaderProgram(const QString& ProgName, bool bSet);
|
||||
virtual int IsLeaderProgram(const QString& ProgName);
|
||||
|
||||
virtual void UpdateSize();
|
||||
virtual quint64 GetSize() const { if(m_TotalSize == -1) return 0; return m_TotalSize; }
|
||||
virtual void SetSize(quint64 Size); //{ m_TotalSize = Size; }
|
||||
|
||||
virtual bool IsRecoverySuspended() const { return m_SuspendRecovery; }
|
||||
virtual void SetSuspendRecovery(bool bSet = true) { m_SuspendRecovery = bSet; }
|
||||
|
||||
|
@ -126,7 +138,10 @@ protected:
|
|||
bool m_bApplicationCompartment;
|
||||
int m_iUnsecureDebugging;
|
||||
|
||||
quint64 m_TotalSize;
|
||||
|
||||
bool m_SuspendRecovery;
|
||||
bool m_IsEmpty;
|
||||
QString m_StatusStr;
|
||||
|
||||
QSet<QString> m_RecentPrograms;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "../../MiscHelpers/Common/Common.h"
|
||||
#include "../Windows/OptionsWindow.h"
|
||||
#include "../Windows/SnapshotsWindow.h"
|
||||
#include <QFileIconProvider>
|
||||
#include "../../MiscHelpers/Common/CheckableMessageBox.h"
|
||||
#include "../Windows/RecoveryWindow.h"
|
||||
#include "../Windows/NewBoxWindow.h"
|
||||
|
@ -1351,8 +1350,6 @@ void CSbieView::UpdateRunMenu(const CSandBoxPtr& pBox)
|
|||
while (m_iMenuRun < m_pMenuRun->actions().count())
|
||||
m_pMenuRun->removeAction(m_pMenuRun->actions().at(m_iMenuRun));
|
||||
|
||||
QFileIconProvider IconProvider;
|
||||
|
||||
QStringList RunOptions = pBox->GetTextList("RunCommand", true);
|
||||
foreach(const QString& RunOption, RunOptions)
|
||||
{
|
||||
|
@ -1372,7 +1369,7 @@ void CSbieView::UpdateRunMenu(const CSandBoxPtr& pBox)
|
|||
if (Path.left(1) == "\\")
|
||||
Path.prepend(pBox->GetFileRoot());
|
||||
|
||||
pAction->setIcon(IconProvider.icon(QFileInfo(Path)));
|
||||
pAction->setIcon(m_IconProvider.icon(QFileInfo(Path)));
|
||||
|
||||
pAction->setData(NameCmd.second);
|
||||
}
|
||||
|
@ -1483,4 +1480,4 @@ void CSbieView::OnRemoveItem()
|
|||
OnSandBoxAction(m_pMenuRemove);
|
||||
else if (!GetSelectedGroups().isEmpty())
|
||||
OnGroupAction(m_pDelGroupe);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
#include "../../MiscHelpers/Common/PanelView.h"
|
||||
#include "../../MiscHelpers/Common/TreeviewEx.h"
|
||||
#include "../Models/SbieModel.h"
|
||||
#include <QFileIconProvider>
|
||||
|
||||
class CSbieView : public CPanelView
|
||||
{
|
||||
|
@ -152,4 +153,6 @@ private:
|
|||
QAction* m_pRemove;
|
||||
|
||||
int m_iMenuRun;
|
||||
|
||||
QFileIconProvider m_IconProvider;
|
||||
};
|
|
@ -301,6 +301,8 @@ void CSettingsWindow::LoadSettings()
|
|||
ui.chkPanic->setChecked(theConf->GetBool("Options/EnablePanicKey", false));
|
||||
ui.keyPanic->setKeySequence(QKeySequence(theConf->GetString("Options/PanicKeySequence", "Shift+Pause")));
|
||||
|
||||
ui.chkMonitorSize->setChecked(theConf->GetBool("Options/WatchBoxSize", false));
|
||||
|
||||
ui.chkWatchConfig->setChecked(theConf->GetBool("Options/WatchIni", true));
|
||||
|
||||
|
||||
|
@ -458,6 +460,8 @@ void CSettingsWindow::SaveSettings()
|
|||
theConf->SetValue("Options/EnablePanicKey", ui.chkPanic->isChecked());
|
||||
theConf->SetValue("Options/PanicKeySequence", ui.keyPanic->keySequence().toString());
|
||||
|
||||
theConf->SetValue("Options/WatchBoxSize", ui.chkMonitorSize->isChecked());
|
||||
|
||||
theConf->SetValue("Options/WatchIni", ui.chkWatchConfig->isChecked());
|
||||
|
||||
theConf->SetValue("Options/SysTrayIcon", ui.cmbSysTray->currentIndex());
|
||||
|
|
|
@ -106,6 +106,7 @@ using namespace std;
|
|||
#include <QColorDialog>
|
||||
#include <QToolButton>
|
||||
#include <QScreen>
|
||||
#include <QRadioButton>
|
||||
|
||||
// other includes
|
||||
|
||||
|
|
Loading…
Reference in New Issue