Closed Bug 295168 Opened 20 years ago Closed 20 years ago

Task/todo list missing columns for Location, Status, Calendar Name

Categories

(Calendar :: Sunbird Only, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gekacheka, Assigned: mostafah)

References

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Build Identifier: trunk

The task/todo list does not have columns for location, status, or calendar name,
though the event list does have these columns.

Being able to sort by columns can be helpful, e.g., to find all the tasks that
need to be done in a given location, esp. since there is no filter for task list.

Reproducible: Always

Steps to Reproduce:
1. click on columns widget to right of task list column headers.


Actual Results:  
No Location, Status, or CalendarName 

Expected Results:  
Location
Status
CalendarName are included
(patch -l -p 2 -i file.patch)

Adds task list columns for location, status, and calendar name, 
Adds code to get their text values.
Adds code to sort their values.  Status values are sorted in the
order None, Needs-Action, In-Process, Completed, Cancelled 
(chronological order).
Attachment #184284 - Flags: first-review?(mvl)
Comment on attachment 184284 [details] [diff] [review]
Add task list columns for location, status, calendar name

>diff -rubtp -x '*[~#]' mozilla/calendar/resources/content/calendar.xul 
>+            <treecol id="unifinder-todo-tree-col-filename"

Again, don't use filename to display the name of the calendar. It has nothing
to do with files.

>+      case "unifinder-todo-tree-col-status":
>+        return compareNumber(taskStatusIndex(taskA), taskStatusIndex(taskB)) * modifier;

>+function taskStatusIndex(task)
>+{
>+  switch(task.status) {
>+  case "NEEDS-ACTION":  return 1;
>+  case "IN-PROCESS":    return 2;
>+  case "COMPLETED":     return 3;
>+  case "CANCELLED":     return 4;
>+  default:              return 0;
>+  }
>+}

You could use a (global) array here. gTaskStatusIndex['IN-PROCESS']=2 etc.

r=mvl with those changes.
Attachment #184284 - Flags: first-review?(mvl) → first-review+
*** Bug 231014 has been marked as a duplicate of this bug. ***
(In reply to comment #2)
The calling the column the filename is taken from the unifinder code.
I will file a separate bug to change it to calendarname (it involves changing
all the locales).

> >+      case "unifinder-todo-tree-col-status":
> >+        return compareNumber(taskStatusIndex(taskA), taskStatusIndex(taskB))
* modifier;
> 
> >+function taskStatusIndex(task)
> >+{
> >+  switch(task.status) {
> >+  case "NEEDS-ACTION":  return 1;
> >+  case "IN-PROCESS":    return 2;
> >+  case "COMPLETED":     return 3;
> >+  case "CANCELLED":     return 4;
> >+  default:              return 0;
> >+  }
> >+}
> 
> You could use a (global) array here. gTaskStatusIndex['IN-PROCESS']=2 etc.

I don't see the benefit.
The values are constants (specified by rfc2445).
The code would be spread out, separated into an initialization at the top of the
file and a function to look it up.
A function is still useful to handle the default case and avoid undefined warnings.
Equality check should usually fail in one or two characters, so speed should be
comparable to hash table since the number of cases is very short.
> The code would be spread out, separated into an initialization at the top of the
> file and a function to look it up.

No, since you just do array[foo] instead of calling the function. Nothing is
pread out.

> A function is still useful to handle the default case and avoid undefined
warnings.

Ok, that's true. A different way could be to use array.indexOf:
array=["NEEDS-ACTION","IN-PROCESS",etc]; array.indexOf("NEEDS-ACTION"). That
will return -1 if not found, so should work in the undefined case. The benefit
should be that it is faster and needs less code.
Blocks: 295212
(patch -l -p 2 -i file.patch)

This version uses indexof as suggested.
Attachment #184313 - Flags: first-review?(mvl)
Attachment #184284 - Attachment is obsolete: true
Attachment #184313 - Flags: first-review?(mvl) → first-review+
patch checked in
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
QA Contact: gurganbl → sunbird
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: