Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced options for various download commands #10

Closed
Infocatcher opened this issue Oct 1, 2013 · 3 comments
Closed

Enhanced options for various download commands #10

Infocatcher opened this issue Oct 1, 2013 · 3 comments

Comments

@Infocatcher
Copy link
Owner

We already track Tools:Downloads command and downloads hotkey here: #2, also we should additionally handle #downloadsHistory item ("Show All Downloads" button in download panel) for #6.
So we can detect 1) downloads command, 2) downloads hotkey and 3) "Show All Downloads" from download panel.
And it's easy to do something good instead of default actions.
And we can override opening of "about:downloads" tab for private windows as well.

[added at 2014-01-13] Support for Downloads Window extension: #16

For example (see resource://app/components/DownloadsUI.js), open old window

var toolkitUI = Components.classesByID["{7dfdf0d1-aff6-4a34-bad1-d0fe74601642}"]
    .getService(Components.interfaces.nsIDownloadManagerUI);
toolkitUI.show(window/*, aDownload, aReason, aUsePrivateUI*/);

or open downloads in tab

window.openUILinkIn("about:downloads", "tab");

or open Library

      let organizer = Services.wm.getMostRecentWindow("Places:Organizer");
      if (!organizer) {
        parentWindow.openDialog("chrome://browser/content/places/places.xul",
                                "", "chrome,toolbar=yes,dialog=no,resizable",
                                "Downloads");
      } else {
        organizer.PlacesOrganizer.selectLeftPaneQuery("Downloads");
        organizer.focus();
      }
@Infocatcher
Copy link
Owner Author

Oh, too many things for options page...

Downloads menu item                               [Open old downloads window  v]
Downloads menu item in private window             [Default (don't override)   v]
“Show All Downloads” item                         [Default (don't override)   v]
“Show All Downloads” item in private window       [Default (don't override)   v]
Hotkey for downloads (Ctrl+J)                     [Toggle download panel      v]
Hotkey for downloads (Ctrl+J) in private window   [Toggle download panel      v]

Infocatcher added a commit that referenced this issue Oct 1, 2013
Note: "useDownloadsHotkeyToTogglePanel" preference replaced with "overrideDownloadsHotkey"
(first draft for #10)
Infocatcher added a commit that referenced this issue Oct 1, 2013
@Infocatcher
Copy link
Owner Author

Oh, too many things for options page...

Current appearance:
Screenshot: options

A but tricky (for margins) and Firefox itself is buggy width menulists:
Screenshot: buggy menulist

Infocatcher added a commit that referenced this issue Oct 1, 2013
Unfortunately we should do this before move focus to already opened library window
(part 4 for #10)
Infocatcher added a commit that referenced this issue Oct 2, 2013
@Infocatcher
Copy link
Owner Author

Also we have "Downloads" button on about:home page...

chrome://browser/content/browser.js

messageManager.loadFrameScript("chrome://browser/content/content.js", true);

chrome://browser/content/content.js

  onClick: function(aEvent) {
    ...
      case "downloads":
        sendAsyncMessage("AboutHome:Downloads");

resource:///components/nsBrowserGlue.js => resource:///modules/AboutHome.jsm

  MESSAGES: [
    ...
    "AboutHome:Downloads",
    ...
  ],

  init: function() {
    let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);

    for (let msg of this.MESSAGES) {
      mm.addMessageListener(msg, this);
    }

Anyway, seems that we can't use this way to handle "AboutHome:Downloads" message (missing things like event.preventDefault()/stopPropagation()):
https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIFrameMessageManager
https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIFrameMessageListener
But we still can handle "click" event before content script...

Infocatcher added a commit that referenced this issue Oct 30, 2013
Infocatcher added a commit that referenced this issue Oct 30, 2013
(#10)
See http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.xul
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser-sets.inc
#ifdef XP_GNOME
    <key id="key_search2" key="&searchFocusUnix.commandkey;" command="Tools:Search" modifiers="accel"/>
    <key id="key_openDownloads" key="&downloadsUnix.commandkey;" command="Tools:Downloads" modifiers="accel,shift"/>
#else
    <key id="key_openDownloads" key="&downloads.commandkey;" command="Tools:Downloads" modifiers="accel"/>
#endif
Infocatcher added a commit that referenced this issue Dec 15, 2013
Infocatcher added a commit that referenced this issue Dec 19, 2013
This may be fixed/implemented in another extension, so it's better to show only warning about possible incompatibility
(#6, #10, #16)
Infocatcher added a commit that referenced this issue Feb 13, 2014
Note: this is not a "real" sidebar, but something that may be useful.
Also unfortunately there is no easy way to show private downloads.
(#10)
Infocatcher added a commit that referenced this issue Feb 13, 2014
Infocatcher added a commit that referenced this issue Feb 14, 2014
isn't needed since 14955b4 commit
(related to #10)
Infocatcher added a commit that referenced this issue Feb 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant