-rw-r--r-- | core/launcher/desktop.cpp | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 7662e48..24dce73 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -173,56 +173,62 @@ void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) | |||
173 | stream >> m; | 173 | stream >> m; |
174 | 174 | ||
175 | qWarning("KeyRegisterReceived: %i, %s, %s", k, (const char*)c, (const char *)m ); | 175 | qWarning("KeyRegisterReceived: %i, %s, %s", k, (const char*)c, (const char *)m ); |
176 | keyRegisterList.append(QCopKeyRegister(k,c,m)); | 176 | keyRegisterList.append(QCopKeyRegister(k,c,m)); |
177 | } | 177 | } |
178 | else if (msg == "suspend()"){ | 178 | else if (msg == "suspend()"){ |
179 | emit power(); | 179 | emit power(); |
180 | } | 180 | } |
181 | 181 | ||
182 | } | 182 | } |
183 | 183 | ||
184 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; | 184 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; |
185 | 185 | ||
186 | #ifdef Q_WS_QWS | 186 | #ifdef Q_WS_QWS |
187 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 187 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
188 | { | 188 | { |
189 | qpedesktop->checkMemory(); | 189 | qpedesktop->checkMemory(); |
190 | 190 | ||
191 | if ( e->type == QWSEvent::Key ) { | 191 | if ( e->type == QWSEvent::Key ) { |
192 | QWSKeyEvent *ke = (QWSKeyEvent *)e; | 192 | QWSKeyEvent *ke = (QWSKeyEvent *)e; |
193 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) | 193 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) |
194 | return TRUE; | 194 | return TRUE; |
195 | bool press = ke->simpleData.is_press; | 195 | bool press = ke->simpleData.is_press; |
196 | bool autoRepeat= ke->simpleData.is_auto_repeat; | 196 | bool autoRepeat= ke->simpleData.is_auto_repeat; |
197 | if (!keyRegisterList.isEmpty()) | 197 | |
198 | { | 198 | /* |
199 | app that registers key/message to be sent back to the app, when it doesn't have focus, | ||
200 | when user presses key, unless keyboard has been requested from app. | ||
201 | will not send multiple repeats if user holds key | ||
202 | i.e. one shot | ||
203 | |||
204 | */ | ||
205 | if (!keyRegisterList.isEmpty()) { | ||
199 | KeyRegisterList::Iterator it; | 206 | KeyRegisterList::Iterator it; |
200 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) | 207 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { |
201 | { | 208 | if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat && !keyboardGrabbed()) { |
202 | if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat) { | 209 | if(press) qDebug("press"); else qDebug("release"); |
203 | if(press) qDebug("press"); else qDebug("release"); | 210 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); |
204 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); | ||
205 | } | 211 | } |
206 | } | 212 | } |
207 | } | 213 | } |
208 | 214 | ||
209 | if ( !keyboardGrabbed() ) { | 215 | if ( !keyboardGrabbed() ) { |
210 | if ( ke->simpleData.keycode == Key_F9 ) { | 216 | if ( ke->simpleData.keycode == Key_F9 ) { |
211 | if ( press ) emit datebook(); | 217 | if ( press ) emit datebook(); |
212 | return TRUE; | 218 | return TRUE; |
213 | } | 219 | } |
214 | if ( ke->simpleData.keycode == Key_F10 ) { | 220 | if ( ke->simpleData.keycode == Key_F10 ) { |
215 | if ( !press && cardSendTimer ) { | 221 | if ( !press && cardSendTimer ) { |
216 | emit contacts(); | 222 | emit contacts(); |
217 | delete cardSendTimer; | 223 | delete cardSendTimer; |
218 | } else if ( press ) { | 224 | } else if ( press ) { |
219 | cardSendTimer = new QTimer(); | 225 | cardSendTimer = new QTimer(); |
220 | cardSendTimer->start( 2000, TRUE ); | 226 | cardSendTimer->start( 2000, TRUE ); |
221 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); | 227 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); |
222 | } | 228 | } |
223 | return TRUE; | 229 | return TRUE; |
224 | } | 230 | } |
225 | /* menu key now opens application menu/toolbar | 231 | /* menu key now opens application menu/toolbar |
226 | if ( ke->simpleData.keycode == Key_F11 ) { | 232 | if ( ke->simpleData.keycode == Key_F11 ) { |
227 | if ( press ) emit menu(); | 233 | if ( press ) emit menu(); |
228 | return TRUE; | 234 | return TRUE; |
@@ -729,56 +735,56 @@ void Desktop::timerEvent( QTimerEvent *e ) | |||
729 | 735 | ||
730 | void Desktop::terminateServers() | 736 | void Desktop::terminateServers() |
731 | { | 737 | { |
732 | delete transferServer; | 738 | delete transferServer; |
733 | delete qcopBridge; | 739 | delete qcopBridge; |
734 | transferServer = 0; | 740 | transferServer = 0; |
735 | qcopBridge = 0; | 741 | qcopBridge = 0; |
736 | } | 742 | } |
737 | 743 | ||
738 | void Desktop::rereadVolumes() | 744 | void Desktop::rereadVolumes() |
739 | { | 745 | { |
740 | Config cfg("qpe"); | 746 | Config cfg("qpe"); |
741 | cfg.setGroup("Volume"); | 747 | cfg.setGroup("Volume"); |
742 | touchclick = cfg.readBoolEntry("TouchSound"); | 748 | touchclick = cfg.readBoolEntry("TouchSound"); |
743 | keyclick = cfg.readBoolEntry("KeySound"); | 749 | keyclick = cfg.readBoolEntry("KeySound"); |
744 | alarmsound = cfg.readBoolEntry("AlarmSound"); | 750 | alarmsound = cfg.readBoolEntry("AlarmSound"); |
745 | // Config cfg("Sound"); | 751 | // Config cfg("Sound"); |
746 | // cfg.setGroup("System"); | 752 | // cfg.setGroup("System"); |
747 | // touchclick = cfg.readBoolEntry("Touch"); | 753 | // touchclick = cfg.readBoolEntry("Touch"); |
748 | // keyclick = cfg.readBoolEntry("Key"); | 754 | // keyclick = cfg.readBoolEntry("Key"); |
749 | } | 755 | } |
750 | 756 | ||
751 | void Desktop::keyClick() | 757 | void Desktop::keyClick() |
752 | { | 758 | { |
753 | if ( keyclick ) | 759 | if ( keyclick ) |
754 | ODevice::inst ( )-> keySound ( ); | 760 | ODevice::inst ( )-> keySound ( ); |
755 | } | 761 | } |
756 | 762 | ||
757 | void Desktop::screenClick() | 763 | void Desktop::screenClick() |
758 | { | 764 | { |
759 | if ( touchclick ) | 765 | if ( touchclick ) |
760 | ODevice::inst ( )-> touchSound ( ); | 766 | ODevice::inst ( )-> touchSound ( ); |
761 | } | 767 | } |
762 | 768 | ||
763 | void Desktop::soundAlarm() | 769 | void Desktop::soundAlarm() |
764 | { | 770 | { |
765 | if ( qpedesktop-> alarmsound ) | 771 | if ( qpedesktop-> alarmsound ) |
766 | ODevice::inst ( )-> alarmSound ( ); | 772 | ODevice::inst ( )-> alarmSound ( ); |
767 | } | 773 | } |
768 | 774 | ||
769 | bool Desktop::eventFilter( QObject *, QEvent *ev ) | 775 | bool Desktop::eventFilter( QObject *, QEvent *ev ) |
770 | { | 776 | { |
771 | if ( ev-> type ( ) == QEvent::KeyPress ) { | 777 | if ( ev-> type ( ) == QEvent::KeyPress ) { |
772 | QKeyEvent *ke = (QKeyEvent *) ev; | 778 | QKeyEvent *ke = (QKeyEvent *) ev; |
773 | if ( ke-> key ( ) == Qt::Key_F11 ) { // menu key | 779 | if ( ke-> key ( ) == Qt::Key_F11 ) { // menu key |
774 | QWidget *active = qApp-> activeWindow ( ); | 780 | QWidget *active = qApp-> activeWindow ( ); |
775 | 781 | ||
776 | if ( active && active-> isPopup ( )) | 782 | if ( active && active-> isPopup ( )) |
777 | active->close(); | 783 | active->close(); |
778 | 784 | ||
779 | raiseMenu ( ); | 785 | raiseMenu ( ); |
780 | return true; | 786 | return true; |
781 | } | 787 | } |
782 | } | 788 | } |
783 | return false; | 789 | return false; |
784 | } | 790 | } |