Bug 391857 - can't open file with doubleclick (new DM). r=sdwilsh

This commit is contained in:
rflint@ryanflint.com 2007-08-12 01:14:08 -07:00
Родитель 815b72055f
Коммит 3280e25a26
1 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -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) function openDownload(aDownload)
{ {
var f = getLocalFileFromNativePathOrUrl(aDownload.getAttribute("file")); var f = getLocalFileFromNativePathOrUrl(aDownload.getAttribute("file"));
@ -370,6 +393,9 @@ function Startup()
buildDefaultView(); buildDefaultView();
// View event listeners
gDownloadsView.addEventListener("dblclick", onDownloadDblClick, false);
// The DownloadProgressListener (DownloadProgressListener.js) handles progress // The DownloadProgressListener (DownloadProgressListener.js) handles progress
// notifications. // notifications.
gDownloadListener = new DownloadProgressListener(); gDownloadListener = new DownloadProgressListener();