Skip to content

Commit

Permalink
Update NewBoxWizard.cpp
Browse files Browse the repository at this point in the history
update SharedTemplate
  • Loading branch information
offhub committed Mar 24, 2024
1 parent 01bb3ba commit 0e35e8f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions SandboxiePlus/SandMan/Wizards/NewBoxWizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 0e35e8f

Please sign in to comment.