home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / fdlg.zip / MSLO_S.CLS < prev    next >
Text File  |  1996-02-02  |  3KB  |  83 lines

  1. "  ---- Ronald Brill 1995, 1996 ---- "
  2. "  ---- Extended File Dialogs Version 2.1 ---- "
  3.  
  4.  
  5. MSOpenDialogController SecondaryFile !
  6.  
  7.  
  8. ! MSOpenDialogController methods!
  9.  
  10.  
  11. mFileSelected
  12.     vFileName put: vFileList getValue first.
  13.     self preview: nil.
  14. !"end mFileSelected"
  15.  
  16.  
  17. preview: aFile
  18. | file count text flag |
  19.     (cItemDict at: #vPreview) isNil
  20.     ifTrue:
  21.     [  ^ self.
  22.     ].
  23.     (cItemDict at: #vPreview) getValue
  24.     ifTrue:
  25.     [   self fileOK.
  26.         file := result deepCopy.
  27.         "  ---- result muß zurückgesetzt werden, damit der 'Cancel'-Button funktioniert ---- "
  28.         result := nil.
  29.         "  ---- das System hat nichts gemerkt, weiter gehts ---- "
  30.         file isString
  31.         ifTrue:
  32.         [   file := FileStream file: file onError: [ file := nil. ].
  33.         ].
  34.         (file isKindOf: Message)
  35.         | file isArray
  36.         | file isNil
  37.         ifTrue:
  38.         [   (cItemDict at: #vPreviewMLString) put: String new.
  39.             (cItemDict at: #vAttribChList) setSelectionTo: Array new.
  40.             #(writeEntry accessEntry creationEntry)
  41.             do:
  42.             [   :each |
  43.                (cItemDict at: each + 'Date') put: String new.
  44.                (cItemDict at: each + 'Time') put: String new.
  45.             ].
  46.             ^ self.
  47.         ].
  48.         count := 0.
  49.         text := String new.
  50.         [ file atEnd not & (count < 24) ]
  51.         whileTrue:
  52.         [   count := count + 1.
  53.             text := text + file nextString + CrLf.
  54.         ].
  55.         (cItemDict at: #vPreviewMLString) put: text.
  56.  
  57. "       ---- Dateiattribute ---- "
  58.         file := file fileName.
  59.         flag := File privateAttributesOf: file.
  60.  
  61.         flag := #(fattrReadonly fattrHidden fattrSystem fattrArchiv)
  62.                 select:
  63.                 [   :eachFlag |
  64.                     (flag bitAnd: (FileAccessConstants at: eachFlag)) == (FileAccessConstants at: eachFlag)
  65.                 ].
  66.         flag := flag collect: [ :each |  #(fattrReadonly fattrHidden fattrSystem fattrArchiv) indexOf: each ].
  67.         (cItemDict at: #vAttribChList) setSelectionTo: flag.
  68.  
  69.         #(modify access create)
  70.         with:
  71.         #(writeEntry accessEntry creationEntry)
  72.         do:
  73.         [   :eachFlag :eachEntry |
  74.             flag := File privateAccessTimeOf: file type: eachFlag.
  75.             (cItemDict at: eachEntry + 'Date') put: (flag at: 1) asDate asFullISOString.
  76.             (cItemDict at: eachEntry + 'Time') put: (flag at: 2) asTime asISOString.
  77.         ].
  78.     ].
  79. !"end preview:"
  80.  
  81.  
  82. !"End of methods block"
  83.