author | sandman <sandman> | 2002-12-22 23:59:13 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-12-22 23:59:13 (UTC) |
commit | c513f413c7d901cc9945714c8e7eb47292f63306 (patch) (unidiff) | |
tree | 9ce6af28225f006dffbeb536eb2fd520e903e08d /library/qpeapplication.h | |
parent | 5c7694a7baadec8afe128ad2541e0a8acfc23737 (diff) | |
download | opie-c513f413c7d901cc9945714c8e7eb47292f63306.zip opie-c513f413c7d901cc9945714c8e7eb47292f63306.tar.gz opie-c513f413c7d901cc9945714c8e7eb47292f63306.tar.bz2 |
Totally reworked the key grabbing, which always had problems:
- applications get *all* key events now, as long as they have the focus
- an application decides if it has the keyboard grabbed or not
- if it's grabbed, the app consumes the key press
- if it's not grabbed and a F1-F29 key is pressed, the app sends a QCop
call to the launcher (deviceButtonPressed(...))
- when the launcher receives a QCop deviceButtonPressed it simply sends
the configured QCopEnvelope
- all "special" actions (like menu, home) are now accessible via QCop
calls (see buttonsettings)
-rw-r--r-- | library/qpeapplication.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index f712077..7d956a3 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -1,160 +1,159 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef __QPE_APPLICATION_H__ | 20 | #ifndef __QPE_APPLICATION_H__ |
21 | #define __QPE_APPLICATION_H__ | 21 | #define __QPE_APPLICATION_H__ |
22 | 22 | ||
23 | 23 | ||
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include <qdialog.h> | 25 | #include <qdialog.h> |
26 | #if defined(_WS_QWS_) && !defined(Q_WS_QWS) | 26 | #if defined(_WS_QWS_) && !defined(Q_WS_QWS) |
27 | #define Q_WS_QWS | 27 | #define Q_WS_QWS |
28 | #endif | 28 | #endif |
29 | #include "qpedecoration_qws.h" | 29 | #include "qpedecoration_qws.h" |
30 | #include "timestring.h" | 30 | #include "timestring.h" |
31 | 31 | ||
32 | class QCopChannel; | 32 | class QCopChannel; |
33 | class QPEApplicationData; | 33 | class QPEApplicationData; |
34 | class QWSEvent; | 34 | class QWSEvent; |
35 | class QWSKeyEvent; | 35 | class QWSKeyEvent; |
36 | 36 | ||
37 | 37 | ||
38 | class QPEApplication : public QApplication | 38 | class QPEApplication : public QApplication |
39 | { | 39 | { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | public: | 41 | public: |
42 | QPEApplication( int& argc, char **argv, Type=GuiClient ); | 42 | QPEApplication( int& argc, char **argv, Type=GuiClient ); |
43 | ~QPEApplication(); | 43 | ~QPEApplication(); |
44 | 44 | ||
45 | static QString qpeDir(); | 45 | static QString qpeDir(); |
46 | static QString documentDir(); | 46 | static QString documentDir(); |
47 | void applyStyle(); | 47 | void applyStyle(); |
48 | static int defaultRotation(); | 48 | static int defaultRotation(); |
49 | static void setDefaultRotation(int r); | 49 | static void setDefaultRotation(int r); |
50 | static void grabKeyboard(); | 50 | static void grabKeyboard(); |
51 | static void ungrabKeyboard(); | 51 | static void ungrabKeyboard(); |
52 | 52 | ||
53 | enum StylusMode { | 53 | enum StylusMode { |
54 | LeftOnly, | 54 | LeftOnly, |
55 | RightOnHold | 55 | RightOnHold |
56 | // RightOnHoldLeftDelayed, etc. | 56 | // RightOnHoldLeftDelayed, etc. |
57 | }; | 57 | }; |
58 | static void setStylusOperation( QWidget*, StylusMode ); | 58 | static void setStylusOperation( QWidget*, StylusMode ); |
59 | static StylusMode stylusOperation( QWidget* ); | 59 | static StylusMode stylusOperation( QWidget* ); |
60 | 60 | ||
61 | enum InputMethodHint { | 61 | enum InputMethodHint { |
62 | Normal, | 62 | Normal, |
63 | AlwaysOff, | 63 | AlwaysOff, |
64 | AlwaysOn | 64 | AlwaysOn |
65 | }; | 65 | }; |
66 | 66 | ||
67 | enum screenSaverHint { | 67 | enum screenSaverHint { |
68 | Disable = 0, | 68 | Disable = 0, |
69 | DisableLightOff = 1, | 69 | DisableLightOff = 1, |
70 | DisableSuspend = 2, | 70 | DisableSuspend = 2, |
71 | Enable = 100 | 71 | Enable = 100 |
72 | }; | 72 | }; |
73 | 73 | ||
74 | static void setInputMethodHint( QWidget *, InputMethodHint ); | 74 | static void setInputMethodHint( QWidget *, InputMethodHint ); |
75 | static InputMethodHint inputMethodHint( QWidget * ); | 75 | static InputMethodHint inputMethodHint( QWidget * ); |
76 | 76 | ||
77 | void showMainWidget( QWidget*, bool nomax=FALSE ); | 77 | void showMainWidget( QWidget*, bool nomax=FALSE ); |
78 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); | 78 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); |
79 | static void showDialog( QDialog*, bool nomax=FALSE ); | 79 | static void showDialog( QDialog*, bool nomax=FALSE ); |
80 | static int execDialog( QDialog*, bool nomax=FALSE ); | 80 | static int execDialog( QDialog*, bool nomax=FALSE ); |
81 | 81 | ||
82 | static void setKeepRunning(); | 82 | static void setKeepRunning(); |
83 | bool keepRunning() const; | 83 | bool keepRunning() const; |
84 | 84 | ||
85 | bool keyboardGrabbed() const; | 85 | bool keyboardGrabbed() const; |
86 | QString keyboardGrabbedBy ( ) const; | ||
87 | 86 | ||
88 | int exec(); | 87 | int exec(); |
89 | 88 | ||
90 | signals: | 89 | signals: |
91 | void clientMoused(); | 90 | void clientMoused(); |
92 | void timeChanged(); | 91 | void timeChanged(); |
93 | void clockChanged( bool pm ); | 92 | void clockChanged( bool pm ); |
94 | void micChanged( bool muted ); | 93 | void micChanged( bool muted ); |
95 | void volumeChanged( bool muted ); | 94 | void volumeChanged( bool muted ); |
96 | void appMessage( const QCString& msg, const QByteArray& data); | 95 | void appMessage( const QCString& msg, const QByteArray& data); |
97 | void weekChanged( bool startOnMonday ); | 96 | void weekChanged( bool startOnMonday ); |
98 | void dateFormatChanged( DateFormat ); | 97 | void dateFormatChanged( DateFormat ); |
99 | void flush(); | 98 | void flush(); |
100 | void reload(); | 99 | void reload(); |
101 | 100 | ||
102 | private slots: | 101 | private slots: |
103 | void systemMessage( const QCString &msg, const QByteArray &data ); | 102 | void systemMessage( const QCString &msg, const QByteArray &data ); |
104 | void pidMessage( const QCString &msg, const QByteArray &data ); | 103 | void pidMessage( const QCString &msg, const QByteArray &data ); |
105 | void removeSenderFromStylusDict(); | 104 | void removeSenderFromStylusDict(); |
106 | void hideOrQuit(); | 105 | void hideOrQuit(); |
107 | 106 | ||
108 | protected: | 107 | protected: |
109 | bool qwsEventFilter( QWSEvent * ); | 108 | bool qwsEventFilter( QWSEvent * ); |
110 | void internalSetStyle( const QString &style ); | 109 | void internalSetStyle( const QString &style ); |
111 | void prepareForTermination(bool willrestart); | 110 | void prepareForTermination(bool willrestart); |
112 | virtual void restart(); | 111 | virtual void restart(); |
113 | virtual void shutdown(); | 112 | virtual void shutdown(); |
114 | bool eventFilter( QObject *, QEvent * ); | 113 | bool eventFilter( QObject *, QEvent * ); |
115 | void timerEvent( QTimerEvent * ); | 114 | void timerEvent( QTimerEvent * ); |
116 | bool raiseAppropriateWindow(); | 115 | bool raiseAppropriateWindow(); |
117 | virtual void tryQuit(); | 116 | virtual void tryQuit(); |
118 | 117 | ||
119 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) | 118 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) |
120 | 119 | ||
121 | private: | 120 | private: |
122 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); | 121 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); |
123 | 122 | ||
124 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 123 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
125 | QCopChannel *sysChannel; | 124 | QCopChannel *sysChannel; |
126 | QCopChannel *pidChannel; | 125 | QCopChannel *pidChannel; |
127 | #endif | 126 | #endif |
128 | QPEApplicationData *d; | 127 | QPEApplicationData *d; |
129 | 128 | ||
130 | bool reserved_sh; | 129 | bool reserved_sh; |
131 | 130 | ||
132 | 131 | ||
133 | 132 | ||
134 | }; | 133 | }; |
135 | 134 | ||
136 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) | 135 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) |
137 | { | 136 | { |
138 | QSize sh = d->sizeHint(); | 137 | QSize sh = d->sizeHint(); |
139 | int w = QMAX(sh.width(),d->width()); | 138 | int w = QMAX(sh.width(),d->width()); |
140 | int h = QMAX(sh.height(),d->height()); | 139 | int h = QMAX(sh.height(),d->height()); |
141 | if ( !nomax | 140 | if ( !nomax |
142 | && ( w > qApp->desktop()->width()*3/4 | 141 | && ( w > qApp->desktop()->width()*3/4 |
143 | || h > qApp->desktop()->height()*3/4 ) ) | 142 | || h > qApp->desktop()->height()*3/4 ) ) |
144 | { | 143 | { |
145 | d->showMaximized(); | 144 | d->showMaximized(); |
146 | } else { | 145 | } else { |
147 | d->resize(w,h); | 146 | d->resize(w,h); |
148 | d->show(); | 147 | d->show(); |
149 | } | 148 | } |
150 | } | 149 | } |
151 | 150 | ||
152 | inline int QPEApplication::execDialog( QDialog* d, bool nomax ) | 151 | inline int QPEApplication::execDialog( QDialog* d, bool nomax ) |
153 | { | 152 | { |
154 | showDialog(d,nomax); | 153 | showDialog(d,nomax); |
155 | return d->exec(); | 154 | return d->exec(); |
156 | } | 155 | } |
157 | 156 | ||
158 | 157 | ||
159 | #endif | 158 | #endif |
160 | 159 | ||