Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 5714eff9 authored by Laurent Montel's avatar Laurent Montel 😁

Fix warning found by clazy

parent f74a81ae
......@@ -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);
......
......@@ -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;
}
......
......@@ -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"))) {
......
......@@ -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);
......
......@@ -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;
......
......@@ -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());
}
......
......@@ -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);
......
......@@ -25,7 +25,7 @@
namespace WebEngineViewer {
class LocalDataBaseFilePrivate;
class Addition;
struct Addition;
class WEBENGINEVIEWER_TESTS_EXPORT LocalDataBaseFile
{
public:
......
......@@ -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();
......
......@@ -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);
}
......
......@@ -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;"
......
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