1.2.1
|
@ -37,6 +37,9 @@ public:
|
|||
|
||||
combo = new QComboBox(q);
|
||||
|
||||
infoLabel = new QLabel(q);
|
||||
infoLabel->setVisible(false);
|
||||
infoLabel->setWordWrap(true);
|
||||
|
||||
buttonBox = new QDialogButtonBox(q);
|
||||
buttonBox->setOrientation(Qt::Horizontal);
|
||||
|
@ -53,15 +56,18 @@ public:
|
|||
QVBoxLayout *verticalLayout_2 = new QVBoxLayout(q);
|
||||
verticalLayout_2->addLayout(horizontalLayout_2);
|
||||
verticalLayout_2->addWidget(combo);
|
||||
verticalLayout_2->addWidget(infoLabel);
|
||||
verticalLayout_2->addItem(buttonSpacer);
|
||||
verticalLayout_2->addWidget(buttonBox);
|
||||
}
|
||||
|
||||
QLabel *pixmapLabel;
|
||||
QLabel *messageLabel;
|
||||
QLabel *infoLabel;
|
||||
QComboBox* combo;
|
||||
QDialogButtonBox *buttonBox;
|
||||
QAbstractButton *clickedButton;
|
||||
QMap<int, QString> infos;
|
||||
};
|
||||
|
||||
CComboInputDialog::CComboInputDialog(QWidget *parent) :
|
||||
|
@ -71,6 +77,7 @@ CComboInputDialog::CComboInputDialog(QWidget *parent) :
|
|||
setModal(true);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
d->combo->setFocus();
|
||||
connect(d->combo, SIGNAL(currentIndexChanged(int)), SLOT(onCmbIndex(int)));
|
||||
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept()));
|
||||
connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
||||
connect(d->buttonBox, SIGNAL(clicked(QAbstractButton*)),
|
||||
|
@ -82,6 +89,14 @@ CComboInputDialog::~CComboInputDialog()
|
|||
delete d;
|
||||
}
|
||||
|
||||
void CComboInputDialog::onCmbIndex(int index)
|
||||
{
|
||||
QString info = d->infos[index];
|
||||
if (!info.isEmpty())
|
||||
d->infoLabel->setVisible(true);
|
||||
d->infoLabel->setText(info);
|
||||
}
|
||||
|
||||
void CComboInputDialog::slotClicked(QAbstractButton *b)
|
||||
{
|
||||
d->clickedButton = b;
|
||||
|
@ -109,9 +124,11 @@ void CComboInputDialog::setText(const QString &t)
|
|||
d->messageLabel->setText(t);
|
||||
}
|
||||
|
||||
void CComboInputDialog::addItem(const QString& t, const QVariant & v)
|
||||
void CComboInputDialog::addItem(const QString& t, const QVariant & v, const QString& info)
|
||||
{
|
||||
d->combo->addItem(t, v);
|
||||
if (!info.isEmpty())
|
||||
d->infos[d->combo->count() - 1] = info;
|
||||
}
|
||||
|
||||
void CComboInputDialog::setEditable(bool b)
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
QString text() const;
|
||||
void setText(const QString &);
|
||||
|
||||
void addItem(const QString&, const QVariant & = QVariant());
|
||||
void addItem(const QString&, const QVariant & = QVariant(), const QString& info = QString());
|
||||
void setEditable(bool);
|
||||
|
||||
QString value() const;
|
||||
|
@ -52,6 +52,7 @@ public:
|
|||
|
||||
private slots:
|
||||
void slotClicked(QAbstractButton *b);
|
||||
void onCmbIndex(int index);
|
||||
|
||||
private:
|
||||
CComboInputDialogPrivate *d;
|
||||
|
|
|
@ -96,7 +96,7 @@ quint64 GetRand64()
|
|||
{
|
||||
quint64 Rand64;
|
||||
#ifdef USE_OPENSSL
|
||||
int Ret = RAND_bytes((byte*)&Rand64, sizeof(uint64));
|
||||
int Ret = RAND_bytes((byte*)&Rand64, sizeof(quint64));
|
||||
ASSERT(Ret == 1); // An error occurs if the PRNG has not been seeded with enough randomness to ensure an unpredictable byte sequence.
|
||||
#else
|
||||
//CryptoPP::AutoSeededRandomPool rng;
|
||||
|
@ -431,6 +431,15 @@ QAction* MakeAction(QActionGroup* pGroup, QMenu* pParent, const QString& Text, c
|
|||
return pAction;
|
||||
}
|
||||
|
||||
void SetPaleteTexture(QPalette& palette, QPalette::ColorRole role, const QImage& image)
|
||||
{
|
||||
for (int i = 0; i < QPalette::NColorGroups; ++i) {
|
||||
QBrush brush(image);
|
||||
brush.setColor(palette.brush(QPalette::ColorGroup(i), role).color());
|
||||
palette.setBrush(QPalette::ColorGroup(i), role, brush);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
|
|
@ -93,7 +93,7 @@ MISCHELPERS_EXPORT QAction* MakeAction(QToolBar* pParent, const QString& IconFil
|
|||
MISCHELPERS_EXPORT QMenu* MakeMenu(QMenu* pParent, const QString& Text, const QString& IconFile = "");
|
||||
MISCHELPERS_EXPORT QAction* MakeAction(QMenu* pParent, const QString& Text, const QString& IconFile = "");
|
||||
MISCHELPERS_EXPORT QAction* MakeAction(QActionGroup* pGroup, QMenu* pParent, const QString& Text, const QVariant& Data);
|
||||
|
||||
MISCHELPERS_EXPORT void SetPaleteTexture(QPalette& palette, QPalette::ColorRole role, const QImage& image);
|
||||
|
||||
#ifdef WIN32
|
||||
MISCHELPERS_EXPORT bool InitConsole(bool bCreateIfNeeded = true);
|
||||
|
|
|
@ -109,23 +109,26 @@ bool CopyDir(const QString& srcDirPath, const QString& destDirPath, bool bMove)
|
|||
return true;
|
||||
}
|
||||
|
||||
QStringList ListDir(const QString& srcDirPath)
|
||||
QStringList ListDir(const QString& srcDirPath, const QStringList& NameFilter, bool bAndSubDirs)
|
||||
{
|
||||
QStringList FileList;
|
||||
QDir srcDir(srcDirPath);
|
||||
if (!srcDir.exists())
|
||||
return FileList;
|
||||
|
||||
QStringList Files = srcDir.entryList(QDir::Files);
|
||||
QStringList Files = !NameFilter.isEmpty() ? srcDir.entryList(NameFilter, QDir::Files | QDir::System) : srcDir.entryList(QDir::Files | QDir::System);
|
||||
foreach (const QString& FileName, Files)
|
||||
FileList.append(FileName);
|
||||
|
||||
QStringList Dirs = srcDir.entryList(QDir::Dirs);
|
||||
if(!bAndSubDirs)
|
||||
return FileList;
|
||||
|
||||
QStringList Dirs = srcDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
foreach (const QString& DirName, Dirs)
|
||||
{
|
||||
if (DirName.compare(".") == 0 || DirName.compare("..") == 0)
|
||||
continue;
|
||||
QStringList SubFiles = ListDir(srcDirPath + DirName + "/");
|
||||
//if (DirName.compare(".") == 0 || DirName.compare("..") == 0)
|
||||
// continue;
|
||||
QStringList SubFiles = ListDir(srcDirPath + "/" + DirName, NameFilter);
|
||||
foreach (const QString& FileName, SubFiles)
|
||||
FileList.append(DirName + "/" + FileName);
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ MISCHELPERS_EXPORT bool WriteStringToFile(const QString& filename, const QStri
|
|||
MISCHELPERS_EXPORT bool CreateDir(const QString& path);
|
||||
MISCHELPERS_EXPORT bool DeleteDir(const QString& path, bool bEmpty = false);
|
||||
MISCHELPERS_EXPORT bool CopyDir(const QString& srcDirPath, const QString& destDirPath, bool bMove = false);
|
||||
MISCHELPERS_EXPORT QStringList ListDir(const QString& srcDirPath);
|
||||
MISCHELPERS_EXPORT QStringList ListDir(const QString& srcDirPath, const QStringList& NameFilter = QStringList(), bool bAndSubDirs = true);
|
||||
MISCHELPERS_EXPORT bool SafeRemove(const QString& path);
|
||||
|
||||
MISCHELPERS_EXPORT QString GetRelativeSharedPath(const QString& fullPath, const QStringList& shared, QString& rootPath);
|
||||
|
|
|
@ -12,9 +12,9 @@ bool TestWriteRight(const QString& Path)
|
|||
return TestFile.remove();
|
||||
}
|
||||
|
||||
CSettings::CSettings(const QString& AppName, bool bShared, QMap<QString, SSetting> DefaultValues, QObject* qObject) : QObject(qObject)
|
||||
CSettings::CSettings(const QString& AppDir, const QString& AppName, bool bShared, QMap<QString, SSetting> DefaultValues, QObject* qObject) : QObject(qObject)
|
||||
{
|
||||
m_ConfigDir = QCoreApplication::applicationDirPath();
|
||||
m_ConfigDir = AppDir;
|
||||
if (!(m_bPortable = QFile::exists(m_ConfigDir + "/" + AppName + ".ini")))
|
||||
{
|
||||
QStringList dirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
virtual bool IsBlob() const {return true;}
|
||||
};
|
||||
|
||||
CSettings(const QString& AppName, bool bShared = false, QMap<QString, SSetting> DefaultValues = QMap<QString, SSetting>(), QObject* qObject = NULL);
|
||||
CSettings(const QString& AppDir, const QString& AppName, bool bShared = false, QMap<QString, SSetting> DefaultValues = QMap<QString, SSetting>(), QObject* qObject = NULL);
|
||||
virtual ~CSettings();
|
||||
|
||||
void DelValue(const QString& key);
|
||||
|
|
|
@ -291,14 +291,14 @@ SB_STATUS CSbieAPI::Connect(bool takeOver, bool withQueue)
|
|||
//m->lastRecordNum = 0;
|
||||
|
||||
// Note: this lib is not using all functions hence it can be compatible with multiple driver ABI revisions
|
||||
QStringList CompatVersions = QStringList () << "5.57.0";
|
||||
QString CurVersion = GetVersion();
|
||||
if (!CompatVersions.contains(CurVersion))
|
||||
{
|
||||
NtClose(m->SbieApiHandle);
|
||||
m->SbieApiHandle = INVALID_HANDLE_VALUE;
|
||||
return SB_ERR(SB_Incompatible, QVariantList() << CurVersion << CompatVersions.join(", "));
|
||||
}
|
||||
//QStringList CompatVersions = QStringList () << "5.55.0";
|
||||
//QString CurVersion = GetVersion();
|
||||
//if (!CompatVersions.contains(CurVersion))
|
||||
//{
|
||||
// NtClose(m->SbieApiHandle);
|
||||
// m->SbieApiHandle = INVALID_HANDLE_VALUE;
|
||||
// return SB_ERR(SB_Incompatible, QVariantList() << CurVersion << CompatVersions.join(", "));
|
||||
//}
|
||||
|
||||
SB_STATUS Status = SB_OK;
|
||||
if (takeOver) {
|
||||
|
@ -1055,6 +1055,7 @@ SB_STATUS CSbieAPI::RunStart(const QString& BoxName, const QString& Command, boo
|
|||
|
||||
StartArgs += Command;
|
||||
|
||||
qint64 pid = 0;
|
||||
//wchar_t sysPath[MAX_PATH];
|
||||
//GetSystemDirectoryW(sysPath, MAX_PATH);
|
||||
if (pProcess) {
|
||||
|
@ -1064,6 +1065,7 @@ SB_STATUS CSbieAPI::RunStart(const QString& BoxName, const QString& Command, boo
|
|||
pProcess->setProgram(GetStartPath());
|
||||
pProcess->setNativeArguments(StartArgs);
|
||||
pProcess->start();
|
||||
pid = pProcess->processId();
|
||||
}
|
||||
else {
|
||||
QProcess process;
|
||||
|
@ -1072,7 +1074,7 @@ SB_STATUS CSbieAPI::RunStart(const QString& BoxName, const QString& Command, boo
|
|||
process.setWorkingDirectory(WorkingDir);
|
||||
process.setProgram(GetStartPath());
|
||||
process.setNativeArguments(StartArgs);
|
||||
process.startDetached();
|
||||
process.startDetached(&pid);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1109,6 +1111,8 @@ SB_STATUS CSbieAPI::RunStart(const QString& BoxName, const QString& Command, boo
|
|||
CloseHandle( pi.hThread );
|
||||
*/
|
||||
|
||||
if(pid == 0)
|
||||
return SB_ERR();
|
||||
return SB_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>634</width>
|
||||
<height>451</height>
|
||||
<height>464</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -54,7 +54,51 @@
|
|||
<layout class="QGridLayout" name="gridLayout_9">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<item row="11" column="1">
|
||||
<item row="8" 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>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkSandboxUrls">
|
||||
<property name="text">
|
||||
<string>Open urls from this ui sandboxed</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" 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="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="1" column="1">
|
||||
<widget class="QComboBox" name="uiLang"/>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkNotifyRecovery">
|
||||
<property name="text">
|
||||
<string>Show recoverable files as notifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -67,30 +111,14 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkNotifications">
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkShowRecovery">
|
||||
<property name="text">
|
||||
<string>Show Notifications for relevant log Messages</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
<string>Show first recovery window when emptying sandboxes</string>
|
||||
</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">
|
||||
<item row="7" column="1" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkPanic">
|
||||
|
@ -104,6 +132,19 @@
|
|||
</item>
|
||||
</layout>
|
||||
</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="1" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
|
@ -114,33 +155,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="2">
|
||||
<item row="6" 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">
|
||||
<string>Open urls from this ui sandboxed</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</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">
|
||||
|
@ -155,48 +176,31 @@
|
|||
</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 occupied by each sandbox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<widget class="QWidget" name="tabShell">
|
||||
<attribute name="title">
|
||||
<string>Shell Integration</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_14">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_13">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Systray options</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="chkShellMenu">
|
||||
<property name="text">
|
||||
|
@ -204,18 +208,35 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<item row="8" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="cmbSysTray"/>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="cmbOnClose"/>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>On main window close:</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2" colspan="3">
|
||||
<widget class="QCheckBox" name="chkAlwaysDefault">
|
||||
<property name="text">
|
||||
<string>Always use DefaultBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="chkBoxOpsNotify">
|
||||
<property name="text">
|
||||
<string>Show a tray notification when automatic box operations are started</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<spacer name="verticalSpacer_6">
|
||||
|
@ -230,15 +251,18 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>On main window close:</string>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="chkSvcStart">
|
||||
|
@ -247,19 +271,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>Show boxes in tray list:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="font">
|
||||
|
@ -274,13 +285,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2" colspan="3">
|
||||
<widget class="QCheckBox" name="chkAlwaysDefault">
|
||||
<property name="text">
|
||||
<string>Always use DefaultBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2" colspan="3">
|
||||
<widget class="QCheckBox" name="chkShellMenu2">
|
||||
<property name="text">
|
||||
|
@ -288,22 +292,24 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<item row="9" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="cmbTrayBoxes"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>Start Sandbox Manager</string>
|
||||
<string>Show Icon in Systray:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="3" colspan="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<item row="3" column="3">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -315,10 +321,10 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>Show Icon in Systray:</string>
|
||||
<string>Show boxes in tray list:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -335,38 +341,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="chkBoxOpsNotify">
|
||||
<property name="text">
|
||||
<string>Show a tray notification when automatic box operations are started</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Systray options</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="cmbSysTray"/>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="cmbTrayBoxes"/>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="cmbOnClose"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<item row="12" column="3" colspan="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -378,6 +354,155 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start Sandbox Manager</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabGUI">
|
||||
<attribute name="title">
|
||||
<string>Interface Config</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_17">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_15">
|
||||
<item row="7" column="1">
|
||||
<spacer name="verticalSpacer_8">
|
||||
<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="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Interface Options</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>Font Scaling</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="cmbFontScale">
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>High DPI Scaling</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="3">
|
||||
<spacer name="horizontalSpacer_11">
|
||||
<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="1" column="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>(Restart required)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2" colspan="2">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>* indetermined means depanding on the view mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="cmbDPI"/>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkDarkTheme">
|
||||
<property name="text">
|
||||
<string>Use Dark Theme</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkBackground">
|
||||
<property name="text">
|
||||
<string>Show Classic Background in box list*</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkLargeIcons">
|
||||
<property name="text">
|
||||
<string>Use large icons in box list *</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="chkNoIcons">
|
||||
<property name="text">
|
||||
<string>Don't show icons in menus *</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -389,7 +514,34 @@
|
|||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="9" column="3">
|
||||
<item row="4" column="2" colspan="4">
|
||||
<widget class="QLineEdit" name="ipcRoot"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="chkSeparateUserFolders">
|
||||
<property name="text">
|
||||
<string>Separate user folders</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="5">
|
||||
<widget class="QCheckBox" name="chkWin32k">
|
||||
<property name="text">
|
||||
<string>Hook selected Win32k system calls to enable GPU acceleration (experimental)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<widget class="QCheckBox" name="chkAutoRoot">
|
||||
<property name="text">
|
||||
<string>Portable root folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="4">
|
||||
<widget class="QLineEdit" name="regRoot"/>
|
||||
</item>
|
||||
<item row="10" column="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -402,7 +554,7 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -415,70 +567,13 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="9" column="4">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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="2" column="5">
|
||||
<widget class="QCheckBox" name="chkAutoRoot">
|
||||
<property name="text">
|
||||
<string>Portable root folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="5">
|
||||
<widget class="QCheckBox" name="chkWFP">
|
||||
<property name="text">
|
||||
<string>Use Windows Filtering Platform to restrict network access</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="4">
|
||||
<widget class="QLineEdit" name="fileRoot"/>
|
||||
</item>
|
||||
<item row="4" column="2" colspan="4">
|
||||
<widget class="QLineEdit" name="ipcRoot"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="chkSeparateUserFolders">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Separate user folders</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QPushButton" name="btnBrowse">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>23</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="5">
|
||||
<widget class="QCheckBox" name="chkObjCb">
|
||||
<property name="text">
|
||||
<string>Activate Kernel Mode Object Filtering</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Sandbox <a href="sbie://docs/ipcrootpath">ipc root</a>: </string>
|
||||
<string>Sandbox <a href="sbie://docs/keyrootpath">registry root</a>: </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -488,20 +583,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_43">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sandbox default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_45">
|
||||
<property name="font">
|
||||
|
@ -516,21 +597,32 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<item row="1" column="6">
|
||||
<widget class="QPushButton" name="btnBrowse">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>23</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sandbox <a href="sbie://docs/keyrootpath">registry root</a>: </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="4">
|
||||
<widget class="QLineEdit" name="regRoot"/>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_43">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sandbox default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_15">
|
||||
|
@ -545,7 +637,21 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<item row="7" column="1" colspan="5">
|
||||
<widget class="QCheckBox" name="chkObjCb">
|
||||
<property name="text">
|
||||
<string>Activate Kernel Mode Object Filtering</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="5">
|
||||
<widget class="QCheckBox" name="chkWFP">
|
||||
<property name="text">
|
||||
<string>Use Windows Filtering Platform to restrict network access</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -558,10 +664,36 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="5">
|
||||
<widget class="QCheckBox" name="chkWin32k">
|
||||
<item row="10" column="4">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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="4" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Hook selected Win32k system calls to enable GPU acceleration (experimental)</string>
|
||||
<string>Sandbox <a href="sbie://docs/ipcrootpath">ipc root</a>: </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="5">
|
||||
<widget class="QCheckBox" name="chkSbieLogon">
|
||||
<property name="text">
|
||||
<string>Use a Sandboxie login instead of an anonymous token (experimental)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -652,7 +784,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<widget class="QWidget" name="tabLock">
|
||||
<attribute name="title">
|
||||
<string>Config Protection</string>
|
||||
</attribute>
|
||||
|
@ -1013,7 +1145,6 @@
|
|||
<tabstops>
|
||||
<tabstop>tabs</tabstop>
|
||||
<tabstop>uiLang</tabstop>
|
||||
<tabstop>chkDarkTheme</tabstop>
|
||||
<tabstop>chkNotifications</tabstop>
|
||||
<tabstop>chkSandboxUrls</tabstop>
|
||||
<tabstop>chkShowRecovery</tabstop>
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
#include "../SandMan.h"
|
||||
|
||||
CSbieModel::CSbieModel(QObject *parent)
|
||||
:CTreeItemModel(parent)
|
||||
: CTreeItemModel(parent)
|
||||
{
|
||||
m_LargeIcons = false;
|
||||
|
||||
//m_BoxEmpty = QIcon(":/BoxEmpty");
|
||||
//m_BoxInUse = QIcon(":/BoxInUse");
|
||||
m_ExeIcon = QIcon(":/exeIcon32");
|
||||
|
@ -137,7 +139,10 @@ QList<QVariant> CSbieModel::Sync(const QMap<QString, CSandBoxPtr>& BoxList, cons
|
|||
New[pNode->Path].append(pNode);
|
||||
Added.append(ID);
|
||||
|
||||
pNode->Icon = theGUI->GetBoxIcon(CSandBoxPlus::eDefault, false);
|
||||
QIcon Icon = theGUI->GetBoxIcon(CSandBoxPlus::eDefault, false);
|
||||
if (m_LargeIcons) // but not for boxes
|
||||
Icon = QIcon(Icon.pixmap(QSize(32,32)).scaled(16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
pNode->Icon = Icon;
|
||||
pNode->IsBold = true;
|
||||
|
||||
pNode->Values[eName].Raw = Group;
|
||||
|
@ -210,17 +215,25 @@ QList<QVariant> CSbieModel::Sync(const QMap<QString, CSandBoxPtr>& BoxList, cons
|
|||
bool Busy = pBoxEx->IsBusy();
|
||||
int boxType = pBoxEx->GetType();
|
||||
|
||||
QIcon Icon;
|
||||
if (pNode->inUse != inUse || (pNode->busyState || Busy) || pNode->boxType != boxType)
|
||||
{
|
||||
pNode->inUse = inUse;
|
||||
pNode->boxType = boxType;
|
||||
if(Busy) pNode->busyState = (pNode->busyState == 1) ? 2 : 1; // make it flach, the cheep way
|
||||
else pNode->busyState = 0;
|
||||
//pNode->Icon = pNode->inUse ? m_BoxInUse : m_BoxEmpty;
|
||||
pNode->Icon = theGUI->GetBoxIcon(boxType, inUse, pNode->busyState == 1);
|
||||
Icon = theGUI->GetBoxIcon(boxType, inUse);
|
||||
}
|
||||
|
||||
if (!Icon.isNull()) {
|
||||
if (Busy) Icon = theGUI->MakeIconBusy(Icon, pNode->busyState++);
|
||||
else pNode->busyState = 0;
|
||||
if (m_LargeIcons) // but not for boxes
|
||||
Icon = QIcon(Icon.pixmap(QSize(32,32)).scaled(16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
pNode->Icon = Icon;
|
||||
Changed = 1; // set change for first column
|
||||
}
|
||||
|
||||
|
||||
if (pNode->IsGray != !pBoxEx->IsEnabled())
|
||||
{
|
||||
pNode->IsGray = !pBoxEx->IsEnabled();
|
||||
|
@ -495,6 +508,14 @@ QVariant CSbieModel::headerData(int section, Qt::Orientation orientation, int ro
|
|||
return g_ExeIcon;
|
||||
}*/
|
||||
|
||||
QVariant CSbieModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if(m_LargeIcons && role == Qt::SizeHintRole)
|
||||
return QSize(32,32);
|
||||
|
||||
return CTreeItemModel::data(index, role);
|
||||
}
|
||||
|
||||
Qt::ItemFlags CSbieModel::flags(const QModelIndex& index) const
|
||||
{
|
||||
Qt::ItemFlags Flags = CTreeItemModel::flags(index);
|
||||
|
|
|
@ -16,6 +16,8 @@ public:
|
|||
|
||||
QList<QVariant> Sync(const QMap<QString, CSandBoxPtr>& BoxList, const QMap<QString, QStringList>& Groups = QMap<QString, QStringList>(), bool ShowHidden = false);
|
||||
|
||||
void SetLargeIcons(bool bSet = true) { m_LargeIcons = bSet; }
|
||||
|
||||
CSandBoxPtr GetSandBox(const QModelIndex &index) const;
|
||||
CBoxedProcessPtr GetProcess(const QModelIndex &index) const;
|
||||
QString GetGroup(const QModelIndex &index) const;
|
||||
|
@ -30,7 +32,8 @@ public:
|
|||
} GetType(const QModelIndex &index) const;
|
||||
|
||||
Qt::DropActions supportedDropActions() const { return Qt::MoveAction; }
|
||||
Qt::ItemFlags flags(const QModelIndex& index) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
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; }
|
||||
|
@ -62,7 +65,7 @@ protected:
|
|||
|
||||
struct SSandBoxNode: STreeNode
|
||||
{
|
||||
SSandBoxNode(const QVariant& Id) : STreeNode(Id) { inUse = false; boxType = -1; OrderNumber = 0; }
|
||||
SSandBoxNode(const QVariant& Id) : STreeNode(Id) { inUse = false; busyState = 0; boxType = -1; OrderNumber = 0; }
|
||||
|
||||
CSandBoxPtr pBox;
|
||||
bool inUse;
|
||||
|
@ -89,6 +92,7 @@ protected:
|
|||
|
||||
private:
|
||||
|
||||
bool m_LargeIcons;
|
||||
//QIcon m_BoxEmpty;
|
||||
//QIcon m_BoxInUse;
|
||||
QIcon m_ExeIcon;
|
||||
|
|
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 36 KiB |
|
@ -70,6 +70,9 @@
|
|||
<file>Actions/Monitor.png</file>
|
||||
<file>SideLogo.png</file>
|
||||
<file>Actions/Refresh.png</file>
|
||||
<file>Actions/UnPackBox.png</file>
|
||||
<file>Actions/PackBox.png</file>
|
||||
<file>Actions/GUI.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Boxes">
|
||||
<file alias="Empty3">Boxes/sandbox-b-empty.png</file>
|
||||
|
@ -93,5 +96,10 @@
|
|||
<file>AdvancedD.png</file>
|
||||
<file>Simple.png</file>
|
||||
<file>SimpleD.png</file>
|
||||
<file>background.png</file>
|
||||
<file>sandboxie-logo.png</file>
|
||||
<file>sandboxie-back.png</file>
|
||||
<file>Classic.png</file>
|
||||
<file>ClassicD.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 531 B |
After Width: | Height: | Size: 58 KiB |
|
@ -52,16 +52,18 @@ public:
|
|||
|
||||
bool IsFullyPortable();
|
||||
|
||||
bool IsShowHidden() { return m_pShowHidden->isChecked(); }
|
||||
|
||||
bool IsShowHidden() { return m_pShowHidden && m_pShowHidden->isChecked(); }
|
||||
bool KeepTerminated() { return m_pKeepTerminated && m_pKeepTerminated->isChecked(); }
|
||||
bool ShowAllSessions() { return m_pShowAllSessions && m_pShowAllSessions->isChecked(); }
|
||||
bool IsDisableRecovery() {return m_pDisableRecovery && m_pDisableRecovery->isChecked();}
|
||||
bool IsDisableMessages() {return m_pDisableMessages && m_pDisableMessages->isChecked();}
|
||||
CSbieView* GetBoxView() { return m_pBoxView; }
|
||||
|
||||
bool RunSandboxed(const QStringList& Commands, const QString& BoxName, const QString& WrkDir = QString());
|
||||
|
||||
QIcon GetBoxIcon(int boxType, bool inUse = false, bool inBusy = false);
|
||||
QIcon GetBoxIcon(int boxType, bool inUse = false);// , bool inBusy = false);
|
||||
QIcon MakeIconBusy(const QIcon& Icon, int Index = 0);
|
||||
QString GetBoxDescription(int boxType);
|
||||
|
||||
void SetViewMode(bool bAdvanced);
|
||||
|
||||
bool CheckCertificate();
|
||||
|
||||
|
@ -120,7 +122,7 @@ protected:
|
|||
struct SBoxIcon {
|
||||
QIcon Empty;
|
||||
QIcon InUse;
|
||||
QIcon Busy;
|
||||
//QIcon Busy;
|
||||
};
|
||||
QMap<int, SBoxIcon> m_BoxIcons;
|
||||
|
||||
|
@ -142,7 +144,7 @@ public slots:
|
|||
bool OpenRecovery(const CSandBoxPtr& pBox, bool& DeleteShapshots, bool bCloseEmpty = false);
|
||||
class CRecoveryWindow* ShowRecovery(const CSandBoxPtr& pBox, bool bFind = true);
|
||||
|
||||
void UpdateSettings();
|
||||
void UpdateSettings(bool bRebuildUI);
|
||||
void OnIniReloaded();
|
||||
|
||||
void SetupHotKeys();
|
||||
|
@ -168,12 +170,10 @@ public slots:
|
|||
void OnBoxDblClick(QTreeWidgetItem*);
|
||||
|
||||
private slots:
|
||||
void OnSelectionChanged();
|
||||
|
||||
void OnMenuHover(QAction* action);
|
||||
|
||||
void OnNewBox();
|
||||
void OnNewGroupe();
|
||||
void OnSandBoxAction();
|
||||
void OnEmptyAll();
|
||||
void OnWndFinder();
|
||||
void OnDisableForce();
|
||||
|
@ -191,7 +191,7 @@ private slots:
|
|||
void OnResetGUI();
|
||||
void OnEditIni();
|
||||
void OnReloadIni();
|
||||
void OnSetMonitoring();
|
||||
void OnMonitoring();
|
||||
|
||||
void OnExit();
|
||||
void OnHelp();
|
||||
|
@ -208,12 +208,23 @@ private slots:
|
|||
|
||||
void SetUITheme();
|
||||
|
||||
void AddLogMessage(const QString& Message);
|
||||
void AddFileRecovered(const QString& BoxName, const QString& FilePath);
|
||||
|
||||
void UpdateLabel();
|
||||
|
||||
private:
|
||||
void CreateMenus();
|
||||
|
||||
void CreateUI();
|
||||
|
||||
void CreateMenus(bool bAdvanced);
|
||||
void CreateOldMenus();
|
||||
void CreateMaintenanceMenu();
|
||||
void CreateViewBaseMenu();
|
||||
void CreateHelpMenu(bool bAdvanced);
|
||||
void CreateToolBar();
|
||||
void CreateView();
|
||||
void CreateView(bool bAdvanced);
|
||||
void CreateTrayIcon();
|
||||
void CreateTrayMenu();
|
||||
|
||||
void HandleMaintenance(SB_RESULT(void*) Status);
|
||||
|
@ -270,7 +281,6 @@ private:
|
|||
QActionGroup* m_pViewMode;
|
||||
QAction* m_pShowHidden;
|
||||
QAction* m_pWndTopMost;
|
||||
int m_iMenuViewPos;
|
||||
QAction* m_pRefreshAll;
|
||||
QMenu* m_pCleanUpMenu;
|
||||
QAction* m_pCleanUpProcesses;
|
||||
|
@ -300,6 +310,11 @@ private:
|
|||
QAction* m_pAbout;
|
||||
QAction* m_pAboutQt;
|
||||
|
||||
|
||||
// for old menu
|
||||
QMenu* m_pSandbox;
|
||||
|
||||
|
||||
QSystemTrayIcon* m_pTrayIcon;
|
||||
QMenu* m_pTrayMenu;
|
||||
QAction* m_pTraySeparator;
|
||||
|
@ -320,13 +335,13 @@ private:
|
|||
bool m_ThemeUpdatePending;
|
||||
QString m_DefaultStyle;
|
||||
QPalette m_DefaultPalett;
|
||||
double m_DefaultFontSize;
|
||||
|
||||
void LoadLanguage();
|
||||
void LoadLanguage(const QString& Lang, const QString& Module, int Index);
|
||||
QTranslator m_Translator[2];
|
||||
|
||||
public:
|
||||
QString m_Language;
|
||||
quint32 m_LanguageId;
|
||||
bool m_DarkTheme;
|
||||
};
|
||||
|
|
|
@ -208,6 +208,18 @@
|
|||
<ClCompile Include="Models\TraceModel.cpp" />
|
||||
<ClCompile Include="Models\SbieModel.cpp" />
|
||||
<ClCompile Include="SandMan.cpp" />
|
||||
<ClCompile Include="SandManRecovery.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SandManTray.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SandManUpdate.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
|
@ -361,6 +373,7 @@
|
|||
<None Include="sandman_pt_BR.ts" />
|
||||
<None Include="sandman_pt_PT.ts" />
|
||||
<None Include="sandman_ru.ts" />
|
||||
<None Include="sandman_sv_SE.ts" />
|
||||
<None Include="sandman_tr.ts" />
|
||||
<None Include="sandman_uk.ts" />
|
||||
<None Include="sandman_zh_TW.ts" />
|
||||
|
|
|
@ -168,6 +168,12 @@
|
|||
<ClCompile Include="SandManUpdate.cpp">
|
||||
<Filter>SandMan</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SandManRecovery.cpp">
|
||||
<Filter>SandMan</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SandManTray.cpp">
|
||||
<Filter>SandMan</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
|
@ -348,6 +354,9 @@
|
|||
<None Include="sandman_cs.ts">
|
||||
<Filter>Translation Files</Filter>
|
||||
</None>
|
||||
<None Include="sandman_sv.ts">
|
||||
<Filter>Translation Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="SandMan.rc">
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
|
||||
void CSandMan::OnFileToRecover(const QString& BoxName, const QString& FilePath, const QString& BoxPath, quint32 ProcessId)
|
||||
{
|
||||
CSandBoxPtr pBox = theAPI->GetBoxByName(BoxName);
|
||||
if ((!pBox.isNull() && pBox.objectCast<CSandBoxPlus>()->IsRecoverySuspended()) || IsDisableRecovery())
|
||||
return;
|
||||
|
||||
if (theConf->GetBool("Options/InstantRecovery", true))
|
||||
{
|
||||
CRecoveryWindow* pWnd = ShowRecovery(pBox, false);
|
||||
|
||||
//if (!theConf->GetBool("Options/AlwaysOnTop", false)) {
|
||||
// SetWindowPos((HWND)pWnd->winId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
// QTimer::singleShot(100, this, [pWnd]() {
|
||||
// SetWindowPos((HWND)pWnd->winId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
// });
|
||||
//}
|
||||
|
||||
pWnd->AddFile(FilePath, BoxPath);
|
||||
}
|
||||
else
|
||||
m_pPopUpWindow->AddFileToRecover(FilePath, BoxPath, pBox, ProcessId);
|
||||
}
|
||||
|
||||
bool CSandMan::OpenRecovery(const CSandBoxPtr& pBox, bool& DeleteShapshots, bool bCloseEmpty)
|
||||
{
|
||||
auto pBoxEx = pBox.objectCast<CSandBoxPlus>();
|
||||
if (!pBoxEx) return false;
|
||||
if (pBoxEx->m_pRecoveryWnd != NULL) {
|
||||
pBoxEx->m_pRecoveryWnd->close();
|
||||
// todo: resuse window?
|
||||
}
|
||||
|
||||
CRecoveryWindow* pRecoveryWindow = new CRecoveryWindow(pBox, false, this);
|
||||
if (pRecoveryWindow->FindFiles() == 0 && bCloseEmpty) {
|
||||
delete pRecoveryWindow;
|
||||
return true;
|
||||
}
|
||||
else if (pRecoveryWindow->exec() != 1)
|
||||
return false;
|
||||
DeleteShapshots = pRecoveryWindow->IsDeleteShapshots();
|
||||
return true;
|
||||
}
|
||||
|
||||
CRecoveryWindow* CSandMan::ShowRecovery(const CSandBoxPtr& pBox, bool bFind)
|
||||
{
|
||||
auto pBoxEx = pBox.objectCast<CSandBoxPlus>();
|
||||
if (!pBoxEx) return false;
|
||||
if (pBoxEx->m_pRecoveryWnd == NULL) {
|
||||
pBoxEx->m_pRecoveryWnd = new CRecoveryWindow(pBox, bFind == false);
|
||||
connect(pBoxEx->m_pRecoveryWnd, &CRecoveryWindow::Closed, [pBoxEx]() {
|
||||
pBoxEx->m_pRecoveryWnd = NULL;
|
||||
});
|
||||
pBoxEx->m_pRecoveryWnd->show();
|
||||
}
|
||||
/*else {
|
||||
pBoxEx->m_pRecoveryWnd->setWindowState((pBoxEx->m_pRecoveryWnd->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
||||
//SetForegroundWindow((HWND)pBoxEx->m_pRecoveryWnd->winId());
|
||||
}*/
|
||||
if(bFind)
|
||||
pBoxEx->m_pRecoveryWnd->FindFiles();
|
||||
return pBoxEx->m_pRecoveryWnd;
|
||||
}
|
||||
|
||||
SB_PROGRESS CSandMan::RecoverFiles(const QString& BoxName, const QList<QPair<QString, QString>>& FileList, int Action)
|
||||
{
|
||||
CSbieProgressPtr pProgress = CSbieProgressPtr(new CSbieProgress());
|
||||
QtConcurrent::run(CSandMan::RecoverFilesAsync, pProgress, BoxName, FileList, Action);
|
||||
return SB_PROGRESS(OP_ASYNC, pProgress);
|
||||
}
|
||||
|
||||
void CSandMan::RecoverFilesAsync(const CSbieProgressPtr& pProgress, const QString& BoxName, const QList<QPair<QString, QString>>& FileList, int Action)
|
||||
{
|
||||
SB_STATUS Status = SB_OK;
|
||||
|
||||
int OverwriteOnExist = -1;
|
||||
|
||||
QStringList Unrecovered;
|
||||
for (QList<QPair<QString, QString>>::const_iterator I = FileList.begin(); I != FileList.end(); ++I)
|
||||
{
|
||||
QString BoxPath = I->first;
|
||||
QString RecoveryPath = I->second;
|
||||
QString FileName = BoxPath.mid(BoxPath.lastIndexOf("\\") + 1);
|
||||
QString RecoveryFolder = RecoveryPath.left(RecoveryPath.lastIndexOf("\\") + 1);
|
||||
|
||||
pProgress->ShowMessage(tr("Recovering file %1 to %2").arg(FileName).arg(RecoveryFolder));
|
||||
|
||||
QDir().mkpath(RecoveryFolder);
|
||||
if (QFile::exists(RecoveryPath))
|
||||
{
|
||||
int Overwrite = OverwriteOnExist;
|
||||
if (Overwrite == -1)
|
||||
{
|
||||
bool forAll = false;
|
||||
int retVal = 0;
|
||||
QMetaObject::invokeMethod(theGUI, "ShowQuestion", Qt::BlockingQueuedConnection, // show this question using the GUI thread
|
||||
Q_RETURN_ARG(int, retVal),
|
||||
Q_ARG(QString, tr("The file %1 already exists, do you want to overwrite it?").arg(RecoveryPath)),
|
||||
Q_ARG(QString, tr("Do this for all files!")),
|
||||
Q_ARG(bool*, &forAll),
|
||||
Q_ARG(int, QDialogButtonBox::Yes | QDialogButtonBox::No),
|
||||
Q_ARG(int, QDialogButtonBox::No)
|
||||
);
|
||||
|
||||
Overwrite = retVal == QDialogButtonBox::Yes ? 1 : 0;
|
||||
if (forAll)
|
||||
OverwriteOnExist = Overwrite;
|
||||
}
|
||||
if (Overwrite == 1)
|
||||
QFile::remove(RecoveryPath);
|
||||
}
|
||||
|
||||
if (!QFile::rename(BoxPath, RecoveryPath))
|
||||
Unrecovered.append(BoxPath);
|
||||
else {
|
||||
QMetaObject::invokeMethod(theGUI, "OnFileRecovered", Qt::BlockingQueuedConnection, // show this question using the GUI thread
|
||||
Q_ARG(QString, BoxName),
|
||||
Q_ARG(QString, RecoveryPath),
|
||||
Q_ARG(QString, BoxPath)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Unrecovered.isEmpty())
|
||||
Status = SB_ERR(SB_Message, QVariantList () << (tr("Failed to recover some files: \n") + Unrecovered.join("\n")));
|
||||
else if(FileList.count() == 1 && Action != 0)
|
||||
{
|
||||
std::wstring path = FileList.first().second.toStdWString();
|
||||
switch (Action)
|
||||
{
|
||||
case 1: // open
|
||||
ShellExecute(NULL, NULL, path.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
break;
|
||||
case 2: // explore
|
||||
ShellExecute(NULL, NULL, L"explorer.exe", (L"/select,\"" + path + L"\"").c_str(), NULL, SW_SHOWNORMAL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pProgress->Finish(Status);
|
||||
}
|
||||
|
||||
void CSandMan::AddFileRecovered(const QString& BoxName, const QString& FilePath)
|
||||
{
|
||||
if (!m_pRecoveryLog)
|
||||
return;
|
||||
|
||||
QTreeWidgetItem* pItem = new QTreeWidgetItem(); // Time|Box|FilePath
|
||||
pItem->setText(0, QDateTime::currentDateTime().toString("hh:mm:ss.zzz"));
|
||||
pItem->setText(1, BoxName);
|
||||
pItem->setText(2, FilePath);
|
||||
m_pRecoveryLog->GetTree()->addTopLevelItem(pItem);
|
||||
|
||||
m_pRecoveryLog->GetView()->verticalScrollBar()->setValue(m_pRecoveryLog->GetView()->verticalScrollBar()->maximum());
|
||||
}
|
||||
|
||||
void CSandMan::OnFileRecovered(const QString& BoxName, const QString& FilePath, const QString& BoxPath)
|
||||
{
|
||||
AddFileRecovered(BoxName, FilePath);
|
||||
|
||||
CSandBoxPtr pBox = theAPI->GetBoxByName(BoxName);
|
||||
if (pBox)
|
||||
pBox.objectCast<CSandBoxPlus>()->UpdateSize();
|
||||
}
|
|
@ -0,0 +1,305 @@
|
|||
|
||||
#include <QStyledItemDelegate>
|
||||
class CTrayBoxesItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
QStyleOptionViewItem opt(option);
|
||||
if ((opt.state & QStyle::State_MouseOver) != 0)
|
||||
opt.state |= QStyle::State_Selected;
|
||||
else if ((opt.state & QStyle::State_HasFocus) != 0 && m_Hold)
|
||||
opt.state |= QStyle::State_Selected;
|
||||
opt.state &= ~QStyle::State_HasFocus;
|
||||
QStyledItemDelegate::paint(painter, opt, index);
|
||||
}
|
||||
public:
|
||||
static bool m_Hold;
|
||||
};
|
||||
|
||||
bool CTrayBoxesItemDelegate::m_Hold = false;
|
||||
|
||||
void CSandMan::CreateTrayIcon()
|
||||
{
|
||||
m_pTrayIcon = new QSystemTrayIcon(GetTrayIcon(), this);
|
||||
m_pTrayIcon->setToolTip(GetTrayText());
|
||||
connect(m_pTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(OnSysTray(QSystemTrayIcon::ActivationReason)));
|
||||
m_bIconEmpty = true;
|
||||
m_bIconDisabled = false;
|
||||
m_bIconBusy = false;
|
||||
m_iDeletingContent = 0;
|
||||
|
||||
CreateTrayMenu();
|
||||
|
||||
bool bAutoRun = QApplication::arguments().contains("-autorun");
|
||||
|
||||
if(g_PendingMessage.isEmpty()){
|
||||
m_pTrayIcon->show(); // Note: qt bug; hide does not work if not showing first :/
|
||||
if(!bAutoRun && theConf->GetInt("Options/SysTrayIcon", 1) == 0)
|
||||
m_pTrayIcon->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void CSandMan::CreateTrayMenu()
|
||||
{
|
||||
m_pTrayMenu = new QMenu();
|
||||
QAction* pShowHide = m_pTrayMenu->addAction(GetIcon("IconFull", false), tr("Show/Hide"), this, SLOT(OnShowHide()));
|
||||
QFont f = pShowHide->font();
|
||||
f.setBold(true);
|
||||
pShowHide->setFont(f);
|
||||
m_pTrayMenu->addSeparator();
|
||||
|
||||
m_pTrayList = new QWidgetAction(m_pTrayMenu);
|
||||
|
||||
QWidget* pWidget = new CActionWidget();
|
||||
QHBoxLayout* pLayout = new QHBoxLayout();
|
||||
pLayout->setMargin(0);
|
||||
pWidget->setLayout(pLayout);
|
||||
|
||||
m_pTrayBoxes = new QTreeWidget();
|
||||
|
||||
m_pTrayBoxes->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Maximum);
|
||||
m_pTrayBoxes->setRootIsDecorated(false);
|
||||
//m_pTrayBoxes->setHeaderLabels(tr(" Sandbox").split("|"));
|
||||
m_pTrayBoxes->setHeaderHidden(true);
|
||||
m_pTrayBoxes->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
//m_pTrayBoxes->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
//m_pTrayBoxes->setStyleSheet("QTreeView::item:hover{background-color:#FFFF00;}");
|
||||
m_pTrayBoxes->setItemDelegate(new CTrayBoxesItemDelegate());
|
||||
|
||||
m_pTrayBoxes->setStyle(QStyleFactory::create(m_DefaultStyle));
|
||||
|
||||
pLayout->insertSpacing(0, 1);// 32);
|
||||
|
||||
/*QFrame* vFrame = new QFrame;
|
||||
vFrame->setFixedWidth(1);
|
||||
vFrame->setFrameShape(QFrame::VLine);
|
||||
vFrame->setFrameShadow(QFrame::Raised);
|
||||
pLayout->addWidget(vFrame);*/
|
||||
|
||||
pLayout->addWidget(m_pTrayBoxes);
|
||||
|
||||
m_pTrayList->setDefaultWidget(pWidget);
|
||||
m_pTrayMenu->addAction(m_pTrayList);
|
||||
|
||||
|
||||
m_pTrayBoxes->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(m_pTrayBoxes, SIGNAL(customContextMenuRequested( const QPoint& )), this, SLOT(OnBoxMenu(const QPoint &)));
|
||||
connect(m_pTrayBoxes, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(OnBoxDblClick(QTreeWidgetItem*)));
|
||||
//m_pBoxMenu
|
||||
|
||||
m_pTraySeparator = m_pTrayMenu->addSeparator();
|
||||
m_pTrayMenu->addAction(m_pEmptyAll);
|
||||
m_pDisableForce2 = m_pTrayMenu->addAction(tr("Pause Forcing Programs"), this, SLOT(OnDisableForce2()));
|
||||
m_pDisableForce2->setCheckable(true);
|
||||
if(m_pDisableRecovery) m_pTrayMenu->addAction(m_pDisableRecovery);
|
||||
if(m_pDisableMessages) m_pTrayMenu->addAction(m_pDisableMessages);
|
||||
m_pTrayMenu->addSeparator();
|
||||
|
||||
/*QWidgetAction* pBoxWidget = new QWidgetAction(m_pTrayMenu);
|
||||
|
||||
QWidget* pWidget = new QWidget();
|
||||
pWidget->setMaximumHeight(200);
|
||||
QGridLayout* pLayout = new QGridLayout();
|
||||
pLayout->addWidget(pBar, 0, 0);
|
||||
pWidget->setLayout(pLayout);
|
||||
pBoxWidget->setDefaultWidget(pWidget);*/
|
||||
|
||||
/*QLabel* pLabel = new QLabel("test");
|
||||
pLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
pLabel->setAlignment(Qt::AlignCenter);
|
||||
pBoxWidget->setDefaultWidget(pLabel);*/
|
||||
|
||||
//m_pTrayMenu->addAction(pBoxWidget);
|
||||
//m_pTrayMenu->addSeparator();
|
||||
|
||||
m_pTrayMenu->addAction(m_pExit);
|
||||
}
|
||||
|
||||
QIcon CSandMan::GetTrayIcon(bool isConnected)
|
||||
{
|
||||
bool bClassic = (theConf->GetInt("Options/SysTrayIcon", 1) == 2);
|
||||
|
||||
QString IconFile;
|
||||
if (isConnected) {
|
||||
if (m_bIconEmpty)
|
||||
IconFile = "IconEmpty";
|
||||
else
|
||||
IconFile = "IconFull";
|
||||
} else
|
||||
IconFile = "IconOff";
|
||||
if (bClassic) IconFile += "C";
|
||||
|
||||
QSize size = QSize(16, 16);
|
||||
QPixmap result(size);
|
||||
result.fill(Qt::transparent); // force alpha channel
|
||||
QPainter painter(&result);
|
||||
QPixmap base = GetIcon(IconFile, false).pixmap(size);
|
||||
QPixmap overlay;
|
||||
|
||||
if (m_bIconBusy) {
|
||||
IconFile = "IconBusy";
|
||||
if (bClassic) { // classic has a different icon instead of an overlay
|
||||
IconFile += "C";
|
||||
base = GetIcon(IconFile, false).pixmap(size);
|
||||
}
|
||||
else
|
||||
overlay = GetIcon(IconFile, false).pixmap(size);
|
||||
}
|
||||
|
||||
painter.drawPixmap(0, 0, base);
|
||||
if(!overlay.isNull()) painter.drawPixmap(0, 0, overlay);
|
||||
|
||||
if (m_bIconDisabled) {
|
||||
IconFile = "IconDFP";
|
||||
if (bClassic) IconFile += "C";
|
||||
overlay = GetIcon(IconFile, false).pixmap(size);
|
||||
painter.drawPixmap(0, 0, overlay);
|
||||
}
|
||||
|
||||
return QIcon(result);
|
||||
}
|
||||
|
||||
QString CSandMan::GetTrayText(bool isConnected)
|
||||
{
|
||||
QString Text = "Sandboxie-Plus";
|
||||
|
||||
if(!isConnected)
|
||||
Text += tr(" - Driver/Service NOT Running!");
|
||||
else if(m_iDeletingContent)
|
||||
Text += tr(" - Deleting Sandbox Content");
|
||||
|
||||
return Text;
|
||||
}
|
||||
|
||||
void CSandMan::OnShowHide()
|
||||
{
|
||||
if (isVisible()) {
|
||||
StoreState();
|
||||
hide();
|
||||
} else
|
||||
show();
|
||||
}
|
||||
|
||||
void CSandMan::OnSysTray(QSystemTrayIcon::ActivationReason Reason)
|
||||
{
|
||||
static bool TriggerSet = false;
|
||||
static bool NullifyTrigger = false;
|
||||
switch(Reason)
|
||||
{
|
||||
case QSystemTrayIcon::Context:
|
||||
{
|
||||
QMap<QString, CSandBoxPtr> Boxes = theAPI->GetAllBoxes();
|
||||
|
||||
int iSysTrayFilter = theConf->GetInt("Options/SysTrayFilter", 0);
|
||||
|
||||
bool bAdded = false;
|
||||
if (m_pTrayBoxes->topLevelItemCount() == 0)
|
||||
bAdded = true; // triger size refresh
|
||||
|
||||
QMap<QString, QTreeWidgetItem*> OldBoxes;
|
||||
for(int i = 0; i < m_pTrayBoxes->topLevelItemCount(); ++i)
|
||||
{
|
||||
QTreeWidgetItem* pItem = m_pTrayBoxes->topLevelItem(i);
|
||||
QString Name = pItem->data(0, Qt::UserRole).toString();
|
||||
OldBoxes.insert(Name,pItem);
|
||||
}
|
||||
|
||||
foreach(const CSandBoxPtr & pBox, Boxes)
|
||||
{
|
||||
if (!pBox->IsEnabled())
|
||||
continue;
|
||||
|
||||
CSandBoxPlus* pBoxEx = qobject_cast<CSandBoxPlus*>(pBox.data());
|
||||
|
||||
if (iSysTrayFilter == 2) { // pinned only
|
||||
if (!pBox->GetBool("PinToTray", false))
|
||||
continue;
|
||||
}
|
||||
else if (iSysTrayFilter == 1) { // active + pinned
|
||||
if (pBoxEx->GetActiveProcessCount() == 0 && !pBox->GetBool("PinToTray", false))
|
||||
continue;
|
||||
}
|
||||
|
||||
QTreeWidgetItem* pItem = OldBoxes.take(pBox->GetName());
|
||||
if(!pItem)
|
||||
{
|
||||
pItem = new QTreeWidgetItem();
|
||||
pItem->setData(0, Qt::UserRole, pBox->GetName());
|
||||
pItem->setText(0, " " + pBox->GetName().replace("_", " "));
|
||||
m_pTrayBoxes->addTopLevelItem(pItem);
|
||||
|
||||
bAdded = true;
|
||||
}
|
||||
|
||||
QIcon Icon = theGUI->GetBoxIcon(pBoxEx->GetType(), pBox->GetActiveProcessCount() != 0);
|
||||
pItem->setData(0, Qt::DecorationRole, Icon);
|
||||
}
|
||||
|
||||
foreach(QTreeWidgetItem* pItem, OldBoxes)
|
||||
delete pItem;
|
||||
|
||||
if (!OldBoxes.isEmpty() || bAdded)
|
||||
{
|
||||
auto palette = m_pTrayBoxes->palette();
|
||||
palette.setColor(QPalette::Base, m_pTrayMenu->palette().color(m_DarkTheme ? QPalette::Base : QPalette::Window));
|
||||
m_pTrayBoxes->setPalette(palette);
|
||||
m_pTrayBoxes->setFrameShape(QFrame::NoFrame);
|
||||
|
||||
//const int FrameWidth = m_pTrayBoxes->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
int Height = 0; //m_pTrayBoxes->header()->height() + (2 * FrameWidth);
|
||||
|
||||
for (QTreeWidgetItemIterator AllIterator(m_pTrayBoxes, QTreeWidgetItemIterator::All); *AllIterator; ++AllIterator)
|
||||
Height += m_pTrayBoxes->visualItemRect(*AllIterator).height();
|
||||
|
||||
QRect scrRect = this->screen()->availableGeometry();
|
||||
int MaxHeight = scrRect.height() / 2;
|
||||
if (Height > MaxHeight) {
|
||||
Height = MaxHeight;
|
||||
if (Height < 64)
|
||||
Height = 64;
|
||||
}
|
||||
|
||||
m_pTrayBoxes->setFixedHeight(Height);
|
||||
|
||||
m_pTrayMenu->removeAction(m_pTrayList);
|
||||
m_pTrayMenu->insertAction(m_pTraySeparator, m_pTrayList);
|
||||
|
||||
m_pTrayBoxes->setFocus();
|
||||
}
|
||||
|
||||
m_pTrayMenu->popup(QCursor::pos());
|
||||
break;
|
||||
}
|
||||
case QSystemTrayIcon::DoubleClick:
|
||||
if (isVisible())
|
||||
{
|
||||
if(TriggerSet)
|
||||
NullifyTrigger = true;
|
||||
|
||||
StoreState();
|
||||
hide();
|
||||
|
||||
if (theAPI->GetGlobalSettings()->GetBool("ForgetPassword", false))
|
||||
theAPI->ClearPassword();
|
||||
|
||||
break;
|
||||
}
|
||||
show();
|
||||
case QSystemTrayIcon::Trigger:
|
||||
if (isVisible() && !TriggerSet)
|
||||
{
|
||||
TriggerSet = true;
|
||||
QTimer::singleShot(100, [this]() {
|
||||
TriggerSet = false;
|
||||
if (NullifyTrigger) {
|
||||
NullifyTrigger = false;
|
||||
return;
|
||||
}
|
||||
this->setWindowState((this->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
||||
SetForegroundWindow(MainWndHandle);
|
||||
} );
|
||||
}
|
||||
m_pPopUpWindow->Poke();
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -286,62 +286,6 @@ void CSandMan::InstallUpdate()
|
|||
}
|
||||
}
|
||||
|
||||
void CSandMan::OnHelp()
|
||||
{
|
||||
if (sender() == m_pSupport)
|
||||
QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=donate"));
|
||||
else if (sender() == m_pForum)
|
||||
QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=sbie-forum"));
|
||||
else if (sender() == m_pManual)
|
||||
QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=sbie-docs"));
|
||||
else
|
||||
QDesktopServices::openUrl(QUrl("https://sandboxie-plus.com/go.php?to=patreon"));
|
||||
}
|
||||
|
||||
void CSandMan::OnAbout()
|
||||
{
|
||||
if (sender() == m_pAbout)
|
||||
{
|
||||
QString AboutCaption = tr(
|
||||
"<h3>About Sandboxie-Plus</h3>"
|
||||
"<p>Version %1</p>"
|
||||
"<p>Copyright (c) 2020-2022 by DavidXanatos</p>"
|
||||
).arg(GetVersion());
|
||||
|
||||
QString CertInfo;
|
||||
if (!g_Certificate.isEmpty()) {
|
||||
CertInfo = tr("This copy of Sandboxie+ is certified for: %1").arg(GetArguments(g_Certificate, L'\n', L':').value("NAME"));
|
||||
} else {
|
||||
CertInfo = tr("Sandboxie+ is free for personal and non-commercial use.");
|
||||
}
|
||||
|
||||
QString AboutText = tr(
|
||||
"Sandboxie-Plus is an open source continuation of Sandboxie.<br />"
|
||||
"Visit <a href=\"https://sandboxie-plus.com\">sandboxie-plus.com</a> for more information.<br />"
|
||||
"<br />"
|
||||
"%3<br />"
|
||||
"<br />"
|
||||
"Driver version: %1<br />"
|
||||
"Features: %2<br />"
|
||||
"<br />"
|
||||
"Icons from <a href=\"https://icons8.com\">icons8.com</a>"
|
||||
).arg(theAPI->GetVersion()).arg(theAPI->GetFeatureStr()).arg(CertInfo);
|
||||
|
||||
QMessageBox *msgBox = new QMessageBox(this);
|
||||
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
msgBox->setWindowTitle(tr("About Sandboxie-Plus"));
|
||||
msgBox->setText(AboutCaption);
|
||||
msgBox->setInformativeText(AboutText);
|
||||
|
||||
QIcon ico(QLatin1String(":/SandMan.png"));
|
||||
msgBox->setIconPixmap(ico.pixmap(128, 128));
|
||||
|
||||
SafeExec(msgBox);
|
||||
}
|
||||
else if (sender() == m_pAboutQt)
|
||||
QMessageBox::aboutQt(this);
|
||||
}
|
||||
|
||||
void CSandMan::UpdateCert()
|
||||
{
|
||||
QString UpdateKey; // for now only patreons can update the cert automatically
|
||||
|
@ -417,4 +361,4 @@ void CSandMan::OnCertCheck()
|
|||
g_Certificate.clear();
|
||||
g_CertInfo.State = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,15 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent)
|
|||
//m_pSbieTree->setItemDelegate(theGUI->GetItemDelegate());
|
||||
|
||||
m_pSbieTree->setModel(m_pSortProxy);
|
||||
|
||||
int iViewMode = theConf->GetInt("Options/ViewMode", 1);
|
||||
int iLargeIcons = theConf->GetInt("Options/LargeIcons", 2);
|
||||
if (iLargeIcons == 2)
|
||||
iLargeIcons = iViewMode == 2 ? 1 : 0;
|
||||
if (iLargeIcons) {
|
||||
m_pSbieModel->SetLargeIcons();
|
||||
m_pSbieTree->setIconSize(QSize(32, 32));
|
||||
}
|
||||
((CSortFilterProxyModel*)m_pSortProxy)->setView(m_pSbieTree);
|
||||
|
||||
m_pSbieTree->setDragDropMode(QAbstractItemView::InternalMove);
|
||||
|
@ -78,132 +87,12 @@ CSbieView::CSbieView(QWidget* parent) : CPanelView(parent)
|
|||
|
||||
connect(m_pSbieModel, SIGNAL(ToolTipCallback(const QVariant&, QString&)), this, SLOT(OnToolTipCallback(const QVariant&, QString&)), Qt::DirectConnection);
|
||||
|
||||
m_pNewBox = m_pMenu->addAction(CSandMan::GetIcon("NewBox"), tr("Create New Box"), this, SLOT(OnGroupAction()));
|
||||
m_pAddGroupe = m_pMenu->addAction(CSandMan::GetIcon("Group"), tr("Create Box Group"), this, SLOT(OnGroupAction()));
|
||||
m_pRenGroupe = m_pMenu->addAction(CSandMan::GetIcon("Rename"), tr("Rename Group"), this, SLOT(OnGroupAction()));
|
||||
m_pDelGroupe = m_pMenu->addAction(CSandMan::GetIcon("Remove"), tr("Remove Group"), this, SLOT(OnGroupAction()));
|
||||
m_pStopAsync = m_pMenu->addAction(CSandMan::GetIcon("Stop"), tr("Stop Operations"), this, SLOT(OnSandBoxAction()));
|
||||
m_iMenuTop = m_pMenu->actions().count();
|
||||
//m_pMenu->addSeparator();
|
||||
if(iViewMode == 2)
|
||||
CreateOldMenu();
|
||||
else
|
||||
CreateMenu();
|
||||
|
||||
m_pMenuRun = m_pMenu->addMenu(CSandMan::GetIcon("Start"), tr("Run"));
|
||||
m_pMenuRunAny = m_pMenuRun->addAction(CSandMan::GetIcon("Run"), tr("Run Program"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunMenu = m_pMenuRun->addAction(CSandMan::GetIcon("StartMenu"), tr("Run from Start Menu"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunBrowser = m_pMenuRun->addAction(CSandMan::GetIcon("Internet"), tr("Default Web Browser"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunMailer = m_pMenuRun->addAction(CSandMan::GetIcon("Email"), tr("Default eMail Client"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunCmd = m_pMenuRun->addAction(CSandMan::GetIcon("Cmd"), tr("Command Prompt"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunTools = m_pMenuRun->addMenu(CSandMan::GetIcon("Maintenance"), tr("Boxed Tools"));
|
||||
m_pMenuRunCmdAdmin = m_pMenuRunTools->addAction(CSandMan::GetIcon("Cmd"), tr("Command Prompt (as Admin)"), this, SLOT(OnSandBoxAction()));
|
||||
#ifndef _WIN64
|
||||
if(CSbieAPI::IsWow64())
|
||||
#endif
|
||||
m_pMenuRunCmd32 = m_pMenuRunTools->addAction(CSandMan::GetIcon("Cmd"), tr("Command Prompt (32-bit)"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunExplorer = m_pMenuRunTools->addAction(CSandMan::GetIcon("Explore"), tr("Windows Explorer"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunRegEdit = m_pMenuRunTools->addAction(CSandMan::GetIcon("RegEdit"), tr("Registry Editor"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunAppWiz = m_pMenuRunTools->addAction(CSandMan::GetIcon("Software"), tr("Programs and Features"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuAutoRun = m_pMenuRunTools->addAction(CSandMan::GetIcon("ReloadIni"), tr("Execute Autorun Entries"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRun->addSeparator();
|
||||
m_iMenuRun = m_pMenuRun->actions().count();
|
||||
m_pMenuEmptyBox = m_pMenu->addAction(CSandMan::GetIcon("EmptyAll"), tr("Terminate All Programs"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenu->addSeparator();
|
||||
m_pMenuBrowse = m_pMenu->addAction(CSandMan::GetIcon("Tree"), tr("Browse Content"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuContent = m_pMenu->addMenu(CSandMan::GetIcon("Compatibility"), tr("Box Content"));
|
||||
m_pMenuMkLink = m_pMenuContent->addAction(CSandMan::GetIcon("MkLink"), tr("Create Shortcut"), this, SLOT(OnSandBoxAction()));
|
||||
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_pMenuRefresh = m_pMenu->addAction(CSandMan::GetIcon("Refresh"), tr("Refresh Info"), 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();
|
||||
m_pMenuOptions = m_pMenu->addAction(CSandMan::GetIcon("Options"), tr("Sandbox Options"), this, SLOT(OnSandBoxAction()));
|
||||
|
||||
m_pMenuPresets = m_pMenu->addMenu(CSandMan::GetIcon("Presets"), tr("Sandbox Presets"));
|
||||
m_pMenuPresetsAdmin = new QActionGroup(m_pMenuPresets);
|
||||
m_pMenuPresetsShowUAC = MakeAction(m_pMenuPresetsAdmin, m_pMenuPresets, tr("Ask for UAC Elevation"), 0);
|
||||
m_pMenuPresetsNoAdmin = MakeAction(m_pMenuPresetsAdmin, m_pMenuPresets, tr("Drop Admin Rights"), 1);
|
||||
m_pMenuPresetsFakeAdmin = MakeAction(m_pMenuPresetsAdmin, m_pMenuPresets, tr("Emulate Admin Rights"), 1 | 2);
|
||||
if (theAPI->IsRunningAsAdmin()) {
|
||||
m_pMenuPresetsNoAdmin->setEnabled(false);
|
||||
m_pMenuPresetsFakeAdmin->setEnabled(false);
|
||||
}
|
||||
connect(m_pMenuPresetsAdmin, SIGNAL(triggered(QAction*)), this, SLOT(OnSandBoxAction(QAction*)));
|
||||
|
||||
m_pMenuPresets->addSeparator();
|
||||
m_pMenuPresetsINet = m_pMenuPresets->addAction(tr("Block Internet Access"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuPresetsINet->setCheckable(true);
|
||||
m_pMenuPresetsShares = m_pMenuPresets->addAction(tr("Allow Network Shares"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuPresetsShares->setCheckable(true);
|
||||
|
||||
m_pMenuPresets->addSeparator();
|
||||
m_pMenuPresetsRecovery = m_pMenuPresets->addAction(tr("Immediate Recovery"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuPresetsRecovery->setCheckable(true);
|
||||
|
||||
m_pMenuDuplicate = m_pMenu->addAction(CSandMan::GetIcon("Duplicate"), tr("Duplicate Sandbox"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRename = m_pMenu->addAction(CSandMan::GetIcon("Rename"), tr("Rename Sandbox"), this, SLOT(OnSandBoxAction()));
|
||||
m_iMoveTo = m_pMenu->actions().count();
|
||||
m_pMenuMoveTo = m_pMenu->addMenu(CSandMan::GetIcon("Group"), tr("Move Box/Group"));
|
||||
m_pMenuMoveUp = m_pMenuMoveTo->addAction(CSandMan::GetIcon("Up"), tr("Move Up"), this, SLOT(OnGroupAction()));
|
||||
m_pMenuMoveUp->setShortcut(QKeySequence("Alt+Up"));
|
||||
m_pMenuMoveUp->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
this->addAction(m_pMenuMoveUp);
|
||||
//m_pMenuMoveBy = m_pMenuMoveTo->addAction(tr("Move to Position"), this, SLOT(OnGroupAction())); // does not seam that intuitive for users
|
||||
m_pMenuMoveDown = m_pMenuMoveTo->addAction(CSandMan::GetIcon("Down"), tr("Move Down"), this, SLOT(OnGroupAction()));
|
||||
m_pMenuMoveDown->setShortcut(QKeySequence("Alt+Down"));
|
||||
m_pMenuMoveDown->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
this->addAction(m_pMenuMoveDown);
|
||||
m_pMenuMoveTo->addSeparator();
|
||||
m_pMenuRemove = m_pMenu->addAction(CSandMan::GetIcon("Remove"), tr("Remove Sandbox"), this, SLOT(OnSandBoxAction()));
|
||||
m_iMenuBox = m_pMenu->actions().count();
|
||||
|
||||
//UpdateRunMenu();
|
||||
|
||||
m_pMenuTerminate = m_pMenu->addAction(CSandMan::GetIcon("Remove"), tr("Terminate"), this, SLOT(OnProcessAction()));
|
||||
//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);
|
||||
this->addAction(m_pMenuBlackList);
|
||||
m_pMenuAllowInternet = m_pMenuPreset->addAction(tr("Allow internet access"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuAllowInternet->setCheckable(true);
|
||||
m_pMenuMarkForced = m_pMenuPreset->addAction(tr("Force into this sandbox"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuMarkForced->setCheckable(true);
|
||||
m_pMenuMarkLinger = m_pMenuPreset->addAction(tr("Set Linger Process"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuMarkLinger->setCheckable(true);
|
||||
m_pMenuMarkLeader = m_pMenuPreset->addAction(tr("Set Leader Process"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuMarkLeader->setCheckable(true);
|
||||
//m_pMenuSuspend = m_pMenu->addAction(tr("Suspend"), this, SLOT(OnProcessAction()));
|
||||
//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();
|
||||
m_pMenu2->addMenu(m_pMenuRun);
|
||||
m_pMenu2->addAction(m_pMenuEmptyBox);
|
||||
m_pMenu2->addSeparator();
|
||||
m_pMenu2->addAction(m_pMenuBrowse);
|
||||
m_pMenu2->addAction(m_pMenuExplore);
|
||||
m_pMenu2->addAction(m_pMenuRegEdit);
|
||||
m_pMenu2->addAction(m_pMenuSnapshots);
|
||||
m_pMenu2->addAction(m_pMenuRecover);
|
||||
m_pMenu2->addAction(m_pMenuCleanUp);
|
||||
m_pMenu2->addSeparator();
|
||||
m_pMenu2->addAction(m_pMenuOptions);
|
||||
m_pMenu2->addMenu(m_pMenuPresets);
|
||||
CreatTrayMenu();
|
||||
|
||||
QByteArray Columns = theConf->GetBlob("MainWindow/BoxTree_Columns");
|
||||
if (Columns.isEmpty())
|
||||
|
@ -237,7 +126,246 @@ void CSbieView::Clear()
|
|||
m_pSbieModel->Clear();
|
||||
}
|
||||
|
||||
void CSbieView::CreateMenu()
|
||||
{
|
||||
m_pNewBox = m_pMenu->addAction(CSandMan::GetIcon("NewBox"), tr("Create New Box"), this, SLOT(OnGroupAction()));
|
||||
m_pAddGroupe = m_pMenu->addAction(CSandMan::GetIcon("Group"), tr("Create Box Group"), this, SLOT(OnGroupAction()));
|
||||
m_pMenu->addSeparator();
|
||||
m_pRenGroupe = m_pMenu->addAction(CSandMan::GetIcon("Rename"), tr("Rename Group"), this, SLOT(OnGroupAction()));
|
||||
m_pDelGroupe = m_pMenu->addAction(CSandMan::GetIcon("Remove"), tr("Remove Group"), this, SLOT(OnGroupAction()));
|
||||
m_pStopAsync = m_pMenu->addAction(CSandMan::GetIcon("Stop"), tr("Stop Operations"), this, SLOT(OnSandBoxAction()));
|
||||
m_iMenuTop = m_pMenu->actions().count();
|
||||
//m_pMenu->addSeparator();
|
||||
|
||||
m_pMenuRun = m_pMenu->addMenu(CSandMan::GetIcon("Start"), tr("Run"));
|
||||
m_pMenuRunAny = m_pMenuRun->addAction(CSandMan::GetIcon("Run"), tr("Run Program"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunMenu = m_pMenuRun->addAction(CSandMan::GetIcon("StartMenu"), tr("Run from Start Menu"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunBrowser = m_pMenuRun->addAction(CSandMan::GetIcon("Internet"), tr("Default Web Browser"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunMailer = m_pMenuRun->addAction(CSandMan::GetIcon("Email"), tr("Default eMail Client"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunCmd = m_pMenuRun->addAction(CSandMan::GetIcon("Cmd"), tr("Command Prompt"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunTools = m_pMenuRun->addMenu(CSandMan::GetIcon("Maintenance"), tr("Boxed Tools"));
|
||||
m_pMenuRunCmdAdmin = m_pMenuRunTools->addAction(CSandMan::GetIcon("Cmd"), tr("Command Prompt (as Admin)"), this, SLOT(OnSandBoxAction()));
|
||||
#ifndef _WIN64
|
||||
if(CSbieAPI::IsWow64())
|
||||
#endif
|
||||
m_pMenuRunCmd32 = m_pMenuRunTools->addAction(CSandMan::GetIcon("Cmd"), tr("Command Prompt (32-bit)"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunExplorer = m_pMenuRunTools->addAction(CSandMan::GetIcon("Explore"), tr("Windows Explorer"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunRegEdit = m_pMenuRunTools->addAction(CSandMan::GetIcon("RegEdit"), tr("Registry Editor"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunAppWiz = m_pMenuRunTools->addAction(CSandMan::GetIcon("Software"), tr("Programs and Features"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuAutoRun = m_pMenuRunTools->addAction(CSandMan::GetIcon("ReloadIni"), tr("Execute Autorun Entries"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRun->addSeparator();
|
||||
m_iMenuRun = m_pMenuRun->actions().count();
|
||||
m_pMenuEmptyBox = m_pMenu->addAction(CSandMan::GetIcon("EmptyAll"), tr("Terminate All Programs"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenu->addSeparator();
|
||||
m_pMenuBrowse = m_pMenu->addAction(CSandMan::GetIcon("Tree"), tr("Browse Content"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuContent = m_pMenu->addMenu(CSandMan::GetIcon("Compatibility"), tr("Box Content"));
|
||||
m_pMenuRefresh = m_pMenuContent->addAction(CSandMan::GetIcon("Refresh"), tr("Refresh Info"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuMkLink = m_pMenuContent->addAction(CSandMan::GetIcon("MkLink"), tr("Create Shortcut"), this, SLOT(OnSandBoxAction()));
|
||||
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();
|
||||
m_pMenuOptions = m_pMenu->addAction(CSandMan::GetIcon("Options"), tr("Sandbox Options"), this, SLOT(OnSandBoxAction()));
|
||||
|
||||
m_pMenuPresets = m_pMenu->addMenu(CSandMan::GetIcon("Presets"), tr("Sandbox Presets"));
|
||||
m_pMenuPresetsAdmin = new QActionGroup(m_pMenuPresets);
|
||||
m_pMenuPresetsShowUAC = MakeAction(m_pMenuPresetsAdmin, m_pMenuPresets, tr("Ask for UAC Elevation"), 0);
|
||||
m_pMenuPresetsNoAdmin = MakeAction(m_pMenuPresetsAdmin, m_pMenuPresets, tr("Drop Admin Rights"), 1);
|
||||
m_pMenuPresetsFakeAdmin = MakeAction(m_pMenuPresetsAdmin, m_pMenuPresets, tr("Emulate Admin Rights"), 1 | 2);
|
||||
if (theAPI->IsRunningAsAdmin()) {
|
||||
m_pMenuPresetsNoAdmin->setEnabled(false);
|
||||
m_pMenuPresetsFakeAdmin->setEnabled(false);
|
||||
}
|
||||
connect(m_pMenuPresetsAdmin, SIGNAL(triggered(QAction*)), this, SLOT(OnSandBoxAction(QAction*)));
|
||||
|
||||
m_pMenuPresets->addSeparator();
|
||||
m_pMenuPresetsINet = m_pMenuPresets->addAction(tr("Block Internet Access"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuPresetsINet->setCheckable(true);
|
||||
m_pMenuPresetsShares = m_pMenuPresets->addAction(tr("Allow Network Shares"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuPresetsShares->setCheckable(true);
|
||||
|
||||
m_pMenuPresets->addSeparator();
|
||||
m_pMenuPresetsRecovery = m_pMenuPresets->addAction(tr("Immediate Recovery"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuPresetsRecovery->setCheckable(true);
|
||||
|
||||
m_pMenuTools = m_pMenu->addMenu(CSandMan::GetIcon("Maintenance"), tr("Sandbox Tools"));
|
||||
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()));
|
||||
m_iMoveTo = m_pMenu->actions().count();
|
||||
m_pMenuMoveTo = m_pMenu->addMenu(CSandMan::GetIcon("Group"), tr("Move Box/Group"));
|
||||
m_pMenuMoveUp = m_pMenuMoveTo->addAction(CSandMan::GetIcon("Up"), tr("Move Up"), this, SLOT(OnGroupAction()));
|
||||
m_pMenuMoveUp->setShortcut(QKeySequence("Alt+Up"));
|
||||
m_pMenuMoveUp->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
this->addAction(m_pMenuMoveUp);
|
||||
//m_pMenuMoveBy = m_pMenuMoveTo->addAction(tr("Move to Position"), this, SLOT(OnGroupAction())); // does not seam that intuitive for users
|
||||
m_pMenuMoveDown = m_pMenuMoveTo->addAction(CSandMan::GetIcon("Down"), tr("Move Down"), this, SLOT(OnGroupAction()));
|
||||
m_pMenuMoveDown->setShortcut(QKeySequence("Alt+Down"));
|
||||
m_pMenuMoveDown->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
this->addAction(m_pMenuMoveDown);
|
||||
m_pMenuMoveTo->addSeparator();
|
||||
m_pMenuRemove = m_pMenu->addAction(CSandMan::GetIcon("Remove"), tr("Remove Sandbox"), this, SLOT(OnSandBoxAction()));
|
||||
m_iMenuBox = m_pMenu->actions().count();
|
||||
|
||||
|
||||
// Process Menu
|
||||
m_pMenuTerminate = m_pMenu->addAction(CSandMan::GetIcon("Remove"), tr("Terminate"), this, SLOT(OnProcessAction()));
|
||||
//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);
|
||||
this->addAction(m_pMenuBlackList);
|
||||
m_pMenuAllowInternet = m_pMenuPreset->addAction(tr("Allow internet access"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuAllowInternet->setCheckable(true);
|
||||
m_pMenuMarkForced = m_pMenuPreset->addAction(tr("Force into this sandbox"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuMarkForced->setCheckable(true);
|
||||
m_pMenuMarkLinger = m_pMenuPreset->addAction(tr("Set Linger Process"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuMarkLinger->setCheckable(true);
|
||||
m_pMenuMarkLeader = m_pMenuPreset->addAction(tr("Set Leader Process"), this, SLOT(OnProcessAction()));
|
||||
m_pMenuMarkLeader->setCheckable(true);
|
||||
//m_pMenuSuspend = m_pMenu->addAction(tr("Suspend"), this, SLOT(OnProcessAction()));
|
||||
//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()));
|
||||
}
|
||||
|
||||
void CSbieView::CreateOldMenu()
|
||||
{
|
||||
m_pNewBox = m_pMenu->addAction(CSandMan::GetIcon("NewBox"), tr("Create New Box"), this, SLOT(OnGroupAction()));
|
||||
m_pAddGroupe = m_pMenu->addAction(CSandMan::GetIcon("Group"), tr("Create Box Group"), this, SLOT(OnGroupAction()));
|
||||
m_pMenu->addSeparator();
|
||||
m_pRenGroupe = m_pMenu->addAction(CSandMan::GetIcon("Rename"), tr("Rename Group"), this, SLOT(OnGroupAction()));
|
||||
m_pDelGroupe = m_pMenu->addAction(CSandMan::GetIcon("Remove"), tr("Remove Group"), this, SLOT(OnGroupAction()));
|
||||
m_pStopAsync = m_pMenu->addAction(CSandMan::GetIcon("Stop"), tr("Stop Operations"), this, SLOT(OnSandBoxAction()));
|
||||
m_iMenuTop = m_pMenu->actions().count();
|
||||
//m_pMenu->addSeparator();
|
||||
|
||||
m_pMenuRun = m_pMenu->addMenu(CSandMan::GetIcon("Start"), tr("Run Sandboxed"));
|
||||
m_pMenuRunBrowser = m_pMenuRun->addAction(CSandMan::GetIcon("Internet"), tr("Run Web Browser"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunMailer = m_pMenuRun->addAction(CSandMan::GetIcon("Email"), tr("Run eMail Reader"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunAny = m_pMenuRun->addAction(CSandMan::GetIcon("Run"), tr("Run Any Program"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunMenu = m_pMenuRun->addAction(CSandMan::GetIcon("StartMenu"), tr("Run From Start Menu"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunExplorer = m_pMenuRun->addAction(CSandMan::GetIcon("Explore"), tr("Run Windows Explorer"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRunCmd = NULL;
|
||||
m_pMenuRunTools = NULL;
|
||||
m_pMenuRunCmdAdmin = NULL;
|
||||
m_pMenuRunCmd32 = NULL;
|
||||
m_pMenuRunRegEdit = NULL;
|
||||
m_pMenuRunAppWiz = NULL;
|
||||
m_pMenuAutoRun = NULL;
|
||||
m_pMenuRun->addSeparator();
|
||||
m_iMenuRun = m_pMenuRun->actions().count();
|
||||
|
||||
m_pMenu->addSeparator();
|
||||
m_pMenuEmptyBox = m_pMenu->addAction(CSandMan::GetIcon("EmptyAll"), tr("Terminate Programs"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuRecover = m_pMenu->addAction(CSandMan::GetIcon("Recover"), tr("Quick Recover"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuCleanUp = m_pMenu->addAction(CSandMan::GetIcon("Erase"), tr("Delete Content"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuExplore = m_pMenu->addAction(CSandMan::GetIcon("Explore"), tr("Explore Content"), this, SLOT(OnSandBoxAction()));
|
||||
|
||||
m_pMenu->addSeparator();
|
||||
m_pMenuOptions = m_pMenu->addAction(CSandMan::GetIcon("Options"), tr("Sandbox Settings"), this, SLOT(OnSandBoxAction()));
|
||||
|
||||
m_pMenuTools = m_pMenu->addMenu(CSandMan::GetIcon("Maintenance"), tr("Sandbox Tools"));
|
||||
m_pMenuBrowse = m_pMenuTools->addAction(CSandMan::GetIcon("Tree"), tr("Browse Content"), this, SLOT(OnSandBoxAction()));
|
||||
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_pMenuTools->addSeparator();
|
||||
m_pMenuRefresh = m_pMenuTools->addAction(CSandMan::GetIcon("Refresh"), tr("Refresh Info"), this, SLOT(OnSandBoxAction()));
|
||||
m_pMenuMkLink = m_pMenuTools->addAction(CSandMan::GetIcon("MkLink"), tr("Create Shortcut"), this, SLOT(OnSandBoxAction()));
|
||||
|
||||
m_pMenu->addSeparator();
|
||||
m_pMenuRename = m_pMenu->addAction(CSandMan::GetIcon("Rename"), tr("Rename Sandbox"), this, SLOT(OnSandBoxAction()));
|
||||
m_iMoveTo = m_pMenu->actions().count();
|
||||
m_pMenuMoveTo = m_pMenu->addMenu(CSandMan::GetIcon("Group"), tr("Move Box/Group"));
|
||||
m_pMenuMoveUp = m_pMenuMoveTo->addAction(CSandMan::GetIcon("Up"), tr("Move Up"), this, SLOT(OnGroupAction()));
|
||||
m_pMenuMoveUp->setShortcut(QKeySequence("Alt+Up"));
|
||||
m_pMenuMoveUp->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
this->addAction(m_pMenuMoveUp);
|
||||
//m_pMenuMoveBy = m_pMenuMoveTo->addAction(tr("Move to Position"), this, SLOT(OnGroupAction())); // does not seam that intuitive for users
|
||||
m_pMenuMoveDown = m_pMenuMoveTo->addAction(CSandMan::GetIcon("Down"), tr("Move Down"), this, SLOT(OnGroupAction()));
|
||||
m_pMenuMoveDown->setShortcut(QKeySequence("Alt+Down"));
|
||||
m_pMenuMoveDown->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
this->addAction(m_pMenuMoveDown);
|
||||
m_pMenuMoveTo->addSeparator();
|
||||
m_pMenuRemove = m_pMenu->addAction(CSandMan::GetIcon("Remove"), tr("Remove Sandbox"), this, SLOT(OnSandBoxAction()));
|
||||
m_iMenuBox = m_pMenu->actions().count();
|
||||
|
||||
|
||||
|
||||
m_pMenuContent = NULL;
|
||||
m_pMenuRegEdit = NULL;
|
||||
|
||||
m_pMenuPresets = NULL;
|
||||
m_pMenuPresetsAdmin = NULL;
|
||||
m_pMenuPresetsShowUAC = NULL;
|
||||
m_pMenuPresetsNoAdmin = NULL;
|
||||
m_pMenuPresetsFakeAdmin = NULL;
|
||||
|
||||
m_pMenuPresetsINet = NULL;
|
||||
m_pMenuPresetsShares = NULL;
|
||||
|
||||
m_pMenuPresetsRecovery = NULL;
|
||||
|
||||
|
||||
// Process Menu
|
||||
m_pMenuTerminate = m_pMenu->addAction(CSandMan::GetIcon("Remove"), tr("Terminate"), this, SLOT(OnProcessAction()));
|
||||
//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 = NULL;
|
||||
m_pMenuPinToRun = NULL;
|
||||
m_pMenuBlackList = NULL;
|
||||
m_pMenuAllowInternet = NULL;
|
||||
m_pMenuMarkForced = NULL;
|
||||
m_pMenuMarkLinger = NULL;
|
||||
m_pMenuMarkLeader = NULL;
|
||||
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()));
|
||||
}
|
||||
|
||||
void CSbieView::CreatTrayMenu()
|
||||
{
|
||||
m_pMenu2 = new QMenu();
|
||||
m_pMenu2->addMenu(m_pMenuRun);
|
||||
m_pMenu2->addAction(m_pMenuEmptyBox);
|
||||
m_pMenu2->addSeparator();
|
||||
m_pMenu2->addAction(m_pMenuBrowse);
|
||||
m_pMenu2->addAction(m_pMenuExplore);
|
||||
m_pMenu2->addAction(m_pMenuRegEdit);
|
||||
m_pMenu2->addAction(m_pMenuSnapshots);
|
||||
m_pMenu2->addAction(m_pMenuRecover);
|
||||
m_pMenu2->addAction(m_pMenuCleanUp);
|
||||
m_pMenu2->addSeparator();
|
||||
if (m_pMenuPresets) {
|
||||
m_pMenu2->addAction(m_pMenuOptions);
|
||||
m_pMenu2->addMenu(m_pMenuPresets);
|
||||
}
|
||||
}
|
||||
|
||||
int CSbieView__ParseGroup(const QString& Grouping, QMap<QString, QStringList>& m_Groups, const QString& Parent = "", int Index = 0)
|
||||
{
|
||||
|
@ -382,7 +510,7 @@ void CSbieView::OnCustomSortByColumn(int column)
|
|||
}
|
||||
}
|
||||
|
||||
bool CSbieView::UpdateMenu()
|
||||
bool CSbieView::UpdateMenu(const CSandBoxPtr &pBox, int iSandBoxeCount, bool bBoxBusy, const CBoxedProcessPtr &pProcess, int iProcessCount, int iGroupe)
|
||||
{
|
||||
QList<QAction*> MenuActions = m_pMenu->actions();
|
||||
|
||||
|
@ -391,7 +519,112 @@ bool CSbieView::UpdateMenu()
|
|||
// foreach(QAction * pAction, MenuActions)
|
||||
// pAction->setEnabled(true);
|
||||
//}
|
||||
|
||||
|
||||
for (int i = 0; i < m_iMenuTop; i++)
|
||||
MenuActions[i]->setVisible(!bBoxBusy && iSandBoxeCount == 0 && iProcessCount == 0);
|
||||
m_pStopAsync->setVisible(bBoxBusy);
|
||||
m_pRenGroupe->setVisible(iGroupe == 1 && iSandBoxeCount == 0 && iProcessCount == 0);
|
||||
m_pDelGroupe->setVisible(iGroupe > 0 && iSandBoxeCount == 0 && iProcessCount == 0);
|
||||
|
||||
for (int i = m_iMenuTop; i < m_iMenuBox; i++)
|
||||
MenuActions[i]->setVisible(iSandBoxeCount != 0 && iProcessCount == 0);
|
||||
m_pMenuRun->setEnabled(iSandBoxeCount == 1);
|
||||
|
||||
MenuActions[m_iMoveTo]->setVisible((iGroupe > 0 || iSandBoxeCount > 0) && iProcessCount == 0);
|
||||
|
||||
if(iSandBoxeCount == 1)
|
||||
UpdateRunMenu(pBox);
|
||||
|
||||
m_pMenuMkLink->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuTools->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuRename->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuRecover->setEnabled(iSandBoxeCount == 1);
|
||||
|
||||
if (m_pMenuPresets) {
|
||||
m_pMenuPresets->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuPresetsShowUAC->setChecked(pBox && !pBox->GetBool("DropAdminRights", false) && !pBox->GetBool("FakeAdminRights", false));
|
||||
m_pMenuPresetsNoAdmin->setChecked(pBox && pBox->GetBool("DropAdminRights", false) && !pBox->GetBool("FakeAdminRights", false));
|
||||
m_pMenuPresetsFakeAdmin->setChecked(pBox && pBox->GetBool("DropAdminRights", false) && pBox->GetBool("FakeAdminRights", false));
|
||||
m_pMenuPresetsINet->setChecked(pBox && pBox.objectCast<CSandBoxPlus>()->IsINetBlocked());
|
||||
m_pMenuPresetsShares->setChecked(pBox && pBox.objectCast<CSandBoxPlus>()->HasSharesAccess());
|
||||
m_pMenuPresetsRecovery->setChecked(pBox && pBox->GetBool("AutoRecover", false));
|
||||
}
|
||||
|
||||
m_pMenuBrowse->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuExplore->setEnabled(iSandBoxeCount == 1);
|
||||
if(m_pMenuRegEdit)m_pMenuRegEdit->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuOptions->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuSnapshots->setEnabled(iSandBoxeCount == 1);
|
||||
|
||||
//m_pMenuMoveUp->setEnabled(m_pSortProxy->sortRole() == Qt::InitialSortOrderRole);
|
||||
//m_pMenuMoveDown->setEnabled(m_pSortProxy->sortRole() == Qt::InitialSortOrderRole);
|
||||
//m_pMenuMoveBy->setEnabled(m_pSortProxy->sortRole() == Qt::InitialSortOrderRole);
|
||||
|
||||
for (int i = m_iMenuBox; i < m_iMenuProc; i++)
|
||||
MenuActions[i]->setVisible(iProcessCount != 0 && iSandBoxeCount == 0);
|
||||
|
||||
m_pMenuLinkTo->setEnabled(iProcessCount == 1);
|
||||
|
||||
if (!pProcess.isNull()) {
|
||||
CSandBoxPlus* pBoxPlus = pProcess.objectCast<CSbieProcess>()->GetBox();
|
||||
QStringList RunOptions = pBoxPlus->GetTextList("RunCommand", true);
|
||||
|
||||
QString FoundPin;
|
||||
QString FileName = pProcess->GetFileName();
|
||||
foreach(const QString& RunOption, RunOptions) {
|
||||
QString Cmd = Split2(RunOption, "|").second;
|
||||
int pos = Cmd.indexOf(FileName);
|
||||
if (pos == 0 || pos == 1) { // 1 for "
|
||||
FoundPin = RunOption;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (FoundPin.isEmpty() && FileName.indexOf(pBoxPlus->GetFileRoot(), Qt::CaseInsensitive) == 0) {
|
||||
FileName.remove(0, pBoxPlus->GetFileRoot().length());
|
||||
foreach(const QString& RunOption, RunOptions) {
|
||||
if (Split2(RunOption, "|").second.indexOf(FileName) == 0) {
|
||||
FoundPin = RunOption;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pMenuPreset) {
|
||||
m_pMenuPinToRun->setChecked(!FoundPin.isEmpty());
|
||||
m_pMenuPinToRun->setData(FoundPin);
|
||||
|
||||
m_pMenuAllowInternet->setChecked(pProcess.objectCast<CSbieProcess>()->HasInternetAccess());
|
||||
|
||||
m_pMenuMarkForced->setChecked(pProcess.objectCast<CSbieProcess>()->IsForcedProgram());
|
||||
|
||||
int isLingering = pProcess.objectCast<CSbieProcess>()->IsLingeringProgram();
|
||||
m_pMenuMarkLinger->setChecked(isLingering != 0);
|
||||
m_pMenuMarkLinger->setEnabled(isLingering != 2);
|
||||
m_pMenuMarkLeader->setChecked(pProcess.objectCast<CSbieProcess>()->IsLeaderProgram());
|
||||
}
|
||||
}
|
||||
|
||||
//m_pMenuSuspend->setEnabled(iProcessCount > iSuspendedCount);
|
||||
//m_pMenuResume->setEnabled(iSuspendedCount > 0);
|
||||
|
||||
//if (!isConnected) {
|
||||
// foreach(QAction * pAction, MenuActions)
|
||||
// pAction->setEnabled(false);
|
||||
//}
|
||||
|
||||
bool bCtrl = theConf->GetInt("Options/ViewMode", 1) == 1
|
||||
|| (QGuiApplication::queryKeyboardModifiers() & Qt::ControlModifier) != 0;
|
||||
|
||||
m_pCopyCell->setVisible(bCtrl);
|
||||
m_pCopyRow->setVisible(bCtrl);
|
||||
m_pCopyPanel->setVisible(bCtrl);
|
||||
|
||||
return bBoxBusy == false;
|
||||
}
|
||||
|
||||
bool CSbieView::UpdateMenu()
|
||||
{
|
||||
CSandBoxPtr pBox;
|
||||
bool bBoxBusy = false;
|
||||
CBoxedProcessPtr pProcess;
|
||||
|
@ -435,95 +668,7 @@ bool CSbieView::UpdateMenu()
|
|||
iGroupe = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_iMenuTop; i++)
|
||||
MenuActions[i]->setVisible(!bBoxBusy && iSandBoxeCount == 0 && iProcessCount == 0);
|
||||
m_pStopAsync->setVisible(bBoxBusy);
|
||||
m_pRenGroupe->setVisible(iGroupe == 1 && iSandBoxeCount == 0 && iProcessCount == 0);
|
||||
m_pDelGroupe->setVisible(iGroupe > 0 && iSandBoxeCount == 0 && iProcessCount == 0);
|
||||
|
||||
for (int i = m_iMenuTop; i < m_iMenuBox; i++)
|
||||
MenuActions[i]->setVisible(iSandBoxeCount != 0 && iProcessCount == 0);
|
||||
m_pMenuRun->setEnabled(iSandBoxeCount == 1);
|
||||
|
||||
MenuActions[m_iMoveTo]->setVisible((iGroupe > 0 || iSandBoxeCount > 0) && iProcessCount == 0);
|
||||
|
||||
if(iSandBoxeCount == 1)
|
||||
UpdateRunMenu(pBox);
|
||||
|
||||
m_pMenuMkLink->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuDuplicate->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuRename->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuRecover->setEnabled(iSandBoxeCount == 1);
|
||||
|
||||
m_pMenuPresets->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuPresetsShowUAC->setChecked(pBox && !pBox->GetBool("DropAdminRights", false) && !pBox->GetBool("FakeAdminRights", false));
|
||||
m_pMenuPresetsNoAdmin->setChecked(pBox && pBox->GetBool("DropAdminRights", false) && !pBox->GetBool("FakeAdminRights", false));
|
||||
m_pMenuPresetsFakeAdmin->setChecked(pBox && pBox->GetBool("DropAdminRights", false) && pBox->GetBool("FakeAdminRights", false));
|
||||
m_pMenuPresetsINet->setChecked(pBox && pBox.objectCast<CSandBoxPlus>()->IsINetBlocked());
|
||||
m_pMenuPresetsShares->setChecked(pBox && pBox.objectCast<CSandBoxPlus>()->HasSharesAccess());
|
||||
m_pMenuPresetsRecovery->setChecked(pBox && pBox->GetBool("AutoRecover", false));
|
||||
|
||||
m_pMenuBrowse->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuExplore->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuRegEdit->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuOptions->setEnabled(iSandBoxeCount == 1);
|
||||
m_pMenuSnapshots->setEnabled(iSandBoxeCount == 1);
|
||||
|
||||
//m_pMenuMoveUp->setEnabled(m_pSortProxy->sortRole() == Qt::InitialSortOrderRole);
|
||||
//m_pMenuMoveDown->setEnabled(m_pSortProxy->sortRole() == Qt::InitialSortOrderRole);
|
||||
//m_pMenuMoveBy->setEnabled(m_pSortProxy->sortRole() == Qt::InitialSortOrderRole);
|
||||
|
||||
for (int i = m_iMenuBox; i < m_iMenuProc; i++)
|
||||
MenuActions[i]->setVisible(iProcessCount != 0 && iSandBoxeCount == 0);
|
||||
|
||||
m_pMenuLinkTo->setEnabled(iProcessCount == 1);
|
||||
|
||||
if (!pProcess.isNull()) {
|
||||
CSandBoxPlus* pBoxPlus = pProcess.objectCast<CSbieProcess>()->GetBox();
|
||||
QStringList RunOptions = pBoxPlus->GetTextList("RunCommand", true);
|
||||
|
||||
QString FoundPin;
|
||||
QString FileName = pProcess->GetFileName();
|
||||
foreach(const QString& RunOption, RunOptions) {
|
||||
QString Cmd = Split2(RunOption, "|").second;
|
||||
int pos = Cmd.indexOf(FileName);
|
||||
if (pos == 0 || pos == 1) { // 1 for "
|
||||
FoundPin = RunOption;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (FoundPin.isEmpty() && FileName.indexOf(pBoxPlus->GetFileRoot(), Qt::CaseInsensitive) == 0) {
|
||||
FileName.remove(0, pBoxPlus->GetFileRoot().length());
|
||||
foreach(const QString& RunOption, RunOptions) {
|
||||
if (Split2(RunOption, "|").second.indexOf(FileName) == 0) {
|
||||
FoundPin = RunOption;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_pMenuPinToRun->setChecked(!FoundPin.isEmpty());
|
||||
m_pMenuPinToRun->setData(FoundPin);
|
||||
|
||||
m_pMenuAllowInternet->setChecked(pProcess.objectCast<CSbieProcess>()->HasInternetAccess());
|
||||
|
||||
m_pMenuMarkForced->setChecked(pProcess.objectCast<CSbieProcess>()->IsForcedProgram());
|
||||
|
||||
int isLingering = pProcess.objectCast<CSbieProcess>()->IsLingeringProgram();
|
||||
m_pMenuMarkLinger->setChecked(isLingering != 0);
|
||||
m_pMenuMarkLinger->setEnabled(isLingering != 2);
|
||||
m_pMenuMarkLeader->setChecked(pProcess.objectCast<CSbieProcess>()->IsLeaderProgram());
|
||||
}
|
||||
|
||||
//m_pMenuSuspend->setEnabled(iProcessCount > iSuspendedCount);
|
||||
//m_pMenuResume->setEnabled(iSuspendedCount > 0);
|
||||
|
||||
//if (!isConnected) {
|
||||
// foreach(QAction * pAction, MenuActions)
|
||||
// pAction->setEnabled(false);
|
||||
//}
|
||||
|
||||
return bBoxBusy == false;
|
||||
return UpdateMenu(pBox, iSandBoxeCount, bBoxBusy, pProcess, iProcessCount, iGroupe);
|
||||
}
|
||||
|
||||
void CSbieView::OnMenu(const QPoint& Point)
|
||||
|
@ -532,6 +677,7 @@ void CSbieView::OnMenu(const QPoint& Point)
|
|||
return;
|
||||
|
||||
UpdateMenu();
|
||||
|
||||
CPanelView::OnMenu(Point);
|
||||
}
|
||||
|
||||
|
@ -848,7 +994,7 @@ void CSbieView::OnSandBoxAction(QAction* Action)
|
|||
Results.append(SandBoxes.first()->RunStart("mail_agent"));
|
||||
else if (Action == m_pMenuRunExplorer)
|
||||
{
|
||||
if (theConf->GetBool("Options/AdvancedView", true) == false && theConf->GetBool("Options/BoxedExplorerInfo", true))
|
||||
if (theConf->GetInt("Options/ViewMode", 1) != 1 && theConf->GetBool("Options/BoxedExplorerInfo", true))
|
||||
{
|
||||
bool State = false;
|
||||
CCheckableMessageBox::question(this, "Sandboxie-Plus",
|
||||
|
@ -895,33 +1041,9 @@ void CSbieView::OnSandBoxAction(QAction* Action)
|
|||
else if (Action == m_pMenuPresetsRecovery)
|
||||
m_pMenuPresetsRecovery->setChecked(SandBoxes.first()->SetBool("AutoRecover", m_pMenuPresetsRecovery->isChecked()));
|
||||
else if (Action == m_pMenuOptions)
|
||||
{
|
||||
OnDoubleClicked(m_pSbieTree->selectedRows().first());
|
||||
}
|
||||
ShowOptions(SandBoxes.first());
|
||||
else if (Action == m_pMenuBrowse)
|
||||
{
|
||||
if (SandBoxes.first()->IsEmpty()) {
|
||||
QMessageBox("Sandboxie-Plus", tr("This Sandbox is empty."), QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton, this).exec();
|
||||
return;
|
||||
}
|
||||
|
||||
CSandBoxPtr pBox = SandBoxes.first();
|
||||
|
||||
static QMap<void*, CFileBrowserWindow*> FileBrowserWindows;
|
||||
CFileBrowserWindow* pFileBrowserWindow = FileBrowserWindows.value(pBox.data());
|
||||
if (pFileBrowserWindow == NULL) {
|
||||
pFileBrowserWindow = new CFileBrowserWindow(SandBoxes.first());
|
||||
FileBrowserWindows.insert(pBox.data(), pFileBrowserWindow);
|
||||
connect(pFileBrowserWindow, &CFileBrowserWindow::Closed, [this, pBox]() {
|
||||
FileBrowserWindows.remove(pBox.data());
|
||||
});
|
||||
SafeShow(pFileBrowserWindow);
|
||||
}
|
||||
else {
|
||||
pFileBrowserWindow->setWindowState((pFileBrowserWindow->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
||||
SetForegroundWindow((HWND)pFileBrowserWindow->winId());
|
||||
}
|
||||
}
|
||||
ShowBrowse(SandBoxes.first());
|
||||
else if (Action == m_pMenuRefresh)
|
||||
{
|
||||
foreach(const CSandBoxPtr& pBox, SandBoxes)
|
||||
|
@ -936,7 +1058,7 @@ void CSbieView::OnSandBoxAction(QAction* Action)
|
|||
return;
|
||||
}
|
||||
|
||||
if (theConf->GetBool("Options/AdvancedView", true) == false && theConf->GetBool("Options/ExplorerInfo", true))
|
||||
if (theConf->GetInt("Options/ViewMode", 1) != 1 && theConf->GetBool("Options/ExplorerInfo", true))
|
||||
{
|
||||
bool State = false;
|
||||
CCheckableMessageBox::question(this, "Sandboxie-Plus",
|
||||
|
@ -1304,6 +1426,45 @@ void CSbieView::OnProcessAction(QAction* Action)
|
|||
CSandMan::CheckResults(Results);
|
||||
}
|
||||
|
||||
void CSbieView::ShowOptions(const CSandBoxPtr& pBox)
|
||||
{
|
||||
auto pBoxEx = pBox.objectCast<CSandBoxPlus>();
|
||||
if (pBoxEx->m_pOptionsWnd == NULL) {
|
||||
pBoxEx->m_pOptionsWnd = new COptionsWindow(pBox, pBox->GetName());
|
||||
connect(pBoxEx->m_pOptionsWnd, &COptionsWindow::Closed, [pBoxEx]() {
|
||||
pBoxEx->m_pOptionsWnd = NULL;
|
||||
});
|
||||
SafeShow(pBoxEx->m_pOptionsWnd);
|
||||
}
|
||||
else {
|
||||
pBoxEx->m_pOptionsWnd->setWindowState((pBoxEx->m_pOptionsWnd->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
||||
SetForegroundWindow((HWND)pBoxEx->m_pOptionsWnd->winId());
|
||||
}
|
||||
}
|
||||
|
||||
void CSbieView::ShowBrowse(const CSandBoxPtr& pBox)
|
||||
{
|
||||
if (pBox->IsEmpty()) {
|
||||
QMessageBox("Sandboxie-Plus", tr("This Sandbox is empty."), QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton, this).exec();
|
||||
return;
|
||||
}
|
||||
|
||||
static QMap<void*, CFileBrowserWindow*> FileBrowserWindows;
|
||||
CFileBrowserWindow* pFileBrowserWindow = FileBrowserWindows.value(pBox.data());
|
||||
if (pFileBrowserWindow == NULL) {
|
||||
pFileBrowserWindow = new CFileBrowserWindow(pBox);
|
||||
FileBrowserWindows.insert(pBox.data(), pFileBrowserWindow);
|
||||
connect(pFileBrowserWindow, &CFileBrowserWindow::Closed, [this, pBox]() {
|
||||
FileBrowserWindows.remove(pBox.data());
|
||||
});
|
||||
SafeShow(pFileBrowserWindow);
|
||||
}
|
||||
else {
|
||||
pFileBrowserWindow->setWindowState((pFileBrowserWindow->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
||||
SetForegroundWindow((HWND)pFileBrowserWindow->winId());
|
||||
}
|
||||
}
|
||||
|
||||
void CSbieView::OnDoubleClicked(const QModelIndex& index)
|
||||
{
|
||||
QModelIndex ModelIndex = m_pSortProxy->mapToSource(index);
|
||||
|
@ -1327,20 +1488,11 @@ void CSbieView::OnDoubleClicked(const QModelIndex& index)
|
|||
if (QMessageBox("Sandboxie-Plus", tr("This sandbox is disabled, do you want to enable it?"), QMessageBox::Question, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape, QMessageBox::NoButton, this).exec() != QMessageBox::Yes)
|
||||
return;
|
||||
pBox->SetText("Enabled", "y");
|
||||
return;
|
||||
}
|
||||
|
||||
auto pBoxEx = pBox.objectCast<CSandBoxPlus>();
|
||||
if (pBoxEx->m_pOptionsWnd == NULL) {
|
||||
pBoxEx->m_pOptionsWnd = new COptionsWindow(pBox, pBox->GetName());
|
||||
connect(pBoxEx->m_pOptionsWnd, &COptionsWindow::Closed, [pBoxEx]() {
|
||||
pBoxEx->m_pOptionsWnd = NULL;
|
||||
});
|
||||
SafeShow(pBoxEx->m_pOptionsWnd);
|
||||
}
|
||||
else {
|
||||
pBoxEx->m_pOptionsWnd->setWindowState((pBoxEx->m_pOptionsWnd->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
||||
SetForegroundWindow((HWND)pBoxEx->m_pOptionsWnd->winId());
|
||||
}
|
||||
|
||||
|
||||
ShowOptions(pBox);
|
||||
}
|
||||
|
||||
void CSbieView::ProcessSelection(const QItemSelection& selected, const QItemSelection& deselected)
|
||||
|
@ -1461,14 +1613,22 @@ void CSbieView::SelectBox(const QString& Name)
|
|||
|
||||
void CSbieView::PopUpMenu(const QString& Name)
|
||||
{
|
||||
SelectBox(Name);
|
||||
if (!UpdateMenu())
|
||||
return;
|
||||
//SelectBox(Name);
|
||||
CSandBoxPtr pBox = theAPI->GetBoxByName(Name);
|
||||
if (pBox.isNull() || !UpdateMenu(pBox)) return;
|
||||
m_pMenu2->exec(QCursor::pos());
|
||||
//m_pMenu2->popup(QCursor::pos());
|
||||
//OnMenu(QCursor::pos());
|
||||
}
|
||||
|
||||
QMenu* CSbieView::GetMenu(const QString& Name)
|
||||
{
|
||||
CSandBoxPtr pBox = theAPI->GetBoxByName(Name);
|
||||
if (pBox.isNull()) return NULL;
|
||||
UpdateMenu(pBox);
|
||||
return m_pMenu;
|
||||
}
|
||||
|
||||
void CSbieView::ShowOptions(const QString& Name)
|
||||
{
|
||||
QModelIndex Index = m_pSbieModel->FindIndex(Name);
|
||||
|
|
|
@ -26,7 +26,10 @@ public:
|
|||
virtual void SelectBox(const QString& Name);
|
||||
|
||||
virtual void PopUpMenu(const QString& Name);
|
||||
virtual QMenu* GetMenu(const QString& Name);
|
||||
virtual void ShowOptions(const QString& Name);
|
||||
virtual void ShowOptions(const CSandBoxPtr& pBox);
|
||||
virtual void ShowBrowse(const CSandBoxPtr& pBox);
|
||||
|
||||
QMap<QString, QStringList> GetGroups() { return m_Groups; }
|
||||
|
||||
|
@ -71,6 +74,11 @@ protected:
|
|||
|
||||
private:
|
||||
|
||||
void CreateMenu();
|
||||
void CreateOldMenu();
|
||||
void CreatTrayMenu();
|
||||
|
||||
bool UpdateMenu(const CSandBoxPtr &pBox, int iSandBoxeCount = 1, bool bBoxBusy = false, const CBoxedProcessPtr &pProcess = CBoxedProcessPtr(), int iProcessCount = 0, int iGroupe = 0);
|
||||
bool UpdateMenu();
|
||||
void UpdateGroupMenu();
|
||||
void RenameGroup(const QString OldName, const QString NewName);
|
||||
|
@ -131,6 +139,7 @@ private:
|
|||
QAction* m_pMenuRecover;
|
||||
QAction* m_pMenuCleanUp;
|
||||
QAction* m_pMenuRemove;
|
||||
QMenu* m_pMenuTools;
|
||||
QAction* m_pMenuDuplicate;
|
||||
QAction* m_pMenuMoveUp;
|
||||
//QAction* m_pMenuMoveBy;
|
||||
|
|
|
@ -151,7 +151,7 @@ CMonitorList::~CMonitorList()
|
|||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CTraceView
|
||||
|
||||
CTraceView::CTraceView(QWidget* parent) : QWidget(parent)
|
||||
CTraceView::CTraceView(bool bStandAlone, QWidget* parent) : QWidget(parent)
|
||||
{
|
||||
//m_pTreeList->setItemDelegate(theGUI->GetItemDelegate());
|
||||
|
||||
|
@ -220,9 +220,13 @@ CTraceView::CTraceView(QWidget* parent) : QWidget(parent)
|
|||
connect(m_pTraceStatus, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSetFilter()));
|
||||
m_pTraceToolBar->addWidget(m_pTraceStatus);
|
||||
|
||||
m_pAllBoxes = m_pTraceToolBar->addAction(CSandMan::GetIcon("All"), tr("Show All Boxes"), this, SLOT(OnSetFilter()));
|
||||
m_pAllBoxes->setCheckable(true);
|
||||
m_pAllBoxes->setChecked(theConf->GetBool("Options/UseLogTree"));
|
||||
if (bStandAlone)
|
||||
m_pAllBoxes = NULL;
|
||||
else {
|
||||
m_pAllBoxes = m_pTraceToolBar->addAction(CSandMan::GetIcon("All"), tr("Show All Boxes"), this, SLOT(OnSetFilter()));
|
||||
m_pAllBoxes->setCheckable(true);
|
||||
m_pAllBoxes->setChecked(theConf->GetBool("Options/UseLogTree"));
|
||||
}
|
||||
|
||||
m_pTraceToolBar->addSeparator();
|
||||
|
||||
|
@ -233,12 +237,19 @@ CTraceView::CTraceView(QWidget* parent) : QWidget(parent)
|
|||
m_pMainLayout->addWidget(m_pTraceToolBar);
|
||||
|
||||
|
||||
|
||||
m_pView = new QWidget(this);
|
||||
m_pLayout = new QStackedLayout(m_pView);
|
||||
|
||||
m_pTrace = new CTraceTree(this);
|
||||
((CTraceModel*)m_pTrace->GetModel())->SetTree(m_pTraceTree->isChecked());
|
||||
|
||||
if (bStandAlone) {
|
||||
QAction* pAction = new QAction(tr("Cleanup Trace Log"));
|
||||
connect(pAction, SIGNAL(triggered()), this, SLOT(Clear()));
|
||||
m_pTrace->GetMenu()->insertAction(m_pTrace->GetMenu()->actions()[0], pAction);
|
||||
m_pTrace->GetMenu()->insertSeparator(m_pTrace->GetMenu()->actions()[0]);
|
||||
}
|
||||
|
||||
m_pLayout->addWidget(m_pTrace);
|
||||
|
||||
QObject::connect(m_pTrace, SIGNAL(FilterSet(const QRegExp&, bool, int)), this, SLOT(SetFilter(const QRegExp&, bool, int)));
|
||||
|
@ -249,14 +260,22 @@ CTraceView::CTraceView(QWidget* parent) : QWidget(parent)
|
|||
m_pView->setLayout(m_pLayout);
|
||||
m_pMainLayout->addWidget(m_pView);
|
||||
|
||||
|
||||
OnSetMode();
|
||||
|
||||
|
||||
m_uTimerID = startTimer(1000);
|
||||
}
|
||||
|
||||
CTraceView::~CTraceView()
|
||||
{
|
||||
|
||||
killTimer(m_uTimerID);
|
||||
}
|
||||
|
||||
void CTraceView::timerEvent(QTimerEvent* pEvent)
|
||||
{
|
||||
if (pEvent->timerId() != m_uTimerID)
|
||||
return;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
int CTraceView__Filter(const CTraceEntryPtr& pEntry, void* params)
|
||||
|
@ -306,7 +325,7 @@ int CTraceView__Filter(const CTraceEntryPtr& pEntry, void* params)
|
|||
void CTraceView::Refresh()
|
||||
{
|
||||
QList<CSandBoxPtr>Boxes;
|
||||
if(!m_pAllBoxes->isChecked())
|
||||
if(m_pAllBoxes && !m_pAllBoxes->isChecked())
|
||||
Boxes = theGUI->GetBoxView()->GetSelectedBoxes();
|
||||
|
||||
if (m_pCurrentBox != (Boxes.count() == 1 ? Boxes.first().data() : NULL)) {
|
||||
|
@ -588,4 +607,45 @@ void CTraceView::SaveToFile()
|
|||
}
|
||||
|
||||
File.close();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CTraceWindow
|
||||
|
||||
CTraceWindow::CTraceWindow(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
Qt::WindowFlags flags = windowFlags();
|
||||
flags |= Qt::CustomizeWindowHint;
|
||||
//flags &= ~Qt::WindowContextHelpButtonHint;
|
||||
//flags &= ~Qt::WindowSystemMenuHint;
|
||||
//flags &= ~Qt::WindowMinMaxButtonsHint;
|
||||
//flags |= Qt::WindowMinimizeButtonHint;
|
||||
//flags &= ~Qt::WindowCloseButtonHint;
|
||||
flags &= ~Qt::WindowContextHelpButtonHint;
|
||||
//flags &= ~Qt::WindowSystemMenuHint;
|
||||
setWindowFlags(flags);
|
||||
|
||||
this->setWindowTitle(tr("Sandboxie-Plus - Trace Monitor"));
|
||||
|
||||
QGridLayout* pLayout = new QGridLayout();
|
||||
pLayout->setMargin(3);
|
||||
pLayout->addWidget(new CTraceView(true, this), 0, 0);
|
||||
this->setLayout(pLayout);
|
||||
|
||||
restoreGeometry(theConf->GetBlob("TraceWindow/Window_Geometry"));
|
||||
}
|
||||
|
||||
CTraceWindow::~CTraceWindow()
|
||||
{
|
||||
theConf->SetBlob("TraceWindow/Window_Geometry", saveGeometry());
|
||||
|
||||
theAPI->EnableMonitor(false);
|
||||
}
|
||||
|
||||
void CTraceWindow::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
emit Closed();
|
||||
this->deleteLater();
|
||||
}
|
|
@ -44,15 +44,15 @@ class CTraceView : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CTraceView(QWidget* parent = 0);
|
||||
CTraceView(bool bStandAlone, QWidget* parent = 0);
|
||||
~CTraceView();
|
||||
|
||||
void Refresh();
|
||||
void Clear();
|
||||
|
||||
void AddAction(QAction* pAction);
|
||||
|
||||
public slots:
|
||||
void Refresh();
|
||||
void Clear();
|
||||
|
||||
void OnSetTree();
|
||||
void OnSetMode();
|
||||
void OnSetPidFilter();
|
||||
|
@ -66,6 +66,9 @@ private slots:
|
|||
void SaveToFile();
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent* pEvent);
|
||||
int m_uTimerID;
|
||||
|
||||
struct SProgInfo
|
||||
{
|
||||
QString Name;
|
||||
|
@ -109,4 +112,19 @@ protected:
|
|||
|
||||
QWidget* m_pView;
|
||||
QStackedLayout* m_pLayout;
|
||||
};
|
||||
};
|
||||
|
||||
class CTraceWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CTraceWindow(QWidget *parent = Q_NULLPTR);
|
||||
~CTraceWindow();
|
||||
|
||||
signals:
|
||||
void Closed();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *e);
|
||||
};
|
||||
|
|
|
@ -84,14 +84,15 @@ CSettingsWindow::CSettingsWindow(QWidget *parent)
|
|||
ui.tabs->setTabPosition(QTabWidget::West);
|
||||
ui.tabs->tabBar()->setStyle(new CustomTabStyle(ui.tabs->tabBar()->style()));
|
||||
|
||||
ui.tabs->setTabIcon(0, CSandMan::GetIcon("Options"));
|
||||
ui.tabs->setTabIcon(1, CSandMan::GetIcon("Shell"));
|
||||
ui.tabs->setTabIcon(2, CSandMan::GetIcon("Advanced"));
|
||||
ui.tabs->setTabIcon(3, CSandMan::GetIcon("Ampel"));
|
||||
ui.tabs->setTabIcon(4, CSandMan::GetIcon("Lock"));
|
||||
ui.tabs->setTabIcon(5, CSandMan::GetIcon("Compatibility"));
|
||||
ui.tabs->setTabIcon(6, CSandMan::GetIcon("EditIni"));
|
||||
ui.tabs->setTabIcon(7, CSandMan::GetIcon("Support"));
|
||||
ui.tabs->setTabIcon(eOptions, CSandMan::GetIcon("Options"));
|
||||
ui.tabs->setTabIcon(eShell, CSandMan::GetIcon("Shell"));
|
||||
ui.tabs->setTabIcon(eGuiConfig, CSandMan::GetIcon("GUI"));
|
||||
ui.tabs->setTabIcon(eAdvanced, CSandMan::GetIcon("Advanced"));
|
||||
ui.tabs->setTabIcon(eProgCtrl, CSandMan::GetIcon("Ampel"));
|
||||
ui.tabs->setTabIcon(eConfigLock, CSandMan::GetIcon("Lock"));
|
||||
ui.tabs->setTabIcon(eSoftCompat, CSandMan::GetIcon("Compatibility"));
|
||||
ui.tabs->setTabIcon(eEditIni, CSandMan::GetIcon("EditIni"));
|
||||
ui.tabs->setTabIcon(eSupport, CSandMan::GetIcon("Support"));
|
||||
|
||||
|
||||
ui.tabs->setCurrentIndex(0);
|
||||
|
@ -106,6 +107,7 @@ CSettingsWindow::CSettingsWindow(QWidget *parent)
|
|||
QString Lang = Locale.nativeLanguageName();
|
||||
ui.uiLang->addItem(Lang, Code);
|
||||
}
|
||||
ui.uiLang->setCurrentIndex(ui.uiLang->findData(theConf->GetString("Options/UiLanguage")));
|
||||
|
||||
ui.cmbSysTray->addItem(tr("Don't show any icon"));
|
||||
ui.cmbSysTray->addItem(tr("Show Plus icon"));
|
||||
|
@ -120,7 +122,13 @@ CSettingsWindow::CSettingsWindow(QWidget *parent)
|
|||
ui.cmbOnClose->addItem(tr("Close"), "Close");
|
||||
|
||||
|
||||
ui.uiLang->setCurrentIndex(ui.uiLang->findData(theConf->GetString("Options/UiLanguage")));
|
||||
ui.cmbDPI->addItem(tr("None"), 0);
|
||||
ui.cmbDPI->addItem(tr("Native"), 1);
|
||||
ui.cmbDPI->addItem(tr("Qt"), 2);
|
||||
|
||||
int FontScales[] = { 75,100,125,150,175,200,225,250,275,300,350,400, 0 };
|
||||
for(int* pFontScales = FontScales; *pFontScales != 0; pFontScales++)
|
||||
ui.cmbFontScale->addItem(tr("%1 %").arg(*pFontScales), *pFontScales);
|
||||
|
||||
QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", QSettings::NativeFormat);
|
||||
if (settings.value("CurrentBuild").toInt() >= 22000) { // Windows 11
|
||||
|
@ -132,6 +140,17 @@ CSettingsWindow::CSettingsWindow(QWidget *parent)
|
|||
|
||||
LoadSettings();
|
||||
|
||||
connect(ui.uiLang, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeGUI()));
|
||||
|
||||
connect(ui.cmbDPI, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeGUI()));
|
||||
connect(ui.chkDarkTheme, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
|
||||
connect(ui.chkBackground, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
|
||||
connect(ui.chkLargeIcons, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
|
||||
connect(ui.chkNoIcons, SIGNAL(stateChanged(int)), this, SLOT(OnChangeGUI()));
|
||||
connect(ui.cmbFontScale, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeGUI()));
|
||||
|
||||
|
||||
m_bRebuildUI = false;
|
||||
|
||||
connect(ui.cmbSysTray, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChange()));
|
||||
connect(ui.cmbTrayBoxes, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChange()));
|
||||
|
@ -204,18 +223,15 @@ CSettingsWindow::~CSettingsWindow()
|
|||
theConf->SetBlob("SettingsWindow/Window_Geometry",saveGeometry());
|
||||
}
|
||||
|
||||
void CSettingsWindow::showCompat()
|
||||
void CSettingsWindow::showTab(int Tab)
|
||||
{
|
||||
m_CompatLoaded = 2;
|
||||
ui.tabs->setCurrentWidget(ui.tabCompat);
|
||||
SafeShow(this);
|
||||
}
|
||||
if(Tab == CSettingsWindow::eSoftCompat)
|
||||
m_CompatLoaded = 2;
|
||||
else if(Tab == CSettingsWindow::eSupport)
|
||||
ui.chkNoCheck->setVisible(true);
|
||||
|
||||
void CSettingsWindow::showSupport()
|
||||
{
|
||||
ui.tabs->setCurrentWidget(ui.tabSupport);
|
||||
ui.tabs->setCurrentIndex(Tab);
|
||||
SafeShow(this);
|
||||
ui.chkNoCheck->setVisible(true);
|
||||
}
|
||||
|
||||
void CSettingsWindow::closeEvent(QCloseEvent *e)
|
||||
|
@ -299,7 +315,14 @@ void CSettingsWindow::LoadSettings()
|
|||
ui.chkShellMenu2->setChecked(CSbieUtils::HasContextMenu2());
|
||||
ui.chkAlwaysDefault->setChecked(theConf->GetBool("Options/RunInDefaultBox", false));
|
||||
|
||||
ui.cmbDPI->setCurrentIndex(theConf->GetInt("Options/DPIScaling", 1));
|
||||
|
||||
ui.chkDarkTheme->setCheckState(CSettingsWindow__Int2Chk(theConf->GetInt("Options/UseDarkTheme", 2)));
|
||||
ui.chkBackground->setCheckState(CSettingsWindow__Int2Chk(theConf->GetInt("Options/UseBackground", 2)));
|
||||
ui.chkLargeIcons->setCheckState(CSettingsWindow__Int2Chk(theConf->GetInt("Options/LargeIcons", 2)));
|
||||
ui.chkNoIcons->setCheckState(CSettingsWindow__Int2Chk(theConf->GetInt("Options/NoIcons", 2)));
|
||||
|
||||
ui.cmbFontScale->setCurrentIndex(ui.cmbFontScale->findData(theConf->GetInt("Options/FontScaling", 100)));
|
||||
|
||||
ui.chkNotifications->setChecked(theConf->GetBool("Options/ShowNotifications", true));
|
||||
|
||||
|
@ -337,6 +360,7 @@ void CSettingsWindow::LoadSettings()
|
|||
ui.chkWFP->setChecked(theAPI->GetGlobalSettings()->GetBool("NetworkEnableWFP", false));
|
||||
ui.chkObjCb->setChecked(theAPI->GetGlobalSettings()->GetBool("EnableObjectFiltering", true));
|
||||
ui.chkWin32k->setChecked(theAPI->GetGlobalSettings()->GetBool("EnableWin32kHooks", true));
|
||||
ui.chkSbieLogon->setChecked(theAPI->GetGlobalSettings()->GetBool("SandboxieLogon", true));
|
||||
|
||||
ui.chkAdminOnly->setChecked(theAPI->GetGlobalSettings()->GetBool("EditAdminOnly", false));
|
||||
ui.chkPassRequired->setChecked(!theAPI->GetGlobalSettings()->GetText("EditPassword", "").isEmpty());
|
||||
|
@ -362,6 +386,7 @@ void CSettingsWindow::LoadSettings()
|
|||
ui.chkWFP->setEnabled(false);
|
||||
ui.chkObjCb->setEnabled(false);
|
||||
ui.chkWin32k->setEnabled(false);
|
||||
ui.chkSbieLogon->setEnabled(false);
|
||||
ui.regRoot->setEnabled(false);
|
||||
ui.ipcRoot->setEnabled(false);
|
||||
ui.chkAdminOnly->setEnabled(false);
|
||||
|
@ -428,7 +453,14 @@ void CSettingsWindow::SaveSettings()
|
|||
{
|
||||
theConf->SetValue("Options/UiLanguage", ui.uiLang->currentData());
|
||||
|
||||
theConf->SetValue("Options/DPIScaling", ui.cmbDPI->currentData());
|
||||
|
||||
theConf->SetValue("Options/UseDarkTheme", CSettingsWindow__Chk2Int(ui.chkDarkTheme->checkState()));
|
||||
theConf->SetValue("Options/UseBackground", CSettingsWindow__Chk2Int(ui.chkBackground->checkState()));
|
||||
theConf->SetValue("Options/LargeIcons", CSettingsWindow__Chk2Int(ui.chkLargeIcons->checkState()));
|
||||
theConf->SetValue("Options/NoIcons", CSettingsWindow__Chk2Int(ui.chkNoIcons->checkState()));
|
||||
|
||||
theConf->SetValue("Options/FontScaling", ui.cmbFontScale->currentData());
|
||||
|
||||
AutorunEnable(ui.chkAutoStart->isChecked());
|
||||
|
||||
|
@ -443,8 +475,10 @@ void CSettingsWindow::SaveSettings()
|
|||
|
||||
if (ui.chkShellMenu->checkState() != CSettingsWindow__IsContextMenu())
|
||||
{
|
||||
if (ui.chkShellMenu->isChecked())
|
||||
CSettingsWindow__AddContextMenu();
|
||||
if (ui.chkShellMenu->isChecked()) {
|
||||
CSecretCheckBox* SecretCheckBox = qobject_cast<CSecretCheckBox*>(ui.chkShellMenu);
|
||||
CSettingsWindow__AddContextMenu(SecretCheckBox && SecretCheckBox->IsSecretSet());
|
||||
}
|
||||
else
|
||||
CSettingsWindow__RemoveContextMenu();
|
||||
}
|
||||
|
@ -503,6 +537,7 @@ void CSettingsWindow::SaveSettings()
|
|||
theAPI->GetGlobalSettings()->SetBool("NetworkEnableWFP", ui.chkWFP->isChecked());
|
||||
theAPI->GetGlobalSettings()->SetBool("EnableObjectFiltering", ui.chkObjCb->isChecked());
|
||||
theAPI->GetGlobalSettings()->SetBool("EnableWin32kHooks", ui.chkWin32k->isChecked());
|
||||
theAPI->GetGlobalSettings()->SetBool("SandboxieLogon", ui.chkSbieLogon->isChecked());
|
||||
|
||||
|
||||
if (m_FeaturesChanged) {
|
||||
|
@ -618,7 +653,7 @@ void CSettingsWindow::SaveSettings()
|
|||
|
||||
theConf->SetValue("Options/NoSupportCheck", ui.chkNoCheck->isChecked());
|
||||
|
||||
emit OptionsChanged();
|
||||
emit OptionsChanged(m_bRebuildUI);
|
||||
}
|
||||
|
||||
bool CSettingsWindow::ApplyCertificate(const QByteArray &Certificate, QWidget* widget)
|
||||
|
@ -934,13 +969,10 @@ void CSettingsWindow::CertChanged()
|
|||
ui.txtCertificate->setPalette(palette);
|
||||
}
|
||||
|
||||
void CSettingsWindow::LoadCertificate()
|
||||
void CSettingsWindow::LoadCertificate(QString CertPath)
|
||||
{
|
||||
QString CertPath;
|
||||
if (theAPI && theAPI->IsConnected())
|
||||
CertPath = theAPI->GetSbiePath() + "\\Certificate.dat";
|
||||
else
|
||||
CertPath = QCoreApplication::applicationDirPath() + "\\Certificate.dat";
|
||||
|
||||
QFile CertFile(CertPath);
|
||||
if (CertFile.open(QFile::ReadOnly)) {
|
||||
|
|
|
@ -49,24 +49,36 @@ public:
|
|||
|
||||
static bool ApplyCertificate(const QByteArray &Certificate, QWidget* widget);
|
||||
|
||||
static void LoadCertificate();
|
||||
static void LoadCertificate(QString CertPath = QString());
|
||||
|
||||
enum ETabs {
|
||||
eOptions = 0,
|
||||
eShell,
|
||||
eGuiConfig,
|
||||
eAdvanced,
|
||||
eProgCtrl,
|
||||
eConfigLock,
|
||||
eSoftCompat,
|
||||
eEditIni,
|
||||
eSupport
|
||||
};
|
||||
|
||||
signals:
|
||||
void OptionsChanged();
|
||||
void OptionsChanged(bool bRebuildUI = false);
|
||||
void Closed();
|
||||
|
||||
public slots:
|
||||
void ok();
|
||||
void apply();
|
||||
|
||||
void showCompat();
|
||||
void showSupport();
|
||||
void showTab(int Tab);
|
||||
|
||||
private slots:
|
||||
void OnChange();
|
||||
|
||||
void OnTab();
|
||||
|
||||
void OnChangeGUI() { m_bRebuildUI = true; }
|
||||
void OnFeaturesChanged() { m_FeaturesChanged = true; }
|
||||
|
||||
void OnBrowse();
|
||||
|
@ -103,6 +115,7 @@ protected:
|
|||
void LoadIniSection();
|
||||
void SaveIniSection();
|
||||
|
||||
bool m_bRebuildUI;
|
||||
int m_CompatLoaded;
|
||||
QString m_NewPassword;
|
||||
bool m_WarnProgsChanged;
|
||||
|
|
|
@ -61,9 +61,11 @@ bool CSetupWizard::ShowWizard()
|
|||
//bool isEvaluate = wizard.field("isEvaluate").toBool();
|
||||
|
||||
if (wizard.field("useAdvanced").toBool())
|
||||
theConf->SetValue("Options/AdvancedView", true);
|
||||
theConf->SetValue("Options/ViewMode", 1);
|
||||
else if (wizard.field("useSimple").toBool())
|
||||
theConf->SetValue("Options/AdvancedView", false);
|
||||
theConf->SetValue("Options/ViewMode", 0);
|
||||
else if (wizard.field("useClassic").toBool())
|
||||
theConf->SetValue("Options/ViewMode", 2);
|
||||
|
||||
if (wizard.field("useBrightMode").toInt())
|
||||
theConf->SetValue("Options/UseDarkTheme", 0);
|
||||
|
@ -89,8 +91,7 @@ bool CSetupWizard::ShowWizard()
|
|||
|
||||
theConf->SetValue("Options/WizardLevel", 1);
|
||||
|
||||
theGUI->SetViewMode(theConf->GetBool("Options/AdvancedView", true));
|
||||
theGUI->UpdateSettings();
|
||||
theGUI->UpdateSettings(true);
|
||||
|
||||
|
||||
return true;
|
||||
|
@ -269,40 +270,46 @@ CUIPage::CUIPage(QWidget* parent)
|
|||
QGridLayout* layout = new QGridLayout;
|
||||
|
||||
m_pAdvanced = new QRadioButton(tr("&Advanced UI for experts"));
|
||||
m_pAdvanced->setChecked(theConf->GetBool("Options/AdvancedView", true));
|
||||
m_pAdvanced->setChecked(theConf->GetInt("Options/ViewMode", 1) == 1);
|
||||
layout->addWidget(m_pAdvanced, 0, 0);
|
||||
registerField("useAdvanced", m_pAdvanced);
|
||||
|
||||
m_pSimple = new QRadioButton(tr("&Simple UI for beginners"));
|
||||
m_pSimple->setChecked(!theConf->GetBool("Options/AdvancedView", true));
|
||||
m_pSimple->setChecked(theConf->GetInt("Options/ViewMode", 1) == 0);
|
||||
layout->addWidget(m_pSimple, 1, 0);
|
||||
registerField("useSimple", m_pSimple);
|
||||
|
||||
m_pClassic = new QRadioButton(tr("&Classic Sandboxie UI"));
|
||||
m_pClassic->setChecked(theConf->GetInt("Options/ViewMode", 1) == 2);
|
||||
layout->addWidget(m_pClassic, 2, 0);
|
||||
registerField("useClassic", m_pClassic);
|
||||
|
||||
QButtonGroup *buttonGroup1 = new QButtonGroup();
|
||||
buttonGroup1->addButton(m_pAdvanced, 0);
|
||||
buttonGroup1->addButton(m_pSimple, 1);
|
||||
buttonGroup1->addButton(m_pClassic, 2);
|
||||
connect(buttonGroup1, SIGNAL(buttonClicked(int)), this, SLOT(UpdatePreview()));
|
||||
|
||||
QLabel* pDummy = new QLabel();
|
||||
pDummy->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
layout->addWidget(pDummy, 0, 1, 5, 4);
|
||||
layout->addWidget(pDummy, 0, 1, 6, 4);
|
||||
pDummy->setStyleSheet("QLabel { background-color : " + QApplication::palette().color(QPalette::Base).name() + "; }");
|
||||
|
||||
m_pPreview = new QLabel();
|
||||
m_pPreview->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
||||
m_pPreview->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
layout->addWidget(m_pPreview, 0, 1, 5, 4);
|
||||
layout->addWidget(m_pPreview, 0, 1, 6, 4);
|
||||
|
||||
QWidget* pSpacer = new QWidget();
|
||||
pSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
layout->addWidget(pSpacer, 2, 0);
|
||||
layout->addWidget(pSpacer, 3, 0);
|
||||
|
||||
m_pBrightMode = new QRadioButton(tr("Use Bright Mode"));
|
||||
layout->addWidget(m_pBrightMode, 3, 0);
|
||||
layout->addWidget(m_pBrightMode, 4, 0);
|
||||
registerField("useBrightMode", m_pBrightMode);
|
||||
|
||||
m_pDarkMode = new QRadioButton(tr("Use Dark Mode"));
|
||||
layout->addWidget(m_pDarkMode, 4, 0);
|
||||
layout->addWidget(m_pDarkMode, 5, 0);
|
||||
registerField("useDarkMode", m_pDarkMode);
|
||||
|
||||
QButtonGroup *buttonGroup2 = new QButtonGroup();
|
||||
|
@ -346,6 +353,10 @@ void CUIPage::UpdatePreview()
|
|||
preview = QPixmap::fromImage(QImage(":/Assets/Simple.png"));
|
||||
else if(m_pSimple->isChecked() && bDark)
|
||||
preview = QPixmap::fromImage(QImage(":/Assets/SimpleD.png"));
|
||||
else if(m_pClassic->isChecked() && !bDark)
|
||||
preview = QPixmap::fromImage(QImage(":/Assets/Classic.png"));
|
||||
else if(m_pClassic->isChecked() && bDark)
|
||||
preview = QPixmap::fromImage(QImage(":/Assets/ClassicD.png"));
|
||||
|
||||
//QRect rect(0, 0, m_pPreview->width(), m_pPreview->height());
|
||||
//m_pPreview->setPixmap(preview.scaled(preview.width()*5/10, preview.height()*5/10, Qt::KeepAspectRatio, Qt::SmoothTransformation).copy(rect));
|
||||
|
@ -394,6 +405,7 @@ CShellPage::CShellPage(QWidget *parent)
|
|||
int CShellPage::nextId() const
|
||||
{
|
||||
return CSetupWizard::Page_WFP;
|
||||
//return CSetupWizard::Page_Finish;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -86,6 +86,7 @@ private slots:
|
|||
private:
|
||||
QRadioButton *m_pSimple;
|
||||
QRadioButton *m_pAdvanced;
|
||||
QRadioButton *m_pClassic;
|
||||
QLabel* m_pPreview;
|
||||
QRadioButton* m_pBrightMode;
|
||||
QRadioButton* m_pDarkMode;
|
||||
|
|
|
@ -15,22 +15,43 @@ QString g_PendingMessage;
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
//SetProcessDPIAware();
|
||||
//SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
|
||||
//SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
|
||||
|
||||
typedef DPI_AWARENESS_CONTEXT(WINAPI* P_SetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext);
|
||||
P_SetThreadDpiAwarenessContext pSetThreadDpiAwarenessContext = (P_SetThreadDpiAwarenessContext)GetProcAddress(GetModuleHandle(L"user32.dll"), "SetThreadDpiAwarenessContext");
|
||||
if(pSetThreadDpiAwarenessContext) // not rpesent on windows 7
|
||||
pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
|
||||
|
||||
#endif // Q_OS_WIN
|
||||
//QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
//QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
||||
|
||||
qsrand(QTime::currentTime().msec());
|
||||
|
||||
wchar_t szPath[MAX_PATH];
|
||||
GetModuleFileNameW(NULL, szPath, ARRAYSIZE(szPath));
|
||||
*wcsrchr(szPath, L'\\') = L'\0';
|
||||
QString AppDir = QString::fromWCharArray(szPath);
|
||||
|
||||
if (QFile::exists(AppDir + "\\Certificate.dat")) {
|
||||
CSettingsWindow::LoadCertificate(AppDir + "\\Certificate.dat");
|
||||
g_CertInfo.business = GetArguments(g_Certificate, L'\n', L':').value("TYPE").toUpper().contains("BUSINESS");
|
||||
}
|
||||
|
||||
// use a shared setting location when used in a business environment for easier administration
|
||||
theConf = new CSettings(AppDir, "Sandboxie-Plus", g_CertInfo.business);
|
||||
|
||||
|
||||
// this must be done before we create QApplication
|
||||
int DPI = theConf->GetInt("Options/DPIScaling", 1);
|
||||
if (DPI == 1) {
|
||||
//SetProcessDPIAware();
|
||||
//SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
|
||||
//SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
|
||||
typedef DPI_AWARENESS_CONTEXT(WINAPI* P_SetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext);
|
||||
P_SetThreadDpiAwarenessContext pSetThreadDpiAwarenessContext = (P_SetThreadDpiAwarenessContext)GetProcAddress(GetModuleHandle(L"user32.dll"), "SetThreadDpiAwarenessContext");
|
||||
if(pSetThreadDpiAwarenessContext) // not present on windows 7
|
||||
pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
|
||||
else
|
||||
SetProcessDPIAware();
|
||||
}
|
||||
else if (DPI == 2) {
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
}
|
||||
//else {
|
||||
// QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
||||
//}
|
||||
|
||||
|
||||
QtSingleApplication app(argc, argv);
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
|
||||
|
@ -98,15 +119,6 @@ int main(int argc, char *argv[])
|
|||
else if (app.sendMessage("ShowWnd"))
|
||||
return 0;
|
||||
|
||||
|
||||
if (QFile::exists(QCoreApplication::applicationDirPath() + "\\Certificate.dat")) {
|
||||
CSettingsWindow::LoadCertificate();
|
||||
g_CertInfo.business = GetArguments(g_Certificate, L'\n', L':').value("TYPE").toUpper().contains("BUSINESS");
|
||||
}
|
||||
|
||||
// use a shared setting location when used in a business environment for easier administration
|
||||
theConf = new CSettings("Sandboxie-Plus", g_CertInfo.business);
|
||||
|
||||
#ifndef _DEBUG
|
||||
InitMiniDumpWriter(QString("SandMan-v%1").arg(CSandMan::GetVersion()).toStdWString().c_str() , QString(theConf->GetConfigDir()).replace("/", "\\").toStdWString().c_str());
|
||||
#endif
|
||||
|
|