Commit 8bfefad0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warning

parent abee3f30
Pipeline #29615 failed with stage
in 60 minutes and 1 second
......@@ -76,7 +76,7 @@ void CheckGravatarPluginInterface::exec()
KMessageBox::sorry(parentWidget(), i18n("You have not selected any contacts."));
} else {
if (mListItems.count() == 1) {
Akonadi::Item item = mListItems.first();
Akonadi::Item item = mListItems.constFirst();
if (item.hasPayload<KContacts::Addressee>()) {
KContacts::Addressee address = item.payload<KContacts::Addressee>();
const QString email = address.preferredEmail();
......
......@@ -48,8 +48,8 @@ void MergeContactLoseInformationWarningTest::shouldEmitSignals()
QVERIFY(w.isVisible());
QAction *customize = w.findChild<QAction *>(QStringLiteral("customize"));
QAction *automatic = w.findChild<QAction *>(QStringLiteral("automatic"));
QSignalSpy spy1(&w, SIGNAL(continueMerging()));
QSignalSpy spy2(&w, SIGNAL(customizeMergingContacts()));
QSignalSpy spy1(&w, &KABMergeContacts::MergeContactLoseInformationWarning::continueMerging);
QSignalSpy spy2(&w, &KABMergeContacts::MergeContactLoseInformationWarning::customizeMergingContacts);
customize->trigger();
QCOMPARE(spy1.count(), 0);
QCOMPARE(spy2.count(), 1);
......
......@@ -36,7 +36,7 @@ void SearchPotentialDuplicateContactJobTest::shouldReturnEmptyListWhenNoItem()
{
Akonadi::Item::List lst;
SearchPotentialDuplicateContactJob job(lst);
QSignalSpy spy(&job, SIGNAL(finished(QVector<Akonadi::Item::List>)));
QSignalSpy spy(&job, &SearchPotentialDuplicateContactJob::finished);
job.start();
QCOMPARE(spy.count(), 1);
QVector<Akonadi::Item::List> lstResult = spy.at(0).at(0).value< QVector<Akonadi::Item::List> >();
......@@ -48,7 +48,7 @@ void SearchPotentialDuplicateContactJobTest::shouldReturnEmptyListWhenOneItem()
Akonadi::Item::List lst;
lst << Akonadi::Item(42);
SearchPotentialDuplicateContactJob job(lst);
QSignalSpy spy(&job, SIGNAL(finished(QVector<Akonadi::Item::List>)));
QSignalSpy spy(&job, &SearchPotentialDuplicateContactJob::finished);
job.start();
QCOMPARE(spy.count(), 1);
QVector<Akonadi::Item::List> lstResult = spy.at(0).at(0).value< QVector<Akonadi::Item::List> >();
......@@ -67,7 +67,7 @@ void SearchPotentialDuplicateContactJobTest::shouldReturnListWhenTwoItemsAreDupl
lst << itemA << itemA;
SearchPotentialDuplicateContactJob job(lst);
QSignalSpy spy(&job, SIGNAL(finished(QVector<Akonadi::Item::List>)));
QSignalSpy spy(&job, &SearchPotentialDuplicateContactJob::finished);
job.start();
QCOMPARE(spy.count(), 1);
QVector<Akonadi::Item::List> lstResult = spy.at(0).at(0).value< QVector<Akonadi::Item::List> >();
......@@ -86,7 +86,7 @@ void SearchPotentialDuplicateContactJobTest::shouldReturnListWhenThreeItemsAreDu
lst << itemA << itemA << itemA;
SearchPotentialDuplicateContactJob job(lst);
QSignalSpy spy(&job, SIGNAL(finished(QVector<Akonadi::Item::List>)));
QSignalSpy spy(&job, &SearchPotentialDuplicateContactJob::finished);
job.start();
QCOMPARE(spy.count(), 1);
QVector<Akonadi::Item::List> lstResult = spy.at(0).at(0).value< QVector<Akonadi::Item::List> >();
......@@ -112,7 +112,7 @@ void SearchPotentialDuplicateContactJobTest::shouldReturnTwoList()
lst << item << item << item;
SearchPotentialDuplicateContactJob job(lst);
QSignalSpy spy(&job, SIGNAL(finished(QVector<Akonadi::Item::List>)));
QSignalSpy spy(&job, &SearchPotentialDuplicateContactJob::finished);
job.start();
QCOMPARE(spy.count(), 1);
QVector<Akonadi::Item::List> lstResult = spy.at(0).at(0).value< QVector<Akonadi::Item::List> >();
......@@ -179,7 +179,7 @@ void SearchPotentialDuplicateContactJobTest::shouldReturnList()
QFETCH(int, numberOfList);
SearchPotentialDuplicateContactJob job(listItem);
QSignalSpy spy(&job, SIGNAL(finished(QVector<Akonadi::Item::List>)));
QSignalSpy spy(&job, &SearchPotentialDuplicateContactJob::finished);
job.start();
QCOMPARE(spy.count(), 1);
QVector<Akonadi::Item::List> lstResult = spy.at(0).at(0).value< QVector<Akonadi::Item::List> >();
......
......@@ -142,7 +142,8 @@ QVector<ItineraryMemento::TripData> ItineraryMemento::data()
// add other traveler we already know about from previous data in the calendar
// but that aren't in the currently extracted data set
if (data.event) {
for (const auto &prev : CalendarHandler::reservationsForEvent(data.event)) {
const auto reservationsForEvent = CalendarHandler::reservationsForEvent(data.event);
for (const auto &prev : reservationsForEvent) {
const auto notFound = std::find_if(data.reservations.constBegin(), data.reservations.constEnd(), [prev](const QVariant &v) {
return MergeUtil::isSame(v, prev);
}) == data.reservations.constEnd();
......
......@@ -167,7 +167,6 @@ bool ItineraryRenderer::render(const MimeTreeParser::MessagePartPtr &msgPart, Me
const auto dir = nodeHelper->createTempDir(QStringLiteral("semantic"));
auto c = MessageViewer::MessagePartRendererManager::self()->createContext();
const auto pal = qGuiApp->palette();
QVariantMap style;
style.insert(QStringLiteral("expandIcon"), QString(QStringLiteral("file://") + MessageViewer::IconNameCache::instance()->iconPathFromLocal(QStringLiteral("quoteexpand.png"))));
style.insert(QStringLiteral("collapseIcon"), QString(QStringLiteral("file://") + MessageViewer::IconNameCache::instance()->iconPathFromLocal(QStringLiteral("quotecollapse.png"))));
......
......@@ -224,7 +224,8 @@ void ItineraryUrlHandler::addToCalendar(ItineraryMemento *memento) const
using namespace KCalendarCore;
const auto calendar = CalendarSupport::calendarSingleton(true);
for (const auto &d : memento->data()) {
const auto datas = memento->data();
for (const auto &d : datas) {
auto event = d.event;
if (!event) {
event.reset(new KCalendarCore::Event);
......
......@@ -168,7 +168,8 @@ void GrantleeHeaderStylePluginTest::testThemeRender()
QVERIFY(interface->mThemeManager->themes().contains(themeName));
for (const auto &theme : interface->mThemeManager->themes()) {
const auto themes = interface->mThemeManager->themes();
for (const auto &theme : themes) {
if (theme.dirName() != themeName) {
continue;
}
......
......@@ -181,8 +181,7 @@ QString FancyHeaderStyle::format(KMime::Message *message) const
if (strategy->showHeader(QStringLiteral("date"))) {
headerStr.append(QStringLiteral("<tr><th>%1</th>\n"
"<td dir=\"%2\">%3</td></tr>\n")
.arg(i18n("Date: "))
.arg(mHeaderStyleUtil.directionOf(HeaderStyleUtil::dateStr(message->date()->dateTime())), mHeaderStyleUtil.strToHtml(HeaderStyleUtil::dateString(message, /* short = */ MessageViewer::HeaderStyleUtil::CustomDate))));
.arg(i18n("Date: "), mHeaderStyleUtil.directionOf(HeaderStyleUtil::dateStr(message->date()->dateTime())), mHeaderStyleUtil.strToHtml(HeaderStyleUtil::dateString(message, /* short = */ MessageViewer::HeaderStyleUtil::CustomDate))));
}
if (strategy->showHeader(QStringLiteral("x-bugzilla-url"))) {
......
......@@ -192,9 +192,7 @@ QString FancyHeaderStylePlugin::extraCommonCss(const QString &headerFont) const
"div.fancy.header table a:hover {\n"
" background-color: transparent ! important;\n"
"}\n\n")
.arg(pal.color(QPalette::Window).name())
.arg(pal.color(QPalette::WindowText).name())
.arg(headerFont);
.arg(pal.color(QPalette::Window).name(),pal.color(QPalette::WindowText).name(), headerFont);
return val;
}
......
......@@ -54,7 +54,7 @@ void ViewerPluginExternalScriptsLoadJobTest::shouldLoadDataInfo()
QCOMPARE(job.externalScriptsDirectories(), dirs);
job.start();
QCOMPARE(job.scriptInfos().count(), 1);
ViewerPluginExternalScriptInfo info = job.scriptInfos().first();
const ViewerPluginExternalScriptInfo info = job.scriptInfos().constFirst();
QCOMPARE(info.commandLine(), QStringLiteral("foo-bla"));
QCOMPARE(info.name(), QStringLiteral("foo"));
QCOMPARE(info.description(), QStringLiteral("description"));
......
......@@ -43,7 +43,7 @@ void AdBlockBlockableItemsJobTest::shouldHaveDefaultValue()
void AdBlockBlockableItemsJobTest::shouldReturnEmptyListWhenWebEngineIsNotSet()
{
AdBlock::AdBlockBlockableItemsJob job;
QSignalSpy blockableItemsSpy(&job, SIGNAL(searchItemsDone(QVector<AdBlock::AdBlockResult>)));
QSignalSpy blockableItemsSpy(&job, &AdBlock::AdBlockBlockableItemsJob::searchItemsDone);
job.start();
QCOMPARE(blockableItemsSpy.count(), 1);
const QVector<AdBlock::AdBlockResult> resultLst = blockableItemsSpy.at(0).at(0).value<QVector<AdBlock::AdBlockResult> >();
......
......@@ -23,7 +23,7 @@
#include <QDialog>
#include "adblocklib_export.h"
namespace AdBlock {
class AdBlockResult;
struct AdBlockResult;
class AdBlockBlockableItemsWidget;
class ADBLOCKLIB_EXPORT AdBlockBlockableItemsDialog : public QDialog
{
......
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