-rw-r--r-- | library/qpeapplication.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 4d0b0ea..98af70a 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -9,32 +9,33 @@ | |||
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 | #define QTOPIA_INTERNAL_LANGLIST | 20 | #define QTOPIA_INTERNAL_LANGLIST |
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | #include <unistd.h> | 22 | #include <unistd.h> |
23 | #include <linux/limits.h> // needed for some toolchains (PATH_MAX) | 23 | #include <linux/limits.h> // needed for some toolchains (PATH_MAX) |
24 | #include <qfile.h> | 24 | #include <qfile.h> |
25 | #include <qqueue.h> | ||
25 | #ifdef Q_WS_QWS | 26 | #ifdef Q_WS_QWS |
26 | #ifndef QT_NO_COP | 27 | #ifndef QT_NO_COP |
27 | #if QT_VERSION <= 231 | 28 | #if QT_VERSION <= 231 |
28 | #define private public | 29 | #define private public |
29 | #define sendLocally processEvent | 30 | #define sendLocally processEvent |
30 | #include "qcopenvelope_qws.h" | 31 | #include "qcopenvelope_qws.h" |
31 | #undef private | 32 | #undef private |
32 | #else | 33 | #else |
33 | #include "qcopenvelope_qws.h" | 34 | #include "qcopenvelope_qws.h" |
34 | #endif | 35 | #endif |
35 | #endif | 36 | #endif |
36 | #include <qwindowsystem_qws.h> | 37 | #include <qwindowsystem_qws.h> |
37 | #endif | 38 | #endif |
38 | #include <qtextstream.h> | 39 | #include <qtextstream.h> |
39 | #include <qpalette.h> | 40 | #include <qpalette.h> |
40 | #include <qbuffer.h> | 41 | #include <qbuffer.h> |
@@ -87,87 +88,88 @@ | |||
87 | #include <unistd.h> | 88 | #include <unistd.h> |
88 | #include <sys/file.h> | 89 | #include <sys/file.h> |
89 | #include <sys/ioctl.h> | 90 | #include <sys/ioctl.h> |
90 | #include <sys/soundcard.h> | 91 | #include <sys/soundcard.h> |
91 | 92 | ||
92 | #include "qt_override_p.h" | 93 | #include "qt_override_p.h" |
93 | 94 | ||
94 | 95 | ||
95 | class QPEApplicationData | 96 | class QPEApplicationData |
96 | { | 97 | { |
97 | public: | 98 | public: |
98 | QPEApplicationData ( ) | 99 | QPEApplicationData ( ) |
99 | : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), | 100 | : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), |
100 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), | 101 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), |
101 | keep_running( true ), qpe_main_widget( 0 ), qcopQok( false ) | 102 | keep_running( true ), qpe_main_widget( 0 ), qcopQok( false ) |
102 | 103 | ||
103 | { | 104 | {} |
104 | qcopq.setAutoDelete( TRUE ); | ||
105 | } | ||
106 | 105 | ||
107 | int presstimer; | 106 | int presstimer; |
108 | QWidget* presswidget; | 107 | QWidget* presswidget; |
109 | QPoint presspos; | 108 | QPoint presspos; |
110 | 109 | ||
111 | bool rightpressed : 1; | 110 | bool rightpressed : 1; |
112 | bool kbgrabbed : 1; | 111 | bool kbgrabbed : 1; |
113 | bool notbusysent : 1; | 112 | bool notbusysent : 1; |
114 | bool preloaded : 1; | 113 | bool preloaded : 1; |
115 | bool forceshow : 1; | 114 | bool forceshow : 1; |
116 | bool nomaximize : 1; | 115 | bool nomaximize : 1; |
117 | bool qcopQok : 1; | 116 | bool qcopQok : 1; |
118 | bool keep_running : 1; | 117 | bool keep_running : 1; |
119 | 118 | ||
120 | 119 | ||
121 | QStringList langs; | 120 | QStringList langs; |
122 | QString appName; | 121 | QString appName; |
123 | struct QCopRec | 122 | struct QCopRec |
124 | { | 123 | { |
125 | QCopRec( const QCString &ch, const QCString &msg, | 124 | QCopRec( const QCString &ch, const QCString &msg, |
126 | const QByteArray &d ) : | 125 | const QByteArray &d ) : |
127 | channel( ch ), message( msg ), data( d ) | 126 | channel( ch ), message( msg ), data( d ) |
128 | { } | 127 | { } |
129 | 128 | ||
130 | QCString channel; | 129 | QCString channel; |
131 | QCString message; | 130 | QCString message; |
132 | QByteArray data; | 131 | QByteArray data; |
133 | }; | 132 | }; |
134 | QWidget* qpe_main_widget; | 133 | QWidget* qpe_main_widget; |
135 | QGuardedPtr<QWidget> lastraised; | 134 | QGuardedPtr<QWidget> lastraised; |
136 | QList<QCopRec> qcopq; | 135 | QQueue<QCopRec> qcopq; |
137 | QString styleName; | 136 | QString styleName; |
138 | QString decorationName; | 137 | QString decorationName; |
139 | 138 | ||
140 | void enqueueQCop( const QCString &ch, const QCString &msg, | 139 | void enqueueQCop( const QCString &ch, const QCString &msg, |
141 | const QByteArray &data ) | 140 | const QByteArray &data ) |
142 | { | 141 | { |
143 | qcopq.append( new QCopRec( ch, msg, data ) ); | 142 | qcopq.enqueue( new QCopRec( ch, msg, data ) ); |
144 | } | 143 | } |
145 | void sendQCopQ() | 144 | void sendQCopQ() |
146 | { | 145 | { |
147 | if (!qcopQok ) | 146 | if (!qcopQok ) |
148 | return; | 147 | return; |
149 | 148 | ||
150 | QCopRec * r; | 149 | QCopRec * r; |
151 | #ifndef QT_NO_COP | 150 | #ifndef QT_NO_COP |
152 | 151 | while((r=qcopq.dequeue())) { | |
153 | for ( QListIterator<QCopRec> it( qcopq ); ( r = it.current() ); ++it ) | 152 | // remove from queue before sending... |
154 | QCopChannel::sendLocally( r->channel, r->message, r->data ); | 153 | // event loop can come around again before getting |
154 | // back from sendLocally | ||
155 | QCopChannel::sendLocally( r->channel, r->message, r->data ); | ||
155 | #endif | 156 | #endif |
156 | 157 | ||
157 | qcopq.clear(); | 158 | delete r; |
159 | } | ||
158 | } | 160 | } |
159 | static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null ) | 161 | static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null ) |
160 | { | 162 | { |
161 | 163 | ||
162 | // ugly hack, remove that later after finding a sane solution | 164 | // ugly hack, remove that later after finding a sane solution |
163 | // Addendum: Only Sharp currently has models with high resolution but (physically) small displays, | 165 | // Addendum: Only Sharp currently has models with high resolution but (physically) small displays, |
164 | // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has | 166 | // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has |
165 | // a (physically) large enough display to use the small icons | 167 | // a (physically) large enough display to use the small icons |
166 | #ifndef QT_QWS_SIMPAD | 168 | #ifndef QT_QWS_SIMPAD |
167 | if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { | 169 | if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { |
168 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); | 170 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); |
169 | } | 171 | } |
170 | #endif | 172 | #endif |
171 | 173 | ||
172 | if ( mw->layout() && mw->inherits("QDialog") ) { | 174 | if ( mw->layout() && mw->inherits("QDialog") ) { |
173 | QPEApplication::showDialog((QDialog*)mw, nomaximize); | 175 | QPEApplication::showDialog((QDialog*)mw, nomaximize); |