--- a/MCSettingsApp.st Fri Nov 25 17:46:35 2011 +0100
+++ b/MCSettingsApp.st Thu Dec 01 20:51:03 2011 +0100
@@ -1,22 +1,13 @@
"{ Package: 'stx:goodies/monticello' }"
AbstractSettingsApplication subclass:#MCSettingsApp
- instanceVariableNames:''
+ instanceVariableNames:'selectedRepositoryHolder'
classVariableNames:''
poolDictionaries:''
category:'Monticello-St/X UI'
!
-!MCSettingsApp class methodsFor:'* As yet uncategorized *'!
-
-managerTypeName
-
- ^ 'Monticello'
-
- "Created: / 21-07-2011 / 11:47:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
!MCSettingsApp class methodsFor:'help specs'!
flyByHelpSpec
@@ -36,19 +27,25 @@
the UIHelpTool may not be able to read the specification."
"
- UIHelpTool openOnClass:SVN::SettingsApp
+ UIHelpTool openOnClass:MCSettingsApp
"
<resource: #help>
^ super helpSpec addPairsFrom:#(
-#Package
-''
+#addRepository
+'Add another monticello repository to the list'
+
+#makePrimaryRepository
+'Checkin from the browser will go into this repository by default'
+
+#removeRepository
+'Remove the selected repository from the list'
)
- "Modified: / 26-05-2008 / 14:24:15 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 01-12-2011 / 20:29:04 / cg"
! !
!MCSettingsApp class methodsFor:'image specs'!
@@ -134,7 +131,7 @@
label: 'Monticello Settings'
name: 'Monticello Settings'
min: (Point 10 10)
- bounds: (Rectangle 0 0 695 627)
+ bounds: (Rectangle 0 0 647 627)
)
component:
(SpecCollection
@@ -196,6 +193,30 @@
)
useDefaultExtent: true
)
+ (ViewSpec
+ name: 'Box1'
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'Primary Repository: '
+ name: 'Label2'
+ layout: (LayoutFrame 7 0 0 0 150 0 22 0)
+ translateLabel: true
+ adjust: left
+ )
+ (LabelSpec
+ name: 'Label3'
+ layout: (LayoutFrame 150 0 0 0 0 1 22 0)
+ translateLabel: true
+ labelChannel: mcPrimaryRepository
+ adjust: left
+ )
+ )
+
+ )
+ extent: (Point 647 24)
+ )
(FramedBoxSpec
label: 'Repositories'
name: 'Repositories'
@@ -234,7 +255,7 @@
)
)
- extent: (Point 661 464)
+ extent: (Point 613 437)
)
(HorizontalPanelViewSpec
name: 'AddRemovePanel'
@@ -248,23 +269,39 @@
(ActionButtonSpec
label: 'Add Repository...'
name: 'AddConfigurationAction'
+ activeHelpKey: addRepository
translateLabel: true
model: addRepositoryAction
enableChannel: mcEnabled
- extent: (Point 329 25)
+ extent: (Point 151 25)
)
(ActionButtonSpec
label: 'Remove Repository...'
name: 'RemoveConfigurationAction'
+ activeHelpKey: removeRepository
translateLabel: true
model: removeRepositoryAction
- enableChannel: mcEnabled
- extent: (Point 329 25)
+ enableChannel: mcEnabledAndRepositorySelectedHolder
+ extent: (Point 151 25)
+ )
+ (LabelSpec
+ name: 'Label1'
+ translateLabel: true
+ extent: (Point 151 22)
+ )
+ (ActionButtonSpec
+ label: 'Define as Primary'
+ name: 'Button1'
+ activeHelpKey: makePrimaryRepository
+ translateLabel: true
+ model: defineAsPrimaryRepositoryAction
+ enableChannel: mcEnabledAndRepositorySelectedHolder
+ extent: (Point 151 25)
)
)
)
- extent: (Point 661 30)
+ extent: (Point 613 30)
)
)
@@ -273,7 +310,7 @@
)
)
- extent: (Point 695 530)
+ extent: (Point 647 503)
)
)
@@ -285,6 +322,15 @@
)
! !
+!MCSettingsApp class methodsFor:'queries'!
+
+managerTypeName
+
+ ^ 'Monticello'
+
+ "Created: / 21-07-2011 / 11:47:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!MCSettingsApp methodsFor:'accessing'!
repositoryConfiguration
@@ -328,16 +374,23 @@
!MCSettingsApp methodsFor:'actions'!
addRepositoryAction
+ | dialog class codeHolder repo |
- | dialog class codeHolder repo |
class := Dialog
choose:'Select repository type'
- fromList:#('HTTP repository' 'Local repository')
- values:(Array with: MCHttpRepository with: MCDirectoryRepository)
+ fromList:#('HTTP Repository' 'FTP Repository' 'Local Repository')
+ values:(Array
+ with: MCHttpRepository
+ with: MCFtpRepository
+ with: MCDirectoryRepository)
lines:5 cancel:[^self].
codeHolder := ValueHolder new.
- dialog := Dialog forRequestText:'Please Fill in Data' lines:10 columns:60 initialAnswer: class creationTemplate model:codeHolder.
+ dialog := Dialog
+ forRequestText:'Please Fill in Data'
+ lines:10 columns:60
+ initialAnswer: class creationTemplate
+ model:codeHolder.
dialog open.
dialog accepted ifFalse:[^self].
repo := Compiler evaluate: codeHolder value.
@@ -347,7 +400,13 @@
"Created: / 26-05-2008 / 12:04:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 16-08-2009 / 17:24:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 16-09-2010 / 14:33:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 27-09-2011 / 11:49:42 / cg"
+ "Modified (format): / 01-12-2011 / 20:31:10 / cg"
+!
+
+defineAsPrimaryRepositoryAction
+ self mcPrimaryRepository value:(self selectedRepositoryHolder value)
+
+ "Created: / 01-12-2011 / 20:33:16 / cg"
!
flushCaches
@@ -366,75 +425,109 @@
!
removeRepositoryAction
- self repositoryConfiguration ifNotNil:
- [ self repositoryConfigurationList remove: self repositoryConfiguration ].
+ self repositoryConfiguration notNil ifTrue:[
+ self repositoryConfigurationList remove: self repositoryConfiguration.
+ self mcRepositories changed.
+ ].
"Created: / 26-05-2008 / 12:04:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 01-12-2011 / 20:50:08 / cg"
! !
!MCSettingsApp methodsFor:'aspects'!
mcEnabled
-
- ^self settingsAspectFor: #mcEnabled
+ ^self settingsAspectFor: #mcEnabled default:false
"Created: / 16-09-2010 / 14:14:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-12-2011 / 20:08:10 / cg"
+!
+
+mcEnabledAndRepositorySelectedHolder
+ ^ BlockValue
+ with:[:v | self mcEnabled value and:[ v notNil ]]
+ argument:(self selectedRepositoryHolder)
+
+ "Created: / 01-12-2011 / 19:58:57 / cg"
+!
+
+mcPrimaryRepository
+
+ ^self settingsAspectFor: #mcPrimaryRepository default:nil
+
+ "Created: / 16-09-2010 / 14:14:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 01-12-2011 / 20:06:36 / cg"
!
mcRepositories
- ^self settingsAspectFor: #mcRepositories
+ ^self settingsAspectFor: #mcRepositories default:nil
"Created: / 16-09-2010 / 14:14:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-12-2011 / 20:08:34 / cg"
!
selectedRepositoryHolder
-
- ^self settingsAspectFor: #selectedRepositoryHolder
+ selectedRepositoryHolder isNil ifTrue:[
+ selectedRepositoryHolder := nil asValue.
+ ].
+ ^ selectedRepositoryHolder
- "Created: / 16-09-2010 / 14:14:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Created: / 27-09-2011 / 11:55:01 / cg"
+ "Created: / 01-12-2011 / 20:19:36 / cg"
! !
!MCSettingsApp methodsFor:'helpers'!
-settingsAspectFor: settingName
-
+settingsAspectFor:settingName default:default
|holder|
self createBuilder.
- (holder := builder bindingAt:settingName) ifNil:
- [holder := (currentUserPrefs perform: settingName asSymbol)
- asValue.
- holder onChangeSend:#updateModifiedChannel to:self.
- builder aspectAt:settingName put:holder
+ (holder := builder bindingAt:settingName) isNil ifTrue:[
+ holder := (currentUserPrefs at:settingName asSymbol ifAbsent:default) asValue.
+ builder aspectAt:settingName put:holder.
+ holder onChangeSend:#updateModifiedChannel to:self.
].
^ holder.
"Created: / 25-05-2009 / 18:43:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Created: / 01-12-2011 / 20:07:59 / cg"
! !
!MCSettingsApp methodsFor:'protocol'!
basicReadSettings
+ "/ special case, because default value of false is not ok here !!
+ (currentUserPrefs includesKey:#mcRepositories) ifTrue:[
+ self
+ readAspects: #(mcRepositories)
+ from:currentUserPrefs.
+ ].
+ "/ special case, because default value of false is not ok here !!
+ (currentUserPrefs includesKey:#mcPrimaryRepository) ifTrue:[
+ self
+ readAspects: #(mcPrimaryRepository)
+ from:currentUserPrefs.
+ ].
self
- readAspects: #(mcEnabled mcRepositories)
+ readAspects: #(mcEnabled)
from:currentUserPrefs.
"Modified: / 16-09-2010 / 14:14:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-12-2011 / 20:26:23 / cg"
!
basicSaveSettings
self
- writeAspects: #(mcEnabled mcRepositories)
+ writeAspects: #(mcEnabled mcRepositories mcPrimaryRepository)
to:currentUserPrefs.
"Created: / 19-04-2008 / 09:42:59 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 25-05-2009 / 19:06:45 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 16-09-2010 / 14:35:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-12-2011 / 20:06:01 / cg"
!
helpFilename
@@ -451,24 +544,36 @@
!MCSettingsApp methodsFor:'queries'!
hasUnsavedChanges
+ "/ special case, because default value of false is not ok here !!
+ (currentUserPrefs includesKey:#mcRepositories) ifTrue:[
+ (self
+ hasChangedAspectIn: #(mcRepositories)
+ asComparedTo:currentUserPrefs) ifTrue:[^ true].
+ ].
+ "/ special case, because default value of false is not ok here !!
+ (currentUserPrefs includesKey:#mcPrimaryRepository) ifTrue:[
+ (self
+ hasChangedAspectIn: #(mcPrimaryRepository)
+ asComparedTo:currentUserPrefs) ifTrue:[^ true].
+ ].
^ self
- hasChangedAspectIn: #(mcEnabled mcRepositories)
+ hasChangedAspectIn: #(mcEnabled)
asComparedTo:currentUserPrefs
"Created: / 28-05-2008 / 07:33:26 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 19-08-2009 / 12:07:01 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 16-09-2010 / 14:17:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 25-11-2011 / 15:24:38 / cg"
+ "Modified: / 01-12-2011 / 20:27:34 / cg"
! !
!MCSettingsApp class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/goodies/monticello/MCSettingsApp.st,v 1.5 2011-11-25 14:47:38 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/goodies/monticello/MCSettingsApp.st,v 1.6 2011-12-01 19:51:03 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/goodies/monticello/MCSettingsApp.st,v 1.5 2011-11-25 14:47:38 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/goodies/monticello/MCSettingsApp.st,v 1.6 2011-12-01 19:51:03 cg Exp $'
!
version_SVN