mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
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
This commit is contained in:
parent
5194a032ac
commit
3fc700f042
1 changed files with 13 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue