Commit b12b5453 authored by Laurent Montel's avatar Laurent Montel 😁

Minor optimization

parent ec4989aa
......@@ -165,7 +165,7 @@ private Q_SLOTS:
Collection col = Collection::retrieveById(notification.id());
QCOMPARE(col.name(), newValue.toString());
}
if (!notification.changedParts().intersect({ "ENABLED", "SYNC", "DISPLAY", "INDEX" }).isEmpty()) {
if (notification.changedParts().intersects({ "ENABLED", "SYNC", "DISPLAY", "INDEX" })) {
Collection col = Collection::retrieveById(notification.id());
const bool sync = col.syncPref() == Collection::Undefined ? col.enabled() : col.syncPref() == Collection::True;
QCOMPARE(sync, newValue.toBool());
......
......@@ -220,7 +220,7 @@ void CollectionScheduler::startScheduler()
// Get next collection to expire and start the timer
const uint next = mSchedule.constBegin().key();
// cast next - now() to int, so that we get negative result when next is in the past
mScheduler->start(qMax(0, (int)(next - QDateTime::currentDateTime().toTime_t()) * 1000));
mScheduler->start(qMax(0, (int)(next - QDateTime::currentDateTimeUtc().toTime_t()) * 1000));
}
void CollectionScheduler::scheduleCollection(Collection collection, bool shouldStartScheduler)
......@@ -238,7 +238,7 @@ void CollectionScheduler::scheduleCollection(Collection collection, bool shouldS
}
const int expireMinutes = qMax(mMinInterval, collectionScheduleInterval(collection));
uint nextCheck = QDateTime::currentDateTime().toTime_t() + (expireMinutes * 60);
uint nextCheck = QDateTime::currentDateTimeUtc().toTime_t() + (expireMinutes * 60);
// Check whether there's another check scheduled within a minute after this one.
// If yes, then delay this check so that it's scheduled together with the others
......
......@@ -342,7 +342,7 @@ void SearchManager::updateSearchImpl(const Collection &collection, QSemaphore *c
}
// Query all plugins for search results
SearchRequest request("searchUpdate-" + QByteArray::number(QDateTime::currentDateTime().toTime_t()));
SearchRequest request("searchUpdate-" + QByteArray::number(QDateTime::currentDateTimeUtc().toTime_t()));
request.setCollections(queryCollections);
request.setMimeTypes(queryMimeTypes);
request.setQuery(collection.queryString());
......
......@@ -1373,7 +1373,7 @@ public:
const bool isItemAction = (type == CopyItemToMenu || type == MoveItemToMenu);
const bool isCollectionAction = (type == CopyCollectionToMenu || type == MoveCollectionToMenu);
const bool canContainRequiredMimeTypes = !collection.contentMimeTypes().toSet().intersect(mimeTypes).isEmpty();
const bool canContainRequiredMimeTypes = collection.contentMimeTypes().toSet().intersects(mimeTypes);
const bool canCreateNewItems = (collection.rights() & Collection::CanCreateItem);
const bool canCreateNewCollections = (collection.rights() & Collection::CanCreateCollection);
......
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