[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [baloo] src/lib: Fix date filter used by timeline://
From:       Weng Xuetian <wengxt () gmail ! com>
Date:       2015-12-06 5:18:57
Message-ID: E1a5Rir-0006I4-27 () scm ! kde ! org
[Download RAW message or body]

Git commit 2813599eadfedeabd34569cbeb1d8de76adcb9cc by Weng Xuetian.
Committed on 06/12/2015 at 05:16.
Pushed by xuetianweng into branch 'master'.

Fix date filter used by timeline://

timeline:// does not result for month 1 or day 1 because date filter
currently use 1 to represent whole year or whole month. Change it to use
month 0 or day 0 to represent to search whole year or whole month.

REVIEW: 126223

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

http://commits.kde.org/baloo/2813599eadfedeabd34569cbeb1d8de76adcb9cc

diff --git a/src/lib/searchstore.cpp b/src/lib/searchstore.cpp
index 11fbd3f..7103964 100644
--- a/src/lib/searchstore.cpp
+++ b/src/lib/searchstore.cpp
@@ -210,16 +210,18 @@ PostingIterator* SearchStore::constructQuery(Transaction* tr, \
const Term& term)  
             Q_ASSERT(year);
 
-            month = month > 0 && month <= 12 ? month : 1;
-            day = day > 0 && day <= 31 ? day : 1;
+            // uses 0 to represent whole month or whole year
+            month = month >= 0 && month <= 12 ? month : 0;
+            day = day >= 0 && day <= 31 ? day : 0;
 
-            QDate startDate(year, month, day);
+            QDate startDate(year, month ? month : 1, day ? day : 1);
             QDate endDate(startDate);
 
-            if (month == 1)
-                endDate.setDate(endDate.year(), 12, endDate.day());
-            else if (day == 1)
+            if (month == 0) {
+                endDate.setDate(endDate.year(), 12, 31);
+            } else if (day == 0) {
                 endDate.setDate(endDate.year(), endDate.month(), \
endDate.daysInMonth()); +            }
 
             return tr->mTimeRangeIter(QDateTime(startDate).toTime_t(), \
QDateTime(endDate, QTime(23, 59, 59)).toTime_t());  }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic