/usr/share/amsn/utils/BWidget-1.9.0/passwddlg.tcl is in amsn-data 0.98.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | # -----------------------------------------------------------------------------
# passwddlg.tcl
# This file is part of Unifix BWidget Toolkit
# by Stephane Lavirotte (Stephane.Lavirotte@sophia.inria.fr)
# $Id: passwddlg.tcl,v 1.12 2009/06/11 15:42:51 oehhar Exp $
# -----------------------------------------------------------------------------
# Index of commands:
# - PasswdDlg::create
# - PasswdDlg::configure
# - PasswdDlg::cget
# - PasswdDlg::_verifonlogin
# - PasswdDlg::_verifonpasswd
# - PasswdDlg::_max
#------------------------------------------------------------------------------
namespace eval PasswdDlg {
Widget::define PasswdDlg passwddlg Dialog LabelEntry
Widget::bwinclude PasswdDlg Dialog :cmd \
remove {-image -bitmap -side -default -cancel -separator} \
initialize {-modal local -anchor e}
Widget::bwinclude PasswdDlg LabelEntry .frame.lablog \
remove [list -command -justify -name -show -side \
-state -takefocus -width -xscrollcommand -padx -pady \
-dragenabled -dragendcmd -dragevent -draginitcmd \
-dragtype -dropenabled -dropcmd -dropovercmd -droptypes \
] \
prefix [list login -editable -helptext -helpvar -label \
-text -textvariable -underline \
] \
initialize [list -relief sunken -borderwidth 2 \
-labelanchor w -width 15 -loginlabel "Login" \
]
Widget::bwinclude PasswdDlg LabelEntry .frame.labpass \
remove [list -command -width -show -side -takefocus \
-xscrollcommand -dragenabled -dragendcmd -dragevent \
-draginitcmd -dragtype -dropenabled -dropcmd \
-dropovercmd -droptypes -justify -padx -pady -name \
] \
prefix [list passwd -editable -helptext -helpvar -label \
-state -text -textvariable -underline \
] \
initialize [list -relief sunken -borderwidth 2 \
-labelanchor w -width 15 -passwdlabel "Password" \
]
Widget::declare PasswdDlg {
{-type Enum ok 0 {ok okcancel}}
{-labelwidth TkResource -1 0 {label -width}}
{-command String "" 0}
}
}
# -----------------------------------------------------------------------------
# Command PasswdDlg::create
# -----------------------------------------------------------------------------
proc PasswdDlg::create { path args } {
array set maps [list PasswdDlg {} :cmd {} .frame.lablog {} \
.frame.labpass {}]
array set maps [Widget::parseArgs PasswdDlg $args]
Widget::initFromODB PasswdDlg "$path#PasswdDlg" $maps(PasswdDlg)
# Extract the PasswdDlg megawidget options (those that don't map to a
# subwidget)
set type [Widget::cget "$path#PasswdDlg" -type]
set cmd [Widget::cget "$path#PasswdDlg" -command]
set defb -1
set canb -1
switch -- $type {
ok { set lbut {ok}; set defb 0 }
okcancel { set lbut {ok cancel} ; set defb 0; set canb 1 }
}
eval [list Dialog::create $path] $maps(:cmd) \
[list -class PasswdDlg -image [Bitmap::get passwd] \
-side bottom -default $defb -cancel $canb]
foreach but $lbut {
if { $but == "ok" && $cmd != "" } {
Dialog::add $path -text $but -name $but -command $cmd
} else {
Dialog::add $path -text $but -name $but
}
}
set frame [Dialog::getframe $path]
bind $path <Return> ""
bind $frame <Destroy> [list Widget::destroy $path\#PasswdDlg]
set lablog [eval [list LabelEntry::create $frame.lablog] \
$maps(.frame.lablog) \
[list -name login -dragenabled 0 -dropenabled 0 \
-command [list PasswdDlg::_verifonpasswd \
$path $frame.labpass]]]
set labpass [eval [list LabelEntry::create $frame.labpass] \
$maps(.frame.labpass) \
[list -name password -show "*" \
-dragenabled 0 -dropenabled 0 \
-command [list PasswdDlg::_verifonlogin \
$path $frame.lablog]]]
# compute label width
if {[$lablog cget -labelwidth] == 0} {
set loglabel [$lablog cget -label]
set passlabel [$labpass cget -label]
set labwidth [_max [string length $loglabel] [string length $passlabel]]
incr labwidth 1
$lablog configure -labelwidth $labwidth
$labpass configure -labelwidth $labwidth
}
Widget::create PasswdDlg $path 0
pack $frame.lablog $frame.labpass -fill x -expand 1
# added by bach@mwgdna.com
# give focus to loginlabel unless the state is disabled
if {[$lablog cget -editable]} {
focus $frame.lablog.e
} else {
focus $frame.labpass.e
}
set res [Dialog::draw $path]
if { $res == 0 } {
set res [list [$lablog.e cget -text] [$labpass.e cget -text]]
} else {
set res [list]
}
Widget::destroy "$path#PasswdDlg"
destroy $path
return $res
}
# -----------------------------------------------------------------------------
# Command PasswdDlg::configure
# -----------------------------------------------------------------------------
proc PasswdDlg::configure { path args } {
set res [Widget::configure "$path#PasswdDlg" $args]
}
# -----------------------------------------------------------------------------
# Command PasswdDlg::cget
# -----------------------------------------------------------------------------
proc PasswdDlg::cget { path option } {
return [Widget::cget "$path#PasswdDlg" $option]
}
# -----------------------------------------------------------------------------
# Command PasswdDlg::_verifonlogin
# -----------------------------------------------------------------------------
proc PasswdDlg::_verifonlogin { path labpass } {
Dialog::enddialog $path 0
}
# -----------------------------------------------------------------------------
# Command PasswdDlg::_verifonpasswd
# -----------------------------------------------------------------------------
proc PasswdDlg::_verifonpasswd { path labpass } {
if {[string equal [$labpass cget -state] "disabled"]} {
Dialog::enddialog $path 0
} else {
focus $labpass
}
}
# -----------------------------------------------------------------------------
# Command PasswdDlg::_max
# -----------------------------------------------------------------------------
proc PasswdDlg::_max { val1 val2 } {
return [expr {($val1 > $val2) ? ($val1) : ($val2)}]
}
|