diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-15 11:46:16 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-15 11:46:16 +0200 |
commit | d432689a50bc57be3b38e0b8ec8e1171bc26b2b2 (patch) | |
tree | de9241e5f14e482d4b7f1e9cc0e37e8243ca7196 /application/palemoon | |
parent | 60d29fb2861768032b831b77541e06de03b6ded2 (diff) | |
download | UXP-d432689a50bc57be3b38e0b8ec8e1171bc26b2b2.tar UXP-d432689a50bc57be3b38e0b8ec8e1171bc26b2b2.tar.gz UXP-d432689a50bc57be3b38e0b8ec8e1171bc26b2b2.tar.lz UXP-d432689a50bc57be3b38e0b8ec8e1171bc26b2b2.tar.xz UXP-d432689a50bc57be3b38e0b8ec8e1171bc26b2b2.zip |
Bug 92737 - Part 5: Set multiple homepage when multiple items are dropped on Home button
Issue #121
Diffstat (limited to 'application/palemoon')
-rw-r--r-- | application/palemoon/base/content/browser.js | 22 | ||||
-rw-r--r-- | application/palemoon/locales/en-US/chrome/browser/browser.properties | 1 |
2 files changed, 16 insertions, 7 deletions
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js index e05eca986..efd26c2b9 100644 --- a/application/palemoon/base/content/browser.js +++ b/application/palemoon/base/content/browser.js @@ -2686,8 +2686,10 @@ var homeButtonObserver = { onDrop: function (aEvent) { // disallow setting home pages that inherit the principal - let url = browserDragAndDrop.drop(aEvent, {}, true); - setTimeout(openHomeDialog, 0, url); + let links = browserDragAndDrop.dropLinks(aEvent, true); + if (links.length) { + setTimeout(openHomeDialog, 0, links.map(link => link.url).join("|")); + } }, onDragOver: function (aEvent) @@ -2703,18 +2705,24 @@ var homeButtonObserver = { function openHomeDialog(aURL) { var promptTitle = gNavigatorBundle.getString("droponhometitle"); - var promptMsg = gNavigatorBundle.getString("droponhomemsg"); + var promptMsg; + if (aURL.includes("|")) { + promptMsg = gNavigatorBundle.getString("droponhomemsgMultiple"); + } else { + promptMsg = gNavigatorBundle.getString("droponhomemsg"); + } + var pressedVal = Services.prompt.confirmEx(window, promptTitle, promptMsg, Services.prompt.STD_YES_NO_BUTTONS, null, null, null, null, {value:0}); if (pressedVal == 0) { try { - var str = Components.classes["@mozilla.org/supports-string;1"] - .createInstance(Components.interfaces.nsISupportsString); - str.data = aURL; + var homepageStr = Components.classes["@mozilla.org/supports-string;1"] + .createInstance(Components.interfaces.nsISupportsString); + homepageStr.data = aURL; gPrefService.setComplexValue("browser.startup.homepage", - Components.interfaces.nsISupportsString, str); + Components.interfaces.nsISupportsString, homepageStr); } catch (ex) { dump("Failed to set the home page.\n"+ex+"\n"); } diff --git a/application/palemoon/locales/en-US/chrome/browser/browser.properties b/application/palemoon/locales/en-US/chrome/browser/browser.properties index 8b3fea4d5..5e08c3e50 100644 --- a/application/palemoon/locales/en-US/chrome/browser/browser.properties +++ b/application/palemoon/locales/en-US/chrome/browser/browser.properties @@ -7,6 +7,7 @@ openFile=Open File droponhometitle=Set Home Page droponhomemsg=Do you want this document to be your new home page? +droponhomemsgMultiple=Do you want these documents to be your new home pages? # context menu strings |