зеркало из https://github.com/mozilla/pjs.git
Bug 408565 - Menu items "Open Containing Folder" / "Show in Finder" shouldn't be grayed out for in-progress/paused downloads. r=sdwilsh, a1.9=beltzner
This commit is contained in:
Родитель
c36039fbde
Коммит
44e48d8b89
|
@ -265,14 +265,23 @@ function showDownload(aDownload)
|
||||||
var f = getLocalFileFromNativePathOrUrl(aDownload.getAttribute("file"));
|
var f = getLocalFileFromNativePathOrUrl(aDownload.getAttribute("file"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Show the directory containing the file and select the file
|
||||||
f.reveal();
|
f.reveal();
|
||||||
} catch (ex) {
|
} catch (e) {
|
||||||
// if reveal failed for some reason (eg on unix it's not currently
|
// If reveal fails for some reason (e.g., it's not implemented on unix or
|
||||||
// implemented), send the file: URL window rooted at the parent to
|
// the file doesn't exist), try using the parent if we have it.
|
||||||
// the OS handler for that protocol
|
let parent = f.parent.QueryInterface(Ci.nsILocalFile);
|
||||||
var parent = f.parent;
|
if (!parent)
|
||||||
if (parent)
|
return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// "Double click" the parent directory to show where the file should be
|
||||||
|
parent.launch();
|
||||||
|
} catch (e) {
|
||||||
|
// If launch also fails (probably because it's not implemented), let the
|
||||||
|
// OS handler try to open the parent
|
||||||
openExternal(parent);
|
openExternal(parent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,7 +638,6 @@ var gDownloadViewController = {
|
||||||
case "cmd_cancel":
|
case "cmd_cancel":
|
||||||
return dl.inProgress;
|
return dl.inProgress;
|
||||||
case "cmd_open":
|
case "cmd_open":
|
||||||
case "cmd_show":
|
|
||||||
let file = getLocalFileFromNativePathOrUrl(dl.getAttribute("file"));
|
let file = getLocalFileFromNativePathOrUrl(dl.getAttribute("file"));
|
||||||
return dl.openable && file.exists();
|
return dl.openable && file.exists();
|
||||||
case "cmd_pause":
|
case "cmd_pause":
|
||||||
|
@ -643,6 +651,7 @@ var gDownloadViewController = {
|
||||||
case "cmd_removeFromList":
|
case "cmd_removeFromList":
|
||||||
case "cmd_retry":
|
case "cmd_retry":
|
||||||
return dl.removable;
|
return dl.removable;
|
||||||
|
case "cmd_show":
|
||||||
case "cmd_copyLocation":
|
case "cmd_copyLocation":
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче