summaryrefslogtreecommitdiff
path: root/noncore/securityplugins/pin/pin.cpp
Unidiff
Diffstat (limited to 'noncore/securityplugins/pin/pin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/securityplugins/pin/pin.cpp67
1 files changed, 54 insertions, 13 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
@@ -78,4 +78,10 @@ signals:
78 friend class PinPlugin; 78 friend class PinPlugin;
79 QString text; 79 QString text;
80
81 private slots:
82 void slotInput();
83 void slotSkip();
84 void slotOK();
85 void slotBackspace();
80}; 86};
81 87
@@ -95,4 +101,17 @@ PinDialog::PinDialog( QWidget* parent, const char* name, WFlags fl )
95 } 101 }
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 );
98 button_1->installEventFilter( this ); 117 button_1->installEventFilter( this );
@@ -107,5 +126,5 @@ PinDialog::PinDialog( QWidget* parent, const char* name, WFlags fl )
107 button_Skip->installEventFilter( this ); 126 button_Skip->installEventFilter( this );
108 button_OK->installEventFilter( this ); 127 button_OK->installEventFilter( this );
109 setFocus(); 128 button_OK->setFocus();
110} 129}
111 130
@@ -116,18 +135,15 @@ PinDialog::~PinDialog()
116} 135}
117 136
118/// Record the pressed numbers, and the Skip and Enter commands 137/// Handle keyboard events
119bool PinDialog::eventFilter( QObject*o, QEvent*e ) 138bool 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:
124 } 143 input(((QKeyEvent *)e)->text());
125 else if ( o == button_Skip ) { 144 return TRUE;
126 isSkip = TRUE; 145 case Key_Backspace:
127 emit skip(); 146 slotBackspace();
128 } 147 return TRUE;
129 else {
130 QLabel *l = (QLabel*)o;
131 input(l->text());
132 } 148 }
133 } 149 }
@@ -135,4 +151,29 @@ bool PinDialog::eventFilter( QObject*o, QEvent*e )
135} 151}
136 152
153void PinDialog::slotInput()
154{
155 QPushButton *l = (QPushButton*)sender();
156 input(l->text().stripWhiteSpace());
157}
158
159void PinDialog::slotSkip()
160{
161 isSkip = TRUE;
162 emit skip();
163}
164
165void PinDialog::slotOK()
166{
167 emit passwordEntered( text );
168}
169
170void PinDialog::slotBackspace()
171{
172 if(text.length() > 0) {
173 text.truncate( text.length() - 1 );
174 display->setText( text );
175 }
176}
177
137void PinDialog::input( QString c ) 178void PinDialog::input( QString c )
138{ 179{