Commit 96b2d998 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some clazy warning

parent 84c57cc3
......@@ -174,7 +174,6 @@ ObjectsList CommentFetchJob::handleReplyWithItems(const QNetworkReply *reply, co
feedData.requestUrl = reply->request().url();
ObjectsList items;
QString itemId;
const QString contentType = reply->header(QNetworkRequest::ContentTypeHeader).toString();
ContentType ct = Utils::stringToContentType(contentType);
......
......@@ -115,7 +115,7 @@ void FreeBusyQueryJob::handleReply(const QNetworkReply *reply, const QByteArray
const QVariantMap data = document.toVariant().toMap();
const QVariantMap cals = data[QStringLiteral("calendars")].toMap();
const QVariantMap cal = cals[d->id].toMap();
if (cal.contains(QLatin1String("errors"))) {
if (cal.contains(QStringLiteral("errors"))) {
setError(KGAPI2::NotFound);
setErrorString(tr("FreeBusy information is not available"));
} else {
......
......@@ -334,25 +334,25 @@ ObjectPtr Private::JSONToContact(const QVariantMap& data)
}
/* Formatted name */
if (data.contains(QLatin1String("gd$name"))) {
if (data.contains(QStringLiteral("gd$name"))) {
const QVariantMap name = data.value(QStringLiteral("gd$name")).toMap();
if (name.contains(QLatin1String("gd$fullName"))) {
if (name.contains(QStringLiteral("gd$fullName"))) {
contact->setFormattedName(Private::stringFromXMLMap(name, QStringLiteral("gd$fullName")));
}
if (name.contains(QLatin1String("gd$givenName"))) {
if (name.contains(QStringLiteral("gd$givenName"))) {
contact->setGivenName(Private::stringFromXMLMap(name, QStringLiteral("gd$givenName")));
}
if (name.contains(QLatin1String("gd$familyName"))) {
if (name.contains(QStringLiteral("gd$familyName"))) {
contact->setFamilyName(Private::stringFromXMLMap(name, QStringLiteral("gd$familyName")));
}
if (name.contains(QLatin1String("gd$additionalName"))) {
if (name.contains(QStringLiteral("gd$additionalName"))) {
contact->setAdditionalName(Private::stringFromXMLMap(name, QStringLiteral("gd$additionalName")));
}
if (name.contains(QLatin1String("gd$namePrefix"))) {
if (name.contains(QStringLiteral("gd$namePrefix"))) {
contact->setPrefix(Private::stringFromXMLMap(name, QStringLiteral("gd$namePrefix")));
}
if (name.contains(QLatin1String("gd$nameSuffix"))) {
if (name.contains(QStringLiteral("gd$nameSuffix"))) {
contact->setSuffix(Private::stringFromXMLMap(name, QStringLiteral("gd$nameSuffix")));
}
}
......@@ -367,32 +367,32 @@ ObjectPtr Private::JSONToContact(const QVariantMap& data)
const QVariantList organizations = data.value(QStringLiteral("gd$organization")).toList();
const QVariantMap organization = organizations.first().toMap();
if (organization.contains(QLatin1String("gd$orgName"))) {
if (organization.contains(QStringLiteral("gd$orgName"))) {
contact->setOrganization(Private::stringFromXMLMap(organization, QStringLiteral("gd$orgName")));
}
if (organization.contains(QLatin1String("gd$orgDepartment"))) {
if (organization.contains(QStringLiteral("gd$orgDepartment"))) {
contact->setDepartment(Private::stringFromXMLMap(organization, QStringLiteral("gd$orgDepartment")));
}
if (organization.contains(QLatin1String("gd$orgTitle"))) {
if (organization.contains(QStringLiteral("gd$orgTitle"))) {
contact->setTitle(Private::stringFromXMLMap(organization, QStringLiteral("gd$orgTitle")));
}
if (organization.contains(QLatin1String("gd$where"))) {
if (organization.contains(QStringLiteral("gd$where"))) {
contact->setOffice(Private::stringFromXMLMap(organization, QStringLiteral("gd$where")));
}
}
/* Nickname */
if (data.contains(QLatin1String("gContact$nickname"))) {
if (data.contains(QStringLiteral("gContact$nickname"))) {
contact->setNickName(Private::stringFromXMLMap(data, QStringLiteral("gContact$nickname")));
}
/* Occupation (= organization/title) */
if (data.contains(QLatin1String("gContact$occupation"))) {
if (data.contains(QStringLiteral("gContact$occupation"))) {
contact->setProfession(Private::stringFromXMLMap(data, QStringLiteral("gContact$occupation")));
}
/* Relationships */
if (data.contains(QLatin1String("gContact$relation"))) {
if (data.contains(QStringLiteral("gContact$relation"))) {
const QVariantList relations = data.value(QStringLiteral("gContact$relation")).toList();
for (const QVariant &r : relations) {
const QVariantMap relation = r.toMap();
......@@ -414,7 +414,7 @@ ObjectPtr Private::JSONToContact(const QVariantMap& data)
}
/* Anniversary */
if (data.contains(QLatin1String("gContact$event"))) {
if (data.contains(QStringLiteral("gContact$event"))) {
const QVariantList events = data.value(QStringLiteral("gContact$event")).toList();
for (const QVariant &e : events) {
const QVariantMap event = e.toMap();
......@@ -427,7 +427,7 @@ ObjectPtr Private::JSONToContact(const QVariantMap& data)
}
/* Websites */
if (data.contains(QLatin1String("gContact$website"))) {
if (data.contains(QStringLiteral("gContact$website"))) {
const QVariantList websites = data.value(QStringLiteral("gContact$website")).toList();
for (const QVariant &w : websites) {
const QVariantMap web = w.toMap();
......
......@@ -128,11 +128,11 @@ QString Job::Private::parseErrorMessage(const QByteArray &json)
QVariantMap map = document.toVariant().toMap();
QString message;
if (map.contains(QLatin1String("error"))) {
if (map.contains(QStringLiteral("error"))) {
map = map.value(QStringLiteral("error")).toMap();
}
if (map.contains(QLatin1String("message"))) {
if (map.contains(QStringLiteral("message"))) {
message.append(map.value(QStringLiteral("message")).toString());
} else {
message = QLatin1String(json);
......
......@@ -126,7 +126,7 @@ QString PermissionCreateJob::emailMessage() const
return d->emailMessage;
}
void PermissionCreateJob::setEmailMessage(QString emailMessage)
void PermissionCreateJob::setEmailMessage(const QString &emailMessage)
{
d->emailMessage = emailMessage;
}
......
......@@ -53,7 +53,7 @@ class KGAPIDRIVE_EXPORT PermissionCreateJob : public KGAPI2::CreateJob
/**
* @brief Sets the plain text custom message to include in notification emails.
*/
void setEmailMessage(QString emailMessage);
void setEmailMessage(const QString &emailMessage);
/**
* @brief Sets whether to send notification emails when sharing to users
......
......@@ -108,28 +108,28 @@ LocationPtr Private::parseLocation(const QVariantMap &map)
{
LocationPtr location(new Location);
if (map.contains(QLatin1String("timestampMs"))) {
if (map.contains(QStringLiteral("timestampMs"))) {
location->setTimestamp(map.value(QStringLiteral("timestampMs")).toULongLong());
}
if (map.contains(QLatin1String("latitude"))) {
if (map.contains(QStringLiteral("latitude"))) {
location->setLatitude(map.value(QStringLiteral("latitude")).toFloat());
}
if (map.contains(QLatin1String("longitude"))) {
if (map.contains(QStringLiteral("longitude"))) {
location->setLongitude(map.value(QStringLiteral("longitude")).toFloat());
}
if (map.contains(QLatin1String("accuracy"))) {
if (map.contains(QStringLiteral("accuracy"))) {
location->setAccuracy(map.value(QStringLiteral("accuracy")).toInt());
}
if (map.contains(QLatin1String("speed"))) {
if (map.contains(QStringLiteral("speed"))) {
location->setSpeed(map.value(QStringLiteral("speed")).toInt());
}
if (map.contains(QLatin1String("heading"))) {
if (map.contains(QStringLiteral("heading"))) {
location->setHeading(map.value(QStringLiteral("heading")).toInt());
}
if (map.contains(QLatin1String("altitude"))) {
if (map.contains(QStringLiteral("altitude"))) {
location->setAltitude(map.value(QStringLiteral("altitude")).toInt());
}
if (map.contains(QLatin1String("altitudeAccuracy"))) {
if (map.contains(QStringLiteral("altitudeAccuracy"))) {
location->setAltitudeAccuracy(map.value(QStringLiteral("altitudeAccuracy")).toInt());
}
......
......@@ -60,7 +60,7 @@ ObjectsList parseJSONFeed(const QByteArray& jsonFeed, FeedData& feedData)
if (feed.value(QStringLiteral("kind")).toString() == QLatin1String("tasks#taskLists")) {
list = Private::parseTaskListJSONFeed(feed.value(QStringLiteral("items")).toList());
if (feed.contains(QLatin1String("nextPageToken"))) {
if (feed.contains(QStringLiteral("nextPageToken"))) {
feedData.nextPageUrl = fetchTaskListsUrl();
QUrlQuery query(feedData.nextPageUrl);
query.addQueryItem(QStringLiteral("pageToken"), feed.value(QStringLiteral("nextPageToken")).toString());
......@@ -73,7 +73,7 @@ ObjectsList parseJSONFeed(const QByteArray& jsonFeed, FeedData& feedData)
} else if (feed.value(QStringLiteral("kind")).toString() == QLatin1String("tasks#tasks")) {
list = Private::parseTasksJSONFeed(feed.value(QStringLiteral("items")).toList());
if (feed.contains(QLatin1String("nextPageToken"))) {
if (feed.contains(QStringLiteral("nextPageToken"))) {
QString taskListId = feedData.requestUrl.toString().remove(QStringLiteral("https://www.googleapis.com/tasks/v1/lists/"));
taskListId = taskListId.left(taskListId.indexOf(QLatin1Char('/')));
......@@ -217,7 +217,7 @@ ObjectPtr Private::JSONToTask(const QVariantMap &jsonData)
task->setDeleted(jsonData.value(QStringLiteral("deleted")).toBool());
if (jsonData.contains(QLatin1String("parent"))) {
if (jsonData.contains(QStringLiteral("parent"))) {
task->setRelatedTo(jsonData.value(QStringLiteral("parent")).toString(), KCalendarCore::Incidence::RelTypeParent);
}
......
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