Continue XBLification, add support for Live bookmarks, better error checking

git-svn-id: svn://10.0.0.236/trunk@193429 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mkaply%us.ibm.com 2006-04-03 20:01:09 +00:00
parent 003bfbc99d
commit 3e5eed0ca7
8 changed files with 423 additions and 301 deletions

View File

@ -88,16 +88,14 @@
<!ENTITY customizePartFour.label "Customize the Browser - Part Four">
<!ENTITY allowedSites.caption "Allowed Sites">
<!ENTITY allowedSites.description "You can specify domains for which popups and/or XPI installs are allowed. List the domains, separated by a comma.">
<!ENTITY popupAllowedSites.label "Popup Allowed Sites:">
<!ENTITY installAllowedSites.label "Install Allowed Sites:">
<!ENTITY popupAllowedSites.label "You can specify domains for which popups are allowed. List the domains, separated by a comma.">
<!ENTITY installAllowedSites.label "You can specify domains for which software installations (XPIs) are allowed. List the domains, separated by a comma.">
<!ENTITY customizeBrowserPlugins.label "Customize Browser Plug-ins">
<!ENTITY browserPlugins.description "Use the buttons below to add browser plug-ins.">
<!ENTITY plugins.label "Browser Plug-ins">
<!ENTITY plugins.description "Please select a browser plug-
in and the platform it is written for.">
<!ENTITY plugins.description "Please select a browser plug-in and the platform it is written for.">
<!ENTITY customizeSearchEngines.label "Customize Search Engines">
<!ENTITY searchEngines.description "Use the buttons below to add search engines.">
@ -110,14 +108,17 @@ in and the platform it is written for.">
<!ENTITY file.label "File:">
<!ENTITY icon.label "Icon:">
<!ENTITY bmFolder.error "You must specify a folder name">
<!ENTITY folderTitle.label "Folder Title:">
<!ENTITY customizeToolbarOne.label "Customize the Personal Toolbar - Part One">
<!ENTITY addToolbarFolder.caption "Add a folder to the personal toolbar">
<!ENTITY addToolbarFolder.description "You can add a folder with up to five bookmarks to the personal toolbar.">
<!ENTITY addToolbarFolder.description "Use the buttons below to add bookmarks to a folder on the personal toolbar.">
<!ENTITY addToolbarBookmark.caption "Add bookmarks to the personal toolbar">
<!ENTITY addToolbarBookmark.description "You can add up to five bookmarks to the personal toolbar.">
<!ENTITY addToolbarBookmark.description "Use the buttons below to add bookmarks to the personal toolbar.">
@ -127,9 +128,9 @@ in and the platform it is written for.">
<!ENTITY customizeBookmarksTwo.label "Customize Bookmarks - Part Two">
<!ENTITY addBookmarkFolder.caption "Add a folder to bookmarks">
<!ENTITY addBookmarkFolder.description "You can add a folder with up to five bookmarks to bookmarks.">
<!ENTITY addBookmarkFolder.description "Use the buttons below to create a folder with boomarks.">
<!ENTITY addBookmark.caption "Add bookmarks">
<!ENTITY addBookmark.description "You can add up to five bookmarks.">
<!ENTITY addBookmark.description "Use the buttons below to add bookmarks.">
<!ENTITY bookmark.label "Bookmark">
@ -140,22 +141,27 @@ in and the platform it is written for.">
<!ENTITY customizePrefs.label "Customize Preferences">
<!ENTITY prefs.label "Preferences">
<!ENTITY prefs.description "Note these preferences are stored exactly as written, so put quotes around string preferences.">
<!ENTITY prefs.description "Use the buttons below to add default preferences. Note these preferences are stored exactly as written, so put quotes around string preferences.">
<!ENTITY prefName.label "Preference Name">
<!ENTITY prefValue.label "Value: ">
<!ENTITY newButton.label "New">
<!ENTITY newButton.accesskey "N">
<!ENTITY newButton.accesskey "W">
<!ENTITY deleteButton.label "Delete">
<!ENTITY deleteButton.accesskey "D">
<!ENTITY editButton.label "Edit">
<!ENTITY editButton.accesskey "E">
<!ENTITY moveUpButton.label "Move Up">
<!ENTITY moveUpButton.accesskey "U">
<!ENTITY moveDownButton.label "Move Down">
<!ENTITY moveDownButton.accesskey "O">
<!ENTITY customizeRegistry.label "Customize Registry (Windows Only)">
<!ENTITY registry.label "Registry">
<!ENTITY registry.description "You can add registry items.">
<!ENTITY registry.description "Use the buttons below to add entries to the Windows registry. Note these items will be added/updated every time the browser starts.">
<!ENTITY regRootKey.label "Root Key">
<!ENTITY regKey.label "Key">

View File

@ -57,5 +57,6 @@
<textbox flex="1" id="bookmarkname" onchange="bookmarkCheckOKButton();" onkeyup="bookmarkCheckOKButton();"/>
<label>&bookmarkURL.label;</label>
<textbox flex="1" id="bookmarkurl" onchange="bookmarkCheckOKButton();" onkeyup="bookmarkCheckOKButton();"/>
<checkbox id="liveBookmark" label="Live Bookmark"/>
</vbox>
</dialog>

View File

@ -2,3 +2,4 @@ box.ccklist {
-moz-binding: url('chrome://cckwizard/content/ccklist.xml#ccklist');
}
.listcell-icon { max-width: 16px; max-height: 16px; }

View File

@ -13,6 +13,8 @@
<xul:button label="&newButton.label;" accesskey="&newButton.accesskey;" type="new"/>
<xul:button label="&editButton.label;" accesskey="&editButton.accesskey;" type="edit"/>
<xul:button label="&deleteButton.label;" accesskey="&deleteButton.accesskey;" type="delete"/>
<xul:button label="&moveUpButton.label;" accesskey="&moveUpButton.accesskey;" type="moveup"/>
<xul:button label="&moveDownButton.label;" accesskey="&moveDownButton.accesskey;" type="movedown"/>
<xul:spacer flex="1"/>
</xul:vbox>
</xul:hbox>
@ -20,7 +22,9 @@
<implementation>
<constructor>
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[1].setAttribute("disabled","true");
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[2].setAttribute("disabled","true");
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[2].setAttribute("disabled","true");
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[3].setAttribute("disabled","true");
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[4].setAttribute("disabled","true");
</constructor>
<method name="clear">
<body>
@ -55,7 +59,18 @@
<body>
<![CDATA[
var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
return listbox.appendItem(label, value);
listboxitem = listbox.appendItem(label, value);
listboxitem.cck = new Array();
if (listbox.selectedIndex != 0)
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[3].setAttribute("disabled","false");
else
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[3].setAttribute("disabled","true");
if (listbox.selectedIndex != listbox.getRowCount()-1)
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[4].setAttribute("disabled","false");
else
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[4].setAttribute("disabled","true");
return listboxitem;
]]>
</body>
</method>
@ -67,6 +82,15 @@
<handler event="select">
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[1].setAttribute("disabled","false");
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[2].setAttribute("disabled","false");
var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
if (listbox.selectedIndex != 0)
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[3].setAttribute("disabled","false");
else
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[3].setAttribute("disabled","true");
if (listbox.selectedIndex != listbox.getRowCount()-1)
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[4].setAttribute("disabled","false");
else
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[4].setAttribute("disabled","true");
</handler>
<handler event="dblclick">
if (event.originalTarget.tagName == "richlistitem")
@ -78,6 +102,37 @@
listbox.removeItemAt(listbox.selectedIndex);
return;
}
if ((event.originalTarget.type == "moveup") || (event.originalTarget.type == "movedown")) {
var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
var listitem=listbox.selectedItem;
var index;
if (event.originalTarget.type == "moveup")
index = listbox.selectedIndex-1;
else
index = listbox.selectedIndex+2;
var newlistitem;
if (index >= listbox.getRowCount()) {
newlistitem = listbox.appendItem(listitem.label , listitem.value);
} else {
newlistitem = listbox.insertItemAt(index, listitem.label , listitem.value);
}
newlistitem.cck = listitem.cck;
if (listitem.getAttribute("class") == "listitem-iconic") {
newlistitem.setAttribute("class", "listitem-iconic");
newlistitem.setAttribute("image", listitem.getAttribute("image"));
}
listbox.removeItemAt(listbox.selectedIndex);
listbox.selectItem(newlistitem);
if (listbox.selectedIndex != 0)
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[3].setAttribute("disabled","false");
else
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[3].setAttribute("disabled","true");
if (listbox.selectedIndex != listbox.getRowCount()-1)
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[4].setAttribute("disabled","false");
else
document.getAnonymousNodes(this)[0].childNodes[1].childNodes[4].setAttribute("disabled","true");
}
eval(this.getAttribute(event.originalTarget.type));
</handler>
</handlers>

View File

@ -405,6 +405,8 @@ function OnBookmarkLoad()
if (window.name == 'editbookmark') {
document.getElementById('bookmarkname').value = listbox.selectedItem.label;
document.getElementById('bookmarkurl').value = listbox.selectedItem.value;
if (listbox.selectedItem.cck['type'] == "live")
document.getElementById('liveBookmark').checked = true;
}
bookmarkCheckOKButton();
}
@ -422,11 +424,21 @@ function OnBookmarkOK()
{
listbox = this.opener.document.getElementById(getPageId() +'.bookmarkList');
var listitem;
if (window.name == 'newbookmark') {
listbox.appendItem(document.getElementById('bookmarkname').value, document.getElementById('bookmarkurl').value);
listitem = listbox.appendItem(document.getElementById('bookmarkname').value, document.getElementById('bookmarkurl').value);
listitem.setAttribute("class", "listitem-iconic");
} else {
listbox.selectedItem.label = document.getElementById('bookmarkname').value;
listbox.selectedItem.value = document.getElementById('bookmarkurl').value;
listitem = listbox.selectedItem;
listitem.label = document.getElementById('bookmarkname').value;
listitem.value = document.getElementById('bookmarkurl').value;
}
if (document.getElementById('liveBookmark').checked) {
listitem.cck['type'] = "live";
listitem.setAttribute("image", "chrome://browser/skin/page-livemarks.png");
} else {
listitem.setAttribute("image", "chrome://browser/skin/Bookmarks-folder.png");
listitem.cck['type'] = "";
}
}
@ -497,11 +509,11 @@ function OnRegLoad()
listbox = this.opener.document.getElementById('regList');
if (window.name == 'editreg') {
document.getElementById('PrettyName').value = listbox.selectedItem.label;
document.getElementById('RootKey').value = listbox.selectedItem.rootkey;
document.getElementById('Key').value = listbox.selectedItem.key;
document.getElementById('Name').value = listbox.selectedItem.name;
document.getElementById('NameValue').value = listbox.selectedItem.namevalue;
document.getElementById('Type').value = listbox.selectedItem.type;
document.getElementById('RootKey').value = listbox.selectedItem.cck['rootkey'];
document.getElementById('Key').value = listbox.selectedItem.cck['key'];
document.getElementById('Name').value = listbox.selectedItem.cck['name'];
document.getElementById('NameValue').value = listbox.selectedItem.cck['namevalue'];
document.getElementById('Type').value = listbox.selectedItem.cck['type'];
}
}
@ -517,22 +529,19 @@ function regCheckOKButton()
function OnRegOK()
{
listbox = this.opener.document.getElementById('regList');
listbox = this.opener.document.getElementById('regList');
var listitem;
if (window.name == 'newreg') {
var listitem = listbox.appendItem(document.getElementById('PrettyName').value, "");
listitem.rootkey = document.getElementById('RootKey').value;
listitem.key = document.getElementById('Key').value;
listitem.name = document.getElementById('Name').value;
listitem.namevalue = document.getElementById('NameValue').value;
listitem.type = document.getElementById('Type').value;
listitem = listbox.appendItem(document.getElementById('PrettyName').value, "");
} else {
listbox.selectedItem.label = document.getElementById('PrettyName').value;
listbox.selectedItem.rootkey = document.getElementById('RootKey').value;
listbox.selectedItem.key = document.getElementById('Key').value;
listbox.selectedItem.name = document.getElementById('Name').value;
listbox.selectedItem.namevalue = document.getElementById('NameValue').value;
listbox.selectedItem.type = document.getElementById('Type').value;
listitem = listbox.selectedItem;
listitem.label = document.getElementById('PrettyName').value;
}
listitem.cck['rootkey'] = document.getElementById('RootKey').value;
listitem.cck['key'] = document.getElementById('Key').value;
listitem.cck['name'] = document.getElementById('Name').value;
listitem.cck['namevalue'] = document.getElementById('NameValue').value;
listitem.cck['type'] = document.getElementById('Type').value;
}
function onNewSearchEngine()
@ -578,8 +587,8 @@ function OnSearchEngineOK()
listbox.selectedItem.label = document.getElementById('searchengine').value;
listbox.selectedItem.value = document.getElementById('searchengineicon').value;
}
var sourcefile = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
var sourcefile = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
sourcefile.initWithPath(document.getElementById('searchengineicon').value);
var ioServ = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
@ -587,14 +596,53 @@ function OnSearchEngineOK()
listitem.setAttribute("image", imgfile.spec);
}
function onNewCert()
{
try {
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window, "Choose File...", nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText |
nsIFilePicker.filterAll | nsIFilePicker.filterImages | nsIFilePicker.filterXML);
if (fp.show() == nsIFilePicker.returnOK && fp.fileURL.spec && fp.fileURL.spec.length > 0) {
listbox = document.getElementById('certList');
listitem = listbox.appendItem(fp.file.path, "");
}
}
catch(ex) {
}
}
function onEditCert()
{
listbox = document.getElementById('certList');
filename = listbox.selectedItem.label;
var sourcefile = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
try {
sourcefile.initWithPath(filename);
var ioServ = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
} catch (ex) {
}
try {
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window, "Choose File...", nsIFilePicker.modeOpen);
fp.displayDirectory = sourcefile.parent;
fp.defaultString = sourcefile.leafName;
fp.appendFilters(nsIFilePicker.filterAll);
if (fp.show() == nsIFilePicker.returnOK && fp.fileURL.spec && fp.fileURL.spec.length > 0) {
listbox = document.getElementById('certList');
listbox.selectedItem.label = fp.file.path;
}
}
catch(ex) {
}
}
function CreateCCK()
{
@ -620,13 +668,15 @@ function CreateCCK()
CCKCopyFile(document.getElementById("LargeAnimPath").value, destdir);
CCKCopyFile(document.getElementById("LargeStillPath").value, destdir);
CCKCopyChromeToFile("cck.js", destdir)
CCKCopyFile(document.getElementById("CertPath1").value, destdir);
CCKCopyFile(document.getElementById("CertPath2").value, destdir);
CCKCopyFile(document.getElementById("CertPath3").value, destdir);
CCKCopyFile(document.getElementById("CertPath4").value, destdir);
CCKCopyFile(document.getElementById("CertPath5").value, destdir);
listbox = document.getElementById('certList');
for (var i=0; i < listbox.getRowCount(); i++) {
listitem = listbox.getItemAtIndex(i);
if (listitem.value)
CCKCopyFile(listitem.value, destdir);
}
/* copy/create contents.rdf if 1.0 */
var zipdir = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
@ -1129,52 +1179,49 @@ function CCKWriteProperties(destdir)
cos.writeString(str);
var str = "ToolbarFolder1.BookmarkURL" + (j+1) + "=" + listitem.value + "\n";
cos.writeString(str);
var str = "ToolbarFolder1.Type" + (j+1) + "=" + listitem.cck['type'] + "\n";
cos.writeString(str);
}
}
for (var i=1; i <= 5; i++) {
str = document.getElementById("ToolbarBookmarkTitle" + i).value;
if (str && str.length) {
str = "ToolbarBookmarkTitle" + i + "=" + str + "\n";
cos.writeString(str);
}
str = document.getElementById("ToolbarBookmarkURL" + i).value;
if (str && str.length) {
str = "ToolbarBookmarkURL" + i + "=" + str + "\n";
cos.writeString(str);
}
listbox = document.getElementById('tb.bookmarkList');
for (var j=0; j < listbox.getRowCount(); j++) {
listitem = listbox.getItemAtIndex(j);
str = "ToolbarBookmarkTitle" + (j+1) + "=" + listitem.label + "\n";
cos.writeString(str);
var str = "ToolbarBookmarkURL" + (j+1) + "=" + listitem.value + "\n";
cos.writeString(str);
var str = "ToolbarBookmarkType" + (j+1) + "=" + listitem.cck['type'] + "\n";
cos.writeString(str);
}
str = document.getElementById('BookmarkFolder1').value;
if (str && str.length) {
str = "BookmarkFolder1=" + str + "\n";
cos.writeString(str);
for (var i=1; i <= 5; i++) {
str = document.getElementById("BookmarkFolder1.BookmarkTitle" + i).value;
if (str && str.length) {
str = "BookmarkFolder1.BookmarkTitle" + i + "=" + str + "\n";
cos.writeString(str);
}
str = document.getElementById("BookmarkFolder1.BookmarkURL" + i).value;
if (str && str.length) {
str = "BookmarkFolder1.BookmarkURL" + i + "=" + str + "\n";
cos.writeString(str);
}
}
}
for (var i=1; i <= 5; i++) {
str = document.getElementById("BookmarkTitle" + i).value;
if (str && str.length) {
str = "BookmarkTitle" + i + "=" + str + "\n";
listbox = document.getElementById('bmFolder.bookmarkList');
for (var j=0; j < listbox.getRowCount(); j++) {
listitem = listbox.getItemAtIndex(j);
str = "BookmarkFolder1.BookmarkTitle" + (j+1) + "=" + listitem.label + "\n";
cos.writeString(str);
}
str = document.getElementById("BookmarkURL" + i).value;
if (str && str.length) {
str = "BookmarkURL" + i + "=" + str + "\n";
var str = "BookmarkFolder1.BookmarkURL" + (j+1) + "=" + listitem.value + "\n";
cos.writeString(str);
var str = "BookmarkFolder1.BookmarkType" + (j+1) + "=" + listitem.cck['type'] + "\n";
cos.writeString(str);
}
}
listbox = document.getElementById('bm.bookmarkList');
for (var j=0; j < listbox.getRowCount(); j++) {
listitem = listbox.getItemAtIndex(j);
str = "BookmarkTitle" + (j+1) + "=" + listitem.label + "\n";
cos.writeString(str);
var str = "BookmarkURL" + (j+1) + "=" + listitem.value + "\n";
cos.writeString(str);
var str = "BookmarkType" + (j+1) + "=" + listitem.cck['type'] + "\n";
cos.writeString(str);
}
// Registry Keys
listbox = document.getElementById("regList");
@ -1182,29 +1229,32 @@ function CCKWriteProperties(destdir)
listitem = listbox.getItemAtIndex(i);
str = "RegName" + (i+1) + "=" + listitem.label + "\n";
cos.writeString(str);
str = "RootKey" + (i+1) + "=" + listitem.rootkey + "\n";
str = "RootKey" + (i+1) + "=" + listitem.cck['rootkey'] + "\n";
cos.writeString(str);
str = "Key" + (i+1) + "=" + listitem.key + "\n";
str = "Key" + (i+1) + "=" + listitem.cck['key'] + "\n";
str = str.replace(/\\/g, "\\\\");
cos.writeString(str);
str = "Name" + (i+1) + "=" + listitem.name + "\n";
str = "Name" + (i+1) + "=" + listitem.cck['name'] + "\n";
cos.writeString(str);
str = "NameValue" + (i+1) + "=" + listitem.namevalue + "\n";
str = "NameValue" + (i+1) + "=" + listitem.cck['namevalue'] + "\n";
cos.writeString(str);
str = "Type" + (i+1) + "=" + listitem.type + "\n";
str = "Type" + (i+1) + "=" + listitem.cck['type'] + "\n";
cos.writeString(str);
}
for (var i = 1; i <= 5; ++i) {
var certpath = document.getElementById("CertPath"+i).value;
if (certpath && (certpath.length > 0)) {
listbox = document.getElementById('certList');
for (var i=0; i < listbox.getRowCount(); i++) {
listitem = listbox.getItemAtIndex(i);
if (listitem.value) {
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(certpath);
file.initWithPath(listitem.value);
var line = "Cert"+ i + "=" + file.leafName + "\n";
cos.writeString(str);
}
}
cos.close();
fos.close();
}
@ -1606,22 +1656,74 @@ function CCKWriteConfigFile(destdir)
var line = "ToolbarFolder1.BookmarkURL" + (j+1) + "=" + listitem.value + "\n";
fos.write(line, line.length);
}
if (listitem.cck['type'].length > 0) {
var line = "ToolbarFolder1.BookmarkType" + (j+1) + "=" + listitem.cck['type'] + "\n";
fos.write(line, line.length);
}
}
} else if (elements[i].id == "tb.bookmarkList") {
listbox = document.getElementById('tb.bookmarkList');
for (var j=0; j < listbox.getRowCount(); j++) {
listitem = listbox.getItemAtIndex(j);
var line = "ToolbarBookmarkTitle" + (j+1) + "=" + listitem.label + "\n";
fos.write(line, line.length);
if (listitem.value) {
var line = "ToolbarBookmarkURL" + (j+1) + "=" + listitem.value + "\n";
fos.write(line, line.length);
}
if (listitem.cck['type'].length > 0) {
var line = "ToolbarBookmarkType" + (j+1) + "=" + listitem.cck['type'] + "\n";
fos.write(line, line.length);
}
}
} else if (elements[i].id == "bmFolder.bookmarkList") {
listbox = document.getElementById('bmFolder.bookmarkList');
for (var j=0; j < listbox.getRowCount(); j++) {
listitem = listbox.getItemAtIndex(j);
var line = "BookmarkFolder1.BookmarkTitle" + (j+1) + "=" + listitem.label + "\n";
fos.write(line, line.length);
if (listitem.value) {
var line = "BookmarkFolder1.BookmarkURL" + (j+1) + "=" + listitem.value + "\n";
fos.write(line, line.length);
}
if (listitem.cck['type'].length > 0) {
var line = "BookmarkFolder1.BookmarkType" + (j+1) + "=" + listitem.cck['type'] + "\n";
fos.write(line, line.length);
}
}
} else if (elements[i].id == "bm.bookmarkList") {
listbox = document.getElementById('bm.bookmarkList');
for (var j=0; j < listbox.getRowCount(); j++) {
listitem = listbox.getItemAtIndex(j);
var line = "BookmarkTitle" + (j+1) + "=" + listitem.label + "\n";
fos.write(line, line.length);
if (listitem.value) {
var line = "BookmarkURL" + (j+1) + "=" + listitem.value + "\n";
fos.write(line, line.length);
}
if (listitem.cck['type'].length > 0) {
var line = "BookmarkType" + (j+1) + "=" + listitem.cck['type'] + "\n";
fos.write(line, line.length);
}
}
} else if (elements[i].id == "regList") {
listbox = document.getElementById('regList');
for (var j=0; j < listbox.getRowCount(); j++) {
listitem = listbox.getItemAtIndex(j);
var line = "RegName" + (j+1) + "=" + listitem.label + "\n";
fos.write(line, line.length);
var line = "RootKey" + (j+1) + "=" + listitem.rootkey + "\n";
var line = "RootKey" + (j+1) + "=" + listitem.cck['rootkey'] + "\n";
fos.write(line, line.length);
var line = "Key" + (j+1) + "=" + listitem.key + "\n";
var line = "Key" + (j+1) + "=" + listitem.cck['key'] + "\n";
fos.write(line, line.length);
var line = "Name" + (j+1) + "=" + listitem.name + "\n";
var line = "Name" + (j+1) + "=" + listitem.cck['name'] + "\n";
fos.write(line, line.length);
var line = "NameValue" + (j+1) + "=" + listitem.namevalue + "\n";
var line = "NameValue" + (j+1) + "=" + listitem.cck['namevalue'] + "\n";
fos.write(line, line.length);
var line = "Type" + (j+1) + "=" + listitem.type + "\n";
var line = "Type" + (j+1) + "=" + listitem.cck['type'] + "\n";
fos.write(line, line.length);
}
} else if (elements[i].id == "searchEngineList") {
@ -1633,6 +1735,13 @@ function CCKWriteConfigFile(destdir)
var line = "SearchEngineIcon" + (j+1) + "=" + listitem.value + "\n";
fos.write(line, line.length);
}
} else if (elements[i].id == "certList") {
listbox = document.getElementById('certList')
for (var j=0; j < listbox.getRowCount(); j++) {
listitem = listbox.getItemAtIndex(j);
var line = "CertPath" + (j+1) + "=" + listitem.label + "\n";
fos.write(line, line.length);
}
}
}
fos.close();
@ -1701,8 +1810,68 @@ function CCKReadConfigFile(srcdir)
listbox.clear();
var i = 1;
while( pluginname = configarray['ToolbarFolder1.BookmarkTitle' + i]) {
listbox.appendItem(pluginname, configarray['ToolbarFolder1.BookmarkURL' + i]);
while( name = configarray['ToolbarFolder1.BookmarkTitle' + i]) {
listitem = listbox.appendItem(name, configarray['ToolbarFolder1.BookmarkURL' + i]);
listitem.setAttribute("class", "listitem-iconic");
if (configarray['ToolbarFolder1.BookmarkType' + i] == "live") {
listitem.cck['type'] = "live";
listitem.setAttribute("image", "chrome://browser/skin/page-livemarks.png");
} else {
listitem.cck['type'] = "";
listitem.setAttribute("image", "chrome://browser/skin/Bookmarks-folder.png");
}
i++;
}
// handle toolbar bookmarks
listbox = document.getElementById('tb.bookmarkList');
listbox.clear();
var i = 1;
while( name = configarray['ToolbarBookmarkTitle' + i]) {
listitem = listbox.appendItem(name, configarray['ToolbarBookmarkURL' + i]);
listitem.setAttribute("class", "listitem-iconic");
if (configarray['ToolbarBookmarkType' + i] == "live") {
listitem.cck['type'] = "live";
listitem.setAttribute("image", "chrome://browser/skin/page-livemarks.png");
} else {
listitem.cck['type'] = "";
listitem.setAttribute("image", "chrome://browser/skin/Bookmarks-folder.png");
}
i++;
}
// handle folder with bookmarks
listbox = document.getElementById('bmFolder.bookmarkList');
listbox.clear();
var i = 1;
while( name = configarray['BookmarkFolder1.BookmarkTitle' + i]) {
listitem = listbox.appendItem(name, configarray['BookmarkFolder1.BookmarkURL' + i]);
listitem.setAttribute("class", "listitem-iconic");
if (configarray['BookmarkFolder1.BookmarkType' + i] == "live") {
listitem.cck['type'] = "live";
listitem.setAttribute("image", "chrome://browser/skin/page-livemarks.png");
} else {
listitem.cck['type'] = "";
listitem.setAttribute("image", "chrome://browser/skin/Bookmarks-folder.png");
}
i++;
}
// handle bookmarks
listbox = document.getElementById('bm.bookmarkList');
listbox.clear();
var i = 1;
while( name = configarray['BookmarkTitle' + i]) {
listitem = listbox.appendItem(name, configarray['BookmarkURL' + i]);
listitem.setAttribute("class", "listitem-iconic");
if (configarray['BookmarkType' + i] == "live") {
listitem.cck['type'] = "live";
listitem.setAttribute("image", "chrome://browser/skin/page-livemarks.png");
} else {
listitem.cck['type'] = "";
listitem.setAttribute("image", "chrome://browser/skin/Bookmarks-folder.png");
}
i++;
}
@ -1716,11 +1885,21 @@ function CCKReadConfigFile(srcdir)
var i = 1;
while( regname = configarray['RegName' + i]) {
var listitem = listbox.appendItem(regname, "");
listitem.rootkey = configarray['RootKey' + i];
listitem.key = configarray['Key' + i];
listitem.name = configarray['Name' + i];
listitem.namevalue = configarray['NameValue' + i];
listitem.type = configarray['Type' + i];
listitem.cck['rootkey'] = configarray['RootKey' + i];
listitem.cck['key'] = configarray['Key' + i];
listitem.cck['name'] = configarray['Name' + i];
listitem.cck['namevalue'] = configarray['NameValue' + i];
listitem.cck['type'] = configarray['Type' + i];
i++;
}
// cert list
listbox = document.getElementById('certList');
listbox.clear();
var i = 1;
while( certpath = configarray['CertPath' + i]) {
var listitem = listbox.appendItem(certpath, "");
i++;
}

View File

@ -254,15 +254,14 @@
<wizardpage label="&customizePartFour.label;">
<groupbox>
<caption label="&allowedSites.caption;"/>
<description>&allowedSites.description;</description>
<vbox>
<label control="PopupAllowedSites">&popupAllowedSites.label;</label>
<description control="PopupAllowedSites">&popupAllowedSites.label;</description>
<vbox>
<textbox id="PopupAllowedSites" flex="1"/>
</vbox>
<vbox>
<label control="InstallAllowedSites">&installAllowedSites.label;</label>
</vbox>
<description control="InstallAllowedSites">&installAllowedSites.label;</description>
<vbox>
<textbox id="InstallAllowedSites" flex="1"/>
</vbox>
</vbox>
</groupbox>
</wizardpage>
@ -277,6 +276,7 @@
<wizardpage label="&customizeSearchEngines.label;">
<groupbox>
<caption label="&engines.label;"/>
<description>&searchEngines.description;</description>
<box class="ccklist" id="searchEngineList" new="onNewSearchEngine();" edit="onEditSearchEngine();"/>
</groupbox>
@ -284,7 +284,7 @@
<wizardpage id="tbFolder" label="&customizeToolbarOne.label;">
<wizardpage id="tbFolder" label="&customizeToolbarOne.label;" onpageadvanced="if (document.getElementById('tbFolder.bookmarkList').getRowCount() > 0) return Validate('ToolbarFolder1','&bmFolder.error;')">
<groupbox>
<caption label="&addToolbarFolder.caption;"/>
<description>&addToolbarFolder.description;</description>
@ -296,49 +296,15 @@
</groupbox>
</wizardpage>
<wizardpage label="&customizeToolbarTwo.label;">
<wizardpage id="tb" label="&customizeToolbarTwo.label;">
<groupbox>
<caption label="&addToolbarBookmark.caption;"/>
<description>&addToolbarBookmark.description;</description>
<label value="&bookmark.label; 1"/>
<hbox align="center">
<label control="ToolbarBookmarkTitle1">&bookmarkTitle.label;</label>
<textbox id="ToolbarBookmarkTitle1" flex="1"/>
<label control="ToolbarBookmarkURL1">&bookmarkURL.label;</label>
<textbox id="ToolbarBookmarkURL1" flex="1"/>
</hbox>
<label value="&bookmark.label; 2"/>
<hbox align="center">
<label control="ToolbarBookmarkTitle2">&bookmarkTitle.label;</label>
<textbox id="ToolbarBookmarkTitle2" flex="1"/>
<label control="ToolbarBookmarkURL2">&bookmarkURL.label;</label>
<textbox id="ToolbarBookmarkURL2" flex="1"/>
</hbox>
<label value="&bookmark.label; 3"/>
<hbox align="center">
<label control="ToolbarBookmarkTitle3">&bookmarkTitle.label;</label>
<textbox id="ToolbarBookmarkTitle3" flex="1"/>
<label control="ToolbarBookmarkURL3">&bookmarkURL.label;</label>
<textbox id="ToolbarBookmarkURL3" flex="1"/>
</hbox>
<label value="&bookmark.label; 4"/>
<hbox align="center">
<label control="ToolbarBookmarkTitle4">&bookmarkTitle.label;</label>
<textbox id="ToolbarBookmarkTitle4" flex="1"/>
<label control="ToolbarBookmarkURL4">&bookmarkURL.label;</label>
<textbox id="ToolbarBookmarkURL4" flex="1"/>
</hbox>
<label value="&bookmark.label; 5"/>
<hbox align="center">
<label control="ToolbarBookmarkTitle5">&bookmarkTitle.label;</label>
<textbox id="ToolbarBookmarkTitle5" flex="1"/>
<label control="ToolbarBookmarkURL5">&bookmarkURL.label;</label>
<textbox id="ToolbarBookmarkURL5" flex="1"/>
</hbox>
<box class="ccklist" id="tb.bookmarkList" new="onNewBookmark();" edit="onEditBookmark();"/>
</groupbox>
</wizardpage>
<wizardpage label="&customizeBookmarksOne.label;">
<wizardpage id="bmFolder" label="&customizeBookmarksOne.label;" onpageadvanced="if (document.getElementById('bmFolder.bookmarkList').getRowCount() > 0) return Validate('BookmarkFolder1','&bmFolder.error;')">
<groupbox>
<caption label="&addBookmarkFolder.caption;"/>
<description>&addBookmarkFolder.description;</description>
@ -346,83 +312,15 @@
<label control="BookmarkFolder1">&folderTitle.label;</label>
<textbox id="BookmarkFolder1"/>
</hbox>
<label value="&bookmark.label; 1"/>
<hbox align="center">
<label control="BookmarkFolder1.BookmarkTitle1">&bookmarkTitle.label;</label>
<textbox id="BookmarkFolder1.BookmarkTitle1" flex="1"/>
<label control="BookmarkFolder1.BookmarkURL1">&bookmarkURL.label;</label>
<textbox id="BookmarkFolder1.BookmarkURL1" flex="1"/>
</hbox>
<label value="&bookmark.label; 2"/>
<hbox align="center">
<label control="BookmarkFolder1.BookmarkTitle2">&bookmarkTitle.label;</label>
<textbox id="BookmarkFolder1.BookmarkTitle2" flex="1"/>
<label control="BookmarkFolder1.BookmarkURL2">&bookmarkURL.label;</label>
<textbox id="BookmarkFolder1.BookmarkURL2" flex="1"/>
</hbox>
<label value="&bookmark.label; 3"/>
<hbox align="center">
<label control="BookmarkFolder1.BookmarkTitle3">&bookmarkTitle.label;</label>
<textbox id="BookmarkFolder1.BookmarkTitle3" flex="1"/>
<label control="BookmarkFolder1.BookmarkURL3">&bookmarkURL.label;</label>
<textbox id="BookmarkFolder1.BookmarkURL3" flex="1"/>
</hbox>
<label value="&bookmark.label; 4"/>
<hbox align="center">
<label control="BookmarkFolder1.BookmarkTitle4">&bookmarkTitle.label;</label>
<textbox id="BookmarkFolder1.BookmarkTitle4" flex="1"/>
<label control="BookmarkFolder1.BookmarkURL4">&bookmarkURL.label;</label>
<textbox id="BookmarkFolder1.BookmarkURL4" flex="1"/>
</hbox>
<label value="&bookmark.label; 5"/>
<hbox align="center">
<label control="BookmarkFolder1.BookmarkTitle5">&bookmarkTitle.label;</label>
<textbox id="BookmarkFolder1.BookmarkTitle5" flex="1"/>
<label control="BookmarkFolder1.BookmarkURL5">&bookmarkURL.label;</label>
<textbox id="BookmarkFolder1.BookmarkURL5" flex="1"/>
</hbox>
<box class="ccklist" id="bmFolder.bookmarkList" new="onNewBookmark();" edit="onEditBookmark();"/>
</groupbox>
</wizardpage>
<wizardpage label="&customizeBookmarksTwo.label;">
<wizardpage id="bm" label="&customizeBookmarksTwo.label;">
<groupbox>
<caption label="&addBookmark.caption;"/>
<description>&addBookmark.description;</description>
<label value="&bookmark.label; 1"/>
<hbox align="center">
<label control="BookmarkTitle1">&bookmarkTitle.label;</label>
<textbox id="BookmarkTitle1" flex="1"/>
<label control="BookmarkURL1">&bookmarkURL.label;</label>
<textbox id="BookmarkURL1" flex="1"/>
</hbox>
<label value="&bookmark.label; 2"/>
<hbox align="center">
<label control="BookmarkTitle2">&bookmarkTitle.label;</label>
<textbox id="BookmarkTitle2" flex="1"/>
<label control="BookmarkURL2">&bookmarkURL.label;</label>
<textbox id="BookmarkURL2" flex="1"/>
</hbox>
<label value="&bookmark.label; 3"/>
<hbox align="center">
<label control="BookmarkTitle3">&bookmarkTitle.label;</label>
<textbox id="BookmarkTitle3" flex="1"/>
<label control="BookmarkURL3">&bookmarkURL.label;</label>
<textbox id="BookmarkURL3" flex="1"/>
</hbox>
<label value="&bookmark.label; 4"/>
<hbox align="center">
<label control="BookmarkTitle4">&bookmarkTitle.label;</label>
<textbox id="BookmarkTitle4" flex="1"/>
<label control="BookmarkURL4">&bookmarkURL.label;</label>
<textbox id="BookmarkURL4" flex="1"/>
</hbox>
<label value="&bookmark.label; 5"/>
<hbox align="center">
<label control="BookmarkTitle5">&bookmarkTitle.label;</label>
<textbox id="BookmarkTitle5" flex="1"/>
<label control="BookmarkURL5">&bookmarkURL.label;</label>
<textbox id="BookmarkURL5" flex="1"/>
</hbox>
<box class="ccklist" id="bm.bookmarkList" new="onNewBookmark();" edit="onEditBookmark();"/>
</groupbox>
</wizardpage>
@ -442,28 +340,9 @@
</groupbox>
</wizardpage>
<wizardpage label="&customizeCerts.label;" onpageadvanced="return ValidateFile('CertPath1','CertPath2','CertPath3','CertPath4','CertPath5');">>
<wizardpage label="&customizeCerts.label;">
<description>&customizeCerts.warning;</description>
<hbox>
<textbox id="CertPath1" flex="1"/>
<button label="&chooseFile.label;" oncommand="choosefile('CertPath1');"/>
</hbox>
<hbox>
<textbox id="CertPath2" flex="1"/>
<button label="&chooseFile.label;" oncommand="choosefile('CertPath2');"/>
</hbox>
<hbox>
<textbox id="CertPath3" flex="1"/>
<button label="&chooseFile.label;" oncommand="choosefile('CertPath3');"/>
</hbox>
<hbox>
<textbox id="CertPath4" flex="1"/>
<button label="&chooseFile.label;" oncommand="choosefile('CertPath4');"/>
</hbox>
<hbox>
<textbox id="CertPath5" flex="1"/>
<button label="&chooseFile.label;" oncommand="choosefile('CertPath5');"/>
</hbox>
<box class="ccklist" id="certList" new="onNewCert();" edit="onEditCert();"/>
</wizardpage>
<wizardpage label="&customizeProxy.label;">

View File

@ -62,7 +62,8 @@
<menupopup>
<menuitem label="Windows" value="WINNT_x86-msvc"/>
<menuitem label="Linux" value="Linux_x86-gcc3"/>
<menuitem label="Macintosh" value="Darwin_ppc-gcc3"/>
<menuitem label="Macintosh (PPC)" value="Darwin_ppc-gcc3"/>
<menuitem label="Macintosh (Intel)" value="Darwin_x86-gcc3"/>
</menupopup>
</menulist>
</hbox>

View File

@ -247,11 +247,9 @@ CCKService.prototype={
if ((ToolbarLocation) && (ToolbarLocation == "First")) {
tbIndex = 1;
addBookmarks(bundle, BMSVC, "Toolbar", BMSVC.getBookmarksToolbarFolder(), tbIndex);
addLivemarks(bundle, BMSVC, "Toolbar", BMSVC.getBookmarksToolbarFolder(), tbIndex);
addFolder(bundle, BMSVC, "Toolbar", BMSVC.getBookmarksToolbarFolder(), tbIndex);
} else {
addFolder(bundle, BMSVC, "Toolbar", BMSVC.getBookmarksToolbarFolder(), tbIndex);
addLivemarks(bundle, BMSVC, "Toolbar", BMSVC.getBookmarksToolbarFolder(), tbIndex);
addBookmarks(bundle, BMSVC, "Toolbar", BMSVC.getBookmarksToolbarFolder(), tbIndex);
}
@ -263,13 +261,11 @@ CCKService.prototype={
} catch (ex) {}
if ((BookmarkLocation) && (BookmarkLocation == "First")) {
bmIndex = 1;
addLivemarks(bundle, BMSVC, "Bookmark", bmRoot, bmIndex);
addBookmarks(bundle, BMSVC, "", bmRoot, bmIndex);
addFolder(bundle, BMSVC, "Bookmark", bmRoot, bmIndex);
} else {
addFolder(bundle, BMSVC, "Bookmark", bmRoot, bmIndex);
addBookmarks(bundle, BMSVC, "", bmRoot, bmIndex);
addLivemarks(bundle, BMSVC, "Bookmark", bmRoot, bmIndex);
}
prefbranch.setBoolPref("cck.initialized", true);
@ -277,44 +273,6 @@ CCKService.prototype={
}
}
function addLivemarks(bundle, BMSVC, prefix, folder, location)
{
var LivemarkTitle;
var LivemarkRSSURL;
// items are added in reverse order if we are set to "First"
var start, end, increment;
if (location == -1) {
start = 1;
end = 6;
increment = 1;
} else {
start = 5;
end = 0;
increment = -1;
}
for (var i=start; i!=end; i+=increment) {
try {
LivemarkTitle = bundle.GetStringFromName(prefix + "LivemarkTitle" + i);
} catch (ex) {
LivemarkTitle = "";
}
if ((LivemarkTitle) && (LivemarkTitle.length)) {
try {
LivemarkRSSURL = bundle.GetStringFromName(prefix + "LivemarkRSSURL" + i);
} catch (ex) {
LivemarkRSSURL = "";
}
if ((LivemarkRSSURL) && (LivemarkRSSURL.length)) {
if (BMSVC.createLivemarkInContainer)
BMSVC.createLivemarkInContainer(LivemarkTitle, "", LivemarkRSSURL, "", folder, location);
}
}
}
}
function addBookmarks(bundle, BMSVC, prefix, folder, location)
{
var BookmarkTitle;
@ -323,12 +281,24 @@ function addBookmarks(bundle, BMSVC, prefix, folder, location)
// items are added in reverse order if we are set to "First"
var start, end, increment;
var i = 1;
var numBookmarks = 0;
while (1) {
try {
var title = bundle.GetStringFromName(prefix + "BookmarkTitle" + i);
} catch (ex) {
break;
}
i++;
numBookmarks++;
}
if (location == -1) {
start = 1;
end = 6;
end = numBookmarks+1;
increment = 1;
} else {
start = 5;
start = numBookmarks;
end = 0;
increment = -1;
}
@ -346,10 +316,20 @@ function addBookmarks(bundle, BMSVC, prefix, folder, location)
BookmarkURL = "";
}
if ((BookmarkURL) && (BookmarkURL.length)) {
if (BMSVC.createBookmarkInContainer.length == 8)
BMSVC.createBookmarkInContainer(BookmarkTitle, BookmarkURL, "", "", "", "", folder, location);
else
BMSVC.createBookmarkInContainer(BookmarkTitle, BookmarkURL, "", "", "", folder, location);
var bmtype;
try {
bmtype = bundle.GetStringFromName(prefix + "BookmarkType" + i);
} catch (ex) {
bmtype = "";
}
if (bmtype == "live") {
BMSVC.createLivemarkInContainer(BookmarkTitle, "", BookmarkURL, "", folder, location);
} else {
if (BMSVC.createBookmarkInContainer.length == 8)
BMSVC.createBookmarkInContainer(BookmarkTitle, BookmarkURL, "", "", "", "", folder, location);
else
BMSVC.createBookmarkInContainer(BookmarkTitle, BookmarkURL, "", "", "", folder, location);
}
}
}
}
@ -383,11 +363,21 @@ function addFolder(bundle, BMSVC, prefix, folder, location)
}
if ((BookmarkFolder) && (BookmarkFolder.length)) {
var newfolder;
if (BMSVC.createBookmarkInContainer.length == 8)
newfolder = BMSVC.createFolderInContainer(BookmarkFolder, folder, location);
else
newfolder = BMSVC.createFolderInContainer(BookmarkFolder, folder, location);
for (var j=1; j<=5; j++) {
newfolder = BMSVC.createFolderInContainer(BookmarkFolder, folder, location);
var j = 1;
var numBookmarks = 0;
while (1) {
try {
var title = bundle.GetStringFromName(prefix + "Folder" + i + ".BookmarkTitle" + j);
} catch (ex) {
break;
}
j++;
numBookmarks++;
}
for (var j=1; j<=numBookmarks; j++) {
try {
BookmarkTitle = bundle.GetStringFromName(prefix + "Folder" + i + ".BookmarkTitle" + j);
} catch (ex) {
@ -400,12 +390,22 @@ function addFolder(bundle, BMSVC, prefix, folder, location)
BookmarkURL = "";
}
if ((BookmarkURL) && (BookmarkURL.length)) {
if (BMSVC.createBookmarkInContainer.length == 8)
BMSVC.createBookmarkInContainer(BookmarkTitle, BookmarkURL, "", "", "", "", newfolder, -1);
else
BMSVC.createBookmarkInContainer(BookmarkTitle, BookmarkURL, "", "", "", newfolder, -1);
}
}
var bmtype;
try {
bmtype = bundle.GetStringFromName(prefix + "BookmarkType" + i);
} catch (ex) {
bmtype = "";
}
if (bmtype == "live") {
BMSVC.createLivemarkInContainer(BookmarkTitle, "", BookmarkURL, "", newfolder, -1);
} else {
if (BMSVC.createBookmarkInContainer.length == 8)
BMSVC.createBookmarkInContainer(BookmarkTitle, BookmarkURL, "", "", "", "", newfolder, -1);
else
BMSVC.createBookmarkInContainer(BookmarkTitle, BookmarkURL, "", "", "", newfolder, -1);
}
}
}
}
}
}