summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-10-12 08:03:38 +0200
committerMontel Laurent <[email protected]>2017-10-12 08:03:38 +0200
commit5714eff9b6712a824ec31c1aab483ba4c6c5c7df (patch)
tree32026f483adcdb1293d0cf7090c21f571e00e49d
parentf74a81aef253366952c5851587f39fe4108fcb1a (diff)
Fix warning found by clazy
-rw-r--r--messagelist/src/core/widgetbase.cpp9
-rw-r--r--messagelist/src/core/widgets/searchcollectionindexingwarning.cpp2
-rw-r--r--messageviewer/src/messagepartthemes/default/autotests/rendertest.cpp2
-rw-r--r--messageviewer/src/widgets/attachmentdialog.cpp2
-rw-r--r--templateparser/autotests/templateparserjobtest.cpp2
-rw-r--r--webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp1
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasefile.cpp1
-rw-r--r--webengineviewer/src/checkphishingurl/localdatabasefile.h2
-rw-r--r--webengineviewer/src/checkphishingurl/searchfullhashjob.cpp6
-rw-r--r--webengineviewer/src/checkphishingurl/tests/webengineviewwithsafebrowsingsupport.cpp2
-rw-r--r--webengineviewer/src/webenginescript.cpp20
11 files changed, 25 insertions, 24 deletions
diff --git a/messagelist/src/core/widgetbase.cpp b/messagelist/src/core/widgetbase.cpp
index 6a933a8..4cbdcf9 100644
--- a/messagelist/src/core/widgetbase.cpp
+++ b/messagelist/src/core/widgetbase.cpp
@@ -579,12 +579,11 @@ void Widget::sortOrderMenuAboutToShow(QMenu *menu)
QActionGroup *grp;
QAction *act;
QList< QPair< QString, int > > options;
- QList< QPair< QString, int > >::ConstIterator it;
grp = new QActionGroup(menu);
options = SortOrder::enumerateMessageSortingOptions(d->mAggregation->threading());
- for (const auto opt : qAsConst(options)) {
+ for (const auto &opt : qAsConst(options)) {
act = menu->addAction(opt.first);
act->setCheckable(true);
grp->addAction(act);
@@ -601,7 +600,7 @@ void Widget::sortOrderMenuAboutToShow(QMenu *menu)
menu->addSection(i18n("Message Sort Direction"));
grp = new QActionGroup(menu);
- for (const auto opt : qAsConst(options)) {
+ for (const auto &opt : qAsConst(options)) {
act = menu->addAction(opt.first);
act->setCheckable(true);
grp->addAction(act);
@@ -619,7 +618,7 @@ void Widget::sortOrderMenuAboutToShow(QMenu *menu)
menu->addSection(i18n("Group Sort Order"));
grp = new QActionGroup(menu);
- for (const auto opt : qAsConst(options)) {
+ for (const auto &opt : qAsConst(options)) {
act = menu->addAction(opt.first);
act->setCheckable(true);
grp->addAction(act);
@@ -638,7 +637,7 @@ void Widget::sortOrderMenuAboutToShow(QMenu *menu)
menu->addSection(i18n("Group Sort Direction"));
grp = new QActionGroup(menu);
- for (const auto opt : qAsConst(options)) {
+ for (const auto &opt : qAsConst(options)) {
act = menu->addAction(opt.first);
act->setCheckable(true);
grp->addAction(act);
diff --git a/messagelist/src/core/widgets/searchcollectionindexingwarning.cpp b/messagelist/src/core/widgets/searchcollectionindexingwarning.cpp
index e4a28a3..d9f2e08 100644
--- a/messagelist/src/core/widgets/searchcollectionindexingwarning.cpp
+++ b/messagelist/src/core/widgets/searchcollectionindexingwarning.cpp
@@ -126,7 +126,7 @@ void SearchCollectionIndexingWarning::queryCollectionFetchFinished(KJob *job)
void SearchCollectionIndexingWarning::queryIndexerStatus()
{
bool allFullyIndexed = true;
- for (const Akonadi::Collection &col : mCollections) {
+ for (const Akonadi::Collection &col : qAsConst(mCollections)) {
if (col.hasAttribute<Akonadi::EntityHiddenAttribute>()) {
continue;
}
diff --git a/messageviewer/src/messagepartthemes/default/autotests/rendertest.cpp b/messageviewer/src/messagepartthemes/default/autotests/rendertest.cpp
index d6d8ce0..90d5182 100644
--- a/messageviewer/src/messagepartthemes/default/autotests/rendertest.cpp
+++ b/messageviewer/src/messagepartthemes/default/autotests/rendertest.cpp
@@ -81,7 +81,7 @@ void RenderTest::testRenderSmartAsync_data()
QDir dir(QStringLiteral(MAIL_DATA_DIR));
foreach (const QString &file,
- dir.entryList(QStringList(QLatin1String("*.mbox")),
+ dir.entryList(QStringList(QStringLiteral("*.mbox")),
QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
if (!QFile::exists(dir.path() + QLatin1Char('/') + file
+ QStringLiteral(".inProgress.html"))) {
diff --git a/messageviewer/src/widgets/attachmentdialog.cpp b/messageviewer/src/widgets/attachmentdialog.cpp
index c21499f..b028029 100644
--- a/messageviewer/src/widgets/attachmentdialog.cpp
+++ b/messageviewer/src/widgets/attachmentdialog.cpp
@@ -61,7 +61,7 @@ AttachmentDialog::AttachmentDialog(QWidget *parent, const QString &filenameText,
KGuiItem::assign(user3Button, KStandardGuiItem::saveAs());
user1Button->setText(i18n("&Open With..."));
- user1Button->setIcon(QIcon::fromTheme(QLatin1String("document-open")));
+ user1Button->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
user3Button->setDefault(true);
connect(user3Button, &QPushButton::clicked, this, &AttachmentDialog::saveClicked);
diff --git a/templateparser/autotests/templateparserjobtest.cpp b/templateparser/autotests/templateparserjobtest.cpp
index 943f137..64d024b 100644
--- a/templateparser/autotests/templateparserjobtest.cpp
+++ b/templateparser/autotests/templateparserjobtest.cpp
@@ -105,7 +105,7 @@ void TemplateParserJobTest::test_replyPlain_data()
QTest::addColumn<QString>("referenceFileName");
QDir dir(QStringLiteral(MAIL_DATA_DIR));
- foreach (const QString &file, dir.entryList(QStringList(QLatin1String("*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
+ foreach (const QString &file, dir.entryList(QStringList(QStringLiteral("*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
const QString expectedFile = dir.path() + QLatin1Char('/') + file + QStringLiteral(".plain.reply");
if (!QFile::exists(expectedFile)) {
continue;
diff --git a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
index f147128..0db49f0 100644
--- a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
+++ b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
@@ -299,6 +299,7 @@ QVector<Removal> CreatePhishingUrlDataBaseJobPrivate::parseRemovals(const QVaria
if (rawIndicesIt.key() == QStringLiteral("indices")) {
const QVariantList lst = rawIndicesIt.value().toList();
QList<quint32> indexList;
+ indexList.reserve(lst.count());
for (const QVariant &var : lst) {
indexList.append(var.toUInt());
}
diff --git a/webengineviewer/src/checkphishingurl/localdatabasefile.cpp b/webengineviewer/src/checkphishingurl/localdatabasefile.cpp
index 56af7fe..671f741 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasefile.cpp
+++ b/webengineviewer/src/checkphishingurl/localdatabasefile.cpp
@@ -200,6 +200,7 @@ QVector<WebEngineViewer::Addition> LocalDataBaseFile::extractAllInfo() const
{
QVector<WebEngineViewer::Addition> lst;
quint64 numberOfElement = getUint64(4);
+ lst.reserve(numberOfElement);
int index = 12; // quint16 major + quint16 minor + quint64 number of element
for (quint64 i = 0; i < numberOfElement; ++i) {
const quint64 value = getUint64(index);
diff --git a/webengineviewer/src/checkphishingurl/localdatabasefile.h b/webengineviewer/src/checkphishingurl/localdatabasefile.h
index c9a176b..f307578 100644
--- a/webengineviewer/src/checkphishingurl/localdatabasefile.h
+++ b/webengineviewer/src/checkphishingurl/localdatabasefile.h
@@ -25,7 +25,7 @@
namespace WebEngineViewer {
class LocalDataBaseFilePrivate;
-class Addition;
+struct Addition;
class WEBENGINEVIEWER_TESTS_EXPORT LocalDataBaseFile
{
public:
diff --git a/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp b/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp
index 74c8724..bbd0db6 100644
--- a/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp
+++ b/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp
@@ -111,14 +111,14 @@ void SearchFullHashJob::parse(const QByteArray &replyStr)
} else {
const QVariantList info = answer.value(QStringLiteral("matches")).toList();
//TODO
- const QString minimumWaitDuration = answer.value(QStringLiteral("minimumWaitDuration")).toString();
- const QString negativeCacheDuration = answer.value(QStringLiteral("negativeCacheDuration")).toString();
+ //const QString minimumWaitDuration = answer.value(QStringLiteral("minimumWaitDuration")).toString();
+ //const QString negativeCacheDuration = answer.value(QStringLiteral("negativeCacheDuration")).toString();
//Implement multi match ?
if (info.count() == 1) {
const QVariantMap map = info.at(0).toMap();
const QString threatTypeStr = map[QStringLiteral("threatType")].toString();
- const QString cacheDuration = map[QStringLiteral("cacheDuration")].toString();
+ //const QString cacheDuration = map[QStringLiteral("cacheDuration")].toString();
if (threatTypeStr == QStringLiteral("MALWARE")) {
const QVariantMap urlMap = map[QStringLiteral("threat")].toMap();
diff --git a/webengineviewer/src/checkphishingurl/tests/webengineviewwithsafebrowsingsupport.cpp b/webengineviewer/src/checkphishingurl/tests/webengineviewwithsafebrowsingsupport.cpp
index 6767edc..5134cbf 100644
--- a/webengineviewer/src/checkphishingurl/tests/webengineviewwithsafebrowsingsupport.cpp
+++ b/webengineviewer/src/checkphishingurl/tests/webengineviewwithsafebrowsingsupport.cpp
@@ -82,7 +82,7 @@ void WebEngineViewWithSafeBrowsingSupport::slotCheckedUrlFinished(const QUrl &ur
}
qDebug() << " checked url: " << url << " result : " << statusStr;
- mDebug->setPlainText(QStringLiteral("Url: %1 , Status %2").arg(url.toDisplayString()).arg(statusStr));
+ mDebug->setPlainText(QStringLiteral("Url: %1 , Status %2").arg(url.toDisplayString(), statusStr));
if (status != WebEngineViewer::CheckPhishingUrlUtil::MalWare) {
pageView->load(url);
}
diff --git a/webengineviewer/src/webenginescript.cpp b/webengineviewer/src/webenginescript.cpp
index 4b8e823..8a3afd6 100644
--- a/webengineviewer/src/webenginescript.cpp
+++ b/webengineviewer/src/webenginescript.cpp
@@ -99,13 +99,13 @@ QString WebEngineScript::findAllAnchorsAndForms()
QString WebEngineScript::setElementByIdVisible(const QString &elementStr, bool visibility)
{
if (visibility) {
- const QString source = QString::fromLatin1("var element = document.getElementById('%1'); "
+ const QString source = QStringLiteral("var element = document.getElementById('%1'); "
"if (element) { "
" element.style.removeProperty( 'display' );"
"}").arg(elementStr);
return source;
} else {
- const QString source = QString::fromLatin1("var element = document.getElementById('%1'); "
+ const QString source = QStringLiteral("var element = document.getElementById('%1'); "
"if (element) { "
" element.style.display = \"none\";"
"}").arg(elementStr);
@@ -115,7 +115,7 @@ QString WebEngineScript::setElementByIdVisible(const QString &elementStr, bool v
QString WebEngineScript::searchElementPosition(const QString &elementStr)
{
- const QString source = QString::fromLatin1("var element = document.getElementById('%1'); "
+ const QString source = QStringLiteral("var element = document.getElementById('%1'); "
"if (element) { "
" var geometry = element.getBoundingClientRect(); "
" [(geometry.left + window.scrollX), (geometry.top + window.scrollY)]; "
@@ -125,7 +125,7 @@ QString WebEngineScript::searchElementPosition(const QString &elementStr)
QString WebEngineScript::scrollPercentage(int percent)
{
- const QString source = QString::fromLatin1("var current = document.body.scrollTop;"
+ const QString source = QStringLiteral("var current = document.body.scrollTop;"
"var docElement = document.documentElement;"
"var height = docElement.clientHeight;"
"var newPosition = current + height * %1 /100;"
@@ -141,19 +141,19 @@ QString WebEngineScript::scrollUp(int pixel)
QString WebEngineScript::scrollDown(int pixel)
{
- const QString source = QString::fromLatin1("window.scrollBy(0, %1);").arg(pixel);
+ const QString source = QStringLiteral("window.scrollBy(0, %1);").arg(pixel);
return source;
}
QString WebEngineScript::scrollToPosition(const QPoint &pos)
{
- const QString source = QString::fromLatin1("window.scrollTo(%1, %2); [window.scrollX, window.scrollY];").arg(pos.x(), pos.y());
+ const QString source = QStringLiteral("window.scrollTo(%1, %2); [window.scrollX, window.scrollY];").arg(pos.x(), pos.y());
return source;
}
QString WebEngineScript::removeStyleToElement(const QString &elementStr)
{
- const QString source = QString::fromLatin1("var element = document.getElementById('%1'); "
+ const QString source = QStringLiteral("var element = document.getElementById('%1'); "
"if (element) { "
" element.removeAttribute(\"style\");"
"}").arg(elementStr);
@@ -162,7 +162,7 @@ QString WebEngineScript::removeStyleToElement(const QString &elementStr)
QString WebEngineScript::setStyleToElement(const QString &elementStr, const QString &style)
{
- const QString source = QString::fromLatin1("var element = document.getElementById('%1'); "
+ const QString source = QStringLiteral("var element = document.getElementById('%1'); "
"if (element) { "
" element.style = '%2';"
"}").arg(elementStr, style);
@@ -171,13 +171,13 @@ QString WebEngineScript::setStyleToElement(const QString &elementStr, const QStr
QString WebEngineScript::scrollToRelativePosition(qreal pos)
{
- const QString source = QString::fromLatin1("window.scrollTo(window.scrollX, %1); [window.scrollX, window.scrollY];").arg(pos);
+ const QString source = QStringLiteral("window.scrollTo(window.scrollX, %1); [window.scrollX, window.scrollY];").arg(pos);
return source;
}
QString WebEngineScript::isScrolledToBottom()
{
- return QString::fromLatin1("(function() { "
+ return QStringLiteral("(function() { "
"var docElement = document.documentElement;"
"var viewportHeight = docElement.clientHeight;"
"var isAtBottom = document.body.scrollTop + viewportHeight >= document.body.scrollHeight;"