[frameworks/baloo] src/lib: Revert "Port away from deprecated QDateTime(QDate) constructor"

Ben Cooksley null at kde.org
Fri Apr 2 18:00:48 BST 2021


Git commit c0e3ecdfdeb147146093baef045912c6342824b7 by Ben Cooksley.
Committed on 02/04/2021 at 16:59.
Pushed by bcooksley into branch 'master'.

Revert "Port away from deprecated QDateTime(QDate) constructor"

This causes a failure to build from source on MSVC as pointed out by the CI system.
Because Baloo is a Framework, leaving this broken is not an option as it breaks the ability to complete Dependency Builds and thus the ability to provide Windows CI to all other KDE projects.
Therefore revert this for now until a proper fix can be implemented - preferrably by going through review.

This reverts commit 23c8e99e1c8144472e2f3a1cdd3d9a2603af4193.

CCMAIL: kde-frameworks-devel at kde.org

M  +6    -6    src/lib/searchstore.cpp

https://invent.kde.org/frameworks/baloo/commit/c0e3ecdfdeb147146093baef045912c6342824b7

diff --git a/src/lib/searchstore.cpp b/src/lib/searchstore.cpp
index 76893bba..683a6a68 100644
--- a/src/lib/searchstore.cpp
+++ b/src/lib/searchstore.cpp
@@ -34,12 +34,8 @@ namespace {
 QPair<quint32, quint32> calculateTimeRange(const QDateTime& dt, Term::Comparator com)
 {
     Q_ASSERT(dt.isValid());
-
-    if (com == Term::Equal) {
-        return {dt.date().startOfDay().toSecsSinceEpoch(), dt.date().endOfDay().toSecsSinceEpoch()};
-    }
-
     quint32 timet = dt.toSecsSinceEpoch();
+
     if (com == Term::LessEqual) {
         return {0, timet};
     }
@@ -52,6 +48,10 @@ QPair<quint32, quint32> calculateTimeRange(const QDateTime& dt, Term::Comparator
     if (com == Term::Greater) {
         return {timet + 1, std::numeric_limits<quint32>::max()};
     }
+    if (com == Term::Equal) {
+        timet = QDateTime(dt.date()).toSecsSinceEpoch();
+        return {timet, timet + 24 * 60 * 60 - 1};
+    }
 
     Q_ASSERT_X(0, __func__, "mtime query must contain a valid comparator");
     return {0, 0};
@@ -264,7 +264,7 @@ PostingIterator* SearchStore::constructQuery(Transaction* tr, const Term& term)
                 endDate.setDate(endDate.year(), endDate.month(), endDate.daysInMonth());
             }
 
-            return tr->mTimeRangeIter(startDate.startOfDay().toSecsSinceEpoch(), endDate.endOfDay().toSecsSinceEpoch());
+            return tr->mTimeRangeIter(QDateTime(startDate).toSecsSinceEpoch(), QDateTime(endDate, QTime(23, 59, 59)).toSecsSinceEpoch());
         }
         else if (value.type() == QVariant::String) {
             const QDateTime dt = value.toDateTime();


More information about the Kde-frameworks-devel mailing list