This commit is contained in:
DavidXanatos 2022-12-06 10:33:17 +01:00
parent d3115408c1
commit b852eb16b7
3 changed files with 35 additions and 16 deletions

View File

@ -4,6 +4,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.6.1a / 5.61.1] - 2022-12-??
### Fixed
- improved fix for [#2495](https://github.com/sandboxie-plus/Sandboxie/issues/2495)
## [1.6.1 / 5.61.1] - 2022-12-04

View File

@ -61,13 +61,20 @@ SB_STATUS CSbieIni::SetBool(const QString& Setting, bool Value)
SB_STATUS CSbieIni::SetBoolSafe(const QString& Setting, bool Value)
{
QString StrValue = Value ? "y" : "n";
bool bAdd = true;
QStringList Values = GetTextList(Setting, false);
foreach(const QString & StrValue, Values) {
if (StrValue.contains(","))
foreach(const QString & CurValue, Values) {
if (CurValue.contains(","))
continue;
DelValue(Setting, StrValue);
if (CurValue == StrValue)
bAdd = false;
else
DelValue(Setting, CurValue);
}
return InsertText(Setting, Value ? "y" : "n");
if(bAdd)
return InsertText(Setting, StrValue);
return SB_OK;
}
QString CSbieIni::GetText(const QString& Setting, const QString& Default, bool bWithGlobal, bool bNoExpand, bool withTemplates) const

View File

@ -759,28 +759,34 @@ void COptionsWindow::WriteAdvancedCheck(QCheckBox* pCheck, const QString& Name,
if (!pCheck->isEnabled())
return;
QStringList Values = m_pBox->GetTextList(Name, false);
foreach(const QString & StrValue, Values) {
if (StrValue.contains(","))
continue;
m_pBox->DelValue(Name, StrValue);
}
SB_STATUS Status;
QString StrValue;
if (pCheck->checkState() == Qt::Checked)
{
if (!OnValue.isEmpty())
Status = m_pBox->InsertText(Name, OnValue);
StrValue = OnValue;
}
else if (pCheck->checkState() == Qt::Unchecked)
{
if (!OffValue.isEmpty())
Status = m_pBox->InsertText(Name, OffValue);
StrValue = OffValue;
}
QStringList Values = m_pBox->GetTextList(Name, false);
foreach(const QString & CurValue, Values) {
if (CurValue.contains(","))
continue;
if (!StrValue.isEmpty() && CurValue == StrValue)
StrValue.clear();
else
m_pBox->DelValue(Name, CurValue);
}
if (!StrValue.isEmpty()) {
SB_STATUS Status = m_pBox->InsertText(Name, StrValue);
if (!Status)
throw Status;
}
}
void COptionsWindow::WriteText(const QString& Name, const QString& Value)
{