This commit is contained in:
DavidXanatos 2023-07-20 20:28:05 +02:00
parent 35928f0d5f
commit e41c6f167e
4 changed files with 43 additions and 4 deletions

View File

@ -21,7 +21,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- fixed issue with working directory for run menu entries
- fixed inpoper global symlink in sandboxed namespace [#3112](https://github.com/sandboxie-plus/Sandboxie/issues/3112)
- fixed 'Addon already installed!' error when clicking 'Show Stack Trace' [#3114](https://github.com/sandboxie-plus/Sandboxie/issues/3114)
- fixed existing BoxNameTitle=process.exe,- removed when toggling other options [#3106](https://github.com/sandboxie-plus/Sandboxie/issues/3106)

View File

@ -207,7 +207,7 @@ void COptionsWindow::CreateGeneral()
void COptionsWindow::LoadGeneral()
{
QString BoxNameTitle = m_pBox->GetText("BoxNameTitle", "n", false, true, false);
QString BoxNameTitle = ReadTextSafe("BoxNameTitle", "n");
ui.cmbBoxIndicator->setCurrentIndex(ui.cmbBoxIndicator->findData(BoxNameTitle.toLower()));
QStringList BorderCfg = m_pBox->GetText("BorderColor").split(",");
@ -316,7 +316,11 @@ void COptionsWindow::LoadGeneral()
void COptionsWindow::SaveGeneral()
{
WriteText("BoxNameTitle", ui.cmbBoxIndicator->currentData().toString());
QString BoxNameTitle = ui.cmbBoxIndicator->currentData().toString();
if (BoxNameTitle == "n")
WriteTextSafe("BoxNameTitle", "");
else
WriteTextSafe("BoxNameTitle", BoxNameTitle);
QStringList BorderCfg;
BorderCfg.append(QString("#%1%2%3").arg(m_BorderColor.blue(), 2, 16, QChar('0')).arg(m_BorderColor.green(), 2, 16, QChar('0')).arg(m_BorderColor.red(), 2, 16, QChar('0')));
@ -399,7 +403,12 @@ void COptionsWindow::SaveGeneral()
WriteGlobalCheck(ui.chkUseVolumeSerialNumbers, "UseVolumeSerialNumbers", false);
}
WriteText("CopyLimitKb", ui.chkCopyLimit->isChecked() ? ui.txtCopyLimit->text() : "-1");
int iLimit = ui.chkCopyLimit->isChecked() ? ui.txtCopyLimit->text().toInt() : -1;
if(iLimit != 80 * 1024)
WriteText("CopyLimitKb", QString::number(iLimit));
else
m_pBox->DelValue("CopyLimitKb");
WriteAdvancedCheck(ui.chkCopyPrompt, "PromptForFileMigration", "", "n");
WriteAdvancedCheck(ui.chkNoCopyWarn, "CopyLimitSilent", "", "y");
WriteAdvancedCheck(ui.chkDenyWrite, "CopyBlockDenyWrite", "y", "");

View File

@ -879,6 +879,34 @@ void COptionsWindow::WriteTextList(const QString& Setting, const QStringList& Li
throw Status;
}
void COptionsWindow::WriteTextSafe(const QString& Name, const QString& Value)
{
QStringList List = m_pBox->GetTextList(Name, false);
// clear all non per process (name=program.exe,value) entries
for (int i = 0; i < List.count(); i++) {
if (!List[i].contains(","))
List.removeAt(i--);
}
// Prepand the global entry
if (!Value.isEmpty()) List.append(Value);
WriteTextList(Name, List);
}
QString COptionsWindow::ReadTextSafe(const QString& Name, const QString& Default)
{
QStringList List = m_pBox->GetTextList(Name, false);
for (int i = 0; i < List.count(); i++) {
if (!List[i].contains(","))
return List[i];
}
return Default;
}
void COptionsWindow::SaveConfig()
{
bool UpdatePaths = false;

View File

@ -547,6 +547,8 @@ private:
void WriteAdvancedCheck(QCheckBox* pCheck, const QString& Name, const QString& OnValue, const QString& OffValue);
void WriteText(const QString& Name, const QString& Value);
void WriteTextList(const QString& Setting, const QStringList& List);
void WriteTextSafe(const QString& Name, const QString& Value);
QString ReadTextSafe(const QString& Name, const QString& Default);
Ui::OptionsWindow ui;
QCheckBox* m_pUseIcon;