summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-14 12:57:57 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-14 12:57:57 (GMT)
commit0d0aafde899eecc25fe319e6caf478ad7502c549 (patch)
tree5fb2eba5d89ded2ca8cbf7b448c38fc2d13db8ad
parent48692e42d7fd105ec20d22c3ef078f9f491f085f (diff)
Fix clazy warningv16.11.80
-rw-r--r--kioslave/src/sieve/sieve.cpp2
-rw-r--r--kioslave/src/sieve/sieve.h2
-rw-r--r--src/kmanagesieve/sievejob.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp10
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp2
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp2
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp2
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp6
-rw-r--r--src/ksieveui/autocreatescripts/sieveglobalvariablewidget.cpp6
-rw-r--r--src/ksieveui/autocreatescripts/sieveincludewidget.cpp6
-rw-r--r--src/ksieveui/editor/sievelinenumberarea.h1
-rw-r--r--src/ksieveui/vacation/autotests/vacationutilstest.cpp2
-rw-r--r--src/ksieveui/vacation/multiimapvacationdialog.cpp8
-rw-r--r--src/ksieveui/vacation/vacationutils.cpp1
14 files changed, 27 insertions, 24 deletions
diff --git a/kioslave/src/sieve/sieve.cpp b/kioslave/src/sieve/sieve.cpp
index 3b8760b..c728e93 100644
--- a/kioslave/src/sieve/sieve.cpp
+++ b/kioslave/src/sieve/sieve.cpp
@@ -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;
diff --git a/kioslave/src/sieve/sieve.h b/kioslave/src/sieve/sieve.h
index 6ed5d65..c4e9c72 100644
--- a/kioslave/src/sieve/sieve.h
+++ b/kioslave/src/sieve/sieve.h
@@ -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);
diff --git a/src/kmanagesieve/sievejob.cpp b/src/kmanagesieve/sievejob.cpp
index 3906415..37e7b6e 100644
--- a/src/kmanagesieve/sievejob.cpp
+++ b/src/kmanagesieve/sievejob.cpp
@@ -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()) + "+}");
diff --git a/src/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp b/src/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp
index ba9fc24..2cf2b60 100644
--- a/src/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp
@@ -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 {
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp
index bfa63d8..cb58aa0 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp
@@ -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
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp
index 729048e..9b480f1 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp
@@ -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
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp
index b740c8f..ac1b954 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp
@@ -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
diff --git a/src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp b/src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp
index ee24d08..4f90d22 100644
--- a/src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp
@@ -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();
diff --git a/src/ksieveui/autocreatescripts/sieveglobalvariablewidget.cpp b/src/ksieveui/autocreatescripts/sieveglobalvariablewidget.cpp
index fadc23a..d98a093 100644
--- a/src/ksieveui/autocreatescripts/sieveglobalvariablewidget.cpp
+++ b/src/ksieveui/autocreatescripts/sieveglobalvariablewidget.cpp
@@ -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);
}
diff --git a/src/ksieveui/autocreatescripts/sieveincludewidget.cpp b/src/ksieveui/autocreatescripts/sieveincludewidget.cpp
index 110c91f..45f6cd6 100644
--- a/src/ksieveui/autocreatescripts/sieveincludewidget.cpp
+++ b/src/ksieveui/autocreatescripts/sieveincludewidget.cpp
@@ -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);
}
diff --git a/src/ksieveui/editor/sievelinenumberarea.h b/src/ksieveui/editor/sievelinenumberarea.h
index 7622811..f525f2b 100644
--- a/src/ksieveui/editor/sievelinenumberarea.h
+++ b/src/ksieveui/editor/sievelinenumberarea.h
@@ -28,6 +28,7 @@ class SieveTextEdit;
class SieveLineNumberArea : public QWidget
{
+ Q_OBJECT
public:
explicit SieveLineNumberArea(SieveTextEdit *editor);
diff --git a/src/ksieveui/vacation/autotests/vacationutilstest.cpp b/src/ksieveui/vacation/autotests/vacationutilstest.cpp
index 269f15f..c362445 100644
--- a/src/ksieveui/vacation/autotests/vacationutilstest.cpp
+++ b/src/ksieveui/vacation/autotests/vacationutilstest.cpp
@@ -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));
}
diff --git a/src/ksieveui/vacation/multiimapvacationdialog.cpp b/src/ksieveui/vacation/multiimapvacationdialog.cpp
index beca4aa..7abbd3a 100644
--- a/src/ksieveui/vacation/multiimapvacationdialog.cpp
+++ b/src/ksieveui/vacation/multiimapvacationdialog.cpp
@@ -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) {
diff --git a/src/ksieveui/vacation/vacationutils.cpp b/src/ksieveui/vacation/vacationutils.cpp
index 32498b0..5986932 100644
--- a/src/ksieveui/vacation/vacationutils.cpp
+++ b/src/ksieveui/vacation/vacationutils.cpp
@@ -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());