Bug 954255 - Better window positions at first start.

This commit is contained in:
Florian Quèze 2011-06-15 19:21:58 +02:00
Родитель bc8d5de639
Коммит 9da78d61d2
5 изменённых файлов: 28 добавлений и 41 удалений

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

@ -592,6 +592,14 @@ var buddyList = {
}
}
// Move the window to the right of the screen on new profiles.
let docElt = document.documentElement;
if (!docElt.hasAttribute("height")) {
docElt.setAttribute("height", screen.availHeight || 600);
let width = parseInt(docElt.getAttribute("width"));
window.moveTo(screen.availLeft + screen.availWidth - width, 0);
}
// TODO remove this once we cleanup the way the menus are inserted
let menubar = document.getElementById("blistMenubar");
let statusArea = document.getElementById("statusArea");

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

@ -54,7 +54,6 @@
windowtype="Messenger:blist"
title = "&contacts.title;"
width = "200"
height = "600"
persist= "width height screenX screenY"
#ifndef XP_MACOSX
onclose= "event.preventDefault(); goQuitApplication();"

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

@ -35,9 +35,6 @@
*
* ***** END LICENSE BLOCK ***** */
const addonManagerWindow = "chrome://instantbird/content/extensions.xul";
const accountManagerWindow = "chrome://instantbird/content/accounts.xul";
const blistWindow = "chrome://instantbird/content/blist.xul";
const addBuddyWindow = "chrome://instantbird/content/addbuddy.xul";
const joinChatWindow = "chrome://instantbird/content/joinchat.xul";
const aboutWindow = "chrome://instantbird/content/aboutDialog.xul";
@ -50,16 +47,8 @@ if (!("Core" in window))
Components.utils.import("resource:///modules/ibCore.jsm");
var menus = {
focus: function menu_focus(aWindowType) {
var win = Services.wm.getMostRecentWindow(aWindowType);
if (win)
win.focus();
return win;
},
about: function menu_about() {
if (!this.focus("Messenger:About"))
window.open(aboutWindow, "About",
Core.showWindow("Messenger:About", aboutWindow, "About",
"chrome,resizable=no,minimizable=no,centerscreen");
},
@ -72,14 +61,11 @@ var menus = {
},
addons: function menu_addons() {
if (!this.focus("Addons:Manager"))
window.open(addonManagerWindow, "Addons",
"chrome,menubar,extra-chrome,toolbar,dialog=no,resizable");
Core.showAddons();
},
errors: function debug_errors() {
if (!menus.focus("global:console"))
window.open(errorConsoleWindow, "Errors",
Core.showWindow("global:console", errorConsoleWindow, "Errors",
"chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
},
@ -199,9 +185,11 @@ var menus = {
if (!status)
return; // is this really possible?
let blist = this.focus("Messenger:blist");
if (blist)
let blist = Services.wm.getMostRecentWindow("Messenger:blist");
if (blist) {
blist.focus();
blist.buddyList.startEditStatus(status);
}
else {
Services.core.setStatus(Status.toFlag(status),
Services.core.currentStatusMessage);

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

@ -38,6 +38,9 @@
#
# ***** END LICENSE BLOCK *****
if (!("Core" in window))
Components.utils.import("resource:///modules/ibCore.jsm");
var gMainPane = {
_pane: null,
@ -49,24 +52,12 @@ var gMainPane = {
this._pane = document.getElementById("paneMain");
},
/**
* Helper to focus an already existing window before opening a new one.
*/
focus: function (aWindowType) {
var win = Services.wm.getMostRecentWindow(aWindowType);
if (win)
win.focus();
return win;
},
/**
* Displays the Add-ons Manager.
*/
showAccountsMgr: function ()
{
if (!this.focus("Messenger:Accounts"))
window.open("chrome://instantbird/content/accounts.xul", "Accounts",
"chrome,resizable");
Core.showAccounts();
},
/**
@ -74,10 +65,6 @@ var gMainPane = {
*/
showAddonsMgr: function ()
{
const AMURL = "chrome://instantbird/content/extensions.xul";
if (!this.focus("Addons:Manager"))
window.open(AMURL, "Addons",
"chrome,menubar,extra-chrome,toolbar,dialog=no,resizable");
Core.showAddons();
}
};

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

@ -130,7 +130,12 @@ var Core = {
showAccounts: function() {
this.showWindow("Messenger:Accounts",
"chrome://instantbird/content/accounts.xul", "Accounts",
"chrome,resizable");
"chrome,resizable,centerscreen");
},
showAddons: function() {
this.showWindow("Addons:Manager",
"chrome://instantbird/content/extensions.xul", "Addons",
"chrome,menubar,extrachrome,toolbar,dialog=no,resizable,centerscreen");
},
showContacts: function() {
this.showWindow("Messenger:blist",