Bug 181337 - Dolphin does not honor the "first day of the week" setting in the icon+group view sorted by date
Summary: Dolphin does not honor the "first day of the week" setting in the icon+group ...
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: view-engine: icons mode (show other bugs)
Version: 2.1
Platform: Chakra Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords: reproducible, triaged
Depends on:
Blocks:
 
Reported: 2009-01-19 20:27 UTC by max
Modified: 2013-03-03 17:27 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.11


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description max 2009-01-19 20:27:27 UTC
Version:           1.1 (using 4.1.4 (KDE 4.1.4), Kubuntu packages)
Compiler:          cc
OS:                Linux (i686) release 2.6.27-11-generic

view mode is Icons, grouped and sorted by date
kde regional setting for first day of the week is Sunday.
files are still grouped by weeks that start on Monday.
thank you
Comment 1 Dario Andres 2009-10-23 01:12:00 UTC
This seems to be still "valid" here using:

Qt: 4.6.0 (Qt git branch 4.6 commit 52aef13521af2137db15ee878893f5c5150471e5
        Date:   Mon Oct 12 14:18:51 2009 +1000)
KDE: 4.3.72 (KDE 4.3.72 (KDE 4.4 >= 20091015))
kdelibs svn rev. 1038788 / kdebase svn rev. 1038788
on ArchLinux i686 - Kernel 2.6.30.6

If I set the week to start on "Tuesday" and I have some files edited this week on the Monday (so they should be considered from "Last Week"), in the group(icon) view they appear under "Monday" instead of under "Last Week"

The current algorithm only counts the week difference but it doesn't consider the day the week starts:

if (currentDate.year() == modifiedDate.year() && currentDate.month() == modifiedDate.month()) {
   switch (currentWeek - modifiedWeek) {
    case 0:
    case 1:
    case n:
...
Comment 2 Jeroen van Meeuwen (Kolab Systems) 2012-08-24 16:19:43 UTC
Resetting assignee to default as per bug #305719
Comment 3 Adrián Chaves (Gallaecio) 2012-10-26 21:11:25 UTC
Steps to reproduce:

1. Change your system’s regional settings to Sunday is the first day of the week.
2. Open Dolphin. Reopen if it was open already, for the regional settings to take effect.
3. Adjust the following Dolphin view settings:
    3.1. View Mode to “Icons”.
    3.2 Sort By to “Date”.
    3.3 Mark “Sort by Groups”.
4. Run the following Bash script (on a Tuesday-Saturday):
#!/bin/bash
for DAY in "Last Saturday" "Last Sunday" "Last Monday" "Today"
do
    touch "$DAY" --date="$DAY"
done

Expected results: 
    - “Last Saturday” under “Last Week”.
    - “Last Sunday” under “Sunday”.
    - “Last Monday” under “Monday” (or “Yesterday” if testing on Tuesday).
    - “Today” under “Today”.
Actual results: 
    - “Last Saturday” under “Last Week”.
    - “Last Sunday” under “Last Week”.
    - “Last Monday” under “Monday” (or “Yesterday” if testing on Tuesday).
    - “Today” under “Today”.
Comment 4 Daniel Kreuter 2013-01-28 21:08:42 UTC
Hi,

thanks for the howto reproduce steps. I've reproduced it myself and already found the code which causes this problem.
I have a solution in mind but will at first need to find out what the code is actually doing before starting implementing the fix.
I'm on it.

Regards
Comment 5 Frank Reininghaus 2013-03-03 17:27:54 UTC
Git commit d7845775624999742f793a16e04531d50f4b450c by Frank Reininghaus, on behalf of Daniel Kreuter.
Committed on 03/03/2013 at 18:20.
Pushed by freininghaus into branch 'master'.

Use a consistent way to group files by "Date"

Before this change, files were grouped by calendar weeks if they were
modified in the current month and ignoring the "first week day setting",
but by the actual distance measured in multiples of seven days if the
were modified last month.

This not only fixes the "ignores first week day" bug, but also the
problem that the inconsistencies in the algorithm could lead to a broken
grouping in the first days of a month (see screenshot in the review
request).
FIXED-IN: 4.11
REVIEW: 108667

M  +3    -20   dolphin/src/kitemviews/kfileitemmodel.cpp

http://commits.kde.org/kde-baseapps/d7845775624999742f793a16e04531d50f4b450c