b26f7dcdf731 — Gerald Klix (speedy) 3 months ago
SUM: Fixed a bug concerning the selected item.

FIX: Rever to the 'subItemsWrappersSubModel' for all selection related commands.
1 files changed, 24 insertions(+), 15 deletions(-)

M haver/office/NuMach.pck.st
M haver/office/NuMach.pck.st +24 -15
@@ 1,14 1,14 @@ 
-'From Haver7.0 [latest update: #6454] on 26 June 2024 at 9:57:29 pm'!
+'From Haver7.0 [latest update: #6454] on 27 June 2024 at 4:11:24 pm'!
 'Description NuMach is a very simple to list.
 
 Hopefully it will serve as a base for something more elaborate.'!
-!provides: 'NuMach' 1 90!
+!provides: 'NuMach' 1 91!
 !requires: 'ActionBuilder' 1 35 nil!
 !requires: 'OfficeRoots' 1 68 nil!
 !requires: 'FacetsMorphs' 1 4 nil!
+!requires: 'PlanF' 1 25 nil!
 !requires: 'Tracing' 1 13 nil!
 !requires: 'SystemMorphs' 1 15 nil!
-!requires: 'PlanF' 1 25 nil!
 !requires: 'Cuis-Base' 60 5981 nil!
 !requires: 'IdGeneration' 1 1 nil!
 !requires: 'ActionButtons' 1 33 nil!

          
@@ 38,8 38,8 @@ Modules environment: #NuMach ::
 	import: #(#TranscriptTracer) from: #API of: Modules>>#Tracing :: 
 	import: #(#TargetButton #TargetToggleButton) from: #API of: Modules>>#ActionButtons :: 
 	import: #(#ActionBuilder) from: #API of: Modules>>#ActionBuilder :: 
+	import: #(#OfficeItemWrapper) from: #API of: Modules>>#OfficeRoots :: 
 	import: #(#DetailsMorph) from: #API of: Modules>>#FacetsMorphs :: 
-	import: #(#OfficeItemWrapper) from: #API of: Modules>>#OfficeRoots :: 
 	import: #(#Store) from: #API of: Modules>>#PlanF :: 
 	import: #API of: Modules>>#SystemMorphs :: 
 	import: #(#GermanDateAndTimeInputMorph) from: #API of: Modules>>#ValueEditors :: 

          
@@ 1963,7 1963,7 @@ todoItemsMenu
 
 	^ self menuBuilder buildUIElement! !
 
-!(Modules>>#NuMach>>#TodoItemListMorph) methodsFor: 'GUI building' stamp: 'KLG 4/12/2024 19:50:40'!
+!(Modules>>#NuMach>>#TodoItemListMorph) methodsFor: 'GUI building' stamp: 'KLG 6/27/2024 16:07:25'!
 buildActions
 	"Build all my actions."
 

          
@@ 1974,7 1974,9 @@ buildActions
 				isHorizontal: false;
 				heading: 'Actions'.
 			builder newActionGroup: #itemActions buildDoing: [ :itemActions |
-				itemActions title: 'Sub Items'.
+				itemActions
+					title: 'Sub Items';
+					model: self subItemsWrappersSubModel.
 				builder
 					newAction: #addItemToSelectedItem buildDoing: [ :addItemToSelectedItem |
 						addItemToSelectedItem

          
@@ 1989,8 1991,8 @@ buildActions
 							balloonText: 'Create a sub item of the type selected by menu of the selected or the browsed item'					];
 					newAction: #showConversionMenu buildDoing: [ :showConversionMenu |
 						showConversionMenu
+							text: 'Convert to ...';
 							target: self;
-							text: 'Convert to ...';
 							icon: #chatIcon;
 							balloonText: 'Convert this item to another type'					];
 					newAction: #removeSelectedItem buildDoing: [ :removeSelectedItem |

          
@@ 2051,17 2053,24 @@ buttonsBuilder
 
 	^ self menuBuilder buttonsBuilder! !
 
-!(Modules>>#NuMach>>#TodoItemListMorph) methodsFor: 'commands' stamp: 'KLG 6/16/2023 11:58:22'!
+!(Modules>>#NuMach>>#TodoItemListMorph) methodsFor: 'commands' stamp: 'KLG 6/27/2024 16:10:19'!
+removalConfirmed
+	"Answer the true if the user confirms the removal of the selected item."
+
+	^ self confirm: 
+		'Do you want to remove item: ''',
+		self subItemsWrappersSubModel selectedItem header,
+		'''?'! !
+
+!(Modules>>#NuMach>>#TodoItemListMorph) methodsFor: 'commands' stamp: 'KLG 6/27/2024 16:09:46'!
 removeSelectedItem
 	"Remove the selected item."
 	
-	self model selectedItem
-		ifNil: [ self flash ]
-		ifNotNil: [ :item |
-			item hasParent ifFalse: [ ^ self flash ].
-			self confirm: 'Do you want to remove item: ''', item header, '''?' :: ifFalse: [
-				^ self ].
-			item parent removeItem: item ]! !
+	self subItemsWrappersSubModel canRemoveSelection
+		ifFalse: [ self flash ]
+		ifTrue: [
+			self removalConfirmed ifTrue: [
+				self subItemsWrappersSubModel removeSelection ] ]! !
 
 !(Modules>>#NuMach>>#TodoItemListMorph) methodsFor: 'events' stamp: 'KLG 6/17/2023 13:55:11'!
 todoItemsKeystroke: aUnicodeCodePoint