Commit 486384be authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warning

parent 117ea429
Pipeline #32099 failed with stage
in 39 minutes and 51 seconds
......@@ -300,7 +300,7 @@ KCalendarCore::Event::Ptr BirthdaysResource::createAnniversary(const Akonadi::It
return KCalendarCore::Event::Ptr();
}
KCalendarCore::Event::Ptr BirthdaysResource::createEvent(const QDate &date)
KCalendarCore::Event::Ptr BirthdaysResource::createEvent(QDate date)
{
Event::Ptr event(new Event());
event->setDtStart(QDateTime(date, {}));
......
......@@ -38,7 +38,7 @@ private:
KCalendarCore::Event::Ptr createBirthday(const Akonadi::Item &contactItem);
KCalendarCore::Event::Ptr createAnniversary(const Akonadi::Item &contactItem);
KCalendarCore::Event::Ptr createEvent(const QDate &date);
KCalendarCore::Event::Ptr createEvent(QDate date);
private Q_SLOTS:
void doFullSearch();
......
......@@ -65,9 +65,10 @@ void DavFreeBusyHandler::retrieveFreeBusy(const QString &email, const QDateTime
fb->addAttendee(att);
KCalendarCore::ICalFormat formatter;
QByteArray fbData = formatter.createScheduleMessage(fb, KCalendarCore::iTIPRequest).toUtf8();
const QByteArray fbData = formatter.createScheduleMessage(fb, KCalendarCore::iTIPRequest).toUtf8();
foreach (const QString &outbox, mPrincipalScheduleOutbox[email]) {
const QStringList principalScheduleOutboxFromEmail = mPrincipalScheduleOutbox[email];
for (const QString &outbox : principalScheduleOutboxFromEmail) {
++mRequestsTracker[email].retrievalJobCount;
uint requestId = mNextRequestId++;
......
......@@ -201,10 +201,10 @@ KDAV::DavUrl Settings::davUrlFromCollectionUrl(const QString &collectionUrl, con
}
KDAV::DavUrl davUrl;
QString targetUrl = finalUrl.isEmpty() ? collectionUrl : finalUrl;
const QString targetUrl = finalUrl.isEmpty() ? collectionUrl : finalUrl;
if (mCollectionsUrlsMapping.contains(collectionUrl)) {
QStringList split = mCollectionsUrlsMapping[ collectionUrl ].split(QLatin1Char(','));
const QStringList split = mCollectionsUrlsMapping.value(collectionUrl).split(QLatin1Char(','));
if (split.size() == 2) {
davUrl = configuredDavUrl(KDAV::ProtocolInfo::protocolByName(split.at(1)), split.at(0), targetUrl);
}
......@@ -219,7 +219,7 @@ void Settings::addCollectionUrlMapping(KDAV::Protocol proto, const QString &coll
loadMappings();
}
QString value = configuredUrl + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(proto);
const QString value = configuredUrl + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(proto);
mCollectionsUrlsMapping.insert(collectionUrl, value);
// Update the cache now
......@@ -244,7 +244,7 @@ QStringList Settings::mappedCollections(KDAV::Protocol proto, const QString &con
loadMappings();
}
QString value = configuredUrl + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(proto);
const QString value = configuredUrl + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(proto);
return mCollectionsUrlsMapping.keys(value);
}
......@@ -257,7 +257,7 @@ void Settings::reloadConfig()
void Settings::newUrlConfiguration(Settings::UrlConfiguration *urlConfig)
{
QString key = urlConfig->mUrl + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(KDAV::Protocol(urlConfig->mProtocol));
const QString key = urlConfig->mUrl + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(KDAV::Protocol(urlConfig->mProtocol));
if (mUrls.contains(key)) {
removeUrlConfiguration(KDAV::Protocol(urlConfig->mProtocol), urlConfig->mUrl);
......@@ -272,7 +272,7 @@ void Settings::newUrlConfiguration(Settings::UrlConfiguration *urlConfig)
void Settings::removeUrlConfiguration(KDAV::Protocol proto, const QString &url)
{
QString key = url + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(proto);
const QString key = url + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(proto);
if (!mUrls.contains(key)) {
return;
......@@ -285,7 +285,7 @@ void Settings::removeUrlConfiguration(KDAV::Protocol proto, const QString &url)
Settings::UrlConfiguration *Settings::urlConfiguration(KDAV::Protocol proto, const QString &url)
{
QString key = url + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(proto);
const QString key = url + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(proto);
UrlConfiguration *ret = nullptr;
if (mUrls.contains(key)) {
......@@ -305,7 +305,7 @@ Settings::UrlConfiguration *Settings::urlConfiguration(KDAV::Protocol proto, con
QString Settings::username(KDAV::Protocol proto, const QString &url) const
{
QString key = url + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(proto);
const QString key = url + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(proto);
if (mUrls.contains(key)) {
if (mUrls[ key ]->mUser == QLatin1String("$default$")) {
......@@ -320,7 +320,7 @@ QString Settings::username(KDAV::Protocol proto, const QString &url) const
QString Settings::password(KDAV::Protocol proto, const QString &url)
{
QString key = url + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(proto);
const QString key = url + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(proto);
if (mUrls.contains(key)) {
if (mUrls[ key ]->mUser == QLatin1String("$default$")) {
......@@ -356,8 +356,8 @@ void Settings::buildUrlsList()
{
foreach (const QString &serializedUrl, remoteUrls()) {
UrlConfiguration *urlConfig = new UrlConfiguration(serializedUrl);
QString key = urlConfig->mUrl + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(KDAV::Protocol(urlConfig->mProtocol));
QString pass = loadPassword(key, urlConfig->mUser);
const QString key = urlConfig->mUrl + QLatin1Char(',') + KDAV::ProtocolInfo::protocolName(KDAV::Protocol(urlConfig->mProtocol));
const QString pass = loadPassword(key, urlConfig->mUser);
if (!pass.isNull()) {
urlConfig->mPassword = pass;
mUrls[ key ] = urlConfig;
......@@ -369,7 +369,7 @@ void Settings::buildUrlsList()
void Settings::loadMappings()
{
QString collectionsMappingCacheBase = QStringLiteral("akonadi-davgroupware/%1_c2u.dat").arg(QCoreApplication::applicationName());
const QString collectionsMappingCacheBase = QStringLiteral("akonadi-davgroupware/%1_c2u.dat").arg(QCoreApplication::applicationName());
mCollectionsUrlsMappingCache = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + collectionsMappingCacheBase;
QFile collectionsMappingsCache(mCollectionsUrlsMappingCache);
......@@ -403,7 +403,7 @@ void Settings::updateRemoteUrls()
void Settings::savePassword(const QString &key, const QString &user, const QString &password)
{
QString entry = key + QLatin1Char(',') + user;
const QString entry = key + QLatin1Char(',') + user;
mPasswordsCache[entry] = password;
KWallet::Wallet *wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), mWinId);
......@@ -515,7 +515,7 @@ void Settings::updateToV2()
return;
}
QString urlConfigStr = urls.at(0);
const QString urlConfigStr = urls.at(0);
UrlConfiguration urlConfig(urlConfigStr);
const QRegularExpression regexp(QStringLiteral("^") + urlConfig.mUser);
......@@ -544,7 +544,7 @@ void Settings::updateToV3()
QStringList splitUrl = url.split(QLatin1Char('|'));
if (splitUrl.size() == 3) {
KDAV::Protocol protocol = Utils::protocolByTranslatedName(splitUrl.at(1));
const KDAV::Protocol protocol = Utils::protocolByTranslatedName(splitUrl.at(1));
splitUrl[1] = KDAV::ProtocolInfo::protocolName(protocol);
updatedUrls << splitUrl.join(QLatin1Char('|'));
}
......
......@@ -137,7 +137,8 @@ QByteArray EwsPKeyAuthJob::buildAuthResponse(const QMap<QString, QString> &param
}
QCA::Certificate cert;
for (const auto &c : certs.certificates()) {
const auto certificates = certs.certificates();
for (const auto &c : certificates) {
if (c.issuerInfo() == authoritiesInfo) {
cert = c;
break;
......
......@@ -20,7 +20,7 @@ class QXmlStreamReader;
class EwsAttendee
{
public:
typedef QList<EwsAttendee> List;
typedef QVector<EwsAttendee> List;
EwsAttendee();
explicit EwsAttendee(QXmlStreamReader &reader);
......
......@@ -123,7 +123,7 @@ EwsSubscribeRequest::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;
}
......
......@@ -29,7 +29,7 @@ public:
class Change
{
public:
typedef QList<Change> List;
typedef QVector<Change> List;
ChangeType type() const
{
......
......@@ -400,7 +400,7 @@ void ContactHandler::itemsLinked(const Item::List &items, const Collection &coll
ContactsList contacts;
contacts.reserve(items.count());
std::transform(items.cbegin(), items.cend(), std::back_inserter(contacts),
[this, &collection](const Item &item){
[&collection](const Item &item){
ContactPtr contact(new Contact(item.payload<KContacts::Addressee>()));
contact->addGroup(collection.remoteId());
return contact;
......
......@@ -489,12 +489,12 @@ Kolab::RecurrenceRule::Frequency fromRecurrenceType(KCalendarCore::RecurrenceRul
return Kolab::RecurrenceRule::FreqNone;
}
KCalendarCore::RecurrenceRule::WDayPos toWeekDayPos(const Kolab::DayPos &dp)
KCalendarCore::RecurrenceRule::WDayPos toWeekDayPos(Kolab::DayPos dp)
{
return KCalendarCore::RecurrenceRule::WDayPos(dp.occurence(), toWeekDay(dp.weekday()));
}
Kolab::DayPos fromWeekDayPos(const KCalendarCore::RecurrenceRule::WDayPos &dp)
Kolab::DayPos fromWeekDayPos(KCalendarCore::RecurrenceRule::WDayPos dp)
{
return Kolab::DayPos(dp.pos(), fromWeekDay(dp.day()));
}
......
......@@ -54,6 +54,7 @@ void getAttachments(KCalendarCore::Incidence::Ptr incidence, const QStringList &
template<typename IncidencePtr, typename Converter>
static inline IncidencePtr incidenceFromKolabImpl(const KMime::Message::Ptr &data, const QByteArray &mimetype, const QString &timezoneId)
{
Q_UNUSED(timezoneId)
KMime::Content *xmlContent = Mime::findContentByType(data, mimetype);
if (!xmlContent) {
Critical() << "couldn't find part";
......
......@@ -253,7 +253,7 @@ QString Contact::spouseName() const
return mSpouseName;
}
void Contact::setBirthday(const QDate &date)
void Contact::setBirthday(QDate date)
{
mBirthday = date;
}
......@@ -263,7 +263,7 @@ QDate Contact::birthday() const
return mBirthday;
}
void Contact::setAnniversary(const QDate &date)
void Contact::setAnniversary(QDate date)
{
mAnniversary = date;
}
......
......@@ -114,10 +114,10 @@ public:
void setSpouseName(const QString &name);
QString spouseName() const;
void setBirthday(const QDate &date);
void setBirthday(QDate date);
QDate birthday() const;
void setAnniversary(const QDate &date);
void setAnniversary(QDate date);
QDate anniversary() const;
void setPicture(const QImage &image, const QString &format)
......
......@@ -1021,7 +1021,7 @@ void Incidence::saveTo(const KCalendarCore::Incidence::Ptr &incidence)
QString Incidence::productID() const
{
return QStringLiteral("%1, Kolab resource").arg(QString::fromUtf8(LIBKOLAB_LIB_VERSION_STRING));
return QStringLiteral("%1, Kolab resource").arg(QStringLiteral(LIBKOLAB_LIB_VERSION_STRING));
}
// Unhandled KCalendarCore::Incidence fields:
......
......@@ -425,7 +425,7 @@ QString KolabBase::dateTimeToString(const QDateTime &time)
return time.toString(Qt::ISODate);
}
QString KolabBase::dateToString(const QDate &date)
QString KolabBase::dateToString(QDate date)
{
return date.toString(Qt::ISODate);
}
......
......@@ -76,7 +76,7 @@ public:
// String - Date conversion methods
static QString dateTimeToString(const QDateTime &time);
static QString dateToString(const QDate &date);
static QString dateToString(QDate date);
static QDateTime stringToDateTime(const QString &time);
static QDate stringToDate(const QString &date);
......
......@@ -61,7 +61,7 @@ void CompactPage::onCollectionFetchCheck(KJob *job)
return;
}
CollectionFetchJob *fetchJob = dynamic_cast<CollectionFetchJob *>(job);
CollectionFetchJob *fetchJob = qobject_cast<CollectionFetchJob *>(job);
Q_ASSERT(fetchJob);
Q_ASSERT(fetchJob->collections().size() == 1);
......
......@@ -83,7 +83,7 @@ private:
QStringList mTagList;
};
typedef QList<TagContext> TagContextList;
typedef QVector<TagContext> TagContextList;
QHash<Akonadi::Collection::Id, TagContextList> mTagContextByColId;
TagContextList mPendingTagContexts;
......
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