var profileCore = "";
var profileList = "";
var lastNum = -1;
var lastName = "";
function CreateProfile()
{
// Need to call CreateNewProfile xuls
this.location.replace("resource:/res/profile/cpwManager.xul");
}
function RenameProfile()
{
if (lastName != "")
{
dump("Rename '" + lastName + "'\n");
dump("Need to do a rename dialog here...\n");
this.location.replace(this.location);
}
else
dump("Select a profile before clicking the rename button.\n");
}
function DeleteProfile()
{
if (lastName != "")
{
dump("Delete '" + lastName + "'\n");
profileCore.DeleteProfile(lastName);
this.location.replace(this.location);
}
else
dump("Select a profile before clicking the delete button.\n");
}
function ExitManager()
{
var toolkitCore = XPAppCoresManager.Find("toolkitCore");
if (!toolkitCore) {
toolkitCore = new ToolkitCore();
if (toolkitCore) {
toolkitCore.Init("toolkitCore");
}
}
if (toolkitCore) {
toolkitCore.CloseWindow(parent);
}
}
function addTreeElement(num, name)
{
dump("Adding element " + num + " : " + name + "\n");
var body = document.getElementById("theTreeBody");
var newitem = document.createElement('treeitem');
newitem.setAttribute("rowID", num);
newitem.setAttribute("rowName", name);
var elem = document.createElement('treecell');
// Hack in a differentation for migration
if (num % 2 == 0)
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.
lastNum = node.getAttribute("rowID");
lastName = node.getAttribute("rowName");
dump("Selected " + lastNum + " : " + lastName + "\n");
}
function loadElements()
{
dump("hacked onload handler adds elements to tree widget\n");
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++)
addTreeElement(i, profileList[i]);
}
// -------------------------------------------- begin Hack for OnLoad handling
setTimeout("loadElements()", 0);
// -------------------------------------------- end Hack for OnLoad handling
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
Delete
Exit