--- a/MIMETypes.st Thu Mar 02 12:07:26 2006 +0100
+++ b/MIMETypes.st Fri Mar 03 14:20:28 2006 +0100
@@ -21,7 +21,7 @@
SuffixToCommentStringMapping FileSuffixToTypeMapping
FilenameToTypeMapping FileSuffixToImageReaderClassMapping
CharSetToFontMapping LastSuffix LastType
- DefaultCommandPerMIMEPerOS'
+ DefaultCommandPerMIMEPerOS DefaultPrintCommandPerMIMEPerOS'
poolDictionaries:''
category:'Net-Communication-Support'
!
@@ -186,7 +186,7 @@
initializeDefaultCommands
"TODO: move this to OS"
- |unixCommands win32Commands|
+ |unixCommands win32Commands unixPrintCommands win32PrintCommands|
DefaultCommandPerMIMEPerOS := Dictionary new.
DefaultCommandPerMIMEPerOS at:#unix put:(unixCommands := Dictionary new).
@@ -195,7 +195,16 @@
unixCommands at:'application/x-tar-compressed' put:'gunzip < %1 | tar tvf -'.
unixCommands at:'application/pdf' put:'acroread -display %2 %1'.
- "/ obsolete - now read through the registry
+ DefaultPrintCommandPerMIMEPerOS := Dictionary new.
+ DefaultPrintCommandPerMIMEPerOS at:#unix put:(unixPrintCommands := Dictionary new).
+ DefaultPrintCommandPerMIMEPerOS at:#win32 put:(win32PrintCommands := Dictionary new).
+
+ "/ if you have a good (intelligent) spooler ;-)
+ unixPrintCommands at:'application/pdf' put:'lpr %1'.
+ "/ if not, you may need more...
+ "/ unixPrintCommands at:'application/pdf' put:'pdfToPS %1 | lpr'.
+
+ "/ WIN32 setup is now obsolete - now read through the registry
"/ OperatingSystem isMSWINDOWSlike ifTrue:[
"/ #(
"/ "suffix" "default" "mime"
@@ -507,15 +516,9 @@
!MIMETypes class methodsFor:'queries'!
defaultCommandForMimeType:mimeType
- |cmd|
+ self obsoleteMethodWarning:'use #defaultCommandTemplateToOpenMimeType:'.
- cmd := self defaultCommandPerMIME at:mimeType ifAbsent:nil.
- cmd isNil ifTrue:[
- OperatingSystem isMSWINDOWSlike ifTrue:[
- cmd := Win32OperatingSystem::RegistryEntry executableForMimeType:mimeType
- ].
- ].
- ^ cmd
+ ^ self defaultCommandTemplateToOpenMimeType:mimeType
"
MIMETypes defaultCommandForMimeType:'application/pdf'
@@ -526,6 +529,8 @@
!
defaultCommandPerMIME
+ "returns the collection which is used to map MIME-type to command-templates."
+
"TODO: move this to OS/UserPreferences"
DefaultCommandPerMIMEPerOS isNil ifTrue:[
@@ -537,6 +542,20 @@
^ DefaultCommandPerMIMEPerOS at:#win32
!
+defaultPrintCommandPerMIME
+ "returns the collection which is used to map MIME-type to printing command-templates."
+
+ "TODO: move this to OS/UserPreferences"
+
+ DefaultPrintCommandPerMIMEPerOS isNil ifTrue:[
+ self initializeDefaultCommands
+ ].
+ OperatingSystem isUNIXlike ifTrue:[
+ ^ DefaultPrintCommandPerMIMEPerOS at:#unix
+ ].
+ ^ DefaultPrintCommandPerMIMEPerOS at:#win32
+!
+
defineImageType:mimeType suffix:aSuffix reader:aReaderClass
"register an image reader."
@@ -732,6 +751,43 @@
"Modified: / 23.12.1999 / 22:30:55 / cg"
! !
+!MIMETypes class methodsFor:'queries-applications'!
+
+defaultCommandTemplateToOpenMimeType:mimeType
+ |cmd|
+
+ cmd := self defaultCommandPerMIME at:mimeType ifAbsent:nil.
+ cmd isNil ifTrue:[
+ OperatingSystem isMSWINDOWSlike ifTrue:[
+ cmd := Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:mimeType
+ ].
+ ].
+ ^ cmd
+
+ "
+ MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'
+ "
+
+ "Created: / 12-05-2004 / 11:09:22 / cg"
+ "Modified: / 12-05-2004 / 11:16:53 / cg"
+!
+
+defaultCommandTemplateToPrintMimeType:mimeType
+ |cmd|
+
+ cmd := self defaultPrintCommandPerMIME at:mimeType ifAbsent:nil.
+ cmd isNil ifTrue:[
+ OperatingSystem isMSWINDOWSlike ifTrue:[
+ cmd := Win32OperatingSystem::RegistryEntry commandTemplateToPrintMimeType:mimeType
+ ].
+ ].
+ ^ cmd
+
+ "
+ MIMETypes defaultCommandTemplateToPrintMimeType:'application/pdf'
+ "
+! !
+
!MIMETypes class methodsFor:'queries-image formats'!
imageReaderClasses
@@ -994,7 +1050,7 @@
!MIMETypes class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.82 2006-02-23 23:59:36 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.83 2006-03-03 13:20:28 cg Exp $'
! !
MIMETypes initialize!