209 } catch (ex) { |
209 } catch (ex) { |
210 } |
210 } |
211 |
211 |
212 PlacesStarButton.uninit(); |
212 PlacesStarButton.uninit(); |
213 |
213 |
214 @@ -3208,16 +3364,22 @@ function FillHistoryMenu(aParent) { |
214 @@ -3208,16 +3364,23 @@ function FillHistoryMenu(aParent) { |
215 |
215 |
216 // Remove old entries if any |
216 // Remove old entries if any |
217 var children = aParent.childNodes; |
217 var children = aParent.childNodes; |
218 for (var i = children.length - 1; i >= 0; --i) { |
218 for (var i = children.length - 1; i >= 0; --i) { |
219 if (children[i].hasAttribute("index")) |
219 if (children[i].hasAttribute("index")) |
220 aParent.removeChild(children[i]); |
220 aParent.removeChild(children[i]); |
221 } |
221 } |
222 |
222 |
223 + // lockdown. Don't display anything if locked down. |
223 + // lockdown. Don't display anything if locked down. |
224 + var disableHistory = gPrefService.getBoolPref("config.lockdown.history"); |
224 + try { |
225 + if (disableHistory) { |
225 + var disableHistory = gPrefService.getBoolPref("config.lockdown.history"); |
226 + return false; |
226 + if (disableHistory) |
227 + } |
227 + return false; |
|
228 + } catch (ex) {} |
228 + |
229 + |
229 var webNav = getWebNavigation(); |
230 var webNav = getWebNavigation(); |
230 var sessionHistory = webNav.sessionHistory; |
231 var sessionHistory = webNav.sessionHistory; |
231 |
232 |
232 var count = sessionHistory.count; |
233 var count = sessionHistory.count; |
233 if (count <= 1) // don't display the popup for a single item |
234 if (count <= 1) // don't display the popup for a single item |
234 return false; |
235 return false; |
235 |
236 |
236 const MAX_HISTORY_MENU_ITEMS = 15; |
237 const MAX_HISTORY_MENU_ITEMS = 15; |
237 @@ -3357,16 +3519,17 @@ function BrowserCustomizeToolbar() |
238 @@ -3357,16 +3520,17 @@ function BrowserCustomizeToolbar() |
238 { |
239 { |
239 // Disable the toolbar context menu items |
240 // Disable the toolbar context menu items |
240 var menubar = document.getElementById("main-menubar"); |
241 var menubar = document.getElementById("main-menubar"); |
241 for (var i = 0; i < menubar.childNodes.length; ++i) |
242 for (var i = 0; i < menubar.childNodes.length; ++i) |
242 menubar.childNodes[i].setAttribute("disabled", true); |
243 menubar.childNodes[i].setAttribute("disabled", true); |
250 splitter.parentNode.removeChild(splitter); |
251 splitter.parentNode.removeChild(splitter); |
251 |
252 |
252 var customizeURL = "chrome://global/content/customizeToolbar.xul"; |
253 var customizeURL = "chrome://global/content/customizeToolbar.xul"; |
253 gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false); |
254 gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false); |
254 |
255 |
255 @@ -3394,16 +3557,25 @@ function BrowserCustomizeToolbar() |
256 @@ -3394,16 +3558,31 @@ function BrowserCustomizeToolbar() |
256 } else { |
257 } else { |
257 return window.openDialog(customizeURL, |
258 return window.openDialog(customizeURL, |
258 "CustomizeToolbar", |
259 "CustomizeToolbar", |
259 "chrome,titlebar,toolbar,location,resizable,dependent", |
260 "chrome,titlebar,toolbar,location,resizable,dependent", |
260 gNavToolbox); |
261 gNavToolbox); |
262 } |
263 } |
263 |
264 |
264 +function BrowserRestoreCustomizationDisabledState() |
265 +function BrowserRestoreCustomizationDisabledState() |
265 +{ |
266 +{ |
266 + var cmd = document.getElementById("cmd_CustomizeToolbars"); |
267 + var cmd = document.getElementById("cmd_CustomizeToolbars"); |
267 + if (!gPrefService.getBoolPref("config.lockdown.toolbarediting")) { |
268 + try { |
|
269 + var disableToolBarEditing = |
|
270 + gPrefService.getBoolPref("config.lockdown.toolbarediting"); |
|
271 + } catch (ex) { |
|
272 + var disableToolBarEditing = false; |
|
273 + } |
|
274 + if (!disableToolBarEditing) { |
268 + cmd.removeAttribute("disabled", "true"); |
275 + cmd.removeAttribute("disabled", "true"); |
269 + } |
276 + } |
270 + cmd.removeAttribute("inCustomization"); |
277 + cmd.removeAttribute("inCustomization"); |
271 +} |
278 +} |
272 + |
279 + |
276 document.getElementById("customizeToolbarSheetPopup").hidePopup(); |
283 document.getElementById("customizeToolbarSheetPopup").hidePopup(); |
277 } |
284 } |
278 |
285 |
279 // Update global UI elements that may have been added or removed |
286 // Update global UI elements that may have been added or removed |
280 if (aToolboxChanged) { |
287 if (aToolboxChanged) { |
281 @@ -3411,16 +3583,23 @@ function BrowserToolboxCustomizeDone(aTo |
288 @@ -3411,16 +3590,27 @@ function BrowserToolboxCustomizeDone(aTo |
282 if (gURLBar) |
289 if (gURLBar) |
283 gURLBar.emptyText = gURLBarEmptyText.value; |
290 gURLBar.emptyText = gURLBarEmptyText.value; |
284 |
291 |
285 gProxyFavIcon = document.getElementById("page-proxy-favicon"); |
292 gProxyFavIcon = document.getElementById("page-proxy-favicon"); |
286 gHomeButton.updateTooltip(); |
293 gHomeButton.updateTooltip(); |
287 gIdentityHandler._cacheElements(); |
294 gIdentityHandler._cacheElements(); |
288 window.XULBrowserWindow.init(); |
295 window.XULBrowserWindow.init(); |
289 |
296 |
290 + // make sure the search bar is not put back if locked down |
297 + // make sure the search bar is not put back if locked down |
291 + var disableSearchBar = gPrefService.getBoolPref("config.lockdown.searchbar"); |
298 + try { |
|
299 + var disableSearchBar = gPrefService.getBoolPref("config.lockdown.searchbar"); |
|
300 + } catch (ex) { |
|
301 + var disableSearchBar = false; |
|
302 + } |
292 + if (disableSearchBar) { |
303 + if (disableSearchBar) { |
293 + document.getElementById("search-container") |
304 + document.getElementById("search-container") |
294 + .setAttribute("style", (disableSearchBar) ? "display: none;" : ""); |
305 + .setAttribute("style", (disableSearchBar) ? "display: none;" : ""); |
295 + } |
306 + } |
296 + |
307 + |
300 document.getElementById('Browser:Back').hasAttribute('disabled') && |
311 document.getElementById('Browser:Back').hasAttribute('disabled') && |
301 document.getElementById('Browser:Forward').hasAttribute('disabled'); |
312 document.getElementById('Browser:Forward').hasAttribute('disabled'); |
302 |
313 |
303 // support downgrading to Firefox 2.0 |
314 // support downgrading to Firefox 2.0 |
304 var navBar = document.getElementById("nav-bar"); |
315 var navBar = document.getElementById("nav-bar"); |
305 @@ -3445,18 +3624,17 @@ function BrowserToolboxCustomizeDone(aTo |
316 @@ -3445,18 +3635,17 @@ function BrowserToolboxCustomizeDone(aTo |
306 XULBrowserWindow.asyncUpdateUI(); |
317 XULBrowserWindow.asyncUpdateUI(); |
307 PlacesStarButton.updateState(); |
318 PlacesStarButton.updateState(); |
308 } |
319 } |
309 |
320 |
310 // Re-enable parts of the UI we disabled during the dialog |
321 // Re-enable parts of the UI we disabled during the dialog |
320 if (!getBoolPref("ui.click_hold_context_menus", false)) |
331 if (!getBoolPref("ui.click_hold_context_menus", false)) |
321 SetClickAndHoldHandlers(); |
332 SetClickAndHoldHandlers(); |
322 #endif |
333 #endif |
323 |
334 |
324 // XXX Shouldn't have to do this, but I do |
335 // XXX Shouldn't have to do this, but I do |
325 @@ -4544,16 +4722,19 @@ function onViewToolbarsPopupShowing(aEve |
336 @@ -4544,16 +4733,19 @@ function onViewToolbarsPopupShowing(aEve |
326 var toolbarName = toolbar.getAttribute("toolbarname"); |
337 var toolbarName = toolbar.getAttribute("toolbarname"); |
327 if (toolbarName) { |
338 if (toolbarName) { |
328 let menuItem = document.createElement("menuitem"); |
339 let menuItem = document.createElement("menuitem"); |
329 let hidingAttribute = toolbar.getAttribute("type") == "menubar" ? |
340 let hidingAttribute = toolbar.getAttribute("type") == "menubar" ? |
330 "autohide" : "collapsed"; |
341 "autohide" : "collapsed"; |
340 |
351 |
341 menuItem.addEventListener("command", onViewToolbarCommand, false); |
352 menuItem.addEventListener("command", onViewToolbarCommand, false); |
342 } |
353 } |
343 toolbar = toolbar.nextSibling; |
354 toolbar = toolbar.nextSibling; |
344 } |
355 } |
345 @@ -6421,17 +6602,17 @@ BookmarkAllTabsHandler.prototype = { |
356 @@ -6421,17 +6613,23 @@ BookmarkAllTabsHandler.prototype = { |
346 |
357 |
347 _updateCommandState: function BATH__updateCommandState(aTabClose) { |
358 _updateCommandState: function BATH__updateCommandState(aTabClose) { |
348 var numTabs = gBrowser.tabContainer.childNodes.length; |
359 var numTabs = gBrowser.tabContainer.childNodes.length; |
349 |
360 |
350 // The TabClose event is fired before the tab is removed from the DOM |
361 // The TabClose event is fired before the tab is removed from the DOM |
351 if (aTabClose) |
362 if (aTabClose) |
352 numTabs--; |
363 numTabs--; |
353 |
364 |
354 - if (numTabs > 1) |
365 - if (numTabs > 1) |
355 + if (numTabs > 1 && !gPrefService.getBoolPref("config.lockdown.bookmark")) |
366 + try { |
|
367 + var disableBookmarks = |
|
368 + gPrefService.getBoolPref("config.lockdown.bookmark"); |
|
369 + } catch (ex) { |
|
370 + var disableBookmarks = false; |
|
371 + } |
|
372 + if (numTabs > 1 && !disableBookmarks) |
356 this._command.removeAttribute("disabled"); |
373 this._command.removeAttribute("disabled"); |
357 else |
374 else |
358 this._command.setAttribute("disabled", "true"); |
375 this._command.setAttribute("disabled", "true"); |
359 }, |
376 }, |
360 |
377 |