--- a/FileApplicationNoteBook.st Thu Jun 21 14:54:43 2018 +0200
+++ b/FileApplicationNoteBook.st Thu Jun 21 15:21:57 2018 +0200
@@ -28,8 +28,8 @@
selectionHolder tableColumns commandProcess errorListHolder
viewErrorList temporaryDirectory enableRemoveErrorOutput
errorListVisibilityHolder hasListEntriesHolder archiver process
- terminateByMe columnDescriptors inDropMode'
- classVariableNames:''
+ terminateByMe columnDescriptors inDropMode selectionIndexHolder'
+ classVariableNames:'LastSearchedInName'
poolDictionaries:''
privateIn:FileApplicationNoteBook
!
@@ -1475,83 +1475,87 @@
<resource: #canvas>
^
- #(#FullSpec
- #name: #windowSpec
- #window:
- #(#WindowSpec
- #label: 'Archive Application'
- #name: 'Archive Application'
- #min: #(#Point 10 10)
- #bounds: #(#Rectangle 16 46 692 538)
- #menu: #mainMenu
- )
- #component:
- #(#SpecCollection
- #collection: #(
- #(#MenuPanelSpec
- #name: 'MenuArchive'
- #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0)
- #level: 0
- #menu: #menu
- #textDefault: true
- )
- #(#'FileBrowserV2UISpecifications::PanelSpec'
- #name: 'VerticalPanel'
- #layout: #(#LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0)
- #level: 0
- #whichView: #last
- #orientation: #vertical
- #visibility: #errorListVisibilityHolder
- #component:
- #(#SpecCollection
- #collection: #(
- #(#DataSetSpec
- #name: 'Table1'
- #model: #selectionHolder
- #menu: #fileListMenu
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: true
- #dataList: #archiveFileList
- #useIndex: false
- #has3Dsepartors: false
- #doubleClickSelector: #dblClick
- #columnHolder: #tableColumns
- #multipleSelectOk: true
- #verticalSpacing: 0
- #postBuildCallback: #postBuildFileTable:
- #properties:
- #(#PropertyListDictionary
- #enterSelector: #dropEnter:
- #dragArgument: #archivApplication
- #startDragSelector: #doStartDrag:in:
- #displayObjectSelector: #getDisplayObjects:
- #dropObjectSelector: #getDropObjects:
- #overSelector: nil
- #dropArgument: #archivApplication
- #canDropSelector: #canDrop:
- #leaveSelector: #dropLeave:
- #dropSelector: #doDrop:
- )
- )
- #(#SequenceViewSpec
- #name: 'ErrorList'
- #initiallyDisabled: true
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: true
- #backgroundColor: #(#Color 100.0 100.0 100.0)
- #isMultiSelect: true
- #useIndex: false
- #sequenceList: #errorListHolder
- )
+ #(FullSpec
+ name: windowSpec
+ uuid: '7d0661ea-7553-11e8-9d37-b8f6b1108e05'
+ window:
+ (WindowSpec
+ label: 'Archive Application'
+ name: 'Archive Application'
+ uuid: '7d066460-7553-11e8-9d37-b8f6b1108e05'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 676 492)
+ menu: mainMenu
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (MenuPanelSpec
+ name: 'MenuArchive'
+ layout: (LayoutFrame 0 0.0 0 0 0 1.0 32 0)
+ uuid: '7d066668-7553-11e8-9d37-b8f6b1108e05'
+ level: 0
+ menu: menu
+ textDefault: true
+ )
+ (#'FileBrowserV2UISpecifications::PanelSpec'
+ name: 'VerticalPanel'
+ layout: (LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0)
+ uuid: '7d06688e-7553-11e8-9d37-b8f6b1108e05'
+ level: 0
+ whichView: last
+ orientation: vertical
+ visibility: errorListVisibilityHolder
+ component:
+ (SpecCollection
+ collection: (
+ (DataSetSpec
+ name: 'Table1'
+ uuid: '7d066a8c-7553-11e8-9d37-b8f6b1108e05'
+ model: selectionIndexHolder
+ menu: fileListMenu
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ dataList: archiveFileList
+ doubleClickSelector: dblClick
+ columnHolder: tableColumns
+ multipleSelectOk: true
+ verticalSpacing: 0
+ postBuildCallback: postBuildFileTable:
+ properties:
+ (PropertyListDictionary
+ leaveSelector: dropLeave:
+ startDragSelector: doStartDrag:in:
+ overSelector: nil
+ dragArgument: archivApplication
+ dropSelector: doDrop:
+ canDropSelector: canDrop:
+ dropObjectSelector: getDropObjects:
+ enterSelector: dropEnter:
+ dropArgument: archivApplication
+ displayObjectSelector: getDisplayObjects:
+ )
)
-
- )
- #handles: #(#Any 0.5 1.0)
- )
+ (SequenceViewSpec
+ name: 'ErrorList'
+ uuid: '7d066e1a-7553-11e8-9d37-b8f6b1108e05'
+ initiallyDisabled: true
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ backgroundColor: (Color 100.0 100.0 100.0)
+ isMultiSelect: true
+ useIndex: false
+ sequenceList: errorListHolder
+ )
+ )
+
+ )
+ handles: (Any 0.5 1.0)
)
-
- )
- )
+ )
+
+ )
+ )
! !
!FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'menu specs'!
@@ -1580,6 +1584,12 @@
#translateLabel: true
)
#(#MenuItem
+ #enabled: #hasListEntriesHolder
+ #label: 'Find in Name...'
+ #itemValue: #findInName
+ #translateLabel: true
+ )
+ #(#MenuItem
#label: '-'
)
#(#MenuItem
@@ -1611,13 +1621,14 @@
)
#(#MenuItem
#label: '-'
+ "/ #isVisible: #closeButtonShown
)
#(#MenuItem
#enabled: #canViewFile
#label: 'Show Contents'
#itemValue: #viewFile
#translateLabel: true
- #isVisible: #closeButtonShown
+ "/ #isVisible: #closeButtonShown
)
)
nil
@@ -1625,6 +1636,7 @@
)
"Modified: / 12-01-2012 / 00:34:13 / cg"
+ "Modified: / 21-06-2018 / 14:58:39 / Claus Gittinger"
!
menu
@@ -1939,6 +1951,12 @@
^ false
!
+selection
+ ^ self selectionHolder value.
+
+ "Created: / 21-06-2018 / 15:04:24 / Claus Gittinger"
+!
+
temporaryDirectory
"return the value of the instance variable 'temporaryDirectory' (automatically generated)"
@@ -1963,9 +1981,11 @@
!
copyFilesToClipboard
+ "copy the names of the selected files to the clipboard"
+
|sel list stream|
- sel := self selectionHolder value.
+ sel := self selection.
list := self archiveFileList.
(sel notEmptyOrNil) ifTrue:[
stream := CharacterWriteStream new.
@@ -1977,6 +1997,7 @@
].
"Modified (format): / 29-11-2011 / 18:57:40 / cg"
+ "Modified (comment): / 21-06-2018 / 15:05:13 / Claus Gittinger"
!
dblClick
@@ -1997,6 +2018,37 @@
"Modified (format): / 29-11-2011 / 18:57:50 / cg"
!
+findInName
+
+ |selIndices pattern startIndex listOfFiles|
+
+ pattern := Dialog request:'Find in Name:'
+ initialAnswer:LastSearchedInName.
+ pattern isEmptyOrNil ifTrue:[
+ ^ self
+ ].
+ LastSearchedInName := pattern.
+
+ selIndices := self selectionIndexHolder value.
+ selIndices isEmpty ifTrue:[ selIndices := #(1) ].
+ startIndex := (selIndices min max:1) + 1.
+
+ listOfFiles := self archiveFileList value.
+
+ startIndex to:(listOfFiles size) do:[:idx |
+ |item|
+
+ item := listOfFiles at:idx.
+ (item fileName includesString:pattern caseSensitive:false) ifTrue:[
+ self selectionIndexHolder value:(Array with:idx).
+ ^ self
+ ].
+ ].
+ self device beep.
+
+ "Created: / 21-06-2018 / 15:00:31 / Claus Gittinger"
+!
+
removeErrorOutput
self viewErrorList value:false.
@@ -2012,15 +2064,17 @@
!
selectAll
-
- | sel listOfFiles|
-
- sel := OrderedCollection new.
+ |sel listOfFiles|
+
listOfFiles := self archiveFileList value.
- 1 to:(listOfFiles size) do:[ : el |
- sel add:el
- ].
- self selectionHolder value:sel.
+"/ sel := OrderedCollection new.
+"/ 1 to:(listOfFiles size) do:[:el |
+"/ sel add:el
+"/ ].
+"/ self selectionHolder value:sel.
+ self selectionIndexHolder value:(1 to:(listOfFiles size)).
+
+ "Modified: / 21-06-2018 / 15:07:08 / Claus Gittinger"
!
updateFileBrowserIfPresentWith:aDirectory
@@ -2039,8 +2093,8 @@
self canViewFile ifFalse:[^ self].
master := self masterApplication.
- self selectionHolder value size = 1 ifFalse:[
- Dialog warn:'only one file have to be selected'.
+ self selection size = 1 ifFalse:[
+ Dialog warn:'only one file has to be selected'.
^ self.
].
tempDir := self temporaryDirectory.
@@ -2055,6 +2109,8 @@
master notNil ifTrue:[
master openApplByFileItem:item.
].
+
+ "Modified: / 21-06-2018 / 15:07:23 / Claus Gittinger"
! !
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'aspects'!
@@ -2104,8 +2160,10 @@
hasSelectionInList
| sel |
- sel := self selectionHolder value.
+ sel := self selection.
^ sel notEmptyOrNil
+
+ "Modified: / 21-06-2018 / 15:05:54 / Claus Gittinger"
!
selectionHolder
@@ -2116,6 +2174,16 @@
^ selectionHolder.
!
+selectionIndexHolder
+ selectionIndexHolder isNil ifTrue:[
+ selectionIndexHolder := ValueHolder new.
+ selectionIndexHolder addDependent:self.
+ ].
+ ^ selectionIndexHolder.
+
+ "Created: / 21-06-2018 / 15:03:42 / Claus Gittinger"
+!
+
tableColumns
tableColumns isNil ifTrue:[
@@ -2137,11 +2205,19 @@
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'change & update'!
update:something with:aParameter from:changedObject
+ changedObject == selectionIndexHolder ifTrue:[
+ self selectionHolder value:(self selectionIndexHolder value
+ collect:[:idx | self archiveFileList at:idx ifAbsent:nil]).
+ ^ self
+ ].
+
changedObject == self archiveFileList ifTrue:[
self hasListEntriesHolder value:(changedObject notEmpty).
^ self
].
super update:something with:aParameter from:changedObject
+
+ "Modified: / 21-06-2018 / 15:15:17 / Claus Gittinger"
!
viewErrorListChanged
@@ -2416,7 +2492,7 @@
extractWithDirectoryPart := true.
extractAllFilesInSelectedDirectories := false.
- sel := self selectionHolder value.
+ sel := self selection.
(sel isEmptyOrNil) ifTrue:[
sel := self archiveFileList value.
].
@@ -2444,6 +2520,7 @@
^ true
"Modified (format): / 29-11-2011 / 18:57:54 / cg"
+ "Modified: / 21-06-2018 / 15:05:20 / Claus Gittinger"
!
extractWithDirectoryPartTo:aDirectory with:extractFiles
@@ -2509,7 +2586,7 @@
removeFilesFromArchive
|sel realSel list firtsPre stringCol stringRealSel|
- sel := self selectionHolder value.
+ sel := self selection.
stringCol := sel collect:[:item | item fileName].
firtsPre := stringCol at:1.
stringCol from:2 do:[:el | firtsPre := firtsPre commonPrefixWith:el].
@@ -2531,6 +2608,8 @@
makeProcessFor:[ self archiver removeFilesFromArchive:stringCol ]
with:'Remove files'.
self archiveFileList value removeAllFoundIn:realSel
+
+ "Modified: / 21-06-2018 / 15:05:58 / Claus Gittinger"
! !
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'drag & drop'!
@@ -2587,7 +2666,7 @@
| sel string size fnName stream|
- sel := self selectionHolder value.
+ sel := self selection.
size := sel size.
size == 0 ifTrue:[^ ''].
@@ -2605,6 +2684,7 @@
^ Array with:(LabelAndIcon icon:(Image fromFile:fnName) string:(string allBold))
"Modified: / 20-06-2017 / 08:18:07 / cg"
+ "Modified: / 21-06-2018 / 15:05:39 / Claus Gittinger"
!
getDropObjects:anArgument
@@ -2612,8 +2692,10 @@
|sel|
- sel := self selectionHolder value.
+ sel := self selection.
^ sel collect:[:el| DropObject newFileInArchive:(el fileName asFilename) ].
+
+ "Modified: / 21-06-2018 / 15:05:45 / Claus Gittinger"
! !
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'event handling'!
@@ -2622,7 +2704,7 @@
"filter keyboard events.
Return true, if I have eaten the event"
- <resource: #keyboard (#Delete )>
+ <resource: #keyboard (#Delete #Find)>
|focusView key rawKey|
@@ -2630,14 +2712,21 @@
focusView := anEvent targetView.
key := anEvent key.
rawKey := anEvent rawKey.
+
(focusView isSameOrComponentOf:self window) ifTrue:[
(key == #Delete) ifTrue:[
self removeFilesFromArchive.
^ true
+ ].
+ (key == #Find) ifTrue:[
+ self findInName.
+ ^ true
]
]
].
^ false
+
+ "Modified: / 21-06-2018 / 15:20:57 / Claus Gittinger"
! !
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'initialization & release'!
@@ -2686,6 +2775,14 @@
super release.
! !
+!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'menus'!
+
+fileListMenu
+ ^ [ self class fileListMenu ].
+
+ "Created: / 21-06-2018 / 15:01:53 / Claus Gittinger"
+! !
+
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'queries'!
canDelete
@@ -2710,8 +2807,10 @@
hasOneSelectionInList
| sel |
- sel := self selectionHolder value.
+ sel := self selection.
^ (sel notNil and:[sel notEmpty and:[sel size = 1]])
+
+ "Modified: / 21-06-2018 / 15:05:50 / Claus Gittinger"
!
selRemoveFilesForDirs:aSel