]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fixed incorrect grouping of dates. Thanks to Jacopo De Simoi for the patch!
authorPeter Penz <peter.penz19@gmail.com>
Thu, 26 Mar 2009 18:05:41 +0000 (18:05 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 26 Mar 2009 18:05:41 +0000 (18:05 +0000)
BUG: 187958

svn path=/trunk/KDE/kdebase/apps/; revision=945024

src/dolphinmodel.cpp

index 76bd86264693c17c562479aa13b6b3777f893564..bb1fd36dda4f354f37392f4daa7524da109596e2 100644 (file)
@@ -221,8 +221,7 @@ QVariant DolphinModel::displayRoleData(const QModelIndex& index) const
             modifiedWeek = 53;
         }
 
-        if (currentDate.year() == modifiedDate.year() &&
-            currentDate.month() == modifiedDate.month()) {
+        if (currentDate.year() == modifiedDate.year() && currentDate.month() == modifiedDate.month()) {
             switch (currentWeek - modifiedWeek) {
             case 0:
                 switch (daysDistance) {
@@ -248,7 +247,8 @@ QVariant DolphinModel::displayRoleData(const QModelIndex& index) const
                 Q_ASSERT(false);
             }
         } else {
-            if (daysDistance <= (currentDate.day() + modifiedDate.daysInMonth())) {
+            const QDate lastMonthDate = currentDate.addMonths(-1);
+            if  (lastMonthDate.year() == modifiedDate.year() && lastMonthDate.month() == modifiedDate.month()) {
                 if (daysDistance == 1) {
                     retString = i18nc("@title:group Date: %B is full month name in current locale, and %Y is full year number", "Yesterday (%B, %Y)");
                 } else if (daysDistance <= 7) {