author | zecke <zecke> | 2002-09-10 12:09:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-10 12:09:49 (UTC) |
commit | 6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4 (patch) (unidiff) | |
tree | 6ebc93c6432f4ed9d00ef1448b6a047ef522a79a /library/qpeapplication.h | |
parent | d10cddb3c9ce75bc90b14add14bc133737fe35aa (diff) | |
download | opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.zip opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.gz opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.bz2 |
Qtopia1-6 merge
still to test
bic changes to be resolved
more changes to be made?
-rw-r--r-- | library/qpeapplication.h | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 23606db..2515f1b 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -1,130 +1,156 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of 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 | #if defined(_WS_QWS_) && !defined(Q_WS_QWS) | 26 | #if defined(_WS_QWS_) && !defined(Q_WS_QWS) |
26 | #define Q_WS_QWS | 27 | #define Q_WS_QWS |
27 | #endif | 28 | #endif |
28 | #include "qpedecoration_qws.h" | 29 | #include "qpedecoration_qws.h" |
29 | #include "timestring.h" | 30 | #include "timestring.h" |
30 | 31 | ||
31 | class QCopChannel; | 32 | class QCopChannel; |
32 | class QPEApplicationData; | 33 | class QPEApplicationData; |
33 | class QWSEvent; | 34 | class QWSEvent; |
34 | class QWSKeyEvent; | 35 | class QWSKeyEvent; |
35 | 36 | ||
36 | class QPEApplication : public QApplication | 37 | class QPEApplication : public QApplication |
37 | { | 38 | { |
38 | Q_OBJECT | 39 | Q_OBJECT |
39 | public: | 40 | public: |
40 | QPEApplication( int& argc, char **argv, Type=GuiClient ); | 41 | QPEApplication( int& argc, char **argv, Type=GuiClient ); |
41 | ~QPEApplication(); | 42 | ~QPEApplication(); |
42 | 43 | ||
43 | static QString qpeDir(); | 44 | static QString qpeDir(); |
44 | static QString documentDir(); | 45 | static QString documentDir(); |
45 | void applyStyle(); | 46 | void applyStyle(); |
46 | static int defaultRotation(); | 47 | static int defaultRotation(); |
47 | static void setDefaultRotation(int r); | 48 | static void setDefaultRotation(int r); |
48 | static void grabKeyboard(); | 49 | static void grabKeyboard(); |
49 | static void ungrabKeyboard(); | 50 | static void ungrabKeyboard(); |
50 | 51 | ||
51 | enum StylusMode { | 52 | enum StylusMode { |
52 | LeftOnly, | 53 | LeftOnly, |
53 | RightOnHold | 54 | RightOnHold |
54 | // RightOnHoldLeftDelayed, etc. | 55 | // RightOnHoldLeftDelayed, etc. |
55 | }; | 56 | }; |
56 | static void setStylusOperation( QWidget*, StylusMode ); | 57 | static void setStylusOperation( QWidget*, StylusMode ); |
57 | static StylusMode stylusOperation( QWidget* ); | 58 | static StylusMode stylusOperation( QWidget* ); |
58 | 59 | ||
59 | enum InputMethodHint { | 60 | enum InputMethodHint { |
60 | Normal, | 61 | Normal, |
61 | AlwaysOff, | 62 | AlwaysOff, |
62 | AlwaysOn | 63 | AlwaysOn |
63 | }; | 64 | }; |
64 | 65 | ||
65 | enum screenSaverHint { | 66 | enum screenSaverHint { |
66 | Disable = 0, | 67 | Disable = 0, |
67 | DisableLightOff = 1, | 68 | DisableLightOff = 1, |
68 | DisableSuspend = 2, | 69 | DisableSuspend = 2, |
69 | Enable = 100 | 70 | Enable = 100 |
70 | }; | 71 | }; |
71 | 72 | ||
72 | static void setInputMethodHint( QWidget *, InputMethodHint ); | 73 | static void setInputMethodHint( QWidget *, InputMethodHint ); |
73 | static InputMethodHint inputMethodHint( QWidget * ); | 74 | static InputMethodHint inputMethodHint( QWidget * ); |
74 | 75 | ||
75 | void showMainWidget( QWidget*, bool nomax=FALSE ); | 76 | void showMainWidget( QWidget*, bool nomax=FALSE ); |
76 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); | 77 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); |
78 | static void showDialog( QDialog*, bool nomax=FALSE ); | ||
79 | static int execDialog( QDialog*, bool nomax=FALSE ); | ||
77 | 80 | ||
78 | static void setKeepRunning(); | 81 | static void setKeepRunning(); |
79 | bool keepRunning() const; | 82 | bool keepRunning() const; |
80 | 83 | ||
84 | bool keyboardGrabbed() const; | ||
85 | |||
81 | int exec(); | 86 | int exec(); |
82 | 87 | ||
83 | signals: | 88 | signals: |
84 | void clientMoused(); | 89 | void clientMoused(); |
85 | void timeChanged(); | 90 | void timeChanged(); |
86 | void clockChanged( bool pm ); | 91 | void clockChanged( bool pm ); |
92 | void micChanged( bool muted ); | ||
87 | void volumeChanged( bool muted ); | 93 | void volumeChanged( bool muted ); |
88 | void micChanged( bool muted ); | ||
89 | void appMessage( const QCString& msg, const QByteArray& data); | 94 | void appMessage( const QCString& msg, const QByteArray& data); |
90 | void weekChanged( bool startOnMonday ); | 95 | void weekChanged( bool startOnMonday ); |
91 | void dateFormatChanged( DateFormat ); | 96 | void dateFormatChanged( DateFormat ); |
92 | void flush(); | 97 | void flush(); |
93 | void reload(); | 98 | void reload(); |
94 | 99 | ||
95 | private slots: | 100 | private slots: |
96 | void systemMessage( const QCString &msg, const QByteArray &data ); | 101 | void systemMessage( const QCString &msg, const QByteArray &data ); |
97 | void pidMessage( const QCString &msg, const QByteArray &data ); | 102 | void pidMessage( const QCString &msg, const QByteArray &data ); |
98 | void removeSenderFromStylusDict(); | 103 | void removeSenderFromStylusDict(); |
99 | void hideOrQuit(); | 104 | void hideOrQuit(); |
100 | 105 | ||
101 | protected: | 106 | protected: |
102 | bool qwsEventFilter( QWSEvent * ); | 107 | bool qwsEventFilter( QWSEvent * ); |
103 | void internalSetStyle( const QString &style ); | 108 | void internalSetStyle( const QString &style ); |
104 | void prepareForTermination(bool willrestart); | 109 | void prepareForTermination(bool willrestart); |
105 | virtual void restart(); | 110 | virtual void restart(); |
106 | virtual void shutdown(); | 111 | virtual void shutdown(); |
107 | bool eventFilter( QObject *, QEvent * ); | 112 | bool eventFilter( QObject *, QEvent * ); |
108 | void timerEvent( QTimerEvent * ); | 113 | void timerEvent( QTimerEvent * ); |
109 | bool keyboardGrabbed() const; | ||
110 | bool raiseAppropriateWindow(); | 114 | bool raiseAppropriateWindow(); |
111 | virtual void tryQuit(); | 115 | virtual void tryQuit(); |
112 | 116 | ||
113 | private: | 117 | private: |
114 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); | 118 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); |
115 | 119 | ||
116 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 120 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
117 | QCopChannel *sysChannel; | 121 | QCopChannel *sysChannel; |
118 | QCopChannel *pidChannel; | 122 | QCopChannel *pidChannel; |
119 | #endif | 123 | #endif |
120 | QPEApplicationData *d; | 124 | QPEApplicationData *d; |
121 | 125 | ||
122 | bool reserved_sh; | 126 | bool reserved_sh; |
123 | 127 | ||
124 | 128 | ||
125 | 129 | ||
126 | }; | 130 | }; |
127 | 131 | ||
132 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) | ||
133 | { | ||
134 | QSize sh = d->sizeHint(); | ||
135 | int w = QMAX(sh.width(),d->width()); | ||
136 | int h = QMAX(sh.height(),d->height()); | ||
137 | if ( !nomax | ||
138 | && ( w > qApp->desktop()->width()*3/4 | ||
139 | || h > qApp->desktop()->height()*3/4 ) ) | ||
140 | { | ||
141 | d->showMaximized(); | ||
142 | } else { | ||
143 | d->resize(w,h); | ||
144 | d->show(); | ||
145 | } | ||
146 | } | ||
147 | |||
148 | inline int QPEApplication::execDialog( QDialog* d, bool nomax ) | ||
149 | { | ||
150 | showDialog(d,nomax); | ||
151 | return d->exec(); | ||
152 | } | ||
153 | |||
128 | 154 | ||
129 | #endif | 155 | #endif |
130 | 156 | ||