Commit 11704c16 authored by Laurent Montel's avatar Laurent Montel 😁

Move indentation method in util file

parent 00fd6710
......@@ -185,3 +185,8 @@ QString AutoCreateScriptUtil::createFullWhatsThis(const QString &help, const QSt
const QString fullWhatsThis = QLatin1String("<qt>") + help + QStringLiteral("<br><a href=\'%1\'>%2</a></qt>").arg(href, i18n("More information"));
return fullWhatsThis;
}
QString AutoCreateScriptUtil::indentation()
{
return QStringLiteral(" ");
}
......@@ -41,6 +41,7 @@ QString quoteStr(QString str, bool protectSlash = true);
void comboboxItemNotFound(const QString &searchItem, const QString &name, QString &error);
QString createFullWhatsThis(const QString &help, const QString &href);
QString protectSlash(QString str);
QString indentation();
}
}
#endif // AUTOCREATESCRIPTUTIL_H
......@@ -43,13 +43,6 @@ using namespace KSieveUi;
static int MINIMUMACTION = 1;
static int MAXIMUMACTION = 8;
namespace {
inline const QString indentation()
{
return QStringLiteral(" ");
}
}
SieveActionWidget::SieveActionWidget(SieveEditorGraphicalModeWidget *graphicalModeWidget, QWidget *parent)
: QWidget(parent)
, mSieveGraphicalModeWidget(graphicalModeWidget)
......@@ -95,11 +88,11 @@ void SieveActionWidget::generatedScript(QString &script, QStringList &requires,
}
QString comment = widgetAction->comment();
if (!comment.trimmed().isEmpty()) {
const QString indent = (onlyActions ? QString() : indentation());
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() : indentation()) + widgetAction->code(currentWidget) + QLatin1Char('\n');
script += (onlyActions ? QString() : AutoCreateScriptUtil::indentation()) + widgetAction->code(currentWidget) + QLatin1Char('\n');
}
}
......
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