Last Comment Bug 359807 - No command line switch to start Thunderbird with calendar view upon start-up
: No command line switch to start Thunderbird with calendar view upon start-up
Status: ASSIGNED
:
Product: Calendar
Classification: Client Software
Component: Lightning Only (show other bugs)
: unspecified
: All All
: -- enhancement with 28 votes (vote)
: ---
Assigned To: Philipp Kewisch [:Fallen]
:
:
Mentors:
: 377073 776244 1071014 (view as bug list)
Depends on:
Blocks: 261460 415906 463930 415905 494630
  Show dependency treegraph
 
Reported: 2006-11-07 07:23 PST by Sven Giermann
Modified: 2016-10-10 08:18 PDT (History)
35 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Enable 'about:calendar' and 'about:calendar-month' etc. for starting TB with Lightning-View (1.43 KB, patch)
2007-07-30 23:46 PDT, Sven Giermann
cmtalbert: review-
Details | Diff | Splinter Review
patch rev.1 (1.44 KB, patch)
2007-08-21 23:25 PDT, Sven Giermann
no flags Details | Diff | Splinter Review
Re-designed patch with CLH to work with Lightning 0.8+ (9.52 KB, patch)
2008-04-09 23:29 PDT, Sven Giermann
no flags Details | Diff | Splinter Review
Philipp's WiP (49.94 KB, patch)
2008-04-10 05:40 PDT, Philipp Kewisch [:Fallen]
no flags Details | Diff | Splinter Review
Commandline options WiP - v6 (43.45 KB, patch)
2008-08-04 22:41 PDT, Philipp Kewisch [:Fallen]
no flags Details | Diff | Splinter Review
Commandline options v6 working (44.98 KB, patch)
2008-09-16 02:53 PDT, Sven Giermann
no flags Details | Diff | Splinter Review

Description Sven Giermann 2006-11-07 07:23:38 PST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7

I tried previous options for Calendar extension (thunderbird.exe -mail -calendar) and only "-calendar"; but TB always starts with the default view...

I would like an option to start in Month-View to see all recent and coming events, like I do in Sunbird on start-up!

Reproducible: Always

Steps to Reproduce:
1. Install TB 1.5.0.7
2. Install Lightning 0.3
3. Start "...\thunderbird.exe -calendar"

Actual Results:  
TB starts normal.

Expected Results:  
TB starts in Lightning-View.

I also tried this with Lightning 0.4a1 (nightly from 02. November) - same result.
Comment 1 Brian King [:kinger] 2006-11-15 09:52:54 PST
Yes, this is covered here:

http://www.mozilla.org/projects/calendar/faq.html#shortcut

But I can confirm -calendar is not working.

Thunderbird 1.5.0.8
Windows
Lightning 0.3
Comment 2 Stefan Sitter 2007-04-10 14:45:29 PDT
*** Bug 377073 has been marked as a duplicate of this bug. ***
Comment 3 Sven Giermann 2007-07-30 06:46:45 PDT
I tried several ways now, but I think there's only one workaround without modifying Thunderbird...

Whenever TB is configured to download mails upon startup, it selects the Inbox folder of the default account. This occurs AFTER Lightning is loaded, so Lighting is unable to bring the calendar up.

One workaround would be to use an internal URL (i.e. 'about:calendar'), because TB does not select the folder view, when it is started with a URL; it displays this URL instead!

I got this working, even with the desired view ('about:calendar-month' etc.) - but I'm not sure, whether this is the right way to go...
Wouldn't it be better to completely handle this URL instead, although it does not really make sense in Thunderbird?!

What do you all think about that?
Comment 4 Bas van den Bosch 2007-07-30 10:35:55 PDT
Doesn't work in 1.5.0.12 or 2.0.0.5 for me using
"C:\Program Files\Mozilla Thunderbird\thunderbird.exe" -about:calendar-month
or
"C:\Program Files\Mozilla Thunderbird\thunderbird.exe" about:calendar-month

What did you use as a workaround?
Comment 5 Sven Giermann 2007-07-30 23:46:30 PDT
Created attachment 274582 [details] [diff] [review]
Enable 'about:calendar' and 'about:calendar-month' etc. for starting TB with Lightning-View

Bas, sorry for being so imprecise. This start option is not supported - but could be; implement attached patch.

Stefan, what do you think about this 'new' start-up option?
Maybe we have to add another line to display the sidebar in mail-mode, too? But I think this is already covered in another bug, although I did not find it to add a reference here...

The patch currently searches the requested view and selects this or month-view as default, so the following start options become available in current nightly builds:
  ...\thunderbird.exe about:calendar
  ...\thunderbird.exe about:calendar-day
  ...\thunderbird.exe about:calendar-month
  ...\thunderbird.exe about:calendar-week
  ...\thunderbird.exe about:calendar-multiweek
Comment 6 Martin Schröder [:mschroeder] 2007-08-14 05:18:20 PDT
Sven, you asked for review without a reviewer. Please choose an appropriate one from http://wiki.mozilla.org/Calendar:Module_Ownership.
Comment 7 cmtalbert 2007-08-21 18:52:09 PDT
Comment on attachment 274582 [details] [diff] [review]
Enable 'about:calendar' and 'about:calendar-month' etc. for starting TB with Lightning-View

Thanks for your patch.  It looks really good.  I have a couple of mozilla style nits
that I have addressed below.  We keep everything less than 80 chars on a line where
it doesn't hurt readability.  That's so that diffs look decent in bonsai and
bugzilla.

>+    // display Calendar, when started with 'about:calendar' or 'about:calendar-[VIEW]'
Break this comment into two lines so that each line is less than 80 chars ^^

>+    if ( (window.arguments.length > 0) && window.arguments[0].substr(0, 14) == "about:calendar" ) {
Same with this if ^^ like so:
>+    if ( (window.arguments.length > 0) &&
>+       window.arguments[0].substr(0, 14) == "about:calendar" ) {


>+      var reqView = window.arguments[0].substr(15);
>+      // check, whether requested view exists
No need for comma in this statement ^

>+      setTimeout("showCalendarView('"+reqView+"');", 0);
I have tested this with a bunch of parameters, and I like the effect.  However,
I think we need to do just a little more.  If you try this with a current nightly,
you'll notice that you get the calendar pane, but the left "folderpane" area
is still the mail "folderpane" and not the calendar left pane.  Likewise,
the toolbar is still the mail toolbar and not the calendar toolbar.  I think this
means that you just need to add some extra calls to this function, but I think you
should check with mickey or Fallen on IRC about what you need to call in order
to fully switch us into the view.

I am eagerly awaiting the next version of the patch. But, I sadly have to r- this
because of the left pane and toolbar issues.
Comment 8 Sven Giermann 2007-08-21 23:25:03 PDT
Created attachment 277678 [details] [diff] [review]
patch rev.1

Clint,

your observation is already covered in Bug 386479, but as I recently found an easy way to fix this, I will attach a patch there soon.

So, this one only covers your additional comments.
Comment 9 Michiel van Leeuwen (email: mvl+moz@) 2007-08-21 23:43:31 PDT
I think that it would be cleaner to use a commandline switch instead of an url. The about: protocol is really handled somewhere else, and not in the power of lightning to change. The commandline switches are for consumers.

Besides that, does the patch work if I do 'thunderbird.exe -P foo about:calendar'?
Comment 10 Sven Giermann 2007-08-22 00:03:37 PDT
(In reply to comment #9)
> I think that it would be cleaner to use a commandline switch instead of an url.
> The about: protocol is really handled somewhere else, and not in the power of
> lightning to change. The commandline switches are for consumers.

Well, I also tried this first, but there is a problem, when TB checks for new mails on start-up. TB does not recognize the '-calendar' switch and continues without attention to it.
This means, if no start page is requested it switches to the Inbox folder, after it downloaded new mails. This switches the view back to Mail-View.
By examining the code, I found that this does not take place, if any start page is requested in commandline.

I agree, that use of the about protocol is not the best way. You could use anything else ('calendar', 'calendar-month', 'calendar:month') - please post your ideas!
I don't know whether we could have a complete handler for a protocol like 'calendar:'...
But this would be an easy way for lots of people to start TB in Calendar view!

> Besides that, does the patch work if I do 'thunderbird.exe -P foo
> about:calendar'?

Yes, it does.

Comment 11 Stefan Sitter 2007-08-22 00:40:10 PDT
(In reply to comment #10)
> Well, I also tried this first, but there is a problem, when TB checks for new
> mails on start-up. TB does not recognize the '-calendar' switch and continues
> without attention to it.

I think Lightning needs to add/register a command handler for '-calendar' switch.  The old Mozilla Calendar extension did this so I don't know why Lightning should not be able to do the same.
Comment 12 Sven Giermann 2007-08-22 02:35:19 PDT
(In reply to comment #11)
> I think Lightning needs to add/register a command handler for '-calendar'
> switch.  The old Mozilla Calendar extension did this so I don't know why
> Lightning should not be able to do the same.

The Problem is not Lightning, but Thunderbird. I played around with the old Mozilla Calendar... Version 0.8.x in Fx 1.0.0.7 switches to Calendar, when started with '-calendar'; version 0.2.x does'nt in Fx 1.5!
I modified the Calendar 0.2.x to install in Fx 1.0.0.7 and it starts in Calendar view (although reporting only errors) - but this shows, that the command handler was removed in Mozilla Code beginning with versions 1.5.
Comment 13 Michiel van Leeuwen (email: mvl+moz@) 2007-08-22 02:54:05 PDT
The way firefox (and thunderbird) handle commandline switches was changed, I think after fx1.0. Support for that was added to calendar after 0.2.x. So testing with older versions doesn't tell us much.
You need to look at calendarService.js for the code. Also, take a look at bug 378557, which also involves commandline stuff. Maybe that bug blocks this one.
Comment 14 Sven Giermann 2007-08-22 09:17:15 PDT
mvl,

I tested the handling of commandline switches. I got a working solution now, but with two disadvantages:

1. I cannot test the existence of the views, because the document seems not to be loaded at this early time.

2. I have to create an own messenger window with the argument 'about:blank' to prevent loadStartFolder() to switch to the Inbox after biff.
But this would load 2 messenger windows, if also started with a start-page (i.e. 'thunderbird.exe about:blank -calendar')

To fix the 2nd, we would have to change Thunderbird code - right?
Comment 15 cmtalbert 2007-08-22 12:57:02 PDT
Cc'ing David Bienvenu on this bug so that he can answer the question in point 2 of comment 14.
Comment 16 David :Bienvenu 2007-08-22 13:30:20 PDT
What to do with all the permutations of command lines is complicated. If you're looking for a way to have an icon on the desktop that starts Thunderbird in Lightning mode, then it doesn't seem like you need to worry so much about other command line arguments...but if you're looking for how to handle it in all situations, I'm not sure that 2 messenger windows isn't the way to go. If I launch TB with -calendar and a .eml file, you'd want two windows, right?

I don't know what you mean by starting TB with a start page on the command line - that doesn't do anything. You can launch Thunderbird with a uri for a message, which loads that message, or a .eml file, which loads the .eml file. Conceivably, you could have a uri for a folder as well, to startup with that folder. But a start page doesn't do anything, afaik.
Comment 17 Sven Giermann 2007-08-22 14:55:27 PDT
(In reply to comment #16)
> What to do with all the permutations of command lines is complicated. If you're
> looking for a way to have an icon on the desktop that starts Thunderbird in
> Lightning mode, then it doesn't seem like you need to worry so much about other
> command line arguments...but if you're looking for how to handle it in all
> situations, I'm not sure that 2 messenger windows isn't the way to go. If I
> launch TB with -calendar and a .eml file, you'd want two windows, right?

As we are talking about a bugfix in a public version, we should handle every situation. You are right, if someone starts 'foo.eml -calendar' he most likly wants both.

> I don't know what you mean by starting TB with a start page on the command line
> - that doesn't do anything. You can launch Thunderbird with a uri for a
> message, which loads that message, or a .eml file, which loads the .eml file.
> Conceivably, you could have a uri for a folder as well, to startup with that
> folder. But a start page doesn't do anything, afaik.

I refferred to the naming in 'msgMail3PaneWindow.js' and you are wrong, it does at least suppress the biff on startup and the selection of Inbox after biff, which is important to this issue...

I there any other way to suppress the (delayed) selection of Inbox?

Comment 18 David :Bienvenu 2007-08-22 15:21:21 PDT
when I run a trunk TB with a start page, e.g., thunderbird about:blank, it actually fails to bring up any UI, so in that sense, it does suppress the biff :-)

do you mean start folder uri? that's the folder we try to load at startup, and yes, that does prevent the selection of the inbox. 

If you've configured Thunderbird to select the inbox on startup, and download new messages, I'd think you might still want it to download new messages on startup, even if you launched it with the -calendar option.

I don't really know how your mail/calendar widget works internally. Why does selecting the start folder mess that widget up and prevent the calendar view from getting displayed? You could do something like listen for the onFolderLoaded notification, on startup, and switch to the calendar view after you receive that notification. Or are you simply trying to prevent Thunderbird from downloading new mail on startup?
Comment 19 Sven Giermann 2007-08-22 23:09:28 PDT
David,

first - thank you for the quick replies and your explanations.
I did not check with the latest trunk, but TB 2.0.0.x brings up a window with an empty 'displayDeck'.
But I could verify the behaviour with the '-addressbook' switch - it also brings up the address book AND a message window, when 'about:blank' is appended.

To bring some light in:
- Lightning extends the 'displayDeck' and switches to calendar view by selecting another child in deck
- Starting with '-calendar' should not necessarily prevent the download of new messages, but if this is done, the Inbox is selected AFTER the download is complete --> the calendar would only display while downloading messages!

Maybe the observation of 'onFolderLoaded' would be an option, but I have another idea right now:

As the calendar view is just a special "location" displayed in the messenger window, I would advice to handle the display through a special uri, maybe with a special protocol...


@mvl: What do you think about handling 'calendar://month-view'?

The switch '-calendar' could just open a window with calendar view, but the behaviour of both would be slightly different:
- when you start TB with 'thunderbird.exe <uri1> <uri2>', only the first is being displayed
- when you start TB with 'thunderbird.exe <uri1> -calendar', two windows open up: one with <uri1> and another with calendar

I think the handling is a little complicated, because most commandline switches are used to display a dialog, not to modify the mail-view.
Comment 20 Sven Giermann 2007-08-23 07:28:39 PDT
David,

(In reply to comment #16)
> Conceivably, you could have a uri for a folder as well, to startup with that
> folder. But a start page doesn't do anything, afaik.

I tested with latest trunk now - how do you start with a folder?
If I enter anything else than an .eml file, it does not bring an UI up...
So this at least produces errors with my 'about:calendar' in trunk!


Comment 21 Michiel van Leeuwen (email: mvl+moz@) 2007-08-30 09:06:46 PDT
The use of an url just feels wrong. The calendar view is not an url, it's just an option. Using an url to work around a problem isn't really clean imho.
Can't the lightning commandline handler eat any urls that are left? Maybe 'preventDefault' can help?
Comment 22 David :Bienvenu 2007-08-30 10:29:09 PDT
I agree with MVL, I think, in the sense that it shouldn't be a url that shows calendar...

Sven, see bug 386919 for how to start up with a particular message (not folder). It should work on the trunk, unless it's somehow regressed since I landed it.
Comment 23 Sven Giermann 2007-09-03 05:35:44 PDT
Unfortunately I was not able to workaround all problems without changing TB code...

Furthermore I cannot manage to provide a working fix before 0.7 release - so I make a call to all others:

Please feel free to pick up this bug, if the solutions should be integrated into 0.7 release!
Comment 24 cmtalbert 2007-09-06 02:55:04 PDT
Sven, I don't think this is an issue that will block 0.7 release.  But I think it is something we want for 1.0 since it gives us a better embedability (is that a word) story, and allows further customization from the users.

Michiel, David, what should be the desired approach for this?  Should we do something like the "show message" functionality akin to what David pointed to in bug 386919?  Should we institute our own command line option handler (and overcome the objections there).  Is there some other approach that is worth looking at here?

Simon, I CC'd you just to get your opinion on where this sort of thing fits in the overall 1.0 strategy.  I'd like to hear your thoughts on that, as well as anyone else's.

Thanks ya'll.
Comment 25 Simon Paquet [:sipaq] 2007-09-08 00:39:33 PDT
I consider this a 5%-feature, meaning that probably only 5% of our users will likely ever use it. However, it would still be great to get this to work within the 1.0 timeframe.
Comment 26 cmtalbert 2007-11-06 22:27:00 PST
Simon, David, Michiel, Sven, this bug is back on my radar after a while. I have read the comments here, and I'm still not totally sure that the patch I have for review is the approach we want.  Can you guys comment about your view on this?

My thought is this:

If our options are these:
1. "Fix thunderbird to do this right"
2. "Use this about handler as a workaround"
3. "Do something else to get command control working"

Then this is how I see things:
1. We should file bugs and patches to fix Thunderbird to do this right. But we can't depend on that code because 1.0 Lightning will need to work with Thunderbird 2.0, and the liklihood of these changes getting onto the MOZILLA_1_8_BRANCH are not high (though it should be said that they are not zero either).

2. I think we can use this handler as a workaround for any "Thunderbird" bug/feature that is stated in part 1.  I like this solution as a workaround because it is small, clean and will be easy to remove later.  Of course, insert here the general disclaimer that workaround code shouldn't ever be checked in since it never gets removed.

3. Is there another way to add command line handlers to thunderbird?  Didn't the old calendar extension have command line handlers?  Can we still do this, or was that feature destroyed during the MOZILLA_1_8_BRANCH effort?

I look forward to hearing your thoughts.  If we decide *not* to use the patch on this bug, then please clear the review request.
Comment 27 Sven Giermann 2007-11-06 23:49:38 PST
Clint,

with respect to comment #25 I think the best way would by the first (to fix TB).
I would even agree to leave out the workaround (2.) and to only use an extension for TB1/2 to start lightning with 'about:calendar'.

Unfortunately I don't have the knowledge to fix 1. or 2., but I could provide an extension as a workaround.
Comment 28 cmtalbert 2007-11-26 19:52:20 PST
Bienvenu or Mvl: Can ya'll help me understand what the "right" fix for Thunderbird should be?  Then I'll make sure that bug is filed against Thunderbird trunk.  I'm with Sven and am a bit confused w.r.t. what needs to change there.  If there is no bug filed against Thunderbird for this feature, then I'd like to reassign this bug to Thunderbird so we don't lose the historical context.

Sven: Even if this were to somehow magically to be fixed on Thunderbird Trunk, the likelihood that the fix will be ported to the Thunderbird 2.x branch is very low.  Therefore, I'd like to ask you to consider providing this functionality in an extension.  Even five percent of our users is quite a measurable number of people, so I think it'd be a good extension to have available.  Feel free to open another bug in bugzilla to track your work on the extension.  Thanks for your patience and your help.

In light of this, I'm going to clear the review ? flag up above. 

Comment 29 Chris Cunningham 2007-11-27 00:33:31 PST
(In reply to comment #28)
> Bienvenu or Mvl: Can ya'll help me understand what the "right" fix for
> Thunderbird should be?  Then I'll make sure that bug is filed against
> Thunderbird trunk.  I'm with Sven and am a bit confused w.r.t. what needs to
> change there.

Thunderbird with Lightning installed needs to accept a "-calendar" switch on the command line when starting up, which presents the calendar view. That's the right fix, and it achieves parity with Seamonkey's calendar capability.

 - Chris
Comment 30 Sven Giermann 2007-11-27 00:42:01 PST
(In reply to comment #29)
> Thunderbird with Lightning installed needs to accept a "-calendar" switch on
> the command line when starting up, which presents the calendar view. That's the
> right fix, and it achieves parity with Seamonkey's calendar capability.

Of course, this is not very complicated to find out!

The question is: What has to be done by Lightning and was needs to be changed in TB...

IMHO TB needs an option for extensions to prevent the selection of the Inbox folder after Biff - this is essential to keep the calendar view after startup, even if the Biff ends after switching to calendar mode through Lightning startup.
Comment 31 Bas van den Bosch 2007-11-27 01:17:22 PST
Just my two cents: 
I think the users won't mind an extra extension for now and a fix in trunk. I think it's more important to have this working and with an extension we don't have to touch TB-2-code. 

As for the Addressbook: "thunderbird.exe -addressbook" does work but I think this is something different as the main-view of lightning doesn't open if you start Thunderbird this way. 
Comment 32 cmtalbert 2007-11-28 12:56:08 PST
Why not just create a command line handler for -calendar inside of lightning and then handle the odd issues with Thunderbird wanting to load the mailbox within the command handler code?

This is From IRC:
[12:08pm] bienvenu_ joined the chat room.
[12:16pm] ctalbert|afk: bienvenu_: ping
[12:16pm] You are now known as ctalbert.
[12:16pm] bienvenu_: ctalbert - pong
[12:17pm] ctalbert: bienvenu_: Do you know what would need to be changed on the Thunderbird side for a -calendar option to work?  (bug 359807, comments 29-31)
[12:18pm] bienvenu_: ctalbert - I don't know. I like the idea of lightning having its own command line handler
[12:18pm] bienvenu_: I don't know if there needs to be some change to Thunderbird for that to happen (I doubt it would, though)
[12:18pm] bienvenu_: and I'm not sure if any changes to TB would be needed if Lightning did have its own command line handler...
[12:19pm] bienvenu_: sorry, that's not very helpful 
[12:19pm] Wolf joined the chat room.
[12:20pm] ctalbert: Ok.  Thanks bienvenu_ From the earlier comments, I thought there was something that would have be modified in Tbird.  Maybe I misread.
[12:20pm] bienvenu_: I'm not sure which approach that comment referred to...
[12:20pm] Fallen: bienvenu_: What do you think about comment #30 ? Sven suggests its about preventing the biff
[12:21pm] Fallen: the problem is that calendar is shown initially, but the biff selects the inbox, which switches back to mail view
[12:23pm] bienvenu_: Fallen - that's not exactly biff, but rather check for new messages on startup...
[12:23pm] Fallen: Yes, thats what I meant.
[12:24pm] bienvenu_: but yes, I understand what you mean...
[12:25pm] bienvenu_: I'm a little unclear how that forces things back to the mail view - does Lightning do that somehow?
[12:25pm] bienvenu_: or is there some side effect of selecting a folder that switches back to the mail folder pane?
[12:27pm] Fallen: Let me take a look how it works exactly. I believe selecting a folder is somehow observed and the view switches back. This is definitely ltn specific
[12:28pm] bienvenu_: so in ttheory if you had your own command line handler, you could supress the behavior for the startup folder, in the -calendar case?
[12:31pm] Fallen: bienvenu_: sorry, was disconnected. SelectFolder and SelectMessage are overridden. http://lxr.mozilla.org/mozilla/source/calendar/lightning/content/messenger-overlay-sidebar.js#580
[12:34pm] MarcoZ joined the chat room.
[12:34pm] MarcoZ: Fallen: *ping*?
[12:35pm] Fallen: busy, whats up?
[12:36pm] MarcoZ: Fallen, a question regarding the gdataprovider extension. I'm always getting a 404 error when trying to update an appointment or create a new one from Lightning. Reading events is OK, though. But if you're busy, we can talk some other time.
[12:37pm] Fallen: I'll look into it later, maybe they changed something.
[12:41pm] MarcoZ: Does anybody know if there's a way to switch the tabs (Mail, Calendar, Tasks) via the keyboard?
[12:41pm] davida left the chat room. (Quit: davida)
[12:49pm] bienvenu_: Fallen - so I think you could supress that behavior on startup just in the Lightning code, with your own command line handler
[12:49pm] ctalbert: MarcoZ: If there isn't a way, then that should be a bug.
[12:49pm] • ctalbert doesn't see one, but I'm using an old build atm
[12:50pm] Ramosa joined the chat room.
[12:50pm] Fallen: Ctrl 1, 3 and maybe 4
[12:51pm] Fallen: not sure if task mode got a key
[12:51pm] Wolf left the chat room. (Ping timeout)
[12:52pm] Fallen: bienvenu_: I guess that could work. I wonder why the others didn't come up with that...
[12:52pm] ctalbert: yeah ctrl 1 -> mail
[12:52pm] ctalbert: ctrl 3 -> calendar
[12:53pm] Fallen: ctalbert: any other implications? Do you think bienvenu's suggestion will work as expected?
[12:53pm] ctalbert: Fallen: None that I know of.  That sounds like a good solution. 
[12:53pm] Mc left the chat room. (Quit: ChatZilla 0.9.79 [Firefox 3.0b1/2007110904])
[12:54pm] ctalbert: We just need to make sure that -calendar gets to us in our code, and then take it from there.
Comment 33 Sven Giermann 2007-11-29 01:54:36 PST
(In reply to comment #32)
> [12:52pm] Fallen: bienvenu_: I guess that could work. I wonder why the others
> didn't come up with that...

Mhh, I can't tell... Maybe this is, because this function has not been overridden on the time of this bug reporting (one year ago).


> [12:53pm] Fallen: ctalbert: any other implications? Do you think bienvenu's
> suggestion will work as expected?
> [12:53pm] ctalbert: Fallen: None that I know of.  That sounds like a good
> solution. 

Well, I did not investigate further, but started some tests. For some reason these functions seem to be called only on startup and by the notification for new mails. I tested with Lighting 0.5 to override these and simply do nothing, when in calendar mode - which worked and I was still able to select the folder by clicking the folder in the folder pane.

Of course, this has to be changed for current Lightning versions, where the mail/calendar modes were introduced. To override these functions was explicitly wanted in bug 386636 - so we would need an extra decision for calendar mode on startup:
1. Simply ignore only the first SelectFolder()
2. Igrore every SelectFolder() and only override SelectMessage()
3. Ignore SelectFolder() and SelectMessage(), when started with '-calendar' until the user switches the manually to mail mode once


> [12:54pm] ctalbert: We just need to make sure that -calendar gets to us in our
> code, and then take it from there.

I also had problems with this in the past... I would appreciate any help in controlling the message window through an CommandLineHandle, because it does not exist this early. Or do I have to open the window myself and use 'PreventDefault'?
Comment 34 Michael Büttner (no reviews TFN) 2007-11-29 02:37:50 PST
(In reply to comment #33)
> I also had problems with this in the past... I would appreciate any help in
> controlling the message window through an CommandLineHandle, because it does
> not exist this early. Or do I have to open the window myself and use
> 'PreventDefault'?
You don't need to control the message window, neither is it something you need to care about. All you need to do is to remember that Lightning has been instructed to automatically switch to the calendar mode upon startup and invoke the necessary bits and pieces during the load handler (ltnOnLoad).
Comment 35 Philipp Kewisch [:Fallen] 2007-11-29 08:20:46 PST
If possible I'd go for option (1), because we can't assume that SelectFolder is generally not called at startup. Option (3) wont work, because SelectMessage is called from the email slider and that shouldn't be ignored just because the program was called with -calendar.
Comment 36 Philipp Kewisch [:Fallen] 2008-02-06 13:17:33 PST
I have a semi-working solution for this bug, but it probably won't make 0.8
Comment 37 Sven Giermann 2008-02-06 23:15:15 PST
Philipp, thanks for investigating.
I delayed work on this, until I accept the new design... (I never used Ltn0.7!)
But IMHO version 0.8 is more complete and I will accept the new modes. I just wanted to wait for the release of 0.8 to go on.

If you have something to solve this, feel free to post it here.

(In reply to comment #36)
> I have a semi-working solution for this bug, but it probably won't make 0.8

According to comment #25 this would be no problem ;-)
Comment 38 Simon Paquet [:sipaq] 2008-02-08 01:38:32 PST
Not going to happen for 0.8.
Comment 39 Sven Giermann 2008-04-09 00:06:19 PDT
(In reply to comment #34)
> You don't need to control the message window, neither is it something you need
> to care about. All you need to do is to remember that Lightning has been
> instructed to automatically switch to the calendar mode upon startup and invoke
> the necessary bits and pieces during the load handler (ltnOnLoad).

I'm at the same problem I was some months ago:
   How do I _REMEMBER_ the command-line switch?

Maybe I'm blind - but I can only handle command-line switches in a script in 'components', right? The switches are not available through 'window.arguments' in any Lightning script...
When I install a command-line handler, how could this access some global variables without installing a component service that could be 'asked' later - do we have to go this way for this simple demand???

(In reply to comment #36)
> I have a semi-working solution for this bug, but it probably won't make 0.8

It would be great, if you could post this as a WIP patch - maybe things are easier for me then ;-)

Comment 40 Sven Giermann 2008-04-09 23:29:16 PDT
Created attachment 314785 [details] [diff] [review]
Re-designed patch with CLH to work with Lightning 0.8+

I created a working solution now, using another existing interface (nsISupportsString) on the commandline-handler to get the desired mode.

This is working fine for me, but there are still some questions:
- Should we better create an own interface with IDL to store and retrieve the desired mode?
- Depending on the current design of Lightning there are much more options, that could be implemented, e.g. to show Task mode on startup...

I implemented the following:
'thunderbird.exe -calendar'
'thunderbird.exe -calendar month'
'thunderbird.exe -calendar week'
'thunderbird.exe -calendar multiweek'
'thunderbird.exe -calendar day'

Whenever a non-existent view (or none) is requested, the last visited will be shown. Depending on the possibilities, there would be another way to go: we could implement 'real' commands for Lighting, e.g.:
'thunderbird.exe -calendar show=month'
'thunderbird.exe -calendar newtask'
'thunderbird.exe -calendar import=mycal.ics'
'thunderbird.exe -calendar export=Birthdays,C:\birthday.ics'

What do you think? Maybe this could go into another bug, if requested by others...
Comment 41 Sven Giermann 2008-04-10 03:09:09 PDT
I already found a small issue with this patch:

- start TB with '-calendar'
- switch to mail mode manually

Actual Result:
- no folder is selected and application title does not change

Expected Result:
- Inbox or 'overview page' of main account should be selected and app title should change to "Inbox - Thunderbird" or something else

Any ideas how to handle this???
Comment 42 Philipp Kewisch [:Fallen] 2008-04-10 05:40:31 PDT
Created attachment 314829 [details] [diff] [review]
Philipp's WiP

This is the semi-working solution I was talking about. It keeps the command line handler out of chrome and also works for sunbird. Its probably bitrotten though.

Sven, feel free to use (parts, all, whatever) of this code if you decide to create a new patch. I was waiting with this, since I first wanted to fix bug 426746, which already creates some files used here.

Hope it helps, sorry for doing possibly duplicate work, at the time I wrote that, it wasn't clear to me you were actively working on this bug.
Comment 43 cmtalbert 2008-06-03 20:00:24 PDT
Once again, I find myself in a position of not knowing what to do with this bug.  Looking briefly at the two different approaches, I tend toward Sven's approach because it is simpler and less wide-ranging than Philipp's.

Philipp, how much of that patch was refactoring startup code and how much of it was fixing this to work with sunbird?

Comment 44 Philipp Kewisch [:Fallen] 2008-06-04 03:39:14 PDT
Clint, some of the work done in that patch has already been done in a previous bug, we already have a calendar-chrome-startup.js now, therefore some chunks are obsolete. I just attached my patch since it may provide some ideas for consolidating the two command line handlers.

I'd like to see a solution that doesn't just also implement the command line handler for lightning, but cleans up the code and creates a common command line handler, so that adding futher options doesn't require code changes in two locations. Also this would clean up the resources/ directory a bit more.

I like the idea of an idl interface for our command line handler to allow retrieving passed options via a component. This would easily allow adding more options.

If I would be doing the review, I'd probably r- the patch to consolidate the command line handlers (sorry ;-).
Comment 45 Sven Giermann 2008-06-04 04:44:32 PDT
Comment on attachment 314785 [details] [diff] [review]
Re-designed patch with CLH to work with Lightning 0.8+

(In reply to comment #44)
> If I would be doing the review, I'd probably r- the patch to consolidate the
> command line handlers (sorry ;-).
> 

Philipp, I totally agree, at least since bug 415906 requests for an option to show a specific date on startup for lightning, which makes sense for me, too.

Maybe the option "-calendar" is totally useless then?!

Unfortunately this starts to go beyond my capabilities... I have not started to look at 'calendar-chrome-startup.js', nor do I understand the command-line handling in Sunbird.

Philipp, do you feel able to take this bug?
Otherwise I'm not sure whether I can get this working before 0.9 release :-(
Comment 46 cmtalbert 2008-06-04 09:20:20 PDT
(In reply to comment #45)
> (From update of attachment 314785 [details] [diff] [review])
> (In reply to comment #44)
> > If I would be doing the review, I'd probably r- the patch to consolidate the
> > command line handlers (sorry ;-).
> > 
Ok sounds good.  Sven, I'm really sorry about letting that patch sit in my review queue for so long.  It somehow slipped my notice.  I won't let that happen again.
Comment 47 Philipp Kewisch [:Fallen] 2008-06-04 10:11:41 PDT
I'll see what I can do. I have quite a few larger patches on my plate so I'm not sure when I'll get to this. Just write me an email if you find time before I've uploaded a patch so I can tell you if I've already started taking a closer look or not.
Comment 48 Philipp Kewisch [:Fallen] 2008-08-04 22:41:10 PDT
Created attachment 332310 [details] [diff] [review]
Commandline options WiP - v6

This patch mostly works, there is one open issue I've discovered:

* Something is fishy with the menus, starting with -taskmode or -calendar gives
  a mix of both mail and calendar menus, works when switching back and forth
  modes

* Something is keeping -calendar from working. I'm too tired to debug this now
  but I think its a minor issue

* In case this gets ready before 0.9, there are still hardcoded strings that
  need to be localized after the release.


Also, we should think about what we want those switches to be called. Keep in mind they should be as sensible as possible for both sb and ltn. Right now I have


-calendar <view>         Start calendar in <view>, where the <view> is optional
-taskmode                Start lightning in task mode
-showdate <date>         Show a specific date, parsed using jsdate
-url <type>,<url>        Add a calendar of a specific type. When type, is
                         omitted it defaults to ICS.

I'm open to name changes and such. I could well imagine using:

-mode <mode>     (i.e -mode calendar or -mode task)
-view <view>     (i.e -view week or -view month)

instead.
Comment 49 Bas van den Bosch 2008-08-04 23:29:22 PDT
I'd reserve "calendar" for showing one particular calendar and disabeling the rest in the future, let's use "view". I know quite some people would like this. 
Comment 50 Karsten Düsterloh 2008-08-05 00:14:57 PDT
It'd probably be worth to prefix calendar commandline options with e.g. cal or use less generic names, so there aren't any name clashes with e.g. -url.
How about: 
-calview <view>
-calmode <mode>
-calimport <type>,<url>
Comment 51 Philipp Kewisch [:Fallen] 2008-08-05 01:24:09 PDT
I was using -url since osx LaunchServices uses this switch to start up ICS files, but it will have the same problem as noted in one of the TODO comments:

Regardless of windows,linux,mac, how do we know if the url passed (either without a switch or with -url) is one that calendar can read? The way the commandline interfaces work we need to do this synchronously, which means we can't just open the URL and find out.

In an ideal world, if the url is one that calendar can read, then i.e the .ics file that was doubleclicked on should be subscribed to, otherwise it can be left to thunderbird to decide how to open it.
Comment 52 Sven Giermann 2008-09-16 02:53:23 PDT
Created attachment 338838 [details] [diff] [review]
Commandline options v6 working

(In reply to comment #48)
> * Something is fishy with the menus, starting with -taskmode or -calendar gives
>   a mix of both mail and calendar menus, works when switching back and forth
>   modes
I solved this by an initial call to swapPopupMenus() in ltnInitializeMenus().

> * Something is keeping -calendar from working. I'm too tired to debug this now
>   but I think its a minor issue
This seems to be related to WHEN commonInitCalendar() is called. I shifted it down in ltnOnLoad() which works for me now and also prevents its call twice, as it's positioned after the removal of the onLoad listener.

There was also a minor case-typo in calHandleChromeStartupOptions():
-    if (showDate && showdate.length) {
+    if (showDate && showDate.length) {

Futhermore I completed your addition of return values, also to selectCalendarView() and ltnSelectCalendarView().

I did not change any names of the command-line switches, which is rather quickly done.

There are still some possibilities to consolidate some code:

- The check for existence of requested views and the current mode could be removed from ltnShowCalendarView() as this is already done in switchToView() and ltnSwitch2Calendar():
>function ltnShowCalendarView(type) {
>    if (ltnSelectCalendarView(type)) {
>	ltnSwitch2Calendar();
>	return true;
>    }
>    return false;
>}

- change ltnSwitch2Calendar() to also call ltnSelectCalendarView() or switchToView() instead of showCalendarView()

- take care of and hand over the result code from switchToView() also in ltnSwitch2Calendar()

I did not change these mainly because of the existing comment for showCalendarView():
  * XXX Kind of confusing. This function calls the app specific function, which
  * again calls the common switchToView function. They should be consolidated in
  * a different bug.
Comment 53 Philipp Kewisch [:Fallen] 2008-09-16 02:57:00 PDT
Sven, thanks for the patch. I'll be taking a look at this after the 0.9 release, since the change is a bit too risky for now.
Comment 54 Sven Giermann 2008-09-17 03:25:28 PDT
One more issue to resolve:

When starting with '-calendar' and then opening one mail folder in another window (right-click / Open), the calendar mode it displayed in this new window again.

This should be fixed by resetting the mode preference after ONE window has been opened.
Comment 55 Jed Leahy 2008-09-24 06:28:35 PDT
would be good if the same kind of switch can be implemented for OS X!
Thanks guys, love your work, no where's a donation button?

-jed.
Comment 56 Alberto Pianon 2008-09-25 09:51:44 PDT
I would like to donate, too!
I look forward to see this functionality implemented!
Again, is there anyone who is willing to provide me with a compiled version of lightning with this patch? (I use linux) Or, can you please indicate me where I can find a configuration file for linux (Ubuntu Hardy) in order to compile it by myself?
I can test it, even if I am not a programmer
thank you
Alberto
Comment 57 Sven Giermann 2008-10-21 07:40:39 PDT
(In reply to comment #56)
> Again, is there anyone who is willing to provide me with a compiled version of
> lightning with this patch? (I use linux)
> I can test it, even if I am not a programmer

Since I did not get any response from Alberto by mail, I tried to attach the patched version for Linux here (but it's too large) - I did only test it on Windows, but did the same modifications in Linux version.
Note: There's an dummy update URL to avoid automatic back-rev to 0.9!

If anyone is interested, feel free to contact me.
Comment 58 Alberto Pianon 2008-10-21 15:34:16 PDT
Thank you Sven
sorry your first email was labeled as spam by gmail :(

I am starting to play with it
The first thing I wanted to do is integration with Gnome Clock Applet
Here is the trick I came up with today:

1) create the following script and name it "evolution"
 
---------------------------------

#!/bin/bash
d=`echo $1 | grep "calendar:///?startdate="`
if [ "$d" != "" ]; then
	yyyy=${d:23:4}
	mm=${d:27:2}
	dd=${d:29:2}
	thunderbird -calendar day -showdate `echo "$yyyy/$mm/$dd"` &
	exit 0
fi

d=`echo $1 | grep "task:"``echo $1 | grep "component=tasks"`
if [ "$d" != "" ]; then
	thunderbird -taskmode &
	exit 0
fi

d=`echo $1 | grep "component=calendar"` 
if [ "$d" != "" ]; then
	thunderbird -calendar &
	exit 0
else
	evolution2 $1 $2
fi

----------------------------------------

2) rename /usr/bin/evolution to /usr/bin/evolution2
3) copy the script "evolution" to /usr/bin and make it executable
4) Try to double-click on a date on Gnome Clock Applet (or to click on a button) and see what it happens

Sven, 
the only thing that is missing is putting the existing thunderbird window in foreground every time you call it from command line. Is it a difficult thing to implement?
Comment 59 Alberto Pianon 2008-10-21 16:05:44 PDT
Sorry, one (fundamental) part of the trick was missing :)

You must first install apache on your local machine and enable dav support
then you create a local "web" calendar with lightning and you enable it also in evolution, so that Gnome Clock Applet show the same events and tasks of lightning (otherwise the trick does not make much sense)

If someone wants the details, I can give him/her
Comment 60 Sven Giermann 2008-10-22 00:13:45 PDT
(In reply to comment #58)
> the only thing that is missing is putting the existing thunderbird window in
> foreground every time you call it from command line. Is it a difficult thing to
> implement?

This seems to be a Linux-only issue - it is working perfect on Windows; except for one thing:

@Phillipp: STR

1. Start TB without commandline option
2. "thunderbird.exe -calendar"
   EXPECTED: Display Calendar in existing window
   ACTUAL:   Display Calendar in existing window
3. "thunderbird.exe -mail"
   EXPECTED: Display Mail mode in existing window
   ACTUAL:   Window is brought to foreground, but still with Calendar

It should also be discussed what should happen, if TB is started again without any option: Mail mode or just foreground?
Comment 61 Alberto Pianon 2008-10-23 03:15:36 PDT
Sven,
another bug: printing emails does not work any more when I install your patched version, while with the official version of lightning it works
Maybe another linux-related issue?

Moreover, even if I close thunderbird, the task appears to be still running (with ps -A, you still see thunderbird-bin and run-mozilla.sh).
(I had to manually kill the task to manage to reinstall the official version of lightning to test the printing issue)
Comment 62 Alberto Pianon 2008-10-23 03:24:14 PDT
Well, I uninstalled the official version, I reinstalled the patched version again, and now all the bugs I signalled above (included tbd window not in foreground) disappeared!
Comment 63 Alberto Pianon 2008-10-23 03:26:55 PDT
sorry...
the tbd window in foreground works only sometimes...
Comment 64 Stefan Sitter 2008-10-23 04:02:38 PDT
Has anyone planned how the open via command line features incorporates into the new tabbed model used in Thunderbird 3.0b1pre / Lightning 1.0pre?
Comment 65 Sven Giermann 2008-10-23 06:50:16 PDT
I just had a first look at the new layout - it seems to be very unfinished yet; not only regarding Lightning.

I would suggest to give the same experience via commandline, as it is with the mode switching buttons!

But it does indeed open further possibilities:
What to do if someone issues TB with commandline "-mail -calendar -task" ?

I would assume he wants 1 window (or tab) for each mode: Mail, Calendar AND Task.

BTW: The tabbed window gives good abilities to introduce Task mode in Sunbird ;-)
Comment 66 Alberto Pianon 2008-10-29 02:12:12 PDT
Sven,
I tested your patch for a while on ubuntu 8.04 and I can say that the only bug/problem is that the tbd window only sometimes is put in foreground when called from command line.
I tried to find a rule, but there isn't one: sometimes, when all other windows are not maximized, the tbd window is put in foreground, but sometimes is not...
When some other windows are maximized, generally the tbd window stays in background even when called.
Maybe a different function must be called in linux, to put the window in foreground? (I'm not a programmer so I'm guessing :) )
Comment 67 meincontainer 2008-10-30 04:00:57 PDT
Are there any plans to include an "-import" command-line switch?

It was mentioned in comment #40 and #50 but I did not spot that function in the proposed patch (I am not a coder, so I might be wrong).
Comment 68 Philipp Kewisch [:Fallen] 2008-12-06 01:14:15 PST
Debitrotting this patch doesn't seem quite enough. I've done so locally but haven't succeeded in opening tabs yet. Also I do hope there is a better solution than using prefs. It does seem that using prefs is a common option, but looking at the code I'm not quite happy yet.

I think we should keep the number of options to a minimum in this patch and then add options like -import in a subsequent patch/bug.
Comment 69 Martin Schröder [:mschroeder] 2009-01-10 05:07:46 PST
Comment on attachment 338838 [details] [diff] [review]
Commandline options v6 working

Removing review request because this patch is significantly bitrotted.
Comment 70 Stefan Sitter 2012-08-23 23:40:29 PDT
*** Bug 776244 has been marked as a duplicate of this bug. ***
Comment 71 nodiscc 2014-07-08 02:54:42 PDT
Any update on this?
Comment 72 Stefan Sitter 2014-09-22 09:10:21 PDT
*** Bug 1071014 has been marked as a duplicate of this bug. ***
Comment 73 Marco 2015-06-19 08:00:21 PDT
I'm interested to. Any update?
Comment 74 patrice Arnal 2015-06-19 08:50:13 PDT
Me too...
Comment 75 Skip 2015-06-29 05:22:47 PDT
I'm also interested...
Comment 76 Mozilla Marsu 2016-02-01 04:12:56 PST
tl;dr: Please make this happen, will ya?

Even after getting the boot from Mozilla, the Thunderbird team has been doing great work recently. But how on earth are people expected to work with calendar on a daily basis and go through the "find the icon and click on" routine each and every time?

Even if there's some new magic way to get right to Lightning I'm not aware of (I'm running 44b), please add the legacy -calendar shortcut because this is such a widespread (defunct) solution.

Note You need to log in before you can comment on or make changes to this bug.