From 1cd19923e910ba52aab0461d48f1bbf9572a3b52 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 18 Apr 2008 21:22:14 +0000 Subject: [PATCH] Support attachment reveal on Linux --- chrome/content/zotero/overlay.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index 13cdc198f..ae5e6f437 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -2017,12 +2017,22 @@ var ZoteroPane = new function() file.reveal(); } catch (e) { - // On platforms that don't support nsILocalFile.reveal() (e.g. Linux), we - // open a small window with a selected read-only textbox containing the - // file path, so the user can open it, Control-c, Control-w, Alt-Tab, and - // Control-v the path into another app - var io = {alertText: file.path}; - window.openDialog('chrome://zotero/content/selectableAlert.xul', "zotero-reveal-window", "chrome", io); + // On platforms that don't support nsILocalFile.reveal() (e.g. Linux), + // "double-click" the parent directory + try { + var parent = file.parent.QueryInterface(Components.interfaces.nsILocalFile); + parent.launch(); + } + // If launch also fails, try the OS handler + catch (e) { + var uri = Components.classes["@mozilla.org/network/io-service;1"]. + getService(Components.interfaces.nsIIOService). + newFileURI(parent); + var protocolService = + Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]. + getService(Components.interfaces.nsIExternalProtocolService); + protocolService.loadUrl(uri); + } } } else {