Commit f0380ed4 authored by Laurent Montel's avatar Laurent Montel 😁

Fix clazy warning

parent a90d2fe5
Pipeline #29614 failed with stage
in 48 minutes and 40 seconds
...@@ -146,7 +146,7 @@ void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job) ...@@ -146,7 +146,7 @@ void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job)
if (job->error()) { if (job->error()) {
if (retrievalJobCount == 0 && !mRequestsTracker[email].retrievalJobSuccessful) { if (retrievalJobCount == 0 && !mRequestsTracker[email].retrievalJobSuccessful) {
Q_EMIT (freeBusyRetrieved(email, QString(), false, job->errorString())); Q_EMIT freeBusyRetrieved(email, QString(), false, job->errorString());
} }
return; return;
} }
...@@ -196,7 +196,7 @@ void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job) ...@@ -196,7 +196,7 @@ void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job)
QDomElement responseElement = firstChildElementNS(scheduleResponse, QStringLiteral("urn:ietf:params:xml:ns:caldav"), QStringLiteral("response")); QDomElement responseElement = firstChildElementNS(scheduleResponse, QStringLiteral("urn:ietf:params:xml:ns:caldav"), QStringLiteral("response"));
if (responseElement.isNull()) { if (responseElement.isNull()) {
if (retrievalJobCount == 0 && !mRequestsTracker[email].retrievalJobSuccessful) { if (retrievalJobCount == 0 && !mRequestsTracker[email].retrievalJobSuccessful) {
Q_EMIT (freeBusyRetrieved(email, QString(), false, i18n("Invalid response from the server"))); Q_EMIT freeBusyRetrieved(email, QString(), false, i18n("Invalid response from the server"));
} }
return; return;
} }
...@@ -207,7 +207,7 @@ void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job) ...@@ -207,7 +207,7 @@ void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job)
QDomElement calendarDataElement = firstChildElementNS(responseElement, QStringLiteral("urn:ietf:params:xml:ns:caldav"), QStringLiteral("calendar-data")); QDomElement calendarDataElement = firstChildElementNS(responseElement, QStringLiteral("urn:ietf:params:xml:ns:caldav"), QStringLiteral("calendar-data"));
if (calendarDataElement.isNull()) { if (calendarDataElement.isNull()) {
if (retrievalJobCount == 0 && !mRequestsTracker[email].retrievalJobSuccessful) { if (retrievalJobCount == 0 && !mRequestsTracker[email].retrievalJobSuccessful) {
Q_EMIT (freeBusyRetrieved(email, QString(), false, i18n("Invalid response from the server"))); Q_EMIT freeBusyRetrieved(email, QString(), false, i18n("Invalid response from the server"));
} }
return; return;
} }
...@@ -218,7 +218,7 @@ void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job) ...@@ -218,7 +218,7 @@ void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job)
KCalendarCore::FreeBusy::Ptr fb = format.parseFreeBusy(rawData); KCalendarCore::FreeBusy::Ptr fb = format.parseFreeBusy(rawData);
if (fb.isNull()) { if (fb.isNull()) {
if (retrievalJobCount == 0 && !mRequestsTracker[email].retrievalJobSuccessful) { if (retrievalJobCount == 0 && !mRequestsTracker[email].retrievalJobSuccessful) {
Q_EMIT (freeBusyRetrieved(email, QString(), false, i18n("Unable to parse free-busy data received"))); Q_EMIT freeBusyRetrieved(email, QString(), false, i18n("Unable to parse free-busy data received"));
} }
return; return;
} }
......
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
class Url class Url
{ {
public: public:
typedef QList<Url> List; typedef QVector<Url> List;
KDAV::Protocol protocol; KDAV::Protocol protocol;
QString url; QString url;
......
...@@ -125,7 +125,7 @@ EwsCreateItemRequest::Response::Response(QXmlStreamReader &reader) ...@@ -125,7 +125,7 @@ EwsCreateItemRequest::Response::Response(QXmlStreamReader &reader)
while (reader.readNextStartElement()) { while (reader.readNextStartElement()) {
if (reader.namespaceUri() != ewsMsgNsUri && reader.namespaceUri() != ewsTypeNsUri) { if (reader.namespaceUri() != ewsMsgNsUri && reader.namespaceUri() != ewsTypeNsUri) {
setErrorMsg(QStringLiteral("Unexpected namespace in %1 element: %2") setErrorMsg(QStringLiteral("Unexpected namespace in %1 element: %2")
.arg(QStringLiteral("ResponseMessage")).arg(reader.namespaceUri().toString())); .arg(QStringLiteral("ResponseMessage"), reader.namespaceUri().toString()));
return; return;
} }
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
class Event class Event
{ {
public: public:
typedef QList<Event> List; typedef QVector<Event> List;
EwsEventType type() const EwsEventType type() const
{ {
......
...@@ -36,7 +36,7 @@ class Mailbox; ...@@ -36,7 +36,7 @@ class Mailbox;
class EwsMailbox class EwsMailbox
{ {
public: public:
typedef QList<EwsMailbox> List; typedef QVector<EwsMailbox> List;
EwsMailbox(); EwsMailbox();
explicit EwsMailbox(QXmlStreamReader &reader); explicit EwsMailbox(QXmlStreamReader &reader);
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
class Change class Change
{ {
public: public:
typedef QList<Change> List; typedef QVector<Change> List;
ChangeType type() const ChangeType type() const
{ {
......
...@@ -317,7 +317,7 @@ SyncFolderHierInitialDialogEntry::SyncFolderHierInitialDialogEntry(const Isolate ...@@ -317,7 +317,7 @@ SyncFolderHierInitialDialogEntry::SyncFolderHierInitialDialogEntry(const Isolate
xml += QStringLiteral("</t:Create>"); xml += QStringLiteral("</t:Create>");
} }
xQuery = IsolatedTestBase::loadResourceAsString(QStringLiteral(":/xquery/syncfolderhierarhy-emptystate")) xQuery = IsolatedTestBase::loadResourceAsString(QStringLiteral(":/xquery/syncfolderhierarhy-emptystate"))
.arg(syncState).arg(xml); .arg(syncState, xml);
} }
UnsubscribeDialogEntry::UnsubscribeDialogEntry(const QString &descr, const ReplyCallback &callback) UnsubscribeDialogEntry::UnsubscribeDialogEntry(const QString &descr, const ReplyCallback &callback)
......
...@@ -49,8 +49,6 @@ ...@@ -49,8 +49,6 @@
using namespace KGAPI2; using namespace KGAPI2;
using namespace Akonadi; using namespace Akonadi;
static constexpr uint32_t KGAPIEventVersion = 1;
QString CalendarHandler::mimeType() QString CalendarHandler::mimeType()
{ {
return KCalendarCore::Event::eventMimeType(); return KCalendarCore::Event::eventMimeType();
...@@ -174,6 +172,7 @@ void CalendarHandler::slotItemsRetrieved(KGAPI2::Job *job) ...@@ -174,6 +172,7 @@ void CalendarHandler::slotItemsRetrieved(KGAPI2::Job *job)
const ObjectsList objects = fetchJob->items(); const ObjectsList objects = fetchJob->items();
bool isIncremental = !fetchJob->syncToken().isEmpty(); bool isIncremental = !fetchJob->syncToken().isEmpty();
qCDebug(GOOGLE_CALENDAR_LOG) << "Retrieved" << objects.count() << "events for calendar" << collection.remoteId(); qCDebug(GOOGLE_CALENDAR_LOG) << "Retrieved" << objects.count() << "events for calendar" << collection.remoteId();
changedItems.reserve(objects.count());
for (const ObjectPtr &object : objects) { for (const ObjectPtr &object : objects) {
const EventPtr event = object.dynamicCast<Event>(); const EventPtr event = object.dynamicCast<Event>();
if (event->useDefaultReminders() && attr) { if (event->useDefaultReminders() && attr) {
......
...@@ -59,7 +59,7 @@ void DummyPasswordRequester::setDelays(const QList<int> &delays) ...@@ -59,7 +59,7 @@ void DummyPasswordRequester::setDelays(const QList<int> &delays)
void DummyPasswordRequester::requestPassword(RequestType request, const QString & /*serverError*/) void DummyPasswordRequester::requestPassword(RequestType request, const QString & /*serverError*/)
{ {
QVERIFY2(!m_expectedCalls.isEmpty(), QString::fromLatin1("Got unexpected call: %1").arg(request).toUtf8().constData()); QVERIFY2(!m_expectedCalls.isEmpty(), QStringLiteral("Got unexpected call: %1").arg(request).toUtf8().constData());
QCOMPARE((int)request, (int)m_expectedCalls.takeFirst()); QCOMPARE((int)request, (int)m_expectedCalls.takeFirst());
int delay = 20; int delay = 20;
......
...@@ -39,7 +39,7 @@ QString ResourceStateInterface::mailBoxForCollection(const Akonadi::Collection & ...@@ -39,7 +39,7 @@ QString ResourceStateInterface::mailBoxForCollection(const Akonadi::Collection &
/*if ( showWarnings && collection.remoteId() != rootRemoteId()) /*if ( showWarnings && collection.remoteId() != rootRemoteId())
qCWarning(IMAPRESOURCE_LOG) << "RID mismatch, is " << collection.remoteId() << " expected " << rootRemoteId(); qCWarning(IMAPRESOURCE_LOG) << "RID mismatch, is " << collection.remoteId() << " expected " << rootRemoteId();
*/ */
return QStringLiteral(""); // see below, this intentionally not just QString()! return QLatin1String(""); // see below, this intentionally not just QString()!
} }
const QString parentMailbox = mailBoxForCollection(collection.parentCollection()); const QString parentMailbox = mailBoxForCollection(collection.parentCollection());
if (parentMailbox.isNull()) { // invalid, != isEmpty() here! if (parentMailbox.isNull()) { // invalid, != isEmpty() here!
......
...@@ -164,7 +164,7 @@ Kolab::Period addLocalPeriod(const QDateTime &eventStart, const QDateTime &event ...@@ -164,7 +164,7 @@ Kolab::Period addLocalPeriod(const QDateTime &eventStart, const QDateTime &event
Freebusy generateFreeBusy(const std::vector< Event > &events, const cDateTime &startDate, const cDateTime &endDate) Freebusy generateFreeBusy(const std::vector< Event > &events, const cDateTime &startDate, const cDateTime &endDate)
{ {
QList<KCalendarCore::Event::Ptr> list; QVector<KCalendarCore::Event::Ptr> list;
list.reserve(events.size()); list.reserve(events.size());
for (const Kolab::Event &e : events) { for (const Kolab::Event &e : events) {
list.append(Kolab::Conversion::toKCalendarCore(e)); list.append(Kolab::Conversion::toKCalendarCore(e));
...@@ -173,7 +173,7 @@ Freebusy generateFreeBusy(const std::vector< Event > &events, const cDateTime &s ...@@ -173,7 +173,7 @@ Freebusy generateFreeBusy(const std::vector< Event > &events, const cDateTime &s
return generateFreeBusy(list, Kolab::Conversion::toDate(startDate), Kolab::Conversion::toDate(endDate), person, startDate.isDateOnly()); return generateFreeBusy(list, Kolab::Conversion::toDate(startDate), Kolab::Conversion::toDate(endDate), person, startDate.isDateOnly());
} }
Freebusy generateFreeBusy(const QList<KCalendarCore::Event::Ptr> &events, const QDateTime &startDate, const QDateTime &endDate, const KCalendarCore::Person &organizer, bool allDay) Freebusy generateFreeBusy(const QVector<KCalendarCore::Event::Ptr> &events, const QDateTime &startDate, const QDateTime &endDate, const KCalendarCore::Person &organizer, bool allDay)
{ {
/* /*
* TODO the conversion of date-only values to date-time is only necessary because xCal doesn't allow date only. iCalendar doesn't seem to make this restriction so it looks like a bug. * TODO the conversion of date-only values to date-time is only necessary because xCal doesn't allow date only. iCalendar doesn't seem to make this restriction so it looks like a bug.
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
namespace Kolab { namespace Kolab {
namespace FreebusyUtils { namespace FreebusyUtils {
KOLAB_EXPORT Freebusy generateFreeBusy(const QList<KCalendarCore::Event::Ptr> &events, const QDateTime &startDate, const QDateTime &endDate, const KCalendarCore::Person &organizer, bool allDay); KOLAB_EXPORT Freebusy generateFreeBusy(const QVector<KCalendarCore::Event::Ptr> &events, const QDateTime &startDate, const QDateTime &endDate, const KCalendarCore::Person &organizer, bool allDay);
KOLAB_EXPORT std::string toIFB(const Kolab::Freebusy &); KOLAB_EXPORT std::string toIFB(const Kolab::Freebusy &);
Kolab::Freebusy generateFreeBusy(const std::vector<Kolab::Event> &events, const Kolab::cDateTime &startDate, const Kolab::cDateTime &endDate); Kolab::Freebusy generateFreeBusy(const std::vector<Kolab::Event> &events, const Kolab::cDateTime &startDate, const Kolab::cDateTime &endDate);
......
...@@ -78,7 +78,7 @@ void ErrorHandler::addError(ErrorHandler::Severity s, const QString &message, co ...@@ -78,7 +78,7 @@ void ErrorHandler::addError(ErrorHandler::Severity s, const QString &message, co
if (!lst.isEmpty()) { if (!lst.isEmpty()) {
filename = lst.last(); filename = lst.last();
} }
const QString output = QTime::currentTime().toString(QLatin1String("(hh:mm:ss) ")) + filename + QLatin1String(":\t") + message; const QString output = QTime::currentTime().toString(QStringLiteral("(hh:mm:ss) ")) + filename + QLatin1String(":\t") + message;
std::cout << output.toStdString() << std::endl; std::cout << output.toStdString() << std::endl;
if (s == Debug) { if (s == Debug) {
return; return;
......
...@@ -773,7 +773,7 @@ void Incidence::setRecurrence(KCalendarCore::Recurrence *recur) ...@@ -773,7 +773,7 @@ void Incidence::setRecurrence(KCalendarCore::Recurrence *recur)
case KCalendarCore::Recurrence::rYearlyDay: // YearlyDay (day N of the year). Not supported by Outlook case KCalendarCore::Recurrence::rYearlyDay: // YearlyDay (day N of the year). Not supported by Outlook
mRecurrence.cycle = QStringLiteral("yearly"); mRecurrence.cycle = QStringLiteral("yearly");
mRecurrence.type = QStringLiteral("yearday"); mRecurrence.type = QStringLiteral("yearday");
mRecurrence.dayNumber = QString::number(recur->yearDays().first()); mRecurrence.dayNumber = QString::number(recur->yearDays().constFirst());
break; break;
case KCalendarCore::Recurrence::rYearlyPos: // (weekday X of week N of month Y) case KCalendarCore::Recurrence::rYearlyPos: // (weekday X of week N of month Y)
mRecurrence.cycle = QStringLiteral("yearly"); mRecurrence.cycle = QStringLiteral("yearly");
......
...@@ -45,6 +45,7 @@ KMime::Message::Ptr readMimeFile(const QString &fileName, bool &ok) ...@@ -45,6 +45,7 @@ KMime::Message::Ptr readMimeFile(const QString &fileName, bool &ok)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
vector<string> inputFiles; vector<string> inputFiles;
inputFiles.reserve(argc - 1);
for (int i = 1; i < argc; ++i) { for (int i = 1; i < argc; ++i) {
inputFiles.push_back(argv[i]); inputFiles.push_back(argv[i]);
} }
......
...@@ -1147,7 +1147,6 @@ void CollectionMoveTest::testMoveToMBox() ...@@ -1147,7 +1147,6 @@ void CollectionMoveTest::testMoveToMBox()
QVERIFY(TestDataUtil::installFolder(QStringLiteral("mbox"), topDir.path(), QStringLiteral("collection5"))); QVERIFY(TestDataUtil::installFolder(QStringLiteral("mbox"), topDir.path(), QStringLiteral("collection5")));
QFileInfo fileInfo5(topDir, QStringLiteral("collection5")); QFileInfo fileInfo5(topDir, QStringLiteral("collection5"));
QVERIFY(TestDataUtil::installFolder(QStringLiteral("mbox"), topDir.path(), QStringLiteral("collection6"))); QVERIFY(TestDataUtil::installFolder(QStringLiteral("mbox"), topDir.path(), QStringLiteral("collection6")));
QFileInfo fileInfo6(topDir, QStringLiteral("collection6"));
// first level maildir parent // first level maildir parent
QDir subDir1 = topDir; QDir subDir1 = topDir;
......
...@@ -493,6 +493,8 @@ void Pop3Test::testBigFetch() ...@@ -493,6 +493,8 @@ void Pop3Test::testBigFetch()
QList<QByteArray> mails; QList<QByteArray> mails;
QStringList uids; QStringList uids;
QString allowedRetrs; QString allowedRetrs;
mails.reserve(1000);
uids.reserve(1000);
for (int i = 0; i < 1000; i++) { for (int i = 0; i < 1000; i++) {
QByteArray newMail = simpleMail1; QByteArray newMail = simpleMail1;
newMail.append(QString::number(i + 1).toLatin1()); newMail.append(QString::number(i + 1).toLatin1());
......
...@@ -182,7 +182,7 @@ QByteArray O0SimpleCrypt::decryptToByteArray(const QByteArray &cypher) ...@@ -182,7 +182,7 @@ QByteArray O0SimpleCrypt::decryptToByteArray(const QByteArray &cypher)
return QByteArray(); return QByteArray();
} }
if (!cypher.length()) { if (cypher.isEmpty()) {
m_lastError = ErrorUnknownVersion; m_lastError = ErrorUnknownVersion;
return QByteArray(); return QByteArray();
} }
......
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