Closed Bug 386480 Opened 18 years ago Closed 18 years ago

View mode is not remembered after thunderbird restart

Categories

(Calendar :: Lightning Only, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: omar.bajraszewski, Assigned: giermann)

References

Details

Attachments

(1 file, 1 obsolete file)

Using lightning 0.7pre 2007063017 and thunderbird 2.0.0.4 When I switched to calendar mode I saw week view. I changed it to month view and then restarted thunderbird And after I switched to calendar mode I saw week view again
Christian, do you want to preserve the last visible view across sessions? I personally think it's a valid request.
OS: Windows XP → All
Hardware: PC → All
Makes sense for me, too. - After restart the default should always be the mail mode - In calendar mode the last selected view should be used.
(In reply to comment #2) > - After restart the default should always be the mail mode Maybe this is not, what the user wants - see Bug 359807. I don't know, if it possible for Lightning to read the command-line options, but maybe someone knows how...
I agree with Stefan, to solve this one together with bug 386830.
Is this a regression? I'd say so, but I can't totally recall right now. If so, it needs the key word.
(In reply to comment #5) This is no regression.
I chose to attach this patch here rather than to Bug 386830, because the main part regards the last visted view. This makes the checked state (introduced in Bug 376086) persistant and restores the global variable gLastShownCalendarView in ltnOnLoad().
Attachment #274774 - Flags: review?(michael.buettner)
Assignee: nobody → giermann
Status: NEW → ASSIGNED
Blocks: 386830
Any chance of getting this reviewed soon? It is hard to "sell" Lightning when this isn't working as expected.
Comment on attachment 274774 [details] [diff] [review] Make the last view persist and use it for choosing the initial view Moving review to Philipp to get some progress...
Attachment #274774 - Flags: review?(michael.buettner) → review?(philipp)
Comment on attachment 274774 [details] [diff] [review] Make the last view persist and use it for choosing the initial view I'd recommend to >+++ mozilla/calendar/lightning/content/messenger-overlay-sidebar.js >@@ -385,16 +369,29 @@ function ltnOnLoad(event) >+ var availableViews = getViewDeck(); >+ for (var i = 0; i < availableViews.childNodes.length; i++) { read availableViews.childNodes.length only once and store it in a variable >+ var view = availableViews.childNodes[i]; >+ var command = document.getElementById(view.id+"-command"); >+ if( command.hasAttribute("checked") ) check for valid command value too: if ( command && command.hasAttribute(... >+ gLastShownCalendarView = view.id.substring(0, view.id.indexOf('-')); >+ } add curly brackets and leave the for loop via break if we found the view
Attached patch patch v2 — — Splinter Review
Updated patch with Stefan's recommendations addressed.
Attachment #274774 - Attachment is obsolete: true
Attachment #281638 - Flags: review?(philipp)
Attachment #274774 - Flags: review?(philipp)
Comment on attachment 281638 [details] [diff] [review] patch v2 Shifting review to mickey.
Attachment #281638 - Flags: review?(philipp) → review?(michael.buettner)
Comment on attachment 281638 [details] [diff] [review] patch v2 >+ // find last shown calendar view (persist="checked") >+ try { >+ var availableViews = getViewDeck(); >+ for (var i = availableViews.childNodes.length - 1; i >= 0; i--) { As Stefan already suggested it is a bit more efficient to read availableViews.childNodes.length only once and store it in a variable. >+ var view = availableViews.childNodes[i]; >+ var command = document.getElementById(view.id+"-command"); >+ if ( command && command.hasAttribute("checked") ) { Superfluous blank after around braces, and more important we probably should explicitly check if the attribute equals the value 'true'. >+ } catch(ex) {} I also suggest to remove the try/catch block. >+ if( gLastShownCalendarView == null ) >+ gLastShownCalendarView = 'month'; Curly braces are missing, no blank after 'if', superfluous blanks around braces. > // show the last displayed type of calendar view >- if(gLastShownCalendarView == null) >- gLastShownCalendarView = 'week'; Missing blank after keyword, missing curly braces. Since all these comments are just minor style nits and the patch is indeed working as advertised, I'm going to fix this before checking it in. r=mickey. Thanks for the patch, Sven. BTW, feel free to remind me from time to time that a patch you're waiting on is stuck in my review queue, I really didn't have this on my radar. Thanks again for being patient.
Attachment #281638 - Flags: review?(michael.buettner) → review+
patch checked in on trunk and MOZILLA_1_8_BRANCH -> FIXED
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Target Milestone: --- → 0.7
(In reply to comment #13) > (From update of attachment 281638 [details] [diff] [review]) > >+ for (var i = availableViews.childNodes.length - 1; i >= 0; i--) { > As Stefan already suggested it is a bit more efficient to read > availableViews.childNodes.length only once and store it in a variable. This was not the solution I had in mind during writting Comment #10 but the change as shown above reads availableViews.childNodes.length only once ;)
Verified with lightning 2007092204
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: