Diffstat (limited to 'noncore/securityplugins/pin/pin.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/securityplugins/pin/pin.cpp | 61 |
1 files changed, 51 insertions, 10 deletions
diff --git a/noncore/securityplugins/pin/pin.cpp b/noncore/securityplugins/pin/pin.cpp index 2accb9c..f1c52c5 100644 --- a/noncore/securityplugins/pin/pin.cpp +++ b/noncore/securityplugins/pin/pin.cpp | |||
@@ -79,2 +79,8 @@ signals: | |||
79 | QString text; | 79 | QString text; |
80 | |||
81 | private slots: | ||
82 | void slotInput(); | ||
83 | void slotSkip(); | ||
84 | void slotOK(); | ||
85 | void slotBackspace(); | ||
80 | }; | 86 | }; |
@@ -96,2 +102,15 @@ PinDialog::PinDialog( QWidget* parent, const char* name, WFlags fl ) | |||
96 | 102 | ||
103 | connect ( button_0, SIGNAL( clicked()), SLOT( slotInput())); | ||
104 | connect ( button_1, SIGNAL( clicked()), SLOT( slotInput())); | ||
105 | connect ( button_2, SIGNAL( clicked()), SLOT( slotInput())); | ||
106 | connect ( button_3, SIGNAL( clicked()), SLOT( slotInput())); | ||
107 | connect ( button_4, SIGNAL( clicked()), SLOT( slotInput())); | ||
108 | connect ( button_5, SIGNAL( clicked()), SLOT( slotInput())); | ||
109 | connect ( button_6, SIGNAL( clicked()), SLOT( slotInput())); | ||
110 | connect ( button_7, SIGNAL( clicked()), SLOT( slotInput())); | ||
111 | connect ( button_8, SIGNAL( clicked()), SLOT( slotInput())); | ||
112 | connect ( button_9, SIGNAL( clicked()), SLOT( slotInput())); | ||
113 | connect ( button_Skip, SIGNAL( clicked()), SLOT( slotSkip())); | ||
114 | connect ( button_OK, SIGNAL( clicked()), SLOT( slotOK())); | ||
115 | |||
97 | button_0->installEventFilter( this ); | 116 | button_0->installEventFilter( this ); |
@@ -108,3 +127,3 @@ PinDialog::PinDialog( QWidget* parent, const char* name, WFlags fl ) | |||
108 | button_OK->installEventFilter( this ); | 127 | button_OK->installEventFilter( this ); |
109 | setFocus(); | 128 | button_OK->setFocus(); |
110 | } | 129 | } |
@@ -117,10 +136,26 @@ PinDialog::~PinDialog() | |||
117 | 136 | ||
118 | /// Record the pressed numbers, and the Skip and Enter commands | 137 | /// Handle keyboard events |
119 | bool PinDialog::eventFilter( QObject*o, QEvent*e ) | 138 | bool PinDialog::eventFilter( QObject*o, QEvent*e ) |
120 | { | 139 | { |
121 | if ( e->type() == QEvent::MouseButtonRelease ) { | 140 | if(e->type() == QEvent::KeyPress) { |
122 | if ( o == button_OK ) { | 141 | switch(((QKeyEvent *)e)->key()) { |
123 | emit passwordEntered( text ); | 142 | case Key_0...Key_9: |
143 | input(((QKeyEvent *)e)->text()); | ||
144 | return TRUE; | ||
145 | case Key_Backspace: | ||
146 | slotBackspace(); | ||
147 | return TRUE; | ||
148 | } | ||
149 | } | ||
150 | return FALSE; | ||
151 | } | ||
152 | |||
153 | void PinDialog::slotInput() | ||
154 | { | ||
155 | QPushButton *l = (QPushButton*)sender(); | ||
156 | input(l->text().stripWhiteSpace()); | ||
124 | } | 157 | } |
125 | else if ( o == button_Skip ) { | 158 | |
159 | void PinDialog::slotSkip() | ||
160 | { | ||
126 | isSkip = TRUE; | 161 | isSkip = TRUE; |
@@ -128,8 +163,14 @@ bool PinDialog::eventFilter( QObject*o, QEvent*e ) | |||
128 | } | 163 | } |
129 | else { | 164 | |
130 | QLabel *l = (QLabel*)o; | 165 | void PinDialog::slotOK() |
131 | input(l->text()); | 166 | { |
167 | emit passwordEntered( text ); | ||
132 | } | 168 | } |
169 | |||
170 | void PinDialog::slotBackspace() | ||
171 | { | ||
172 | if(text.length() > 0) { | ||
173 | text.truncate( text.length() - 1 ); | ||
174 | display->setText( text ); | ||
133 | } | 175 | } |
134 | return FALSE; | ||
135 | } | 176 | } |