Make it easy to close the account window or a conversation tab. When the last conversation tab is closed, close the conversation window.

This commit is contained in:
Florian Quèze 2007-09-30 23:22:37 +02:00
Родитель 3c2a4e0cbd
Коммит 4f2153ffc0
4 изменённых файлов: 34 добавлений и 1 удалений

Просмотреть файл

@ -19,6 +19,16 @@
<script type="application/javascript" src="chrome://instantbird/content/accounts.js"/>
<stringbundle id="accountsBundle" src="chrome://instantbird/locale/accounts.properties"/>
<commandset id="accountsCommands">
<command id="cmd_close" oncommand="gAccountManager.close()"/>
</commandset>
<keyset id="accountsKeys">
<key id="key_close1" key="w" modifiers="accel" command="cmd_close"/>
<key id="key_close2" keycode="VK_ESCAPE" command="cmd_close"/>
</keyset>
<richlistbox id="accountlist" flex="1"/>
<hbox id="bottombuttons">
<button id="newaccount" oncommand="gAccountManager.new()"

Просмотреть файл

@ -95,6 +95,12 @@
var convWindow = wm.getMostRecentWindow("Messenger:convs");
if (convWindow)
convWindow.msgObserver.focusConv(conv);
else {
// the conversation window has been closed. Force reopening.
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.notifyObservers(conv, "new-conversation", null);
}
]]>
</handler>
</handlers>

Просмотреть файл

@ -59,6 +59,9 @@ var msgObserver = {
},
addConvTab: function mo_addConvTab(aConv, aTitle) {
if (aConv.id in this.convs)
return this.convs[aConv.id];
var conv = document.createElement("conversation");
var panels = document.getElementById("panels");
panels.appendChild(conv);
@ -99,6 +102,11 @@ var msgObserver = {
panels.selectedPanel.focus();
},
closeCurrentTab: function mo_closeCurrentTab() {
var tabs = document.getElementById("tabs");
this.closeTab(tabs.selectedItem);
},
closeTab: function mo_closeTab(aTab) {
var tabs = aTab.parentNode.childNodes;
var i = aTab.parentNode.getIndexOfItem(aTab);
@ -125,7 +133,7 @@ var msgObserver = {
panels.selectedPanel = conv.nextSibling;
}
else {
// we should close the window!
window.close();
}
}
}

Просмотреть файл

@ -20,6 +20,15 @@
xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://instantbird/content/utilities.js"/>
<script type="application/javascript" src="chrome://instantbird/content/instantbird.js"/>
<commandset id="conversationsCommands">
<command id="cmd_close" oncommand="msgObserver.closeCurrentTab()"/>
</commandset>
<keyset id="conversationsKeys">
<key id="key_close" key="w" modifiers="accel" command="cmd_close"/>
</keyset>
<tabbox flex="1">
<tabs id="tabs" context="tabs-context-menu" onselect="msgObserver.onSelectTab();"/>
<tabpanels id="panels" flex="1"/>