*** empty log message ***

This commit is contained in:
selmer%netscape.com 1999-06-09 00:24:52 +00:00
parent 2f34d8b24b
commit fa4102aa5b

View File

@ -1,4 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<?xml-stylesheet href="chrome:/global/skin/xul.css" type="text/css"?>
<?xml-stylesheet href="pm.css" type="text/css"?> <?xml-stylesheet href="pm.css" type="text/css"?>
<window <window
@ -9,43 +10,94 @@
<html:script> <html:script>
var profileCore = ""; var profileCore = "";
var profileList = ""; var profileList = "";
var lastNum = -1; var selected = null;
var lastName = "";
function CreateProfile() function CreateProfile()
{ {
// Need to call CreateNewProfile xuls // Need to call CreateNewProfile xuls
this.location.replace("resource:/res/profile/cpwManager.xul"); this.location = "resource:/res/profile/cpwManager.xul";
}
function MigrateProfile(override)
{
// Hack to avoid writing two copies of this
if (override)
selected = override;
if (!selected)
{
dump("Select a profile to migrate.\n");
return;
}
var name = selected.getAttribute("rowName");
var migrate = selected.getAttribute("rowMigrate");
if (migrate == "false")
{
dump("This profile doesn't need migration.\n");
return;
}
//profileCore.MigrateProfile(name);
//this.location.replace(this.location);
dump("Would have migrated " + name + ".\n");
}
function MigrateAllProfiles()
{
var body = document.getElementById("theTreeBody");
var child = body.firstChild;
while (child)
{
if (child.getAttribute("rowMigrate") == "true")
MigrateProfile(child);
child = child.nextSibling;
}
} }
function RenameProfile(w) function RenameProfile(w)
{ {
dump("RenameProfile\n"); if (!selected)
var newName = w.document.getElementById("NewName").value;
dump("RenameProfile : " + lastName + " to " + newName + "\n");
if (lastName != "")
{ {
dump("Rename '" + lastName + "'\n"); dump("Select a profile to migrate.\n");
profileCore.RenameProfile(lastName, newName); return;
this.location.replace(this.location);
} }
else
dump("Select a profile before clicking the rename button.\n"); dump("RenameProfile\n");
var newName = w.document.getElementById("NewName").value;
var oldName = selected.getAttribute("rowName");
var migrate = selected.getAttribute("rowMigrate");
if (migrate == "true")
{
dump("Migrate this profile before renaming it.\n");
return;
}
dump("RenameProfile : " + oldName + " to " + newName + "\n");
profileCore.RenameProfile(oldName, newName);
this.location.replace(this.location);
} }
function DeleteProfile() function DeleteProfile()
{ {
if (lastName != "") if (!selected)
{ {
dump("Delete '" + lastName + "'\n"); dump("Select a profile to delete.\n");
profileCore.DeleteProfile(lastName); return;
this.location.replace(this.location);
} }
else
dump("Select a profile before clicking the delete button.\n"); var migrate = selected.getAttribute("rowMigrate");
var name = selected.getAttribute("rowName");
dump("Delete '" + name + "'\n");
profileCore.DeleteProfile(name);
this.location.replace(this.location);
} }
function ExitManager() function ExitApp()
{ {
var toolkitCore = XPAppCoresManager.Find("toolkitCore"); var toolkitCore = XPAppCoresManager.Find("toolkitCore");
if (!toolkitCore) { if (!toolkitCore) {
@ -60,19 +112,20 @@ function ExitManager()
} }
} }
function addTreeItem(num, name) function addTreeItem(num, name, migrate)
{ {
dump("Adding element " + num + " : " + name + "\n"); dump("Adding element " + num + " : " + name + "\n");
var body = document.getElementById("theTreeBody"); var body = document.getElementById("theTreeBody");
var newitem = document.createElement('treeitem'); var newitem = document.createElement('treeitem');
newitem.setAttribute("rowID", num); newitem.setAttribute("rowNum", num);
newitem.setAttribute("rowName", name); newitem.setAttribute("rowName", name);
newitem.setAttribute("rowMigrate", migrate);
var elem = document.createElement('treecell'); var elem = document.createElement('treecell');
// Hack in a differentation for migration // Hack in a differentation for migration
if (num % 2 == 0) if (migrate)
var text = document.createTextNode('Migrate'); var text = document.createTextNode('Migrate');
else else
var text = document.createTextNode(''); var text = document.createTextNode('');
@ -94,9 +147,10 @@ function showSelection(node)
// Tree events originate in the smallest clickable object which is the cell. The object // Tree events originate in the smallest clickable object which is the cell. The object
// originating the event is available as event.target. We want the cell's row, so we go // originating the event is available as event.target. We want the cell's row, so we go
// one further and get event.target.parentNode. // one further and get event.target.parentNode.
lastNum = node.getAttribute("rowID"); selected = node;
lastName = node.getAttribute("rowName"); var num = node.getAttribute("rowNum");
dump("Selected " + lastNum + " : " + lastName + "\n"); var name = node.getAttribute("rowName");
dump("Selected " + num + " : " + name + "\n");
} }
function loadElements() function loadElements()
@ -123,7 +177,7 @@ function loadElements()
profileList = profileList.split(","); profileList = profileList.split(",");
for (var i=0; i &lt; profileList.length; i++) for (var i=0; i &lt; profileList.length; i++)
addTreeItem(i, profileList[i]); addTreeItem(i, profileList[i], (i%2==0));
} }
// -------------------------------------------- begin Hack for OnLoad handling // -------------------------------------------- begin Hack for OnLoad handling
@ -132,16 +186,34 @@ setTimeout("loadElements()", 0);
</html:script> </html:script>
[[[[ Please ignore these fields until popups behave better
<popup id="renamePopup"> <popup id="renamePopup">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="200" height="50"> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="100" height="50">
If you don't type in the input field, it works. If you don't type in the input field, it works.
<html:input type="text" id="NewName" size="20" value="zz" /> <html:input type="text" id="NewName" size="20" value="zz" />
<titledbutton value="Ok" class="push" onclick="opener.RenameProfile(window);window.close();" /> <titledbutton value="Ok" class="push" onclick="opener.RenameProfile(window);window.close();" />
<titledbutton value="Cancel" class="push" onclick="window.close();" /> <titledbutton value="Cancel" class="push" onclick="window.close();" />
</window> </window>
</popup> </popup>
]]]]
<popup id="deletePopup">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="100" height="50">
Deleting an unmigrated profile will prevent you from ever migrating it in the future.
<html:p> </html:p>
Confirm delete?
<html:p />
<titledbutton value="Ok" class="push" onclick="opener.DeleteProfile();window.close();" />
<titledbutton value="Cancel" class="push" onclick="window.close();" />
</window>
</popup>
<popup id="migratePopup">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="100" height="50">
Confirm migrate all profiles?
<html:p />
<titledbutton value="Ok" class="push" onclick="opener.MigrateAllProfiles();window.close();" />
<titledbutton value="Cancel" class="push" onclick="window.close();" />
</window>
</popup>
<html:center> <html:center>
<html:table> <html:table>
@ -180,10 +252,17 @@ bookmarks, and stored messages in your personal profile.
</tree> </tree>
<titledbutton value="New" class="push" onclick="CreateProfile();" /> <titledbutton value="New" class="push" onclick="CreateProfile();" />
<titledbutton value="Migrate" class="push" onclick="MigrateProfile();" />
<titledbutton value="Rename" class="push" popup="renamePopup" /> <titledbutton value="Rename" class="push" popup="renamePopup" />
<html:button onclick="DeleteProfile();">Delete</html:button> <titledbutton value="Delete" class="push" popup="deletePopup" />
<html:button onclick="ExitManager();">Exit</html:button>
</html:center> </html:center>
<html:p />
<html:hr />
<html:p />
<titledbutton value="Migrate All" class="push" popup="migratePopup" />
<titledbutton value="Start" class="push" onclick="window.close();" />
<titledbutton value="Exit" class="push" onclick="ExitApp();" />
</window> </window>