Merge pull request #3751 from offhub/add007-2

Update NewBoxWizard.cpp
This commit is contained in:
DavidXanatos 2024-03-25 19:30:15 +01:00 committed by GitHub
commit 300bdfec6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 8 deletions

View File

@ -176,16 +176,18 @@ SB_STATUS CNewBoxWizard::TryToCreateBox()
if(field("imagesProtection").toBool())
pBox->SetBool("ProtectHostImages", true);
QString stName = "SharedTemplate";
QString stNameCheck = theAPI->SbieIniGetEx("Template_Local_" + stName, "Tmpl.Title");
QString stComment = tr("Add your settings after this line.");
QString templateName = "SharedTemplate";
QString templateFullName = QString("Template_Local_%1").arg(templateName);
QString templateSettings = theAPI->SbieIniGetEx(templateFullName, "");
QString templateComment = tr("Add your settings after this line.");
if (field("sharedTemplate").toBool()) {
if (stNameCheck.isNull()) {
QString stTemplate = QString("Template_Local_%1").arg(stName);
QString stSettings = QString("Tmpl.Title=%1\nTmpl.Class=Local\nTmpl.Comment=%2").arg(stName,stComment);
theAPI->SbieIniSet(stTemplate, "", stSettings);
if (templateSettings.isNull()) {
QString templateBase = QString("Tmpl.Title=%1\r\nTmpl.Class=Local\r\nTmpl.Comment=%2\r\n").arg(templateName, templateComment);
theAPI->SbieIniSet(templateFullName, "", templateBase);
}
pBox->InsertText("Template", "Local_" + stName);
QString insertValue = templateFullName.replace("Template_", "");
pBox->InsertText("Template", insertValue);
}
if (!Password.isEmpty())