1.1.0
This commit is contained in:
parent
7d8e3fc177
commit
bdba0e2ebf
|
@ -21,6 +21,7 @@
|
|||
#include "Views/TraceView.h"
|
||||
#include "Windows/SelectBoxWindow.h"
|
||||
#include "../UGlobalHotkey/uglobalhotkeys.h"
|
||||
#include "Wizards/SetupWizard.h"
|
||||
#include "Helpers/WinAdmin.h"
|
||||
|
||||
CSbiePlusAPI* theAPI = NULL;
|
||||
|
@ -355,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()));
|
||||
|
||||
|
@ -1173,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
|
||||
{
|
||||
|
@ -1726,7 +1740,13 @@ void CSandMan::OnMaintenance()
|
|||
CSettingsWindow__RemoveContextMenu();
|
||||
CSbieUtils::RemoveContextMenu2();
|
||||
}
|
||||
|
||||
|
||||
else if (sender() == m_pSetupWizard) {
|
||||
if (CSetupWizard::ShowWizard())
|
||||
UpdateSettings();
|
||||
return;
|
||||
}
|
||||
|
||||
HandleMaintenance(Status);
|
||||
}
|
||||
|
||||
|
|
|
@ -570,80 +570,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);
|
||||
}
|
||||
|
@ -660,6 +606,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:
|
||||
|
|
Loading…
Reference in New Issue