Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow build with Qt6 #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.qmake.stash
*.o
moc_*
*.moc
Makefile
*.prl
*.so
*.so.*
*.qm


# project specific
src/qml/socialcache.ts
src/lib/pkgconfig/
tests/tst_abstractsocialcachedatabase/tst_abstractsocialcachedatabase
tests/tst_dropboximage/tst_dropboximage
tests/tst_facebookcontact/tst_facebookcontact
tests/tst_facebookimage/tst_facebookimage
tests/tst_facebooknotification/tst_facebooknotification
tests/tst_facebookpost/tst_facebookpost
tests/tst_onedriveimage/tst_onedriveimage
tests/tst_socialimage/tst_socialimage
tests/tst_socialnetworksync/tst_socialnetworksync
tests/tst_twitterpost/tst_twitterpost
8 changes: 8 additions & 0 deletions src/lib/abstractsocialpostcachedatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,11 @@ bool AbstractSocialPostCacheDatabase::read()
QString body = postQuery.value(2).toString();
int timestamp = postQuery.value(3).toInt();
SocialPost::Ptr post = SocialPost::create(identifier, name, body,
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(timestamp));
#else
QDateTime::fromTime_t(timestamp));
#endif

imageQuery.bindValue(":postId", identifier);

Expand Down Expand Up @@ -579,7 +583,11 @@ bool AbstractSocialPostCacheDatabase::write()
posts.postIds.append(postId);
posts.names.append(post->name());
posts.bodies.append(post->body());
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
posts.timestamps.append(post->timestamp().toSecsSinceEpoch());
#else
posts.timestamps.append(post->timestamp().toTime_t());
#endif

const QMap<int, SocialPostImage::ConstPtr> postImages = post->allImages();
typedef QMap<int, SocialPostImage::ConstPtr>::const_iterator iterator;
Expand Down
42 changes: 42 additions & 0 deletions src/lib/dropboximagesdatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,13 @@ QList<DropboxImage::ConstPtr> DropboxImagesDatabasePrivate::queryImages(const QS
while (query.next()) {
data.append(DropboxImage::create(query.value(0).toString(), query.value(1).toString(),
query.value(2).toString(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(3).toUInt()),
QDateTime::fromSecsSinceEpoch(query.value(4).toUInt()),
#else
QDateTime::fromTime_t(query.value(3).toUInt()),
QDateTime::fromTime_t(query.value(4).toUInt()),
#endif
query.value(5).toString(),
query.value(6).toInt(), query.value(7).toInt(),
query.value(8).toString(), query.value(9).toString(),
Expand Down Expand Up @@ -551,7 +556,11 @@ DropboxUser::ConstPtr DropboxImagesDatabase::user(const QString &userId) const

DropboxUser::ConstPtr user = DropboxUser::create(
query.value(0).toString(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(1).toUInt()),
#else
QDateTime::fromTime_t(query.value(1).toUInt()),
#endif
query.value(2).toString());

query.finish();
Expand Down Expand Up @@ -597,7 +606,11 @@ QList<DropboxUser::ConstPtr> DropboxImagesDatabasePrivate::queryUsers() const

while (query.next()) {
data.append(DropboxUser::create(query.value(0).toString(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(1).toUInt()),
#else
QDateTime::fromTime_t(query.value(1).toUInt()),
#endif
query.value(2).toString(), query.value(3).toInt()));
}
return data;
Expand Down Expand Up @@ -674,8 +687,13 @@ DropboxAlbum::ConstPtr DropboxImagesDatabase::album(const QString &albumId) cons
}

DropboxAlbum::ConstPtr album = DropboxAlbum::create(query.value(0).toString(), query.value(1).toString(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(2).toUInt()),
QDateTime::fromSecsSinceEpoch(query.value(3).toUInt()),
#else
QDateTime::fromTime_t(query.value(2).toUInt()),
QDateTime::fromTime_t(query.value(3).toUInt()),
#endif
query.value(4).toString(), query.value(5).toInt(),
query.value(6).toString());

Expand Down Expand Up @@ -738,8 +756,13 @@ QList<DropboxAlbum::ConstPtr> DropboxImagesDatabasePrivate::queryAlbums(const QS

while (query.next()) {
data.append(DropboxAlbum::create(query.value(0).toString(), query.value(1).toString(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(2).toUInt()),
QDateTime::fromSecsSinceEpoch(query.value(3).toUInt()),
#else
QDateTime::fromTime_t(query.value(2).toUInt()),
QDateTime::fromTime_t(query.value(3).toUInt()),
#endif
query.value(4).toString(), query.value(5).toInt(),
query.value(6).toString()));
}
Expand Down Expand Up @@ -817,8 +840,13 @@ DropboxImage::ConstPtr DropboxImagesDatabase::image(const QString &imageId) cons

return DropboxImage::create(query.value(0).toString(), query.value(1).toString(),
query.value(2).toString(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(3).toUInt()),
QDateTime::fromSecsSinceEpoch(query.value(4).toUInt()),
#else
QDateTime::fromTime_t(query.value(3).toUInt()),
QDateTime::fromTime_t(query.value(4).toUInt()),
#endif
query.value(5).toString(),
query.value(6).toInt(), query.value(7).toInt(),
query.value(8).toString(), query.value(9).toString(),
Expand Down Expand Up @@ -1169,7 +1197,11 @@ bool DropboxImagesDatabase::write()

Q_FOREACH (const DropboxUser::ConstPtr &user, insertUsers) {
userIds.append(user->userId());
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
updatedTimes.append(user->updatedTime().toSecsSinceEpoch());
#else
updatedTimes.append(user->updatedTime().toTime_t());
#endif
usernames.append(user->userName());
}

Expand All @@ -1194,8 +1226,13 @@ bool DropboxImagesDatabase::write()
Q_FOREACH (const DropboxAlbum::ConstPtr &album, insertAlbums) {
albumIds.append(album->albumId());
userIds.append(album->userId());
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
createdTimes.append(album->createdTime().toSecsSinceEpoch());
updatedTimes.append(album->updatedTime().toSecsSinceEpoch());
#else
createdTimes.append(album->createdTime().toTime_t());
updatedTimes.append(album->updatedTime().toTime_t());
#endif
albumNames.append(album->albumName());
imageCounts.append(album->imageCount());
hashes.append(album->hash());
Expand Down Expand Up @@ -1229,8 +1266,13 @@ bool DropboxImagesDatabase::write()
imageIds.append(image->imageId());
albumIds.append(image->albumId());
userIds.append(image->userId());
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
createdTimes.append(image->createdTime().toSecsSinceEpoch());
updatedTimes.append(image->updatedTime().toSecsSinceEpoch());
#else
createdTimes.append(image->createdTime().toTime_t());
updatedTimes.append(image->updatedTime().toTime_t());
#endif
imageNames.append(image->imageName());
widths.append(image->width());
heights.append(image->height());
Expand Down
42 changes: 42 additions & 0 deletions src/lib/facebookimagesdatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,13 @@ QList<FacebookImage::ConstPtr> FacebookImagesDatabasePrivate::queryImages(const
while (query.next()) {
data.append(FacebookImage::create(query.value(0).toString(), query.value(1).toString(),
query.value(2).toString(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(3).toUInt()),
QDateTime::fromSecsSinceEpoch(query.value(4).toUInt()),
#else
QDateTime::fromTime_t(query.value(3).toUInt()),
QDateTime::fromTime_t(query.value(4).toUInt()),
#endif
query.value(5).toString(),
query.value(6).toInt(), query.value(7).toInt(),
query.value(8).toString(), query.value(9).toString(),
Expand Down Expand Up @@ -533,7 +538,11 @@ FacebookUser::ConstPtr FacebookImagesDatabase::user(const QString &fbUserId) con

FacebookUser::ConstPtr user = FacebookUser::create(
query.value(0).toString(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(1).toUInt()),
#else
QDateTime::fromTime_t(query.value(1).toUInt()),
#endif
query.value(2).toString());

query.finish();
Expand Down Expand Up @@ -579,7 +588,11 @@ QList<FacebookUser::ConstPtr> FacebookImagesDatabasePrivate::queryUsers() const

while (query.next()) {
data.append(FacebookUser::create(query.value(0).toString(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(1).toUInt()),
#else
QDateTime::fromTime_t(query.value(1).toUInt()),
#endif
query.value(2).toString(), query.value(3).toInt()));
}

Expand Down Expand Up @@ -659,8 +672,13 @@ FacebookAlbum::ConstPtr FacebookImagesDatabase::album(const QString &fbAlbumId)
}

FacebookAlbum::ConstPtr album = FacebookAlbum::create(query.value(0).toString(), query.value(1).toString(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(2).toUInt()),
QDateTime::fromSecsSinceEpoch(query.value(3).toUInt()),
#else
QDateTime::fromTime_t(query.value(2).toUInt()),
QDateTime::fromTime_t(query.value(3).toUInt()),
#endif
query.value(4).toString(), query.value(5).toInt());

query.finish();
Expand Down Expand Up @@ -723,8 +741,13 @@ QList<FacebookAlbum::ConstPtr> FacebookImagesDatabasePrivate::queryAlbums(const

while (query.next()) {
data.append(FacebookAlbum::create(query.value(0).toString(), query.value(1).toString(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(2).toUInt()),
QDateTime::fromSecsSinceEpoch(query.value(3).toUInt()),
#else
QDateTime::fromTime_t(query.value(2).toUInt()),
QDateTime::fromTime_t(query.value(3).toUInt()),
#endif
query.value(4).toString(), query.value(5).toInt()));
}

Expand Down Expand Up @@ -805,8 +828,13 @@ FacebookImage::ConstPtr FacebookImagesDatabase::image(const QString &fbImageId)

return FacebookImage::create(query.value(0).toString(), query.value(1).toString(),
query.value(2).toString(),
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(3).toUInt()),
QDateTime::fromSecsSinceEpoch(query.value(4).toUInt()),
#else
QDateTime::fromTime_t(query.value(3).toUInt()),
QDateTime::fromTime_t(query.value(4).toUInt()),
#endif
query.value(5).toString(),
query.value(6).toInt(), query.value(7).toInt(),
query.value(8).toString(), query.value(9).toString(),
Expand Down Expand Up @@ -1156,7 +1184,11 @@ bool FacebookImagesDatabase::write()

Q_FOREACH (const FacebookUser::ConstPtr &user, insertUsers) {
userIds.append(user->fbUserId());
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
updatedTimes.append(user->updatedTime().toSecsSinceEpoch());
#else
updatedTimes.append(user->updatedTime().toTime_t());
#endif
usernames.append(user->userName());
}

Expand All @@ -1180,8 +1212,13 @@ bool FacebookImagesDatabase::write()
Q_FOREACH (const FacebookAlbum::ConstPtr &album, insertAlbums) {
albumIds.append(album->fbAlbumId());
userIds.append(album->fbUserId());
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
createdTimes.append(album->createdTime().toSecsSinceEpoch());
updatedTimes.append(album->updatedTime().toSecsSinceEpoch());
#else
createdTimes.append(album->createdTime().toTime_t());
updatedTimes.append(album->updatedTime().toTime_t());
#endif
albumNames.append(album->albumName());
imageCounts.append(album->imageCount());
}
Expand Down Expand Up @@ -1212,8 +1249,13 @@ bool FacebookImagesDatabase::write()
imageIds.append(image->fbImageId());
albumIds.append(image->fbAlbumId());
userIds.append(image->fbUserId());
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
createdTimes.append(image->createdTime().toSecsSinceEpoch());
updatedTimes.append(image->updatedTime().toSecsSinceEpoch());
#else
createdTimes.append(image->createdTime().toTime_t());
updatedTimes.append(image->updatedTime().toTime_t());
#endif
imageNames.append(image->imageName());
widths.append(image->width());
heights.append(image->height());
Expand Down
14 changes: 14 additions & 0 deletions src/lib/facebooknotificationsdatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,13 @@ QList<FacebookNotification::ConstPtr> FacebookNotificationsDatabase::notificatio
data.append(FacebookNotification::create(query.value(0).toString(), // facebookId
query.value(2).toString(), // from
query.value(3).toString(), // to
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
QDateTime::fromSecsSinceEpoch(query.value(4).toInt()), // createdTime
QDateTime::fromSecsSinceEpoch(query.value(5).toInt()), // updatedTime
#else
QDateTime::fromTime_t(query.value(4).toInt()), // createdTime
QDateTime::fromTime_t(query.value(5).toInt()), // updatedTime
#endif
query.value(6).toString(), // title
query.value(7).toString(), // link
query.value(8).toString(), // application
Expand Down Expand Up @@ -446,8 +451,13 @@ bool FacebookNotificationsDatabase::write()
accountIds.append(notification->accountId());
fromStrings.append(notification->from());
toStrings.append(notification->to());
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
createdTimes.append(notification->createdTime().toSecsSinceEpoch());
updatedTimes.append(notification->updatedTime().toSecsSinceEpoch());
#else
createdTimes.append(notification->createdTime().toTime_t());
updatedTimes.append(notification->updatedTime().toTime_t());
#endif
titles.append(notification->title());
links.append(notification->link());
applications.append(notification->application());
Expand Down Expand Up @@ -481,7 +491,11 @@ bool FacebookNotificationsDatabase::write()
if (d->purgeTimeLimit > 0) {
QVariantList limits;
// purge notifications older than expirationTime in days
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
const quint32 limit = QDateTime::currentDateTime().toSecsSinceEpoch() - d->purgeTimeLimit * 24 * 60 * 60;
#else
const quint32 limit = QDateTime::currentDateTime().toTime_t() - d->purgeTimeLimit * 24 * 60 * 60;
#endif
limits.append(limit);
query = prepare(QStringLiteral("DELETE FROM notifications WHERE updatedTime < :timeLimit"));
query.bindValue(QStringLiteral(":timeLimit"), limits);
Expand Down
Loading