MIMETypes.st
changeset 1979 0612875a95c1
parent 1925 9f5e4568529f
child 1981 52b15b1e90b6
--- a/MIMETypes.st	Wed Apr 28 17:46:15 2004 +0200
+++ b/MIMETypes.st	Wed May 12 11:39:09 2004 +0200
@@ -17,10 +17,11 @@
 Object subclass:#MIMETypes
 	instanceVariableNames:''
 	classVariableNames:'TypeToImageReaderClassMapping TypeToCommentStringMapping
+		TypeToFileSuffixMapping TypeToViewerApplicationMapping
 		SuffixToCommentStringMapping FileSuffixToTypeMapping
-		TypeToFileSuffixMapping FilenameToTypeMapping
-		FileSuffixToImageReaderClassMapping CharSetToFontMapping
-		LastSuffix LastType DefaultCommandPerMIMEPerOS'
+		FilenameToTypeMapping FileSuffixToImageReaderClassMapping
+		CharSetToFontMapping LastSuffix LastType
+		DefaultCommandPerMIMEPerOS'
 	poolDictionaries:''
 	category:'Net-Communication-Support'
 !
@@ -99,7 +100,7 @@
      self initialize
     "
 
-    "Modified: / 19.11.1999 / 15:01:53 / cg"
+    "Modified: / 12-05-2004 / 11:07:20 / cg"
 !
 
 initializeCommentStringMappings
@@ -185,9 +186,35 @@
     unixCommands at:'application/x-tar-compressed' put:'gunzip < %1 | tar tvf -'.
     unixCommands at:'application/pdf'              put:'acroread -display %2 %1'.
 
+    OperatingSystem isMSWINDOWSlike ifTrue:[
+        |k fkey cmd|
+
+        k := Win32OperatingSystem::RegistryEntry key:'HKEY_CLASSES_ROOT\.pdf'.
+        k notNil ifTrue:[
+            fkey := (k valueNamed:'').
+        ].
+        fkey isNil ifTrue:[
+            fkey := 'pdf_auto_file'
+        ].
+        fkey notEmptyOrNil ifTrue:[
+            k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , fkey , '\shell\open\command').
+            k notNil ifTrue:[
+                cmd := k valueNamed:''
+            ].
+        ].
+
+        cmd isNil ifTrue:[
+            "assume its in the path"
+            cmd := 'acrord32 %1'.
+        ].
+        win32Commands at:'application/pdf'             put:cmd.
+    ].
+
     "
      self initializeDefaultCommands
     "
+
+    "Modified: / 12-05-2004 / 11:43:23 / cg"
 !
 
 initializeFileNameToMimeTypeMapping
@@ -470,6 +497,17 @@
 
 !MIMETypes class methodsFor:'queries'!
 
+defaultCommandForMimeType:mimeType
+    ^ self defaultCommandPerMIME at:mimeType ifAbsent:nil.
+
+    "
+     MIMETypes defaultCommandForMimeType:'application/pdf'
+    "
+
+    "Created: / 12-05-2004 / 11:09:22 / cg"
+    "Modified: / 12-05-2004 / 11:16:53 / cg"
+!
+
 defaultCommandPerMIME
     "TODO: move this to OS/UserPreferences"
 
@@ -917,7 +955,7 @@
 !MIMETypes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.72 2004-02-24 16:49:05 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.73 2004-05-12 09:39:09 cg Exp $'
 ! !
 
 MIMETypes initialize!