MIMETypes.st
author ca
Fri, 28 Jul 2006 14:06:24 +0200
changeset 2141 8decb5cd7766
parent 2118 b41112f6c76e
child 2142 d9537c2a5c64
permissions -rw-r--r--
support html browser under unix
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG 
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
     3
	      All Rights Reserved
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
1410
faf04ef6892b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    15
"{ Package: 'stx:libview2' }"
faf04ef6892b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    16
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
Object subclass:#MIMETypes
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    18
	instanceVariableNames:''
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    19
	classVariableNames:'TypeToImageReaderClassMapping TypeToCommentStringMapping
1979
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
    20
		TypeToFileSuffixMapping TypeToViewerApplicationMapping
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    21
		SuffixToCommentStringMapping FileSuffixToTypeMapping
1979
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
    22
		FilenameToTypeMapping FileSuffixToImageReaderClassMapping
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
    23
		CharSetToFontMapping LastSuffix LastType
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
    24
		DefaultCommandPerMIMEPerOS DefaultPrintCommandPerMIMEPerOS'
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    25
	poolDictionaries:''
1800
817b8ce39da7 category
Claus Gittinger <cg@exept.de>
parents: 1783
diff changeset
    26
	category:'Net-Communication-Support'
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    27
!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    28
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    29
String variableByteSubclass:#MIMEType
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    30
	instanceVariableNames:''
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    31
	classVariableNames:'CachedTypes'
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    32
	poolDictionaries:''
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    33
	privateIn:MIMETypes
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
!MIMETypes class methodsFor:'documentation'!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
copyright
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
 COPYRIGHT (c) 1997 by eXept Software AG 
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    41
	      All Rights Reserved
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
 This software is furnished under a license and may be used
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
 only in accordance with the terms of that license and with the
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
 inclusion of the above copyright notice.   This software may not
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
 be provided or otherwise made available to, or used by, any
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
 other person.  No title to or ownership of the software is
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
 hereby transferred.
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
"
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
documentation
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
"
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    just a place to keep MIME information
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    (avoid spreading things at many places)
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    59
    MIMETypes is abstract and functional.
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    60
    Actually, in some OperatingSystems, this information may
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    61
    be found in some config files (or registries).
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    62
    Therefore, this class may have to be extended to support this
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    63
    and fetch the information from there eventually.
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    64
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
    [author:]
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
        Claus Gittinger
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
"
1311
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    68
!
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    69
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    70
knownTypes
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    71
"
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    72
    simply a reminder for me ...
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    73
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    74
    application         mime                            file extentsions
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    75
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    76
        powerpoint      application/ms-powerpoint       .pot, .ppz, .ppt, .pps, 
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    77
                        application/mspowerpoint        
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    78
                        application/vnd.ms-powerpoint   
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    79
                        application/x-mspowerpoint
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    80
1312
Claus Gittinger <cg@exept.de>
parents: 1311
diff changeset
    81
        shockwave       application/x-shockwave-flash   .swf     
1311
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    82
1312
Claus Gittinger <cg@exept.de>
parents: 1311
diff changeset
    83
        futuresplash    application/futuresplash        .spl
1311
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    84
"
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
! !
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
!MIMETypes class methodsFor:'initialization'!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    89
initialize
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    90
    "initialize wellKnown facts"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    91
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    92
    MIMEType initialize.   "must be initialized first"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    93
    LastSuffix := LastType := nil.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    94
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    95
    self initializeFileNameToMimeTypeMapping.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    96
    self initializeImageReaderMappings.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    97
    self initializeCommentStringMappings.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    98
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    99
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   100
     self initialize
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   101
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   102
1979
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   103
    "Modified: / 12-05-2004 / 11:07:20 / cg"
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   104
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   105
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   106
initializeCommentStringMappings
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   107
    TypeToCommentStringMapping := Dictionary new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   108
    SuffixToCommentStringMapping := Dictionary new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   109
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   110
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   111
        at:'application/x-make'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   112
        put:#('#' (nil nil)).           "/ '#' for EOL comments only
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   113
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   114
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   115
        at:'application/x-sh'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   116
        put:#('#' (nil nil)).           "/ '#' for EOL comments only
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   117
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   118
    #('text/html' 'text/xml' 'application/xml')
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   119
    do:[:eachXMLType |
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   120
        TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   121
            at:eachXMLType
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   122
            put:#(nil ('<!!-- ' ' -->')). "/ '<!!-- ... -->' delimited comments only
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   123
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   124
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   125
    TypeToCommentStringMapping 
2055
501740104b75 css-comments
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   126
        at:'text/css'
501740104b75 css-comments
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   127
        put:#('//' ('/*' '*/')).          
501740104b75 css-comments
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   128
501740104b75 css-comments
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   129
    TypeToCommentStringMapping 
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   130
        at:'application/x-batch-script'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   131
        put:#('rem ' (nil nil)).         "/ 'rem ' for EOL comments only
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   132
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   133
    "/ the following is ST/X specific
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   134
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   135
        at:'application/x-smalltalk-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   136
        put:#('"/' ('"' '"')).           "/ '"/ ' for EOL; ".." for delimited comments
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   137
2055
501740104b75 css-comments
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   138
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   139
    "/ this is for standard smalltalk
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   140
"/    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   141
"/        at:'application/x-smalltalk-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   142
"/        put:#(nil ('"' '"')).            "/ ".." for delimited comments only
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   143
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   144
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   145
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   146
        at:'application/x-pascal-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   147
        put:#(nil ('{' '}')).           "/ '{'..'}' for delimited comments
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   148
2055
501740104b75 css-comments
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   149
2048
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   150
"/    "/ the following is k&r
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   151
"/    TypeToCommentStringMapping 
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   152
"/        at:'application/x-c-source'
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   153
"/        put:#(nil ('/*' '*/')).          "/ '/*'..'*/' for delimited comments
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   154
    "/ this is ANSI-c
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   155
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   156
        at:'application/x-c-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   157
        put:#('//' ('/*' '*/')).          
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   158
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   159
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   160
        at:'application/x-cpp-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   161
        put:#('//' ('/*' '*/')).          
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   162
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   163
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   164
        at:'application/x-java-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   165
        put:#('//' ('/*' '*/')).          
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   166
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   167
    TypeToCommentStringMapping 
2048
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   168
        at:'application/x-javascript'
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   169
        put:#('//' ('/*' '*/')).          
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   170
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   171
    TypeToCommentStringMapping 
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   172
        at:'application/x-asn1-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   173
        put:#('--' ('--' '--')).          
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   174
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   175
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   176
    "/ st/x support files
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   177
    SuffixToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   178
        at:'style'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   179
        put:#(';' (nil nil)).          
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   180
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   181
    SuffixToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   182
        at:'rs'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   183
        put:#(';' (nil nil)).          
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   184
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   185
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   186
initializeDefaultCommands
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   187
    "TODO: move this to OS"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   188
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   189
    |unixCommands win32Commands unixPrintCommands win32PrintCommands|
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   190
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   191
    DefaultCommandPerMIMEPerOS := Dictionary new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   192
    DefaultCommandPerMIMEPerOS at:#unix  put:(unixCommands := Dictionary new).
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   193
    DefaultCommandPerMIMEPerOS at:#win32 put:(win32Commands := Dictionary new).
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   194
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   195
    unixCommands at:'application/x-tar-compressed' put:'gunzip < %1 | tar tvf -'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   196
    unixCommands at:'application/pdf'              put:'acroread -display %2 %1'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   197
2141
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   198
    OperatingSystem isMSWINDOWSlike ifFalse:[ |cmd|
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   199
        cmd := #( firefox mozilla netscape opera )
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   200
                detect:[:aCmd| (OperatingSystem pathOfCommand:aCmd) notEmptyOrNil ]
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   201
                ifNone:nil.
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   202
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   203
        cmd notNil ifTrue:[
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   204
            unixCommands at:'text/html' put:(cmd, ' %1')       
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   205
        ].
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   206
    ].
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   207
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   208
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   209
    DefaultPrintCommandPerMIMEPerOS := Dictionary new.
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   210
    DefaultPrintCommandPerMIMEPerOS at:#unix  put:(unixPrintCommands := Dictionary new).
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   211
    DefaultPrintCommandPerMIMEPerOS at:#win32 put:(win32PrintCommands := Dictionary new).
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   212
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   213
    "/ if you have a good (intelligent) spooler ;-)
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   214
    unixPrintCommands at:'application/pdf'         put:'lpr %1'.
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   215
    "/ if not, you may need more...
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   216
    "/ unixPrintCommands at:'application/pdf'         put:'pdfToPS %1 | lpr'.
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   217
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   218
    "/ WIN32 setup is now obsolete - now read through the registry
2096
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   219
"/    OperatingSystem isMSWINDOWSlike ifTrue:[
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   220
"/        #(
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   221
"/            "suffix"    "default"       "mime"
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   222
"/            ( 'pdf'     'acrord32 %1'   'application/pdf' )
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   223
"/        ) triplesDo:[:suffix :default :mime|
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   224
"/            |cmd|
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   225
"/
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   226
"/            cmd := Win32OperatingSystem::RegistryEntry executableForSuffix:suffix.
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   227
"/            cmd isNil ifTrue:[
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   228
"/                "assume its in the path"
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   229
"/                cmd := default.
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   230
"/            ].
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   231
"/            win32Commands at:mime put:cmd.
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   232
"/        ].
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   233
"/    ].
1979
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   234
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   235
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   236
     self initializeDefaultCommands
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   237
    "
1979
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   238
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   239
    "Modified: / 12-05-2004 / 11:43:23 / cg"
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   240
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   241
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   242
initializeFileNameToMimeTypeMapping
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   243
    "initialize wellKnown facts"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   244
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   245
    |types|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   246
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   247
    FileSuffixToTypeMapping isNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   248
        FileSuffixToTypeMapping := Dictionary new
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   249
    ].
1887
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   250
    TypeToFileSuffixMapping isNil ifTrue:[
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   251
        TypeToFileSuffixMapping := Dictionary new
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   252
    ].
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   253
    FilenameToTypeMapping isNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   254
        FilenameToTypeMapping := Dictionary new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   255
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   256
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   257
    types := OrderedCollection new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   258
    types addAll:self textTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   259
    types addAll:self imageTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   260
    types addAll:self videoTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   261
    types addAll:self audioTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   262
    types addAll:self applicationTypeList.
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   263
    types addAll:self osSpecificTypeList.
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   264
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   265
    types pairWiseDo:[:suff :typeString|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   266
        |type|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   267
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   268
        type := MIMEType fromString:typeString.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   269
        suff isArray ifTrue:[
1887
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   270
            suff do:[:s | FileSuffixToTypeMapping at:s put:type].
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   271
            TypeToFileSuffixMapping at:type put:suff first.
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   272
        ] ifFalse:[
1887
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   273
            FileSuffixToTypeMapping at:suff put:type.
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   274
            TypeToFileSuffixMapping at:type put:suff.
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   275
        ].
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   276
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   277
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   278
    self miscFilenameList pairWiseDo:[:nm :typeString|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   279
        |type|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   280
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   281
        type := MIMEType fromString:typeString.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   282
        nm isArray ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   283
            nm do:[:s | FilenameToTypeMapping at:s put:type]
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   284
        ] ifFalse:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   285
            FilenameToTypeMapping at:nm put:type
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   286
        ]
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   287
    ].
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   288
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   289
    "
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   290
     self initializeFileNameToMimeTypeMapping
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   291
    "
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   292
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   293
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   294
initializeImageReaderMappings
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   295
    FileSuffixToImageReaderClassMapping isNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   296
        FileSuffixToImageReaderClassMapping := Dictionary new
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   297
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   298
    "MIME" TypeToImageReaderClassMapping isNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   299
        TypeToImageReaderClassMapping := Dictionary new
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   300
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   301
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   302
    "/ setup mimeType to image reader class mapping ...
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   303
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   304
    TypeToImageReaderClassMapping at:'image/jpeg' put:JPEGReader.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   305
    TypeToImageReaderClassMapping at:'image/gif'  put:GIFReader.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   306
    TypeToImageReaderClassMapping at:'image/tiff' put:TIFFReader.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   307
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   308
    "/ setup suffix to image reader class mapping ...
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   309
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   310
    FileSuffixToImageReaderClassMapping at:'jpg'  put:JPEGReader.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   311
    FileSuffixToImageReaderClassMapping at:'gif'  put:GIFReader.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   312
    FileSuffixToImageReaderClassMapping at:'tif'  put:TIFFReader.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   313
! !
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   314
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   315
!MIMETypes class methodsFor:'initialization-lists'!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   316
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   317
applicationCompressorsAndArchiveTypeList
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   318
    ^ #(
1890
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   319
        'tar'                       'application/x-tar'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   320
        'gtar'                      'application/x-gtar'
1891
1b53c21c64c5 tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1890
diff changeset
   321
        ('tgz' 'tar.gz')            'application/x-tar-gzip-compressed'   "/ 'application/x-tar-compressed'
1b53c21c64c5 tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1890
diff changeset
   322
        ('tar.bz2')                 'application/x-tar-bzip2-compressed'
1890
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   323
        'zip'                       'application/x-zip-compressed'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   324
        'bz2'                       'application/x-bzip2-compressed'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   325
        ('gz' 'z')                  'application/x-gzip-compressed'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   326
        'cpio'                      'application/x-cpio'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   327
        'shar'                      'application/x-shar'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   328
        'jar'                       'application/java-archive'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   329
        'sar'                       'application/x-squeak-archive'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   330
        'sit'                       'application/x-stuffit'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   331
        'hqx'                       'application/mac-binhex40'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   332
        'cpt'                       'application/mac-compactpro'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   333
    )
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   334
!
645
97e83ab4d246 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
   335
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   336
applicationMiscTypeList
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   337
    "misc applications"
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   338
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   339
    ^ #(
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   340
        ('a' 'o' 'obj' )                        'application/binary'
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   341
        'a'                                     'application/library'
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   342
        ('dll' 'so')                            'application/shared-library'
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   343
    )
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   344
!
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   345
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   346
applicationProgLangTypeList
1606
158c10a36736 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1604
diff changeset
   347
    "applications for programm languages"
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   348
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   349
    ^ #(
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   350
        ('st' 'cls' 'rc')            'application/x-smalltalk-source'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   351
        'sif'                        'application/x-smalltalk-source-sif'
1668
070264d3a087 added dolphin package
Claus Gittinger <cg@exept.de>
parents: 1666
diff changeset
   352
        'pac'                        'application/x-smalltalk-dolphin-package'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   353
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   354
        'sts'                        'application/x-squeak-source'
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   355
        'pr'                         'application/x-squeak-project'
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   356
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   357
        'c'                          'application/x-c-source'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   358
        ('cc' 'cpp')                 'application/x-cpp-source'
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   359
        ('h' 'hi')                   'application/x-c-header'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   360
        ('js' 'mocha')               'application/x-javascript'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   361
        ('java' 'jav')               'application/x-java-source'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   362
        'sh'                         'application/x-sh'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   363
        'csh'                        'application/x-csh'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   364
        'tcl'                        'application/x-tcl'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   365
        'pl'                         'application/x-perl'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   366
        'mak'                        'application/x-make'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   367
        'bat'                        'application/x-batch-script'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   368
        ('asn1' 'x409' 'gdmo' 'gdm') 'application/x-asn1-source'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   369
    )
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   370
!
1561
942de18a3e3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1560
diff changeset
   371
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   372
applicationTextTypeList
1606
158c10a36736 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1604
diff changeset
   373
    "text applications"
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   374
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   375
    ^ #(
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   376
        ('ps' 'eps')                 'application/postscript'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   377
        "/ 'ai'                         'application/postscript'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   378
        'pdf'                        'application/pdf'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   379
        'rtf'                        'application/rtf'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   380
        "/ 'rtf'                        'text/rtf'            ????
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   381
        "/ 'doc'                        'application/winword'
1779
c0bd3dcd9ee4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
   382
        'doc'                        'application/ms-word-document'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   383
        'swf'                        'application/x-shockwave-flash'
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   384
        ('ppt' 'ppz' 'pot' 'pps')    'application/mspowerpoint'
2028
5d67d14ad4a0 slk type added
Michael Beyl <mb@exept.de>
parents: 2024
diff changeset
   385
        'xls'                        'application/x-excel'   
5d67d14ad4a0 slk type added
Michael Beyl <mb@exept.de>
parents: 2024
diff changeset
   386
        'slk'                        'application/vnd.ms-excel'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   387
    )
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   388
!
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   389
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   390
applicationTypeList
1606
158c10a36736 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1604
diff changeset
   391
    "applications"
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   392
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   393
    |typeList|                            
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   394
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   395
    typeList := OrderedCollection new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   396
    typeList addAll:self applicationProgLangTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   397
    typeList addAll:self applicationTextTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   398
    typeList addAll:self applicationCompressorsAndArchiveTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   399
    typeList addAll:self applicationMiscTypeList.
1616
f07466809515 add binary file extensions
penk
parents: 1612
diff changeset
   400
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   401
    ^ typeList
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   402
!
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   403
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   404
audioTypeList
1606
158c10a36736 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1604
diff changeset
   405
    "audio formats ..."
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   406
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   407
    ^ #(
1720
cca50de2e8e4 change x-png to png
penk
parents: 1716
diff changeset
   408
        ('au' 'snd')            'audio/basic'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   409
        ('ra')                  'audio/x-realaudio'
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   410
        ('ram' 'rm')            'audio/x-pn-realaudio'
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   411
"/ cg: see unixSpecific / windowsSpecific
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   412
"/        'rpm'                   'audio/x-pn-realaudio-plugin'
1720
cca50de2e8e4 change x-png to png
penk
parents: 1716
diff changeset
   413
        ('mpa' 'mpega')         'audio/mpeg'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   414
        "/ 'mp3'                   'audio/x-mp3'
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   415
        ('mp3' 'mp2')           'audio/mpeg'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   416
        'wav'                   'audio/x-wav'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   417
        ('aif' 'aiff' 'aifc')   'audio/x-aiff'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   418
        ('midi' 'mid')          'audio/midi'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   419
    )
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   420
!
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   421
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   422
imageTypeList
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   423
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   424
    ^ #(
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   425
        "/ image formats ...
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   426
1216
26fe79e724d0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   427
        ('jpg' 'jpeg')  'image/jpeg'
1188
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   428
        'gif'           'image/gif'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   429
        ('tif' 'tiff')  'image/tiff'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   430
        'xbm'           'image/x-xbitmap'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   431
        'xpm'           'image/x-xpixmap'
1720
cca50de2e8e4 change x-png to png
penk
parents: 1716
diff changeset
   432
        'png'           'image/png'
1188
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   433
        'pcd'           'image/x-photo-cd'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   434
        'bmp'           'image/x-MS-bmp'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   435
        'rgb'           'image/x-rgb'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   436
        'ppm'           'image/x-portable-pixmap'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   437
        'pgm'           'image/x-portable-graymap'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   438
        'pbm'           'image/x-portable-bitmap'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   439
        'pnm'           'image/x-portable-anymap'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   440
        'xwd'           'image/x-xwindowdump'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   441
        'ras'           'image/x-cmu-raster'
1216
26fe79e724d0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   442
        'tga'           'image/x-targa'
2020
d5c5d7928433 add 'image/x-ico' for *.ico files
penk
parents: 1981
diff changeset
   443
        'ico'           'image/x-ico'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   444
    ) 
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   445
!
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   446
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   447
miscFilenameList
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   448
    "other formats (not by suffix, but by fileName isnstead) ..."
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   449
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   450
    ^ #(
2113
65cbfeee886d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   451
        ('makefile' 'make.proto' 'make.spec' 'nt.mak')  'application/x-make'
65cbfeee886d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   452
        ('exe' 'bin')                                   'application/octet-stream'
65cbfeee886d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   453
        ('class')                                       'application/octet-stream'
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   454
    )
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   455
!
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   456
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   457
osSpecificTypeList
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   458
    OperatingSystem isMSWINDOWSlike ifTrue:[
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   459
        ^ self windowsSpecificTypeList
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   460
    ].
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   461
    ^ self unixSpecificTypeList
2023
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   462
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   463
"
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   464
    self osSpecificTypeList
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   465
"
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   466
!
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   467
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   468
textTypeList
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   469
   "/ misc text ...
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   470
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   471
    ^ #(
1887
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   472
        ('html' 'htm' 'shtml')  'text/html'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   473
        ('txt' 'text')          'text/plain'
1680
d34932ed0e86 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1668
diff changeset
   474
        'xml'                   'text/xml'
1777
5879ec563fc1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1775
diff changeset
   475
        'css'                   'text/css'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   476
    )
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   477
!
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   478
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   479
unixSpecificTypeList
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   480
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   481
    ^ #(
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   482
"/ cg: RPM is 'audio/x-pn-realaudio-plugin' for WIN32
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   483
"/     and 'application/x-rpm' for Unix
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   484
        'rpm'                   'application/x-rpm'
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   485
    )
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   486
!
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   487
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   488
videoTypeList
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   489
    "/ video formats ...
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   490
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   491
    ^ #(
1720
cca50de2e8e4 change x-png to png
penk
parents: 1716
diff changeset
   492
        ('qt' 'mov' 'moov')                'video/quicktime'
cca50de2e8e4 change x-png to png
penk
parents: 1716
diff changeset
   493
        ('mpv' 'mpegv' 'mpg' 'mpeg' 'mpe') 'video/mpeg'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   494
        'movie'                            'video/x-sgi-movie'
1820
7817c4809af7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1819
diff changeset
   495
        ('avi' 'wmv' 'asf')                'video/x-msvideo'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   496
        ('mpv2' 'mp2v' 'mp2' 'mpeg2')      'video/x-mpeg2'
1680
d34932ed0e86 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1668
diff changeset
   497
        'rm'                               'application/vnd.rn-realmedia'
d34932ed0e86 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1668
diff changeset
   498
        'rv'                               'video/x-pn-realvideo'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   499
   )
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   500
!
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   501
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   502
windowsSpecificTypeList
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   503
    ^ #(
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   504
"/ cg: RPM is 'audio/x-pn-realaudio-plugin' for WIN32
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   505
"/     and 'application/x-rpm' for Unix
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   506
        'rpm'                   'audio/x-pn-realaudio-plugin'
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   507
    )
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
! !
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   510
!MIMETypes class methodsFor:'obsolete'!
1489
9e339e123bfa commentStrings: added ifUnknown-argument
tm
parents: 1475
diff changeset
   511
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   512
fontForCharset:aCharSetName
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   513
    "return the font-encoding for an iso-charset"
1489
9e339e123bfa commentStrings: added ifUnknown-argument
tm
parents: 1475
diff changeset
   514
1981
52b15b1e90b6 Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 1979
diff changeset
   515
    <resource:#obsolete>
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   516
    self obsoleteMethodWarning:'use FontDescription >> fontNamePatternForCharset:'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   517
    ^ FontDescription fontNamePatternForCharset:aCharSetName.
1489
9e339e123bfa commentStrings: added ifUnknown-argument
tm
parents: 1475
diff changeset
   518
9e339e123bfa commentStrings: added ifUnknown-argument
tm
parents: 1475
diff changeset
   519
    "
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   520
     MIMETypes fontForCharset:'iso2022-jp'       
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   521
     MIMETypes fontForCharset:'euc-jp'     
1472
bef5798d367d comment strings
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   522
    "
bef5798d367d comment strings
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   523
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   524
    "Modified: / 1.8.1998 / 17:00:57 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   525
! !
1472
bef5798d367d comment strings
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   526
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   527
!MIMETypes class methodsFor:'queries'!
1472
bef5798d367d comment strings
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   528
647
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   529
defineImageType:mimeType suffix:aSuffix reader:aReaderClass
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   530
    "register an image reader."
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   531
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   532
    aSuffix notNil ifTrue:[
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   533
        self imageReaderForSuffix:aSuffix put:aReaderClass.
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   534
    ].
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   535
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   536
    mimeType notNil ifTrue:[
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   537
        self imageReaderForType:mimeType put:aReaderClass
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   538
    ].
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   539
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   540
    (aSuffix notNil and:[mimeType notNil]) ifTrue:[
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   541
        self mimeTypeForSuffix:aSuffix put:mimeType
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   542
    ].
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   543
!
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   544
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
fileSuffixToImageReaderMapping
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   546
    "return the suffix-to-imageReader mapping"
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   547
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
    ^ FileSuffixToImageReaderClassMapping ? #()
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   550
    "Modified: / 1.8.1998 / 17:00:11 / cg"
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
imageFileSuffixes
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   554
    "return a collection with known file suffixes"
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   555
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
    FileSuffixToImageReaderClassMapping isNil ifTrue:[^ #()].
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
    ^ FileSuffixToImageReaderClassMapping keys
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   559
    "Created: / 30.6.1997 / 22:04:48 / cg"
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   560
    "Modified: / 1.8.1998 / 17:01:26 / cg"
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   561
!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
1473
876caa979b7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
   563
mimeTypeForFilename:filenameArg
1272
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   564
    "given a filename, return the mime-type or nil, if unknown"
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   565
1780
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   566
    |type filename lcFilename suff suff2|
1272
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   567
1473
876caa979b7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
   568
    filename := filenameArg asFilename.
1474
bd86cf0c1a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1473
diff changeset
   569
bd86cf0c1a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1473
diff changeset
   570
    lcFilename := filename baseName asLowercase.
1272
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   571
    type := FilenameToTypeMapping at:lcFilename ifAbsent:nil.
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   572
    type isNil ifTrue:[
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   573
        "/ allow for fallback ...
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   574
        type := OperatingSystem mimeTypeForFilename:lcFilename.
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   575
        "/ the special value #unknown is returned as nil;
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   576
        "/ this avoids constant retry if a mimeType is not known in
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   577
        "/ the OS.
1275
cf421c7dfeec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
   578
"/        type isNil ifTrue:[
cf421c7dfeec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
   579
"/            FilenameToTypeMapping at:lcFilename put:#unknown
cf421c7dfeec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
   580
"/        ].
1272
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   581
    ].
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   582
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   583
    type == #unknown ifTrue:[
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   584
        type := nil.
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   585
    ].
1273
7a52d4bcdb10 filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
   586
7a52d4bcdb10 filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
   587
    type isNil ifTrue:[
1473
876caa979b7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
   588
        suff := filename suffix.
1273
7a52d4bcdb10 filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
   589
        suff size ~~ 0 ifTrue:[
1780
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   590
            "/ sigh - special code for multiple-suffices...
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   591
            "/ .tar.gz -> tgz
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   592
            suff2 := filename withoutSuffix suffix.
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   593
            suff2 size > 0 ifTrue:[
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   594
                type := self mimeTypeForSuffix:(suff2 , '.' , suff).
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   595
            ].
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   596
            type isNil ifTrue:[
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   597
                type := self mimeTypeForSuffix:suff
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   598
            ].
1273
7a52d4bcdb10 filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
   599
        ]
7a52d4bcdb10 filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
   600
    ].
7a52d4bcdb10 filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
   601
1272
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   602
    ^ type
1780
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   603
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   604
    "
1841
b7ff9829e4b3 return value should be undefined if type isNil
penk
parents: 1840
diff changeset
   605
     self mimeTypeForFilename:'typeinst.dvi'      
1780
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   606
     self mimeTypeForFilename:'foo.tar'
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   607
     self mimeTypeForFilename:'foo.tgz'
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   608
     self mimeTypeForFilename:'foo.tar.gz'
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   609
    "
1272
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   610
!
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   611
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   612
mimeTypeForFilename:filename put:mimeType
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   613
    "register a mime type for a filename"
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   614
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   615
    FilenameToTypeMapping isNil ifTrue:[
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   616
        FilenameToTypeMapping := Dictionary new
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   617
    ].
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   618
    FilenameToTypeMapping at:filename put:(MIMEType fromString:mimeType asLowercase)
1611
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   619
!
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   620
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
mimeTypeForSuffix:suffix
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   622
    "given a file suffix, return the mime-type"
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   623
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   624
    |type lcSuffix|
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   625
1837
penk
parents: 1820
diff changeset
   626
    suffix = LastSuffix ifTrue:[
penk
parents: 1820
diff changeset
   627
        ^ LastType
penk
parents: 1820
diff changeset
   628
    ].
penk
parents: 1820
diff changeset
   629
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   630
    lcSuffix := suffix asLowercase.
1837
penk
parents: 1820
diff changeset
   631
    type := FileSuffixToTypeMapping at:lcSuffix ifAbsent:nil.
penk
parents: 1820
diff changeset
   632
    type isNil ifTrue:[
penk
parents: 1820
diff changeset
   633
        "/ allow for fallback ...
penk
parents: 1820
diff changeset
   634
        type := OperatingSystem mimeTypeForSuffix:lcSuffix.
penk
parents: 1820
diff changeset
   635
        "/ the special value #unknown is returned as nil;
penk
parents: 1820
diff changeset
   636
        "/ this avoids constant retry if a mimeType is not known in the OS.
penk
parents: 1820
diff changeset
   637
penk
parents: 1820
diff changeset
   638
        type := type ? #unknown.
penk
parents: 1820
diff changeset
   639
        FileSuffixToTypeMapping at:lcSuffix put:type.
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   640
    ].
1837
penk
parents: 1820
diff changeset
   641
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   642
    type == #unknown ifTrue:[
1837
penk
parents: 1820
diff changeset
   643
        type := nil.
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   644
    ].
1840
19123ded64e3 mime Types have to MIMEType instance
penk
parents: 1837
diff changeset
   645
    type notNil ifTrue:[
19123ded64e3 mime Types have to MIMEType instance
penk
parents: 1837
diff changeset
   646
        LastSuffix := suffix.
19123ded64e3 mime Types have to MIMEType instance
penk
parents: 1837
diff changeset
   647
        LastType := MIMEType fromString:type.
19123ded64e3 mime Types have to MIMEType instance
penk
parents: 1837
diff changeset
   648
        ^ LastType
19123ded64e3 mime Types have to MIMEType instance
penk
parents: 1837
diff changeset
   649
    ].
1841
b7ff9829e4b3 return value should be undefined if type isNil
penk
parents: 1840
diff changeset
   650
    ^ type
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
1666
2fe4fb7be12c added xml type
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
   652
    "
1840
19123ded64e3 mime Types have to MIMEType instance
penk
parents: 1837
diff changeset
   653
     self mimeTypeForSuffix:'gif'     
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   654
     self mimeTypeForSuffix:'rpm'     
1666
2fe4fb7be12c added xml type
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
   655
    "
2fe4fb7be12c added xml type
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
   656
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   657
    "Created: / 30.6.1997 / 21:55:51 / cg"
1300
09ff1f28470c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   658
    "Modified: / 23.12.1999 / 22:30:55 / cg"
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   660
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
mimeTypeForSuffix:suffix put:mimeType
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   662
    "register a mime type for a file suffix"
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   663
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
    FileSuffixToTypeMapping isNil ifTrue:[
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
        FileSuffixToTypeMapping := Dictionary new
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
    ].
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
    FileSuffixToTypeMapping at:suffix put:mimeType asLowercase
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   669
    "Created: / 30.6.1997 / 21:56:20 / cg"
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   670
    "Modified: / 1.8.1998 / 17:03:18 / cg"
1593
4bf2544435a9 add class getter method for FileSuffixToTypemapping
penk
parents: 1561
diff changeset
   671
!
4bf2544435a9 add class getter method for FileSuffixToTypemapping
penk
parents: 1561
diff changeset
   672
4bf2544435a9 add class getter method for FileSuffixToTypemapping
penk
parents: 1561
diff changeset
   673
mimeTypeForSuffixMapping
4bf2544435a9 add class getter method for FileSuffixToTypemapping
penk
parents: 1561
diff changeset
   674
4bf2544435a9 add class getter method for FileSuffixToTypemapping
penk
parents: 1561
diff changeset
   675
    ^ FileSuffixToTypeMapping
1611
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   676
!
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   677
2023
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   678
mimeTypeFromString:mimeTypeString
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   679
    "given a mime-type for a string"
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   680
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   681
     ^ MIMEType fromString:mimeTypeString
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   682
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   683
    "
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   684
     self mimeTypeFromString:'image/gif' 
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   685
    "
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   686
!
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   687
1611
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   688
mimeTypeOfContents:filename
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   689
    "given a filename, scan the contents, return the mime-type or nil, if unknown"
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   690
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   691
    |typeString|
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   692
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   693
    typeString := filename mimeTypeOfContents.
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   694
    typeString isNil ifTrue:[^ nil].
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   695
    ^ MIMEType fromString:typeString.
1887
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   696
!
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   697
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   698
suffixForMimeType:mimeType
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   699
    "given a file suffix, return the mime-type"
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   700
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   701
    ^ TypeToFileSuffixMapping at:mimeType ifAbsent:nil
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   702
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   703
    "
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   704
     self suffixForMimeType:(MIMEType fromString:'image/gif')     
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   705
    "
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   706
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   707
    "Created: / 30.6.1997 / 21:55:51 / cg"
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   708
    "Modified: / 23.12.1999 / 22:30:55 / cg"
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   709
!
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   710
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   711
suffixForMimeTypeString:mimeTypeString
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   712
    "given a file suffix, return the mime-type"
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   713
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   714
     ^ self suffixForMimeType:(MIMEType fromString:mimeTypeString) 
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   715
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   716
    "
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   717
     self suffixForMimeTypeString:'image/gif' 
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   718
    "
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   719
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   720
    "Created: / 30.6.1997 / 21:55:51 / cg"
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   721
    "Modified: / 23.12.1999 / 22:30:55 / cg"
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   722
! !
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   723
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   724
!MIMETypes class methodsFor:'queries-applications'!
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   725
2117
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   726
defaultCommandForMimeType:mimeType
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   727
    self obsoleteMethodWarning:'use #defaultCommandTemplateToOpenMimeType:'.
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   728
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   729
    ^ self defaultCommandTemplateToOpenMimeType:mimeType
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   730
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   731
    "
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   732
     MIMETypes defaultCommandForMimeType:'application/pdf'
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   733
    "
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   734
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   735
    "Created: / 12-05-2004 / 11:09:22 / cg"
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   736
    "Modified: / 12-05-2004 / 11:16:53 / cg"
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   737
!
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   738
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   739
defaultCommandPerMIME
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   740
    "returns the collection which is used to map MIME-type to command-templates."
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   741
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   742
    "TODO: move this to OS/UserPreferences"
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   743
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   744
    DefaultCommandPerMIMEPerOS isNil ifTrue:[
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   745
        self initializeDefaultCommands
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   746
    ].
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   747
    OperatingSystem isUNIXlike ifTrue:[
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   748
        ^ DefaultCommandPerMIMEPerOS at:#unix
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   749
    ].
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   750
    ^ DefaultCommandPerMIMEPerOS at:#win32
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   751
!
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   752
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   753
defaultCommandTemplateToOpenMimeType:mimeType
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   754
    |cmd|
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   755
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   756
    cmd := self defaultCommandPerMIME at:mimeType ifAbsent:nil.
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   757
    cmd isNil ifTrue:[
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   758
        OperatingSystem isMSWINDOWSlike ifTrue:[
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   759
            cmd := Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:mimeType
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   760
        ].
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   761
    ].
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   762
    ^ cmd
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   763
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   764
    "
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   765
     MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'
2118
b41112f6c76e commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 2117
diff changeset
   766
     MIMETypes defaultCommandTemplateToOpenMimeType:'text/html'
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   767
    "
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   768
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   769
    "Created: / 12-05-2004 / 11:09:22 / cg"
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   770
    "Modified: / 12-05-2004 / 11:16:53 / cg"
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   771
!
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   772
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   773
defaultCommandTemplateToPrintMimeType:mimeType
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   774
    |cmd|
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   775
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   776
    cmd := self defaultPrintCommandPerMIME at:mimeType ifAbsent:nil.
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   777
    cmd isNil ifTrue:[
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   778
        OperatingSystem isMSWINDOWSlike ifTrue:[
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   779
            cmd := Win32OperatingSystem::RegistryEntry commandTemplateToPrintMimeType:mimeType
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   780
        ].
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   781
    ].
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   782
    ^ cmd
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   783
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   784
    "
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   785
     MIMETypes defaultCommandTemplateToPrintMimeType:'application/pdf'
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   786
    "
2117
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   787
!
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   788
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   789
defaultPrintCommandPerMIME
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   790
    "returns the collection which is used to map MIME-type to printing command-templates."
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   791
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   792
    "TODO: move this to OS/UserPreferences"
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   793
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   794
    DefaultPrintCommandPerMIMEPerOS isNil ifTrue:[
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   795
        self initializeDefaultCommands
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   796
    ].
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   797
    OperatingSystem isUNIXlike ifTrue:[
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   798
        ^ DefaultPrintCommandPerMIMEPerOS at:#unix
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   799
    ].
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   800
    ^ DefaultPrintCommandPerMIMEPerOS at:#win32
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   801
! !
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   802
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   803
!MIMETypes class methodsFor:'queries-image formats'!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   804
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   805
imageReaderClasses
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   806
    "return a collection of registered image reader classes"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   807
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   808
    |setOfClasses|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   809
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   810
    setOfClasses := IdentitySet new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   811
    FileSuffixToImageReaderClassMapping notNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   812
        FileSuffixToImageReaderClassMapping keysAndValuesDo:[:suff :cls |
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   813
            setOfClasses add:cls
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   814
        ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   815
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   816
    TypeToImageReaderClassMapping notNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   817
        TypeToImageReaderClassMapping keysAndValuesDo:[:suff :cls |
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   818
            setOfClasses add:cls
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   819
        ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   820
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   821
    ^ setOfClasses
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   822
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   823
    "Created: / 30.6.1997 / 22:03:42 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   824
    "Modified: / 1.8.1998 / 16:59:52 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   825
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   826
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   827
imageReaderForSuffix:aSuffix
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   828
    "given a file suffix, return an approriate image reader class"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   829
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   830
    FileSuffixToImageReaderClassMapping isNil ifTrue:[^ nil].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   831
    ^ FileSuffixToImageReaderClassMapping at:aSuffix asLowercase ifAbsent:nil
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   832
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   833
    "Created: / 30.6.1997 / 21:59:11 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   834
    "Modified: / 1.8.1998 / 17:01:58 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   835
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   836
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   837
imageReaderForSuffix:aSuffix put:aReaderClass
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   838
    "register an image reader for a file suffix"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   839
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   840
    FileSuffixToImageReaderClassMapping isNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   841
        FileSuffixToImageReaderClassMapping := Dictionary new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   842
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   843
    FileSuffixToImageReaderClassMapping at:aSuffix asLowercase put:aReaderClass
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   844
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   845
    "Created: / 30.6.1997 / 21:59:43 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   846
    "Modified: / 1.8.1998 / 17:02:14 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   847
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   848
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   849
imageReaderForType:mimeTypeString
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   850
    "given a mime-type, return an approriate image reader class"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   851
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   852
    TypeToImageReaderClassMapping isNil ifTrue:[^ nil].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   853
    ^ TypeToImageReaderClassMapping at:mimeTypeString asLowercase ifAbsent:nil
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   854
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   855
    "Created: / 30.6.1997 / 21:56:01 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   856
    "Modified: / 1.8.1998 / 17:02:28 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   857
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   858
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   859
imageReaderForType:mimeTypeString put:aReaderClass
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   860
    "register an image reader for a mime-type"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   861
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   862
    TypeToImageReaderClassMapping isNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   863
        TypeToImageReaderClassMapping := Dictionary new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   864
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   865
    TypeToImageReaderClassMapping at:mimeTypeString asLowercase put:aReaderClass
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   866
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   867
    "Created: / 30.6.1997 / 21:56:11 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   868
    "Modified: / 1.8.1998 / 17:02:40 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   869
! !
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   870
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   871
!MIMETypes class methodsFor:'queries-language syntax'!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   872
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   873
commentStringsForFilename:aFilename
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   874
    "return a useful comment definition; heuristics for now.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   875
     The returned value is an array of 2 elements;
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   876
     the first is the end-of-line comment string (or nil);
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   877
     the second an array of opening/closing delimiters (or an array of nils)"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   878
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   879
     |mime|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   880
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   881
     mime := MIMETypes mimeTypeForFilename:aFilename.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   882
     ^ self commentStringsForMimeType:mime suffix:(aFilename asFilename suffix)
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   883
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   884
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   885
     MIMETypes commentStringsForFilename:'Makefile'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   886
     MIMETypes commentStringsForFilename:'Object.st'. 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   887
     MIMETypes commentStringsForFilename:'Foo.java'. 
1925
9f5e4568529f comment
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   888
     MIMETypes commentStringsForFilename:'Foo.html'. 
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   889
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   890
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   891
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   892
commentStringsForFilename:aFilename ifUnknown:alternativeBlockReturningCommentString
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   893
    "return a useful comment definition; heuristics for now.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   894
     The returned value is an array of 2 elements;
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   895
     the first is the end-of-line comment string (or nil);
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   896
     the second an array of opening/closing delimiters (or an array of nils)"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   897
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   898
     |mime|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   899
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   900
     mime := MIMETypes mimeTypeForFilename:aFilename.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   901
     ^ self commentStringsForMimeType:mime suffix:(aFilename asFilename suffix) ifUnknown:alternativeBlockReturningCommentString
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   902
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   903
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   904
     MIMETypes commentStringsForFilename:'Makefile'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   905
     MIMETypes commentStringsForFilename:'Object.st'. 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   906
     MIMETypes commentStringsForFilename:'Foo.java'. 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   907
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   908
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   909
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   910
commentStringsForMimeType:mime suffix:suff
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   911
    "return a useful comment definition; heuristics for now.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   912
     The returned value is an array of 2 elements;
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   913
     the first is the end-of-line comment string (or nil);
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   914
     the second an array of opening/closing delimiters (or an array of nils)"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   915
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   916
    ^ self
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   917
        commentStringsForMimeType:mime suffix:suff 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   918
        ifUnknown: #(';' (nil nil))  
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   919
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   920
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   921
     |mime|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   922
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   923
     mime := MIMETypes mimeTypeForFilename:'Makefile'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   924
     MIMETypes commentStringsForMimeType:mime suffix:nil.     
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   925
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   926
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   927
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   928
     |mime|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   929
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   930
     mime := MIMETypes mimeTypeForFilename:'Object.st'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   931
     MIMETypes commentStringsForMimeType:mime suffix:nil.    
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   932
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   933
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   934
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   935
commentStringsForMimeType:mime suffix:suff ifUnknown:alternativeBlockReturningCommentString
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   936
    "return a useful comment definition; heuristics for now.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   937
     The returned value is an array of 2 elements;
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   938
     the first is the end-of-line comment string (or nil);
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   939
     the second an array of opening/closing delimiters (or an array of nils)"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   940
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   941
    |commentSpec|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   942
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   943
    commentSpec := TypeToCommentStringMapping at:mime ifAbsent:nil.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   944
    commentSpec notNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   945
        ^ commentSpec
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   946
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   947
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   948
    commentSpec := SuffixToCommentStringMapping at:suff ifAbsent:nil.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   949
    commentSpec notNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   950
        ^ commentSpec
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   951
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   952
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   953
    ^ alternativeBlockReturningCommentString value
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   954
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   955
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   956
     |mime|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   957
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   958
     mime := MIMETypes mimeTypeForFilename:'Makefile'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   959
     MIMETypes commentStringsForMimeType:mime suffix:nil.     
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   960
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   961
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   962
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   963
     |mime|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   964
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   965
     mime := MIMETypes mimeTypeForFilename:'Object.st'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   966
     MIMETypes commentStringsForMimeType:mime suffix:nil.    
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   967
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   968
! !
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   969
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   970
!MIMETypes::MIMEType class methodsFor:'documentation'!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   971
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   972
documentation
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   973
"
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
   974
    like a string, but knows that it represents a mimeType.
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   975
"
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   976
! !
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   977
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   978
!MIMETypes::MIMEType class methodsFor:'initialization'!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   979
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   980
initialize
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   981
    CachedTypes := CacheDictionary new:30.
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   982
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   983
    "
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   984
     self initialize
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   985
    "
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   986
! !
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   987
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   988
!MIMETypes::MIMEType class methodsFor:'instance creation'!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   989
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   990
fromString:aString
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   991
    |cachedType newType|
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   992
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   993
    aString class == self ifTrue:[^ aString].
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   994
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   995
    cachedType := CachedTypes at:aString ifAbsent:nil.
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   996
    cachedType notNil ifTrue:[^ cachedType].
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   997
    newType := aString copy changeClassTo:self.
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   998
    CachedTypes at:aString put:newType.
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   999
    ^ newType
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1000
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1001
    "
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1002
     self fromString:'text/html'
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1003
    "
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1004
! !
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1005
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1006
!MIMETypes::MIMEType methodsFor:'queries'!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1007
1693
4055b361abe9 isArchiv -> isArchive
Claus Gittinger <cg@exept.de>
parents: 1691
diff changeset
  1008
isArchive
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1009
    "return true, if I represent an archive type (such as zip or tar)"
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1010
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1011
    |archivTypes|
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1012
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1013
    archivTypes := MIMETypes applicationCompressorsAndArchiveTypeList.
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1014
    archivTypes pairWiseDo:[: ext : type |
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1015
        self = type ifTrue:[ ^ true].
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1016
    ].
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1017
    ^ false
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1018
!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1019
2024
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1020
isBinary
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1021
    "return true, if I represent a binary (non-text) type"
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1022
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1023
    ^ self isTextType not
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1024
!
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1025
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1026
isHtml
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1027
    "return true, if I represent the html text type"
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1028
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1029
    ^ (self = 'text/html')
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1030
!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1031
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1032
isImage
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1033
    "return true, if I represent an image type (such as gif or jpg)"
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1034
1693
4055b361abe9 isArchiv -> isArchive
Claus Gittinger <cg@exept.de>
parents: 1691
diff changeset
  1035
    ^ (self startsWith:'image/')
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1036
!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1037
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1038
isPdf
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1039
    "return true, if I represent the pdf type"
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1040
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1041
    ^ (self = 'application/pdf')
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1042
!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1043
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1044
isSmalltalkSource
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1045
    "return true, if I represent the smalltalk sourcecode type"
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1046
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1047
    ^ (self = 'application/x-smalltalk-source')
1783
faf721f692ae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1048
!
faf721f692ae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1049
2024
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1050
isTextType
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1051
    "return true, if I represent some text type"
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1052
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1053
    ^ self startsWith:'text/'
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1054
!
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1055
1783
faf721f692ae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1056
isXml
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1057
    "return true, if I represent the xml text type"
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1058
1783
faf721f692ae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1059
    ^ (self = 'text/xml')
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1060
! !
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1061
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1062
!MIMETypes class methodsFor:'documentation'!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1063
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1064
version
2141
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
  1065
    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.86 2006-07-28 12:06:24 ca Exp $'
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1066
! !
1666
2fe4fb7be12c added xml type
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  1067
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1068
MIMETypes initialize!
1666
2fe4fb7be12c added xml type
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  1069
MIMETypes::MIMEType initialize!