Bug 501095 Clean up appPicker.xul r=Mano

This commit is contained in:
Neil Rashbrook 2009-09-09 23:18:35 +01:00
Родитель 9107a1f2a2
Коммит ad88beaa35
3 изменённых файлов: 34 добавлений и 92 удалений

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

@ -89,20 +89,7 @@ AppPicker.prototype =
// Grab a list of nsILocalHandlerApp application helpers to list
var fileList = mimeInfo.possibleLocalHandlers;
/*
<richlistitem id="app-picker-item" value=nsfileobject>
<hbox align="center">
<image id="app-picker-item-image" src=""/>
<vbox>
<hbox align="center">
<listcell id="app-picker-item-cell" label="Outlook"/>
</hbox>
</vbox>
</hbox>
</richlistitem>
*/
var list = document.getElementById("app-picker-list");
var list = document.getElementById("app-picker-listbox");
var primaryCount = 0;
@ -121,32 +108,11 @@ AppPicker.prototype =
continue;
}
var item = document.createElement("richlistitem");
item.setAttribute("id", "app-picker-item");
item.value = file;
item.label = this.getFileDisplayName(file.executable);
item.setAttribute("ondblclick", "g_dialog.appDoubleClick();");
var hbox1 = document.createElement("hbox");
hbox1.setAttribute("align", "center");
var image = document.createElement("image");
image.setAttribute("id", "app-picker-item-image");
image.setAttribute("src", this.getFileIconURL(file.executable));
var vbox1 = document.createElement("vbox");
var hbox2 = document.createElement("hbox");
hbox2.setAttribute("align", "center");
var cell = document.createElement("listcell");
cell.setAttribute("id", "app-picker-item-cell");
cell.setAttribute("label", this.getFileDisplayName(file.executable));
hbox2.appendChild(cell);
vbox1.appendChild(hbox2);
hbox1.appendChild(image);
hbox1.appendChild(vbox1);
item.appendChild(hbox1);
var item = document.createElement("listitem");
item.className = "listitem-iconic";
item.handlerApp = file;
item.setAttribute("label", this.getFileDisplayName(file.executable));
item.setAttribute("image", this.getFileIconURL(file.executable));
list.appendChild(item);
primaryCount++;
@ -206,7 +172,7 @@ AppPicker.prototype =
* Double click accepts an app
*/
appDoubleClick: function appDoubleClick() {
var list = document.getElementById("app-picker-list");
var list = document.getElementById("app-picker-listbox");
var selItem = list.selectedItem;
if (!selItem) {
@ -214,7 +180,7 @@ AppPicker.prototype =
return true;
}
this._incomingParams.handlerApp = selItem.value;
this._incomingParams.handlerApp = selItem.handlerApp;
window.close();
return true;
@ -223,14 +189,14 @@ AppPicker.prototype =
appPickerOK: function appPickerOK() {
if (this._incomingParams.handlerApp) return true;
var list = document.getElementById("app-picker-list");
var list = document.getElementById("app-picker-listbox");
var selItem = list.selectedItem;
if (!selItem) {
this._incomingParams.handlerApp = null;
return true;
}
this._incomingParams.handlerApp = selItem.value;
this._incomingParams.handlerApp = selItem.handlerApp;
return true;
},

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

@ -41,7 +41,9 @@
<dialog id="app-picker"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="g_dialog.appPickerLoad();"
buttons="accept,cancel"
buttons="accept,cancel,extra2"
buttonlabelextra2="&BrowseButton.label;"
ondialogextra2="g_dialog.appPickerBrowse();"
defaultButton="cancel"
ondialogaccept="return g_dialog.appPickerOK();"
ondialogcancel="return g_dialog.appPickerCancel();"
@ -49,25 +51,18 @@
<script type="application/javascript" src="chrome://global/content/appPicker.js"/>
<vbox>
<hbox id="file-info" align="left">
<image id="content-icon" src="" />
<vbox flex="1">
<label id="content-description" crop="center" value=""/>
<label id="suggested-filename" crop="center" value=""/>
</vbox>
</hbox>
<spacer height="10px"/>
<label id="sendto-message" value="&SendMsg.label;"/>
<hbox id="file-info" align="center">
<image id="content-icon" src=""/>
<vbox flex="1">
<label id="content-description" crop="center" value=""/>
<label id="suggested-filename" crop="center" value=""/>
</vbox>
</hbox>
<richlistbox id="app-picker-list">
</richlistbox>
<label id="sendto-message" value="&SendMsg.label;" for="app-picker-listbox"/>
<label id="app-picker-notfound" value="&NoAppFound.label;" hidden="true"/>
<listbox id="app-picker-listbox" rows="5"
ondblclick="g_dialog.appDoubleClick();"/>
<hbox>
<spacer flex="1"/>
<button id="browse-button" onclick="g_dialog.appPickerBrowse();" label="&BrowseButton.label;" align="center"/>
</hbox>
</vbox>
<label id="app-picker-notfound" value="&NoAppFound.label;" hidden="true"/>
</dialog>

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

@ -1,39 +1,20 @@
#app-picker {
width:320px !important;
max-width:320px !important;
width: 320px;
}
#content-description {
font-weight:bold;
font-weight: bold;
}
#suggested-filename {
font-weight:normal;
#content-icon,
.listcell-icon {
height: 32px;
width: 32px;
}
#file-info {
#content-icon,
.listcell-icon,
.listcell-label {
margin: 5px;
}
#app-picker-list {
height:225px;
min-height:225px;
}
#app-picker-item {
padding-bottom:5px;
padding-top:5px;
}
#app-picker-item-image {
}
#app-picker-item-cell {
font-weight:normal;
padding-right:10px;
padding-left:10px;
}
#browse-button {
margin-top:10px;
}