Commit 0d0aafde authored by Laurent Montel's avatar Laurent Montel 😁

Fix clazy warning

parent 48692e42
......@@ -132,7 +132,7 @@ const QByteArray &kio_sieveResponse::getExtra() const
}
/* ---------------------------------------------------------------------------------- */
void kio_sieveResponse::setQuantity(const uint &newQty)
void kio_sieveResponse::setQuantity(uint newQty)
{
rType = QUANTITY;
quantity = newQty;
......
......@@ -45,7 +45,7 @@ public:
const QByteArray &getVal() const;
const QByteArray &getExtra() const;
void setQuantity(const uint &quantity);
void setQuantity(uint quantity);
void setAction(const QByteArray &newAction);
void setKey(const QByteArray &newKey);
void setVal(const QByteArray &newVal);
......
......@@ -102,7 +102,6 @@ void SieveJob::Private::run(Session *session)
break;
}
case Check: {
const QString filename = mUrl.fileName(/*QUrl::ObeyTrailingSlash*/);
QByteArray encodedData;
append_lf2crlf(encodedData, mScript.toUtf8());
session->sendData("RENAMESCRIPT {" + QByteArray::number(encodedData.size()) + "+}");
......
......@@ -353,10 +353,10 @@ void SieveActionWidgetLister::loadScript(const QDomElement &element, bool onlyAc
if (tagName == QLatin1String("action")) {
if (element.hasAttribute(QStringLiteral("name"))) {
const QString actionName = element.attribute(QStringLiteral("name"));
SieveActionWidget *w = qobject_cast<SieveActionWidget *>(widgets().last());
SieveActionWidget *w = qobject_cast<SieveActionWidget *>(widgets().constLast());
if (w->isConfigurated()) {
addWidgetAfterThisWidget(widgets().last());
w = qobject_cast<SieveActionWidget *>(widgets().last());
addWidgetAfterThisWidget(widgets().constLast());
w = qobject_cast<SieveActionWidget *>(widgets().constLast());
}
w->setAction(actionName, element, comment, error);
//comment.clear();
......@@ -384,9 +384,9 @@ void SieveActionWidgetLister::loadScript(const QDomElement &element, bool onlyAc
if (firstAction) {
firstAction = false;
} else {
addWidgetAfterThisWidget(widgets().last());
addWidgetAfterThisWidget(widgets().constLast());
}
SieveActionWidget *w = qobject_cast<SieveActionWidget *>(widgets().last());
SieveActionWidget *w = qobject_cast<SieveActionWidget *>(widgets().constLast());
w->setAction(actionName, e, comment, error);
comment.clear();
} else {
......
......@@ -69,7 +69,7 @@ QString SieveConditionCurrentDate::code(QWidget *w) const
const SelectDateWidget *dateWidget = w->findChild<SelectDateWidget *>(QStringLiteral("datewidget"));
const QString dateWidgetStr = dateWidget->code();
return AutoCreateScriptUtil::negativeString(isNegative) + QStringLiteral("currentdate %1 %2").arg(matchTypeStr).arg(dateWidgetStr);
return AutoCreateScriptUtil::negativeString(isNegative) + QStringLiteral("currentdate %1 %2").arg(matchTypeStr, dateWidgetStr);
}
bool SieveConditionCurrentDate::needCheckIfServerHasCapability() const
......
......@@ -71,7 +71,7 @@ QString SieveConditionMetaDataExists::code(QWidget *w) const
const QLineEdit *value = w->findChild<QLineEdit *>(QStringLiteral("value"));
const QString valueStr = value->text();
return QStringLiteral("metadataexists \"%1\" \"%2\"").arg(mailboxStr).arg(valueStr);
return QStringLiteral("metadataexists \"%1\" \"%2\"").arg(mailboxStr, valueStr);
}
QStringList SieveConditionMetaDataExists::needRequires(QWidget *) const
......
......@@ -66,7 +66,7 @@ QString SieveConditionSize::code(QWidget *w) const
const QComboBox *combo = w->findChild<QComboBox *>(QStringLiteral("combosize"));
const QString comparaison = combo->itemData(combo->currentIndex()).toString();
const SelectSizeWidget *sizeWidget = w->findChild<SelectSizeWidget *>(QStringLiteral("sizewidget"));
return QStringLiteral("size %1 %2").arg(comparaison).arg(sizeWidget->code());
return QStringLiteral("size %1 %2").arg(comparaison, sizeWidget->code());
}
QString SieveConditionSize::help() const
......
......@@ -313,7 +313,7 @@ void SieveConditionWidgetLister::loadTest(const QDomElement &element, bool notCo
}
if (testElement.hasAttribute(QStringLiteral("name"))) {
const QString conditionName = testElement.attribute(QStringLiteral("name"));
SieveConditionWidget *w = qobject_cast<SieveConditionWidget *>(widgets().last());
SieveConditionWidget *w = qobject_cast<SieveConditionWidget *>(widgets().constLast());
w->setCondition(conditionName, testElement, notCondition, error);
}
}
......@@ -348,9 +348,9 @@ void SieveConditionWidgetLister::loadScript(const QDomElement &e, bool uniqTest,
if (firstCondition) {
firstCondition = false;
} else {
addWidgetAfterThisWidget(widgets().last());
addWidgetAfterThisWidget(widgets().constLast());
}
SieveConditionWidget *w = qobject_cast<SieveConditionWidget *>(widgets().last());
SieveConditionWidget *w = qobject_cast<SieveConditionWidget *>(widgets().constLast());
if (conditionName == QLatin1String("not")) {
notCondition = true;
QDomNode notNode = testElement.firstChild();
......
......@@ -285,10 +285,10 @@ QWidget *SieveGlobalVariableLister::createWidget(QWidget *parent)
void SieveGlobalVariableLister::loadScript(const QDomElement &element, QString &error)
{
SieveGlobalVariableActionWidget *w = static_cast<SieveGlobalVariableActionWidget *>(widgets().last());
SieveGlobalVariableActionWidget *w = static_cast<SieveGlobalVariableActionWidget *>(widgets().constLast());
if (w->isInitialized()) {
addWidgetAfterThisWidget(widgets().last());
w = static_cast<SieveGlobalVariableActionWidget *>(widgets().last());
addWidgetAfterThisWidget(widgets().constLast());
w = static_cast<SieveGlobalVariableActionWidget *>(widgets().constLast());
}
w->loadScript(element, error);
}
......
......@@ -323,10 +323,10 @@ void SieveIncludeWidgetLister::loadScript(const QDomElement &element, QString &e
error += QLatin1Char('\n') + i18n("We can not add more includes elements.") + QLatin1Char('\n');
return;
}
SieveIncludeActionWidget *w = static_cast<SieveIncludeActionWidget *>(widgets().last());
SieveIncludeActionWidget *w = static_cast<SieveIncludeActionWidget *>(widgets().constLast());
if (w->isInitialized()) {
addWidgetAfterThisWidget(widgets().last());
w = static_cast<SieveIncludeActionWidget *>(widgets().last());
addWidgetAfterThisWidget(widgets().constLast());
w = static_cast<SieveIncludeActionWidget *>(widgets().constLast());
}
w->loadScript(element, error);
}
......
......@@ -28,6 +28,7 @@ class SieveTextEdit;
class SieveLineNumberArea : public QWidget
{
Q_OBJECT
public:
explicit SieveLineNumberArea(SieveTextEdit *editor);
......
......@@ -305,11 +305,13 @@ void VacationUtilsTest::testUpdateVacationBlock()
QStringList linesA = scriptA.split(QLatin1Char('\n'));
QStringList header;
header.reserve(5);
for (int i = 0; i < 5; ++i) {
header.append(linesA.at(i));
}
QStringList vacation;
vacation.reserve(linesA.count()-5);
for (int i = 5; i < linesA.count(); ++i) {
vacation.append(linesA.at(i));
}
......
......@@ -121,9 +121,11 @@ void MultiImapVacationDialog::init()
QDialogButtonBox *buttonBox = Q_NULLPTR;
const QMap <QString, QUrl> list = d->mVacationManager->serverList();
foreach (const QString &serverName, list.keys()) {
const QUrl url = list.value(serverName);
createPage(serverName, url);
QMapIterator<QString, QUrl> i(list);
while (i.hasNext()) {
i.next();
const QUrl url = i.value();
createPage(i.key(), url);
foundOneImap = true;
}
if (foundOneImap) {
......
......@@ -419,7 +419,6 @@ QString KSieveUi::VacationUtils::updateVacationBlock(const QString &oldScript, c
QStringList lines = oldScript.split(QLatin1Char('\n'));
QString script;
if (parserOld.parse() && vdxOld.commandFound()) {
startOld = vdxOld.lineStart();
const int endOld(vdxOld.lineEnd());
......
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