var profileCore = ""; var selected = null; function CreateProfile() { // Need to call CreateNewProfile xuls 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 != "true") { 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) { if (!selected) { dump("Select a profile to migrate.\n"); return; } 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() { if (!selected) { dump("Select a profile to delete.\n"); return; } var migrate = selected.getAttribute("rowMigrate"); var name = selected.getAttribute("rowName"); dump("Delete '" + name + "'\n"); profileCore.DeleteProfile(name); this.location.replace(this.location); } function ExitApp() { var toolkitCore = XPAppCoresManager.Find("toolkitCore"); if (!toolkitCore) { toolkitCore = new ToolkitCore(); if (toolkitCore) { toolkitCore.Init("toolkitCore"); } } if (toolkitCore) { toolkitCore.CloseWindow(parent); } } function addTreeItem(num, name, migrate) { dump("Adding element " + num + " : " + name + "\n"); var body = document.getElementById("theTreeBody"); var newitem = document.createElement('treeitem'); newitem.setAttribute("rowNum", num); newitem.setAttribute("rowName", name); newitem.setAttribute("rowMigrate", migrate); var elem = document.createElement('treecell'); // Hack in a differentation for migration if (migrate) var text = document.createTextNode('Migrate'); else var text = document.createTextNode(''); elem.appendChild(text); newitem.appendChild(elem); var elem = document.createElement('treecell'); var text = document.createTextNode(name); elem.appendChild(text); newitem.appendChild(elem); body.appendChild(newitem); } function showSelection(node) { // (see tree's onclick definition) // 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 // one further and get event.target.parentNode. selected = node; var num = node.getAttribute("rowNum"); var name = node.getAttribute("rowName"); dump("Selected " + num + " : " + name + "\n"); } function loadElements() { dump("hacked onload handler adds elements to tree widget\n"); var profileList = ""; profileCore = XPAppCoresManager.Find("ProfileCore"); if (!profileCore) { dump("!profileCore\n"); profileCore = new ProfileCore(); if (profileCore) { dump("after ! yes profileCore in if loop\n"); profileCore.Init("ProfileCore"); } else { dump("profile not created\n"); } } if (profileCore) profileList = profileCore.GetProfileList(); profileList = profileList.split(","); for (var i=0; i < profileList.length; i++) addTreeItem(i, profileList[i], (i%2==0)); } // -------------------------------------------- begin Hack for OnLoad handling setTimeout("loadElements()", 0); // -------------------------------------------- end Hack for OnLoad handling function openRename() { if (!selected) dump("Select a profile to rename.\n"); else { var migrate = selected.getAttribute("rowMigrate"); if (migrate == "true") dump("Migrate the profile before renaming it.\n"); else var win = window.openDialog('pmrename.xul', 'Renamer', 'chrome'); } } Deleting an unmigrated profile will prevent you from ever migrating it in the future. Confirm delete? Confirm migrate all profiles? Communicator stores information about your settings, preferences, bookmarks, and stored messages in your personal profile. Click New to create a new profile. Select a profile, click delete to remove that profile. Select a profile, click Rename to rename the profile. Migration User Name