wizard
This commit is contained in:
parent
fd2e11a5cf
commit
0b487cd3a1
|
@ -68,6 +68,7 @@
|
|||
<file>IconOffC.png</file>
|
||||
<file>IconOffCx.png</file>
|
||||
<file>Actions/Monitor.png</file>
|
||||
<file>SideLogo.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Boxes">
|
||||
<file alias="Empty3">Boxes/sandbox-b-empty.png</file>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
|
@ -21,6 +21,8 @@
|
|||
#include "Views/TraceView.h"
|
||||
#include "Windows/SelectBoxWindow.h"
|
||||
#include "../UGlobalHotkey/uglobalhotkeys.h"
|
||||
#include "Wizards/SetupWizard.h"
|
||||
#include "Helpers/WinAdmin.h"
|
||||
|
||||
CSbiePlusAPI* theAPI = NULL;
|
||||
|
||||
|
@ -354,6 +356,7 @@ void CSandMan::CreateMenus()
|
|||
m_pStopSvc = m_pMaintenanceItems->addAction(tr("Stop Service"), this, SLOT(OnMaintenance()));
|
||||
m_pUninstallSvc = m_pMaintenanceItems->addAction(tr("Uninstall Service"), this, SLOT(OnMaintenance()));
|
||||
m_pMaintenance->addSeparator();
|
||||
m_pSetupWizard = m_pMaintenance->addAction(CSandMan::GetIcon("Software"), tr("Setup Wizard"), this, SLOT(OnMaintenance()));
|
||||
if(IsFullyPortable())
|
||||
m_pUninstallAll = m_pMaintenance->addAction(CSandMan::GetIcon("Uninstall"), tr("Uninstall All"), this, SLOT(OnMaintenance()));
|
||||
|
||||
|
@ -1172,6 +1175,18 @@ void CSandMan::OnStatusChanged()
|
|||
OnLogMessage(tr("Default sandbox not found; creating: %1").arg("DefaultBox"));
|
||||
theAPI->CreateBox("DefaultBox");
|
||||
}
|
||||
|
||||
int BusinessUse = theConf->GetInt("Options/BusinessUse", 2);
|
||||
if (g_CertInfo.business && BusinessUse == 0) // if we have a Business cert switch to that use case
|
||||
theConf->SetValue("Options/BusinessUse", 1);
|
||||
|
||||
int WizardLevel = theConf->GetBool("Options/WizardLevel", 0);
|
||||
if (WizardLevel == 0) {
|
||||
if (CSetupWizard::ShowWizard())
|
||||
UpdateSettings();
|
||||
else // if user canceled mark that and not show again
|
||||
theConf->SetValue("Options/WizardLevel", -1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1716,9 +1731,22 @@ void CSandMan::OnMaintenance()
|
|||
Status = CSbieUtils::Uninstall(CSbieUtils::eService);
|
||||
|
||||
// uninstall
|
||||
else if (sender() == m_pUninstallAll)
|
||||
else if (sender() == m_pUninstallAll) {
|
||||
|
||||
Status = StopSbie(true);
|
||||
|
||||
AutorunEnable(false);
|
||||
|
||||
CSbieUtils::RemoveContextMenu();
|
||||
CSbieUtils::RemoveContextMenu2();
|
||||
}
|
||||
|
||||
else if (sender() == m_pSetupWizard) {
|
||||
if (CSetupWizard::ShowWizard())
|
||||
UpdateSettings();
|
||||
return;
|
||||
}
|
||||
|
||||
HandleMaintenance(Status);
|
||||
}
|
||||
|
||||
|
|
|
@ -258,6 +258,7 @@ private:
|
|||
QAction* m_pUninstallSvc;
|
||||
QAction* m_pStopAll;
|
||||
QAction* m_pUninstallAll;
|
||||
QAction* m_pSetupWizard;
|
||||
QAction* m_pExit;
|
||||
|
||||
QMenu* m_pMenuView;
|
||||
|
|
|
@ -23,7 +23,8 @@ HEADERS += ./stdafx.h \
|
|||
./Windows/SettingsWindow.h \
|
||||
./Windows/OptionsWindow.h \
|
||||
./Windows/SelectBoxWindow.h \
|
||||
./Windows/FileBrowserWindow.h
|
||||
./Windows/FileBrowserWindow.h\
|
||||
./Wizards/SetupWizard.h
|
||||
|
||||
SOURCES += ./main.cpp \
|
||||
./stdafx.cpp \
|
||||
|
@ -57,7 +58,8 @@ SOURCES += ./main.cpp \
|
|||
./Windows/SettingsWindow.cpp \
|
||||
./Windows/SnapshotsWindow.cpp \
|
||||
./Windows/SelectBoxWindow.cpp \
|
||||
./Windows/FileBrowserWindow.cpp
|
||||
./Windows/FileBrowserWindow.cpp\
|
||||
./Wizards/SetupWizard.cpp
|
||||
|
||||
FORMS += ./Forms/NewBoxWindow.ui \
|
||||
./Forms/OptionsWindow.ui \
|
||||
|
|
|
@ -233,8 +233,10 @@
|
|||
<ClCompile Include="Windows\SelectBoxWindow.cpp" />
|
||||
<ClCompile Include="Windows\SettingsWindow.cpp" />
|
||||
<ClCompile Include="Windows\SnapshotsWindow.cpp" />
|
||||
<ClCompile Include="Wizards\SetupWizard.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="Wizards\SetupWizard.h" />
|
||||
<QtMoc Include="Windows\FileBrowserWindow.h" />
|
||||
<QtMoc Include="Windows\SelectBoxWindow.h" />
|
||||
<QtMoc Include="Views\TraceView.h" />
|
||||
|
@ -250,6 +252,7 @@
|
|||
<QtMoc Include="Models\TraceModel.h" />
|
||||
<QtMoc Include="Dialogs\MultiErrorDialog.h" />
|
||||
<QtMoc Include="BoxJob.h" />
|
||||
<ClInclude Include="..\version.h" />
|
||||
<ClInclude Include="Helpers\FindTool.h" />
|
||||
<ClInclude Include="Helpers\WinAdmin.h" />
|
||||
<QtMoc Include="Models\MonitorModel.h" />
|
||||
|
|
|
@ -46,6 +46,9 @@
|
|||
<Extensions>ts</Extensions>
|
||||
<ParseFiles>false</ParseFiles>
|
||||
</Filter>
|
||||
<Filter Include="Wizards">
|
||||
<UniqueIdentifier>{4bf40c7e-2ce4-4528-813c-3b48b8c56155}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
|
@ -147,6 +150,9 @@
|
|||
<ClCompile Include="Models\MonitorModel.cpp">
|
||||
<Filter>Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Wizards\SetupWizard.cpp">
|
||||
<Filter>Wizards</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
|
@ -161,6 +167,9 @@
|
|||
<ClInclude Include="resource.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="SandMan.h">
|
||||
|
@ -217,6 +226,9 @@
|
|||
<QtMoc Include="Models\MonitorModel.h">
|
||||
<Filter>Models</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="Wizards\SetupWizard.h">
|
||||
<Filter>Wizards</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="Resources\SandMan.qrc">
|
||||
|
|
|
@ -230,6 +230,13 @@ void CSettingsWindow__AddContextMenu()
|
|||
QApplication::applicationDirPath().replace("/", "\\") + "\\Start.exe");
|
||||
}
|
||||
|
||||
void CSettingsWindow__AddBrowserIcon()
|
||||
{
|
||||
QString Path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation).replace("/", "\\");
|
||||
Path += "\\" + CSettingsWindow::tr("Sandboxed Web Browser") + ".lnk";
|
||||
CSbieUtils::CreateShortcut(theAPI, Path, "", "", "default_browser");
|
||||
}
|
||||
|
||||
void CSettingsWindow::LoadSettings()
|
||||
{
|
||||
ui.uiLang->setCurrentIndex(ui.uiLang->findData(theConf->GetString("Options/UiLanguage")));
|
||||
|
@ -535,80 +542,26 @@ void CSettingsWindow::SaveSettings()
|
|||
{
|
||||
QByteArray Certificate = ui.txtCertificate->toPlainText().toUtf8();
|
||||
if (g_Certificate != Certificate) {
|
||||
|
||||
|
||||
QPalette palette = QApplication::palette();
|
||||
|
||||
QString CertPath = theAPI->GetSbiePath() + "\\Certificate.dat";
|
||||
if (!Certificate.isEmpty()) {
|
||||
|
||||
auto Args = GetArguments(Certificate, L'\n', L':');
|
||||
|
||||
bool bLooksOk = true;
|
||||
if (Args.value("NAME").isEmpty()) // mandatory
|
||||
bLooksOk = false;
|
||||
//if (Args.value("UPDATEKEY").isEmpty())
|
||||
// bLooksOk = false;
|
||||
if (Args.value("SIGNATURE").isEmpty()) // absolutely mandatory
|
||||
bLooksOk = false;
|
||||
|
||||
if (bLooksOk) {
|
||||
QString TempPath = QDir::tempPath() + "/Sbie+Certificate.dat";
|
||||
QFile CertFile(TempPath);
|
||||
if (CertFile.open(QFile::WriteOnly)) {
|
||||
CertFile.write(Certificate);
|
||||
CertFile.close();
|
||||
}
|
||||
|
||||
WindowsMoveFile(TempPath.replace("/", "\\"), CertPath.replace("/", "\\"));
|
||||
}
|
||||
else {
|
||||
Certificate.clear();
|
||||
QMessageBox::critical(this, "Sandboxie-Plus", tr("This does not look like a certificate, please enter the entire certificate not just a portion of it."));
|
||||
}
|
||||
}
|
||||
else if(!g_Certificate.isEmpty()){
|
||||
WindowsMoveFile(CertPath.replace("/", "\\"), "");
|
||||
}
|
||||
|
||||
if (theGUI->m_DarkTheme)
|
||||
palette.setColor(QPalette::Text, Qt::black);
|
||||
|
||||
ui.lblCertExp->setVisible(false);
|
||||
|
||||
bool bRet = ApplyCertificate(Certificate, this);
|
||||
|
||||
if (Certificate.isEmpty())
|
||||
{
|
||||
palette.setColor(QPalette::Base, Qt::white);
|
||||
}
|
||||
else if (!theAPI->ReloadCert().IsError())
|
||||
{
|
||||
g_FeatureFlags = theAPI->GetFeatureFlags();
|
||||
theGUI->UpdateCertState();
|
||||
|
||||
if (g_CertInfo.expired || g_CertInfo.outdated) {
|
||||
if(g_CertInfo.expired)
|
||||
QMessageBox::information(this, "Sandboxie-Plus", tr("This certificate is unfortunately expired."));
|
||||
else
|
||||
QMessageBox::information(this, "Sandboxie-Plus", tr("This certificate is unfortunately outdated."));
|
||||
|
||||
palette.setColor(QPalette::Base, QColor(255, 255, 192));
|
||||
ui.lblCertExp->setVisible(true);
|
||||
}
|
||||
else {
|
||||
QMessageBox::information(this, "Sandboxie-Plus", tr("Thank you for supporting the development of Sandboxie-Plus."));
|
||||
|
||||
palette.setColor(QPalette::Base, QColor(192, 255, 192));
|
||||
}
|
||||
else if (!bRet)
|
||||
palette.setColor(QPalette::Base, QColor(255, 192, 192));
|
||||
else if (g_CertInfo.expired || g_CertInfo.outdated) {
|
||||
palette.setColor(QPalette::Base, QColor(255, 255, 192));
|
||||
ui.lblCertExp->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, "Sandboxie-Plus", tr("This support certificate is not valid."));
|
||||
|
||||
palette.setColor(QPalette::Base, QColor(255, 192, 192));
|
||||
Certificate.clear();
|
||||
g_CertInfo.State = 0;
|
||||
}
|
||||
|
||||
g_Certificate = Certificate;
|
||||
palette.setColor(QPalette::Base, QColor(192, 255, 192));
|
||||
|
||||
ui.txtCertificate->setPalette(palette);
|
||||
}
|
||||
|
@ -625,6 +578,71 @@ void CSettingsWindow::SaveSettings()
|
|||
emit OptionsChanged();
|
||||
}
|
||||
|
||||
bool CSettingsWindow::ApplyCertificate(const QByteArray &Certificate, QWidget* widget)
|
||||
{
|
||||
QString CertPath = theAPI->GetSbiePath() + "\\Certificate.dat";
|
||||
if (!Certificate.isEmpty()) {
|
||||
|
||||
auto Args = GetArguments(Certificate, L'\n', L':');
|
||||
|
||||
bool bLooksOk = true;
|
||||
if (Args.value("NAME").isEmpty()) // mandatory
|
||||
bLooksOk = false;
|
||||
//if (Args.value("UPDATEKEY").isEmpty())
|
||||
// bLooksOk = false;
|
||||
if (Args.value("SIGNATURE").isEmpty()) // absolutely mandatory
|
||||
bLooksOk = false;
|
||||
|
||||
if (bLooksOk) {
|
||||
QString TempPath = QDir::tempPath() + "/Sbie+Certificate.dat";
|
||||
QFile CertFile(TempPath);
|
||||
if (CertFile.open(QFile::WriteOnly)) {
|
||||
CertFile.write(Certificate);
|
||||
CertFile.close();
|
||||
}
|
||||
|
||||
WindowsMoveFile(TempPath.replace("/", "\\"), CertPath.replace("/", "\\"));
|
||||
}
|
||||
else {
|
||||
QMessageBox::critical(widget, "Sandboxie-Plus", tr("This does not look like a certificate, please enter the entire certificate not just a portion of it."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(!g_Certificate.isEmpty()){
|
||||
WindowsMoveFile(CertPath.replace("/", "\\"), "");
|
||||
}
|
||||
|
||||
if (Certificate.isEmpty())
|
||||
return false;
|
||||
|
||||
if (!theAPI->ReloadCert().IsError())
|
||||
{
|
||||
g_FeatureFlags = theAPI->GetFeatureFlags();
|
||||
theGUI->UpdateCertState();
|
||||
|
||||
if (g_CertInfo.expired || g_CertInfo.outdated) {
|
||||
if(g_CertInfo.expired)
|
||||
QMessageBox::information(widget, "Sandboxie-Plus", tr("This certificate is unfortunately expired."));
|
||||
else
|
||||
QMessageBox::information(widget, "Sandboxie-Plus", tr("This certificate is unfortunately outdated."));
|
||||
}
|
||||
else {
|
||||
QMessageBox::information(widget, "Sandboxie-Plus", tr("Thank you for supporting the development of Sandboxie-Plus."));
|
||||
}
|
||||
|
||||
g_Certificate = Certificate;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(widget, "Sandboxie-Plus", tr("This support certificate is not valid."));
|
||||
|
||||
g_CertInfo.State = 0;
|
||||
g_Certificate.clear();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingsWindow::apply()
|
||||
{
|
||||
if (!ui.btnEditIni->isEnabled())
|
||||
|
|
|
@ -24,6 +24,8 @@ public:
|
|||
virtual void accept() {}
|
||||
virtual void reject();
|
||||
|
||||
static bool ApplyCertificate(const QByteArray &Certificate, QWidget* widget);
|
||||
|
||||
static void LoadCertificate();
|
||||
|
||||
signals:
|
||||
|
@ -88,6 +90,7 @@ private:
|
|||
};
|
||||
|
||||
void CSettingsWindow__AddContextMenu();
|
||||
void CSettingsWindow__AddBrowserIcon();
|
||||
|
||||
void WindowsMoveFile(const QString& from, const QString& to);
|
||||
|
||||
|
|
|
@ -0,0 +1,327 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
#include "SetupWizard.h"
|
||||
#include "../MiscHelpers/Common/Common.h"
|
||||
#include "../Windows/SettingsWindow.h"
|
||||
#include "../SandMan.h"
|
||||
#include "Helpers/WinAdmin.h"
|
||||
|
||||
QString emailRegExp = QStringLiteral(".+@.+");
|
||||
|
||||
CSetupWizard::CSetupWizard(QWidget *parent)
|
||||
: QWizard(parent)
|
||||
{
|
||||
setPage(Page_Intro, new CIntroPage);
|
||||
setPage(Page_Certificate, new CCertificatePage);
|
||||
setPage(Page_Shell, new CShellPage);
|
||||
setPage(Page_Finish, new CFinishPage);
|
||||
|
||||
setWizardStyle(ModernStyle);
|
||||
//setOption(HaveHelpButton, true);
|
||||
setPixmap(QWizard::LogoPixmap, QPixmap(":/SandMan.png").scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
|
||||
connect(this, &QWizard::helpRequested, this, &CSetupWizard::showHelp);
|
||||
|
||||
setWindowTitle(tr("Setup Wizard"));
|
||||
}
|
||||
|
||||
void CSetupWizard::showHelp()
|
||||
{
|
||||
static QString lastHelpMessage;
|
||||
|
||||
QString message;
|
||||
|
||||
switch (currentId()) {
|
||||
case Page_Intro:
|
||||
message = tr("The decision you make here will affect which page you get to see next.");
|
||||
break;
|
||||
default:
|
||||
message = tr("This help is likely not to be of any help.");
|
||||
}
|
||||
|
||||
if (lastHelpMessage == message)
|
||||
message = tr("Sorry, I already gave what help I could.");
|
||||
|
||||
QMessageBox::information(this, tr("Setup Wizard Help"), message);
|
||||
|
||||
lastHelpMessage = message;
|
||||
}
|
||||
|
||||
bool CSetupWizard::ShowWizard()
|
||||
{
|
||||
CSetupWizard wizard;
|
||||
if (!wizard.exec())
|
||||
return false;
|
||||
|
||||
//bool useBusiness = wizard.field("useBusiness").toBool();
|
||||
//QString Certificate = wizard.field("useCertificate").toString();
|
||||
//bool isEvaluate = wizard.field("isEvaluate").toBool();
|
||||
|
||||
AutorunEnable(wizard.field("isAutoStart").toBool());
|
||||
|
||||
if (wizard.field("useContecxtMenu").toBool())
|
||||
CSettingsWindow__AddContextMenu();
|
||||
|
||||
if (wizard.field("useBrowserIcon").toBool())
|
||||
CSettingsWindow__AddBrowserIcon();
|
||||
|
||||
if (wizard.field("isUpdate").toBool()) {
|
||||
theConf->SetValue("Options/CheckForUpdates", 1);
|
||||
theConf->SetValue("Options/DownloadUpdates", 1);
|
||||
theConf->SetValue("Options/InstallUpdates", 1);
|
||||
}
|
||||
|
||||
theConf->SetValue("Options/WizardLevel", 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CIntroPage
|
||||
//
|
||||
|
||||
CIntroPage::CIntroPage(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
{
|
||||
setTitle(tr("Introduction"));
|
||||
setPixmap(QWizard::WatermarkPixmap, QPixmap(":/SideLogo.png"));
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
QLabel* pTopLabel = new QLabel(tr("Welcome to the Setup Wizard. This wizard will help you to configure your copy of <b>Sandboxie-Plus</b>. "
|
||||
"You can start this wizard at any time from the Box->Maintenance if you do not wish to complete it now."));
|
||||
pTopLabel->setWordWrap(true);
|
||||
layout->addWidget(pTopLabel);
|
||||
|
||||
QWidget* pSpace = new QWidget();
|
||||
pSpace->setMinimumHeight(16);
|
||||
layout->addWidget(pSpace);
|
||||
|
||||
int BusinessUse = theConf->GetInt("Options/BusinessUse", 2);
|
||||
|
||||
m_pLabel = new QLabel(tr("Select how you would like to use Sandboxie-Plus"));
|
||||
layout->addWidget(m_pLabel);
|
||||
|
||||
m_pPersonalRadio = new QRadioButton(tr("&Personally for private non comertial use"));
|
||||
layout->addWidget(m_pPersonalRadio);
|
||||
connect(m_pPersonalRadio, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
|
||||
registerField("usePersonal", m_pPersonalRadio);
|
||||
|
||||
m_pBusinessRadio = new QRadioButton(tr("&Commercially for business or enterprise use"));
|
||||
layout->addWidget(m_pBusinessRadio);
|
||||
connect(m_pBusinessRadio, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
|
||||
registerField("useBusiness", m_pBusinessRadio);
|
||||
|
||||
if (BusinessUse != 2) {
|
||||
m_pLabel->setEnabled(false);
|
||||
m_pPersonalRadio->setChecked(BusinessUse == 0);
|
||||
m_pPersonalRadio->setEnabled(false);
|
||||
m_pBusinessRadio->setChecked(BusinessUse == 1);
|
||||
m_pBusinessRadio->setEnabled(false);
|
||||
}
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
int CIntroPage::nextId() const
|
||||
{
|
||||
if(g_Certificate.isEmpty())
|
||||
return CSetupWizard::Page_Certificate;
|
||||
return CSetupWizard::Page_Shell;
|
||||
}
|
||||
|
||||
bool CIntroPage::isComplete() const
|
||||
{
|
||||
if (m_pLabel->isEnabled() && !m_pPersonalRadio->isChecked() && !m_pBusinessRadio->isChecked())
|
||||
return false;
|
||||
return QWizardPage::isComplete();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CCertificatePage
|
||||
//
|
||||
|
||||
CCertificatePage::CCertificatePage(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
{
|
||||
setTitle(tr("Install your <b>Sandboxie-Plus</b> support certificate"));
|
||||
setSubTitle(tr("If you have a supporter certificate, please fill it into the field below."));
|
||||
|
||||
QGridLayout *layout = new QGridLayout;
|
||||
|
||||
m_pTopLabel = new QLabel();
|
||||
m_pTopLabel->setWordWrap(true);
|
||||
layout->addWidget(m_pTopLabel);
|
||||
|
||||
m_pCertificate = new QPlainTextEdit();
|
||||
m_pCertificate->setMaximumSize(QSize(16777215, 73));
|
||||
m_pCertificate->setPlaceholderText(
|
||||
"NAME: User Name\n"
|
||||
"LEVEL: ULTIMATE\n"
|
||||
"DATE: dd.mm.yyyy\n"
|
||||
"UPDATEKEY: 00000000000000000000000000000000\n"
|
||||
"SIGNATURE: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
|
||||
);
|
||||
//layout->addWidget(m_pCertificate); // we dont show this page when there already is a certificat present
|
||||
connect(m_pCertificate, SIGNAL(textChanged()), this, SIGNAL(completeChanged()));
|
||||
registerField("useCertificate", m_pCertificate, "plainText");
|
||||
|
||||
m_pEvaluate = new QCheckBox(tr("Start evaluation without a certificate for a limited periode of time."));
|
||||
layout->addWidget(m_pEvaluate);
|
||||
connect(m_pEvaluate, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
|
||||
registerField("isEvaluate", m_pEvaluate);
|
||||
|
||||
layout->addWidget(new QWidget());
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void CCertificatePage::initializePage()
|
||||
{
|
||||
m_pCertificate->setPlainText(g_Certificate);
|
||||
|
||||
if (field("useBusiness").toBool())
|
||||
{
|
||||
theConf->SetValue("Options/BusinessUse", 1);
|
||||
|
||||
m_pTopLabel->setText(
|
||||
tr("To use <b>Sandboxie-Plus</b> in a business setting an apropriate business use <a href=\"https://sandboxie-plus.com/go.php?to=sbie-get-cert\">support certificate</a> is required. "
|
||||
"If you do not yet have the required certificate(s) you can get those from the <a href=\"https://xanasoft.com/shop/\">xanasoft.com web shop</a>.")
|
||||
);
|
||||
|
||||
m_pEvaluate->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
theConf->SetValue("Options/BusinessUse", 0);
|
||||
|
||||
m_pTopLabel->setText(
|
||||
tr("<b>Sandboxie-Plus</b> provides additional features and box types exclusively to <u>project supporters</u>. "
|
||||
"Boxes like the Privacy Enhanced boxes <b><font color='red'>protect user data from illicit access</font></b> by the sandboxed programs. "
|
||||
"If you are not yet a supporter then please consider <a href=\"https://sandboxie-plus.com/go.php?to=sbie-get-cert\">supporting the project</a> "
|
||||
"to to ensure furtehr developement of sandboxie and to receive a <a href=\"https://sandboxie-plus.com/go.php?to=sbie-cert\">supporter certificate</a>.")
|
||||
);
|
||||
|
||||
m_pEvaluate->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
int CCertificatePage::nextId() const
|
||||
{
|
||||
return CSetupWizard::Page_Shell;
|
||||
}
|
||||
|
||||
bool CCertificatePage::isComplete() const
|
||||
{
|
||||
if (field("useBusiness").toBool())
|
||||
{
|
||||
m_pCertificate->setEnabled(!m_pEvaluate->isChecked());
|
||||
if (m_pCertificate->toPlainText().isEmpty() && !m_pEvaluate->isChecked())
|
||||
return false;
|
||||
}
|
||||
return QWizardPage::isComplete();
|
||||
}
|
||||
|
||||
bool CCertificatePage::validatePage()
|
||||
{
|
||||
QByteArray Certificate = m_pCertificate->toPlainText().toLatin1();
|
||||
if (!m_pEvaluate->isChecked() && !Certificate.isEmpty() && g_Certificate != Certificate) {
|
||||
return CSettingsWindow::ApplyCertificate(Certificate, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CShellPage
|
||||
//
|
||||
|
||||
CShellPage::CShellPage(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
{
|
||||
setTitle(tr("Configure <b>Sandboxie-Plus</b> shell integration"));
|
||||
setSubTitle(tr("Configure how Sandboxie-Plus should integrate with your system."));
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
|
||||
m_pAutoStart = new QCheckBox(tr("Start UI with Windows"));
|
||||
m_pAutoStart->setChecked(true);
|
||||
layout->addWidget(m_pAutoStart);
|
||||
registerField("isAutoStart", m_pAutoStart);
|
||||
|
||||
m_pContecxtMenu = new QCheckBox(tr("Add 'Run Sandboxed' to the explorer context menu"));
|
||||
m_pContecxtMenu->setChecked(true);
|
||||
layout->addWidget(m_pContecxtMenu);
|
||||
registerField("useContecxtMenu", m_pContecxtMenu);
|
||||
|
||||
m_pBrowserIcon = new QCheckBox(tr("Add desktop shortcut for starting Web browser under Sandboxie"));
|
||||
m_pBrowserIcon->setChecked(true);
|
||||
layout->addWidget(m_pBrowserIcon);
|
||||
registerField("useBrowserIcon", m_pBrowserIcon);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
int CShellPage::nextId() const
|
||||
{
|
||||
return CSetupWizard::Page_Finish;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CFinishPage
|
||||
//
|
||||
|
||||
CFinishPage::CFinishPage(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
{
|
||||
setTitle(tr("Complete Your Configuration"));
|
||||
setPixmap(QWizard::WatermarkPixmap, QPixmap(":/SideLogo.png"));
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
|
||||
m_pLabel = new QLabel;
|
||||
m_pLabel->setWordWrap(true);
|
||||
m_pLabel->setText(tr("Almost complete, click Finish to apply all selected options and finisch the wizard."));
|
||||
layout->addWidget(m_pLabel);
|
||||
|
||||
QWidget* pSpacer = new QWidget();
|
||||
pSpacer->setMinimumHeight(16);
|
||||
layout->addWidget(pSpacer);
|
||||
|
||||
//QLabel* pLabel = new QLabel;
|
||||
//pLabel->setWordWrap(true);
|
||||
//pLabel->setText(tr("Like with any other security product it's important to keep your Sandboxie-Plus up to date."));
|
||||
//layout->addWidget(pLabel);
|
||||
|
||||
m_pUpdate = new QCheckBox(tr("Keep Sandboxie-Plus up to date."));
|
||||
m_pUpdate->setChecked(true);
|
||||
layout->addWidget(m_pUpdate);
|
||||
registerField("isUpdate", m_pUpdate);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
int CFinishPage::nextId() const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CFinishPage::initializePage()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//void ConclusionPage::setVisible(bool visible)
|
||||
//{
|
||||
// QWizardPage::setVisible(visible);
|
||||
//
|
||||
// if (visible) {
|
||||
// wizard()->setButtonText(QWizard::CustomButton1, tr("&Print"));
|
||||
// wizard()->setOption(QWizard::HaveCustomButton1, true);
|
||||
// connect(wizard(), &QWizard::customButtonClicked,
|
||||
// this, &ConclusionPage::printButtonClicked);
|
||||
// } else {
|
||||
// wizard()->setOption(QWizard::HaveCustomButton1, false);
|
||||
// disconnect(wizard(), &QWizard::customButtonClicked,
|
||||
// this, &ConclusionPage::printButtonClicked);
|
||||
// }
|
||||
//}
|
|
@ -0,0 +1,107 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWizard>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCheckBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QRadioButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class CSetupWizard : public QWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum { Page_Intro, Page_Certificate, Page_Shell, Page_Finish };
|
||||
|
||||
CSetupWizard(QWidget *parent = nullptr);
|
||||
|
||||
static bool ShowWizard();
|
||||
|
||||
private slots:
|
||||
void showHelp();
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CIntroPage
|
||||
//
|
||||
|
||||
class CIntroPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CIntroPage(QWidget *parent = nullptr);
|
||||
|
||||
int nextId() const override;
|
||||
bool isComplete() const override;
|
||||
|
||||
private:
|
||||
QLabel* m_pLabel;
|
||||
QRadioButton *m_pPersonalRadio;
|
||||
QRadioButton *m_pBusinessRadio;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CCertificatePage
|
||||
//
|
||||
|
||||
class CCertificatePage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CCertificatePage(QWidget *parent = nullptr);
|
||||
|
||||
void initializePage() override;
|
||||
int nextId() const override;
|
||||
bool isComplete() const override;
|
||||
bool validatePage() override;
|
||||
|
||||
private:
|
||||
QLabel* m_pTopLabel;
|
||||
QPlainTextEdit* m_pCertificate;
|
||||
QCheckBox* m_pEvaluate;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CShellPage
|
||||
//
|
||||
|
||||
class CShellPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CShellPage(QWidget *parent = nullptr);
|
||||
|
||||
int nextId() const override;
|
||||
|
||||
private:
|
||||
QCheckBox *m_pAutoStart;
|
||||
QCheckBox *m_pContecxtMenu;
|
||||
QCheckBox *m_pBrowserIcon;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CFinishPage
|
||||
//
|
||||
|
||||
class CFinishPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CFinishPage(QWidget *parent = nullptr);
|
||||
|
||||
void initializePage() override;
|
||||
int nextId() const override;
|
||||
//void setVisible(bool visible) override;
|
||||
|
||||
private:
|
||||
QLabel *m_pLabel;
|
||||
QCheckBox *m_pUpdate;
|
||||
};
|
||||
|
Loading…
Reference in New Issue