Closed Bug 362930 Opened 13 years ago Closed 13 years ago

Selected calendar will not be restored after restart

Categories

(Calendar :: Calendar Views, defect)

x86
Windows XP
defect
Not set

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: frank.loehmann, Assigned: thomas.benisch)

References

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1) Gecko/20061010 Firefox/2.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1) Gecko/20061010 Firefox/2.0

The selected calendar is used to create new events by default.

Lightning creates a local default calendar. If the user creates a new calendar (i.e. linked to a network) and selects this calendar after creating it, this calendar selection will not be remembered/restored if Lightning gets restarted. Thus new created events are going to the wrong calendar.

Proposed solution: Restoring the latest selection in the calendar tab would solve this problem.

Reproducible: Always

Steps to Reproduce:
1. Install Lightning 
2. Create calendar from network (i.e. WCAP)
3. Select the new calendar 
4. Close Thunderbird/Lightning
5. Start Thunderbird/Lightning

Actual Results:  
First calendar gets selected after restart.
I'll pre-emptively give a ui-review+ to a patch that does what's described here,   since it makes the calendar act more like a physical object.
*** Bug 363432 has been marked as a duplicate of this bug. ***
Assignee: nobody → thomas.benisch
This patch selects the stored default calendar in the calendar tab list
right after application start.
Attachment #248253 - Flags: first-review?(lilmatt)
Comment on attachment 248253 [details] [diff] [review]
select default calendar patch

>+function getIndexForCalendar(calendar) {
Please use aCalendar here...

>+    // Special trick to compare interface pointers, since normal, ==
>+    // comparison can fail due to javascript wrapping.
>+    var sip = Components.classes["@mozilla.org/supports-interface-pointer;1"]
>+                        .createInstance(Components.interfaces.nsISupportsInterfacePointer);
>+    sip.data = calendar;
...and here.


r=lilmatt

I would love a similar patch for Sunbird
Attachment #248253 - Flags: first-review?(lilmatt) → first-review+
This patch selects the stored default calendar in the Sunbird calendar list
right after application start.
Attachment #248504 - Flags: first-review?(lilmatt)
Comment on attachment 248504 [details] [diff] [review]
Sunbird select default calendar patch

>+++ mozilla/calendar/resources/content/calendarManagement.js	2006-12-13 12:37:04.625000000 >         calendarList.appendChild(listItem);
>     }
>+    // Ensure that a calendar is selected in calendar list after startup.
>+    if (!oldSelection || oldSelection < 0) {
>+        var defaultCalendar = composite.defaultCalendar;
>+        var item = defaultCalendar ? getListItem(defaultCalendar) : null;
>+        oldSelection = item ? calendarList.getIndexOfItem(item) : 0;
>+    }
>+    if (oldSelection >= calendars.length) {
>+        oldSelection = calendars.length-1;
>+    }
>     calendarList.selectedIndex = oldSelection;

Please put a blank line on either side of what you added for increased readability.

Otherwise, r=lilmatt
Attachment #248504 - Flags: first-review?(lilmatt) → first-review+
patch checked in on HEAD and MOZILLA_1_8_BRANCH
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Summary: Selected calendar will not be restored after restart of Lightning → Selected calendar will not be restored after restart
verified with
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061215 Calendar/0.4a1
Status: RESOLVED → VERIFIED
Whiteboard: [litmus testcase wanted]
Litmus testcase 2899 created
Whiteboard: [litmus testcase wanted]
You need to log in before you can comment on or make changes to this bug.