зеркало из https://github.com/mozilla/pjs.git
Profile Manager UI with new functions
This commit is contained in:
Родитель
71a2a211e9
Коммит
187fad7040
|
@ -5,28 +5,39 @@
|
|||
var errorMessage = "";
|
||||
|
||||
var profileCore = parent.GetProfileCore();
|
||||
var curProf = profileCore.GetCurrentProfile();
|
||||
|
||||
if (profileCore) {
|
||||
dump("yes profileCore\n");
|
||||
//dump("yes profileCore\n");
|
||||
profileList = profileCore.GetProfileList();
|
||||
dump("***********---------> Profiles I got back : " + profileList + "\n");
|
||||
dump("---> Profiles : " + profileList + "\n");
|
||||
dump("---> CurrentProfile is : " + curProf + "\n");
|
||||
}
|
||||
|
||||
function generateProfileList()
|
||||
{
|
||||
dump("************Inside generateProfileList\n");
|
||||
//dump("************Inside generateProfileList\n");
|
||||
profileList = profileList.split(",");
|
||||
profileList.sort();
|
||||
var numOfElements = profileList.length;
|
||||
dump("************numOfElements: "+numOfElements+"\n");
|
||||
//dump("************numOfElements: "+numOfElements+"\n");
|
||||
var i = 0;
|
||||
|
||||
for (i = 0; i < numOfElements; i++) {
|
||||
document.writeln("<option>"+profileList[i]);
|
||||
for (i = 0; i != numOfElements; i++) {
|
||||
if (profileList[i] == curProf)
|
||||
{
|
||||
document.writeln("<option selected>"+profileList[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
document.writeln("<option>"+profileList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function CreateProfile()
|
||||
{
|
||||
dump("************Inside del prof\n");
|
||||
//dump("************Inside del prof\n");
|
||||
|
||||
// Need to call CreateNewProfile xuls
|
||||
this.location.replace("resource:/res/profile/cpwManager.xul");
|
||||
|
@ -34,21 +45,27 @@ function CreateProfile()
|
|||
|
||||
function RenameProfile()
|
||||
{
|
||||
dump("************Inside REANAME prof\n");
|
||||
//dump("************Inside RENAME prof\n");
|
||||
var index = document.forms[0].profiles.selectedIndex;
|
||||
dump("index: "+index+"\n");
|
||||
//dump("index: "+index+"\n");
|
||||
|
||||
if (index > 0 || index == 0)
|
||||
if ((index > 0 || index == 0))
|
||||
{
|
||||
var curProfileName = profileList[index];
|
||||
dump("curProfileName: "+curProfileName+"\n");
|
||||
//dump("curProfileName: "+curProfileName+"\n");
|
||||
|
||||
if (curProfileName.indexOf("- migrate") >= 0)
|
||||
{
|
||||
this.location.replace("resource:/res/profile/errorDialog.html");
|
||||
}
|
||||
else
|
||||
{
|
||||
//dump("********************calling SetProfileName\n");
|
||||
parent.SetProfileName(curProfileName);
|
||||
|
||||
dump("********************calling SetProfileName\n");
|
||||
parent.SetProfileName(curProfileName);
|
||||
|
||||
// Open a dialog and get new name
|
||||
this.location.replace("resource:/res/profile/renameProfile.html");
|
||||
// Open a dialog and get new name
|
||||
this.location.replace("resource:/res/profile/renameProfile.html");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -61,19 +78,95 @@ function RenameProfile()
|
|||
|
||||
function DeleteProfile()
|
||||
{
|
||||
dump("************Inside DELETE prof\n");
|
||||
//dump("************Inside DELETE prof\n");
|
||||
var index = document.forms[0].profiles.selectedIndex;
|
||||
dump("index: "+index+"\n");
|
||||
//dump("index: "+index+"\n");
|
||||
|
||||
if (index > 0 || index == 0)
|
||||
if ((index > 0 || index == 0))
|
||||
{
|
||||
var curProfileName = profileList[index];
|
||||
dump("curProfileName: "+curProfileName+"\n");
|
||||
//dump("curProfileName: "+curProfileName+"\n");
|
||||
|
||||
profileCore.DeleteProfile(curProfileName);
|
||||
if (curProfileName.indexOf("- migrate") >= 0)
|
||||
{
|
||||
//dump("Need to be migrated before deleting the profile..\n");
|
||||
this.location.replace("resource:/res/profile/errorDialog.html");
|
||||
//dump("Loaded error dialog..\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
profileCore.DeleteProfile(curProfileName);
|
||||
|
||||
// Load this xul to see the updated profile list
|
||||
this.location.replace("resource:/res/profile/profileManager.html");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.location.replace("resource:/res/profile/errorDialog.html");
|
||||
//errorMessage = "Please select a profile first";
|
||||
//var element = document.getElementById("ErrorMessage");
|
||||
//element.value = errorMessage;
|
||||
}
|
||||
}
|
||||
|
||||
// Load this xul to see the updated profile list
|
||||
this.location.replace("resource:/res/profile/profileManager.html");
|
||||
function MigrateProfile()
|
||||
{
|
||||
//dump("************Inside DELETE prof\n");
|
||||
var index = document.forms[0].profiles.selectedIndex;
|
||||
//dump("index: "+index+"\n");
|
||||
|
||||
if ((index > 0 || index == 0))
|
||||
{
|
||||
var curProfileName = profileList[index];
|
||||
//dump("curProfileName: "+curProfileName+"\n");
|
||||
|
||||
var migrateIndex = curProfileName.indexOf("- migrate");
|
||||
|
||||
if (migrateIndex >= 0)
|
||||
{
|
||||
curProfileName = curProfileName.substr(0, migrateIndex-1);
|
||||
//dump("+++++++curProfileName: "+curProfileName+"\n");
|
||||
profileCore.MigrateProfile(curProfileName);
|
||||
|
||||
// Load this xul to see the updated profile list
|
||||
this.location.replace("resource:/res/profile/profileManager.html");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.location.replace("resource:/res/profile/errorDialog.html");
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.location.replace("resource:/res/profile/errorDialog.html");
|
||||
//errorMessage = "Please select a profile first";
|
||||
//var element = document.getElementById("ErrorMessage");
|
||||
//element.value = errorMessage;
|
||||
}
|
||||
}
|
||||
|
||||
function StartCommunicator()
|
||||
{
|
||||
//dump("************Inside Start Communicator prof\n");
|
||||
var index = document.forms[0].profiles.selectedIndex;
|
||||
//dump("index: "+index+"\n");
|
||||
|
||||
if ((index > 0 || index == 0))
|
||||
{
|
||||
var curProfileName = profileList[index];
|
||||
//dump("curProfileName: "+curProfileName+"\n");
|
||||
|
||||
if (curProfileName.indexOf("- migrate") >= 0)
|
||||
{
|
||||
this.location.replace("resource:/res/profile/errorDialog.html");
|
||||
}
|
||||
else
|
||||
{
|
||||
profileCore.StartCommunicator(curProfileName);
|
||||
ExitManager();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -149,10 +242,18 @@ in <i>New Profile Name</i> field, click Rename to rename the profile.
|
|||
<input name=delButton type="button" value="Delete " onclick="DeleteProfile();">
|
||||
</td></tr>
|
||||
|
||||
<tr><td>
|
||||
<input name=migrateButton type="button" value="Migrate " onclick="MigrateProfile();">
|
||||
</td></tr>
|
||||
|
||||
<tr><td>
|
||||
<input name=exitButton type="button" value="Exit " onclick="ExitManager();">
|
||||
</td></tr>
|
||||
|
||||
<tr><td>
|
||||
<input name=exitButton type="button" value="Start Communicator " onclick="StartCommunicator();">
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Загрузка…
Ссылка в новой задаче