зеркало из https://github.com/mozilla/gecko-dev.git
Bug 803344 - Add a menuitem in the social toolbar button menu to disable the Social API with confirmation, r=gavin
This commit is contained in:
Родитель
366974721c
Коммит
d8a3b43c14
|
@ -192,6 +192,25 @@ let SocialUI = {
|
|||
containerParent instanceof Ci.nsIDOMXULPopupElement) {
|
||||
containerParent.hidePopup();
|
||||
}
|
||||
},
|
||||
|
||||
disableWithConfirmation: function SocialUI_disableWithConfirmation() {
|
||||
let brandShortName = document.getElementById("bundle_brand").getString("brandShortName");
|
||||
let dialogTitle = gNavigatorBundle.getFormattedString("social.remove.confirmationOK",
|
||||
[Social.provider.name]);
|
||||
let text = gNavigatorBundle.getFormattedString("social.remove.confirmationLabel",
|
||||
[Social.provider.name, brandShortName]);
|
||||
let okButtonText = dialogTitle;
|
||||
|
||||
let ps = Services.prompt;
|
||||
let flags = ps.BUTTON_TITLE_IS_STRING * ps.BUTTON_POS_0 +
|
||||
ps.BUTTON_TITLE_CANCEL * ps.BUTTON_POS_1 +
|
||||
ps.BUTTON_POS_0_DEFAULT;
|
||||
|
||||
let confirmationIndex = ps.confirmEx(null, dialogTitle, text, flags,
|
||||
okButtonText, null, null, null, {});
|
||||
if (confirmationIndex == 0)
|
||||
Social.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -650,6 +669,15 @@ var SocialToolbar = {
|
|||
// Called once, after window load, when the Social.provider object is initialized
|
||||
init: function SocialToolbar_init() {
|
||||
this.button.setAttribute("image", Social.provider.iconURL);
|
||||
|
||||
let removeItem = document.getElementById("social-remove-menuitem");
|
||||
let brandShortName = document.getElementById("bundle_brand").getString("brandShortName");
|
||||
let label = gNavigatorBundle.getFormattedString("social.remove.label",
|
||||
[brandShortName]);
|
||||
let accesskey = gNavigatorBundle.getString("social.remove.accesskey");
|
||||
removeItem.setAttribute("label", label);
|
||||
removeItem.setAttribute("accesskey", accesskey);
|
||||
|
||||
this.updateButton();
|
||||
this.updateProfile();
|
||||
this._dynamicResizer = new DynamicResizeWatcher();
|
||||
|
|
|
@ -691,6 +691,9 @@
|
|||
command="Social:ToggleNotifications"
|
||||
label="&social.toggleNotifications.label;"
|
||||
accesskey="&social.toggleNotifications.accesskey;"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="social-remove-menuitem"
|
||||
oncommand="SocialUI.disableWithConfirmation();"/>
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
</toolbaritem>
|
||||
|
|
|
@ -394,6 +394,14 @@ social.toggle.accesskey=f
|
|||
# LOCALIZATION NOTE (social.activated.description): %1$S is the name of the social provider, %2$S is brandShortName (e.g. Firefox)
|
||||
social.activated.description=You've turned on %1$S for %2$S.
|
||||
|
||||
# LOCALIZATION NOTE (social.remove.label): %S = brandShortName
|
||||
social.remove.label=Remove from %S
|
||||
social.remove.accesskey=R
|
||||
# LOCALIZATION NOTE (social.remove.confirmationLabel): %1$S is the name of the social provider, %2$S is brandShortName (e.g. Firefox)
|
||||
social.remove.confirmationLabel=Are you sure you want to remove %1$S for %2$S?
|
||||
# LOCALIZATION NOTE (social.remove.confirmationOK): %S is the name of the social provider
|
||||
social.remove.confirmationOK=Remove %S
|
||||
|
||||
# LOCALIZATION NOTE (social.error.message): %1$S is brandShortName (e.g. Firefox), %2$S is the name of the social provider
|
||||
social.error.message=%1$S is unable to connect with %2$S right now.
|
||||
social.error.tryAgain.label=Try Again
|
||||
|
|
Загрузка…
Ссылка в новой задаче