| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | proc run_resource_dialog { name email } { |
|---|
| 37 | set w .form |
|---|
| 38 | global V |
|---|
| 39 | frame $w |
|---|
| 40 | |
|---|
| 41 | frame $w.msg -relief ridge |
|---|
| 42 | label $w.msg.label -font [mediumfont] -wraplength 4i \ |
|---|
| 43 | -justify left -text \ |
|---|
| 44 | "Please specify values for the following resources. \ |
|---|
| 45 | These strings will identify you by name and by email address \ |
|---|
| 46 | in any RTP-based conference. Please use your real name and \ |
|---|
| 47 | affiliation instead of a ``handle'', e.g., ``Jane Doe (ACME Research)''. \ |
|---|
| 48 | The values you enter will be saved in the Windows registry under the \ |
|---|
| 49 | Software\\Vic\\vic key so you will not have to re-enter them." -relief ridge |
|---|
| 50 | |
|---|
| 51 | pack $w.msg.label -padx 6 -pady 6 |
|---|
| 52 | pack $w.msg -side top |
|---|
| 53 | |
|---|
| 54 | foreach i {name email} { |
|---|
| 55 | frame $w.$i -bd 2 |
|---|
| 56 | entry $w.$i.entry -relief sunken |
|---|
| 57 | label $w.$i.label -width 10 -anchor e |
|---|
| 58 | pack $w.$i.label -side left |
|---|
| 59 | pack $w.$i.entry -side left -fill x -expand 1 -padx 8 |
|---|
| 60 | } |
|---|
| 61 | $w.name.label config -text *rtpName: |
|---|
| 62 | $w.email.label config -text *rtpEmail: |
|---|
| 63 | pack $w.msg -pady 10 |
|---|
| 64 | pack $w.name $w.email -side top -fill x |
|---|
| 65 | |
|---|
| 66 | set owner "" |
|---|
| 67 | catch {set owner [getregistry "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" "RegisteredOwner"]} |
|---|
| 68 | if { $owner == "" } { |
|---|
| 69 | catch {set owner [getregistry "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion" "RegisteredOwner"]} |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | set org "" |
|---|
| 73 | catch {set org [getregistry "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" "RegisteredOrganization"]} |
|---|
| 74 | if { $org == "" } { |
|---|
| 75 | catch {set org [getregistry "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion" "RegisteredOrganization"]} |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | $w.name.entry insert 0 [format "%s (%s)" $owner $org ] |
|---|
| 79 | $w.email.entry insert 0 [email_heursitic] |
|---|
| 80 | |
|---|
| 81 | frame $w.buttons |
|---|
| 82 | button $w.buttons.accept -text Accept -command "set dialogDone 1" |
|---|
| 83 | button $w.buttons.dismiss -text Quit -command "set dialogDone -1" |
|---|
| 84 | pack $w.buttons.accept $w.buttons.dismiss \ |
|---|
| 85 | -side left -expand 1 -padx 20 -pady 10 |
|---|
| 86 | pack $w.buttons |
|---|
| 87 | pack $w -padx 10 |
|---|
| 88 | |
|---|
| 89 | global dialogDone |
|---|
| 90 | while { 1 } { |
|---|
| 91 | set dialogDone 0 |
|---|
| 92 | focus $w.name.entry |
|---|
| 93 | tkwait variable dialogDone |
|---|
| 94 | if { $dialogDone < 0 } { |
|---|
| 95 | exit 0 |
|---|
| 96 | } |
|---|
| 97 | set name [string trim [$w.name.entry get]] |
|---|
| 98 | if { [string length $name] <= 3 } { |
|---|
| 99 | open_dialog "please enter a reasonable name" |
|---|
| 100 | continue |
|---|
| 101 | } |
|---|
| 102 | set email [string trim [$w.email.entry get]] |
|---|
| 103 | if { [string first . $email] < 0 || \ |
|---|
| 104 | [string first @ $email] < 0 } { |
|---|
| 105 | open_dialog "email address should have form user@host.domain" |
|---|
| 106 | continue |
|---|
| 107 | } |
|---|
| 108 | break |
|---|
| 109 | } |
|---|
| 110 | option add *rtpName "$name" interactive |
|---|
| 111 | option add *rtpEmail "$email" interactive |
|---|
| 112 | |
|---|
| 113 | putregistry "HKEY_CURRENT_USER\\Software\\$V(class)\\$V(app)" "*rtpName" "$name" |
|---|
| 114 | putregistry "HKEY_CURRENT_USER\\Software\\$V(class)\\$V(app)" "*rtpEmail" "$email" |
|---|
| 115 | |
|---|
| 116 | pack forget $w |
|---|
| 117 | destroy $w |
|---|
| 118 | } |
|---|