Closed Bug 520667 Opened 11 years ago Closed 9 years ago

Pressing Select All (Ctrl + A) in the tasks view selects all the items in the calendar view

Categories

(Calendar :: Calendar Views, defect, critical)

defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mlissner+bugzilla, Assigned: philmsgs)

References

(Blocks 1 open bug)

Details

(Keywords: dataloss, Whiteboard: [not needed beta][no l10n impact])

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20090930 Ubuntu/9.04 (jaunty) Firefox/3.5.2
Build Identifier: 1.0 pre

The summary + steps to reproduce should pretty much explain it.

Reproducible: Always

Steps to Reproduce:
1. Open the calendar tab in Tb3+
2. Set it so you can see more than one event (selecting a week view is probably most dramatic)
3. Open the tasks tab
4. Press Ctrl + A to select all the tasks
5. Switch back to the calendar tab
6. Be startled that all your calendar items have turned yellow
7. Realize that they're not yellow, they're just all selected
8. File a bug.


Expected Results:  
Select all in the tasks tab should select all the TASKS, not all the calendar items across all calendars.
Flags: wanted-calendar1.0?
Flags: blocking-calendar1.0?
Confirmed using Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.4pre) Gecko/20090915 Lightning/1.0pre Thunderbird/3.0b4 with Lightning nightly build 20091026, but just for day/week view, not multiweek/month view.
Status: UNCONFIRMED → NEW
Component: General → Calendar Views
Ever confirmed: true
Flags: wanted-calendar1.0?
OS: Linux → All
QA Contact: general → views
Hardware: x86 → All
Flags: blocking-calendar1.0? → blocking-calendar1.0+
Whiteboard: [not needed beta][no l10n impact]
I heard of a user that tried to delete all his completed task by:

1- Setting Show to "Completed Task".
2- Select All.
3- Press <Del>.

and found out that this had actually deleted all his events for the current week!

In short, the consequence of this issue can be quite severe.
I'll try to get this fixed together with bug 527254.
Severity: normal → critical
Keywords: dataloss
My code analysis shows at least 2 problems.

In the function 'selectAllEvents' file 'calendar-views.js', a filter is constructed.
For tasks, the value is positioned with composite.ITEM_FILTER_TYPE_ALL.
composite.ITEM_FILTER_TYPE_TODO should be used. 

currentView().tasksInView is set to true only when the option 'Show Tasks in Calendar'is selected. it can be selected when calendar view is active.

Replacing:
filter |= composite.ITEM_FILTER_TYPE_ALL;
by:
filter |= composite.ITEM_FILTER_TYPE_TODO;

and
if (currentView().tasksInView) {
by
var menuTask=document.getElementById("ltnMenuSwitchToTask");
if ("true"==menuTask.getAttribute("checked")) {

From tasks view, ctrl + a no longer selects the events.
However, the tasks are not selected, although the result in 'onOperationComplete' indicates a number> 0. 
Maybe a problem with:
currentView (). setSelectedItems
In the task view, selectAllEvents shouldn't be called at all, is that the case? This bug is about the task view and shouldn't have to do with the calendar view at all.
If you select "Select | All" from the Edit menu or simply type Ctrl+A while in the task view, all the date-time events in the calendar view will be selected. Note that day events are NOT selected.
philipp,
yes you are right, selectAllEvents shouldn't be called at all when taskView is selected.

i saw that the command controller is the same for calendar and task view (file calendar-common-sets.js : calendarController2). On cmd_selectAll command, selectAllEvents is called.

I've made a patch that change selectAllEvents by a new function selectAllItems witch call selectAllEvents in case where calendar view is active, or selectAllTasks (new function) when taskView is active. 

selectAllTasks mark all task selected in task tree.

After some tests, i found another problem.
If we have one or more events selected, switching to mail view or task view and hitting del will delete selected items.
Comment on attachment 529984 [details] [diff] [review]
patch that select task items from task view on typing ctrl+A

Putting this patch in Philipp's queue, so it doesn't get lost. ;)
Attachment #529984 - Flags: review?(philipp)
Assignee: nobody → philippe.martinak
Status: NEW → ASSIGNED
Comment on attachment 529984 [details] [diff] [review]
patch that select task items from task view on typing ctrl+A

r=philipp
Attachment #529984 - Flags: review?(philipp) → review+
Comment on attachment 529984 [details] [diff] [review]
patch that select task items from task view on typing ctrl+A

Actually, I'm going to check in something slightly different, since this patch will cause problems when selecting tasks in the mail mode today pane.
Pushed to comm-central <http://hg.mozilla.org/comm-central/rev/ebd9fe591823>
-> FIXED
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Trunk
Backported to comm-miramar <http://hg.mozilla.org/releases/comm-miramar/rev/b22098d9344b>
Target Milestone: Trunk → 1.0b4
You need to log in before you can comment on or make changes to this bug.