зеркало из https://github.com/mozilla/pjs.git
Bug 391857 - can't open file with doubleclick (new DM). r=sdwilsh
This commit is contained in:
Родитель
815b72055f
Коммит
3280e25a26
|
@ -237,6 +237,29 @@ function showDownload(aDownload)
|
|||
}
|
||||
}
|
||||
|
||||
function onDownloadDblClick(aEvent)
|
||||
{
|
||||
var item = aEvent.target;
|
||||
if (item.getAttribute("type") == "download") {
|
||||
var state = parseInt(item.getAttribute("state"));
|
||||
switch (state) {
|
||||
case Ci.nsIDownloadManager.DOWNLOAD_FINISHED:
|
||||
gDownloadViewController.doCommand("cmd_open");
|
||||
break;
|
||||
case Ci.nsIDownloadManager.DOWNLOAD_DOWNLOADING:
|
||||
gDownloadViewController.doCommand("cmd_pause");
|
||||
break;
|
||||
case Ci.nsIDownloadManager.DOWNLOAD_PAUSED:
|
||||
gDownloadViewController.doCommand("cmd_resume");
|
||||
break;
|
||||
case Ci.nsIDownloadManager.DOWNLOAD_CANCELED:
|
||||
case Ci.nsIDownloadManager.DOWNLOAD_FAILED:
|
||||
gDownloadViewController.doCommand("cmd_retry");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function openDownload(aDownload)
|
||||
{
|
||||
var f = getLocalFileFromNativePathOrUrl(aDownload.getAttribute("file"));
|
||||
|
@ -370,6 +393,9 @@ function Startup()
|
|||
|
||||
buildDefaultView();
|
||||
|
||||
// View event listeners
|
||||
gDownloadsView.addEventListener("dblclick", onDownloadDblClick, false);
|
||||
|
||||
// The DownloadProgressListener (DownloadProgressListener.js) handles progress
|
||||
// notifications.
|
||||
gDownloadListener = new DownloadProgressListener();
|
||||
|
|
Загрузка…
Ссылка в новой задаче