Commit 4d5a06dc authored by Laurent Montel's avatar Laurent Montel 😁

Add indentation

parent 292f882d
......@@ -6,6 +6,6 @@ require "ihave";
foreverypart :name "foreach1" {
if ihave "value"
{
stop;
stop;
}
}
......@@ -87,12 +87,18 @@ void SieveActionWidget::generatedScript(QString &script, QStringList &requires,
}
}
QString comment = widgetAction->comment();
QString indent;
if (!onlyActions) {
indent += AutoCreateScriptUtil::indentation();
}
if (inForEveryPartLoop) {
indent += AutoCreateScriptUtil::indentation();
}
if (!comment.trimmed().isEmpty()) {
const QString indent = (onlyActions ? QString() : AutoCreateScriptUtil::indentation());
script += indent;
script += QLatin1Char('#') + comment.replace(QLatin1Char('\n'), QStringLiteral("\n%1#").arg(indent)) + QLatin1Char('\n');
}
script += (onlyActions ? QString() : AutoCreateScriptUtil::indentation()) + widgetAction->code(currentWidget) + QLatin1Char('\n');
script += indent + widgetAction->code(currentWidget) + QLatin1Char('\n');
}
}
......
......@@ -80,6 +80,9 @@ void SieveConditionWidget::generatedScript(QString &script, QStringList &require
requires.append(r);
}
}
if (inForEveryPartLoop) {
//FIXME script += AutoCreateScriptUtil::indentation();
}
script += mConditionList.at(mComboBox->currentIndex())->code(currentWidget) + QLatin1Char('\n');
}
}
......
......@@ -216,12 +216,12 @@ void SieveScriptBlockWidget::generatedScript(QString &script, QStringList &requi
if (conditionStr.isEmpty()) {
return;
} else {
script += indentation +filterStr + conditionStr;
script += indentation + filterStr + conditionStr;
}
if (hasUniqCondition) {
script += indentation + QLatin1String("{\n");
} else {
script += indentation +QLatin1String(")\n{\n");
script += indentation + QStringLiteral(")\n%1{\n").arg(indentation);
}
}
mScriptActionLister->generatedScript(script, requires, onlyActions, inForEveryPartLoop);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment