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

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)
if (job->error()) {
if (retrievalJobCount == 0 && !mRequestsTracker[email].retrievalJobSuccessful) {
Q_EMIT (freeBusyRetrieved(email, QString(), false, job->errorString()));
Q_EMIT freeBusyRetrieved(email, QString(), false, job->errorString());
}
return;
}
......@@ -196,7 +196,7 @@ void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job)
QDomElement responseElement = firstChildElementNS(scheduleResponse, QStringLiteral("urn:ietf:params:xml:ns:caldav"), QStringLiteral("response"));
if (responseElement.isNull()) {
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;
}
......@@ -207,7 +207,7 @@ void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job)
QDomElement calendarDataElement = firstChildElementNS(responseElement, QStringLiteral("urn:ietf:params:xml:ns:caldav"), QStringLiteral("calendar-data"));
if (calendarDataElement.isNull()) {
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;
}
......@@ -218,7 +218,7 @@ void DavFreeBusyHandler::onRetrieveFreeBusyJobFinished(KJob *job)
KCalendarCore::FreeBusy::Ptr fb = format.parseFreeBusy(rawData);
if (fb.isNull()) {
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;
}
......
......@@ -55,7 +55,7 @@ public:
class Url
{
public:
typedef QList<Url> List;
typedef QVector<Url> List;
KDAV::Protocol protocol;
QString url;
......
......@@ -125,7 +125,7 @@ EwsCreateItemRequest::Response::Response(QXmlStreamReader &reader)
while (reader.readNextStartElement()) {
if (reader.namespaceUri() != ewsMsgNsUri && reader.namespaceUri() != ewsTypeNsUri) {
setErrorMsg(QStringLiteral("Unexpected namespace in %1 element: %2")
.arg(QStringLiteral("ResponseMessage")).arg(reader.namespaceUri().toString()));
.arg(QStringLiteral("ResponseMessage"), reader.namespaceUri().toString()));
return;
}
......
......@@ -40,7 +40,7 @@ public:
class Event
{
public:
typedef QList<Event> List;
typedef QVector<Event> List;
EwsEventType type() const
{
......
......@@ -36,7 +36,7 @@ class Mailbox;
class EwsMailbox
{
public:
typedef QList<EwsMailbox> List;
typedef QVector<EwsMailbox> List;
EwsMailbox();
explicit EwsMailbox(QXmlStreamReader &reader);
......
......@@ -41,7 +41,7 @@ public:
class Change
{
public:
typedef QList<Change> List;
typedef QVector<Change> List;
ChangeType type() const
{
......
......@@ -317,7 +317,7 @@ SyncFolderHierInitialDialogEntry::SyncFolderHierInitialDialogEntry(const Isolate
xml += QStringLiteral("</t:Create>");
}
xQuery = IsolatedTestBase::loadResourceAsString(QStringLiteral(":/xquery/syncfolderhierarhy-emptystate"))
.arg(syncState).arg(xml);
.arg(syncState, xml);
}
UnsubscribeDialogEntry::UnsubscribeDialogEntry(const QString &descr, const ReplyCallback &callback)
......
......@@ -49,8 +49,6 @@
using namespace KGAPI2;
using namespace Akonadi;
static constexpr uint32_t KGAPIEventVersion = 1;
QString CalendarHandler::mimeType()
{
return KCalendarCore::Event::eventMimeType();
......@@ -174,6 +172,7 @@ void CalendarHandler::slotItemsRetrieved(KGAPI2::Job *job)
const ObjectsList objects = fetchJob->items();
bool isIncremental = !fetchJob->syncToken().isEmpty();
qCDebug(GOOGLE_CALENDAR_LOG) << "Retrieved" << objects.count() << "events for calendar" << collection.remoteId();
changedItems.reserve(objects.count());
for (const ObjectPtr &object : objects) {
const EventPtr event = object.dynamicCast<Event>();
if (event->useDefaultReminders() && attr) {
......
......@@ -59,7 +59,7 @@ void DummyPasswordRequester::setDelays(const QList<int> &delays)
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());
int delay = 20;
......
......@@ -39,7 +39,7 @@ QString ResourceStateInterface::mailBoxForCollection(const Akonadi::Collection &
/*if ( showWarnings && collection.remoteId() != 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());
if (parentMailbox.isNull()) { // invalid, != isEmpty() here!
......
......@@ -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)
{
QList<KCalendarCore::Event::Ptr> list;
QVector<KCalendarCore::Event::Ptr> list;
list.reserve(events.size());
for (const Kolab::Event &e : events) {
list.append(Kolab::Conversion::toKCalendarCore(e));
......@@ -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());
}
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.
......
......@@ -25,7 +25,7 @@
namespace Kolab {
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::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
if (!lst.isEmpty()) {
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;
if (s == Debug) {
return;
......
......@@ -773,7 +773,7 @@ void Incidence::setRecurrence(KCalendarCore::Recurrence *recur)
case KCalendarCore::Recurrence::rYearlyDay: // YearlyDay (day N of the year). Not supported by Outlook
mRecurrence.cycle = QStringLiteral("yearly");
mRecurrence.type = QStringLiteral("yearday");
mRecurrence.dayNumber = QString::number(recur->yearDays().first());
mRecurrence.dayNumber = QString::number(recur->yearDays().constFirst());
break;
case KCalendarCore::Recurrence::rYearlyPos: // (weekday X of week N of month Y)
mRecurrence.cycle = QStringLiteral("yearly");
......
......@@ -45,6 +45,7 @@ KMime::Message::Ptr readMimeFile(const QString &fileName, bool &ok)
int main(int argc, char *argv[])
{
vector<string> inputFiles;
inputFiles.reserve(argc - 1);
for (int i = 1; i < argc; ++i) {
inputFiles.push_back(argv[i]);
}
......
......@@ -1147,7 +1147,6 @@ void CollectionMoveTest::testMoveToMBox()
QVERIFY(TestDataUtil::installFolder(QStringLiteral("mbox"), topDir.path(), QStringLiteral("collection5")));
QFileInfo fileInfo5(topDir, QStringLiteral("collection5"));
QVERIFY(TestDataUtil::installFolder(QStringLiteral("mbox"), topDir.path(), QStringLiteral("collection6")));
QFileInfo fileInfo6(topDir, QStringLiteral("collection6"));
// first level maildir parent
QDir subDir1 = topDir;
......
......@@ -493,6 +493,8 @@ void Pop3Test::testBigFetch()
QList<QByteArray> mails;
QStringList uids;
QString allowedRetrs;
mails.reserve(1000);
uids.reserve(1000);
for (int i = 0; i < 1000; i++) {
QByteArray newMail = simpleMail1;
newMail.append(QString::number(i + 1).toLatin1());
......
......@@ -182,7 +182,7 @@ QByteArray O0SimpleCrypt::decryptToByteArray(const QByteArray &cypher)
return QByteArray();
}
if (!cypher.length()) {
if (cypher.isEmpty()) {
m_lastError = ErrorUnknownVersion;
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