Changeset 703

Show
Ignore:
Timestamp:
03/28/08 13:29:30 (8 months ago)
Author:
ma..@jesperkristensen.dk
Message:

uninstall dialog

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/manage-ui2/src/chrome/chromeFiles/content/manage.js

    r700 r703  
    111111 
    112112function handleUninstallButton() { 
    113   if (document.getElementById("chkUninstallPrefs").checked) { 
    114     // Remove saved preferences 
    115     GM_prefRoot.remove(selectedScript.prefBranch); 
    116   } 
    117  
    118   config.uninstall(selectedScript); 
     113  var gmManageBundle = document.getElementById("gm-manage-bundle"); 
     114 
     115  var hasPrefs = GM_prefRoot.existsBranch(selectedScript.prefBranch); 
     116 
     117  var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] 
     118                                .getService(Components.interfaces.nsIPromptService); 
     119 
     120  var choice = promptService.confirmEx( 
     121    window, 
     122    gmManageBundle.getString("uninstallDialogTitle"), 
     123    gmManageBundle.getFormattedString(hasPrefs ? "uninstallTextWithPrefs" : 
     124      "uninstallTextWithoutPrefs", [selectedScript.name]), 
     125    promptService.BUTTON_POS_0_DEFAULT + 
     126    promptService.BUTTON_TITLE_IS_STRING * ( 
     127      promptService.BUTTON_POS_0 + 
     128      promptService.BUTTON_POS_1 + 
     129      (hasPrefs ? promptService.BUTTON_POS_2 : 0) 
     130    ), 
     131    gmManageBundle.getString("uninstallButtonRemoveScript"), // 0 
     132    gmManageBundle.getString("uninstallButtonCancel"), // 1 
     133    gmManageBundle.getString("uninstallButtonRemoveScriptAndPrefs"), // 2 
     134    null, {} 
     135  ); 
     136 
     137  if (choice == 2) GM_prefRoot.remove(selectedScript.prefBranch); 
     138 
     139  if (choice != 1) config.uninstall(selectedScript); 
    119140} 
    120141 
  • branches/manage-ui2/src/chrome/chromeFiles/content/manage.xul

    r688 r703  
    5959            <button id="btnUninstall" 
    6060              label="&manage.label.btnUninstall;" /> 
    61             <checkbox id="chkUninstallPrefs" 
    62               label="&manage.label.chkUninstall;" 
    63               checked="false" /> 
    6461          </hbox> 
    6562        </vbox> 
  • branches/manage-ui2/src/chrome/chromeFiles/content/prefmanager.js

    r692 r703  
    2828  this.exists = function(prefName) { 
    2929    return pref.getPrefType(prefName) != 0; 
     30  }; 
     31 
     32  /** 
     33   * whether a preference branch exists 
     34   */ 
     35  this.existsBranch = function(prefName) { 
     36    var out = {}; 
     37    pref.getChildList(prefName, out); 
     38    return !!out.value; 
    3039  }; 
    3140 
  • branches/manage-ui2/src/chrome/chromeFiles/locale/en-US/gm-manage.properties

    r652 r703  
    55promptForEdit.msg=Modify the URL of the page below. You can specify multiple pages using the wildcard (*) character. 
    66promptForEdit.title=Edit Page 
     7 
     8uninstallDialogTitle=Uninstall User Script 
     9uninstallTextWithPrefs=You are about to uninstall the user script "%S".\n\nWould you also like to delete associated preferences? 
     10uninstallTextWithoutPrefs=You are about to uninstall the user script "%S".\n\nWould you like to continue? 
     11uninstallButtonRemoveScriptAndPrefs=Uninstall and delete preferences 
     12uninstallButtonRemoveScript=Uninstall 
     13uninstallButtonCancel=Cancel 
  • branches/manage-ui2/src/chrome/chromeFiles/locale/en-US/greasemonkey.dtd

    r673 r703  
    88<!ENTITY manage.label.chkEnabled "Enabled"> 
    99<!ENTITY manage.label.btnUninstall "Uninstall"> 
    10 <!ENTITY manage.label.chkUninstall "Also uninstall associated preferences"> 
    1110<!ENTITY manage.reorderHelp "Drag-and-drop with the mouse or press Alt-Up/Alt-Down to reorder scripts in this list."> 
    1211