diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/all-studies-window.js b/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/all-studies-window.js index cc42cbe20e5..bed2286972d 100644 --- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/all-studies-window.js +++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/all-studies-window.js @@ -210,6 +210,7 @@ var TestPilotXulWindow = { Components.utils.import("resource://testpilot/modules/tasks.js"); this._stringBundle = document.getElementById("testpilot-stringbundle"); + this.sizeWindow(); this._init(false); Observers.add("testpilot:task:changed", this._onTaskStatusChanged, this); }, @@ -241,8 +242,8 @@ var TestPilotXulWindow = { } if (!ready) { - // If you opened the window before tasks are done loading, exit now but try - // again in a few seconds. + // If you opened the window before tasks are done loading, exit now + // but try again in a few seconds. window.setTimeout( function() { TestPilotXulWindow._init(aReload); }, 2000); return; @@ -419,7 +420,28 @@ var TestPilotXulWindow = { // Show number of studies the user finished on badge: document.getElementById("num-finished-badge").setAttribute( "value", numFinishedStudies); + }, + sizeWindow: function() { + // Size listboxes based on available screen size, then size window to fit + // list boxes. + let currList = document.getElementById("current-studies-listbox"); + let finList = document.getElementById("finished-studies-listbox"); + let resultsList = document.getElementById("study-results-listbox"); + + let screenWidth = window.screen.availWidth; + let screenHeight = window.screen.availHeight; + let width = screenWidth >= 800 ? 700 : screenWidth - 100; + let height = screenHeight >= 800 ? 700 : screenHeight - 100; + + height -= 130; // Or whatever is height of title bar plus windowdragbox + + currList.width = width; + currList.height = height; + finList.width = width; + finList.height = height; + resultsList.width = width; + resultsList.height = height; window.sizeToContent(); }, diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/browser.css b/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/browser.css index db8bbbd2f22..6a6b465e7f8 100644 --- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/browser.css +++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/browser.css @@ -133,11 +133,6 @@ image.study-result { font-size: 16px; } -#test-pilot-all-studies-window { - min-width: 720px !important; - min-height: 500px !important; -} - #test-pilot-all-studies-window > .prefWindow-dlgbuttons { display: none; } @@ -174,13 +169,12 @@ image.study-result { } richlistbox.tp-study-list { - height: 522px; - width: 502px; overflow: auto; margin: 0px; } .tp-tab-panel { + background-color: -moz-dialog; padding: 0px; } diff --git a/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/window-utils.js b/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/window-utils.js index 79bfd2c26ea..e722478ba82 100644 --- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/window-utils.js +++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/content/window-utils.js @@ -54,7 +54,8 @@ var TestPilotWindowUtils; } else { allStudiesWindow = window.openDialog( "chrome://testpilot/content/all-studies-window.xul", - ALL_STUDIES_WINDOW_NAME, "chrome,titlebar,centerscreen,dialog=no"); + ALL_STUDIES_WINDOW_NAME, + "chrome,titlebar,centerscreen,dialog=no"); } }, @@ -130,9 +131,14 @@ var TestPilotWindowUtils; // TODO this window opening triggers studies' window-open code. // Is that what we want or not? + let screenWidth = window.screen.availWidth; + let screenHeight = window.screen.availHeight; + let width = screenWidth >= 1200 ? 1000 : screenWidth - 200; + let height = screenHeight >= 1000 ? 800 : screenHeight - 200; + let win = window.open(url, "TestPilotStudyDetailWindow", "chrome,centerscreen,resizable=yes,scrollbars=yes," + - "status=no,width=1000,height=800"); + "status=no,width=" + width + ",height=" + height); win.focus(); } };