┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-12-30 14:48:18 +0000
committerPeter Penz <[email protected]>2008-12-30 14:48:18 +0000
commit3fc700f0421f801c4c89c075155009ce67667f10 (patch)
tree0edcbf8c612581e4ba7dc6add213a693cc536b21
parent5194a032ac75194c67199a8dc2c0edc526f04df1 (diff)
fixed crash when enabling grouping by date and having dates like
30 December 2008 (is "Week 1" (of 2009 , but for 2008 too)) 28 December 2008 (is "Week 52" (of 2008) ) Thanks to Darío Andrés for the patch! BUG: 179019 svn path=/trunk/KDE/kdebase/apps/; revision=903432
-rw-r--r--src/dolphinmodel.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/dolphinmodel.cpp b/src/dolphinmodel.cpp
index 1cd5ad663..76bd86264 100644
--- a/src/dolphinmodel.cpp
+++ b/src/dolphinmodel.cpp
@@ -208,8 +208,18 @@ QVariant DolphinModel::displayRoleData(const QModelIndex& index) const
const QDate modifiedDate = modifiedTime.date();
const int daysDistance = modifiedDate.daysTo(currentDate);
- const int currentWeek = currentDate.weekNumber();
- const int modifiedWeek = modifiedDate.weekNumber();
+
+ int yearForCurrentWeek = 0;
+ int currentWeek = currentDate.weekNumber(&yearForCurrentWeek);
+ if (yearForCurrentWeek == currentDate.year() + 1) {
+ currentWeek = 53;
+ }
+
+ int yearForModifiedWeek = 0;
+ int modifiedWeek = modifiedDate.weekNumber(&yearForModifiedWeek);
+ if (yearForModifiedWeek == modifiedDate.year() + 1) {
+ modifiedWeek = 53;
+ }
if (currentDate.year() == modifiedDate.year() &&
currentDate.month() == modifiedDate.month()) {
@@ -231,6 +241,7 @@ QVariant DolphinModel::displayRoleData(const QModelIndex& index) const
retString = i18nc("@title:group Date", "Three Weeks Ago");
break;
case 4:
+ case 5:
retString = i18nc("@title:group Date", "Earlier this Month");
break;
default: