2021-10-16 16:19:51 +01:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "OptionsWindow.h"
|
|
|
|
#include "SandMan.h"
|
|
|
|
#include "SettingsWindow.h"
|
|
|
|
#include "../MiscHelpers/Common/Settings.h"
|
|
|
|
#include "../MiscHelpers/Common/Common.h"
|
|
|
|
#include "../MiscHelpers/Common/ComboInputDialog.h"
|
|
|
|
#include "../MiscHelpers/Common/SettingsWidgets.h"
|
|
|
|
#include "Helpers/WinAdmin.h"
|
|
|
|
|
|
|
|
void COptionsWindow::LoadStart()
|
|
|
|
{
|
|
|
|
ui.chkStartBlockMsg->setEnabled(!ui.radStartAll->isChecked());
|
|
|
|
ui.chkStartBlockMsg->setChecked(m_pBox->GetBool("NotifyStartRunAccessDenied", true));
|
2024-05-26 06:44:21 +01:00
|
|
|
ui.chkAlertBeforeStart->setChecked(m_pBox->GetBool("AlertBeforeStart", false));
|
2021-10-16 16:19:51 +01:00
|
|
|
m_StartChanged = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void COptionsWindow::SaveStart()
|
|
|
|
{
|
|
|
|
WriteAdvancedCheck(ui.chkStartBlockMsg, "NotifyStartRunAccessDenied", "", "n");
|
2024-05-26 06:44:21 +01:00
|
|
|
WriteAdvancedCheck(ui.chkAlertBeforeStart, "AlertBeforeStart", "y", "");
|
2021-10-16 16:19:51 +01:00
|
|
|
m_StartChanged = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void COptionsWindow::OnRestrictStart()
|
|
|
|
{
|
|
|
|
// only selected
|
|
|
|
bool Enable = ui.radStartSelected->isChecked();
|
|
|
|
if (Enable)
|
|
|
|
SetAccessEntry(eIPC, "!<StartRunAccess>", eClosed, "*");
|
|
|
|
else
|
|
|
|
DelAccessEntry(eIPC, "!<StartRunAccess>", eClosed, "*");
|
|
|
|
|
|
|
|
// all except selected
|
|
|
|
Enable = ui.radStartExcept->isChecked();
|
|
|
|
if (Enable)
|
|
|
|
SetAccessEntry(eIPC, "<StartRunAccess>", eClosed, "*");
|
|
|
|
else
|
|
|
|
DelAccessEntry(eIPC, "<StartRunAccess>", eClosed, "*");
|
|
|
|
|
|
|
|
ui.chkStartBlockMsg->setEnabled(!ui.radStartAll->isChecked());
|
|
|
|
//m_StartChanged = true;
|
2021-11-13 08:28:32 +00:00
|
|
|
//OnOptChanged();
|
2021-10-16 16:19:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void COptionsWindow::OnAddStartProg()
|
|
|
|
{
|
2022-10-26 09:37:30 +01:00
|
|
|
QString Value = SelectProgram();
|
|
|
|
if (Value.isEmpty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
QTreeWidgetItem* pItem = new QTreeWidgetItem();
|
|
|
|
pItem->setCheckState(0, Qt::Checked);
|
|
|
|
SetProgramItem(Value, pItem, 0);
|
|
|
|
pItem->setFlags(pItem->flags() | Qt::ItemIsEditable);
|
|
|
|
ui.treeStart->addTopLevelItem(pItem);
|
|
|
|
|
|
|
|
AddProgramToGroup(Value, "<StartRunAccess>");
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
//m_StartChanged = true;
|
2021-11-13 08:28:32 +00:00
|
|
|
//OnOptChanged();
|
2021-10-16 16:19:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void COptionsWindow::OnDelStartProg()
|
|
|
|
{
|
2022-10-26 09:37:30 +01:00
|
|
|
QTreeWidgetItem* pItem = ui.treeStart->currentItem();
|
|
|
|
if (!pItem)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QString Value = pItem->data(0, Qt::UserRole).toString();
|
|
|
|
|
|
|
|
delete pItem;
|
|
|
|
|
|
|
|
DelProgramFromGroup(Value, "<StartRunAccess>");
|
|
|
|
DelProgramFromGroup(Value, "<StartRunAccessDisabled>");
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
//m_StartChanged = true;
|
2021-11-13 08:28:32 +00:00
|
|
|
//OnOptChanged();
|
2021-10-16 16:19:51 +01:00
|
|
|
}
|
2021-12-03 19:26:09 +00:00
|
|
|
|
|
|
|
void COptionsWindow::OnStartChanged(QTreeWidgetItem* pItem, int Index)
|
|
|
|
{
|
2022-05-01 09:10:47 +01:00
|
|
|
QString Name = pItem->data(0, Qt::UserRole).toString();
|
|
|
|
QString NewName = pItem->text(0);
|
|
|
|
if (Name != NewName)
|
|
|
|
{
|
|
|
|
pItem->setData(0, Qt::UserRole, NewName);
|
|
|
|
|
|
|
|
if (pItem->checkState(0) == Qt::Checked) {
|
|
|
|
if (DelProgramFromGroup(Name, "<StartRunAccess>"))
|
|
|
|
AddProgramToGroup(NewName, "<StartRunAccess>");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (DelProgramFromGroup(Name, "<StartRunAccessDisabled>"))
|
|
|
|
AddProgramToGroup(NewName, "<StartRunAccessDisabled>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (pItem->checkState(0) == Qt::Checked) {
|
|
|
|
if(DelProgramFromGroup(Name, "<StartRunAccessDisabled>"))
|
|
|
|
AddProgramToGroup(Name, "<StartRunAccess>");
|
2021-12-03 19:26:09 +00:00
|
|
|
}
|
|
|
|
else {
|
2022-05-01 09:10:47 +01:00
|
|
|
if(DelProgramFromGroup(Name, "<StartRunAccess>"))
|
|
|
|
AddProgramToGroup(Name, "<StartRunAccessDisabled>");
|
2021-12-03 19:26:09 +00:00
|
|
|
}
|
|
|
|
//m_StartChanged = true;
|
|
|
|
//OnOptChanged();
|
2024-05-26 06:44:21 +01:00
|
|
|
}
|