LicenceBox.st
changeset 244 646c3da97dd0
parent 243 82637ad60d26
child 245 7b986d50e79d
equal deleted inserted replaced
243:82637ad60d26 244:646c3da97dd0
     5 	category:'Views-DialogBoxes'
     5 	category:'Views-DialogBoxes'
     6 !
     6 !
     7 
     7 
     8 !LicenceBox  class methodsFor:'documentation'!
     8 !LicenceBox  class methodsFor:'documentation'!
     9 
     9 
    10 alize!
    10 copyright
       
    11 "
       
    12  COPYRIGHT (c) 1996 by eXept Software AG
       
    13               All Rights Reserved
       
    14 
       
    15  This software is furnished under a license and may be used
       
    16  only in accordance with the terms of that license and with the
       
    17  inclusion of the above copyright notice.   This software may not
       
    18  be provided or otherwise made available to, or used by, any
       
    19  other person.  No title to or ownership of the software is
       
    20  hereby transferred.
       
    21 "
       
    22 !
    11 
    23 
    12 documentation
    24 documentation
    13 "
    25 "
    14     LicenceBox shows a licence text when opened, an returns true,
    26     LicenceBox shows a licence text when opened, an returns true,
    15     if the licence has been accepted, false otherwise.
    27     if the licence has been accepted, false otherwise.
       
    28 
       
    29     [author:]
       
    30 	Stefan Vogel
       
    31 
       
    32     [see also:]
       
    33 	AboutBox
    16 "
    34 "
    17 !
    35 !
    18 
    36 
    19 examples
    37 examples
    20 "
    38 "
    21                                                 [exBegin]
    39 						[exBegin]
    22     LicenceRejectSignal handle:[:ex|
    40     LicenceRejectSignal handle:[:ex|
    23         Transcript showCR:'Licence rejected'.
    41 	Transcript showCR:'Licence rejected'.
    24     ] do:[
    42     ] do:[
    25         LicenceBox open.
    43 	LicenceBox open.
    26         Transcript showCR:'Licence accepted'.
    44 	Transcript showCR:'Licence accepted'.
    27     ] 
    45     ] 
    28                                                 [exEnd]
    46 						[exEnd]
    29 "
    47 "
    30 !
       
    31 
       
    32 history
       
    33 
       
    34     "Created: 6.9.1996 / 13:29:15 / stefan"
       
    35     "Modified: 9.9.1996 / 14:53:11 / stefan"
       
    36 ! !
    48 ! !
    37 
    49 
    38 !LicenceBox  class methodsFor:'initialization'!
    50 !LicenceBox  class methodsFor:'initialization'!
    39 
    51 
    40 initialize
    52 initialize
    41     LicenceRejectSignal isNil ifTrue:[
    53     LicenceRejectSignal isNil ifTrue:[
    42         LicenceRejectSignal := ErrorSignal newSignalMayProceed:true.
    54 	LicenceRejectSignal := ErrorSignal newSignalMayProceed:true.
    43         LicenceRejectSignal nameClass:self message:#licenceRejectSignal.
    55 	LicenceRejectSignal nameClass:self message:#licenceRejectSignal.
    44         LicenceRejectSignal notifierString:'licence rejected by user'.
    56 	LicenceRejectSignal notifierString:'licence rejected by user'.
    45     ].
    57     ].
    46 
    58 
    47     "
    59     "
    48      self initialize
    60      self initialize
    49     "
    61     "
   110     super initialize.
   122     super initialize.
   111     accepted := false.
   123     accepted := false.
   112 
   124 
   113     (self addTextLabel:(resources string:'Please read the licence terms:')) adjust:#left.
   125     (self addTextLabel:(resources string:'Please read the licence terms:')) adjust:#left.
   114     textView := self addTextBoxOn:nil 
   126     textView := self addTextBoxOn:nil 
   115                         class:HTMLDocumentView
   127 			class:HTMLDocumentView
   116                         withNumberOfLines:40 
   128 			withNumberOfLines:40 
   117                         hScrollable:true 
   129 			hScrollable:true 
   118                         vScrollable:true.
   130 			vScrollable:true.
   119     self width:(textView preferredExtentForLines:40 cols:70) x.
   131     self width:(textView preferredExtentForLines:40 cols:70) x.
   120     textView setText:(self licenceText).
   132     textView setText:(self licenceText).
   121     self addAbortButtonLabelled:(resources string:'reject licence terms').
   133     self addAbortButtonLabelled:(resources string:'reject licence terms').
   122     self addOkButtonLabelled:(resources string:'accept licence terms').
   134     self addOkButtonLabelled:(resources string:'accept licence terms').
   123     self abortAction:[self destroy. accepted := false. LicenceRejectSignal raise].
   135     self abortAction:[self destroy. accepted := false. LicenceRejectSignal raise].
   133    "get licence text"
   145    "get licence text"
   134 
   146 
   135    |file|
   147    |file|
   136 
   148 
   137    file := resources at:'LICENCEFILE' default:nil.
   149    file := resources at:'LICENCEFILE' default:nil.
   138 self halt.
       
   139    file isNil ifTrue:[
   150    file isNil ifTrue:[
   140         file := 'doc/online/german/LICENCE.STX.html'.
   151 	file := 'doc/online/german/LICENCE.STX.html'.
   141    ].
   152    ].
   142    file asFilename exists ifFalse:[
   153    file asFilename exists ifFalse:[
   143        file := Smalltalk getSystemFileName:'doc/online/german/LICENCE.STX.html'.
   154        file := Smalltalk getSystemFileName:'doc/online/german/LICENCE.STX.html'.
   144        file isNil ifTrue:[
   155        file isNil ifTrue:[
   145           file := '../../doc/online/german/LICENCE.STX.html'.
   156 	  file := '../../doc/online/german/LICENCE.STX.html'.
   146        ].
   157        ].
   147    ].
   158    ].
   148    file asFilename exists ifFalse:[
   159    file asFilename exists ifFalse:[
   149        ^ 'oops - you are not allowed to remove the LICENSE file !!'
   160        ^ 'oops - you are not allowed to remove the LICENSE file !!'
   150    ].
   161    ].