-rw-r--r-- | core/apps/calibrate/opie-calibrate.control | 8 | ||||
-rw-r--r-- | core/launcher/desktop.cpp | 2 | ||||
-rw-r--r-- | core/launcher/launcher.pro | 4 | ||||
-rw-r--r-- | core/launcher/main.cpp | 15 | ||||
-rw-r--r-- | core/launcher/opie-taskbar.control | 4 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 17 | ||||
-rw-r--r-- | core/launcher/taskbar.h | 2 |
7 files changed, 32 insertions, 20 deletions
diff --git a/core/apps/calibrate/opie-calibrate.control b/core/apps/calibrate/opie-calibrate.control deleted file mode 100644 index 6eafb94..0000000 --- a/core/apps/calibrate/opie-calibrate.control +++ b/dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | Files: bin/calibrate apps/Settings/Calibrate.desktop | ||
2 | Priority: required | ||
3 | Section: opie/system | ||
4 | Maintainer: Project Opie <opie@handhelds.org> | ||
5 | Architecture: arm | ||
6 | Version: $QPE_VERSION-$SUB_VERSION.3 | ||
7 | Depends: libqpe1, libqt2-emb | ||
8 | Description: Opie calibration tool | ||
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index ef0bf4c..6def126 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -1,876 +1,878 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | 20 | ||
21 | #include <syslog.h> | 21 | #include <syslog.h> |
22 | 22 | ||
23 | #include "desktop.h" | 23 | #include "desktop.h" |
24 | #include "info.h" | 24 | #include "info.h" |
25 | #include "launcher.h" | 25 | #include "launcher.h" |
26 | #include "qcopbridge.h" | 26 | #include "qcopbridge.h" |
27 | #include "shutdownimpl.h" | 27 | #include "shutdownimpl.h" |
28 | #include "startmenu.h" | 28 | #include "startmenu.h" |
29 | #include "taskbar.h" | 29 | #include "taskbar.h" |
30 | #include "transferserver.h" | 30 | #include "transferserver.h" |
31 | #include "irserver.h" | 31 | #include "irserver.h" |
32 | #include "packageslave.h" | 32 | #include "packageslave.h" |
33 | #include "screensaver.h" | 33 | #include "screensaver.h" |
34 | 34 | ||
35 | #include <qpe/applnk.h> | 35 | #include <qpe/applnk.h> |
36 | #include <qpe/mimetype.h> | 36 | #include <qpe/mimetype.h> |
37 | #include <qpe/password.h> | 37 | #include <qpe/password.h> |
38 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
39 | #include <qpe/power.h> | 39 | #include <qpe/power.h> |
40 | #include <qpe/timeconversion.h> | 40 | #include <qpe/timeconversion.h> |
41 | #include <qpe/qcopenvelope_qws.h> | 41 | #include <qpe/qcopenvelope_qws.h> |
42 | #include <qpe/network.h> | 42 | #include <qpe/network.h> |
43 | #include <qpe/global.h> | 43 | #include <qpe/global.h> |
44 | 44 | ||
45 | #if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ ) | 45 | #if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ ) |
46 | #include <qpe/custom.h> | 46 | #include <qpe/custom.h> |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #include <opie/odevice.h> | 49 | #include <opie/odevice.h> |
50 | 50 | ||
51 | #include <qgfx_qws.h> | 51 | #include <qgfx_qws.h> |
52 | #include <qmainwindow.h> | 52 | #include <qmainwindow.h> |
53 | #include <qmessagebox.h> | 53 | #include <qmessagebox.h> |
54 | #include <qtimer.h> | 54 | #include <qtimer.h> |
55 | #include <qwindowsystem_qws.h> | 55 | #include <qwindowsystem_qws.h> |
56 | 56 | ||
57 | #include <qvaluelist.h> | 57 | #include <qvaluelist.h> |
58 | 58 | ||
59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
60 | #include <unistd.h> | 60 | #include <unistd.h> |
61 | #include <fcntl.h> | 61 | #include <fcntl.h> |
62 | 62 | ||
63 | 63 | ||
64 | using namespace Opie; | 64 | using namespace Opie; |
65 | 65 | ||
66 | class QCopKeyRegister | 66 | class QCopKeyRegister |
67 | { | 67 | { |
68 | public: | 68 | public: |
69 | QCopKeyRegister() : keyCode( 0 ) | 69 | QCopKeyRegister() : keyCode( 0 ) |
70 | { } | 70 | { } |
71 | QCopKeyRegister( int k, const QCString &c, const QCString &m ) | 71 | QCopKeyRegister( int k, const QCString &c, const QCString &m ) |
72 | : keyCode( k ), channel( c ), message( m ) | 72 | : keyCode( k ), channel( c ), message( m ) |
73 | { } | 73 | { } |
74 | 74 | ||
75 | int getKeyCode() const | 75 | int getKeyCode() const |
76 | { | 76 | { |
77 | return keyCode; | 77 | return keyCode; |
78 | } | 78 | } |
79 | QCString getChannel() const | 79 | QCString getChannel() const |
80 | { | 80 | { |
81 | return channel; | 81 | return channel; |
82 | } | 82 | } |
83 | QCString getMessage() const | 83 | QCString getMessage() const |
84 | { | 84 | { |
85 | return message; | 85 | return message; |
86 | } | 86 | } |
87 | 87 | ||
88 | private: | 88 | private: |
89 | int keyCode; | 89 | int keyCode; |
90 | QCString channel, message; | 90 | QCString channel, message; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | typedef QValueList<QCopKeyRegister> KeyRegisterList; | 93 | typedef QValueList<QCopKeyRegister> KeyRegisterList; |
94 | KeyRegisterList keyRegisterList; | 94 | KeyRegisterList keyRegisterList; |
95 | 95 | ||
96 | static Desktop* qpedesktop = 0; | 96 | static Desktop* qpedesktop = 0; |
97 | static int loggedin = 0; | 97 | static int loggedin = 0; |
98 | static void login( bool at_poweron ) | 98 | static void login( bool at_poweron ) |
99 | { | 99 | { |
100 | if ( !loggedin ) { | 100 | if ( !loggedin ) { |
101 | Global::terminateBuiltin( "calibrate" ); | ||
101 | Password::authenticate( at_poweron ); | 102 | Password::authenticate( at_poweron ); |
102 | loggedin = 1; | 103 | loggedin = 1; |
103 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); | 104 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); |
104 | } | 105 | } |
105 | } | 106 | } |
106 | 107 | ||
107 | bool Desktop::screenLocked() | 108 | bool Desktop::screenLocked() |
108 | { | 109 | { |
109 | return loggedin == 0; | 110 | return loggedin == 0; |
110 | } | 111 | } |
111 | 112 | ||
112 | /* | 113 | /* |
113 | Priority is number of alerts that are needed to pop up | 114 | Priority is number of alerts that are needed to pop up |
114 | alert. | 115 | alert. |
115 | */ | 116 | */ |
116 | class DesktopPowerAlerter : public QMessageBox | 117 | class DesktopPowerAlerter : public QMessageBox |
117 | { | 118 | { |
118 | public: | 119 | public: |
119 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) | 120 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) |
120 | : QMessageBox( tr( "Battery Status" ), "Low Battery", | 121 | : QMessageBox( tr( "Battery Status" ), "Low Battery", |
121 | QMessageBox::Critical, | 122 | QMessageBox::Critical, |
122 | QMessageBox::Ok | QMessageBox::Default, | 123 | QMessageBox::Ok | QMessageBox::Default, |
123 | QMessageBox::NoButton, QMessageBox::NoButton, | 124 | QMessageBox::NoButton, QMessageBox::NoButton, |
124 | parent, name, FALSE ) | 125 | parent, name, FALSE ) |
125 | { | 126 | { |
126 | currentPriority = INT_MAX; | 127 | currentPriority = INT_MAX; |
127 | alertCount = 0; | 128 | alertCount = 0; |
128 | } | 129 | } |
129 | 130 | ||
130 | void alert( const QString &text, int priority ); | 131 | void alert( const QString &text, int priority ); |
131 | void hideEvent( QHideEvent * ); | 132 | void hideEvent( QHideEvent * ); |
132 | private: | 133 | private: |
133 | int currentPriority; | 134 | int currentPriority; |
134 | int alertCount; | 135 | int alertCount; |
135 | }; | 136 | }; |
136 | 137 | ||
137 | void DesktopPowerAlerter::alert( const QString &text, int priority ) | 138 | void DesktopPowerAlerter::alert( const QString &text, int priority ) |
138 | { | 139 | { |
139 | alertCount++; | 140 | alertCount++; |
140 | if ( alertCount < priority ) | 141 | if ( alertCount < priority ) |
141 | return ; | 142 | return ; |
142 | if ( priority > currentPriority ) | 143 | if ( priority > currentPriority ) |
143 | return ; | 144 | return ; |
144 | currentPriority = priority; | 145 | currentPriority = priority; |
145 | setText( text ); | 146 | setText( text ); |
146 | show(); | 147 | show(); |
147 | } | 148 | } |
148 | 149 | ||
149 | 150 | ||
150 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) | 151 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) |
151 | { | 152 | { |
152 | QMessageBox::hideEvent( e ); | 153 | QMessageBox::hideEvent( e ); |
153 | alertCount = 0; | 154 | alertCount = 0; |
154 | currentPriority = INT_MAX; | 155 | currentPriority = INT_MAX; |
155 | } | 156 | } |
156 | 157 | ||
157 | 158 | ||
158 | void DesktopApplication::switchLCD ( bool on ) | 159 | void DesktopApplication::switchLCD ( bool on ) |
159 | { | 160 | { |
160 | if ( qApp ) { | 161 | if ( qApp ) { |
161 | DesktopApplication *dapp = (DesktopApplication *) qApp; | 162 | DesktopApplication *dapp = (DesktopApplication *) qApp; |
162 | 163 | ||
163 | if ( dapp-> m_screensaver ) { | 164 | if ( dapp-> m_screensaver ) { |
164 | if ( on ) { | 165 | if ( on ) { |
165 | dapp-> m_screensaver-> setDisplayState ( true ); | 166 | dapp-> m_screensaver-> setDisplayState ( true ); |
166 | dapp-> m_screensaver-> setBacklight ( -3 ); | 167 | dapp-> m_screensaver-> setBacklight ( -3 ); |
167 | } | 168 | } |
168 | else { | 169 | else { |
169 | dapp-> m_screensaver-> setDisplayState ( false ); | 170 | dapp-> m_screensaver-> setDisplayState ( false ); |
170 | } | 171 | } |
171 | } | 172 | } |
172 | } | 173 | } |
173 | } | 174 | } |
174 | 175 | ||
175 | 176 | ||
176 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) | 177 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) |
177 | : QPEApplication( argc, argv, appType ) | 178 | : QPEApplication( argc, argv, appType ) |
178 | { | 179 | { |
179 | m_ps = new PowerStatus; | 180 | m_ps = new PowerStatus; |
180 | m_ps_last = new PowerStatus; | 181 | m_ps_last = new PowerStatus; |
181 | pa = new DesktopPowerAlerter( 0 ); | 182 | pa = new DesktopPowerAlerter( 0 ); |
182 | 183 | ||
183 | m_apm_timer = new QTimer ( this ); | 184 | m_apm_timer = new QTimer ( this ); |
184 | connect ( m_apm_timer, SIGNAL( timeout ( )), this, SLOT( apmTimeout ( ))); | 185 | connect ( m_apm_timer, SIGNAL( timeout ( )), this, SLOT( apmTimeout ( ))); |
185 | reloadPowerWarnSettings ( ); | 186 | reloadPowerWarnSettings ( ); |
186 | 187 | ||
187 | m_last_button = 0; | 188 | m_last_button = 0; |
188 | m_button_timer = new QTimer ( ); | 189 | m_button_timer = new QTimer ( ); |
189 | connect ( m_button_timer, SIGNAL( timeout ( )), this, SLOT( sendHeldAction ( ))); | 190 | connect ( m_button_timer, SIGNAL( timeout ( )), this, SLOT( sendHeldAction ( ))); |
190 | 191 | ||
191 | channel = new QCopChannel( "QPE/System", this ); | 192 | channel = new QCopChannel( "QPE/System", this ); |
192 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), | 193 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), |
193 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); | 194 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); |
194 | 195 | ||
195 | channel = new QCopChannel( "QPE/Launcher", this ); | 196 | channel = new QCopChannel( "QPE/Launcher", this ); |
196 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), | 197 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), |
197 | this, SLOT( launcherMessage( const QCString&, const QByteArray& ) ) ); | 198 | this, SLOT( launcherMessage( const QCString&, const QByteArray& ) ) ); |
198 | 199 | ||
199 | m_screensaver = new OpieScreenSaver ( ); | 200 | m_screensaver = new OpieScreenSaver ( ); |
200 | m_screensaver-> setInterval ( -1 ); | 201 | m_screensaver-> setInterval ( -1 ); |
201 | QWSServer::setScreenSaver( m_screensaver ); | 202 | QWSServer::setScreenSaver( m_screensaver ); |
202 | 203 | ||
203 | rereadVolumes(); | 204 | rereadVolumes(); |
204 | connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); | 205 | connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); |
205 | 206 | ||
206 | apmTimeout ( ); | 207 | apmTimeout ( ); |
207 | 208 | ||
208 | grabKeyboard ( ); | 209 | grabKeyboard ( ); |
209 | } | 210 | } |
210 | 211 | ||
211 | 212 | ||
212 | DesktopApplication::~DesktopApplication() | 213 | DesktopApplication::~DesktopApplication() |
213 | { | 214 | { |
214 | ungrabKeyboard ( ); | 215 | ungrabKeyboard ( ); |
215 | 216 | ||
216 | delete m_ps; | 217 | delete m_ps; |
217 | delete m_ps_last; | 218 | delete m_ps_last; |
218 | delete pa; | 219 | delete pa; |
219 | } | 220 | } |
220 | 221 | ||
221 | void DesktopApplication::apmTimeout() | 222 | void DesktopApplication::apmTimeout() |
222 | { | 223 | { |
223 | qpedesktop-> checkMemory ( ); // in case no events are being generated | 224 | qpedesktop-> checkMemory ( ); // in case no events are being generated |
224 | 225 | ||
225 | *m_ps_last = *m_ps; | 226 | *m_ps_last = *m_ps; |
226 | *m_ps = PowerStatusManager::readStatus(); | 227 | *m_ps = PowerStatusManager::readStatus(); |
227 | 228 | ||
228 | if ( m_ps-> acStatus ( ) != m_ps_last-> acStatus ( )) | 229 | if ( m_ps-> acStatus ( ) != m_ps_last-> acStatus ( )) |
229 | m_screensaver-> powerStatusChanged ( *m_ps ); | 230 | m_screensaver-> powerStatusChanged ( *m_ps ); |
230 | 231 | ||
231 | if ( m_ps-> acStatus ( ) != PowerStatus::Online ) { | 232 | if ( m_ps-> acStatus ( ) != PowerStatus::Online ) { |
232 | int bat = m_ps-> batteryPercentRemaining ( ); | 233 | int bat = m_ps-> batteryPercentRemaining ( ); |
233 | 234 | ||
234 | if ( bat < m_ps_last-> batteryPercentRemaining ( )) { | 235 | if ( bat < m_ps_last-> batteryPercentRemaining ( )) { |
235 | if ( bat <= m_powerCritical ) | 236 | if ( bat <= m_powerCritical ) |
236 | pa->alert( tr( "Battery level is critical!\nKeep power off until power restored!" ), 1 ); | 237 | pa->alert( tr( "Battery level is critical!\nKeep power off until power restored!" ), 1 ); |
237 | else if ( bat <= m_powerVeryLow ) | 238 | else if ( bat <= m_powerVeryLow ) |
238 | pa->alert( tr( "Battery is running very low." ), 2 ); | 239 | pa->alert( tr( "Battery is running very low." ), 2 ); |
239 | } | 240 | } |
240 | if ( m_ps-> backupBatteryStatus ( ) == PowerStatus::VeryLow ) | 241 | if ( m_ps-> backupBatteryStatus ( ) == PowerStatus::VeryLow ) |
241 | pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 2 ); | 242 | pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 2 ); |
242 | } | 243 | } |
243 | } | 244 | } |
244 | 245 | ||
245 | 246 | ||
246 | void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) | 247 | void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) |
247 | { | 248 | { |
248 | QDataStream stream ( data, IO_ReadOnly ); | 249 | QDataStream stream ( data, IO_ReadOnly ); |
249 | 250 | ||
250 | if ( msg == "setScreenSaverInterval(int)" ) { | 251 | if ( msg == "setScreenSaverInterval(int)" ) { |
251 | int time; | 252 | int time; |
252 | stream >> time; | 253 | stream >> time; |
253 | m_screensaver-> setInterval( time ); | 254 | m_screensaver-> setInterval( time ); |
254 | } | 255 | } |
255 | else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { | 256 | else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { |
256 | int t1, t2, t3; | 257 | int t1, t2, t3; |
257 | stream >> t1 >> t2 >> t3; | 258 | stream >> t1 >> t2 >> t3; |
258 | m_screensaver-> setIntervals( t1, t2, t3 ); | 259 | m_screensaver-> setIntervals( t1, t2, t3 ); |
259 | } | 260 | } |
260 | else if ( msg == "setBacklight(int)" ) { | 261 | else if ( msg == "setBacklight(int)" ) { |
261 | int bright; | 262 | int bright; |
262 | stream >> bright; | 263 | stream >> bright; |
263 | m_screensaver-> setBacklight( bright ); | 264 | m_screensaver-> setBacklight( bright ); |
264 | } | 265 | } |
265 | else if ( msg == "setScreenSaverMode(int)" ) { | 266 | else if ( msg == "setScreenSaverMode(int)" ) { |
266 | int mode; | 267 | int mode; |
267 | stream >> mode; | 268 | stream >> mode; |
268 | m_screensaver-> setMode ( mode ); | 269 | m_screensaver-> setMode ( mode ); |
269 | } | 270 | } |
270 | else if ( msg == "reloadPowerWarnSettings()" ) { | 271 | else if ( msg == "reloadPowerWarnSettings()" ) { |
271 | reloadPowerWarnSettings(); | 272 | reloadPowerWarnSettings(); |
272 | } | 273 | } |
273 | else if ( msg == "setDisplayState(int)" ) { | 274 | else if ( msg == "setDisplayState(int)" ) { |
274 | int state; | 275 | int state; |
275 | stream >> state; | 276 | stream >> state; |
276 | m_screensaver-> setDisplayState ( state != 0 ); | 277 | m_screensaver-> setDisplayState ( state != 0 ); |
277 | } | 278 | } |
278 | else if ( msg == "suspend()" ) { | 279 | else if ( msg == "suspend()" ) { |
279 | emit power(); | 280 | emit power(); |
280 | } | 281 | } |
281 | else if ( msg == "sendBusinessCard()" ) { | 282 | else if ( msg == "sendBusinessCard()" ) { |
282 | QString card = ::getenv ( "HOME" ); | 283 | QString card = ::getenv ( "HOME" ); |
283 | card += "/Applications/addressbook/businesscard.vcf"; | 284 | card += "/Applications/addressbook/businesscard.vcf"; |
284 | 285 | ||
285 | if ( QFile::exists( card ) ) { | 286 | if ( QFile::exists( card ) ) { |
286 | QCopEnvelope e ( "QPE/Obex", "send(QString,QString,QString)" ); | 287 | QCopEnvelope e ( "QPE/Obex", "send(QString,QString,QString)" ); |
287 | QString mimetype = "text/x-vCard"; | 288 | QString mimetype = "text/x-vCard"; |
288 | e << tr( "business card" ) << card << mimetype; | 289 | e << tr( "business card" ) << card << mimetype; |
289 | } | 290 | } |
290 | } | 291 | } |
291 | } | 292 | } |
292 | 293 | ||
293 | void DesktopApplication::reloadPowerWarnSettings ( ) | 294 | void DesktopApplication::reloadPowerWarnSettings ( ) |
294 | { | 295 | { |
295 | Config cfg ( "apm" ); | 296 | Config cfg ( "apm" ); |
296 | cfg. setGroup ( "Warnings" ); | 297 | cfg. setGroup ( "Warnings" ); |
297 | 298 | ||
298 | int iv = cfg. readNumEntry ( "checkinterval", 10000 ); | 299 | int iv = cfg. readNumEntry ( "checkinterval", 10000 ); |
299 | 300 | ||
300 | m_apm_timer-> stop ( ); | 301 | m_apm_timer-> stop ( ); |
301 | if ( iv ) | 302 | if ( iv ) |
302 | m_apm_timer-> start ( iv ); | 303 | m_apm_timer-> start ( iv ); |
303 | 304 | ||
304 | m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 ); | 305 | m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 ); |
305 | m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 ); | 306 | m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 ); |
306 | } | 307 | } |
307 | 308 | ||
308 | 309 | ||
309 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; | 310 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; |
310 | 311 | ||
311 | 312 | ||
312 | void DesktopApplication::launcherMessage( const QCString & msg, const QByteArray & data ) | 313 | void DesktopApplication::launcherMessage( const QCString & msg, const QByteArray & data ) |
313 | { | 314 | { |
314 | QDataStream stream ( data, IO_ReadOnly ); | 315 | QDataStream stream ( data, IO_ReadOnly ); |
315 | 316 | ||
316 | if ( msg == "deviceButton(int,int,int)" ) { | 317 | if ( msg == "deviceButton(int,int,int)" ) { |
317 | int keycode, press, autoRepeat; | 318 | int keycode, press, autoRepeat; |
318 | stream >> keycode >> press >> autoRepeat; | 319 | stream >> keycode >> press >> autoRepeat; |
319 | 320 | ||
320 | const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( keycode ); | 321 | const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( keycode ); |
321 | 322 | ||
322 | if ( db ) | 323 | if ( db ) |
323 | checkButtonAction ( db, keycode, press, autoRepeat ); | 324 | checkButtonAction ( db, keycode, press, autoRepeat ); |
324 | } | 325 | } |
325 | else if ( msg == "keyRegister(int,QCString,QCString)" ) { | 326 | else if ( msg == "keyRegister(int,QCString,QCString)" ) { |
326 | int k; | 327 | int k; |
327 | QCString c, m; | 328 | QCString c, m; |
328 | stream >> k >> c >> m; | 329 | stream >> k >> c >> m; |
329 | 330 | ||
330 | keyRegisterList.append ( QCopKeyRegister ( k, c, m )); | 331 | keyRegisterList.append ( QCopKeyRegister ( k, c, m )); |
331 | } | 332 | } |
332 | } | 333 | } |
333 | 334 | ||
334 | void DesktopApplication::sendHeldAction ( ) | 335 | void DesktopApplication::sendHeldAction ( ) |
335 | { | 336 | { |
336 | if ( m_last_button ) { | 337 | if ( m_last_button ) { |
337 | m_last_button-> heldAction ( ). send ( ); | 338 | m_last_button-> heldAction ( ). send ( ); |
338 | m_last_button = 0; | 339 | m_last_button = 0; |
339 | } | 340 | } |
340 | } | 341 | } |
341 | 342 | ||
342 | 343 | ||
343 | 344 | ||
344 | bool DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat ) | 345 | bool DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat ) |
345 | { | 346 | { |
346 | if ( db ) { | 347 | if ( db ) { |
347 | if ( !press && !autoRepeat && m_button_timer-> isActive ( )) { | 348 | if ( !press && !autoRepeat && m_button_timer-> isActive ( )) { |
348 | m_button_timer-> stop ( ); | 349 | m_button_timer-> stop ( ); |
349 | 350 | ||
350 | if (!db-> pressedAction ( ). channel ( ) .isEmpty()) | 351 | if (!db-> pressedAction ( ). channel ( ) .isEmpty()) |
351 | { | 352 | { |
352 | 353 | ||
353 | if ( db-> pressedAction ( ). channel ( )!="ignore") { | 354 | if ( db-> pressedAction ( ). channel ( )!="ignore") { |
354 | 355 | ||
355 | db-> pressedAction ( ). send ( ); | 356 | db-> pressedAction ( ). send ( ); |
356 | } | 357 | } |
357 | else | 358 | else |
358 | return false; | 359 | return false; |
359 | } | 360 | } |
360 | } | 361 | } |
361 | else if ( press && !autoRepeat ) { | 362 | else if ( press && !autoRepeat ) { |
362 | m_button_timer-> stop ( ); | 363 | m_button_timer-> stop ( ); |
363 | if (!db-> pressedAction ( ). channel ( ) .isEmpty()) | 364 | if (!db-> pressedAction ( ). channel ( ) .isEmpty()) |
364 | { | 365 | { |
365 | 366 | ||
366 | if ( db-> heldAction ( ). channel ( )!="ignore") { | 367 | if ( db-> heldAction ( ). channel ( )!="ignore") { |
367 | m_last_button = db; | 368 | m_last_button = db; |
368 | m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); | 369 | m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); |
369 | } | 370 | } |
370 | else return false; | 371 | else return false; |
371 | } | 372 | } |
372 | } | 373 | } |
373 | } | 374 | } |
374 | return true; | 375 | return true; |
375 | } | 376 | } |
376 | 377 | ||
377 | bool DesktopApplication::eventFilter ( QObject *o, QEvent *e ) | 378 | bool DesktopApplication::eventFilter ( QObject *o, QEvent *e ) |
378 | { | 379 | { |
379 | 380 | ||
380 | if ( e-> type ( ) == QEvent::KeyPress || e-> type ( ) == QEvent::KeyRelease ) { | 381 | if ( e-> type ( ) == QEvent::KeyPress || e-> type ( ) == QEvent::KeyRelease ) { |
381 | QKeyEvent *ke = (QKeyEvent *) e; | 382 | QKeyEvent *ke = (QKeyEvent *) e; |
382 | 383 | ||
383 | const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( ke-> key ( )); | 384 | const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( ke-> key ( )); |
384 | 385 | ||
385 | if ( db ) { | 386 | if ( db ) { |
386 | if (checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( ))) | 387 | if (checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( ))) |
387 | return true; //checkButtonAction retrune false if events should be routed through | 388 | return true; //checkButtonAction retrune false if events should be routed through |
388 | } | 389 | } |
389 | } | 390 | } |
390 | return QPEApplication::eventFilter ( o, e ); | 391 | return QPEApplication::eventFilter ( o, e ); |
391 | } | 392 | } |
392 | 393 | ||
393 | #ifdef Q_WS_QWS | 394 | #ifdef Q_WS_QWS |
394 | 395 | ||
395 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 396 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
396 | { | 397 | { |
397 | qpedesktop->checkMemory(); | 398 | qpedesktop->checkMemory(); |
398 | 399 | ||
399 | if ( e->type == QWSEvent::Key ) { | 400 | if ( e->type == QWSEvent::Key ) { |
400 | QWSKeyEvent * ke = (QWSKeyEvent *) e; | 401 | QWSKeyEvent * ke = (QWSKeyEvent *) e; |
401 | ushort keycode = ke-> simpleData. keycode; | 402 | ushort keycode = ke-> simpleData. keycode; |
402 | 403 | ||
403 | if ( !loggedin && keycode != Key_F34 ) | 404 | if ( !loggedin && keycode != Key_F34 ) |
404 | return true; | 405 | return true; |
405 | 406 | ||
406 | bool press = ke-> simpleData. is_press; | 407 | bool press = ke-> simpleData. is_press; |
407 | bool autoRepeat = ke-> simpleData. is_auto_repeat; | 408 | bool autoRepeat = ke-> simpleData. is_auto_repeat; |
408 | 409 | ||
409 | if ( !keyboardGrabbed ( )) { | 410 | if ( !keyboardGrabbed ( )) { |
410 | // app that registers key/message to be sent back to the app, when it doesn't have focus, | 411 | // app that registers key/message to be sent back to the app, when it doesn't have focus, |
411 | // when user presses key, unless keyboard has been requested from app. | 412 | // when user presses key, unless keyboard has been requested from app. |
412 | // will not send multiple repeats if user holds key | 413 | // will not send multiple repeats if user holds key |
413 | // i.e. one shot | 414 | // i.e. one shot |
414 | 415 | ||
415 | if ( keycode != 0 && press && !autoRepeat ) { | 416 | if ( keycode != 0 && press && !autoRepeat ) { |
416 | for ( KeyRegisterList::Iterator it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { | 417 | for ( KeyRegisterList::Iterator it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { |
417 | if (( *it ). getKeyCode ( ) == keycode ) { | 418 | if (( *it ). getKeyCode ( ) == keycode ) { |
418 | QCopEnvelope (( *it ). getChannel ( ), ( *it ). getMessage ( )); | 419 | QCopEnvelope (( *it ). getChannel ( ), ( *it ). getMessage ( )); |
419 | return true; | 420 | return true; |
420 | } | 421 | } |
421 | } | 422 | } |
422 | } | 423 | } |
423 | } | 424 | } |
424 | 425 | ||
425 | if ( keycode == HardKey_Suspend ) { | 426 | if ( keycode == HardKey_Suspend ) { |
426 | if ( press ) | 427 | if ( press ) |
427 | emit power ( ); | 428 | emit power ( ); |
428 | return true; | 429 | return true; |
429 | } | 430 | } |
430 | else if ( keycode == HardKey_Backlight ) { | 431 | else if ( keycode == HardKey_Backlight ) { |
431 | if ( press ) | 432 | if ( press ) |
432 | emit backlight ( ); | 433 | emit backlight ( ); |
433 | return true; | 434 | return true; |
434 | } | 435 | } |
435 | else if ( keycode == Key_F32 ) { | 436 | else if ( keycode == Key_F32 ) { |
436 | if ( press ) | 437 | if ( press ) |
437 | QCopEnvelope e( "QPE/Desktop", "startSync()" ); | 438 | QCopEnvelope e( "QPE/Desktop", "startSync()" ); |
438 | return true; | 439 | return true; |
439 | } | 440 | } |
440 | else if ( keycode == Key_F31 && !ke-> simpleData. modifiers ) { // Symbol Key -> show Unicode IM | 441 | else if ( keycode == Key_F31 && !ke-> simpleData. modifiers ) { // Symbol Key -> show Unicode IM |
441 | if ( press ) | 442 | if ( press ) |
442 | emit symbol ( ); | 443 | emit symbol ( ); |
443 | return true; | 444 | return true; |
444 | } | 445 | } |
445 | else if ( keycode == Key_NumLock ) { | 446 | else if ( keycode == Key_NumLock ) { |
446 | if ( press ) | 447 | if ( press ) |
447 | emit numLockStateToggle ( ); | 448 | emit numLockStateToggle ( ); |
448 | } | 449 | } |
449 | else if ( keycode == Key_CapsLock ) { | 450 | else if ( keycode == Key_CapsLock ) { |
450 | if ( press ) | 451 | if ( press ) |
451 | emit capsLockStateToggle(); | 452 | emit capsLockStateToggle(); |
452 | } | 453 | } |
453 | if (( press && !autoRepeat ) || ( !press && autoRepeat )) { | 454 | if (( press && !autoRepeat ) || ( !press && autoRepeat )) { |
454 | if ( m_keyclick_sound ) | 455 | if ( m_keyclick_sound ) |
455 | ODevice::inst ( )-> keySound ( ); | 456 | ODevice::inst ( )-> keySound ( ); |
456 | } | 457 | } |
457 | } | 458 | } |
458 | else if ( e-> type == QWSEvent::Mouse ) { | 459 | else if ( e-> type == QWSEvent::Mouse ) { |
459 | QWSMouseEvent * me = ( QWSMouseEvent * ) e; | 460 | QWSMouseEvent * me = ( QWSMouseEvent * ) e; |
460 | static bool up = true; | 461 | static bool up = true; |
461 | 462 | ||
462 | if ( me-> simpleData. state & LeftButton ) { | 463 | if ( me-> simpleData. state & LeftButton ) { |
463 | if ( up ) { | 464 | if ( up ) { |
464 | up = false; | 465 | up = false; |
465 | if ( m_screentap_sound ) | 466 | if ( m_screentap_sound ) |
466 | ODevice::inst ( ) -> touchSound ( ); | 467 | ODevice::inst ( ) -> touchSound ( ); |
467 | } | 468 | } |
468 | } | 469 | } |
469 | else { | 470 | else { |
470 | up = true; | 471 | up = true; |
471 | } | 472 | } |
472 | } | 473 | } |
473 | 474 | ||
474 | return QPEApplication::qwsEventFilter ( e ); | 475 | return QPEApplication::qwsEventFilter ( e ); |
475 | } | 476 | } |
476 | #endif | 477 | #endif |
477 | 478 | ||
478 | 479 | ||
479 | 480 | ||
480 | #if defined(QPE_HAVE_MEMALERTER) | 481 | #if defined(QPE_HAVE_MEMALERTER) |
481 | QPE_MEMALERTER_IMPL | 482 | QPE_MEMALERTER_IMPL |
482 | #endif | 483 | #endif |
483 | 484 | ||
484 | //=========================================================================== | 485 | //=========================================================================== |
485 | 486 | ||
486 | Desktop::Desktop() : | 487 | Desktop::Desktop() : |
487 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), | 488 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), |
488 | qcopBridge( 0 ), | 489 | qcopBridge( 0 ), |
489 | transferServer( 0 ), | 490 | transferServer( 0 ), |
490 | packageSlave( 0 ) | 491 | packageSlave( 0 ) |
491 | { | 492 | { |
492 | qpedesktop = this; | 493 | qpedesktop = this; |
493 | 494 | ||
494 | // bg = new Info( this ); | 495 | // bg = new Info( this ); |
495 | tb = new TaskBar; | 496 | tb = new TaskBar; |
496 | 497 | ||
497 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); | 498 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); |
498 | 499 | ||
499 | connect( launcher, SIGNAL( busy() ), tb, SLOT( startWait() ) ); | 500 | connect( launcher, SIGNAL( busy() ), tb, SLOT( startWait() ) ); |
500 | connect( launcher, SIGNAL( notBusy( const QString& ) ), tb, SLOT( stopWait( const QString& ) ) ); | 501 | connect( launcher, SIGNAL( notBusy( const QString& ) ), tb, SLOT( stopWait( const QString& ) ) ); |
501 | 502 | ||
502 | int displayw = qApp->desktop() ->width(); | 503 | int displayw = qApp->desktop() ->width(); |
503 | int displayh = qApp->desktop() ->height(); | 504 | int displayh = qApp->desktop() ->height(); |
504 | 505 | ||
505 | 506 | ||
506 | QSize sz = tb->sizeHint(); | 507 | QSize sz = tb->sizeHint(); |
507 | 508 | ||
508 | setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | 509 | setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); |
509 | layout(); | 510 | layout(); |
510 | 511 | ||
511 | tb->show(); | 512 | tb->show(); |
512 | launcher->showMaximized(); | 513 | launcher->showMaximized(); |
513 | launcher->show(); | 514 | launcher->show(); |
514 | launcher->raise(); | 515 | launcher->raise(); |
515 | #if defined(QPE_HAVE_MEMALERTER) | 516 | #if defined(QPE_HAVE_MEMALERTER) |
516 | 517 | ||
517 | initMemalerter(); | 518 | initMemalerter(); |
518 | #endif | 519 | #endif |
519 | // start services | 520 | // start services |
520 | startTransferServer(); | 521 | startTransferServer(); |
521 | ( void ) new IrServer( this ); | 522 | ( void ) new IrServer( this ); |
522 | 523 | ||
523 | packageSlave = new PackageSlave( this ); | 524 | packageSlave = new PackageSlave( this ); |
524 | 525 | ||
525 | qApp->installEventFilter( this ); | 526 | qApp->installEventFilter( this ); |
526 | qApp->desktop()->installEventFilter( this ); | 527 | qApp->desktop()->installEventFilter( this ); |
527 | 528 | ||
528 | qApp-> setMainWidget ( launcher ); | 529 | qApp-> setMainWidget ( launcher ); |
529 | } | 530 | } |
530 | 531 | ||
531 | void Desktop::show() | 532 | void Desktop::show() |
532 | { | 533 | { |
533 | login( TRUE ); | 534 | login( TRUE ); |
534 | QWidget::show(); | 535 | QWidget::show(); |
535 | } | 536 | } |
536 | 537 | ||
537 | Desktop::~Desktop() | 538 | Desktop::~Desktop() |
538 | { | 539 | { |
539 | delete launcher; | 540 | delete launcher; |
540 | delete tb; | 541 | delete tb; |
541 | delete qcopBridge; | 542 | delete qcopBridge; |
542 | delete transferServer; | 543 | delete transferServer; |
543 | } | 544 | } |
544 | 545 | ||
545 | bool Desktop::recoverMemory() | 546 | bool Desktop::recoverMemory() |
546 | { | 547 | { |
547 | return tb->recoverMemory(); | 548 | return tb->recoverMemory(); |
548 | } | 549 | } |
549 | 550 | ||
550 | void Desktop::checkMemory() | 551 | void Desktop::checkMemory() |
551 | { | 552 | { |
552 | #if defined(QPE_HAVE_MEMALERTER) | 553 | #if defined(QPE_HAVE_MEMALERTER) |
553 | static bool ignoreNormal = FALSE; | 554 | static bool ignoreNormal = FALSE; |
554 | static bool existingMessage = FALSE; | 555 | static bool existingMessage = FALSE; |
555 | 556 | ||
556 | if ( existingMessage ) | 557 | if ( existingMessage ) |
557 | return ; // don't show a second message while still on first | 558 | return ; // don't show a second message while still on first |
558 | 559 | ||
559 | existingMessage = TRUE; | 560 | existingMessage = TRUE; |
560 | switch ( memstate ) { | 561 | switch ( memstate ) { |
561 | case Unknown: | 562 | case Unknown: |
562 | break; | 563 | break; |
563 | case Low: | 564 | case Low: |
564 | memstate = Unknown; | 565 | memstate = Unknown; |
565 | if ( recoverMemory() ) | 566 | if ( recoverMemory() ) |
566 | ignoreNormal = TRUE; | 567 | ignoreNormal = TRUE; |
567 | else | 568 | else |
568 | QMessageBox::warning( 0 , "Memory Status", | 569 | QMessageBox::warning( 0 , "Memory Status", |
569 | "The memory smacks of shortage. \n" | 570 | "The memory smacks of shortage. \n" |
570 | "Please save data. " ); | 571 | "Please save data. " ); |
571 | break; | 572 | break; |
572 | case Normal: | 573 | case Normal: |
573 | memstate = Unknown; | 574 | memstate = Unknown; |
574 | if ( ignoreNormal ) | 575 | if ( ignoreNormal ) |
575 | ignoreNormal = FALSE; | 576 | ignoreNormal = FALSE; |
576 | // else | 577 | // else |
577 | // QMessageBox::information ( 0 , "Memory Status", | 578 | // QMessageBox::information ( 0 , "Memory Status", |
578 | // "There is enough memory again." ); | 579 | // "There is enough memory again." ); |
579 | break; | 580 | break; |
580 | case VeryLow: | 581 | case VeryLow: |
581 | memstate = Unknown; | 582 | memstate = Unknown; |
582 | QMessageBox::critical( 0 , "Memory Status", | 583 | QMessageBox::critical( 0 , "Memory Status", |
583 | "The memory is very low. \n" | 584 | "The memory is very low. \n" |
584 | "Please end this application \n" | 585 | "Please end this application \n" |
585 | "immediately." ); | 586 | "immediately." ); |
586 | recoverMemory(); | 587 | recoverMemory(); |
587 | } | 588 | } |
588 | existingMessage = FALSE; | 589 | existingMessage = FALSE; |
589 | #endif | 590 | #endif |
590 | } | 591 | } |
591 | 592 | ||
592 | static bool isVisibleWindow( int wid ) | 593 | static bool isVisibleWindow( int wid ) |
593 | { | 594 | { |
594 | #ifdef QWS | 595 | #ifdef QWS |
595 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 596 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
596 | QWSWindow* w; | 597 | QWSWindow* w; |
597 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { | 598 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { |
598 | if ( w->winId() == wid ) | 599 | if ( w->winId() == wid ) |
599 | return !w->isFullyObscured(); | 600 | return !w->isFullyObscured(); |
600 | } | 601 | } |
601 | #endif | 602 | #endif |
602 | return FALSE; | 603 | return FALSE; |
603 | } | 604 | } |
604 | 605 | ||
605 | static bool hasVisibleWindow( const QString& clientname ) | 606 | static bool hasVisibleWindow( const QString& clientname ) |
606 | { | 607 | { |
607 | #ifdef QWS | 608 | #ifdef QWS |
608 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 609 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
609 | QWSWindow* w; | 610 | QWSWindow* w; |
610 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { | 611 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { |
611 | if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) | 612 | if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) |
612 | return TRUE; | 613 | return TRUE; |
613 | } | 614 | } |
614 | #endif | 615 | #endif |
615 | return FALSE; | 616 | return FALSE; |
616 | } | 617 | } |
617 | 618 | ||
618 | 619 | ||
619 | void Desktop::executeOrModify( const QString& appLnkFile ) | 620 | void Desktop::executeOrModify( const QString& appLnkFile ) |
620 | { | 621 | { |
621 | AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); | 622 | AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); |
622 | if ( lnk.isValid() ) { | 623 | if ( lnk.isValid() ) { |
623 | QCString app = lnk.exec().utf8(); | 624 | QCString app = lnk.exec().utf8(); |
625 | Global::terminateBuiltin( "calibrate" ); | ||
624 | if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { | 626 | if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { |
625 | // MRUList::addTask( &lnk ); | 627 | // MRUList::addTask( &lnk ); |
626 | if ( hasVisibleWindow( app ) ) | 628 | if ( hasVisibleWindow( app ) ) |
627 | QCopChannel::send( "QPE/Application/" + app, "nextView()" ); | 629 | QCopChannel::send( "QPE/Application/" + app, "nextView()" ); |
628 | else | 630 | else |
629 | QCopChannel::send( "QPE/Application/" + app, "raise()" ); | 631 | QCopChannel::send( "QPE/Application/" + app, "raise()" ); |
630 | } | 632 | } |
631 | else { | 633 | else { |
632 | lnk.execute(); | 634 | lnk.execute(); |
633 | } | 635 | } |
634 | } | 636 | } |
635 | } | 637 | } |
636 | 638 | ||
637 | // autoStarts apps on resume and start | 639 | // autoStarts apps on resume and start |
638 | void Desktop::execAutoStart() | 640 | void Desktop::execAutoStart() |
639 | { | 641 | { |
640 | QString appName; | 642 | QString appName; |
641 | int delay; | 643 | int delay; |
642 | QDateTime now = QDateTime::currentDateTime(); | 644 | QDateTime now = QDateTime::currentDateTime(); |
643 | Config cfg( "autostart" ); | 645 | Config cfg( "autostart" ); |
644 | cfg.setGroup( "AutoStart" ); | 646 | cfg.setGroup( "AutoStart" ); |
645 | appName = cfg.readEntry( "Apps", "" ); | 647 | appName = cfg.readEntry( "Apps", "" ); |
646 | delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); | 648 | delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); |
647 | // If the time between suspend and resume was longer then the | 649 | // If the time between suspend and resume was longer then the |
648 | // value saved as delay, start the app | 650 | // value saved as delay, start the app |
649 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { | 651 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { |
650 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 652 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
651 | e << QString( appName ); | 653 | e << QString( appName ); |
652 | } | 654 | } |
653 | } | 655 | } |
654 | 656 | ||
655 | #if defined(QPE_HAVE_TOGGLELIGHT) | 657 | #if defined(QPE_HAVE_TOGGLELIGHT) |
656 | #include <qpe/config.h> | 658 | #include <qpe/config.h> |
657 | 659 | ||
658 | #include <sys/ioctl.h> | 660 | #include <sys/ioctl.h> |
659 | #include <sys/types.h> | 661 | #include <sys/types.h> |
660 | #include <fcntl.h> | 662 | #include <fcntl.h> |
661 | #include <unistd.h> | 663 | #include <unistd.h> |
662 | #include <errno.h> | 664 | #include <errno.h> |
663 | #include <linux/ioctl.h> | 665 | #include <linux/ioctl.h> |
664 | #include <time.h> | 666 | #include <time.h> |
665 | #endif | 667 | #endif |
666 | 668 | ||
667 | 669 | ||
668 | void Desktop::togglePower() | 670 | void Desktop::togglePower() |
669 | { | 671 | { |
670 | static bool excllock = false; | 672 | static bool excllock = false; |
671 | 673 | ||
672 | if ( excllock ) | 674 | if ( excllock ) |
673 | return ; | 675 | return ; |
674 | 676 | ||
675 | excllock = true; | 677 | excllock = true; |
676 | 678 | ||
677 | bool wasloggedin = loggedin; | 679 | bool wasloggedin = loggedin; |
678 | loggedin = 0; | 680 | loggedin = 0; |
679 | suspendTime = QDateTime::currentDateTime(); | 681 | suspendTime = QDateTime::currentDateTime(); |
680 | 682 | ||
681 | #ifdef QWS | 683 | #ifdef QWS |
682 | 684 | ||
683 | if ( Password::needToAuthenticate ( true ) && qt_screen ) { | 685 | if ( Password::needToAuthenticate ( true ) && qt_screen ) { |
684 | // Should use a big black window instead. | 686 | // Should use a big black window instead. |
685 | // But this would not show up fast enough | 687 | // But this would not show up fast enough |
686 | QGfx *g = qt_screen-> screenGfx ( ); | 688 | QGfx *g = qt_screen-> screenGfx ( ); |
687 | g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); | 689 | g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); |
688 | delete g; | 690 | delete g; |
689 | } | 691 | } |
690 | #endif | 692 | #endif |
691 | 693 | ||
692 | ODevice::inst ( )-> suspend ( ); | 694 | ODevice::inst ( )-> suspend ( ); |
693 | 695 | ||
694 | DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call | 696 | DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call |
695 | QWSServer::screenSaverActivate ( false ); | 697 | QWSServer::screenSaverActivate ( false ); |
696 | 698 | ||
697 | { | 699 | { |
698 | QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep | 700 | QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep |
699 | } | 701 | } |
700 | 702 | ||
701 | if ( wasloggedin ) | 703 | if ( wasloggedin ) |
702 | login ( true ); | 704 | login ( true ); |
703 | 705 | ||
704 | execAutoStart(); | 706 | execAutoStart(); |
705 | //qcopBridge->closeOpenConnections(); | 707 | //qcopBridge->closeOpenConnections(); |
706 | 708 | ||
707 | excllock = false; | 709 | excllock = false; |
708 | } | 710 | } |
709 | 711 | ||
710 | void Desktop::toggleLight() | 712 | void Desktop::toggleLight() |
711 | { | 713 | { |
712 | QCopEnvelope e( "QPE/System", "setBacklight(int)" ); | 714 | QCopEnvelope e( "QPE/System", "setBacklight(int)" ); |
713 | e << -2; // toggle | 715 | e << -2; // toggle |
714 | } | 716 | } |
715 | 717 | ||
716 | void Desktop::toggleSymbolInput() | 718 | void Desktop::toggleSymbolInput() |
717 | { | 719 | { |
718 | tb->toggleSymbolInput(); | 720 | tb->toggleSymbolInput(); |
719 | } | 721 | } |
720 | 722 | ||
721 | void Desktop::toggleNumLockState() | 723 | void Desktop::toggleNumLockState() |
722 | { | 724 | { |
723 | tb->toggleNumLockState(); | 725 | tb->toggleNumLockState(); |
724 | } | 726 | } |
725 | 727 | ||
726 | void Desktop::toggleCapsLockState() | 728 | void Desktop::toggleCapsLockState() |
727 | { | 729 | { |
728 | tb->toggleCapsLockState(); | 730 | tb->toggleCapsLockState(); |
729 | } | 731 | } |
730 | 732 | ||
731 | void Desktop::styleChange( QStyle &s ) | 733 | void Desktop::styleChange( QStyle &s ) |
732 | { | 734 | { |
733 | QWidget::styleChange( s ); | 735 | QWidget::styleChange( s ); |
734 | layout(); | 736 | layout(); |
735 | } | 737 | } |
736 | 738 | ||
737 | void DesktopApplication::shutdown() | 739 | void DesktopApplication::shutdown() |
738 | { | 740 | { |
739 | if ( type() != GuiServer ) | 741 | if ( type() != GuiServer ) |
740 | return ; | 742 | return ; |
741 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); | 743 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); |
742 | connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ), | 744 | connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ), |
743 | this, SLOT( shutdown( ShutdownImpl::Type ) ) ); | 745 | this, SLOT( shutdown( ShutdownImpl::Type ) ) ); |
744 | sd->showMaximized(); | 746 | sd->showMaximized(); |
745 | } | 747 | } |
746 | 748 | ||
747 | void DesktopApplication::shutdown( ShutdownImpl::Type t ) | 749 | void DesktopApplication::shutdown( ShutdownImpl::Type t ) |
748 | { | 750 | { |
749 | char *opt = 0; | 751 | char *opt = 0; |
750 | 752 | ||
751 | switch ( t ) { | 753 | switch ( t ) { |
752 | case ShutdownImpl::ShutdownSystem: | 754 | case ShutdownImpl::ShutdownSystem: |
753 | opt = "-h"; | 755 | opt = "-h"; |
754 | // fall through | 756 | // fall through |
755 | case ShutdownImpl::RebootSystem: | 757 | case ShutdownImpl::RebootSystem: |
756 | if ( opt == 0 ) | 758 | if ( opt == 0 ) |
757 | opt = "-r"; | 759 | opt = "-r"; |
758 | 760 | ||
759 | if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 ) | 761 | if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 ) |
760 | perror("shutdown"); | 762 | perror("shutdown"); |
761 | // ::syslog ( LOG_ERR, "Erroring execing shutdown\n" ); | 763 | // ::syslog ( LOG_ERR, "Erroring execing shutdown\n" ); |
762 | 764 | ||
763 | break; | 765 | break; |
764 | case ShutdownImpl::RestartDesktop: | 766 | case ShutdownImpl::RestartDesktop: |
765 | restart(); | 767 | restart(); |
766 | break; | 768 | break; |
767 | case ShutdownImpl::TerminateDesktop: | 769 | case ShutdownImpl::TerminateDesktop: |
768 | prepareForTermination( FALSE ); | 770 | prepareForTermination( FALSE ); |
769 | 771 | ||
770 | // This is a workaround for a Qt bug | 772 | // This is a workaround for a Qt bug |
771 | // clipboard applet has to stop its poll timer, or Qt/E | 773 | // clipboard applet has to stop its poll timer, or Qt/E |
772 | // will hang on quit() right before it emits aboutToQuit() | 774 | // will hang on quit() right before it emits aboutToQuit() |
773 | emit aboutToQuit ( ); | 775 | emit aboutToQuit ( ); |
774 | 776 | ||
775 | quit(); | 777 | quit(); |
776 | break; | 778 | break; |
777 | } | 779 | } |
778 | } | 780 | } |
779 | 781 | ||
780 | void DesktopApplication::restart() | 782 | void DesktopApplication::restart() |
781 | { | 783 | { |
782 | prepareForTermination( TRUE ); | 784 | prepareForTermination( TRUE ); |
783 | 785 | ||
784 | #ifdef Q_WS_QWS | 786 | #ifdef Q_WS_QWS |
785 | 787 | ||
786 | for ( int fd = 3; fd < 100; fd++ ) | 788 | for ( int fd = 3; fd < 100; fd++ ) |
787 | close( fd ); | 789 | close( fd ); |
788 | #if defined(QT_DEMO_SINGLE_FLOPPY) | 790 | #if defined(QT_DEMO_SINGLE_FLOPPY) |
789 | 791 | ||
790 | execl( "/sbin/init", "qpe", 0 ); | 792 | execl( "/sbin/init", "qpe", 0 ); |
791 | #elif defined(QT_QWS_CASSIOPEIA) | 793 | #elif defined(QT_QWS_CASSIOPEIA) |
792 | 794 | ||
793 | execl( "/bin/sh", "sh", 0 ); | 795 | execl( "/bin/sh", "sh", 0 ); |
794 | #else | 796 | #else |
795 | 797 | ||
796 | execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); | 798 | execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); |
797 | #endif | 799 | #endif |
798 | 800 | ||
799 | exit( 1 ); | 801 | exit( 1 ); |
800 | #endif | 802 | #endif |
801 | } | 803 | } |
802 | 804 | ||
803 | void Desktop::layout() | 805 | void Desktop::layout() |
804 | { | 806 | { |
805 | int displayw = qApp->desktop() ->width(); | 807 | int displayw = qApp->desktop() ->width(); |
806 | int displayh = qApp->desktop() ->height(); | 808 | int displayh = qApp->desktop() ->height(); |
807 | 809 | ||
808 | QSize sz = tb->sizeHint(); | 810 | QSize sz = tb->sizeHint(); |
809 | 811 | ||
810 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | 812 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); |
811 | tb->calcMaxWindowRect(); | 813 | tb->calcMaxWindowRect(); |
812 | } | 814 | } |
813 | 815 | ||
814 | void Desktop::startTransferServer() | 816 | void Desktop::startTransferServer() |
815 | { | 817 | { |
816 | // start qcop bridge server | 818 | // start qcop bridge server |
817 | qcopBridge = new QCopBridge( 4243 ); | 819 | qcopBridge = new QCopBridge( 4243 ); |
818 | if ( !qcopBridge->ok() ) { | 820 | if ( !qcopBridge->ok() ) { |
819 | delete qcopBridge; | 821 | delete qcopBridge; |
820 | qcopBridge = 0; | 822 | qcopBridge = 0; |
821 | } | 823 | } |
822 | // start transfer server | 824 | // start transfer server |
823 | transferServer = new TransferServer( 4242 ); | 825 | transferServer = new TransferServer( 4242 ); |
824 | if ( !transferServer->ok() ) { | 826 | if ( !transferServer->ok() ) { |
825 | delete transferServer; | 827 | delete transferServer; |
826 | transferServer = 0; | 828 | transferServer = 0; |
827 | } | 829 | } |
828 | if ( !transferServer || !qcopBridge ) | 830 | if ( !transferServer || !qcopBridge ) |
829 | startTimer( 2000 ); | 831 | startTimer( 2000 ); |
830 | } | 832 | } |
831 | 833 | ||
832 | void Desktop::timerEvent( QTimerEvent *e ) | 834 | void Desktop::timerEvent( QTimerEvent *e ) |
833 | { | 835 | { |
834 | killTimer( e->timerId() ); | 836 | killTimer( e->timerId() ); |
835 | startTransferServer(); | 837 | startTransferServer(); |
836 | } | 838 | } |
837 | 839 | ||
838 | bool Desktop::eventFilter( QObject *o, QEvent *ev ) | 840 | bool Desktop::eventFilter( QObject *o, QEvent *ev ) |
839 | { | 841 | { |
840 | if ( o != qApp->desktop() || ev->type() != QEvent::Resize ) | 842 | if ( o != qApp->desktop() || ev->type() != QEvent::Resize ) |
841 | return QWidget::eventFilter( o, ev ); | 843 | return QWidget::eventFilter( o, ev ); |
842 | 844 | ||
843 | layout(); | 845 | layout(); |
844 | 846 | ||
845 | return QWidget::eventFilter( o, ev ); | 847 | return QWidget::eventFilter( o, ev ); |
846 | } | 848 | } |
847 | 849 | ||
848 | void Desktop::terminateServers() | 850 | void Desktop::terminateServers() |
849 | { | 851 | { |
850 | delete transferServer; | 852 | delete transferServer; |
851 | delete qcopBridge; | 853 | delete qcopBridge; |
852 | transferServer = 0; | 854 | transferServer = 0; |
853 | qcopBridge = 0; | 855 | qcopBridge = 0; |
854 | } | 856 | } |
855 | 857 | ||
856 | void DesktopApplication::rereadVolumes() | 858 | void DesktopApplication::rereadVolumes() |
857 | { | 859 | { |
858 | Config cfg( "qpe" ); | 860 | Config cfg( "qpe" ); |
859 | cfg. setGroup ( "Volume" ); | 861 | cfg. setGroup ( "Volume" ); |
860 | 862 | ||
861 | m_screentap_sound = cfg. readBoolEntry ( "TouchSound" ); | 863 | m_screentap_sound = cfg. readBoolEntry ( "TouchSound" ); |
862 | m_keyclick_sound = cfg. readBoolEntry ( "KeySound" ); | 864 | m_keyclick_sound = cfg. readBoolEntry ( "KeySound" ); |
863 | m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" ); | 865 | m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" ); |
864 | } | 866 | } |
865 | 867 | ||
866 | void DesktopApplication::soundAlarm() | 868 | void DesktopApplication::soundAlarm() |
867 | { | 869 | { |
868 | if ( me ( )-> m_alarm_sound ) | 870 | if ( me ( )-> m_alarm_sound ) |
869 | ODevice::inst ( )-> alarmSound ( ); | 871 | ODevice::inst ( )-> alarmSound ( ); |
870 | } | 872 | } |
871 | 873 | ||
872 | DesktopApplication *DesktopApplication::me ( ) | 874 | DesktopApplication *DesktopApplication::me ( ) |
873 | { | 875 | { |
874 | return (DesktopApplication *) qApp; | 876 | return (DesktopApplication *) qApp; |
875 | } | 877 | } |
876 | 878 | ||
diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro index ba01954..f5597c5 100644 --- a/core/launcher/launcher.pro +++ b/core/launcher/launcher.pro | |||
@@ -1,121 +1,125 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | DESTDIR = ../../bin | 3 | DESTDIR = ../../bin |
4 | HEADERS = background.h \ | 4 | HEADERS = background.h \ |
5 | desktop.h \ | 5 | desktop.h \ |
6 | screensaver.h \ | 6 | screensaver.h \ |
7 | mediummountgui.h \ | 7 | mediummountgui.h \ |
8 | info.h \ | 8 | info.h \ |
9 | appicons.h \ | 9 | appicons.h \ |
10 | taskbar.h \ | 10 | taskbar.h \ |
11 | sidething.h \ | 11 | sidething.h \ |
12 | runningappbar.h \ | 12 | runningappbar.h \ |
13 | stabmon.h \ | 13 | stabmon.h \ |
14 | inputmethods.h \ | 14 | inputmethods.h \ |
15 | systray.h \ | 15 | systray.h \ |
16 | wait.h \ | 16 | wait.h \ |
17 | shutdownimpl.h \ | 17 | shutdownimpl.h \ |
18 | launcher.h \ | 18 | launcher.h \ |
19 | launcherview.h \ | 19 | launcherview.h \ |
20 | ../../core/apps/calibrate/calibrate.h \ | ||
20 | startmenu.h \ | 21 | startmenu.h \ |
21 | transferserver.h \ | 22 | transferserver.h \ |
22 | qcopbridge.h \ | 23 | qcopbridge.h \ |
23 | packageslave.h \ | 24 | packageslave.h \ |
24 | irserver.h \ | 25 | irserver.h \ |
25 | ../../rsync/buf.h \ | 26 | ../../rsync/buf.h \ |
26 | ../../rsync/checksum.h \ | 27 | ../../rsync/checksum.h \ |
27 | ../../rsync/command.h \ | 28 | ../../rsync/command.h \ |
28 | ../../rsync/emit.h \ | 29 | ../../rsync/emit.h \ |
29 | ../../rsync/job.h \ | 30 | ../../rsync/job.h \ |
30 | ../../rsync/netint.h \ | 31 | ../../rsync/netint.h \ |
31 | ../../rsync/protocol.h \ | 32 | ../../rsync/protocol.h \ |
32 | ../../rsync/prototab.h \ | 33 | ../../rsync/prototab.h \ |
33 | ../../rsync/rsync.h \ | 34 | ../../rsync/rsync.h \ |
34 | ../../rsync/search.h \ | 35 | ../../rsync/search.h \ |
35 | ../../rsync/stream.h \ | 36 | ../../rsync/stream.h \ |
36 | ../../rsync/sumset.h \ | 37 | ../../rsync/sumset.h \ |
37 | ../../rsync/trace.h \ | 38 | ../../rsync/trace.h \ |
38 | ../../rsync/types.h \ | 39 | ../../rsync/types.h \ |
39 | ../../rsync/util.h \ | 40 | ../../rsync/util.h \ |
40 | ../../rsync/whole.h \ | 41 | ../../rsync/whole.h \ |
41 | ../../rsync/config_rsync.h \ | 42 | ../../rsync/config_rsync.h \ |
42 | ../../rsync/qrsync.h \ | 43 | ../../rsync/qrsync.h \ |
43 | quicklauncher.h | 44 | quicklauncher.h |
44 | SOURCES = background.cpp \ | 45 | SOURCES = background.cpp \ |
45 | desktop.cpp \ | 46 | desktop.cpp \ |
46 | screensaver.cpp \ | 47 | screensaver.cpp \ |
47 | mediummountgui.cpp \ | 48 | mediummountgui.cpp \ |
48 | info.cpp \ | 49 | info.cpp \ |
49 | appicons.cpp \ | 50 | appicons.cpp \ |
50 | taskbar.cpp \ | 51 | taskbar.cpp \ |
51 | sidething.cpp \ | 52 | sidething.cpp \ |
52 | runningappbar.cpp \ | 53 | runningappbar.cpp \ |
53 | stabmon.cpp \ | 54 | stabmon.cpp \ |
54 | inputmethods.cpp \ | 55 | inputmethods.cpp \ |
55 | systray.cpp \ | 56 | systray.cpp \ |
56 | wait.cpp \ | 57 | wait.cpp \ |
57 | shutdownimpl.cpp \ | 58 | shutdownimpl.cpp \ |
58 | launcher.cpp \ | 59 | launcher.cpp \ |
59 | launcherview.cpp \ | 60 | launcherview.cpp \ |
61 | ../../core/apps/calibrate/calibrate.cpp \ | ||
60 | transferserver.cpp \ | 62 | transferserver.cpp \ |
61 | packageslave.cpp \ | 63 | packageslave.cpp \ |
62 | irserver.cpp \ | 64 | irserver.cpp \ |
63 | qcopbridge.cpp \ | 65 | qcopbridge.cpp \ |
64 | startmenu.cpp \ | 66 | startmenu.cpp \ |
65 | main.cpp \ | 67 | main.cpp \ |
66 | ../../rsync/base64.c \ | 68 | ../../rsync/base64.c \ |
67 | ../../rsync/buf.c \ | 69 | ../../rsync/buf.c \ |
68 | ../../rsync/checksum.c \ | 70 | ../../rsync/checksum.c \ |
69 | ../../rsync/command.c \ | 71 | ../../rsync/command.c \ |
70 | ../../rsync/delta.c \ | 72 | ../../rsync/delta.c \ |
71 | ../../rsync/emit.c \ | 73 | ../../rsync/emit.c \ |
72 | ../../rsync/hex.c \ | 74 | ../../rsync/hex.c \ |
73 | ../../rsync/job.c \ | 75 | ../../rsync/job.c \ |
74 | ../../rsync/mdfour.c \ | 76 | ../../rsync/mdfour.c \ |
75 | ../../rsync/mksum.c \ | 77 | ../../rsync/mksum.c \ |
76 | ../../rsync/msg.c \ | 78 | ../../rsync/msg.c \ |
77 | ../../rsync/netint.c \ | 79 | ../../rsync/netint.c \ |
78 | ../../rsync/patch.c \ | 80 | ../../rsync/patch.c \ |
79 | ../../rsync/prototab.c \ | 81 | ../../rsync/prototab.c \ |
80 | ../../rsync/readsums.c \ | 82 | ../../rsync/readsums.c \ |
81 | ../../rsync/scoop.c \ | 83 | ../../rsync/scoop.c \ |
82 | ../../rsync/search.c \ | 84 | ../../rsync/search.c \ |
83 | ../../rsync/stats.c \ | 85 | ../../rsync/stats.c \ |
84 | ../../rsync/stream.c \ | 86 | ../../rsync/stream.c \ |
85 | ../../rsync/sumset.c \ | 87 | ../../rsync/sumset.c \ |
86 | ../../rsync/trace.c \ | 88 | ../../rsync/trace.c \ |
87 | ../../rsync/tube.c \ | 89 | ../../rsync/tube.c \ |
88 | ../../rsync/util.c \ | 90 | ../../rsync/util.c \ |
89 | ../../rsync/version.c \ | 91 | ../../rsync/version.c \ |
90 | ../../rsync/whole.c \ | 92 | ../../rsync/whole.c \ |
91 | ../../rsync/qrsync.cpp | 93 | ../../rsync/qrsync.cpp |
92 | INTERFACES= syncdialog.ui | 94 | INTERFACES= syncdialog.ui |
93 | INCLUDEPATH += ../../include | 95 | INCLUDEPATH += ../../include |
94 | DEPENDPATH+= ../../include . | 96 | DEPENDPATH+= ../../include . |
97 | INCLUDEPATH += ../../core/apps/calibrate | ||
98 | DEPENDPATH+= ../../core/apps/calibrate | ||
95 | INCLUDEPATH += ../../rsync | 99 | INCLUDEPATH += ../../rsync |
96 | DEPENDPATH+= ../../rsync | 100 | DEPENDPATH+= ../../rsync |
97 | TARGET = qpe | 101 | TARGET = qpe |
98 | LIBS += -lqpe -lcrypt -lopie | 102 | LIBS += -lqpe -lcrypt -lopie |
99 | 103 | ||
100 | TRANSLATIONS = ../../i18n/de/qpe.ts \ | 104 | TRANSLATIONS = ../../i18n/de/qpe.ts \ |
101 | ../../i18n/nl/qpe.ts \ | 105 | ../../i18n/nl/qpe.ts \ |
102 | ../../i18n/xx/qpe.ts \ | 106 | ../../i18n/xx/qpe.ts \ |
103 | ../../i18n/en/qpe.ts \ | 107 | ../../i18n/en/qpe.ts \ |
104 | ../../i18n/es/qpe.ts \ | 108 | ../../i18n/es/qpe.ts \ |
105 | ../../i18n/fr/qpe.ts \ | 109 | ../../i18n/fr/qpe.ts \ |
106 | ../../i18n/hu/qpe.ts \ | 110 | ../../i18n/hu/qpe.ts \ |
107 | ../../i18n/ja/qpe.ts \ | 111 | ../../i18n/ja/qpe.ts \ |
108 | ../../i18n/ko/qpe.ts \ | 112 | ../../i18n/ko/qpe.ts \ |
109 | ../../i18n/no/qpe.ts \ | 113 | ../../i18n/no/qpe.ts \ |
110 | ../../i18n/pl/qpe.ts \ | 114 | ../../i18n/pl/qpe.ts \ |
111 | ../../i18n/pt/qpe.ts \ | 115 | ../../i18n/pt/qpe.ts \ |
112 | ../../i18n/pt_BR/qpe.ts \ | 116 | ../../i18n/pt_BR/qpe.ts \ |
113 | ../../i18n/sl/qpe.ts \ | 117 | ../../i18n/sl/qpe.ts \ |
114 | ../../i18n/zh_CN/qpe.ts \ | 118 | ../../i18n/zh_CN/qpe.ts \ |
115 | ../../i18n/it/qpe.ts \ | 119 | ../../i18n/it/qpe.ts \ |
116 | ../../i18n/zh_TW/qpe.ts \ | 120 | ../../i18n/zh_TW/qpe.ts \ |
117 | ../../i18n/da/qpe.ts | 121 | ../../i18n/da/qpe.ts |
118 | 122 | ||
119 | 123 | ||
120 | 124 | ||
121 | include ( $(OPIEDIR)/include.pro ) | 125 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index e96eeae..20a1ecd 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -1,194 +1,191 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | 20 | ||
21 | #include "desktop.h" | 21 | #include "desktop.h" |
22 | #include "taskbar.h" | 22 | #include "taskbar.h" |
23 | #include "stabmon.h" | 23 | #include "stabmon.h" |
24 | 24 | ||
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/network.h> | 26 | #include <qpe/network.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ ) | 28 | #if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ ) |
29 | #include <qpe/custom.h> | 29 | #include <qpe/custom.h> |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include <opie/odevice.h> | 32 | #include <opie/odevice.h> |
33 | #include <opie/oprocess.h> | ||
34 | 33 | ||
35 | #include <qmessagebox.h> | 34 | #include <qmessagebox.h> |
36 | #include <qfile.h> | 35 | #include <qfile.h> |
37 | #include <qimage.h> | 36 | #include <qimage.h> |
38 | #include <qwindowsystem_qws.h> | 37 | #include <qwindowsystem_qws.h> |
39 | #include <qwsmouse_qws.h> | 38 | #include <qwsmouse_qws.h> |
40 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
41 | #include <qpe/alarmserver.h> | 40 | #include <qpe/alarmserver.h> |
42 | 41 | ||
43 | #include <stdlib.h> | 42 | #include <stdlib.h> |
44 | #include <stdio.h> | 43 | #include <stdio.h> |
45 | #include <signal.h> | 44 | #include <signal.h> |
46 | #include <unistd.h> | 45 | #include <unistd.h> |
47 | 46 | ||
47 | #include "../calibrate/calibrate.h" | ||
48 | |||
48 | using namespace Opie; | 49 | using namespace Opie; |
49 | 50 | ||
50 | void initEnvironment() | 51 | void initEnvironment() |
51 | { | 52 | { |
52 | int rot; | 53 | int rot; |
53 | Config config("locale"); | 54 | Config config("locale"); |
54 | 55 | ||
55 | config.setGroup( "Location" ); | 56 | config.setGroup( "Location" ); |
56 | QString tz = config.readEntry( "Timezone", getenv("TZ") ); | 57 | QString tz = config.readEntry( "Timezone", getenv("TZ") ); |
57 | 58 | ||
58 | // if not timezone set, pick New York | 59 | // if not timezone set, pick New York |
59 | if (tz.isNull()) | 60 | if (tz.isNull()) |
60 | tz = "America/New_York"; | 61 | tz = "America/New_York"; |
61 | 62 | ||
62 | setenv( "TZ", tz, 1 ); | 63 | setenv( "TZ", tz, 1 ); |
63 | config.writeEntry( "Timezone", tz); | 64 | config.writeEntry( "Timezone", tz); |
64 | 65 | ||
65 | config.setGroup( "Language" ); | 66 | config.setGroup( "Language" ); |
66 | QString lang = config.readEntry( "Language", getenv("LANG") ); | 67 | QString lang = config.readEntry( "Language", getenv("LANG") ); |
67 | if ( !lang.isNull() ) | 68 | if ( !lang.isNull() ) |
68 | setenv( "LANG", lang, 1 ); | 69 | setenv( "LANG", lang, 1 ); |
69 | 70 | ||
70 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX) | 71 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX) |
71 | setenv( "QWS_SIZE", "240x320", 0 ); | 72 | setenv( "QWS_SIZE", "240x320", 0 ); |
72 | #endif | 73 | #endif |
73 | 74 | ||
74 | QString env(getenv("QWS_DISPLAY")); | 75 | QString env(getenv("QWS_DISPLAY")); |
75 | if (env.contains("Transformed")) { | 76 | if (env.contains("Transformed")) { |
76 | // transformed driver default rotation is controlled by the hardware. | 77 | // transformed driver default rotation is controlled by the hardware. |
77 | Config config("qpe"); | 78 | Config config("qpe"); |
78 | config.setGroup( "Rotation" ); | 79 | config.setGroup( "Rotation" ); |
79 | if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 ) | 80 | if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 ) |
80 | rot = ODevice::inst ( )-> rotation ( ) * 90; | 81 | rot = ODevice::inst ( )-> rotation ( ) * 90; |
81 | 82 | ||
82 | setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); | 83 | setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); |
83 | QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */ | 84 | QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */ |
84 | } | 85 | } |
85 | } | 86 | } |
86 | 87 | ||
87 | 88 | ||
88 | int initApplication( int argc, char ** argv ) | 89 | int initApplication( int argc, char ** argv ) |
89 | { | 90 | { |
90 | initEnvironment(); | 91 | initEnvironment(); |
91 | 92 | ||
92 | //Don't flicker at startup: | 93 | //Don't flicker at startup: |
93 | QWSServer::setDesktopBackground( QImage() ); | 94 | QWSServer::setDesktopBackground( QImage() ); |
94 | 95 | ||
95 | DesktopApplication a( argc, argv, QApplication::GuiServer ); | 96 | DesktopApplication a( argc, argv, QApplication::GuiServer ); |
96 | 97 | ||
97 | ODevice::inst ( )-> setSoftSuspend ( true ); | 98 | ODevice::inst ( )-> setSoftSuspend ( true ); |
98 | 99 | ||
99 | { // init backlight | 100 | { // init backlight |
100 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 101 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
101 | e << -3; // Forced on | 102 | e << -3; // Forced on |
102 | } | 103 | } |
103 | 104 | ||
104 | AlarmServer::initialize(); | 105 | AlarmServer::initialize(); |
105 | 106 | ||
106 | Desktop *d = new Desktop(); | 107 | Desktop *d = new Desktop(); |
107 | 108 | ||
108 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); | 109 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); |
109 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); | 110 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); |
110 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); | 111 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); |
111 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); | 112 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); |
112 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); | 113 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); |
113 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); | 114 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); |
114 | 115 | ||
115 | (void)new SysFileMonitor(d); | 116 | (void)new SysFileMonitor(d); |
116 | Network::createServer(d); | 117 | Network::createServer(d); |
117 | 118 | ||
118 | if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { | 119 | if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { |
119 | if ( !QFile::exists( "/etc/pointercal" ) ) { | 120 | if ( !QFile::exists( "/etc/pointercal" ) ) { |
120 | OProcess cal; | 121 | // Make sure calibration widget starts on top. |
121 | cal << "calibrate"; | 122 | Calibrate *cal = new Calibrate; |
122 | 123 | cal->exec(); | |
123 | if ( ! cal.start(OProcess::Block, OProcess::NoCommunication) ) { | 124 | delete cal; |
124 | QMessageBox::warning( 0, "Unable to calibrate", | ||
125 | "Failed to start the calibration tool.\n" | ||
126 | ); | ||
127 | } | ||
128 | } | 125 | } |
129 | } | 126 | } |
130 | 127 | ||
131 | d->show(); | 128 | d->show(); |
132 | 129 | ||
133 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { | 130 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { |
134 | if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { | 131 | if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { |
135 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); | 132 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); |
136 | e << QString ( ); | 133 | e << QString ( ); |
137 | } | 134 | } |
138 | } | 135 | } |
139 | 136 | ||
140 | int rv = a.exec(); | 137 | int rv = a.exec(); |
141 | 138 | ||
142 | delete d; | 139 | delete d; |
143 | 140 | ||
144 | ODevice::inst ( )-> setSoftSuspend ( false ); | 141 | ODevice::inst ( )-> setSoftSuspend ( false ); |
145 | 142 | ||
146 | return rv; | 143 | return rv; |
147 | } | 144 | } |
148 | 145 | ||
149 | static const char *pidfile_path = "/var/run/opie.pid"; | 146 | static const char *pidfile_path = "/var/run/opie.pid"; |
150 | 147 | ||
151 | void create_pidfile ( ) | 148 | void create_pidfile ( ) |
152 | { | 149 | { |
153 | FILE *f; | 150 | FILE *f; |
154 | 151 | ||
155 | if (( f = ::fopen ( pidfile_path, "w" ))) { | 152 | if (( f = ::fopen ( pidfile_path, "w" ))) { |
156 | ::fprintf ( f, "%d", getpid ( )); | 153 | ::fprintf ( f, "%d", getpid ( )); |
157 | ::fclose ( f ); | 154 | ::fclose ( f ); |
158 | } | 155 | } |
159 | } | 156 | } |
160 | 157 | ||
161 | void remove_pidfile ( ) | 158 | void remove_pidfile ( ) |
162 | { | 159 | { |
163 | ::unlink ( pidfile_path ); | 160 | ::unlink ( pidfile_path ); |
164 | } | 161 | } |
165 | 162 | ||
166 | void handle_sigterm ( int /* sig */ ) | 163 | void handle_sigterm ( int /* sig */ ) |
167 | { | 164 | { |
168 | if ( qApp ) | 165 | if ( qApp ) |
169 | qApp-> quit ( ); | 166 | qApp-> quit ( ); |
170 | } | 167 | } |
171 | 168 | ||
172 | int main( int argc, char ** argv ) | 169 | int main( int argc, char ** argv ) |
173 | { | 170 | { |
174 | ::signal ( SIGCHLD, SIG_IGN ); | 171 | ::signal ( SIGCHLD, SIG_IGN ); |
175 | 172 | ||
176 | ::signal ( SIGTERM, handle_sigterm ); | 173 | ::signal ( SIGTERM, handle_sigterm ); |
177 | ::signal ( SIGINT, handle_sigterm ); | 174 | ::signal ( SIGINT, handle_sigterm ); |
178 | 175 | ||
179 | ::setsid ( ); | 176 | ::setsid ( ); |
180 | ::setpgid ( 0, 0 ); | 177 | ::setpgid ( 0, 0 ); |
181 | 178 | ||
182 | ::atexit ( remove_pidfile ); | 179 | ::atexit ( remove_pidfile ); |
183 | create_pidfile ( ); | 180 | create_pidfile ( ); |
184 | 181 | ||
185 | int retVal = initApplication ( argc, argv ); | 182 | int retVal = initApplication ( argc, argv ); |
186 | 183 | ||
187 | // Kill them. Kill them all. | 184 | // Kill them. Kill them all. |
188 | ::kill ( 0, SIGTERM ); | 185 | ::kill ( 0, SIGTERM ); |
189 | ::sleep ( 1 ); | 186 | ::sleep ( 1 ); |
190 | ::kill ( 0, SIGKILL ); | 187 | ::kill ( 0, SIGKILL ); |
191 | 188 | ||
192 | return retVal; | 189 | return retVal; |
193 | } | 190 | } |
194 | 191 | ||
diff --git a/core/launcher/opie-taskbar.control b/core/launcher/opie-taskbar.control index db66a05..c0430b7 100644 --- a/core/launcher/opie-taskbar.control +++ b/core/launcher/opie-taskbar.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Files: bin/qpe pics/launcher pics/devicebuttons/*.png plugins/applets/libsuspendapplet.so* plugins/applets/libhomeapplet.so* plugins/applets/liblogoutapplet.so* plugins/applets/librotateapplet.so* root/etc/init.d/opie | 1 | Files: bin/qpe apps/Settings/Calibrate.desktop pics/launcher pics/devicebuttons/*.png plugins/applets/libsuspendapplet.so* plugins/applets/libhomeapplet.so* plugins/applets/liblogoutapplet.so* plugins/applets/librotateapplet.so* root/etc/init.d/opie |
2 | Priority: required | 2 | Priority: required |
3 | Section: opie/system | 3 | Section: opie/system |
4 | Maintainer: Project Opie <opie@handhelds.org> | 4 | Maintainer: Project Opie <opie@handhelds.org> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION.3 | 6 | Version: $QPE_VERSION-$SUB_VERSION.3 |
7 | Depends: opie-base, opie-calibrate | 7 | Depends: opie-base |
8 | Replaces: opie-rotation | 8 | Replaces: opie-rotation |
9 | Description: Launcher for Opie | 9 | Description: Launcher for Opie |
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index 8158128..8af568d 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp | |||
@@ -1,329 +1,344 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | 20 | ||
21 | #include "startmenu.h" | 21 | #include "startmenu.h" |
22 | #include "inputmethods.h" | 22 | #include "inputmethods.h" |
23 | #include "runningappbar.h" | 23 | #include "runningappbar.h" |
24 | #include "systray.h" | 24 | #include "systray.h" |
25 | #include "calibrate.h" | ||
25 | #include "wait.h" | 26 | #include "wait.h" |
26 | #include "appicons.h" | 27 | #include "appicons.h" |
27 | 28 | ||
28 | #include "taskbar.h" | 29 | #include "taskbar.h" |
29 | #include "desktop.h" | 30 | #include "desktop.h" |
30 | 31 | ||
31 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
32 | #include <qpe/qcopenvelope_qws.h> | 33 | #include <qpe/qcopenvelope_qws.h> |
33 | #include <qpe/global.h> | 34 | #include <qpe/global.h> |
34 | 35 | ||
35 | #if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ ) | 36 | #if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ ) |
36 | #include <qpe/custom.h> | 37 | #include <qpe/custom.h> |
37 | #endif | 38 | #endif |
38 | 39 | ||
39 | #include <opie/odevice.h> | 40 | #include <opie/odevice.h> |
40 | 41 | ||
41 | #include <qlabel.h> | 42 | #include <qlabel.h> |
42 | #include <qlayout.h> | 43 | #include <qlayout.h> |
43 | #include <qtimer.h> | 44 | #include <qtimer.h> |
44 | #include <qwindowsystem_qws.h> | 45 | #include <qwindowsystem_qws.h> |
45 | #include <qwidgetstack.h> | 46 | #include <qwidgetstack.h> |
46 | 47 | ||
47 | #if defined( Q_WS_QWS ) | 48 | #if defined( Q_WS_QWS ) |
48 | #include <qwsdisplay_qws.h> | 49 | #include <qwsdisplay_qws.h> |
49 | #include <qgfx_qws.h> | 50 | #include <qgfx_qws.h> |
50 | #endif | 51 | #endif |
51 | 52 | ||
52 | 53 | ||
53 | using namespace Opie; | 54 | using namespace Opie; |
54 | 55 | ||
55 | #define FACTORY(T) \ | 56 | #define FACTORY(T) \ |
56 | static QWidget *new##T( bool maximized ) { \ | 57 | static QWidget *new##T( bool maximized ) { \ |
57 | QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ | 58 | QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ |
58 | if ( maximized ) { \ | 59 | if ( maximized ) { \ |
59 | if ( qApp->desktop()->width() <= 350 ) { \ | 60 | if ( qApp->desktop()->width() <= 350 ) { \ |
60 | w->showMaximized(); \ | 61 | w->showMaximized(); \ |
61 | } else { \ | 62 | } else { \ |
62 | w->resize( QSize( 300, 300 ) ); \ | 63 | w->resize( QSize( 300, 300 ) ); \ |
63 | } \ | 64 | } \ |
64 | } \ | 65 | } \ |
65 | w->show(); \ | 66 | w->show(); \ |
66 | return w; \ | 67 | return w; \ |
67 | } | 68 | } |
68 | 69 | ||
69 | 70 | ||
70 | #ifdef SINGLE_APP | 71 | #ifdef SINGLE_APP |
71 | #define APP(a,b,c,d) FACTORY(b) | 72 | #define APP(a,b,c,d) FACTORY(b) |
72 | #include "../launcher/apps.h" | 73 | #include "../launcher/apps.h" |
73 | #undef APP | 74 | #undef APP |
74 | #endif // SINGLE_APP | 75 | #endif // SINGLE_APP |
75 | 76 | ||
76 | static Global::Command builtins[] = { | 77 | static Global::Command builtins[] = { |
77 | 78 | ||
78 | #ifdef SINGLE_APP | 79 | #ifdef SINGLE_APP |
79 | #define APP(a,b,c,d) { a, new##b, c }, | 80 | #define APP(a,b,c,d) { a, new##b, c }, |
80 | #include "../launcher/apps.h" | 81 | #include "../launcher/apps.h" |
81 | #undef APP | 82 | #undef APP |
82 | #endif | 83 | #endif |
83 | 84 | ||
85 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SL5XXX) | ||
86 | { "calibrate", TaskBar::calibrate, 1, 0 }, | ||
87 | #endif | ||
84 | #if !defined(QT_QWS_CASSIOPEIA) | 88 | #if !defined(QT_QWS_CASSIOPEIA) |
85 | { "shutdown", Global::shutdown, 1, 0 }, | 89 | { "shutdown", Global::shutdown, 1, 0 }, |
86 | // { "run", run, 1, 0 }, | 90 | // { "run", run, 1, 0 }, |
87 | #endif | 91 | #endif |
88 | 92 | ||
89 | { 0, 0, 0, 0 }, | 93 | { 0, TaskBar::calibrate, 0, 0 }, |
90 | }; | 94 | }; |
91 | 95 | ||
92 | static bool initNumLock() | 96 | static bool initNumLock() |
93 | { | 97 | { |
94 | #ifdef QPE_INITIAL_NUMLOCK_STATE | 98 | #ifdef QPE_INITIAL_NUMLOCK_STATE |
95 | QPE_INITIAL_NUMLOCK_STATE | 99 | QPE_INITIAL_NUMLOCK_STATE |
96 | #endif | 100 | #endif |
97 | return FALSE; | 101 | return FALSE; |
98 | } | 102 | } |
99 | 103 | ||
100 | class LockKeyState : public QWidget | 104 | class LockKeyState : public QWidget |
101 | { | 105 | { |
102 | public: | 106 | public: |
103 | LockKeyState( QWidget *parent ) : | 107 | LockKeyState( QWidget *parent ) : |
104 | QWidget(parent), | 108 | QWidget(parent), |
105 | nl(initNumLock()), cl(FALSE) | 109 | nl(initNumLock()), cl(FALSE) |
106 | { | 110 | { |
107 | nl_pm = Resource::loadPixmap("numlock"); | 111 | nl_pm = Resource::loadPixmap("numlock"); |
108 | cl_pm = Resource::loadPixmap("capslock"); | 112 | cl_pm = Resource::loadPixmap("capslock"); |
109 | } | 113 | } |
110 | QSize sizeHint() const | 114 | QSize sizeHint() const |
111 | { | 115 | { |
112 | return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); | 116 | return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); |
113 | } | 117 | } |
114 | void toggleNumLockState() | 118 | void toggleNumLockState() |
115 | { | 119 | { |
116 | nl = !nl; repaint(); | 120 | nl = !nl; repaint(); |
117 | } | 121 | } |
118 | void toggleCapsLockState() | 122 | void toggleCapsLockState() |
119 | { | 123 | { |
120 | cl = !cl; repaint(); | 124 | cl = !cl; repaint(); |
121 | } | 125 | } |
122 | void paintEvent( QPaintEvent * ) | 126 | void paintEvent( QPaintEvent * ) |
123 | { | 127 | { |
124 | int y = (height()-sizeHint().height())/2; | 128 | int y = (height()-sizeHint().height())/2; |
125 | QPainter p(this); | 129 | QPainter p(this); |
126 | if ( nl ) | 130 | if ( nl ) |
127 | p.drawPixmap(1,y,nl_pm); | 131 | p.drawPixmap(1,y,nl_pm); |
128 | if ( cl ) | 132 | if ( cl ) |
129 | p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); | 133 | p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); |
130 | } | 134 | } |
131 | private: | 135 | private: |
132 | QPixmap nl_pm, cl_pm; | 136 | QPixmap nl_pm, cl_pm; |
133 | bool nl, cl; | 137 | bool nl, cl; |
134 | }; | 138 | }; |
135 | 139 | ||
136 | TaskBar::~TaskBar() | 140 | TaskBar::~TaskBar() |
137 | { | 141 | { |
138 | } | 142 | } |
139 | 143 | ||
140 | 144 | ||
141 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) | 145 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) |
142 | { | 146 | { |
143 | Global::setBuiltinCommands(builtins); | 147 | Global::setBuiltinCommands(builtins); |
144 | 148 | ||
145 | sm = new StartMenu( this ); | 149 | sm = new StartMenu( this ); |
146 | 150 | ||
147 | inputMethods = new InputMethods( this ); | 151 | inputMethods = new InputMethods( this ); |
148 | connect( inputMethods, SIGNAL(inputToggled(bool)), | 152 | connect( inputMethods, SIGNAL(inputToggled(bool)), |
149 | this, SLOT(calcMaxWindowRect()) ); | 153 | this, SLOT(calcMaxWindowRect()) ); |
150 | //new QuickLauncher( this ); | 154 | //new QuickLauncher( this ); |
151 | 155 | ||
152 | stack = new QWidgetStack( this ); | 156 | stack = new QWidgetStack( this ); |
153 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); | 157 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); |
154 | label = new QLabel(stack); | 158 | label = new QLabel(stack); |
155 | 159 | ||
156 | //mru = new MRUList( stack ); | 160 | //mru = new MRUList( stack ); |
157 | //stack->raiseWidget( mru ); | 161 | //stack->raiseWidget( mru ); |
158 | 162 | ||
159 | runningAppBar = new RunningAppBar(stack); | 163 | runningAppBar = new RunningAppBar(stack); |
160 | stack->raiseWidget(runningAppBar); | 164 | stack->raiseWidget(runningAppBar); |
161 | 165 | ||
162 | waitIcon = new Wait( this ); | 166 | waitIcon = new Wait( this ); |
163 | (void) new AppIcons( this ); | 167 | (void) new AppIcons( this ); |
164 | 168 | ||
165 | sysTray = new SysTray( this ); | 169 | sysTray = new SysTray( this ); |
166 | 170 | ||
167 | // ## make customizable in some way? | 171 | // ## make customizable in some way? |
168 | lockState = new LockKeyState( this ); | 172 | lockState = new LockKeyState( this ); |
169 | 173 | ||
170 | #if defined(Q_WS_QWS) | 174 | #if defined(Q_WS_QWS) |
171 | #if !defined(QT_NO_COP) | 175 | #if !defined(QT_NO_COP) |
172 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); | 176 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); |
173 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 177 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
174 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 178 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
175 | #endif | 179 | #endif |
176 | #endif | 180 | #endif |
177 | waitTimer = new QTimer( this ); | 181 | waitTimer = new QTimer( this ); |
178 | connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); | 182 | connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); |
179 | clearer = new QTimer( this ); | 183 | clearer = new QTimer( this ); |
180 | QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); | 184 | QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); |
181 | QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); | 185 | QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); |
182 | } | 186 | } |
183 | 187 | ||
184 | void TaskBar::setStatusMessage( const QString &text ) | 188 | void TaskBar::setStatusMessage( const QString &text ) |
185 | { | 189 | { |
186 | if ( !text.isEmpty() ) { | 190 | if ( !text.isEmpty() ) { |
187 | label->setText( text ); | 191 | label->setText( text ); |
188 | stack->raiseWidget( label ); | 192 | stack->raiseWidget( label ); |
189 | if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) | 193 | if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) |
190 | sysTray->hide(); | 194 | sysTray->hide(); |
191 | clearer->start( 3000, TRUE ); | 195 | clearer->start( 3000, TRUE ); |
192 | } else { | 196 | } else { |
193 | clearStatusBar(); | 197 | clearStatusBar(); |
194 | } | 198 | } |
195 | } | 199 | } |
196 | 200 | ||
197 | void TaskBar::clearStatusBar() | 201 | void TaskBar::clearStatusBar() |
198 | { | 202 | { |
199 | label->clear(); | 203 | label->clear(); |
200 | stack->raiseWidget(runningAppBar); | 204 | stack->raiseWidget(runningAppBar); |
201 | // stack->raiseWidget( mru ); | 205 | // stack->raiseWidget( mru ); |
202 | } | 206 | } |
203 | 207 | ||
204 | void TaskBar::startWait() | 208 | void TaskBar::startWait() |
205 | { | 209 | { |
206 | waitIcon->setWaiting( true ); | 210 | waitIcon->setWaiting( true ); |
207 | // a catchall stop after 10 seconds... | 211 | // a catchall stop after 10 seconds... |
208 | waitTimer->start( 10 * 1000, true ); | 212 | waitTimer->start( 10 * 1000, true ); |
209 | } | 213 | } |
210 | 214 | ||
211 | void TaskBar::stopWait(const QString& /*app*/) | 215 | void TaskBar::stopWait(const QString& /*app*/) |
212 | { | 216 | { |
213 | waitTimer->stop(); | 217 | waitTimer->stop(); |
214 | //mru->addTask(sm->execToLink(app)); | 218 | //mru->addTask(sm->execToLink(app)); |
215 | waitIcon->setWaiting( false ); | 219 | waitIcon->setWaiting( false ); |
216 | } | 220 | } |
217 | 221 | ||
218 | void TaskBar::stopWait() | 222 | void TaskBar::stopWait() |
219 | { | 223 | { |
220 | waitTimer->stop(); | 224 | waitTimer->stop(); |
221 | 225 | ||
222 | waitIcon->setWaiting( false ); | 226 | waitIcon->setWaiting( false ); |
223 | } | 227 | } |
224 | 228 | ||
225 | void TaskBar::resizeEvent( QResizeEvent *e ) | 229 | void TaskBar::resizeEvent( QResizeEvent *e ) |
226 | { | 230 | { |
227 | QHBox::resizeEvent( e ); | 231 | QHBox::resizeEvent( e ); |
228 | calcMaxWindowRect(); | 232 | calcMaxWindowRect(); |
229 | } | 233 | } |
230 | 234 | ||
231 | void TaskBar::styleChange( QStyle &s ) | 235 | void TaskBar::styleChange( QStyle &s ) |
232 | { | 236 | { |
233 | QHBox::styleChange( s ); | 237 | QHBox::styleChange( s ); |
234 | calcMaxWindowRect(); | 238 | calcMaxWindowRect(); |
235 | } | 239 | } |
236 | 240 | ||
237 | void TaskBar::calcMaxWindowRect() | 241 | void TaskBar::calcMaxWindowRect() |
238 | { | 242 | { |
239 | #ifdef Q_WS_QWS | 243 | #ifdef Q_WS_QWS |
240 | QRect wr; | 244 | QRect wr; |
241 | int displayWidth = qApp->desktop()->width(); | 245 | int displayWidth = qApp->desktop()->width(); |
242 | QRect ir = inputMethods->inputRect(); | 246 | QRect ir = inputMethods->inputRect(); |
243 | if ( ir.isValid() ) { | 247 | if ( ir.isValid() ) { |
244 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); | 248 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); |
245 | } else { | 249 | } else { |
246 | wr.setCoords( 0, 0, displayWidth-1, y()-1 ); | 250 | wr.setCoords( 0, 0, displayWidth-1, y()-1 ); |
247 | } | 251 | } |
248 | 252 | ||
249 | #if QT_VERSION < 300 | 253 | #if QT_VERSION < 300 |
250 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, | 254 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, |
251 | QSize(qt_screen->width(),qt_screen->height())) | 255 | QSize(qt_screen->width(),qt_screen->height())) |
252 | ); | 256 | ); |
253 | #else | 257 | #else |
254 | QWSServer::setMaxWindowRect( wr ); | 258 | QWSServer::setMaxWindowRect( wr ); |
255 | #endif | 259 | #endif |
256 | #endif | 260 | #endif |
257 | } | 261 | } |
258 | 262 | ||
259 | void TaskBar::receive( const QCString &msg, const QByteArray &data ) | 263 | void TaskBar::receive( const QCString &msg, const QByteArray &data ) |
260 | { | 264 | { |
261 | QDataStream stream( data, IO_ReadOnly ); | 265 | QDataStream stream( data, IO_ReadOnly ); |
262 | if ( msg == "message(QString)" ) { | 266 | if ( msg == "message(QString)" ) { |
263 | QString text; | 267 | QString text; |
264 | stream >> text; | 268 | stream >> text; |
265 | setStatusMessage( text ); | 269 | setStatusMessage( text ); |
266 | } else if ( msg == "hideInputMethod()" ) { | 270 | } else if ( msg == "hideInputMethod()" ) { |
267 | inputMethods->hideInputMethod(); | 271 | inputMethods->hideInputMethod(); |
268 | } else if ( msg == "showInputMethod()" ) { | 272 | } else if ( msg == "showInputMethod()" ) { |
269 | inputMethods->showInputMethod(); | 273 | inputMethods->showInputMethod(); |
270 | } else if ( msg == "reloadInputMethods()" ) { | 274 | } else if ( msg == "reloadInputMethods()" ) { |
271 | inputMethods->loadInputMethods(); | 275 | inputMethods->loadInputMethods(); |
272 | } else if ( msg == "reloadApps()" ) { | 276 | } else if ( msg == "reloadApps()" ) { |
273 | sm->reloadApps(); | 277 | sm->reloadApps(); |
274 | } else if ( msg == "reloadApplets()" ) { | 278 | } else if ( msg == "reloadApplets()" ) { |
275 | sysTray->clearApplets(); | 279 | sysTray->clearApplets(); |
276 | sysTray->addApplets(); | 280 | sysTray->addApplets(); |
277 | sm->reloadApplets(); | 281 | sm->reloadApplets(); |
278 | } else if ( msg == "soundAlarm()" ) { | 282 | } else if ( msg == "soundAlarm()" ) { |
279 | DesktopApplication::soundAlarm ( ); | 283 | DesktopApplication::soundAlarm ( ); |
280 | } | 284 | } |
281 | else if ( msg == "setLed(int,bool)" ) { | 285 | else if ( msg == "setLed(int,bool)" ) { |
282 | int led, status; | 286 | int led, status; |
283 | stream >> led >> status; | 287 | stream >> led >> status; |
284 | 288 | ||
285 | QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); | 289 | QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); |
286 | if ( ll. count ( )){ | 290 | if ( ll. count ( )){ |
287 | OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0]; | 291 | OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0]; |
288 | bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow ); | 292 | bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow ); |
289 | 293 | ||
290 | ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off ); | 294 | ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off ); |
291 | } | 295 | } |
292 | } | 296 | } |
293 | else if ( msg == "toggleMenu()" ) { | 297 | else if ( msg == "toggleMenu()" ) { |
294 | if ( sm-> launchMenu-> isVisible ( )) | 298 | if ( sm-> launchMenu-> isVisible ( )) |
295 | sm-> launch ( ); | 299 | sm-> launch ( ); |
296 | else { | 300 | else { |
297 | QCopEnvelope e ( "QPE/System", "toggleApplicationMenu()" ); | 301 | QCopEnvelope e ( "QPE/System", "toggleApplicationMenu()" ); |
298 | } | 302 | } |
299 | } | 303 | } |
300 | else if ( msg == "toggleStartMenu()" ) { | 304 | else if ( msg == "toggleStartMenu()" ) { |
301 | sm-> launch ( ); | 305 | sm-> launch ( ); |
302 | } | 306 | } |
303 | } | 307 | } |
304 | 308 | ||
309 | QWidget *TaskBar::calibrate(bool) | ||
310 | { | ||
311 | #ifdef Q_WS_QWS | ||
312 | Calibrate *c = new Calibrate; | ||
313 | c->show(); | ||
314 | return c; | ||
315 | #else | ||
316 | return 0; | ||
317 | #endif | ||
318 | } | ||
319 | |||
305 | void TaskBar::toggleNumLockState() | 320 | void TaskBar::toggleNumLockState() |
306 | { | 321 | { |
307 | if ( lockState ) lockState->toggleNumLockState(); | 322 | if ( lockState ) lockState->toggleNumLockState(); |
308 | } | 323 | } |
309 | 324 | ||
310 | void TaskBar::toggleCapsLockState() | 325 | void TaskBar::toggleCapsLockState() |
311 | { | 326 | { |
312 | if ( lockState ) lockState->toggleCapsLockState(); | 327 | if ( lockState ) lockState->toggleCapsLockState(); |
313 | } | 328 | } |
314 | 329 | ||
315 | void TaskBar::toggleSymbolInput() | 330 | void TaskBar::toggleSymbolInput() |
316 | { | 331 | { |
317 | if ( inputMethods->currentShown() == "Unicode" ) { | 332 | if ( inputMethods->currentShown() == "Unicode" ) { |
318 | inputMethods->hideInputMethod(); | 333 | inputMethods->hideInputMethod(); |
319 | } else { | 334 | } else { |
320 | inputMethods->showInputMethod("Unicode"); | 335 | inputMethods->showInputMethod("Unicode"); |
321 | } | 336 | } |
322 | } | 337 | } |
323 | 338 | ||
324 | bool TaskBar::recoverMemory() | 339 | bool TaskBar::recoverMemory() |
325 | { | 340 | { |
326 | //eturn mru->quitOldApps(); | 341 | //eturn mru->quitOldApps(); |
327 | return true; | 342 | return true; |
328 | } | 343 | } |
329 | 344 | ||
diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h index 575a8c9..a0bf395 100644 --- a/core/launcher/taskbar.h +++ b/core/launcher/taskbar.h | |||
@@ -1,83 +1,85 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | 20 | ||
21 | #ifndef __TASKBAR_H__ | 21 | #ifndef __TASKBAR_H__ |
22 | #define __TASKBAR_H__ | 22 | #define __TASKBAR_H__ |
23 | 23 | ||
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | 25 | ||
26 | class QLabel; | 26 | class QLabel; |
27 | class QTimer; | 27 | class QTimer; |
28 | class InputMethods; | 28 | class InputMethods; |
29 | class Wait; | 29 | class Wait; |
30 | class SysTray; | 30 | class SysTray; |
31 | //class MRUList; | 31 | //class MRUList; |
32 | class RunningAppBar; | 32 | class RunningAppBar; |
33 | class QWidgetStack; | 33 | class QWidgetStack; |
34 | class QTimer; | 34 | class QTimer; |
35 | class QLabel; | 35 | class QLabel; |
36 | class StartMenu; | 36 | class StartMenu; |
37 | class LockKeyState; | 37 | class LockKeyState; |
38 | 38 | ||
39 | class TaskBar : public QHBox { | 39 | class TaskBar : public QHBox { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | public: | 41 | public: |
42 | TaskBar(); | 42 | TaskBar(); |
43 | ~TaskBar(); | 43 | ~TaskBar(); |
44 | 44 | ||
45 | static QWidget *calibrate( bool ); | ||
46 | |||
45 | bool recoverMemory(); | 47 | bool recoverMemory(); |
46 | 48 | ||
47 | StartMenu *startMenu() const { return sm; } | 49 | StartMenu *startMenu() const { return sm; } |
48 | public slots: | 50 | public slots: |
49 | void startWait(); | 51 | void startWait(); |
50 | void stopWait(const QString&); | 52 | void stopWait(const QString&); |
51 | void stopWait(); | 53 | void stopWait(); |
52 | void clearStatusBar(); | 54 | void clearStatusBar(); |
53 | void toggleNumLockState(); | 55 | void toggleNumLockState(); |
54 | void toggleCapsLockState(); | 56 | void toggleCapsLockState(); |
55 | void toggleSymbolInput(); | 57 | void toggleSymbolInput(); |
56 | 58 | ||
57 | protected: | 59 | protected: |
58 | void resizeEvent( QResizeEvent * ); | 60 | void resizeEvent( QResizeEvent * ); |
59 | void styleChange( QStyle & ); | 61 | void styleChange( QStyle & ); |
60 | void setStatusMessage( const QString &text ); | 62 | void setStatusMessage( const QString &text ); |
61 | 63 | ||
62 | public slots: | 64 | public slots: |
63 | void calcMaxWindowRect(); | 65 | void calcMaxWindowRect(); |
64 | private slots: | 66 | private slots: |
65 | void receive( const QCString &msg, const QByteArray &data ); | 67 | void receive( const QCString &msg, const QByteArray &data ); |
66 | 68 | ||
67 | private: | 69 | private: |
68 | 70 | ||
69 | QTimer *waitTimer; | 71 | QTimer *waitTimer; |
70 | Wait *waitIcon; | 72 | Wait *waitIcon; |
71 | InputMethods *inputMethods; | 73 | InputMethods *inputMethods; |
72 | SysTray *sysTray; | 74 | SysTray *sysTray; |
73 | // MRUList *mru; | 75 | // MRUList *mru; |
74 | RunningAppBar* runningAppBar; | 76 | RunningAppBar* runningAppBar; |
75 | QWidgetStack *stack; | 77 | QWidgetStack *stack; |
76 | QTimer *clearer; | 78 | QTimer *clearer; |
77 | QLabel *label; | 79 | QLabel *label; |
78 | LockKeyState* lockState; | 80 | LockKeyState* lockState; |
79 | StartMenu *sm; | 81 | StartMenu *sm; |
80 | }; | 82 | }; |
81 | 83 | ||
82 | 84 | ||
83 | #endif // __TASKBAR_H__ | 85 | #endif // __TASKBAR_H__ |