Commit 9fecb57f authored by Laurent Montel's avatar Laurent Montel 😁

Const'ify variable + initialize in header class

parent 51b57ddf
Pipeline #34757 passed with stage
in 6 minutes and 20 seconds
......@@ -22,8 +22,8 @@ class Q_DECL_HIDDEN BlogFetchJob::Private
Private(const QString &id, FetchBy fetchBy);
~Private();
QString id;
FetchBy fetchBy;
const QString id;
const FetchBy fetchBy;
};
BlogFetchJob::Private::Private(const QString &id_, FetchBy fetchBy_)
......
......@@ -24,10 +24,10 @@ class Q_DECL_HIDDEN CommentApproveJob::Private
const QString &commentId,
ApprovalAction action);
QString blogId;
QString postId;
QString commentId;
ApprovalAction action;
const QString blogId;
const QString postId;
const QString commentId;
const ApprovalAction action;
};
CommentApproveJob::Private::Private(const QString &blogId_,
......
......@@ -23,9 +23,9 @@ class Q_DECL_HIDDEN CommentDeleteContentJob::Private
const QString &postId,
const QString &commentId);
QString blogId;
QString postId;
QString commentId;
const QString blogId;
const QString postId;
const QString commentId;
};
CommentDeleteContentJob::Private::Private(const QString &blogId_,
......
......@@ -23,9 +23,9 @@ class Q_DECL_HIDDEN CommentDeleteJob::Private
const QString &postId,
const QString &commentId);
QString blogId;
QString postId;
QString commentId;
const QString blogId;
const QString postId;
const QString commentId;
};
......
......@@ -26,9 +26,9 @@ class Q_DECL_HIDDEN CommentFetchJob::Private
CommentFetchJob *parent);
~Private();
QString blogId;
QString postId;
QString commentId;
const QString blogId;
const QString postId;
const QString commentId;
uint maxResults;
QDateTime startDate;
QDateTime endDate;
......
......@@ -21,7 +21,7 @@ class Q_DECL_HIDDEN PageCreateJob::Private
public:
Private(const PagePtr &page);
PagePtr page;
const PagePtr page;
};
PageCreateJob::Private::Private(const PagePtr &page_)
......
......@@ -22,8 +22,8 @@ class Q_DECL_HIDDEN PageDeleteJob::Private
Private(const QString &blogId,
const QString &pageId);
QString blogId;
QString pageId;
const QString blogId;
const QString pageId;
};
PageDeleteJob::Private::Private(const QString &blogId_, const QString &pageId_)
......
......@@ -23,19 +23,17 @@ class Q_DECL_HIDDEN PageFetchJob::Private
Private(const QString &blogId,
const QString &pageId);
QString blogId;
QString pageId;
const QString blogId;
const QString pageId;
bool fetchContent;
StatusFilters statusFilter;
bool fetchContent = true;
StatusFilters statusFilter = All;
};
PageFetchJob::Private::Private(const QString &blogId_,
const QString &pageId_)
: blogId(blogId_)
, pageId(pageId_)
, fetchContent(true)
, statusFilter(All)
{
}
......
......@@ -21,7 +21,7 @@ class Q_DECL_HIDDEN PageModifyJob::Private
public:
Private(const PagePtr &page);
PagePtr page;
const PagePtr page;
};
PageModifyJob::Private::Private(const PagePtr &page_)
......
......@@ -31,20 +31,17 @@ class Q_DECL_HIDDEN Post::Private
QString authorName;
QUrl authorUrl;
QUrl authorImageUrl;
uint commentsCount;
uint commentsCount =0;
QStringList labels;
QVariant customMetaData;
QString location;
double latitude;
double longitude;
double latitude = -1;
double longitude = -1;
QList<QUrl> images;
QString status;
};
Post::Private::Private()
: commentsCount(0)
, latitude(-1)
, longitude(-1)
{
}
......
......@@ -23,8 +23,8 @@ class Q_DECL_HIDDEN PostCreateJob::Private
Private(const PostPtr &post,
bool isDraft);
PostPtr post;
bool isDraft;
const PostPtr post;
const bool isDraft;
};
PostCreateJob::Private::Private(const PostPtr &post_,
......
......@@ -21,8 +21,8 @@ class Q_DECL_HIDDEN PostDeleteJob::Private
Private(const QString &blogId,
const QString &postId);
QString blogId;
QString postId;
const QString blogId;
const QString postId;
};
PostDeleteJob::Private::Private(const QString &blogId_,
......
......@@ -27,13 +27,13 @@ class Q_DECL_HIDDEN PostFetchJob::Private
QString blogId;
QString postId;
bool fetchBodies;
bool fetchImages;
uint maxResults;
bool fetchBodies = true;
bool fetchImages = true;
uint maxResults = 0;
QStringList filterLabels;
QDateTime startDate;
QDateTime endDate;
StatusFilters statusFilter;
StatusFilters statusFilter = All;
private:
PostFetchJob *const q;
......@@ -44,10 +44,6 @@ PostFetchJob::Private::Private(const QString &blogId_,
PostFetchJob *parent)
: blogId(blogId_)
, postId(postId_)
, fetchBodies(true)
, fetchImages(true)
, maxResults(0)
, statusFilter(All)
, q(parent)
{
}
......
......@@ -21,7 +21,7 @@ class Q_DECL_HIDDEN PostModifyJob::Private
public:
Private(const PostPtr &post);
PostPtr post;
const PostPtr post;
};
PostModifyJob::Private::Private(const PostPtr &post_)
......
......@@ -26,10 +26,10 @@ class Q_DECL_HIDDEN PostPublishJob::Private
PostPublishJob::PublishAction action,
const QDateTime &publishDate = QDateTime());
QString blogId;
QString postId;
PublishAction action;
QDateTime publishDate;
const QString blogId;
const QString postId;
const PublishAction action;
const QDateTime publishDate;
ObjectPtr response;
};
......
......@@ -24,9 +24,9 @@ class Q_DECL_HIDDEN PostSearchJob::Private
const QString &query,
PostSearchJob *parent);
QString blogId;
QString query;
bool fetchBodies;
const QString blogId;
const QString query;
bool fetchBodies = true;
private:
PostSearchJob *const q;
......
......@@ -26,9 +26,9 @@ public:
, timeMax(timeMax)
{}
QString id;
QDateTime timeMin;
QDateTime timeMax;
const QString id;
const QDateTime timeMin;
const QDateTime timeMax;
FreeBusyQueryJob::BusyRangeList busy;
};
......
......@@ -22,11 +22,11 @@ class Q_DECL_HIDDEN Contact::Private
{
public:
Private() : deleted(false) { }
Private() { }
Private(const Private &other);
~Private() { }
bool deleted;
bool deleted = false;
QUrl photoUrl;
/* group URI, isDeleted */
......
......@@ -26,9 +26,9 @@ class Q_DECL_HIDDEN ContactFetchJob::Private
QNetworkRequest createRequest(const QUrl &url);
bool fetchDeleted;
bool fetchDeleted = true;
QString contactId;
quint64 timestamp;
quint64 timestamp = 0;
QString filter;
private:
......@@ -36,8 +36,6 @@ class Q_DECL_HIDDEN ContactFetchJob::Private
};
ContactFetchJob::Private::Private(ContactFetchJob *parent):
fetchDeleted(true),
timestamp(0),
q(parent)
{
}
......
......@@ -23,12 +23,11 @@ class Q_DECL_HIDDEN ContactsGroup::Private
QString title;
QString content;
QDateTime updated;
bool isSystemGroup;
bool isSystemGroup = false;
};
ContactsGroup::Private::Private():
isSystemGroup(false)
ContactsGroup::Private::Private()
{
}
......
......@@ -36,13 +36,12 @@ public:
QString locale;
QString timezone;
bool verifiedEmail;
bool verifiedEmail = false;
QString pictureUrl;
};
AccountInfo::Private::Private():
verifiedEmail(false)
AccountInfo::Private::Private()
{
}
......
......@@ -45,7 +45,7 @@ class Q_DECL_HIDDEN AuthJob::Private
AccountPtr account;
QString apiKey;
QString secretKey;
QWidget* widget;
QWidget* widget = nullptr;
QString username;
QString password;
......@@ -56,7 +56,6 @@ class Q_DECL_HIDDEN AuthJob::Private
};
AuthJob::Private::Private(AuthJob *parent):
widget(nullptr),
q(parent)
{
}
......
......@@ -20,16 +20,10 @@ using namespace KGAPI2;
class Q_DECL_HIDDEN NewTokensFetchJob::Private
{
public:
Private()
: expiresIn(0)
{
}
QString tmpToken;
QString apiKey;
QString secretKey;
int localPort;
int localPort = 0;
QString accessToken;
QString refreshToken;
......
......@@ -25,15 +25,12 @@ class Q_DECL_HIDDEN AboutFetchJob::Private
public:
Private();
bool includeSubscribed;
qlonglong maxChangeIdCount;
qlonglong startChangeId;
bool includeSubscribed = true;
qlonglong maxChangeIdCount = 0;
qlonglong startChangeId = 0;
};
AboutFetchJob::Private::Private():
includeSubscribed(true),
maxChangeIdCount(0),
startChangeId(0)
AboutFetchJob::Private::Private()
{
}
......
......@@ -21,14 +21,13 @@ class Q_DECL_HIDDEN App::Icon::Private
Private(const Private &other);
Category category;
int size;
int size = -1;
QUrl iconUrl;
static Category categoryFromName(const QString &categoryName);
};
App::Icon::Private::Private():
size(-1)
App::Icon::Private::Private()
{
}
......
......@@ -20,18 +20,16 @@ class Q_DECL_HIDDEN Change::Private
Private();
Private(const Private &other);
qlonglong id;
qlonglong id = -1;
QString fileId;
QUrl selfLink;
bool deleted;
bool deleted = false;
FilePtr file;
static ChangePtr fromJSON(const QVariantMap &map);
};
Change::Private::Private():
id(-1),
deleted(false)
Change::Private::Private()
{
}
......
......@@ -27,24 +27,18 @@ class Q_DECL_HIDDEN ChangeFetchJob::Private
QString changeId;
bool includeDeleted;
bool includeSubscribed;
int maxResults;
qlonglong startChangeId;
bool includeItemsFromAllDrives;
bool supportsAllDrives;
bool includeDeleted = true;
bool includeSubscribed = true;
int maxResults = 0;
qlonglong startChangeId = 0;
bool includeItemsFromAllDrives = true;
bool supportsAllDrives = true;
private:
ChangeFetchJob *const q;
};
ChangeFetchJob::Private::Private(ChangeFetchJob *parent):
includeDeleted(true),
includeSubscribed(true),
maxResults(0),
startChangeId(0),
includeItemsFromAllDrives(true),
supportsAllDrives(true),
q(parent)
{
}
......
......@@ -28,14 +28,13 @@ class Q_DECL_HIDDEN ChildReferenceCreateJob::Private
QString folderId;
ChildReferencesList references;
bool supportsAllDrives;
bool supportsAllDrives = true;
private:
ChildReferenceCreateJob *const q;
};
ChildReferenceCreateJob::Private::Private(ChildReferenceCreateJob *parent):
supportsAllDrives(true),
q(parent)
{
}
......
......@@ -25,19 +25,14 @@ class Q_DECL_HIDDEN File::Labels::Private
Private();
Private(const Private &other);
bool starred;
bool hidden;
bool trashed;
bool restricted;
bool viewed;
bool starred = false;
bool hidden = false;
bool trashed = false;
bool restricted = false;
bool viewed = false;
};
File::Labels::Private::Private():
starred(false),
hidden(false),
trashed(false),
restricted(false),
viewed(false)
File::Labels::Private::Private()
{
}
......
......@@ -20,25 +20,19 @@ class Q_DECL_HIDDEN FileAbstractDataJob::Private
public:
Private();
bool convert;
bool enforceSingleParent;
bool convert = false;
bool enforceSingleParent = false;
QString includePermissionsForView;
bool ocr;
bool ocr = false;
QString ocrLanguage;
bool pinned;
bool supportsAllDrives;
bool pinned = false;
bool supportsAllDrives = true;
QString timedTextLanguage;
QString timedTextTrackName;
bool useContentAsIndexableText;
bool useContentAsIndexableText = false;
};
FileAbstractDataJob::Private::Private():
convert(false),
enforceSingleParent(false),
ocr(false),
pinned(false),
supportsAllDrives(true),
useContentAsIndexableText(false)
FileAbstractDataJob::Private::Private()
{
}
......
......@@ -28,14 +28,13 @@ class Q_DECL_HIDDEN FileAbstractModifyJob::Private
QStringList filesIds;
bool supportsAllDrives;
bool supportsAllDrives = true;
private:
FileAbstractModifyJob *const q;
};
FileAbstractModifyJob::Private::Private(FileAbstractModifyJob *parent):
supportsAllDrives(true),
q(parent)
{
}
......
......@@ -39,7 +39,7 @@ class Q_DECL_HIDDEN FileAbstractUploadJob::Private
void _k_uploadProgress(qint64 bytesSent, qint64 totalBytes);
int originalFilesCount;
int originalFilesCount = 0;
QMap<QString, FilePtr> files;
QMap<QString, FilePtr> uploadedFiles;
......@@ -51,7 +51,6 @@ class Q_DECL_HIDDEN FileAbstractUploadJob::Private
};
FileAbstractUploadJob::Private::Private(FileAbstractUploadJob *parent):
originalFilesCount(0),
q(parent)
{
}
......
......@@ -29,11 +29,11 @@ class Q_DECL_HIDDEN FileFetchJob::Private
FileSearchQuery searchQuery;
QStringList filesIDs;
bool isFeed;
bool includeItemsFromAllDrives;
bool supportsAllDrives;
bool isFeed = false;
bool includeItemsFromAllDrives = true;
bool supportsAllDrives = true;
bool updateViewedDate;
bool updateViewedDate = false;
QStringList fields;
......@@ -42,10 +42,6 @@ class Q_DECL_HIDDEN FileFetchJob::Private
};
FileFetchJob::Private::Private(FileFetchJob *parent):
isFeed(false),
includeItemsFromAllDrives(true),
supportsAllDrives(true),
updateViewedDate(false),
q(parent)
{
}
......
......@@ -26,15 +26,12 @@ class Q_DECL_HIDDEN FileModifyJob::Private
QMap < QString /* filepath */, QString /* fileId */ > files;
bool createNewRevision;
bool changeModifiedDate;
bool updateViewedDate;
bool createNewRevision = true;
bool changeModifiedDate = false;
bool updateViewedDate = true;
};
FileModifyJob::Private::Private():
createNewRevision(true),
changeModifiedDate(false),