-rw-r--r-- | core/launcher/desktop.cpp | 1070 | ||||
-rw-r--r-- | core/launcher/desktop.h | 149 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 7 | ||||
-rw-r--r-- | core/launcher/main.cpp | 5 | ||||
-rw-r--r-- | core/launcher/opie-taskbar.control | 2 | ||||
-rw-r--r-- | core/launcher/runningappbar.cpp | 9 | ||||
-rw-r--r-- | core/launcher/startmenu.cpp | 19 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 12 |
8 files changed, 608 insertions, 665 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 6c67056..fa9736f 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -28,9 +28,9 @@ | |||
28 | #include "transferserver.h" | 28 | #include "transferserver.h" |
29 | #include "irserver.h" | 29 | #include "irserver.h" |
30 | #include "packageslave.h" | 30 | #include "packageslave.h" |
31 | #include "screensaver.h" | 31 | #include "screensaver.h" |
32 | 32 | ||
33 | #include <qpe/applnk.h> | 33 | #include <qpe/applnk.h> |
34 | #include <qpe/mimetype.h> | 34 | #include <qpe/mimetype.h> |
35 | #include <qpe/password.h> | 35 | #include <qpe/password.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
@@ -57,35 +57,36 @@ | |||
57 | #include <stdlib.h> | 57 | #include <stdlib.h> |
58 | #include <unistd.h> | 58 | #include <unistd.h> |
59 | #include <fcntl.h> | 59 | #include <fcntl.h> |
60 | 60 | ||
61 | |||
61 | using namespace Opie; | 62 | using namespace Opie; |
62 | 63 | ||
63 | class QCopKeyRegister | 64 | class QCopKeyRegister |
64 | { | 65 | { |
65 | public: | 66 | public: |
66 | QCopKeyRegister() : keyCode( 0 ) | 67 | QCopKeyRegister() : keyCode( 0 ) |
67 | { } | 68 | { } |
68 | QCopKeyRegister( int k, const QString &c, const QString &m ) | 69 | QCopKeyRegister( int k, const QCString &c, const QCString &m ) |
69 | : keyCode( k ), channel( c ), message( m ) | 70 | : keyCode( k ), channel( c ), message( m ) |
70 | { } | 71 | { } |
71 | 72 | ||
72 | int getKeyCode() const | 73 | int getKeyCode() const |
73 | { | 74 | { |
74 | return keyCode; | 75 | return keyCode; |
75 | } | 76 | } |
76 | QString getChannel() const | 77 | QCString getChannel() const |
77 | { | 78 | { |
78 | return channel; | 79 | return channel; |
79 | } | 80 | } |
80 | QString getMessage() const | 81 | QCString getMessage() const |
81 | { | 82 | { |
82 | return message; | 83 | return message; |
83 | } | 84 | } |
84 | 85 | ||
85 | private: | 86 | private: |
86 | int keyCode; | 87 | int keyCode; |
87 | QString channel, message; | 88 | QCString channel, message; |
88 | }; | 89 | }; |
89 | 90 | ||
90 | typedef QValueList<QCopKeyRegister> KeyRegisterList; | 91 | typedef QValueList<QCopKeyRegister> KeyRegisterList; |
91 | KeyRegisterList keyRegisterList; | 92 | KeyRegisterList keyRegisterList; |
@@ -93,19 +94,19 @@ KeyRegisterList keyRegisterList; | |||
93 | static Desktop* qpedesktop = 0; | 94 | static Desktop* qpedesktop = 0; |
94 | static int loggedin = 0; | 95 | static int loggedin = 0; |
95 | static void login( bool at_poweron ) | 96 | static void login( bool at_poweron ) |
96 | { | 97 | { |
97 | if ( !loggedin ) { | 98 | if ( !loggedin ) { |
98 | Global::terminateBuiltin( "calibrate" ); | 99 | Global::terminateBuiltin( "calibrate" ); |
99 | Password::authenticate( at_poweron ); | 100 | Password::authenticate( at_poweron ); |
100 | loggedin = 1; | 101 | loggedin = 1; |
101 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); | 102 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); |
102 | } | 103 | } |
103 | } | 104 | } |
104 | 105 | ||
105 | bool Desktop::screenLocked() | 106 | bool Desktop::screenLocked() |
106 | { | 107 | { |
107 | return loggedin == 0; | 108 | return loggedin == 0; |
108 | } | 109 | } |
109 | 110 | ||
110 | /* | 111 | /* |
111 | Priority is number of alerts that are needed to pop up | 112 | Priority is number of alerts that are needed to pop up |
@@ -113,101 +114,112 @@ bool Desktop::screenLocked() | |||
113 | */ | 114 | */ |
114 | class DesktopPowerAlerter : public QMessageBox | 115 | class DesktopPowerAlerter : public QMessageBox |
115 | { | 116 | { |
116 | public: | 117 | public: |
117 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) | 118 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) |
118 | : QMessageBox( tr( "Battery Status" ), "Low Battery", | 119 | : QMessageBox( tr( "Battery Status" ), "Low Battery", |
119 | QMessageBox::Critical, | 120 | QMessageBox::Critical, |
120 | QMessageBox::Ok | QMessageBox::Default, | 121 | QMessageBox::Ok | QMessageBox::Default, |
121 | QMessageBox::NoButton, QMessageBox::NoButton, | 122 | QMessageBox::NoButton, QMessageBox::NoButton, |
122 | parent, name, FALSE ) | 123 | parent, name, FALSE ) |
123 | { | 124 | { |
124 | currentPriority = INT_MAX; | 125 | currentPriority = INT_MAX; |
125 | alertCount = 0; | 126 | alertCount = 0; |
126 | } | 127 | } |
127 | 128 | ||
128 | void alert( const QString &text, int priority ); | 129 | void alert( const QString &text, int priority ); |
129 | void hideEvent( QHideEvent * ); | 130 | void hideEvent( QHideEvent * ); |
130 | private: | 131 | private: |
131 | int currentPriority; | 132 | int currentPriority; |
132 | int alertCount; | 133 | int alertCount; |
133 | }; | 134 | }; |
134 | 135 | ||
135 | void DesktopPowerAlerter::alert( const QString &text, int priority ) | 136 | void DesktopPowerAlerter::alert( const QString &text, int priority ) |
136 | { | 137 | { |
137 | alertCount++; | 138 | alertCount++; |
138 | if ( alertCount < priority ) | 139 | if ( alertCount < priority ) |
139 | return ; | 140 | return ; |
140 | if ( priority > currentPriority ) | 141 | if ( priority > currentPriority ) |
141 | return ; | 142 | return ; |
142 | currentPriority = priority; | 143 | currentPriority = priority; |
143 | setText( text ); | 144 | setText( text ); |
144 | show(); | 145 | show(); |
145 | } | 146 | } |
146 | 147 | ||
147 | 148 | ||
148 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) | 149 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) |
149 | { | 150 | { |
150 | QMessageBox::hideEvent( e ); | 151 | QMessageBox::hideEvent( e ); |
151 | alertCount = 0; | 152 | alertCount = 0; |
152 | currentPriority = INT_MAX; | 153 | currentPriority = INT_MAX; |
153 | } | 154 | } |
154 | 155 | ||
155 | 156 | ||
156 | void DesktopApplication::switchLCD ( bool on ) | 157 | void DesktopApplication::switchLCD ( bool on ) |
157 | { | 158 | { |
158 | if ( qApp ) { | 159 | if ( qApp ) { |
159 | DesktopApplication *dapp = (DesktopApplication *) qApp; | 160 | DesktopApplication *dapp = (DesktopApplication *) qApp; |
160 | 161 | ||
161 | if ( dapp-> m_screensaver ) { | 162 | if ( dapp-> m_screensaver ) { |
162 | if ( on ) { | 163 | if ( on ) { |
163 | dapp-> m_screensaver-> setDisplayState ( true ); | 164 | dapp-> m_screensaver-> setDisplayState ( true ); |
164 | dapp-> m_screensaver-> setBacklight ( -3 ); | 165 | dapp-> m_screensaver-> setBacklight ( -3 ); |
165 | } | 166 | } |
166 | else { | 167 | else { |
167 | dapp-> m_screensaver-> setDisplayState ( false ); | 168 | dapp-> m_screensaver-> setDisplayState ( false ); |
168 | } | 169 | } |
169 | } | 170 | } |
170 | } | 171 | } |
171 | } | 172 | } |
172 | 173 | ||
173 | 174 | ||
174 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) | 175 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) |
175 | : QPEApplication( argc, argv, appType ) | 176 | : QPEApplication( argc, argv, appType ) |
176 | { | 177 | { |
177 | 178 | ||
178 | Config cfg( "apm" ); | 179 | Config cfg( "apm" ); |
179 | cfg.setGroup( "Warnings" ); | 180 | cfg.setGroup( "Warnings" ); |
180 | //cfg.readNumEntry( "checkinterval", 10000 ) | 181 | //cfg.readNumEntry( "checkinterval", 10000 ) |
181 | m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); | 182 | m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); |
182 | m_powerCritical = cfg.readNumEntry( "powercritical", 5 ); | 183 | m_powerCritical = cfg.readNumEntry( "powercritical", 5 ); |
183 | 184 | ||
184 | m_ps = new PowerStatus; | 185 | m_ps = new PowerStatus; |
185 | m_ps_last = new PowerStatus; | 186 | m_ps_last = new PowerStatus; |
186 | pa = new DesktopPowerAlerter( 0 ); | 187 | pa = new DesktopPowerAlerter( 0 ); |
187 | 188 | ||
188 | m_timer = new QTimer( this ); | 189 | m_timer = new QTimer( this ); |
189 | connect( m_timer, SIGNAL( timeout() ), this, SLOT( apmTimeout() ) ); | 190 | connect( m_timer, SIGNAL( timeout() ), this, SLOT( apmTimeout() ) ); |
190 | m_timer->start( 5000 ); | 191 | m_timer->start( 5000 ); |
191 | |||
192 | channel = new QCopChannel( "QPE/Desktop", this ); | ||
193 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), | ||
194 | this, SLOT( desktopMessage( const QCString&, const QByteArray& ) ) ); | ||
195 | 192 | ||
193 | m_last_button = 0; | ||
194 | m_button_timer = new QTimer ( ); | ||
195 | connect ( m_button_timer, SIGNAL( timeout ( )), this, SLOT( sendHeldAction ( ))); | ||
196 | |||
196 | channel = new QCopChannel( "QPE/System", this ); | 197 | channel = new QCopChannel( "QPE/System", this ); |
197 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), | 198 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), |
198 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); | 199 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); |
199 | 200 | ||
201 | channel = new QCopChannel( "QPE/Launcher", this ); | ||
202 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), | ||
203 | this, SLOT( launcherMessage( const QCString&, const QByteArray& ) ) ); | ||
204 | |||
200 | m_screensaver = new OpieScreenSaver ( ); | 205 | m_screensaver = new OpieScreenSaver ( ); |
201 | m_screensaver-> setInterval ( -1 ); | 206 | m_screensaver-> setInterval ( -1 ); |
202 | QWSServer::setScreenSaver( m_screensaver ); | 207 | QWSServer::setScreenSaver( m_screensaver ); |
208 | |||
209 | rereadVolumes(); | ||
210 | connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); | ||
203 | 211 | ||
204 | apmTimeout ( ); | 212 | apmTimeout ( ); |
213 | |||
214 | grabKeyboard ( ); | ||
205 | } | 215 | } |
206 | 216 | ||
207 | 217 | ||
208 | DesktopApplication::~DesktopApplication() | 218 | DesktopApplication::~DesktopApplication() |
209 | { | 219 | { |
220 | ungrabKeyboard ( ); | ||
221 | |||
210 | delete m_ps; | 222 | delete m_ps; |
211 | delete m_ps_last; | 223 | delete m_ps_last; |
212 | delete pa; | 224 | delete pa; |
213 | } | 225 | } |
@@ -215,9 +227,9 @@ DesktopApplication::~DesktopApplication() | |||
215 | void DesktopApplication::apmTimeout() | 227 | void DesktopApplication::apmTimeout() |
216 | { | 228 | { |
217 | qpedesktop->checkMemory(); // in case no events are being generated | 229 | qpedesktop->checkMemory(); // in case no events are being generated |
218 | 230 | ||
219 | *m_ps_last = *m_ps; | 231 | *m_ps_last = *m_ps; |
220 | *m_ps = PowerStatusManager::readStatus(); | 232 | *m_ps = PowerStatusManager::readStatus(); |
221 | 233 | ||
222 | if ( m_ps-> acStatus ( ) != m_ps_last-> acStatus ( )) | 234 | if ( m_ps-> acStatus ( ) != m_ps_last-> acStatus ( )) |
223 | m_screensaver-> powerStatusChanged ( *m_ps ); | 235 | m_screensaver-> powerStatusChanged ( *m_ps ); |
@@ -225,478 +237,407 @@ void DesktopApplication::apmTimeout() | |||
225 | if ( m_ps-> acStatus ( ) != PowerStatus::Online ) { | 237 | if ( m_ps-> acStatus ( ) != PowerStatus::Online ) { |
226 | int bat = m_ps-> batteryPercentRemaining ( ); | 238 | int bat = m_ps-> batteryPercentRemaining ( ); |
227 | 239 | ||
228 | if ( bat < m_ps_last-> batteryPercentRemaining ( )) { | 240 | if ( bat < m_ps_last-> batteryPercentRemaining ( )) { |
229 | if ( bat <= m_powerCritical ) | 241 | if ( bat <= m_powerCritical ) |
230 | pa->alert( tr( "Battery level is critical!\nKeep power off until power restored!" ), 1 ); | 242 | pa->alert( tr( "Battery level is critical!\nKeep power off until power restored!" ), 1 ); |
231 | else if ( bat <= m_powerVeryLow ) | 243 | else if ( bat <= m_powerVeryLow ) |
232 | pa->alert( tr( "Battery is running very low." ), 2 ); | 244 | pa->alert( tr( "Battery is running very low." ), 2 ); |
233 | } | 245 | } |
234 | if ( m_ps-> backupBatteryStatus ( ) == PowerStatus::VeryLow ) | 246 | if ( m_ps-> backupBatteryStatus ( ) == PowerStatus::VeryLow ) |
235 | pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 2 ); | 247 | pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 2 ); |
236 | } | 248 | } |
237 | } | 249 | } |
238 | 250 | ||
239 | void DesktopApplication::desktopMessage( const QCString &msg, const QByteArray &data ) | 251 | |
252 | void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) | ||
240 | { | 253 | { |
241 | QDataStream stream( data, IO_ReadOnly ); | 254 | QDataStream stream ( data, IO_ReadOnly ); |
242 | if ( msg == "keyRegister(int key, QString channel, QString message)" ) { | ||
243 | int k; | ||
244 | QString c, m; | ||
245 | stream >> k; | ||
246 | stream >> c; | ||
247 | stream >> m; | ||
248 | 255 | ||
249 | qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m ); | 256 | if ( msg == "setScreenSaverInterval(int)" ) { |
250 | keyRegisterList.append( QCopKeyRegister( k, c, m ) ); | 257 | int time; |
251 | } | 258 | stream >> time; |
259 | m_screensaver-> setInterval( time ); | ||
260 | } | ||
261 | else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { | ||
262 | int t1, t2, t3; | ||
263 | stream >> t1 >> t2 >> t3; | ||
264 | m_screensaver-> setIntervals( t1, t2, t3 ); | ||
265 | } | ||
266 | else if ( msg == "setBacklight(int)" ) { | ||
267 | int bright; | ||
268 | stream >> bright; | ||
269 | m_screensaver-> setBacklight( bright ); | ||
270 | } | ||
271 | else if ( msg == "setScreenSaverMode(int)" ) { | ||
272 | int mode; | ||
273 | stream >> mode; | ||
274 | m_screensaver-> setMode ( mode ); | ||
275 | } | ||
276 | else if ( msg == "reloadPowerWarnSettings()" ) { | ||
277 | reloadPowerWarnSettings(); | ||
278 | } | ||
279 | else if ( msg == "setDisplayState(int)" ) { | ||
280 | int state; | ||
281 | stream >> state; | ||
282 | m_screensaver-> setDisplayState ( state != 0 ); | ||
283 | } | ||
284 | else if ( msg == "suspend()" ) { | ||
285 | emit power(); | ||
286 | } | ||
287 | else if ( msg == "sendBusinessCard()" ) { | ||
288 | QString card = ::getenv ( "HOME" ); | ||
289 | card += "/Applications/addressbook/businesscard.vcf"; | ||
290 | |||
291 | if ( QFile::exists( card ) ) { | ||
292 | QCopEnvelope e ( "QPE/Obex", "send(QString,QString,QString)" ); | ||
293 | QString mimetype = "text/x-vCard"; | ||
294 | e << tr( "business card" ) << card << mimetype; | ||
295 | } | ||
296 | } | ||
252 | } | 297 | } |
253 | 298 | ||
254 | 299 | void DesktopApplication::reloadPowerWarnSettings() | |
255 | void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) | ||
256 | { | 300 | { |
257 | QDataStream stream ( data, IO_ReadOnly ); | 301 | Config cfg( "apm" ); |
258 | 302 | cfg.setGroup( "Warnings" ); | |
259 | if ( msg == "setScreenSaverInterval(int)" ) { | 303 | |
260 | int time; | 304 | // m_timer->changeInterval( cfg.readNumEntry( "checkinterval", 10000 ) ); |
261 | stream >> time; | 305 | m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); |
262 | m_screensaver-> setInterval( time ); | 306 | m_powerCritical = cfg.readNumEntry( "powervcritical", 5 ); |
263 | } | ||
264 | else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { | ||
265 | int t1, t2, t3; | ||
266 | stream >> t1 >> t2 >> t3; | ||
267 | m_screensaver-> setIntervals( t1, t2, t3 ); | ||
268 | } | ||
269 | else if ( msg == "setBacklight(int)" ) { | ||
270 | int bright; | ||
271 | stream >> bright; | ||
272 | m_screensaver-> setBacklight( bright ); | ||
273 | } | ||
274 | else if ( msg == "setScreenSaverMode(int)" ) { | ||
275 | int mode; | ||
276 | stream >> mode; | ||
277 | m_screensaver-> setMode ( mode ); | ||
278 | } | ||
279 | else if ( msg == "reloadPowerWarnSettings()" ) { | ||
280 | reloadPowerWarnSettings(); | ||
281 | } | ||
282 | else if ( msg == "setDisplayState(int)" ) { | ||
283 | int state; | ||
284 | stream >> state; | ||
285 | m_screensaver-> setDisplayState ( state != 0 ); | ||
286 | } | ||
287 | else if ( msg == "suspend()" ) { | ||
288 | emit power(); | ||
289 | } | ||
290 | } | ||
291 | |||
292 | void DesktopApplication::reloadPowerWarnSettings() { | ||
293 | Config cfg( "apm" ); | ||
294 | cfg.setGroup( "Warnings" ); | ||
295 | |||
296 | // m_timer->changeInterval( cfg.readNumEntry( "checkinterval", 10000 ) ); | ||
297 | m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); | ||
298 | m_powerCritical = cfg.readNumEntry( "powervcritical", 5 ); | ||
299 | } | 307 | } |
300 | 308 | ||
301 | 309 | ||
302 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; | 310 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; |
303 | 311 | ||
304 | #ifdef Q_WS_QWS | 312 | |
305 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 313 | void DesktopApplication::launcherMessage( const QCString & msg, const QByteArray & data ) |
314 | { | ||
315 | QDataStream stream ( data, IO_ReadOnly ); | ||
316 | |||
317 | if ( msg == "deviceButton(int,int,int)" ) { | ||
318 | int keycode, press, autoRepeat; | ||
319 | stream >> keycode >> press >> autoRepeat; | ||
320 | |||
321 | const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( keycode ); | ||
322 | |||
323 | if ( db ) | ||
324 | checkButtonAction ( db, keycode, press, autoRepeat ); | ||
325 | } | ||
326 | else if ( msg == "keyRegister(int,QCString,QCString)" ) { | ||
327 | int k; | ||
328 | QCString c, m; | ||
329 | stream >> k >> c >> m; | ||
330 | |||
331 | keyRegisterList.append ( QCopKeyRegister ( k, c, m )); | ||
332 | } | ||
333 | } | ||
334 | |||
335 | void DesktopApplication::sendHeldAction ( ) | ||
306 | { | 336 | { |
307 | qpedesktop->checkMemory(); | 337 | if ( m_last_button ) { |
308 | 338 | m_last_button-> heldAction ( ). send ( ); | |
309 | if ( e->type == QWSEvent::Key ) { | 339 | m_last_button = 0; |
310 | QWSKeyEvent * ke = ( QWSKeyEvent * ) e; | 340 | } |
311 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) | ||
312 | return TRUE; | ||
313 | bool press = ke->simpleData.is_press; | ||
314 | bool autoRepeat = ke->simpleData.is_auto_repeat; | ||
315 | |||
316 | /* | ||
317 | app that registers key/message to be sent back to the app, when it doesn't have focus, | ||
318 | when user presses key, unless keyboard has been requested from app. | ||
319 | will not send multiple repeats if user holds key | ||
320 | i.e. one shot | ||
321 | */ | ||
322 | if ( !keyRegisterList.isEmpty() && ke->simpleData.keycode !=0 && press) { | ||
323 | // qDebug("<<<<<<<<<<<<<keycode %d", ke->simpleData.keycode); | ||
324 | KeyRegisterList::Iterator it; | ||
325 | for ( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { | ||
326 | if ( ( *it ).getKeyCode() == ke->simpleData.keycode && !autoRepeat && !keyboardGrabbed() ) { | ||
327 | if ( press ) | ||
328 | qDebug( "press" ); | ||
329 | else | ||
330 | qDebug( "release" ); | ||
331 | QCopEnvelope( ( *it ).getChannel().utf8(), ( *it ).getMessage().utf8() ); | ||
332 | } | ||
333 | } | ||
334 | } | ||
335 | |||
336 | if ( !keyboardGrabbed() ) { | ||
337 | if ( ke->simpleData.keycode == Key_F9 ) { | ||
338 | if ( press ) | ||
339 | emit datebook(); | ||
340 | return TRUE; | ||
341 | } | ||
342 | if ( ke->simpleData.keycode == Key_F10 ) { | ||
343 | if ( !press && cardSendTimer ) { | ||
344 | emit contacts(); | ||
345 | delete cardSendTimer; | ||
346 | } | ||
347 | else if ( press ) { | ||
348 | cardSendTimer = new QTimer(); | ||
349 | cardSendTimer->start( 2000, TRUE ); | ||
350 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); | ||
351 | } | ||
352 | return TRUE; | ||
353 | } | ||
354 | |||
355 | if ( ke->simpleData.keycode == Key_F11 ) { | ||
356 | if ( press ) emit menu(); | ||
357 | return TRUE; | ||
358 | } | ||
359 | |||
360 | if ( ke->simpleData.keycode == Key_F12 ) { | ||
361 | while ( activePopupWidget() ) | ||
362 | activePopupWidget() ->close(); | ||
363 | if ( press ) | ||
364 | emit launch(); | ||
365 | return TRUE; | ||
366 | } | ||
367 | if ( ke->simpleData.keycode == Key_F13 ) { | ||
368 | if ( press ) | ||
369 | emit email(); | ||
370 | return TRUE; | ||
371 | } | ||
372 | } | ||
373 | |||
374 | if ( ke->simpleData.keycode == Key_F34 ) { | ||
375 | if ( press ) | ||
376 | emit power(); | ||
377 | return TRUE; | ||
378 | } | ||
379 | // This was used for the iPAQ PowerButton | ||
380 | // See main.cpp for new KeyboardFilter | ||
381 | // | ||
382 | // if ( ke->simpleData.keycode == Key_SysReq ) { | ||
383 | // if ( press ) emit power(); | ||
384 | // return TRUE; | ||
385 | // } | ||
386 | if ( ke->simpleData.keycode == Key_F35 ) { | ||
387 | if ( press ) | ||
388 | emit backlight(); | ||
389 | return TRUE; | ||
390 | } | ||
391 | if ( ke->simpleData.keycode == Key_F32 ) { | ||
392 | if ( press ) | ||
393 | QCopEnvelope e( "QPE/Desktop", "startSync()" ); | ||
394 | return TRUE; | ||
395 | } | ||
396 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { | ||
397 | if ( press ) | ||
398 | emit symbol(); | ||
399 | return TRUE; | ||
400 | } | ||
401 | if ( ke->simpleData.keycode == Key_NumLock ) { | ||
402 | if ( press ) | ||
403 | emit numLockStateToggle(); | ||
404 | } | ||
405 | if ( ke->simpleData.keycode == Key_CapsLock ) { | ||
406 | if ( press ) | ||
407 | emit capsLockStateToggle(); | ||
408 | } | ||
409 | if ( ( press && !autoRepeat ) || ( !press && autoRepeat ) ) | ||
410 | qpedesktop->keyClick(); | ||
411 | } | ||
412 | else { | ||
413 | if ( e->type == QWSEvent::Mouse ) { | ||
414 | QWSMouseEvent * me = ( QWSMouseEvent * ) e; | ||
415 | static bool up = TRUE; | ||
416 | if ( me->simpleData.state & LeftButton ) { | ||
417 | if ( up ) { | ||
418 | up = FALSE; | ||
419 | qpedesktop->screenClick(); | ||
420 | } | ||
421 | } | ||
422 | else { | ||
423 | up = TRUE; | ||
424 | } | ||
425 | } | ||
426 | } | ||
427 | |||
428 | return QPEApplication::qwsEventFilter( e ); | ||
429 | } | 341 | } |
430 | #endif | ||
431 | 342 | ||
432 | 343 | ||
433 | void DesktopApplication::sendCard() | 344 | |
345 | void DesktopApplication::checkButtonAction ( const ODeviceButton *db, int keycode, bool press, bool autoRepeat ) | ||
346 | { | ||
347 | if ( db ) { | ||
348 | if ( !press && !autoRepeat && m_button_timer-> isActive ( )) { | ||
349 | m_button_timer-> stop ( ); | ||
350 | if ( !db-> pressedAction ( ). channel ( ). isEmpty ( )) { | ||
351 | db-> pressedAction ( ). send ( ); | ||
352 | } | ||
353 | } | ||
354 | else if ( press && !autoRepeat ) { | ||
355 | m_button_timer-> stop ( ); | ||
356 | |||
357 | if ( !db-> heldAction ( ). channel ( ). isEmpty ( )) { | ||
358 | m_last_button = db; | ||
359 | m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); | ||
360 | } | ||
361 | } | ||
362 | } | ||
363 | } | ||
364 | |||
365 | bool DesktopApplication::eventFilter ( QObject *o, QEvent *e ) | ||
434 | { | 366 | { |
435 | delete cardSendTimer; | 367 | if ( e-> type ( ) == QEvent::KeyPress || e-> type ( ) == QEvent::KeyRelease ) { |
436 | cardSendTimer = 0; | 368 | QKeyEvent *ke = (QKeyEvent *) e; |
437 | QString card = getenv( "HOME" ); | 369 | |
438 | card += "/Applications/addressbook/businesscard.vcf"; | 370 | const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( ke-> key ( )); |
371 | |||
372 | if ( db ) { | ||
373 | checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( )); | ||
374 | return true; | ||
375 | } | ||
376 | } | ||
377 | return QPEApplication::eventFilter ( o, e ); | ||
378 | } | ||
379 | |||
380 | #ifdef Q_WS_QWS | ||
381 | |||
382 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | ||
383 | { | ||
384 | qpedesktop->checkMemory(); | ||
385 | |||
386 | if ( e->type == QWSEvent::Key ) { | ||
387 | QWSKeyEvent * ke = (QWSKeyEvent *) e; | ||
388 | ushort keycode = ke-> simpleData. keycode; | ||
389 | |||
390 | if ( !loggedin && keycode != Key_F34 ) | ||
391 | return true; | ||
392 | |||
393 | bool press = ke-> simpleData. is_press; | ||
394 | bool autoRepeat = ke-> simpleData. is_auto_repeat; | ||
395 | |||
396 | if ( !keyboardGrabbed ( )) { | ||
397 | // app that registers key/message to be sent back to the app, when it doesn't have focus, | ||
398 | // when user presses key, unless keyboard has been requested from app. | ||
399 | // will not send multiple repeats if user holds key | ||
400 | // i.e. one shot | ||
401 | |||
402 | if ( keycode != 0 && press && !autoRepeat ) { | ||
403 | for ( KeyRegisterList::Iterator it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { | ||
404 | if (( *it ). getKeyCode ( ) == keycode ) { | ||
405 | QCopEnvelope (( *it ). getChannel ( ), ( *it ). getMessage ( )); | ||
406 | return true; | ||
407 | } | ||
408 | } | ||
409 | } | ||
410 | } | ||
411 | |||
412 | if ( keycode == HardKey_Suspend ) { | ||
413 | if ( press ) | ||
414 | emit power ( ); | ||
415 | return true; | ||
416 | } | ||
417 | else if ( keycode == HardKey_Backlight ) { | ||
418 | if ( press ) | ||
419 | emit backlight ( ); | ||
420 | return true; | ||
421 | } | ||
422 | else if ( keycode == Key_F32 ) { | ||
423 | if ( press ) | ||
424 | QCopEnvelope e( "QPE/Desktop", "startSync()" ); | ||
425 | return true; | ||
426 | } | ||
427 | else if ( keycode == Key_F31 && !ke-> simpleData. modifiers ) { // Symbol Key -> show Unicode IM | ||
428 | if ( press ) | ||
429 | emit symbol ( ); | ||
430 | return true; | ||
431 | } | ||
432 | else if ( keycode == Key_NumLock ) { | ||
433 | if ( press ) | ||
434 | emit numLockStateToggle ( ); | ||
435 | } | ||
436 | else if ( keycode == Key_CapsLock ) { | ||
437 | if ( press ) | ||
438 | emit capsLockStateToggle(); | ||
439 | } | ||
440 | if (( press && !autoRepeat ) || ( !press && autoRepeat )) { | ||
441 | if ( m_keyclick_sound ) | ||
442 | ODevice::inst ( )-> keySound ( ); | ||
443 | } | ||
444 | } | ||
445 | else if ( e-> type == QWSEvent::Mouse ) { | ||
446 | QWSMouseEvent * me = ( QWSMouseEvent * ) e; | ||
447 | static bool up = true; | ||
448 | |||
449 | if ( me-> simpleData. state & LeftButton ) { | ||
450 | if ( up ) { | ||
451 | up = false; | ||
452 | if ( m_screentap_sound ) | ||
453 | ODevice::inst ( ) -> touchSound ( ); | ||
454 | } | ||
455 | } | ||
456 | else { | ||
457 | up = true; | ||
458 | } | ||
459 | } | ||
439 | 460 | ||
440 | if ( QFile::exists( card ) ) { | 461 | return QPEApplication::qwsEventFilter ( e ); |
441 | QCopEnvelope e( "QPE/Obex", "send(QString,QString,QString)" ); | ||
442 | QString mimetype = "text/x-vCard"; | ||
443 | e << tr( "business card" ) << card << mimetype; | ||
444 | } | ||
445 | } | 462 | } |
463 | #endif | ||
464 | |||
465 | |||
446 | 466 | ||
447 | #if defined(QPE_HAVE_MEMALERTER) | 467 | #if defined(QPE_HAVE_MEMALERTER) |
448 | QPE_MEMALERTER_IMPL | 468 | QPE_MEMALERTER_IMPL |
449 | #endif | 469 | #endif |
450 | 470 | ||
451 | //=========================================================================== | 471 | //=========================================================================== |
452 | 472 | ||
453 | Desktop::Desktop() : | 473 | Desktop::Desktop() : |
454 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), | 474 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), |
455 | qcopBridge( 0 ), | 475 | qcopBridge( 0 ), |
456 | transferServer( 0 ), | 476 | transferServer( 0 ), |
457 | packageSlave( 0 ) | 477 | packageSlave( 0 ) |
458 | { | 478 | { |
459 | qpedesktop = this; | 479 | qpedesktop = this; |
460 | 480 | ||
461 | // bg = new Info( this ); | 481 | // bg = new Info( this ); |
462 | tb = new TaskBar; | 482 | tb = new TaskBar; |
463 | 483 | ||
464 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); | 484 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); |
465 | 485 | ||
466 | connect( launcher, SIGNAL( busy() ), tb, SLOT( startWait() ) ); | 486 | connect( launcher, SIGNAL( busy() ), tb, SLOT( startWait() ) ); |
467 | connect( launcher, SIGNAL( notBusy( const QString& ) ), tb, SLOT( stopWait( const QString& ) ) ); | 487 | connect( launcher, SIGNAL( notBusy( const QString& ) ), tb, SLOT( stopWait( const QString& ) ) ); |
468 | 488 | ||
469 | int displayw = qApp->desktop() ->width(); | 489 | int displayw = qApp->desktop() ->width(); |
470 | int displayh = qApp->desktop() ->height(); | 490 | int displayh = qApp->desktop() ->height(); |
471 | 491 | ||
472 | 492 | ||
473 | QSize sz = tb->sizeHint(); | 493 | QSize sz = tb->sizeHint(); |
474 | 494 | ||
475 | setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | 495 | setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); |
476 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | 496 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); |
477 | 497 | ||
478 | tb->show(); | 498 | tb->show(); |
479 | launcher->showMaximized(); | 499 | launcher->showMaximized(); |
480 | launcher->show(); | 500 | launcher->show(); |
481 | launcher->raise(); | 501 | launcher->raise(); |
482 | #if defined(QPE_HAVE_MEMALERTER) | 502 | #if defined(QPE_HAVE_MEMALERTER) |
483 | 503 | ||
484 | initMemalerter(); | 504 | initMemalerter(); |
485 | #endif | 505 | #endif |
486 | // start services | 506 | // start services |
487 | startTransferServer(); | 507 | startTransferServer(); |
488 | ( void ) new IrServer( this ); | 508 | ( void ) new IrServer( this ); |
489 | rereadVolumes(); | ||
490 | 509 | ||
491 | packageSlave = new PackageSlave( this ); | 510 | packageSlave = new PackageSlave( this ); |
492 | connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); | ||
493 | 511 | ||
494 | qApp->installEventFilter( this ); | 512 | qApp->installEventFilter( this ); |
495 | 513 | ||
496 | qApp-> setMainWidget ( launcher ); | 514 | qApp-> setMainWidget ( launcher ); |
497 | } | 515 | } |
498 | 516 | ||
499 | void Desktop::show() | 517 | void Desktop::show() |
500 | { | 518 | { |
501 | login( TRUE ); | 519 | login( TRUE ); |
502 | QWidget::show(); | 520 | QWidget::show(); |
503 | } | 521 | } |
504 | 522 | ||
505 | Desktop::~Desktop() | 523 | Desktop::~Desktop() |
506 | { | 524 | { |
507 | delete launcher; | 525 | delete launcher; |
508 | delete tb; | 526 | delete tb; |
509 | delete qcopBridge; | 527 | delete qcopBridge; |
510 | delete transferServer; | 528 | delete transferServer; |
511 | } | 529 | } |
512 | 530 | ||
513 | bool Desktop::recoverMemory() | 531 | bool Desktop::recoverMemory() |
514 | { | 532 | { |
515 | return tb->recoverMemory(); | 533 | return tb->recoverMemory(); |
516 | } | 534 | } |
517 | 535 | ||
518 | void Desktop::checkMemory() | 536 | void Desktop::checkMemory() |
519 | { | 537 | { |
520 | #if defined(QPE_HAVE_MEMALERTER) | 538 | #if defined(QPE_HAVE_MEMALERTER) |
521 | static bool ignoreNormal = FALSE; | 539 | static bool ignoreNormal = FALSE; |
522 | static bool existingMessage = FALSE; | 540 | static bool existingMessage = FALSE; |
523 | 541 | ||
524 | if ( existingMessage ) | 542 | if ( existingMessage ) |
525 | return ; // don't show a second message while still on first | 543 | return ; // don't show a second message while still on first |
526 | 544 | ||
527 | existingMessage = TRUE; | 545 | existingMessage = TRUE; |
528 | switch ( memstate ) { | 546 | switch ( memstate ) { |
529 | case Unknown: | 547 | case Unknown: |
530 | break; | 548 | break; |
531 | case Low: | 549 | case Low: |
532 | memstate = Unknown; | 550 | memstate = Unknown; |
533 | if ( recoverMemory() ) | 551 | if ( recoverMemory() ) |
534 | ignoreNormal = TRUE; | 552 | ignoreNormal = TRUE; |
535 | else | 553 | else |
536 | QMessageBox::warning( 0 , "Memory Status", | 554 | QMessageBox::warning( 0 , "Memory Status", |
537 | "The memory smacks of shortage. \n" | 555 | "The memory smacks of shortage. \n" |
538 | "Please save data. " ); | 556 | "Please save data. " ); |
539 | break; | 557 | break; |
540 | case Normal: | 558 | case Normal: |
541 | memstate = Unknown; | 559 | memstate = Unknown; |
542 | if ( ignoreNormal ) | 560 | if ( ignoreNormal ) |
543 | ignoreNormal = FALSE; | 561 | ignoreNormal = FALSE; |
544 | // else | 562 | // else |
545 | // QMessageBox::information ( 0 , "Memory Status", | 563 | // QMessageBox::information ( 0 , "Memory Status", |
546 | // "There is enough memory again." ); | 564 | // "There is enough memory again." ); |
547 | break; | 565 | break; |
548 | case VeryLow: | 566 | case VeryLow: |
549 | memstate = Unknown; | 567 | memstate = Unknown; |
550 | QMessageBox::critical( 0 , "Memory Status", | 568 | QMessageBox::critical( 0 , "Memory Status", |
551 | "The memory is very low. \n" | 569 | "The memory is very low. \n" |
552 | "Please end this application \n" | 570 | "Please end this application \n" |
553 | "immediately." ); | 571 | "immediately." ); |
554 | recoverMemory(); | 572 | recoverMemory(); |
555 | } | 573 | } |
556 | existingMessage = FALSE; | 574 | existingMessage = FALSE; |
557 | #endif | 575 | #endif |
558 | } | 576 | } |
559 | 577 | ||
560 | static bool isVisibleWindow( int wid ) | 578 | static bool isVisibleWindow( int wid ) |
561 | { | 579 | { |
562 | #ifdef QWS | 580 | #ifdef QWS |
563 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 581 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
564 | QWSWindow* w; | 582 | QWSWindow* w; |
565 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { | 583 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { |
566 | if ( w->winId() == wid ) | 584 | if ( w->winId() == wid ) |
567 | return !w->isFullyObscured(); | 585 | return !w->isFullyObscured(); |
568 | } | 586 | } |
569 | #endif | 587 | #endif |
570 | return FALSE; | 588 | return FALSE; |
571 | } | 589 | } |
572 | 590 | ||
573 | static bool hasVisibleWindow( const QString& clientname ) | 591 | static bool hasVisibleWindow( const QString& clientname ) |
574 | { | 592 | { |
575 | #ifdef QWS | 593 | #ifdef QWS |
576 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 594 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
577 | QWSWindow* w; | 595 | QWSWindow* w; |
578 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { | 596 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { |
579 | if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) | 597 | if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) |
580 | return TRUE; | 598 | return TRUE; |
581 | } | 599 | } |
582 | #endif | 600 | #endif |
583 | return FALSE; | 601 | return FALSE; |
584 | } | 602 | } |
585 | 603 | ||
586 | void Desktop::raiseLauncher() | ||
587 | { | ||
588 | Config cfg( "qpe" ); //F12 'Home' | ||
589 | cfg.setGroup( "AppsKey" ); | ||
590 | QString tempItem; | ||
591 | tempItem = cfg.readEntry( "Middle", "Home" ); | ||
592 | if ( tempItem == "Home" || tempItem.isEmpty() ) { | ||
593 | home ( ); | ||
594 | } | ||
595 | else { | ||
596 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | ||
597 | e << tempItem; | ||
598 | } | ||
599 | } | ||
600 | |||
601 | void Desktop::home ( ) | ||
602 | { | ||
603 | if ( isVisibleWindow( launcher->winId() ) ) | ||
604 | launcher->nextView(); | ||
605 | else | ||
606 | launcher->raise(); | ||
607 | } | ||
608 | 604 | ||
609 | void Desktop::executeOrModify( const QString& appLnkFile ) | 605 | void Desktop::executeOrModify( const QString& appLnkFile ) |
610 | { | 606 | { |
611 | AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); | 607 | AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); |
612 | if ( lnk.isValid() ) { | 608 | if ( lnk.isValid() ) { |
613 | QCString app = lnk.exec().utf8(); | 609 | QCString app = lnk.exec().utf8(); |
614 | Global::terminateBuiltin( "calibrate" ); | 610 | Global::terminateBuiltin( "calibrate" ); |
615 | if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { | 611 | if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { |
616 | // MRUList::addTask( &lnk ); | 612 | // MRUList::addTask( &lnk ); |
617 | if ( hasVisibleWindow( app ) ) | 613 | if ( hasVisibleWindow( app ) ) |
618 | QCopChannel::send( "QPE/Application/" + app, "nextView()" ); | 614 | QCopChannel::send( "QPE/Application/" + app, "nextView()" ); |
619 | else | 615 | else |
620 | QCopChannel::send( "QPE/Application/" + app, "raise()" ); | 616 | QCopChannel::send( "QPE/Application/" + app, "raise()" ); |
621 | } | 617 | } |
622 | else { | 618 | else { |
623 | lnk.execute(); | 619 | lnk.execute(); |
624 | } | 620 | } |
625 | } | 621 | } |
626 | } | ||
627 | |||
628 | void Desktop::raiseDatebook() | ||
629 | { | ||
630 | Config cfg( "qpe" ); //F9 'Activity' | ||
631 | cfg.setGroup( "AppsKey" ); | ||
632 | QString tempItem; | ||
633 | tempItem = cfg.readEntry( "LeftEnd" , "Calendar" ); | ||
634 | if ( tempItem == "Calendar" || tempItem.isEmpty() ) { | ||
635 | tempItem = "datebook"; | ||
636 | } | ||
637 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | ||
638 | e << tempItem; | ||
639 | } | ||
640 | |||
641 | void Desktop::raiseContacts() | ||
642 | { | ||
643 | Config cfg( "qpe" ); //F10, 'Contacts' | ||
644 | cfg.setGroup( "AppsKey" ); | ||
645 | QString tempItem; | ||
646 | tempItem = cfg.readEntry( "Left2nd", "Address Book" ); | ||
647 | if ( tempItem == "Address Book" || tempItem.isEmpty() ) { | ||
648 | tempItem = "addressbook"; | ||
649 | } | ||
650 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | ||
651 | e << tempItem; | ||
652 | } | ||
653 | |||
654 | void Desktop::raiseMenu() | ||
655 | { | ||
656 | Config cfg( "qpe" ); //F11, 'Menu | ||
657 | cfg.setGroup( "AppsKey" ); | ||
658 | QString tempItem; | ||
659 | tempItem = cfg.readEntry( "Right2nd" , "Popup Menu" ); | ||
660 | if ( tempItem == "Popup Menu" || tempItem.isEmpty() ) { | ||
661 | Global::terminateBuiltin( "calibrate" ); | ||
662 | tb->startMenu() ->launch(); | ||
663 | } | ||
664 | else { | ||
665 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | ||
666 | e << tempItem; | ||
667 | } | ||
668 | } | ||
669 | |||
670 | void Desktop::raiseEmail() | ||
671 | { | ||
672 | Config cfg( "qpe" ); //F13, 'Mail' // only in zaurus, on ipaq mail key is F11 | ||
673 | cfg.setGroup( "AppsKey" ); | ||
674 | QString tempItem; | ||
675 | tempItem = cfg.readEntry( "RightEnd", "Mail" ); | ||
676 | if ( tempItem == "Mail" || tempItem == "qtmail" || tempItem.isEmpty() ) { | ||
677 | tempItem = "mail"; | ||
678 | } | ||
679 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | ||
680 | e << tempItem; | ||
681 | } | 622 | } |
682 | 623 | ||
683 | // autoStarts apps on resume and start | 624 | // autoStarts apps on resume and start |
684 | void Desktop::execAutoStart() | 625 | void Desktop::execAutoStart() |
685 | { | 626 | { |
686 | QString appName; | 627 | QString appName; |
687 | int delay; | 628 | int delay; |
688 | QDateTime now = QDateTime::currentDateTime(); | 629 | QDateTime now = QDateTime::currentDateTime(); |
689 | Config cfg( "autostart" ); | 630 | Config cfg( "autostart" ); |
690 | cfg.setGroup( "AutoStart" ); | 631 | cfg.setGroup( "AutoStart" ); |
691 | appName = cfg.readEntry( "Apps", "" ); | 632 | appName = cfg.readEntry( "Apps", "" ); |
692 | delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); | 633 | delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); |
693 | // If the time between suspend and resume was longer then the | 634 | // If the time between suspend and resume was longer then the |
694 | // value saved as delay, start the app | 635 | // value saved as delay, start the app |
695 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { | 636 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { |
696 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 637 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
697 | e << QString( appName ); | 638 | e << QString( appName ); |
698 | } | 639 | } |
699 | } | 640 | } |
700 | 641 | ||
701 | #if defined(QPE_HAVE_TOGGLELIGHT) | 642 | #if defined(QPE_HAVE_TOGGLELIGHT) |
702 | #include <qpe/config.h> | 643 | #include <qpe/config.h> |
@@ -712,194 +653,189 @@ void Desktop::execAutoStart() | |||
712 | 653 | ||
713 | 654 | ||
714 | void Desktop::togglePower() | 655 | void Desktop::togglePower() |
715 | { | 656 | { |
716 | static bool excllock = false; | 657 | static bool excllock = false; |
717 | 658 | ||
718 | qDebug ( "togglePower (locked == %d)", excllock ? 1 : 0 ); | 659 | qDebug ( "togglePower (locked == %d)", excllock ? 1 : 0 ); |
719 | 660 | ||
720 | if ( excllock ) | 661 | if ( excllock ) |
721 | return; | 662 | return ; |
722 | 663 | ||
723 | excllock = true; | 664 | excllock = true; |
724 | 665 | ||
725 | bool wasloggedin = loggedin; | 666 | bool wasloggedin = loggedin; |
726 | loggedin = 0; | 667 | loggedin = 0; |
727 | suspendTime = QDateTime::currentDateTime(); | 668 | suspendTime = QDateTime::currentDateTime(); |
728 | 669 | ||
729 | #ifdef QWS | 670 | #ifdef QWS |
730 | if ( Password::needToAuthenticate ( true ) && qt_screen ) { | 671 | |
731 | // Should use a big black window instead. | 672 | if ( Password::needToAuthenticate ( true ) && qt_screen ) { |
732 | // But this would not show up fast enough | 673 | // Should use a big black window instead. |
733 | QGfx *g = qt_screen-> screenGfx ( ); | 674 | // But this would not show up fast enough |
734 | g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); | 675 | QGfx *g = qt_screen-> screenGfx ( ); |
735 | delete g; | 676 | g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); |
736 | } | 677 | delete g; |
678 | } | ||
737 | #endif | 679 | #endif |
738 | 680 | ||
739 | ODevice::inst ( )-> suspend ( ); | 681 | ODevice::inst ( )-> suspend ( ); |
740 | 682 | ||
741 | DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call | 683 | DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call |
742 | QWSServer::screenSaverActivate ( false ); | 684 | QWSServer::screenSaverActivate ( false ); |
743 | 685 | ||
744 | { | 686 | { |
745 | QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep | 687 | QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep |
746 | } | 688 | } |
747 | 689 | ||
748 | if ( wasloggedin ) | 690 | if ( wasloggedin ) |
749 | login ( true ); | 691 | login ( true ); |
750 | 692 | ||
751 | execAutoStart(); | 693 | execAutoStart(); |
752 | //qcopBridge->closeOpenConnections(); | 694 | //qcopBridge->closeOpenConnections(); |
753 | 695 | ||
754 | excllock = false; | 696 | excllock = false; |
755 | } | 697 | } |
756 | 698 | ||
757 | void Desktop::toggleLight() | 699 | void Desktop::toggleLight() |
758 | { | 700 | { |
759 | QCopEnvelope e( "QPE/System", "setBacklight(int)" ); | 701 | QCopEnvelope e( "QPE/System", "setBacklight(int)" ); |
760 | e << -2; // toggle | 702 | e << -2; // toggle |
761 | } | 703 | } |
762 | 704 | ||
763 | void Desktop::toggleSymbolInput() | 705 | void Desktop::toggleSymbolInput() |
764 | { | 706 | { |
765 | tb->toggleSymbolInput(); | 707 | tb->toggleSymbolInput(); |
766 | } | 708 | } |
767 | 709 | ||
768 | void Desktop::toggleNumLockState() | 710 | void Desktop::toggleNumLockState() |
769 | { | 711 | { |
770 | tb->toggleNumLockState(); | 712 | tb->toggleNumLockState(); |
771 | } | 713 | } |
772 | 714 | ||
773 | void Desktop::toggleCapsLockState() | 715 | void Desktop::toggleCapsLockState() |
774 | { | 716 | { |
775 | tb->toggleCapsLockState(); | 717 | tb->toggleCapsLockState(); |
776 | } | 718 | } |
777 | 719 | ||
778 | void Desktop::styleChange( QStyle &s ) | 720 | void Desktop::styleChange( QStyle &s ) |
779 | { | 721 | { |
780 | QWidget::styleChange( s ); | 722 | QWidget::styleChange( s ); |
781 | int displayw = qApp->desktop() ->width(); | 723 | int displayw = qApp->desktop() ->width(); |
782 | int displayh = qApp->desktop() ->height(); | 724 | int displayh = qApp->desktop() ->height(); |
783 | 725 | ||
784 | QSize sz = tb->sizeHint(); | 726 | QSize sz = tb->sizeHint(); |
785 | 727 | ||
786 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | 728 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); |
787 | } | 729 | } |
788 | 730 | ||
789 | void DesktopApplication::shutdown() | 731 | void DesktopApplication::shutdown() |
790 | { | 732 | { |
791 | if ( type() != GuiServer ) | 733 | if ( type() != GuiServer ) |
792 | return ; | 734 | return ; |
793 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); | 735 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); |
794 | connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ), | 736 | connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ), |
795 | this, SLOT( shutdown( ShutdownImpl::Type ) ) ); | 737 | this, SLOT( shutdown( ShutdownImpl::Type ) ) ); |
796 | sd->showMaximized(); | 738 | sd->showMaximized(); |
797 | } | 739 | } |
798 | 740 | ||
799 | void DesktopApplication::shutdown( ShutdownImpl::Type t ) | 741 | void DesktopApplication::shutdown( ShutdownImpl::Type t ) |
800 | { | 742 | { |
801 | switch ( t ) { | 743 | switch ( t ) { |
802 | case ShutdownImpl::ShutdownSystem: | 744 | case ShutdownImpl::ShutdownSystem: |
803 | execlp( "shutdown", "shutdown", "-h", "now", ( void* ) 0 ); | 745 | execlp( "shutdown", "shutdown", "-h", "now", ( void* ) 0 ); |
804 | break; | 746 | break; |
805 | case ShutdownImpl::RebootSystem: | 747 | case ShutdownImpl::RebootSystem: |
806 | execlp( "shutdown", "shutdown", "-r", "now", ( void* ) 0 ); | 748 | execlp( "shutdown", "shutdown", "-r", "now", ( void* ) 0 ); |
807 | break; | 749 | break; |
808 | case ShutdownImpl::RestartDesktop: | 750 | case ShutdownImpl::RestartDesktop: |
809 | restart(); | 751 | restart(); |
810 | break; | 752 | break; |
811 | case ShutdownImpl::TerminateDesktop: | 753 | case ShutdownImpl::TerminateDesktop: |
812 | prepareForTermination( FALSE ); | 754 | prepareForTermination( FALSE ); |
813 | 755 | ||
814 | // This is a workaround for a Qt bug | 756 | // This is a workaround for a Qt bug |
815 | // clipboard applet has to stop its poll timer, or Qt/E | 757 | // clipboard applet has to stop its poll timer, or Qt/E |
816 | // will hang on quit() right before it emits aboutToQuit() | 758 | // will hang on quit() right before it emits aboutToQuit() |
817 | emit aboutToQuit ( ); | 759 | emit aboutToQuit ( ); |
818 | 760 | ||
819 | quit(); | 761 | quit(); |
820 | break; | 762 | break; |
821 | } | 763 | } |
822 | } | 764 | } |
823 | 765 | ||
824 | void DesktopApplication::restart() | 766 | void DesktopApplication::restart() |
825 | { | 767 | { |
826 | prepareForTermination( TRUE ); | 768 | prepareForTermination( TRUE ); |
827 | 769 | ||
828 | #ifdef Q_WS_QWS | 770 | #ifdef Q_WS_QWS |
829 | 771 | ||
830 | for ( int fd = 3; fd < 100; fd++ ) | 772 | for ( int fd = 3; fd < 100; fd++ ) |
831 | close( fd ); | 773 | close( fd ); |
832 | #if defined(QT_DEMO_SINGLE_FLOPPY) | 774 | #if defined(QT_DEMO_SINGLE_FLOPPY) |
833 | 775 | ||
834 | execl( "/sbin/init", "qpe", 0 ); | 776 | execl( "/sbin/init", "qpe", 0 ); |
835 | #elif defined(QT_QWS_CASSIOPEIA) | 777 | #elif defined(QT_QWS_CASSIOPEIA) |
836 | 778 | ||
837 | execl( "/bin/sh", "sh", 0 ); | 779 | execl( "/bin/sh", "sh", 0 ); |
838 | #else | 780 | #else |
839 | 781 | ||
840 | execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); | 782 | execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); |
841 | #endif | 783 | #endif |
842 | 784 | ||
843 | exit( 1 ); | 785 | exit( 1 ); |
844 | #endif | 786 | #endif |
845 | } | 787 | } |
846 | 788 | ||
847 | void Desktop::startTransferServer() | 789 | void Desktop::startTransferServer() |
848 | { | 790 | { |
849 | // start qcop bridge server | 791 | // start qcop bridge server |
850 | qcopBridge = new QCopBridge( 4243 ); | 792 | qcopBridge = new QCopBridge( 4243 ); |
851 | if ( !qcopBridge->ok() ) { | 793 | if ( !qcopBridge->ok() ) { |
852 | delete qcopBridge; | 794 | delete qcopBridge; |
853 | qcopBridge = 0; | 795 | qcopBridge = 0; |
854 | } | 796 | } |
855 | // start transfer server | 797 | // start transfer server |
856 | transferServer = new TransferServer( 4242 ); | 798 | transferServer = new TransferServer( 4242 ); |
857 | if ( !transferServer->ok() ) { | 799 | if ( !transferServer->ok() ) { |
858 | delete transferServer; | 800 | delete transferServer; |
859 | transferServer = 0; | 801 | transferServer = 0; |
860 | } | 802 | } |
861 | if ( !transferServer || !qcopBridge ) | 803 | if ( !transferServer || !qcopBridge ) |
862 | startTimer( 2000 ); | 804 | startTimer( 2000 ); |
863 | } | 805 | } |
864 | 806 | ||
865 | void Desktop::timerEvent( QTimerEvent *e ) | 807 | void Desktop::timerEvent( QTimerEvent *e ) |
866 | { | 808 | { |
867 | killTimer( e->timerId() ); | 809 | killTimer( e->timerId() ); |
868 | startTransferServer(); | 810 | startTransferServer(); |
869 | } | 811 | } |
870 | 812 | ||
871 | void Desktop::terminateServers() | 813 | void Desktop::terminateServers() |
872 | { | 814 | { |
873 | delete transferServer; | 815 | delete transferServer; |
874 | delete qcopBridge; | 816 | delete qcopBridge; |
875 | transferServer = 0; | 817 | transferServer = 0; |
876 | qcopBridge = 0; | 818 | qcopBridge = 0; |
877 | } | 819 | } |
878 | 820 | ||
879 | void Desktop::rereadVolumes() | 821 | void DesktopApplication::rereadVolumes() |
880 | { | 822 | { |
881 | Config cfg( "qpe" ); | 823 | Config cfg( "qpe" ); |
882 | cfg.setGroup( "Volume" ); | 824 | cfg. setGroup ( "Volume" ); |
883 | touchclick = cfg.readBoolEntry( "TouchSound" ); | 825 | |
884 | keyclick = cfg.readBoolEntry( "KeySound" ); | 826 | m_screentap_sound = cfg. readBoolEntry ( "TouchSound" ); |
885 | alarmsound = cfg.readBoolEntry( "AlarmSound" ); | 827 | m_keyclick_sound = cfg. readBoolEntry ( "KeySound" ); |
886 | } | 828 | m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" ); |
887 | |||
888 | void Desktop::keyClick() | ||
889 | { | ||
890 | if ( keyclick ) | ||
891 | ODevice::inst ( ) -> keySound ( ); | ||
892 | } | 829 | } |
893 | 830 | ||
894 | void Desktop::screenClick() | 831 | void DesktopApplication::soundAlarm() |
895 | { | 832 | { |
896 | if ( touchclick ) | 833 | if ( me ( )-> m_alarm_sound ) |
897 | ODevice::inst ( ) -> touchSound ( ); | 834 | ODevice::inst ( )-> alarmSound ( ); |
898 | } | 835 | } |
899 | 836 | ||
900 | void Desktop::soundAlarm() | 837 | DesktopApplication *DesktopApplication::me ( ) |
901 | { | 838 | { |
902 | if ( qpedesktop-> alarmsound ) | 839 | return (DesktopApplication *) qApp; |
903 | ODevice::inst ( ) -> alarmSound ( ); | ||
904 | } | 840 | } |
905 | 841 | ||
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h index 1f8daa0..6cb7ab2 100644 --- a/core/launcher/desktop.h +++ b/core/launcher/desktop.h | |||
@@ -19,13 +19,14 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #ifndef __DESKTOP_H__ | 21 | #ifndef __DESKTOP_H__ |
22 | #define __DESKTOP_H__ | 22 | #define __DESKTOP_H__ |
23 | 23 | ||
24 | 24 | ||
25 | #include "shutdownimpl.h" | 25 | #include "shutdownimpl.h" |
26 | 26 | ||
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <opie/odevicebutton.h> | ||
28 | 29 | ||
29 | #include <qwidget.h> | 30 | #include <qwidget.h> |
30 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
31 | 32 | ||
@@ -40,112 +41,114 @@ class PackageSlave; | |||
40 | class OpieScreenSaver; | 41 | class OpieScreenSaver; |
41 | 42 | ||
42 | class DesktopApplication : public QPEApplication | 43 | class DesktopApplication : public QPEApplication |
43 | { | 44 | { |
44 | Q_OBJECT | 45 | Q_OBJECT |
45 | public: | 46 | public: |
46 | DesktopApplication( int& argc, char **argv, Type t ); | 47 | DesktopApplication( int& argc, char **argv, Type t ); |
47 | ~DesktopApplication(); | 48 | ~DesktopApplication(); |
49 | |||
50 | static void switchLCD ( bool on ); // only for togglePower in Desktop | ||
48 | 51 | ||
49 | static void switchLCD ( bool on ); // only for togglePower in Desktop | 52 | static void soundAlarm(); // only because QCop soundAlarm() is defined in QPE/TaskBar |
50 | 53 | ||
51 | signals: | 54 | signals: |
52 | void menu(); | 55 | void menu(); |
53 | void home(); | 56 | void home(); |
54 | void datebook(); | 57 | void launch(); |
55 | void contacts(); | 58 | void backlight(); |
56 | void launch(); | 59 | void power(); |
57 | void email(); | 60 | void symbol(); |
58 | void backlight(); | 61 | void numLockStateToggle(); |
59 | void power(); | 62 | void capsLockStateToggle(); |
60 | void symbol(); | 63 | void prepareForRestart(); |
61 | void numLockStateToggle(); | ||
62 | void capsLockStateToggle(); | ||
63 | void prepareForRestart(); | ||
64 | 64 | ||
65 | protected: | 65 | protected: |
66 | #ifdef Q_WS_QWS | 66 | #ifdef Q_WS_QWS |
67 | 67 | ||
68 | bool qwsEventFilter( QWSEvent * ); | 68 | bool qwsEventFilter( QWSEvent * ); |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | void shutdown(); | 71 | void shutdown(); |
72 | void restart(); | 72 | void restart(); |
73 | 73 | ||
74 | public slots: | 74 | public slots: |
75 | virtual void desktopMessage ( const QCString &msg, const QByteArray &data ); | 75 | virtual void systemMessage ( const QCString &msg, const QByteArray &data ); |
76 | virtual void systemMessage ( const QCString &msg, const QByteArray &data ); | 76 | virtual void launcherMessage ( const QCString &msg, const QByteArray &data ); |
77 | void rereadVolumes(); | ||
77 | 78 | ||
78 | protected slots: | 79 | protected slots: |
79 | void shutdown( ShutdownImpl::Type ); | 80 | void shutdown ( ShutdownImpl::Type ); |
80 | void apmTimeout(); | 81 | void apmTimeout ( ); |
81 | void sendCard(); | 82 | void sendHeldAction ( ); |
83 | |||
84 | protected: | ||
85 | virtual bool eventFilter ( QObject *o, QEvent *e ); | ||
86 | void checkButtonAction ( const Opie::ODeviceButton *db, int keycode, bool press, bool autoRepeat ); | ||
87 | |||
88 | private: | ||
89 | static DesktopApplication *me ( ); | ||
90 | |||
82 | private: | 91 | private: |
83 | void reloadPowerWarnSettings(); | 92 | void reloadPowerWarnSettings(); |
84 | DesktopPowerAlerter *pa; | 93 | DesktopPowerAlerter *pa; |
85 | PowerStatus *m_ps, *m_ps_last; | 94 | PowerStatus *m_ps, *m_ps_last; |
86 | QTimer *cardSendTimer; | 95 | QTimer *cardSendTimer; |
87 | QCopChannel *channel; | 96 | QCopChannel *channel; |
88 | OpieScreenSaver *m_screensaver; | 97 | OpieScreenSaver *m_screensaver; |
89 | QTimer * m_timer; | 98 | QTimer * m_timer; |
90 | int m_powerVeryLow; | 99 | int m_powerVeryLow; |
91 | int m_powerCritical; | 100 | int m_powerCritical; |
92 | int m_currentPowerLevel; | 101 | int m_currentPowerLevel; |
102 | |||
103 | const Opie::ODeviceButton *m_last_button; | ||
104 | QTimer *m_button_timer; | ||
105 | |||
106 | bool m_keyclick_sound : 1; | ||
107 | bool m_screentap_sound : 1; | ||
108 | bool m_alarm_sound : 1; | ||
93 | }; | 109 | }; |
94 | 110 | ||
95 | 111 | ||
96 | class Desktop : public QWidget | 112 | class Desktop : public QWidget |
97 | { | 113 | { |
98 | Q_OBJECT | 114 | Q_OBJECT |
99 | public: | 115 | public: |
100 | Desktop(); | 116 | Desktop(); |
101 | ~Desktop(); | 117 | ~Desktop(); |
102 | |||
103 | static bool screenLocked(); | ||
104 | 118 | ||
105 | void show(); | 119 | static bool screenLocked(); |
106 | void checkMemory(); | ||
107 | 120 | ||
108 | void keyClick(); | 121 | void show(); |
109 | void screenClick(); | 122 | void checkMemory(); |
110 | static void soundAlarm(); | ||
111 | 123 | ||
112 | public slots: | 124 | public slots: |
113 | void raiseDatebook(); | 125 | void execAutoStart(); |
114 | void raiseContacts(); | 126 | void togglePower(); |
115 | void raiseMenu(); | 127 | void toggleLight(); |
116 | void raiseLauncher(); | 128 | void toggleNumLockState(); |
117 | void raiseEmail(); | 129 | void toggleCapsLockState(); |
118 | void execAutoStart(); | 130 | void toggleSymbolInput(); |
119 | void togglePower(); | 131 | void terminateServers(); |
120 | void toggleLight(); | ||
121 | void toggleNumLockState(); | ||
122 | void toggleCapsLockState(); | ||
123 | void toggleSymbolInput(); | ||
124 | void terminateServers(); | ||
125 | void rereadVolumes(); | ||
126 | |||
127 | void home ( ); | ||
128 | 132 | ||
129 | protected: | 133 | protected: |
130 | void executeOrModify( const QString& appLnkFile ); | 134 | void executeOrModify( const QString& appLnkFile ); |
131 | void styleChange( QStyle & ); | 135 | void styleChange( QStyle & ); |
132 | void timerEvent( QTimerEvent *e ); | 136 | void timerEvent( QTimerEvent *e ); |
133 | 137 | ||
134 | QWidget *bg; | 138 | QWidget *bg; |
135 | Launcher *launcher; | 139 | Launcher *launcher; |
136 | TaskBar *tb; | 140 | TaskBar *tb; |
137 | 141 | ||
138 | private: | 142 | private: |
139 | void startTransferServer(); | 143 | void startTransferServer(); |
140 | bool recoverMemory(); | 144 | bool recoverMemory(); |
141 | 145 | ||
142 | QCopBridge *qcopBridge; | 146 | QCopBridge *qcopBridge; |
143 | TransferServer *transferServer; | 147 | TransferServer *transferServer; |
144 | PackageSlave *packageSlave; | 148 | PackageSlave *packageSlave; |
145 | 149 | ||
146 | QDateTime suspendTime; | 150 | QDateTime suspendTime; |
147 | bool keyclick, touchclick, alarmsound; | ||
148 | }; | 151 | }; |
149 | 152 | ||
150 | 153 | ||
151 | #endif // __DESKTOP_H__ | 154 | #endif // __DESKTOP_H__ |
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 767efb2..6764338 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -1181,8 +1181,15 @@ void Launcher::launcherMessage( const QCString &msg, const QByteArray &data) | |||
1181 | QString type; | 1181 | QString type; |
1182 | stream >> type; | 1182 | stream >> type; |
1183 | tabs->setBusyIndicatorType(type); | 1183 | tabs->setBusyIndicatorType(type); |
1184 | } | 1184 | } |
1185 | else if ( msg == "home()" ) { | ||
1186 | if ( isVisibleWindow( winId ( ))) | ||
1187 | nextView ( ); | ||
1188 | else | ||
1189 | raise ( ); | ||
1190 | |||
1191 | } | ||
1185 | } | 1192 | } |
1186 | 1193 | ||
1187 | void Launcher::storageChanged() | 1194 | void Launcher::storageChanged() |
1188 | { | 1195 | { |
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 8b91f5d..49b41d6 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -91,13 +91,8 @@ int initApplication( int argc, char ** argv ) | |||
91 | AlarmServer::initialize(); | 91 | AlarmServer::initialize(); |
92 | 92 | ||
93 | Desktop *d = new Desktop(); | 93 | Desktop *d = new Desktop(); |
94 | 94 | ||
95 | QObject::connect( &a, SIGNAL(menu()), d, SLOT(raiseMenu()) ); | ||
96 | QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) ); | ||
97 | QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); | ||
98 | QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); | ||
99 | QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); | ||
100 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); | 95 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); |
101 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); | 96 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); |
102 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); | 97 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); |
103 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); | 98 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); |
diff --git a/core/launcher/opie-taskbar.control b/core/launcher/opie-taskbar.control index 13e5715..8bf2113 100644 --- a/core/launcher/opie-taskbar.control +++ b/core/launcher/opie-taskbar.control | |||
@@ -1,5 +1,5 @@ | |||
1 | Files: bin/qpe apps/Settings/Calibrate.desktop pics/launcher plugins/applets/libsuspendapplet.so* plugins/applets/libhomeapplet.so* plugins/applets/liblogoutapplet.so* | 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* |
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 |
diff --git a/core/launcher/runningappbar.cpp b/core/launcher/runningappbar.cpp index 3ac66f2..356200b 100644 --- a/core/launcher/runningappbar.cpp +++ b/core/launcher/runningappbar.cpp | |||
@@ -123,17 +123,8 @@ void RunningAppBar::removeTask(const AppLnk& appLnk) | |||
123 | if (target->exec() == appLnk.exec()) { | 123 | if (target->exec() == appLnk.exec()) { |
124 | qDebug("Removing %s from app list.", appLnk.name().latin1()); | 124 | qDebug("Removing %s from app list.", appLnk.name().latin1()); |
125 | m_AppList.remove(); | 125 | m_AppList.remove(); |
126 | 126 | ||
127 | // grab the keyboard back, in case the app crashed/forgot | ||
128 | |||
129 | QPEApplication *qpeapp = (QPEApplication *) qApp; | ||
130 | |||
131 | if ( appLnk.exec() == qpeapp-> keyboardGrabbedBy ( )) { | ||
132 | qDebug ( "grabbing keyboard back from %s", appLnk.name().latin1()); | ||
133 | qpeapp-> grabKeyboard ( ); | ||
134 | } | ||
135 | |||
136 | delete target; | 127 | delete target; |
137 | } | 128 | } |
138 | } | 129 | } |
139 | update(); | 130 | update(); |
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp index 88c6219..39e07c8 100644 --- a/core/launcher/startmenu.cpp +++ b/core/launcher/startmenu.cpp | |||
@@ -240,20 +240,21 @@ bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu ) | |||
240 | return result; | 240 | return result; |
241 | } | 241 | } |
242 | 242 | ||
243 | 243 | ||
244 | void StartMenu::launch() | 244 | void StartMenu::launch ( ) |
245 | { | 245 | { |
246 | int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); | 246 | int y = mapToGlobal ( QPoint ( )). y ( ) - launchMenu-> sizeHint ( ). height ( ); |
247 | 247 | ||
248 | if ( launchMenu->isVisible() ) | 248 | if ( launchMenu-> isVisible ( )) { |
249 | launchMenu->hide(); | 249 | launchMenu-> hide ( ); |
250 | } | ||
250 | else { | 251 | else { |
251 | QWidget *active = qApp->activeWindow(); | 252 | QWidget *active = qApp-> activeWindow ( ); |
252 | if ( active && active->isPopup() ) | 253 | if ( active && active-> isPopup ( )) |
253 | active->close(); | 254 | active-> close ( ); |
254 | 255 | ||
255 | launchMenu->popup( QPoint( 1, y ) ); | 256 | launchMenu-> popup ( QPoint ( 1, y )); |
256 | } | 257 | } |
257 | } | 258 | } |
258 | 259 | ||
259 | const AppLnk* StartMenu::execToLink(const QString& appname) | 260 | const AppLnk* StartMenu::execToLink(const QString& appname) |
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index b4b7df6..77035a3 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp | |||
@@ -279,9 +279,9 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data ) | |||
279 | sysTray->clearApplets(); | 279 | sysTray->clearApplets(); |
280 | sysTray->addApplets(); | 280 | sysTray->addApplets(); |
281 | sm->reloadApplets(); | 281 | sm->reloadApplets(); |
282 | } else if ( msg == "soundAlarm()" ) { | 282 | } else if ( msg == "soundAlarm()" ) { |
283 | Desktop::soundAlarm(); | 283 | DesktopApplication::soundAlarm ( ); |
284 | } | 284 | } |
285 | else if ( msg == "setLed(int,bool)" ) { | 285 | else if ( msg == "setLed(int,bool)" ) { |
286 | int led, status; | 286 | int led, status; |
287 | stream >> led >> status; | 287 | stream >> led >> status; |
@@ -293,8 +293,18 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data ) | |||
293 | 293 | ||
294 | 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 ); |
295 | } | 295 | } |
296 | } | 296 | } |
297 | else if ( msg == "toggleMenu()" ) { | ||
298 | if ( sm-> launchMenu-> isVisible ( )) | ||
299 | sm-> launch ( ); | ||
300 | else { | ||
301 | QCopEnvelope e ( "QPE/System", "toggleApplicationMenu()" ); | ||
302 | } | ||
303 | } | ||
304 | else if ( msg == "toggleStartMenu()" ) { | ||
305 | sm-> launch ( ); | ||
306 | } | ||
297 | } | 307 | } |
298 | 308 | ||
299 | QWidget *TaskBar::calibrate(bool) | 309 | QWidget *TaskBar::calibrate(bool) |
300 | { | 310 | { |