ask MIMETypes for pdf-command
authorClaus Gittinger <cg@exept.de>
Wed, 12 May 2004 12:21:08 +0200
changeset 5836 922c94b683a1
parent 5835 228d78813972
child 5837 470e67fd9d0a
ask MIMETypes for pdf-command
AbstractFileBrowser.st
--- a/AbstractFileBrowser.st	Wed May 12 10:15:54 2004 +0200
+++ b/AbstractFileBrowser.st	Wed May 12 12:21:08 2004 +0200
@@ -5453,23 +5453,35 @@
 !
 
 openPDFViewer
-    |files fileNames|
+    |files fileNames cmd arg|
 
     files := self currentSelectedFiles.
     (files isEmpty) ifTrue:[
         ^ self.
     ].
+    cmd := MIMETypes defaultCommandForMimeType:'application/pdf'.
+    cmd isNil ifTrue:[
+        Dialog warn:'No viewer has been defined for pdf-files (See MIMETypes initialization).'.
+        ^ self.
+    ].
+
     fileNames := 
         files 
             collect:
                 [:each |
                     '"' , each asFilename pathName , '"'
                 ].
+    arg := fileNames asStringCollection asStringWith:' '.
+
+    (cmd includesString:'"%1"') ifTrue:[
+        cmd := cmd copyReplaceString:'"%1"' withString:'%1'    
+    ].
 
     [
-        OperatingSystem 
-            executeCommand:'acroread ' , fileNames asStringCollection asString.
+        OperatingSystem executeCommand:(cmd bindWith:arg).
     ] fork
+
+    "Modified: / 12-05-2004 / 12:31:20 / cg"
 !
 
 openRP
@@ -6741,5 +6753,5 @@
 !AbstractFileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.230 2004-05-11 14:58:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.231 2004-05-12 10:21:08 cg Exp $'
 ! !