Commit 6f3b93e3 authored by Laurent Montel's avatar Laurent Montel 😁

Use QLatin1String

parent 7aa1f562
......@@ -27,7 +27,7 @@ using namespace KSieveUi;
SelectMatchTypeComboBox::SelectMatchTypeComboBox(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QWidget *parent)
: QComboBox(parent)
{
mHasRegexCapability = sieveGraphicalModeWidget->sieveCapabilities().contains(QStringLiteral("regex"));
mHasRegexCapability = sieveGraphicalModeWidget->sieveCapabilities().contains(QLatin1String("regex"));
initialize();
connect(this, QOverload<int>::of(&SelectMatchTypeComboBox::activated), this, &SelectMatchTypeComboBox::slotValueChanged);
}
......@@ -40,7 +40,7 @@ void SelectMatchTypeComboBox::slotValueChanged(int val)
{
if (mHasRegexCapability) {
const QString value = itemData(val).toString();
Q_EMIT switchToRegexp(value.contains(QStringLiteral("regex")));
Q_EMIT switchToRegexp(value.contains(QLatin1String("regex")));
}
Q_EMIT valueChanged();
}
......@@ -77,7 +77,7 @@ void SelectMatchTypeComboBox::setCode(const QString &code, const QString &name,
if (mHasRegexCapability) {
//TODO optimize
const QString value = itemData(index).toString();
Q_EMIT switchToRegexp(value.contains(QStringLiteral("regex")));
Q_EMIT switchToRegexp(value.contains(QLatin1String("regex")));
}
} else {
AutoCreateScriptUtil::comboboxItemNotFound(code, name, error);
......
......@@ -78,7 +78,7 @@ QString SieveActionAbstractFlags::code(QWidget *w) const
QStringList SieveActionAbstractFlags::needRequires(QWidget *) const
{
if (sieveCapabilities().contains(QStringLiteral("imap4flags"))) {
if (sieveCapabilities().contains(QLatin1String("imap4flags"))) {
return QStringList() << QStringLiteral("imap4flags");
} else {
return QStringList() << QStringLiteral("imapflags");
......@@ -92,7 +92,7 @@ bool SieveActionAbstractFlags::needCheckIfServerHasCapability() const
QString SieveActionAbstractFlags::serverNeedsCapability() const
{
if (sieveCapabilities().contains(QStringLiteral("imap4flags"))) {
if (sieveCapabilities().contains(QLatin1String("imap4flags"))) {
return QStringLiteral("imap4flags");
} else {
return QStringLiteral("imapflags");
......
......@@ -35,8 +35,8 @@ using namespace KSieveUi;
SieveActionFileInto::SieveActionFileInto(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QObject *parent)
: SieveAction(sieveGraphicalModeWidget, QStringLiteral("fileinto"), i18n("File Into"), parent)
{
mHasCopySupport = sieveCapabilities().contains(QStringLiteral("copy"));
mHasMailBoxSupport = sieveCapabilities().contains(QStringLiteral("mailbox"));
mHasCopySupport = sieveCapabilities().contains(QLatin1String("copy"));
mHasMailBoxSupport = sieveCapabilities().contains(QLatin1String("mailbox"));
}
QString SieveActionFileInto::code(QWidget *w) const
......
......@@ -32,8 +32,8 @@ using namespace KSieveUi;
SieveActionKeep::SieveActionKeep(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QObject *parent)
: SieveAction(sieveGraphicalModeWidget, QStringLiteral("keep"), i18n("Keep"), parent)
{
mHasImapFlag4Support = sieveCapabilities().contains(QStringLiteral("imap4flags"));
mHasFlagSupport = sieveCapabilities().contains(QStringLiteral("imapflags")) || mHasImapFlag4Support;
mHasImapFlag4Support = sieveCapabilities().contains(QLatin1String("imap4flags"));
mHasFlagSupport = sieveCapabilities().contains(QLatin1String("imapflags")) || mHasImapFlag4Support;
}
QString SieveActionKeep::code(QWidget *w) const
......
......@@ -35,8 +35,8 @@ using namespace KSieveUi;
SieveActionRedirect::SieveActionRedirect(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QObject *parent)
: SieveAction(sieveGraphicalModeWidget, QStringLiteral("redirect"), i18n("Redirect"), parent)
{
mHasCopySupport = sieveCapabilities().contains(QStringLiteral("copy"));
mHasListSupport = sieveCapabilities().contains(QStringLiteral("extlists"));
mHasCopySupport = sieveCapabilities().contains(QLatin1String("copy"));
mHasListSupport = sieveCapabilities().contains(QLatin1String("extlists"));
}
QWidget *SieveActionRedirect::createParamWidget(QWidget *parent) const
......
......@@ -35,7 +35,7 @@ using namespace KSieveUi;
SieveActionSetVariable::SieveActionSetVariable(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QObject *parent)
: SieveAction(sieveGraphicalModeWidget, QStringLiteral("set"), i18n("Variable"), parent)
{
mHasRegexCapability = sieveCapabilities().contains(QStringLiteral("regex"));
mHasRegexCapability = sieveCapabilities().contains(QLatin1String("regex"));
}
QWidget *SieveActionSetVariable::createParamWidget(QWidget *parent) const
......
......@@ -37,7 +37,7 @@ using namespace KSieveUi;
SieveActionVacation::SieveActionVacation(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QObject *parent)
: SieveAction(sieveGraphicalModeWidget, QStringLiteral("vacation"), i18n("Vacation"), parent)
{
mHasVacationSecondsSupport = sieveCapabilities().contains(QStringLiteral("vacation-seconds"));
mHasVacationSecondsSupport = sieveCapabilities().contains(QLatin1String("vacation-seconds"));
}
QWidget *SieveActionVacation::createParamWidget(QWidget *parent) const
......
......@@ -122,7 +122,7 @@ void SieveActionWidget::initWidget()
int index = 0;
QStringList listCapabilities = mSieveGraphicalModeWidget->sieveCapabilities();
//imapflags was old name of imap4flags but still used.
if (listCapabilities.contains(QStringLiteral("imap4flags"))) {
if (listCapabilities.contains(QLatin1String("imap4flags"))) {
listCapabilities.append(QStringLiteral("imapflags"));
}
for (index = 0, it = list.constBegin(); it != end; ++it, ++index) {
......
......@@ -35,7 +35,7 @@ using namespace KSieveUi;
SieveConditionHasFlag::SieveConditionHasFlag(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QObject *parent)
: SieveCondition(sieveGraphicalModeWidget, QStringLiteral("hasflag"), i18n("Has Flag"), parent)
{
hasVariableSupport = sieveCapabilities().contains(QStringLiteral("variables"));
hasVariableSupport = sieveCapabilities().contains(QLatin1String("variables"));
}
QWidget *SieveConditionHasFlag::createParamWidget(QWidget *parent) const
......@@ -101,7 +101,7 @@ QString SieveConditionHasFlag::code(QWidget *w) const
QStringList SieveConditionHasFlag::needRequires(QWidget *w) const
{
QStringList lst;
if (sieveCapabilities().contains(QStringLiteral("imap4flags"))) {
if (sieveCapabilities().contains(QLatin1String("imap4flags"))) {
lst << QStringLiteral("imap4flags");
} else {
lst << QStringLiteral("imapflags");
......@@ -123,9 +123,9 @@ QString SieveConditionHasFlag::serverNeedsCapability() const
{
return QStringLiteral("variables");
#if 0
if (sieveCapabilities().contains(QStringLiteral("variables"))) {
if (sieveCapabilities().contains(QLatin1String("variables"))) {
}
if (sieveCapabilities().contains(QStringLiteral("imap4flags"))) {
if (sieveCapabilities().contains(QLatin1String("imap4flags"))) {
return QStringLiteral("imap4flags");
} else {
return QStringLiteral("imapflags");
......
......@@ -36,7 +36,7 @@ using namespace KSieveUi;
SieveConditionSpamTest::SieveConditionSpamTest(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QObject *parent)
: SieveCondition(sieveGraphicalModeWidget, QStringLiteral("spamtest"), i18n("Spam Test"), parent)
{
mHasSpamTestPlusSupport = sieveCapabilities().contains(QStringLiteral("spamtestplus"));
mHasSpamTestPlusSupport = sieveCapabilities().contains(QLatin1String("spamtestplus"));
}
QWidget *SieveConditionSpamTest::createParamWidget(QWidget *parent) const
......
......@@ -27,7 +27,7 @@ using namespace KSieveUi;
SelectAddressPartComboBox::SelectAddressPartComboBox(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QWidget *parent)
: QComboBox(parent)
{
mHasSubaddressCapability = sieveGraphicalModeWidget->sieveCapabilities().contains(QStringLiteral("subaddress"));
mHasSubaddressCapability = sieveGraphicalModeWidget->sieveCapabilities().contains(QLatin1String("subaddress"));
initialize();
connect(this, QOverload<int>::of(&SelectAddressPartComboBox::activated), this, &SelectAddressPartComboBox::valueChanged);
}
......
......@@ -47,7 +47,7 @@ SieveScriptPage::SieveScriptPage(SieveEditorGraphicalModeWidget *sieveEditorGrap
mTabWidget = new SieveScriptTabWidget(this);
connect(mTabWidget, &SieveScriptTabWidget::tabCloseRequested, this, &SieveScriptPage::slotCloseTab);
if (mSieveGraphicalModeWidget->sieveCapabilities().contains(QStringLiteral("include"))) {
if (mSieveGraphicalModeWidget->sieveCapabilities().contains(QLatin1String("include"))) {
mIncludeWidget = new SieveIncludeWidget(this);
mIncludeWidget->setListOfIncludeFile(mSieveGraphicalModeWidget->listOfIncludeFile());
connect(mIncludeWidget, &SieveIncludeWidget::valueChanged, this, &SieveScriptPage::valueChanged);
......@@ -58,7 +58,7 @@ SieveScriptPage::SieveScriptPage(SieveEditorGraphicalModeWidget *sieveEditorGrap
mTabWidget->addTab(mGlobalVariableWidget, i18n("Global Variable"));
}
if (mSieveGraphicalModeWidget->sieveCapabilities().contains(QStringLiteral("foreverypart"))) {
if (mSieveGraphicalModeWidget->sieveCapabilities().contains(QLatin1String("foreverypart"))) {
mForEveryPartWidget = new SieveForEveryPartWidget(this);
connect(mForEveryPartWidget, &SieveForEveryPartWidget::valueChanged, this, &SieveScriptPage::valueChanged);
mTabWidget->addTab(mForEveryPartWidget, i18n("ForEveryPart"));
......
......@@ -226,7 +226,7 @@ void SieveScriptDebuggerFrontEndWidget::setScript(const QString &script)
bool SieveScriptDebuggerFrontEndWidget::canAccept() const
{
const QString script = mSieveTextEditWidget->textEdit()->toPlainText();
if (script.contains(QStringLiteral("debug_log")) || script.contains(QStringLiteral("vnd.dovecot.debug"))) {
if (script.contains(QLatin1String("debug_log")) || script.contains(QLatin1String("vnd.dovecot.debug"))) {
mSieveScriptDebuggerWarning->setErrorMessage(i18n("Script still contains debug method. Remove it please."));
return false;
}
......
......@@ -53,7 +53,7 @@ void SieveScriptDebuggerTextEdit::slotAddDebug()
{
QTextCursor cursor(textCursor());
cursor.insertText(QStringLiteral("debug_log \"DEBUG\";\n"));
if (!document()->toPlainText().contains(QStringLiteral("vnd.dovecot.debug"))) {
if (!document()->toPlainText().contains(QLatin1String("vnd.dovecot.debug"))) {
cursor.movePosition(QTextCursor::Start);
cursor.insertText(QStringLiteral("require \"vnd.dovecot.debug\";\n"));
}
......
......@@ -53,7 +53,7 @@ QMimeData *SieveTemplateListWidget::mimeData(const QList<QListWidgetItem *> item
QMimeData *mimeData = new QMimeData();
QListWidgetItem *item = items.first();
QString templateStr = item->data(TemplateListWidget::Text).toString();
if (!mCapabilities.contains(QStringLiteral("imap4flags")) && templateStr.contains(QStringLiteral("imap4flags"))) {
if (!mCapabilities.contains(QLatin1String("imap4flags")) && templateStr.contains(QLatin1String("imap4flags"))) {
templateStr.replace(QStringLiteral("imap4flags"), QStringLiteral("imapflags"));
}
mimeData->setText(templateStr);
......
......@@ -245,8 +245,8 @@ QVector<KSieveUi::SieveImapInstance> KSieveUi::Util::sieveImapInstances()
QVector<KSieveUi::SieveImapInstance> relevantInstances;
for (const KSieveUi::SieveImapInstance &instance : allInstances) {
if (instance.mimeTypes().contains(KMime::Message::mimeType())
&& instance.capabilities().contains(QStringLiteral("Resource"))
&& !instance.capabilities().contains(QStringLiteral("Virtual"))) {
&& instance.capabilities().contains(QLatin1String("Resource"))
&& !instance.capabilities().contains(QLatin1String("Virtual"))) {
if (PimCommon::Util::isImapResource(instance.identifier())) {
relevantInstances << instance;
}
......@@ -267,7 +267,7 @@ bool KSieveUi::Util::allowOutOfOfficeSettings()
bool Util::hasKep14Support(const QStringList &sieveCapabilities, const QStringList &availableScripts, const QString &activeScript)
{
const bool hasIncludeCapability = sieveCapabilities.contains(QStringLiteral("include"));
const bool hasIncludeCapability = sieveCapabilities.contains(QLatin1String("include"));
if (!hasIncludeCapability) {
return false;
}
......
......@@ -97,7 +97,7 @@ void Vacation::slotGetResult(KManageSieve::SieveJob *job, bool success, const QS
mSieveJob = nullptr; // job deletes itself after returning from this slot!
if (!mCheckOnly && mUrl.scheme() == QLatin1String("sieve")
&& !job->sieveCapabilities().contains(QStringLiteral("vacation"))) {
&& !job->sieveCapabilities().contains(QLatin1String("vacation"))) {
KMessageBox::sorry(nullptr, i18n("Your server did not list \"vacation\" in "
"its list of supported Sieve extensions;\n"
"without it, KMail cannot install out-of-"
......@@ -107,7 +107,7 @@ void Vacation::slotGetResult(KManageSieve::SieveJob *job, bool success, const QS
return;
}
const bool supportsDate = job->sieveCapabilities().contains(QStringLiteral("date"));
const bool supportsDate = job->sieveCapabilities().contains(QLatin1String("date"));
if (!mDialog && !mCheckOnly) {
mDialog = new VacationDialog(i18n("Configure \"Out of Office\" Replies"), nullptr);
......
......@@ -58,7 +58,7 @@ void VacationHelperJob::slotGetScriptList(KManageSieve::SieveJob *job, bool succ
mSieveJob = nullptr;
if (success) {
const QStringList caps = job->sieveCapabilities();
Q_EMIT scriptListResult(scriptList, activeScript, caps.contains(QStringLiteral("include")));
Q_EMIT scriptListResult(scriptList, activeScript, caps.contains(QLatin1String("include")));
} else {
Q_EMIT canNotGetScriptList();
}
......
......@@ -116,7 +116,7 @@ void VacationPageWidget::slotGetResult(const QString &serverName, const QStringL
<< scriptName << "(" << active << ")" << endl;
if (mUrl.scheme() == QStringLiteral("sieve")
&& !sieveCapabilities.contains(QStringLiteral("vacation"))) {
&& !sieveCapabilities.contains(QLatin1String("vacation"))) {
mStackWidget->setCurrentIndex(ScriptNotSupported);
return;
}
......@@ -125,7 +125,7 @@ void VacationPageWidget::slotGetResult(const QString &serverName, const QStringL
mUrl.setPath(mUrl.path() + scriptName);
// Whether the server supports the "date" extension
mHasDateSupport = mUrl.scheme() == QStringLiteral("sieve") && sieveCapabilities.contains(QStringLiteral("date"));
mHasDateSupport = mUrl.scheme() == QStringLiteral("sieve") && sieveCapabilities.contains(QLatin1String("date"));
KSieveUi::VacationUtils::Vacation vacation = KSieveUi::VacationUtils::parseScript(script);
......
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