TextSweep

Hex Artifact Content
Login

Artifact e01ff71784ea7ae38474f447a6d4476573e2490a:


0000: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
0010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0020: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0040: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
0050: 23 20 20 70 61 73 73 77 64 64 6c 67 2e 74 63 6c  #  passwddlg.tcl
0060: 0a 23 20 20 54 68 69 73 20 66 69 6c 65 20 69 73  .#  This file is
0070: 20 70 61 72 74 20 6f 66 20 55 6e 69 66 69 78 20   part of Unifix 
0080: 42 57 69 64 67 65 74 20 54 6f 6f 6c 6b 69 74 0a  BWidget Toolkit.
0090: 23 20 20 20 62 79 20 53 74 65 70 68 61 6e 65 20  #   by Stephane 
00a0: 4c 61 76 69 72 6f 74 74 65 20 28 53 74 65 70 68  Lavirotte (Steph
00b0: 61 6e 65 2e 4c 61 76 69 72 6f 74 74 65 40 73 6f  ane.Lavirotte@so
00c0: 70 68 69 61 2e 69 6e 72 69 61 2e 66 72 29 0a 23  phia.inria.fr).#
00d0: 20 20 24 49 64 3a 20 70 61 73 73 77 64 64 6c 67    $Id: passwddlg
00e0: 2e 74 63 6c 2c 76 20 31 2e 31 32 20 32 30 30 39  .tcl,v 1.12 2009
00f0: 2f 30 36 2f 31 31 20 31 35 3a 34 32 3a 35 31 20  /06/11 15:42:51 
0100: 6f 65 68 68 61 72 20 45 78 70 20 24 0a 23 20 2d  oehhar Exp $.# -
0110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0120: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0130: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0140: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0150: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20  ------------.#  
0160: 49 6e 64 65 78 20 6f 66 20 63 6f 6d 6d 61 6e 64  Index of command
0170: 73 3a 0a 23 20 20 20 20 20 2d 20 50 61 73 73 77  s:.#     - Passw
0180: 64 44 6c 67 3a 3a 63 72 65 61 74 65 0a 23 20 20  dDlg::create.#  
0190: 20 20 20 2d 20 50 61 73 73 77 64 44 6c 67 3a 3a     - PasswdDlg::
01a0: 63 6f 6e 66 69 67 75 72 65 0a 23 20 20 20 20 20  configure.#     
01b0: 2d 20 50 61 73 73 77 64 44 6c 67 3a 3a 63 67 65  - PasswdDlg::cge
01c0: 74 0a 23 20 20 20 20 20 2d 20 50 61 73 73 77 64  t.#     - Passwd
01d0: 44 6c 67 3a 3a 5f 76 65 72 69 66 6f 6e 6c 6f 67  Dlg::_verifonlog
01e0: 69 6e 0a 23 20 20 20 20 20 2d 20 50 61 73 73 77  in.#     - Passw
01f0: 64 44 6c 67 3a 3a 5f 76 65 72 69 66 6f 6e 70 61  dDlg::_verifonpa
0200: 73 73 77 64 0a 23 20 20 20 20 20 2d 20 50 61 73  sswd.#     - Pas
0210: 73 77 64 44 6c 67 3a 3a 5f 6d 61 78 0a 23 2d 2d  swdDlg::_max.#--
0220: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0230: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0240: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0250: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0260: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 6e 61  ------------..na
0270: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 50 61 73  mespace eval Pas
0280: 73 77 64 44 6c 67 20 7b 0a 20 20 20 20 57 69 64  swdDlg {.    Wid
0290: 67 65 74 3a 3a 64 65 66 69 6e 65 20 50 61 73 73  get::define Pass
02a0: 77 64 44 6c 67 20 70 61 73 73 77 64 64 6c 67 20  wdDlg passwddlg 
02b0: 44 69 61 6c 6f 67 20 4c 61 62 65 6c 45 6e 74 72  Dialog LabelEntr
02c0: 79 0a 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 62  y..    Widget::b
02d0: 77 69 6e 63 6c 75 64 65 20 50 61 73 73 77 64 44  winclude PasswdD
02e0: 6c 67 20 44 69 61 6c 6f 67 20 3a 63 6d 64 20 5c  lg Dialog :cmd \
02f0: 0a 09 20 20 20 20 72 65 6d 6f 76 65 20 20 20 20  ..    remove    
0300: 20 7b 2d 69 6d 61 67 65 20 2d 62 69 74 6d 61 70   {-image -bitmap
0310: 20 2d 73 69 64 65 20 2d 64 65 66 61 75 6c 74 20   -side -default 
0320: 2d 63 61 6e 63 65 6c 20 2d 73 65 70 61 72 61 74  -cancel -separat
0330: 6f 72 7d 20 5c 0a 09 20 20 20 20 69 6e 69 74 69  or} \..    initi
0340: 61 6c 69 7a 65 20 7b 2d 6d 6f 64 61 6c 20 6c 6f  alize {-modal lo
0350: 63 61 6c 20 2d 61 6e 63 68 6f 72 20 65 7d 0a 20  cal -anchor e}. 
0360: 20 20 20 0a 20 20 20 20 57 69 64 67 65 74 3a 3a     .    Widget::
0370: 62 77 69 6e 63 6c 75 64 65 20 50 61 73 73 77 64  bwinclude Passwd
0380: 44 6c 67 20 4c 61 62 65 6c 45 6e 74 72 79 20 2e  Dlg LabelEntry .
0390: 66 72 61 6d 65 2e 6c 61 62 6c 6f 67 20 5c 0a 09  frame.lablog \..
03a0: 20 20 20 20 72 65 6d 6f 76 65 20 5b 6c 69 73 74      remove [list
03b0: 20 2d 63 6f 6d 6d 61 6e 64 20 2d 6a 75 73 74 69   -command -justi
03c0: 66 79 20 2d 6e 61 6d 65 20 2d 73 68 6f 77 20 2d  fy -name -show -
03d0: 73 69 64 65 09 20 20 20 20 20 20 20 20 5c 0a 09  side.        \..
03e0: 09 2d 73 74 61 74 65 20 2d 74 61 6b 65 66 6f 63  .-state -takefoc
03f0: 75 73 20 2d 77 69 64 74 68 20 2d 78 73 63 72 6f  us -width -xscro
0400: 6c 6c 63 6f 6d 6d 61 6e 64 20 2d 70 61 64 78 20  llcommand -padx 
0410: 2d 70 61 64 79 09 5c 0a 09 09 2d 64 72 61 67 65  -pady.\...-drage
0420: 6e 61 62 6c 65 64 20 2d 64 72 61 67 65 6e 64 63  nabled -dragendc
0430: 6d 64 20 2d 64 72 61 67 65 76 65 6e 74 20 2d 64  md -dragevent -d
0440: 72 61 67 69 6e 69 74 63 6d 64 09 5c 0a 09 09 2d  raginitcmd.\...-
0450: 64 72 61 67 74 79 70 65 20 2d 64 72 6f 70 65 6e  dragtype -dropen
0460: 61 62 6c 65 64 20 2d 64 72 6f 70 63 6d 64 20 2d  abled -dropcmd -
0470: 64 72 6f 70 6f 76 65 72 63 6d 64 20 2d 64 72 6f  dropovercmd -dro
0480: 70 74 79 70 65 73 09 5c 0a 09 09 5d 20 5c 0a 09  ptypes.\...] \..
0490: 20 20 20 20 70 72 65 66 69 78 20 5b 6c 69 73 74      prefix [list
04a0: 20 6c 6f 67 69 6e 20 2d 65 64 69 74 61 62 6c 65   login -editable
04b0: 20 2d 68 65 6c 70 74 65 78 74 20 2d 68 65 6c 70   -helptext -help
04c0: 76 61 72 20 2d 6c 61 62 65 6c 20 20 20 20 20 20  var -label      
04d0: 5c 0a 09 09 2d 74 65 78 74 20 2d 74 65 78 74 76  \...-text -textv
04e0: 61 72 69 61 62 6c 65 20 2d 75 6e 64 65 72 6c 69  ariable -underli
04f0: 6e 65 09 09 09 09 5c 0a 09 09 5d 20 5c 0a 09 20  ne....\...] \.. 
0500: 20 20 20 69 6e 69 74 69 61 6c 69 7a 65 20 5b 6c     initialize [l
0510: 69 73 74 20 2d 72 65 6c 69 65 66 20 73 75 6e 6b  ist -relief sunk
0520: 65 6e 20 2d 62 6f 72 64 65 72 77 69 64 74 68 20  en -borderwidth 
0530: 32 09 09 5c 0a 09 09 2d 6c 61 62 65 6c 61 6e 63  2..\...-labelanc
0540: 68 6f 72 20 77 20 2d 77 69 64 74 68 20 31 35 20  hor w -width 15 
0550: 2d 6c 6f 67 69 6e 6c 61 62 65 6c 20 22 4c 6f 67  -loginlabel "Log
0560: 69 6e 22 09 09 5c 0a 09 09 5d 0a 20 20 20 20 0a  in"..\...].    .
0570: 20 20 20 20 57 69 64 67 65 74 3a 3a 62 77 69 6e      Widget::bwin
0580: 63 6c 75 64 65 20 50 61 73 73 77 64 44 6c 67 20  clude PasswdDlg 
0590: 4c 61 62 65 6c 45 6e 74 72 79 20 2e 66 72 61 6d  LabelEntry .fram
05a0: 65 2e 6c 61 62 70 61 73 73 09 09 5c 0a 09 20 20  e.labpass..\..  
05b0: 20 20 72 65 6d 6f 76 65 20 5b 6c 69 73 74 20 2d    remove [list -
05c0: 63 6f 6d 6d 61 6e 64 20 2d 77 69 64 74 68 20 2d  command -width -
05d0: 73 68 6f 77 20 2d 73 69 64 65 20 2d 74 61 6b 65  show -side -take
05e0: 66 6f 63 75 73 09 09 5c 0a 09 09 2d 78 73 63 72  focus..\...-xscr
05f0: 6f 6c 6c 63 6f 6d 6d 61 6e 64 20 2d 64 72 61 67  ollcommand -drag
0600: 65 6e 61 62 6c 65 64 20 2d 64 72 61 67 65 6e 64  enabled -dragend
0610: 63 6d 64 20 2d 64 72 61 67 65 76 65 6e 74 09 5c  cmd -dragevent.\
0620: 0a 09 09 2d 64 72 61 67 69 6e 69 74 63 6d 64 20  ...-draginitcmd 
0630: 2d 64 72 61 67 74 79 70 65 20 2d 64 72 6f 70 65  -dragtype -drope
0640: 6e 61 62 6c 65 64 20 2d 64 72 6f 70 63 6d 64 09  nabled -dropcmd.
0650: 09 5c 0a 09 09 2d 64 72 6f 70 6f 76 65 72 63 6d  .\...-dropovercm
0660: 64 20 2d 64 72 6f 70 74 79 70 65 73 20 2d 6a 75  d -droptypes -ju
0670: 73 74 69 66 79 20 2d 70 61 64 78 20 2d 70 61 64  stify -padx -pad
0680: 79 20 2d 6e 61 6d 65 09 5c 0a 09 09 5d 20 5c 0a  y -name.\...] \.
0690: 09 20 20 20 20 70 72 65 66 69 78 20 5b 6c 69 73  .    prefix [lis
06a0: 74 20 70 61 73 73 77 64 20 2d 65 64 69 74 61 62  t passwd -editab
06b0: 6c 65 20 2d 68 65 6c 70 74 65 78 74 20 2d 68 65  le -helptext -he
06c0: 6c 70 76 61 72 20 2d 6c 61 62 65 6c 09 5c 0a 09  lpvar -label.\..
06d0: 09 2d 73 74 61 74 65 20 2d 74 65 78 74 20 2d 74  .-state -text -t
06e0: 65 78 74 76 61 72 69 61 62 6c 65 20 2d 75 6e 64  extvariable -und
06f0: 65 72 6c 69 6e 65 09 09 09 5c 0a 09 09 5d 20 5c  erline...\...] \
0700: 0a 09 20 20 20 20 69 6e 69 74 69 61 6c 69 7a 65  ..    initialize
0710: 20 5b 6c 69 73 74 20 2d 72 65 6c 69 65 66 20 73   [list -relief s
0720: 75 6e 6b 65 6e 20 2d 62 6f 72 64 65 72 77 69 64  unken -borderwid
0730: 74 68 20 32 09 09 5c 0a 09 09 2d 6c 61 62 65 6c  th 2..\...-label
0740: 61 6e 63 68 6f 72 20 77 20 2d 77 69 64 74 68 20  anchor w -width 
0750: 31 35 20 2d 70 61 73 73 77 64 6c 61 62 65 6c 20  15 -passwdlabel 
0760: 22 50 61 73 73 77 6f 72 64 22 09 5c 0a 09 09 5d  "Password".\...]
0770: 0a 20 20 20 20 0a 20 20 20 20 57 69 64 67 65 74  .    .    Widget
0780: 3a 3a 64 65 63 6c 61 72 65 20 50 61 73 73 77 64  ::declare Passwd
0790: 44 6c 67 20 7b 0a 20 20 20 20 20 20 20 20 7b 2d  Dlg {.        {-
07a0: 74 79 70 65 20 20 20 20 20 20 20 20 45 6e 75 6d  type        Enum
07b0: 20 20 20 20 20 20 20 6f 6b 20 20 20 20 20 20 20         ok       
07c0: 20 20 20 20 30 20 7b 6f 6b 20 6f 6b 63 61 6e 63      0 {ok okcanc
07d0: 65 6c 7d 7d 0a 20 20 20 20 20 20 20 20 7b 2d 6c  el}}.        {-l
07e0: 61 62 65 6c 77 69 64 74 68 20 20 54 6b 52 65 73  abelwidth  TkRes
07f0: 6f 75 72 63 65 20 2d 31 20 20 20 20 20 20 20 20  ource -1        
0800: 20 20 20 30 20 7b 6c 61 62 65 6c 20 2d 77 69 64     0 {label -wid
0810: 74 68 7d 7d 0a 20 20 20 20 20 20 20 20 7b 2d 63  th}}.        {-c
0820: 6f 6d 6d 61 6e 64 20 20 20 20 20 53 74 72 69 6e  ommand     Strin
0830: 67 20 20 20 20 20 22 22 20 20 20 20 20 20 20 20  g     ""        
0840: 20 20 20 30 7d 0a 20 20 20 20 7d 0a 7d 0a 0a 0a     0}.    }.}...
0850: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
0860: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0870: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0890: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
08a0: 23 20 20 43 6f 6d 6d 61 6e 64 20 50 61 73 73 77  #  Command Passw
08b0: 64 44 6c 67 3a 3a 63 72 65 61 74 65 0a 23 20 2d  dDlg::create.# -
08c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
08d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
08e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
08f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0900: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72 6f  ------------.pro
0910: 63 20 50 61 73 73 77 64 44 6c 67 3a 3a 63 72 65  c PasswdDlg::cre
0920: 61 74 65 20 7b 20 70 61 74 68 20 61 72 67 73 20  ate { path args 
0930: 7d 20 7b 0a 0a 20 20 20 20 61 72 72 61 79 20 73  } {..    array s
0940: 65 74 20 6d 61 70 73 20 5b 6c 69 73 74 20 50 61  et maps [list Pa
0950: 73 73 77 64 44 6c 67 20 7b 7d 20 3a 63 6d 64 20  sswdDlg {} :cmd 
0960: 7b 7d 20 2e 66 72 61 6d 65 2e 6c 61 62 6c 6f 67  {} .frame.lablog
0970: 20 7b 7d 20 5c 0a 09 20 20 20 20 2e 66 72 61 6d   {} \..    .fram
0980: 65 2e 6c 61 62 70 61 73 73 20 7b 7d 5d 0a 20 20  e.labpass {}].  
0990: 20 20 61 72 72 61 79 20 73 65 74 20 6d 61 70 73    array set maps
09a0: 20 5b 57 69 64 67 65 74 3a 3a 70 61 72 73 65 41   [Widget::parseA
09b0: 72 67 73 20 50 61 73 73 77 64 44 6c 67 20 24 61  rgs PasswdDlg $a
09c0: 72 67 73 5d 0a 0a 20 20 20 20 57 69 64 67 65 74  rgs]..    Widget
09d0: 3a 3a 69 6e 69 74 46 72 6f 6d 4f 44 42 20 50 61  ::initFromODB Pa
09e0: 73 73 77 64 44 6c 67 20 22 24 70 61 74 68 23 50  sswdDlg "$path#P
09f0: 61 73 73 77 64 44 6c 67 22 20 24 6d 61 70 73 28  asswdDlg" $maps(
0a00: 50 61 73 73 77 64 44 6c 67 29 0a 0a 20 20 20 20  PasswdDlg)..    
0a10: 23 20 45 78 74 72 61 63 74 20 74 68 65 20 50 61  # Extract the Pa
0a20: 73 73 77 64 44 6c 67 20 6d 65 67 61 77 69 64 67  sswdDlg megawidg
0a30: 65 74 20 6f 70 74 69 6f 6e 73 20 28 74 68 6f 73  et options (thos
0a40: 65 20 74 68 61 74 20 64 6f 6e 27 74 20 6d 61 70  e that don't map
0a50: 20 74 6f 20 61 0a 20 20 20 20 23 20 73 75 62 77   to a.    # subw
0a60: 69 64 67 65 74 29 0a 20 20 20 20 73 65 74 20 74  idget).    set t
0a70: 79 70 65 20 20 20 20 20 20 5b 57 69 64 67 65 74  ype      [Widget
0a80: 3a 3a 63 67 65 74 20 22 24 70 61 74 68 23 50 61  ::cget "$path#Pa
0a90: 73 73 77 64 44 6c 67 22 20 2d 74 79 70 65 5d 0a  sswdDlg" -type].
0aa0: 20 20 20 20 73 65 74 20 63 6d 64 20 20 20 20 20      set cmd     
0ab0: 20 20 5b 57 69 64 67 65 74 3a 3a 63 67 65 74 20    [Widget::cget 
0ac0: 22 24 70 61 74 68 23 50 61 73 73 77 64 44 6c 67  "$path#PasswdDlg
0ad0: 22 20 2d 63 6f 6d 6d 61 6e 64 5d 0a 0a 20 20 20  " -command]..   
0ae0: 20 73 65 74 20 64 65 66 62 20 2d 31 0a 20 20 20   set defb -1.   
0af0: 20 73 65 74 20 63 61 6e 62 20 2d 31 0a 20 20 20   set canb -1.   
0b00: 20 73 77 69 74 63 68 20 2d 2d 20 24 74 79 70 65   switch -- $type
0b10: 20 7b 0a 20 20 20 20 20 20 20 20 6f 6b 20 20 20   {.        ok   
0b20: 20 20 20 20 20 7b 20 73 65 74 20 6c 62 75 74 20       { set lbut 
0b30: 7b 6f 6b 7d 3b 20 73 65 74 20 64 65 66 62 20 30  {ok}; set defb 0
0b40: 20 7d 0a 20 20 20 20 20 20 20 20 6f 6b 63 61 6e   }.        okcan
0b50: 63 65 6c 20 20 7b 20 73 65 74 20 6c 62 75 74 20  cel  { set lbut 
0b60: 7b 6f 6b 20 63 61 6e 63 65 6c 7d 20 3b 20 73 65  {ok cancel} ; se
0b70: 74 20 64 65 66 62 20 30 3b 20 73 65 74 20 63 61  t defb 0; set ca
0b80: 6e 62 20 31 20 7d 0a 20 20 20 20 7d 0a 0a 20 20  nb 1 }.    }..  
0b90: 20 20 65 76 61 6c 20 5b 6c 69 73 74 20 44 69 61    eval [list Dia
0ba0: 6c 6f 67 3a 3a 63 72 65 61 74 65 20 24 70 61 74  log::create $pat
0bb0: 68 5d 20 24 6d 61 70 73 28 3a 63 6d 64 29 20 5c  h] $maps(:cmd) \
0bc0: 0a 20 20 20 20 20 20 20 20 5b 6c 69 73 74 20 2d  .        [list -
0bd0: 63 6c 61 73 73 20 50 61 73 73 77 64 44 6c 67 20  class PasswdDlg 
0be0: 2d 69 6d 61 67 65 20 5b 42 69 74 6d 61 70 3a 3a  -image [Bitmap::
0bf0: 67 65 74 20 70 61 73 73 77 64 5d 20 5c 0a 09 20  get passwd] \.. 
0c00: 20 20 20 20 2d 73 69 64 65 20 62 6f 74 74 6f 6d      -side bottom
0c10: 20 2d 64 65 66 61 75 6c 74 20 24 64 65 66 62 20   -default $defb 
0c20: 2d 63 61 6e 63 65 6c 20 24 63 61 6e 62 5d 0a 20  -cancel $canb]. 
0c30: 20 20 20 66 6f 72 65 61 63 68 20 62 75 74 20 24     foreach but $
0c40: 6c 62 75 74 20 7b 0a 20 20 20 20 20 20 20 20 69  lbut {.        i
0c50: 66 20 7b 20 24 62 75 74 20 3d 3d 20 22 6f 6b 22  f { $but == "ok"
0c60: 20 26 26 20 24 63 6d 64 20 21 3d 20 22 22 20 7d   && $cmd != "" }
0c70: 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 44   {.            D
0c80: 69 61 6c 6f 67 3a 3a 61 64 64 20 24 70 61 74 68  ialog::add $path
0c90: 20 2d 74 65 78 74 20 24 62 75 74 20 2d 6e 61 6d   -text $but -nam
0ca0: 65 20 24 62 75 74 20 2d 63 6f 6d 6d 61 6e 64 20  e $but -command 
0cb0: 24 63 6d 64 0a 20 20 20 20 20 20 20 20 7d 20 65  $cmd.        } e
0cc0: 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20  lse {.          
0cd0: 20 20 44 69 61 6c 6f 67 3a 3a 61 64 64 20 24 70    Dialog::add $p
0ce0: 61 74 68 20 2d 74 65 78 74 20 24 62 75 74 20 2d  ath -text $but -
0cf0: 6e 61 6d 65 20 24 62 75 74 0a 20 20 20 20 20 20  name $but.      
0d00: 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 73    }.    }..    s
0d10: 65 74 20 66 72 61 6d 65 20 5b 44 69 61 6c 6f 67  et frame [Dialog
0d20: 3a 3a 67 65 74 66 72 61 6d 65 20 24 70 61 74 68  ::getframe $path
0d30: 5d 0a 20 20 20 20 62 69 6e 64 20 24 70 61 74 68  ].    bind $path
0d40: 20 20 3c 52 65 74 75 72 6e 3e 20 20 22 22 0a 20    <Return>  "". 
0d50: 20 20 20 62 69 6e 64 20 24 66 72 61 6d 65 20 3c     bind $frame <
0d60: 44 65 73 74 72 6f 79 3e 20 5b 6c 69 73 74 20 57  Destroy> [list W
0d70: 69 64 67 65 74 3a 3a 64 65 73 74 72 6f 79 20 24  idget::destroy $
0d80: 70 61 74 68 5c 23 50 61 73 73 77 64 44 6c 67 5d  path\#PasswdDlg]
0d90: 0a 0a 20 20 20 20 73 65 74 20 6c 61 62 6c 6f 67  ..    set lablog
0da0: 20 5b 65 76 61 6c 20 5b 6c 69 73 74 20 4c 61 62   [eval [list Lab
0db0: 65 6c 45 6e 74 72 79 3a 3a 63 72 65 61 74 65 20  elEntry::create 
0dc0: 24 66 72 61 6d 65 2e 6c 61 62 6c 6f 67 5d 20 5c  $frame.lablog] \
0dd0: 0a 09 09 20 20 20 20 24 6d 61 70 73 28 2e 66 72  ...    $maps(.fr
0de0: 61 6d 65 2e 6c 61 62 6c 6f 67 29 20 5c 0a 09 09  ame.lablog) \...
0df0: 20 20 20 20 5b 6c 69 73 74 20 2d 6e 61 6d 65 20      [list -name 
0e00: 6c 6f 67 69 6e 20 2d 64 72 61 67 65 6e 61 62 6c  login -dragenabl
0e10: 65 64 20 30 20 2d 64 72 6f 70 65 6e 61 62 6c 65  ed 0 -dropenable
0e20: 64 20 30 20 5c 0a 09 09 09 20 2d 63 6f 6d 6d 61  d 0 \.... -comma
0e30: 6e 64 20 5b 6c 69 73 74 20 50 61 73 73 77 64 44  nd [list PasswdD
0e40: 6c 67 3a 3a 5f 76 65 72 69 66 6f 6e 70 61 73 73  lg::_verifonpass
0e50: 77 64 20 5c 0a 09 09 09 09 20 20 20 20 20 20 20  wd \.....       
0e60: 24 70 61 74 68 20 24 66 72 61 6d 65 2e 6c 61 62  $path $frame.lab
0e70: 70 61 73 73 5d 5d 5d 0a 0a 20 20 20 20 73 65 74  pass]]]..    set
0e80: 20 6c 61 62 70 61 73 73 20 5b 65 76 61 6c 20 5b   labpass [eval [
0e90: 6c 69 73 74 20 4c 61 62 65 6c 45 6e 74 72 79 3a  list LabelEntry:
0ea0: 3a 63 72 65 61 74 65 20 24 66 72 61 6d 65 2e 6c  :create $frame.l
0eb0: 61 62 70 61 73 73 5d 20 5c 0a 09 09 20 20 20 20  abpass] \...    
0ec0: 20 24 6d 61 70 73 28 2e 66 72 61 6d 65 2e 6c 61   $maps(.frame.la
0ed0: 62 70 61 73 73 29 20 5c 0a 09 09 20 20 20 20 20  bpass) \...     
0ee0: 5b 6c 69 73 74 20 2d 6e 61 6d 65 20 70 61 73 73  [list -name pass
0ef0: 77 6f 72 64 20 2d 73 68 6f 77 20 22 2a 22 20 5c  word -show "*" \
0f00: 0a 09 09 09 20 20 2d 64 72 61 67 65 6e 61 62 6c  ....  -dragenabl
0f10: 65 64 20 30 20 2d 64 72 6f 70 65 6e 61 62 6c 65  ed 0 -dropenable
0f20: 64 20 30 20 5c 0a 09 09 09 20 20 2d 63 6f 6d 6d  d 0 \....  -comm
0f30: 61 6e 64 20 5b 6c 69 73 74 20 50 61 73 73 77 64  and [list Passwd
0f40: 44 6c 67 3a 3a 5f 76 65 72 69 66 6f 6e 6c 6f 67  Dlg::_verifonlog
0f50: 69 6e 20 5c 0a 09 09 09 09 09 24 70 61 74 68 20  in \......$path 
0f60: 24 66 72 61 6d 65 2e 6c 61 62 6c 6f 67 5d 5d 5d  $frame.lablog]]]
0f70: 0a 0a 20 20 20 20 23 20 63 6f 6d 70 75 74 65 20  ..    # compute 
0f80: 6c 61 62 65 6c 20 77 69 64 74 68 0a 20 20 20 20  label width.    
0f90: 69 66 20 7b 5b 24 6c 61 62 6c 6f 67 20 63 67 65  if {[$lablog cge
0fa0: 74 20 2d 6c 61 62 65 6c 77 69 64 74 68 5d 20 3d  t -labelwidth] =
0fb0: 3d 20 30 7d 20 7b 0a 20 20 20 20 20 20 20 20 73  = 0} {.        s
0fc0: 65 74 20 6c 6f 67 6c 61 62 65 6c 20 20 5b 24 6c  et loglabel  [$l
0fd0: 61 62 6c 6f 67 20 63 67 65 74 20 2d 6c 61 62 65  ablog cget -labe
0fe0: 6c 5d 0a 20 20 20 20 20 20 20 20 73 65 74 20 70  l].        set p
0ff0: 61 73 73 6c 61 62 65 6c 20 5b 24 6c 61 62 70 61  asslabel [$labpa
1000: 73 73 20 63 67 65 74 20 2d 6c 61 62 65 6c 5d 0a  ss cget -label].
1010: 20 20 20 20 20 20 20 20 73 65 74 20 6c 61 62 77          set labw
1020: 69 64 74 68 20 20 5b 5f 6d 61 78 20 5b 73 74 72  idth  [_max [str
1030: 69 6e 67 20 6c 65 6e 67 74 68 20 24 6c 6f 67 6c  ing length $logl
1040: 61 62 65 6c 5d 20 5b 73 74 72 69 6e 67 20 6c 65  abel] [string le
1050: 6e 67 74 68 20 24 70 61 73 73 6c 61 62 65 6c 5d  ngth $passlabel]
1060: 5d 0a 20 20 20 20 20 20 20 20 69 6e 63 72 20 6c  ].        incr l
1070: 61 62 77 69 64 74 68 20 31 0a 20 20 20 20 20 20  abwidth 1.      
1080: 20 20 24 6c 61 62 6c 6f 67 20 20 63 6f 6e 66 69    $lablog  confi
1090: 67 75 72 65 20 2d 6c 61 62 65 6c 77 69 64 74 68  gure -labelwidth
10a0: 20 24 6c 61 62 77 69 64 74 68 0a 20 20 20 20 20   $labwidth.     
10b0: 20 20 20 24 6c 61 62 70 61 73 73 20 63 6f 6e 66     $labpass conf
10c0: 69 67 75 72 65 20 2d 6c 61 62 65 6c 77 69 64 74  igure -labelwidt
10d0: 68 20 24 6c 61 62 77 69 64 74 68 0a 20 20 20 20  h $labwidth.    
10e0: 7d 0a 0a 20 20 20 20 57 69 64 67 65 74 3a 3a 63  }..    Widget::c
10f0: 72 65 61 74 65 20 50 61 73 73 77 64 44 6c 67 20  reate PasswdDlg 
1100: 24 70 61 74 68 20 30 0a 0a 20 20 20 20 70 61 63  $path 0..    pac
1110: 6b 20 20 24 66 72 61 6d 65 2e 6c 61 62 6c 6f 67  k  $frame.lablog
1120: 20 24 66 72 61 6d 65 2e 6c 61 62 70 61 73 73 20   $frame.labpass 
1130: 2d 66 69 6c 6c 20 78 20 2d 65 78 70 61 6e 64 20  -fill x -expand 
1140: 31 0a 0a 20 20 20 20 23 20 61 64 64 65 64 20 62  1..    # added b
1150: 79 20 62 61 63 68 40 6d 77 67 64 6e 61 2e 63 6f  y bach@mwgdna.co
1160: 6d 0a 20 20 20 20 23 20 20 67 69 76 65 20 66 6f  m.    #  give fo
1170: 63 75 73 20 74 6f 20 6c 6f 67 69 6e 6c 61 62 65  cus to loginlabe
1180: 6c 20 75 6e 6c 65 73 73 20 74 68 65 20 73 74 61  l unless the sta
1190: 74 65 20 69 73 20 64 69 73 61 62 6c 65 64 0a 20  te is disabled. 
11a0: 20 20 20 69 66 20 7b 5b 24 6c 61 62 6c 6f 67 20     if {[$lablog 
11b0: 63 67 65 74 20 2d 65 64 69 74 61 62 6c 65 5d 7d  cget -editable]}
11c0: 20 7b 0a 09 66 6f 63 75 73 20 24 66 72 61 6d 65   {..focus $frame
11d0: 2e 6c 61 62 6c 6f 67 2e 65 0a 20 20 20 20 7d 20  .lablog.e.    } 
11e0: 65 6c 73 65 20 7b 0a 09 66 6f 63 75 73 20 24 66  else {..focus $f
11f0: 72 61 6d 65 2e 6c 61 62 70 61 73 73 2e 65 0a 20  rame.labpass.e. 
1200: 20 20 20 7d 0a 20 20 20 20 73 65 74 20 72 65 73     }.    set res
1210: 20 5b 44 69 61 6c 6f 67 3a 3a 64 72 61 77 20 24   [Dialog::draw $
1220: 70 61 74 68 5d 0a 0a 20 20 20 20 69 66 20 7b 20  path]..    if { 
1230: 24 72 65 73 20 3d 3d 20 30 20 7d 20 7b 0a 20 20  $res == 0 } {.  
1240: 20 20 20 20 20 20 73 65 74 20 72 65 73 20 5b 6c        set res [l
1250: 69 73 74 20 5b 24 6c 61 62 6c 6f 67 2e 65 20 63  ist [$lablog.e c
1260: 67 65 74 20 2d 74 65 78 74 5d 20 5b 24 6c 61 62  get -text] [$lab
1270: 70 61 73 73 2e 65 20 63 67 65 74 20 2d 74 65 78  pass.e cget -tex
1280: 74 5d 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b  t]].    } else {
1290: 0a 20 20 20 20 20 20 20 20 73 65 74 20 72 65 73  .        set res
12a0: 20 5b 6c 69 73 74 5d 0a 20 20 20 20 7d 0a 20 20   [list].    }.  
12b0: 20 20 57 69 64 67 65 74 3a 3a 64 65 73 74 72 6f    Widget::destro
12c0: 79 20 22 24 70 61 74 68 23 50 61 73 73 77 64 44  y "$path#PasswdD
12d0: 6c 67 22 0a 20 20 20 20 64 65 73 74 72 6f 79 20  lg".    destroy 
12e0: 24 70 61 74 68 0a 0a 20 20 20 20 72 65 74 75 72  $path..    retur
12f0: 6e 20 24 72 65 73 0a 7d 0a 0a 23 20 2d 2d 2d 2d  n $res.}..# ----
1300: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1310: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f 6d  ---------.#  Com
1350: 6d 61 6e 64 20 50 61 73 73 77 64 44 6c 67 3a 3a  mand PasswdDlg::
1360: 63 6f 6e 66 69 67 75 72 65 0a 23 20 2d 2d 2d 2d  configure.# ----
1370: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1380: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1390: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 70 72 6f 63 20  ---------..proc 
13c0: 50 61 73 73 77 64 44 6c 67 3a 3a 63 6f 6e 66 69  PasswdDlg::confi
13d0: 67 75 72 65 20 7b 20 70 61 74 68 20 61 72 67 73  gure { path args
13e0: 20 7d 20 7b 0a 20 20 20 20 73 65 74 20 72 65 73   } {.    set res
13f0: 20 5b 57 69 64 67 65 74 3a 3a 63 6f 6e 66 69 67   [Widget::config
1400: 75 72 65 20 22 24 70 61 74 68 23 50 61 73 73 77  ure "$path#Passw
1410: 64 44 6c 67 22 20 24 61 72 67 73 5d 0a 7d 0a 0a  dDlg" $args].}..
1420: 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  # --------------
1430: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1440: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1450: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1460: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
1470: 23 20 20 43 6f 6d 6d 61 6e 64 20 50 61 73 73 77  #  Command Passw
1480: 64 44 6c 67 3a 3a 63 67 65 74 0a 23 20 2d 2d 2d  dDlg::cget.# ---
1490: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 70 72 6f 63  ----------..proc
14e0: 20 50 61 73 73 77 64 44 6c 67 3a 3a 63 67 65 74   PasswdDlg::cget
14f0: 20 7b 20 70 61 74 68 20 6f 70 74 69 6f 6e 20 7d   { path option }
1500: 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 5b 57   {.    return [W
1510: 69 64 67 65 74 3a 3a 63 67 65 74 20 22 24 70 61  idget::cget "$pa
1520: 74 68 23 50 61 73 73 77 64 44 6c 67 22 20 24 6f  th#PasswdDlg" $o
1530: 70 74 69 6f 6e 5d 0a 7d 0a 0a 0a 23 20 2d 2d 2d  ption].}...# ---
1540: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1550: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1560: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1570: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1580: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23 20 20 43 6f  ----------.#  Co
1590: 6d 6d 61 6e 64 20 50 61 73 73 77 64 44 6c 67 3a  mmand PasswdDlg:
15a0: 3a 5f 76 65 72 69 66 6f 6e 6c 6f 67 69 6e 0a 23  :_verifonlogin.#
15b0: 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   ---------------
15c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70  --------------.p
1600: 72 6f 63 20 50 61 73 73 77 64 44 6c 67 3a 3a 5f  roc PasswdDlg::_
1610: 76 65 72 69 66 6f 6e 6c 6f 67 69 6e 20 7b 20 70  verifonlogin { p
1620: 61 74 68 20 6c 61 62 70 61 73 73 20 7d 20 7b 0a  ath labpass } {.
1630: 20 20 20 20 44 69 61 6c 6f 67 3a 3a 65 6e 64 64      Dialog::endd
1640: 69 61 6c 6f 67 20 24 70 61 74 68 20 30 0a 7d 0a  ialog $path 0.}.
1650: 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .# -------------
1660: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1670: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1680: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1690: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16a0: 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 50 61 73 73  .#  Command Pass
16b0: 77 64 44 6c 67 3a 3a 5f 76 65 72 69 66 6f 6e 70  wdDlg::_verifonp
16c0: 61 73 73 77 64 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d  asswd.# --------
16d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1700: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1710: 2d 2d 2d 2d 2d 0a 70 72 6f 63 20 50 61 73 73 77  -----.proc Passw
1720: 64 44 6c 67 3a 3a 5f 76 65 72 69 66 6f 6e 70 61  dDlg::_verifonpa
1730: 73 73 77 64 20 7b 20 70 61 74 68 20 6c 61 62 70  sswd { path labp
1740: 61 73 73 20 7d 20 7b 0a 20 20 20 20 69 66 20 7b  ass } {.    if {
1750: 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20 5b 24  [string equal [$
1760: 6c 61 62 70 61 73 73 20 63 67 65 74 20 2d 73 74  labpass cget -st
1770: 61 74 65 5d 20 22 64 69 73 61 62 6c 65 64 22 5d  ate] "disabled"]
1780: 7d 20 7b 0a 20 20 20 20 20 20 20 20 44 69 61 6c  } {.        Dial
1790: 6f 67 3a 3a 65 6e 64 64 69 61 6c 6f 67 20 24 70  og::enddialog $p
17a0: 61 74 68 20 30 0a 20 20 20 20 7d 20 65 6c 73 65  ath 0.    } else
17b0: 20 7b 0a 20 20 20 20 20 20 20 20 66 6f 63 75 73   {.        focus
17c0: 20 24 6c 61 62 70 61 73 73 0a 20 20 20 20 7d 0a   $labpass.    }.
17d0: 7d 0a 0a 23 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  }..# -----------
17e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
17f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1800: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1810: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1820: 2d 2d 0a 23 20 20 43 6f 6d 6d 61 6e 64 20 50 61  --.#  Command Pa
1830: 73 73 77 64 44 6c 67 3a 3a 5f 6d 61 78 0a 23 20  sswdDlg::_max.# 
1840: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1850: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1860: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1870: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 70 72  -------------.pr
1890: 6f 63 20 50 61 73 73 77 64 44 6c 67 3a 3a 5f 6d  oc PasswdDlg::_m
18a0: 61 78 20 7b 20 76 61 6c 31 20 76 61 6c 32 20 7d  ax { val1 val2 }
18b0: 20 7b 20 0a 20 20 20 20 72 65 74 75 72 6e 20 5b   { .    return [
18c0: 65 78 70 72 20 7b 28 24 76 61 6c 31 20 3e 20 24  expr {($val1 > $
18d0: 76 61 6c 32 29 20 3f 20 28 24 76 61 6c 31 29 20  val2) ? ($val1) 
18e0: 3a 20 28 24 76 61 6c 32 29 7d 5d 20 0a 7d 0a     : ($val2)}] .}.