author | sandman <sandman> | 2002-12-17 00:20:01 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-12-17 00:20:01 (UTC) |
commit | 70090722d240bed8c390281e072c9bcfc5ba7782 (patch) (unidiff) | |
tree | 453b4715acff74889655877a491c6cc3791d5de0 /library/qpeapplication.h | |
parent | 79b94019014efe998b126219827f3050395beea7 (diff) | |
download | opie-70090722d240bed8c390281e072c9bcfc5ba7782.zip opie-70090722d240bed8c390281e072c9bcfc5ba7782.tar.gz opie-70090722d240bed8c390281e072c9bcfc5ba7782.tar.bz2 |
small additions to support grabbing the buttons back from a crashed
application
-rw-r--r-- | library/qpeapplication.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 86affa6..f712077 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -1,158 +1,160 @@ | |||
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 | class QPEApplication : public QApplication | 38 | class QPEApplication : public QApplication |
38 | { | 39 | { |
39 | Q_OBJECT | 40 | Q_OBJECT |
40 | public: | 41 | public: |
41 | QPEApplication( int& argc, char **argv, Type=GuiClient ); | 42 | QPEApplication( int& argc, char **argv, Type=GuiClient ); |
42 | ~QPEApplication(); | 43 | ~QPEApplication(); |
43 | 44 | ||
44 | static QString qpeDir(); | 45 | static QString qpeDir(); |
45 | static QString documentDir(); | 46 | static QString documentDir(); |
46 | void applyStyle(); | 47 | void applyStyle(); |
47 | static int defaultRotation(); | 48 | static int defaultRotation(); |
48 | static void setDefaultRotation(int r); | 49 | static void setDefaultRotation(int r); |
49 | static void grabKeyboard(); | 50 | static void grabKeyboard(); |
50 | static void ungrabKeyboard(); | 51 | static void ungrabKeyboard(); |
51 | 52 | ||
52 | enum StylusMode { | 53 | enum StylusMode { |
53 | LeftOnly, | 54 | LeftOnly, |
54 | RightOnHold | 55 | RightOnHold |
55 | // RightOnHoldLeftDelayed, etc. | 56 | // RightOnHoldLeftDelayed, etc. |
56 | }; | 57 | }; |
57 | static void setStylusOperation( QWidget*, StylusMode ); | 58 | static void setStylusOperation( QWidget*, StylusMode ); |
58 | static StylusMode stylusOperation( QWidget* ); | 59 | static StylusMode stylusOperation( QWidget* ); |
59 | 60 | ||
60 | enum InputMethodHint { | 61 | enum InputMethodHint { |
61 | Normal, | 62 | Normal, |
62 | AlwaysOff, | 63 | AlwaysOff, |
63 | AlwaysOn | 64 | AlwaysOn |
64 | }; | 65 | }; |
65 | 66 | ||
66 | enum screenSaverHint { | 67 | enum screenSaverHint { |
67 | Disable = 0, | 68 | Disable = 0, |
68 | DisableLightOff = 1, | 69 | DisableLightOff = 1, |
69 | DisableSuspend = 2, | 70 | DisableSuspend = 2, |
70 | Enable = 100 | 71 | Enable = 100 |
71 | }; | 72 | }; |
72 | 73 | ||
73 | static void setInputMethodHint( QWidget *, InputMethodHint ); | 74 | static void setInputMethodHint( QWidget *, InputMethodHint ); |
74 | static InputMethodHint inputMethodHint( QWidget * ); | 75 | static InputMethodHint inputMethodHint( QWidget * ); |
75 | 76 | ||
76 | void showMainWidget( QWidget*, bool nomax=FALSE ); | 77 | void showMainWidget( QWidget*, bool nomax=FALSE ); |
77 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); | 78 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); |
78 | static void showDialog( QDialog*, bool nomax=FALSE ); | 79 | static void showDialog( QDialog*, bool nomax=FALSE ); |
79 | static int execDialog( QDialog*, bool nomax=FALSE ); | 80 | static int execDialog( QDialog*, bool nomax=FALSE ); |
80 | 81 | ||
81 | static void setKeepRunning(); | 82 | static void setKeepRunning(); |
82 | bool keepRunning() const; | 83 | bool keepRunning() const; |
83 | 84 | ||
84 | bool keyboardGrabbed() const; | 85 | bool keyboardGrabbed() const; |
86 | QString keyboardGrabbedBy ( ) const; | ||
85 | 87 | ||
86 | int exec(); | 88 | int exec(); |
87 | 89 | ||
88 | signals: | 90 | signals: |
89 | void clientMoused(); | 91 | void clientMoused(); |
90 | void timeChanged(); | 92 | void timeChanged(); |
91 | void clockChanged( bool pm ); | 93 | void clockChanged( bool pm ); |
92 | void micChanged( bool muted ); | 94 | void micChanged( bool muted ); |
93 | void volumeChanged( bool muted ); | 95 | void volumeChanged( bool muted ); |
94 | void appMessage( const QCString& msg, const QByteArray& data); | 96 | void appMessage( const QCString& msg, const QByteArray& data); |
95 | void weekChanged( bool startOnMonday ); | 97 | void weekChanged( bool startOnMonday ); |
96 | void dateFormatChanged( DateFormat ); | 98 | void dateFormatChanged( DateFormat ); |
97 | void flush(); | 99 | void flush(); |
98 | void reload(); | 100 | void reload(); |
99 | 101 | ||
100 | private slots: | 102 | private slots: |
101 | void systemMessage( const QCString &msg, const QByteArray &data ); | 103 | void systemMessage( const QCString &msg, const QByteArray &data ); |
102 | void pidMessage( const QCString &msg, const QByteArray &data ); | 104 | void pidMessage( const QCString &msg, const QByteArray &data ); |
103 | void removeSenderFromStylusDict(); | 105 | void removeSenderFromStylusDict(); |
104 | void hideOrQuit(); | 106 | void hideOrQuit(); |
105 | 107 | ||
106 | protected: | 108 | protected: |
107 | bool qwsEventFilter( QWSEvent * ); | 109 | bool qwsEventFilter( QWSEvent * ); |
108 | void internalSetStyle( const QString &style ); | 110 | void internalSetStyle( const QString &style ); |
109 | void prepareForTermination(bool willrestart); | 111 | void prepareForTermination(bool willrestart); |
110 | virtual void restart(); | 112 | virtual void restart(); |
111 | virtual void shutdown(); | 113 | virtual void shutdown(); |
112 | bool eventFilter( QObject *, QEvent * ); | 114 | bool eventFilter( QObject *, QEvent * ); |
113 | void timerEvent( QTimerEvent * ); | 115 | void timerEvent( QTimerEvent * ); |
114 | bool raiseAppropriateWindow(); | 116 | bool raiseAppropriateWindow(); |
115 | virtual void tryQuit(); | 117 | virtual void tryQuit(); |
116 | 118 | ||
117 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) | 119 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) |
118 | 120 | ||
119 | private: | 121 | private: |
120 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); | 122 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); |
121 | 123 | ||
122 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 124 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
123 | QCopChannel *sysChannel; | 125 | QCopChannel *sysChannel; |
124 | QCopChannel *pidChannel; | 126 | QCopChannel *pidChannel; |
125 | #endif | 127 | #endif |
126 | QPEApplicationData *d; | 128 | QPEApplicationData *d; |
127 | 129 | ||
128 | bool reserved_sh; | 130 | bool reserved_sh; |
129 | 131 | ||
130 | 132 | ||
131 | 133 | ||
132 | }; | 134 | }; |
133 | 135 | ||
134 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) | 136 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) |
135 | { | 137 | { |
136 | QSize sh = d->sizeHint(); | 138 | QSize sh = d->sizeHint(); |
137 | int w = QMAX(sh.width(),d->width()); | 139 | int w = QMAX(sh.width(),d->width()); |
138 | int h = QMAX(sh.height(),d->height()); | 140 | int h = QMAX(sh.height(),d->height()); |
139 | if ( !nomax | 141 | if ( !nomax |
140 | && ( w > qApp->desktop()->width()*3/4 | 142 | && ( w > qApp->desktop()->width()*3/4 |
141 | || h > qApp->desktop()->height()*3/4 ) ) | 143 | || h > qApp->desktop()->height()*3/4 ) ) |
142 | { | 144 | { |
143 | d->showMaximized(); | 145 | d->showMaximized(); |
144 | } else { | 146 | } else { |
145 | d->resize(w,h); | 147 | d->resize(w,h); |
146 | d->show(); | 148 | d->show(); |
147 | } | 149 | } |
148 | } | 150 | } |
149 | 151 | ||
150 | inline int QPEApplication::execDialog( QDialog* d, bool nomax ) | 152 | inline int QPEApplication::execDialog( QDialog* d, bool nomax ) |
151 | { | 153 | { |
152 | showDialog(d,nomax); | 154 | showDialog(d,nomax); |
153 | return d->exec(); | 155 | return d->exec(); |
154 | } | 156 | } |
155 | 157 | ||
156 | 158 | ||
157 | #endif | 159 | #endif |
158 | 160 | ||