<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Liam,<br>
<br>
Sorry for the delay in replying. I've been updating the bug with a
comment, but I'm replying here as well for posterity.<br>
<br>
<div class="moz-cite-prefix">On 03/01/2013 07:26 AM, Liam
Edwards-Playne wrote:<br>
</div>
<blockquote
cite="mid:1362119188.65302.YahooMailNeo@web161403.mail.bf1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:verdana, helvetica, sans-serif;font-size:10pt">
<div id="yiv1849058986">
<div>
<div style="background-color: rgb(255, 255, 255);
font-family: verdana, helvetica, sans-serif;">
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="color: rgb(0, 0, 0); font-family: verdana,
helvetica, sans-serif; font-size: 10pt;"><span
id="yiv1849058986yui_3_7_2_16_1362043379697_62">Hello
all,</span></div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="color: rgb(0, 0, 0); font-family: verdana,
helvetica, sans-serif; font-size: 13px;
background-color: transparent; font-style: normal;"><span
id="yiv1849058986yui_3_7_2_16_1362043379697_68"><br>
</span></div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent; font-family:
verdana, helvetica, sans-serif;"><span
id="yiv1849058986yui_3_7_2_16_1362043379697_94"><span
style="font-size: 13px;">As you may/may not know,
I've been working on tabbed composition for the past
month now and I'd like some help on the
codebase/architecture. Currently </span></span><span
style="color: rgb(0, 0, 0); font-family: verdana,
helvetica, sans-serif; font-size: 13px;
background-color: transparent;">ported the bulk of
OpenComposeWindow and OpenComposeWindowParams to JS
functions and have rewritten nearly all the calls to
the JS port, and now looking into the window/tab
management stuff. </span><span style="color: rgb(0, 0,
0); font-family: verdana, helvetica, sans-serif;
font-size: 13px; background-color: transparent;"> </span></div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="color: rgb(0, 0, 0); font-family: verdana,
helvetica, sans-serif; font-size: 13px;
background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56"><span
style="font-style:normal;"><br>
As discussed on BugZilla, it would be best to
implement the new 'compose tab' like the message view
tab (mail/base/content/</span><span style="font-style:
italic;">mailTabs.js</span><span
style="font-style:normal;">), so it can be opened in
either a new window or new tab and so forth. This
would also allow for older users to still use windows
(should tabbed composition be a default?). So how are
they implemented? How can I iterate over open compose
tabs etc.?</span></div>
</div>
</div>
</div>
</div>
</blockquote>
The bulk of the code that does tab handling is in
<a class="moz-txt-link-freetext" href="http://mxr.mozilla.org/comm-central/source/mail/base/content/tabmail.xml">http://mxr.mozilla.org/comm-central/source/mail/base/content/tabmail.xml</a>
. You can iterate over tabs by doing (untested):<br>
<br>
let tabmail = document.getElementById("tabmail");<br>
for (let candidate of tabmail.tabInfo)<br>
dump(candidate.mode);<br>
<br>
You can easily define new tab types, I'm pretty sure that's what I
did with the "compose in a tab" experiment. You have to reimplement
a few things yourself but specialtabs.js contains good examples of
how to implement a new tab type.<br>
<blockquote
cite="mid:1362119188.65302.YahooMailNeo@web161403.mail.bf1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:verdana, helvetica, sans-serif;font-size:10pt">
<div id="yiv1849058986">
<div>
<div style="background-color: rgb(255, 255, 255);
font-family: verdana, helvetica, sans-serif;">
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="color: rgb(0, 0, 0); font-family: verdana,
helvetica, sans-serif; font-size: 13px;
background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56"><span
style="font-style:normal;"><br>
</span></div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="color: rgb(0, 0, 0); font-family: verdana,
helvetica, sans-serif; font-size: 13px;
background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56">After this, I have
to finish porting OpenComposeWindow, which includes:</div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56">
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56"><span
style="font-size: 13px;">- integrating
GetOrigWindowSelection to use the new compose tab
mode</span></div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56"><span
style="font-size: 13px;">- integrating LoadDraftOrTemplate
- which is a </span><span style="font-size: 13px;
background-color: transparent;">tricky function
compared to the others because it goes down a long
road of function calls (DisplayMessage onwards)
before it reaches any UI-related code. </span></div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56"><span
style="font-size: 13px;">- integrating ComposeMessage
to iterate through open draft tabs</span></div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56"><span
style="font-size: 13px;">- rewrite the argument
passing mechanism (nsMsgComposeParams) to use
something other than window.arguments -
MsgComposeCommands.js</span></div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56"><span
style="font-size: 13px;">- some other misc. stuff
todo with js string encoding</span></div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
I would suggest, as much as you can, to break this down into smaller
patches. You could implement, as a first step, a "composition
manager" written in JS. The JS object would provide JS-implemented
versions of GetOrigWindowSelection, possibly LoadDraftOrTemplate.
This would simplify the code by a significant margin, while
providing after that an easy way to build on top of that JS and make
it work with composition in a tab. Iterating of the tabs from C++,
inside GetOrigWindowSelection is going to be an incredible pain -- I
think it's worth looking into switching some of these methods to JS
first.<br>
<blockquote
cite="mid:1362119188.65302.YahooMailNeo@web161403.mail.bf1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:verdana, helvetica, sans-serif;font-size:10pt">
<div id="yiv1849058986">
<div>
<div style="background-color: rgb(255, 255, 255);
font-family: verdana, helvetica, sans-serif;">
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56">
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56"><span
style="font-size: 13px;"><br>
</span></div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56"><span
style="font-size: 13px;">After that, some more
things:<br>
</span></div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56"><span
style="font-size: 13px;">- Rewrite the code to close
the message tab (so it doesn't try to close the
window and crash)</span></div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
I've had that as well!<br>
<blockquote
cite="mid:1362119188.65302.YahooMailNeo@web161403.mail.bf1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:verdana, helvetica, sans-serif;font-size:10pt">
<div id="yiv1849058986">
<div>
<div style="background-color: rgb(255, 255, 255);
font-family: verdana, helvetica, sans-serif;">
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56">
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="background-color: transparent;"
class="yui_3_7_2_17_1362116764957_56"><span
style="font-size: 13px;">- Redesign the UX so there
are not 2 menu bars - this will be very interesting</span></div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
This is another big chunk of work. What about having the
"composition in a tab" feature pref'd off, while we work out to
solve these issues? This would allow you to land a first set of
patches and prevent them from bitrotting, and this would allow other
people to start playing with the feature and find bugs, while we
solve other problems in smaller chunks.<br>
<blockquote
cite="mid:1362119188.65302.YahooMailNeo@web161403.mail.bf1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:verdana, helvetica, sans-serif;font-size:10pt">
<div id="yiv1849058986">
<div>
<div style="background-color: rgb(255, 255, 255);
font-family: verdana, helvetica, sans-serif;">
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="color: rgb(0, 0, 0); font-family: verdana,
helvetica, sans-serif; font-size: 13px;
background-color: transparent; font-style: normal;">-
Add options similar to
"Preferences->Advanced->Reading and Display" (open
message in new tab/window etc.)</div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="color: rgb(0, 0, 0); font-family: verdana,
helvetica, sans-serif; font-size: 13px;
background-color: transparent; font-style: normal;"
class="yui_3_7_2_17_1362116764957_61"><br>
</div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="color: rgb(0, 0, 0); font-family: verdana,
helvetica, sans-serif; font-size: 13px;
background-color: transparent; font-style: normal;"
class="yui_3_7_2_17_1362116764957_61">When the majority
of the coding is done, we'll have to get in touch with
UX for the menu bar and whether compose should open in a
new tab by default. </div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="color: rgb(0, 0, 0); font-family: verdana,
helvetica, sans-serif; font-size: 13px;
background-color: transparent; font-style: normal;"
class="yui_3_7_2_17_1362116764957_61"><br>
</div>
<div id="yiv1849058986yui_3_7_2_16_1362043379697_48"
style="color: rgb(0, 0, 0); font-family: verdana,
helvetica, sans-serif; font-size: 13px;
background-color: transparent; font-style: normal;"
class="yui_3_7_2_17_1362116764957_61">Look forward to
getting this long-awaited feature done.</div>
</div>
</div>
</div>
</div>
</blockquote>
As Magnus said on the bug, it's usually better to hang out in
#maildev on IRC as people tend to be more responsive there.<br>
<br>
Good luck and don't hesitate to ask specific questions about the
code in this thread, I'll do my best to reply if I have the
knowledge.<br>
<br>
Cheers,<br>
<br>
jonathan<br>
</body>
</html>