-rw-r--r-- | core/launcher/desktop.cpp | 10 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 2 | ||||
-rw-r--r-- | core/launcher/main.cpp | 7 | ||||
-rw-r--r-- | core/launcher/qcopbridge.cpp | 2 | ||||
-rw-r--r-- | core/launcher/runningappbar.cpp | 2 | ||||
-rw-r--r-- | core/launcher/transferserver.cpp | 2 |
6 files changed, 12 insertions, 13 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index d74b745..1fd3f6a 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -91,129 +91,128 @@ typedef QValueList<QCopKeyRegister> KeyRegisterList; | |||
91 | KeyRegisterList keyRegisterList; | 91 | KeyRegisterList keyRegisterList; |
92 | 92 | ||
93 | static Desktop* qpedesktop = 0; | 93 | static Desktop* qpedesktop = 0; |
94 | static int loggedin = 0; | 94 | static int loggedin = 0; |
95 | static void login( bool at_poweron ) | 95 | static void login( bool at_poweron ) |
96 | { | 96 | { |
97 | if ( !loggedin ) { | 97 | if ( !loggedin ) { |
98 | Global::terminateBuiltin( "calibrate" ); | 98 | Global::terminateBuiltin( "calibrate" ); |
99 | Password::authenticate( at_poweron ); | 99 | Password::authenticate( at_poweron ); |
100 | loggedin = 1; | 100 | loggedin = 1; |
101 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); | 101 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | bool Desktop::screenLocked() | 105 | bool Desktop::screenLocked() |
106 | { | 106 | { |
107 | return loggedin == 0; | 107 | return loggedin == 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | /* | 110 | /* |
111 | Priority is number of alerts that are needed to pop up | 111 | Priority is number of alerts that are needed to pop up |
112 | alert. | 112 | alert. |
113 | */ | 113 | */ |
114 | class DesktopPowerAlerter : public QMessageBox | 114 | class DesktopPowerAlerter : public QMessageBox |
115 | { | 115 | { |
116 | public: | 116 | public: |
117 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) | 117 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) |
118 | : QMessageBox( tr( "Battery Status" ), "Low Battery", | 118 | : QMessageBox( tr( "Battery Status" ), "Low Battery", |
119 | QMessageBox::Critical, | 119 | QMessageBox::Critical, |
120 | QMessageBox::Ok | QMessageBox::Default, | 120 | QMessageBox::Ok | QMessageBox::Default, |
121 | QMessageBox::NoButton, QMessageBox::NoButton, | 121 | QMessageBox::NoButton, QMessageBox::NoButton, |
122 | parent, name, FALSE ) | 122 | parent, name, FALSE ) |
123 | { | 123 | { |
124 | currentPriority = INT_MAX; | 124 | currentPriority = INT_MAX; |
125 | alertCount = 0; | 125 | alertCount = 0; |
126 | } | 126 | } |
127 | 127 | ||
128 | void alert( const QString &text, int priority ); | 128 | void alert( const QString &text, int priority ); |
129 | void hideEvent( QHideEvent * ); | 129 | void hideEvent( QHideEvent * ); |
130 | private: | 130 | private: |
131 | int currentPriority; | 131 | int currentPriority; |
132 | int alertCount; | 132 | int alertCount; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | void DesktopPowerAlerter::alert( const QString &text, int priority ) | 135 | void DesktopPowerAlerter::alert( const QString &text, int priority ) |
136 | { | 136 | { |
137 | alertCount++; | 137 | alertCount++; |
138 | if ( alertCount < priority ) | 138 | if ( alertCount < priority ) |
139 | return ; | 139 | return ; |
140 | if ( priority > currentPriority ) | 140 | if ( priority > currentPriority ) |
141 | return ; | 141 | return ; |
142 | currentPriority = priority; | 142 | currentPriority = priority; |
143 | setText( text ); | 143 | setText( text ); |
144 | show(); | 144 | show(); |
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) | 148 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) |
149 | { | 149 | { |
150 | QMessageBox::hideEvent( e ); | 150 | QMessageBox::hideEvent( e ); |
151 | alertCount = 0; | 151 | alertCount = 0; |
152 | currentPriority = INT_MAX; | 152 | currentPriority = INT_MAX; |
153 | } | 153 | } |
154 | 154 | ||
155 | |||
156 | class QPEScreenSaver : public QWSScreenSaver | 155 | class QPEScreenSaver : public QWSScreenSaver |
157 | { | 156 | { |
158 | private: | 157 | private: |
159 | int LcdOn; | 158 | int LcdOn; |
160 | 159 | ||
161 | public: | 160 | public: |
162 | QPEScreenSaver() | 161 | QPEScreenSaver() |
163 | { | 162 | { |
164 | m_disable_suspend = 100; | 163 | m_disable_suspend = 100; |
165 | m_enable_dim = false; | 164 | m_enable_dim = false; |
166 | m_enable_lightoff = false; | 165 | m_enable_lightoff = false; |
167 | m_enable_onlylcdoff = false; | 166 | m_enable_onlylcdoff = false; |
168 | 167 | ||
169 | m_lcd_status = true; | 168 | m_lcd_status = true; |
170 | 169 | ||
171 | m_backlight_bright = -1; | 170 | m_backlight_bright = -1; |
172 | m_backlight_forcedoff = false; | 171 | m_backlight_forcedoff = false; |
173 | 172 | ||
174 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) | 173 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) |
175 | ODevice::inst ( ) -> setDisplayStatus ( true ); | 174 | ODevice::inst ( ) -> setDisplayStatus ( true ); |
176 | } | 175 | } |
177 | void restore() | 176 | void restore() |
178 | { | 177 | { |
179 | if ( !m_lcd_status ) { // We must have turned it off | 178 | if ( !m_lcd_status ) { // We must have turned it off |
180 | ODevice::inst ( ) -> setDisplayStatus ( true ); | 179 | ODevice::inst ( ) -> setDisplayStatus ( true ); |
181 | m_lcd_status = true; | 180 | m_lcd_status = true; |
182 | } | 181 | } |
183 | 182 | ||
184 | setBacklight ( -1 ); | 183 | setBacklight ( -1 ); |
185 | } | 184 | } |
186 | bool save( int level ) | 185 | bool save( int level ) |
187 | { | 186 | { |
188 | switch ( level ) { | 187 | switch ( level ) { |
189 | case 0: | 188 | case 0: |
190 | if ( m_disable_suspend > 0 && m_enable_dim ) { | 189 | if ( m_disable_suspend > 0 && m_enable_dim ) { |
191 | if ( backlight() > 1 ) | 190 | if ( backlight() > 1 ) |
192 | setBacklight( 1 ); // lowest non-off | 191 | setBacklight( 1 ); // lowest non-off |
193 | } | 192 | } |
194 | return true; | 193 | return true; |
195 | break; | 194 | break; |
196 | case 1: | 195 | case 1: |
197 | if ( m_disable_suspend > 1 && m_enable_lightoff ) { | 196 | if ( m_disable_suspend > 1 && m_enable_lightoff ) { |
198 | setBacklight( 0 ); // off | 197 | setBacklight( 0 ); // off |
199 | } | 198 | } |
200 | return true; | 199 | return true; |
201 | break; | 200 | break; |
202 | case 2: | 201 | case 2: |
203 | if ( m_enable_onlylcdoff ) { | 202 | if ( m_enable_onlylcdoff ) { |
204 | ODevice::inst ( ) -> setDisplayStatus ( false ); | 203 | ODevice::inst ( ) -> setDisplayStatus ( false ); |
205 | m_lcd_status = false; | 204 | m_lcd_status = false; |
206 | return true; | 205 | return true; |
207 | } | 206 | } |
208 | else // We're going to suspend the whole machine | 207 | else // We're going to suspend the whole machine |
209 | { | 208 | { |
210 | if ( ( m_disable_suspend > 2 ) && | 209 | if ( ( m_disable_suspend > 2 ) && |
211 | ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) && | 210 | ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) && |
212 | ( !Network::networkOnline ( ) ) ) { | 211 | ( !Network::networkOnline ( ) ) ) { |
213 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | 212 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); |
214 | return true; | 213 | return true; |
215 | } | 214 | } |
216 | } | 215 | } |
217 | break; | 216 | break; |
218 | } | 217 | } |
219 | return false; | 218 | return false; |
@@ -264,129 +263,128 @@ public: | |||
264 | setIntervals ( -1, -1, interval ); | 263 | setIntervals ( -1, -1, interval ); |
265 | } | 264 | } |
266 | 265 | ||
267 | void setMode ( int mode ) | 266 | void setMode ( int mode ) |
268 | { | 267 | { |
269 | if ( mode > m_disable_suspend ) | 268 | if ( mode > m_disable_suspend ) |
270 | setInterval( -1 ); | 269 | setInterval( -1 ); |
271 | m_disable_suspend = mode; | 270 | m_disable_suspend = mode; |
272 | } | 271 | } |
273 | 272 | ||
274 | int backlight ( ) | 273 | int backlight ( ) |
275 | { | 274 | { |
276 | if ( m_backlight_bright == -1 ) { | 275 | if ( m_backlight_bright == -1 ) { |
277 | // Read from config | 276 | // Read from config |
278 | Config config ( "qpe" ); | 277 | Config config ( "qpe" ); |
279 | config. setGroup ( "Screensaver" ); | 278 | config. setGroup ( "Screensaver" ); |
280 | m_backlight_bright = config. readNumEntry ( "Brightness", 255 ); | 279 | m_backlight_bright = config. readNumEntry ( "Brightness", 255 ); |
281 | } | 280 | } |
282 | return m_backlight_bright; | 281 | return m_backlight_bright; |
283 | } | 282 | } |
284 | 283 | ||
285 | void setBacklight ( int bright ) | 284 | void setBacklight ( int bright ) |
286 | { | 285 | { |
287 | if ( bright == -3 ) { | 286 | if ( bright == -3 ) { |
288 | // Forced on | 287 | // Forced on |
289 | m_backlight_forcedoff = false; | 288 | m_backlight_forcedoff = false; |
290 | bright = -1; | 289 | bright = -1; |
291 | } | 290 | } |
292 | if ( m_backlight_forcedoff && bright != -2 ) | 291 | if ( m_backlight_forcedoff && bright != -2 ) |
293 | return ; | 292 | return ; |
294 | if ( bright == -2 ) { | 293 | if ( bright == -2 ) { |
295 | // Toggle between off and on | 294 | // Toggle between off and on |
296 | bright = m_backlight_bright ? 0 : -1; | 295 | bright = m_backlight_bright ? 0 : -1; |
297 | m_backlight_forcedoff = !bright; | 296 | m_backlight_forcedoff = !bright; |
298 | } | 297 | } |
299 | 298 | ||
300 | m_backlight_bright = bright; | 299 | m_backlight_bright = bright; |
301 | 300 | ||
302 | bright = backlight ( ); | 301 | bright = backlight ( ); |
303 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); | 302 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); |
304 | 303 | ||
305 | m_backlight_bright = bright; | 304 | m_backlight_bright = bright; |
306 | } | 305 | } |
307 | 306 | ||
308 | void setDisplayState ( bool on ) | 307 | void setDisplayState ( bool on ) |
309 | { | 308 | { |
310 | if ( m_lcd_status != on ) { | 309 | if ( m_lcd_status != on ) { |
311 | ODevice::inst ( ) -> setDisplayStatus ( on ); | 310 | ODevice::inst ( ) -> setDisplayStatus ( on ); |
312 | m_lcd_status = on; | 311 | m_lcd_status = on; |
313 | } | 312 | } |
314 | } | 313 | } |
315 | 314 | ||
316 | private: | 315 | private: |
317 | int m_disable_suspend; | 316 | int m_disable_suspend; |
318 | bool m_enable_dim; | 317 | bool m_enable_dim; |
319 | bool m_enable_lightoff; | 318 | bool m_enable_lightoff; |
320 | bool m_enable_onlylcdoff; | 319 | bool m_enable_onlylcdoff; |
321 | 320 | ||
322 | bool m_lcd_status; | 321 | bool m_lcd_status; |
323 | 322 | ||
324 | int m_backlight_bright; | 323 | int m_backlight_bright; |
325 | bool m_backlight_forcedoff; | 324 | bool m_backlight_forcedoff; |
326 | }; | 325 | }; |
327 | 326 | ||
328 | |||
329 | void DesktopApplication::switchLCD ( bool on ) | 327 | void DesktopApplication::switchLCD ( bool on ) |
330 | { | 328 | { |
331 | if ( qApp ) { | 329 | if ( qApp ) { |
332 | DesktopApplication *dapp = (DesktopApplication *) qApp; | 330 | DesktopApplication *dapp = (DesktopApplication *) qApp; |
333 | 331 | ||
334 | if ( dapp-> m_screensaver ) { | 332 | if ( dapp-> m_screensaver ) { |
335 | if ( on ) { | 333 | if ( on ) { |
336 | dapp-> m_screensaver-> setDisplayState ( true ); | 334 | dapp-> m_screensaver-> setDisplayState ( true ); |
337 | dapp-> m_screensaver-> setBacklight ( -3 ); | 335 | dapp-> m_screensaver-> setBacklight ( -3 ); |
338 | } | 336 | } |
339 | else { | 337 | else { |
340 | dapp-> m_screensaver-> setDisplayState ( false ); | 338 | dapp-> m_screensaver-> setDisplayState ( false ); |
341 | } | 339 | } |
342 | } | 340 | } |
343 | } | 341 | } |
344 | } | 342 | } |
345 | 343 | ||
346 | 344 | ||
347 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) | 345 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) |
348 | : QPEApplication( argc, argv, appType ) | 346 | : QPEApplication( argc, argv, appType ) |
349 | { | 347 | { |
350 | 348 | ||
351 | QTimer * t = new QTimer( this ); | 349 | QTimer * t = new QTimer( this ); |
352 | connect( t, SIGNAL( timeout() ), this, SLOT( psTimeout() ) ); | 350 | connect( t, SIGNAL( timeout() ), this, SLOT( psTimeout() ) ); |
353 | t->start( 10000 ); | 351 | t->start( 10000 ); |
354 | ps = new PowerStatus; | 352 | ps = new PowerStatus; |
355 | pa = new DesktopPowerAlerter( 0 ); | 353 | pa = new DesktopPowerAlerter( 0 ); |
356 | 354 | ||
357 | channel = new QCopChannel( "QPE/Desktop", this ); | 355 | channel = new QCopChannel( "QPE/Desktop", this ); |
358 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), | 356 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), |
359 | this, SLOT( desktopMessage( const QCString&, const QByteArray& ) ) ); | 357 | this, SLOT( desktopMessage( const QCString&, const QByteArray& ) ) ); |
360 | 358 | ||
361 | channel = new QCopChannel( "QPE/System", this ); | 359 | channel = new QCopChannel( "QPE/System", this ); |
362 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), | 360 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), |
363 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); | 361 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); |
364 | 362 | ||
365 | m_screensaver = new QPEScreenSaver; | 363 | m_screensaver = new QPEScreenSaver; |
366 | 364 | ||
367 | m_screensaver-> setInterval ( -1 ); | 365 | m_screensaver-> setInterval ( -1 ); |
368 | QWSServer::setScreenSaver( m_screensaver ); | 366 | QWSServer::setScreenSaver( m_screensaver ); |
369 | } | 367 | } |
370 | 368 | ||
371 | 369 | ||
372 | DesktopApplication::~DesktopApplication() | 370 | DesktopApplication::~DesktopApplication() |
373 | { | 371 | { |
374 | delete ps; | 372 | delete ps; |
375 | delete pa; | 373 | delete pa; |
376 | } | 374 | } |
377 | 375 | ||
378 | void DesktopApplication::desktopMessage( const QCString &msg, const QByteArray &data ) | 376 | void DesktopApplication::desktopMessage( const QCString &msg, const QByteArray &data ) |
379 | { | 377 | { |
380 | #ifdef Q_WS_QWS | 378 | #ifdef Q_WS_QWS |
381 | QDataStream stream( data, IO_ReadOnly ); | 379 | QDataStream stream( data, IO_ReadOnly ); |
382 | if ( msg == "keyRegister(int key, QString channel, QString message)" ) { | 380 | if ( msg == "keyRegister(int key, QString channel, QString message)" ) { |
383 | int k; | 381 | int k; |
384 | QString c, m; | 382 | QString c, m; |
385 | stream >> k; | 383 | stream >> k; |
386 | stream >> c; | 384 | stream >> c; |
387 | stream >> m; | 385 | stream >> m; |
388 | 386 | ||
389 | qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m ); | 387 | qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m ); |
390 | keyRegisterList.append( QCopKeyRegister( k, c, m ) ); | 388 | keyRegisterList.append( QCopKeyRegister( k, c, m ) ); |
391 | } | 389 | } |
392 | #endif | 390 | #endif |
@@ -581,232 +579,236 @@ void DesktopApplication::psTimeout() | |||
581 | 579 | ||
582 | 580 | ||
583 | void DesktopApplication::sendCard() | 581 | void DesktopApplication::sendCard() |
584 | { | 582 | { |
585 | delete cardSendTimer; | 583 | delete cardSendTimer; |
586 | cardSendTimer = 0; | 584 | cardSendTimer = 0; |
587 | QString card = getenv( "HOME" ); | 585 | QString card = getenv( "HOME" ); |
588 | card += "/Applications/addressbook/businesscard.vcf"; | 586 | card += "/Applications/addressbook/businesscard.vcf"; |
589 | 587 | ||
590 | if ( QFile::exists( card ) ) { | 588 | if ( QFile::exists( card ) ) { |
591 | QCopEnvelope e( "QPE/Obex", "send(QString,QString,QString)" ); | 589 | QCopEnvelope e( "QPE/Obex", "send(QString,QString,QString)" ); |
592 | QString mimetype = "text/x-vCard"; | 590 | QString mimetype = "text/x-vCard"; |
593 | e << tr( "business card" ) << card << mimetype; | 591 | e << tr( "business card" ) << card << mimetype; |
594 | } | 592 | } |
595 | } | 593 | } |
596 | 594 | ||
597 | #if defined(QPE_HAVE_MEMALERTER) | 595 | #if defined(QPE_HAVE_MEMALERTER) |
598 | QPE_MEMALERTER_IMPL | 596 | QPE_MEMALERTER_IMPL |
599 | #endif | 597 | #endif |
600 | 598 | ||
601 | //=========================================================================== | 599 | //=========================================================================== |
602 | 600 | ||
603 | Desktop::Desktop() : | 601 | Desktop::Desktop() : |
604 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), | 602 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), |
605 | qcopBridge( 0 ), | 603 | qcopBridge( 0 ), |
606 | transferServer( 0 ), | 604 | transferServer( 0 ), |
607 | packageSlave( 0 ) | 605 | packageSlave( 0 ) |
608 | { | 606 | { |
609 | qpedesktop = this; | 607 | qpedesktop = this; |
610 | 608 | ||
611 | // bg = new Info( this ); | 609 | // bg = new Info( this ); |
612 | tb = new TaskBar; | 610 | tb = new TaskBar; |
613 | 611 | ||
614 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); | 612 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); |
615 | 613 | ||
616 | connect( launcher, SIGNAL( busy() ), tb, SLOT( startWait() ) ); | 614 | connect( launcher, SIGNAL( busy() ), tb, SLOT( startWait() ) ); |
617 | connect( launcher, SIGNAL( notBusy( const QString& ) ), tb, SLOT( stopWait( const QString& ) ) ); | 615 | connect( launcher, SIGNAL( notBusy( const QString& ) ), tb, SLOT( stopWait( const QString& ) ) ); |
618 | 616 | ||
619 | int displayw = qApp->desktop() ->width(); | 617 | int displayw = qApp->desktop() ->width(); |
620 | int displayh = qApp->desktop() ->height(); | 618 | int displayh = qApp->desktop() ->height(); |
621 | 619 | ||
622 | 620 | ||
623 | QSize sz = tb->sizeHint(); | 621 | QSize sz = tb->sizeHint(); |
624 | 622 | ||
625 | setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | 623 | setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); |
626 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); | 624 | tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); |
627 | 625 | ||
628 | tb->show(); | 626 | tb->show(); |
629 | launcher->showMaximized(); | 627 | launcher->showMaximized(); |
630 | launcher->show(); | 628 | launcher->show(); |
631 | launcher->raise(); | 629 | launcher->raise(); |
632 | #if defined(QPE_HAVE_MEMALERTER) | 630 | #if defined(QPE_HAVE_MEMALERTER) |
633 | 631 | ||
634 | initMemalerter(); | 632 | initMemalerter(); |
635 | #endif | 633 | #endif |
636 | // start services | 634 | // start services |
637 | startTransferServer(); | 635 | startTransferServer(); |
638 | ( void ) new IrServer( this ); | 636 | ( void ) new IrServer( this ); |
639 | rereadVolumes(); | 637 | rereadVolumes(); |
640 | 638 | ||
641 | packageSlave = new PackageSlave( this ); | 639 | packageSlave = new PackageSlave( this ); |
642 | connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); | 640 | connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); |
643 | 641 | ||
644 | qApp->installEventFilter( this ); | 642 | qApp->installEventFilter( this ); |
645 | 643 | ||
646 | qApp-> setMainWidget ( launcher ); | 644 | qApp-> setMainWidget ( launcher ); |
647 | } | 645 | } |
648 | 646 | ||
649 | void Desktop::show() | 647 | void Desktop::show() |
650 | { | 648 | { |
651 | login( TRUE ); | 649 | login( TRUE ); |
652 | QWidget::show(); | 650 | QWidget::show(); |
653 | } | 651 | } |
654 | 652 | ||
655 | Desktop::~Desktop() | 653 | Desktop::~Desktop() |
656 | { | 654 | { |
657 | delete launcher; | 655 | delete launcher; |
658 | delete tb; | 656 | delete tb; |
659 | delete qcopBridge; | 657 | delete qcopBridge; |
660 | delete transferServer; | 658 | delete transferServer; |
661 | } | 659 | } |
662 | 660 | ||
663 | bool Desktop::recoverMemory() | 661 | bool Desktop::recoverMemory() |
664 | { | 662 | { |
665 | return tb->recoverMemory(); | 663 | return tb->recoverMemory(); |
666 | } | 664 | } |
667 | 665 | ||
668 | void Desktop::checkMemory() | 666 | void Desktop::checkMemory() |
669 | { | 667 | { |
670 | #if defined(QPE_HAVE_MEMALERTER) | 668 | #if defined(QPE_HAVE_MEMALERTER) |
671 | static bool ignoreNormal = FALSE; | 669 | static bool ignoreNormal = FALSE; |
672 | static bool existingMessage = FALSE; | 670 | static bool existingMessage = FALSE; |
673 | 671 | ||
674 | if ( existingMessage ) | 672 | if ( existingMessage ) |
675 | return ; // don't show a second message while still on first | 673 | return ; // don't show a second message while still on first |
676 | 674 | ||
677 | existingMessage = TRUE; | 675 | existingMessage = TRUE; |
678 | switch ( memstate ) { | 676 | switch ( memstate ) { |
679 | case Unknown: | 677 | case Unknown: |
680 | break; | 678 | break; |
681 | case Low: | 679 | case Low: |
682 | memstate = Unknown; | 680 | memstate = Unknown; |
683 | if ( recoverMemory() ) | 681 | if ( recoverMemory() ) |
684 | ignoreNormal = TRUE; | 682 | ignoreNormal = TRUE; |
685 | else | 683 | else |
686 | QMessageBox::warning( 0 , "Memory Status", | 684 | QMessageBox::warning( 0 , "Memory Status", |
687 | "The memory smacks of shortage. \n" | 685 | "The memory smacks of shortage. \n" |
688 | "Please save data. " ); | 686 | "Please save data. " ); |
689 | break; | 687 | break; |
690 | case Normal: | 688 | case Normal: |
691 | memstate = Unknown; | 689 | memstate = Unknown; |
692 | if ( ignoreNormal ) | 690 | if ( ignoreNormal ) |
693 | ignoreNormal = FALSE; | 691 | ignoreNormal = FALSE; |
694 | // else | 692 | // else |
695 | // QMessageBox::information ( 0 , "Memory Status", | 693 | // QMessageBox::information ( 0 , "Memory Status", |
696 | // "There is enough memory again." ); | 694 | // "There is enough memory again." ); |
697 | break; | 695 | break; |
698 | case VeryLow: | 696 | case VeryLow: |
699 | memstate = Unknown; | 697 | memstate = Unknown; |
700 | QMessageBox::critical( 0 , "Memory Status", | 698 | QMessageBox::critical( 0 , "Memory Status", |
701 | "The memory is very low. \n" | 699 | "The memory is very low. \n" |
702 | "Please end this application \n" | 700 | "Please end this application \n" |
703 | "immediately." ); | 701 | "immediately." ); |
704 | recoverMemory(); | 702 | recoverMemory(); |
705 | } | 703 | } |
706 | existingMessage = FALSE; | 704 | existingMessage = FALSE; |
707 | #endif | 705 | #endif |
708 | } | 706 | } |
709 | 707 | ||
710 | static bool isVisibleWindow( int wid ) | 708 | static bool isVisibleWindow( int wid ) |
711 | { | 709 | { |
710 | #ifdef QWS | ||
712 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 711 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
713 | QWSWindow* w; | 712 | QWSWindow* w; |
714 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { | 713 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { |
715 | if ( w->winId() == wid ) | 714 | if ( w->winId() == wid ) |
716 | return !w->isFullyObscured(); | 715 | return !w->isFullyObscured(); |
717 | } | 716 | } |
717 | #endif | ||
718 | return FALSE; | 718 | return FALSE; |
719 | } | 719 | } |
720 | 720 | ||
721 | static bool hasVisibleWindow( const QString& clientname ) | 721 | static bool hasVisibleWindow( const QString& clientname ) |
722 | { | 722 | { |
723 | #ifdef QWS | ||
723 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 724 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
724 | QWSWindow* w; | 725 | QWSWindow* w; |
725 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { | 726 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { |
726 | if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) | 727 | if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) |
727 | return TRUE; | 728 | return TRUE; |
728 | } | 729 | } |
730 | #endif | ||
729 | return FALSE; | 731 | return FALSE; |
730 | } | 732 | } |
731 | 733 | ||
732 | void Desktop::raiseLauncher() | 734 | void Desktop::raiseLauncher() |
733 | { | 735 | { |
734 | Config cfg( "qpe" ); //F12 'Home' | 736 | Config cfg( "qpe" ); //F12 'Home' |
735 | cfg.setGroup( "AppsKey" ); | 737 | cfg.setGroup( "AppsKey" ); |
736 | QString tempItem; | 738 | QString tempItem; |
737 | tempItem = cfg.readEntry( "Middle", "Home" ); | 739 | tempItem = cfg.readEntry( "Middle", "Home" ); |
738 | if ( tempItem == "Home" || tempItem.isEmpty() ) { | 740 | if ( tempItem == "Home" || tempItem.isEmpty() ) { |
739 | home ( ); | 741 | home ( ); |
740 | } | 742 | } |
741 | else { | 743 | else { |
742 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 744 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
743 | e << tempItem; | 745 | e << tempItem; |
744 | } | 746 | } |
745 | } | 747 | } |
746 | 748 | ||
747 | void Desktop::home ( ) | 749 | void Desktop::home ( ) |
748 | { | 750 | { |
749 | if ( isVisibleWindow( launcher->winId() ) ) | 751 | if ( isVisibleWindow( launcher->winId() ) ) |
750 | launcher->nextView(); | 752 | launcher->nextView(); |
751 | else | 753 | else |
752 | launcher->raise(); | 754 | launcher->raise(); |
753 | } | 755 | } |
754 | 756 | ||
755 | void Desktop::executeOrModify( const QString& appLnkFile ) | 757 | void Desktop::executeOrModify( const QString& appLnkFile ) |
756 | { | 758 | { |
757 | AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); | 759 | AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); |
758 | if ( lnk.isValid() ) { | 760 | if ( lnk.isValid() ) { |
759 | QCString app = lnk.exec().utf8(); | 761 | QCString app = lnk.exec().utf8(); |
760 | Global::terminateBuiltin( "calibrate" ); | 762 | Global::terminateBuiltin( "calibrate" ); |
761 | if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { | 763 | if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { |
762 | // MRUList::addTask( &lnk ); | 764 | // MRUList::addTask( &lnk ); |
763 | if ( hasVisibleWindow( app ) ) | 765 | if ( hasVisibleWindow( app ) ) |
764 | QCopChannel::send( "QPE/Application/" + app, "nextView()" ); | 766 | QCopChannel::send( "QPE/Application/" + app, "nextView()" ); |
765 | else | 767 | else |
766 | QCopChannel::send( "QPE/Application/" + app, "raise()" ); | 768 | QCopChannel::send( "QPE/Application/" + app, "raise()" ); |
767 | } | 769 | } |
768 | else { | 770 | else { |
769 | lnk.execute(); | 771 | lnk.execute(); |
770 | } | 772 | } |
771 | } | 773 | } |
772 | } | 774 | } |
773 | 775 | ||
774 | void Desktop::raiseDatebook() | 776 | void Desktop::raiseDatebook() |
775 | { | 777 | { |
776 | Config cfg( "qpe" ); //F9 'Activity' | 778 | Config cfg( "qpe" ); //F9 'Activity' |
777 | cfg.setGroup( "AppsKey" ); | 779 | cfg.setGroup( "AppsKey" ); |
778 | QString tempItem; | 780 | QString tempItem; |
779 | tempItem = cfg.readEntry( "LeftEnd" , "Calendar" ); | 781 | tempItem = cfg.readEntry( "LeftEnd" , "Calendar" ); |
780 | if ( tempItem == "Calendar" || tempItem.isEmpty() ) { | 782 | if ( tempItem == "Calendar" || tempItem.isEmpty() ) { |
781 | tempItem = "datebook"; | 783 | tempItem = "datebook"; |
782 | } | 784 | } |
783 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 785 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
784 | e << tempItem; | 786 | e << tempItem; |
785 | } | 787 | } |
786 | 788 | ||
787 | void Desktop::raiseContacts() | 789 | void Desktop::raiseContacts() |
788 | { | 790 | { |
789 | Config cfg( "qpe" ); //F10, 'Contacts' | 791 | Config cfg( "qpe" ); //F10, 'Contacts' |
790 | cfg.setGroup( "AppsKey" ); | 792 | cfg.setGroup( "AppsKey" ); |
791 | QString tempItem; | 793 | QString tempItem; |
792 | tempItem = cfg.readEntry( "Left2nd", "Address Book" ); | 794 | tempItem = cfg.readEntry( "Left2nd", "Address Book" ); |
793 | if ( tempItem == "Address Book" || tempItem.isEmpty() ) { | 795 | if ( tempItem == "Address Book" || tempItem.isEmpty() ) { |
794 | tempItem = "addressbook"; | 796 | tempItem = "addressbook"; |
795 | } | 797 | } |
796 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 798 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
797 | e << tempItem; | 799 | e << tempItem; |
798 | } | 800 | } |
799 | 801 | ||
800 | void Desktop::raiseMenu() | 802 | void Desktop::raiseMenu() |
801 | { | 803 | { |
802 | Config cfg( "qpe" ); //F11, 'Menu | 804 | Config cfg( "qpe" ); //F11, 'Menu |
803 | cfg.setGroup( "AppsKey" ); | 805 | cfg.setGroup( "AppsKey" ); |
804 | QString tempItem; | 806 | QString tempItem; |
805 | tempItem = cfg.readEntry( "Right2nd" , "Popup Menu" ); | 807 | tempItem = cfg.readEntry( "Right2nd" , "Popup Menu" ); |
806 | if ( tempItem == "Popup Menu" || tempItem.isEmpty() ) { | 808 | if ( tempItem == "Popup Menu" || tempItem.isEmpty() ) { |
807 | Global::terminateBuiltin( "calibrate" ); | 809 | Global::terminateBuiltin( "calibrate" ); |
808 | tb->startMenu() ->launch(); | 810 | tb->startMenu() ->launch(); |
809 | } | 811 | } |
810 | else { | 812 | else { |
811 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 813 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
812 | e << tempItem; | 814 | e << tempItem; |
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 66cc3e6..a5955a4 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -1,91 +1,89 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | 21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT |
22 | // have this class. | 22 | // have this class. |
23 | #define QTOPIA_INTERNAL_FSLP | 23 | #define QTOPIA_INTERNAL_FSLP |
24 | 24 | ||
25 | #ifdef QWS | ||
26 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
27 | #endif | ||
28 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
29 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
30 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
31 | #include <qpe/global.h> | 29 | #include <qpe/global.h> |
32 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/mimetype.h> | 31 | #include <qpe/mimetype.h> |
34 | #include <qpe/storage.h> | 32 | #include <qpe/storage.h> |
35 | #include <qpe/palmtoprecord.h> | 33 | #include <qpe/palmtoprecord.h> |
36 | 34 | ||
37 | #include <qpe/version.h> | 35 | #include <qpe/version.h> |
38 | 36 | ||
39 | #include <qdir.h> | 37 | #include <qdir.h> |
40 | #ifdef QWS | 38 | #ifdef QWS |
41 | #include <qwindowsystem_qws.h> | 39 | #include <qwindowsystem_qws.h> |
42 | #endif | 40 | #endif |
43 | #include <qtimer.h> | 41 | #include <qtimer.h> |
44 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
45 | #include <qvbox.h> | 43 | #include <qvbox.h> |
46 | #include <qlayout.h> | 44 | #include <qlayout.h> |
47 | #include <qstyle.h> | 45 | #include <qstyle.h> |
48 | #include <qpushbutton.h> | 46 | #include <qpushbutton.h> |
49 | #include <qtabbar.h> | 47 | #include <qtabbar.h> |
50 | #include <qwidgetstack.h> | 48 | #include <qwidgetstack.h> |
51 | #include <qlayout.h> | 49 | #include <qlayout.h> |
52 | #include <qregexp.h> | 50 | #include <qregexp.h> |
53 | #include <qmessagebox.h> | 51 | #include <qmessagebox.h> |
54 | #include <qframe.h> | 52 | #include <qframe.h> |
55 | #include <qpainter.h> | 53 | #include <qpainter.h> |
56 | #include <qlabel.h> | 54 | #include <qlabel.h> |
57 | #include <qtextstream.h> | 55 | #include <qtextstream.h> |
58 | #include <qpopupmenu.h> | 56 | #include <qpopupmenu.h> |
59 | 57 | ||
60 | #include "launcherview.h" | 58 | #include "launcherview.h" |
61 | #include "launcher.h" | 59 | #include "launcher.h" |
62 | #include "syncdialog.h" | 60 | #include "syncdialog.h" |
63 | #include "desktop.h" | 61 | #include "desktop.h" |
64 | #include <qpe/lnkproperties.h> | 62 | #include <qpe/lnkproperties.h> |
65 | //#include "mrulist.h" | 63 | //#include "mrulist.h" |
66 | #include "qrsync.h" | 64 | #include "qrsync.h" |
67 | #include <stdlib.h> | 65 | #include <stdlib.h> |
68 | #include <unistd.h> | 66 | #include <unistd.h> |
69 | 67 | ||
70 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 68 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
71 | #include <stdio.h> | 69 | #include <stdio.h> |
72 | #include <sys/vfs.h> | 70 | #include <sys/vfs.h> |
73 | #include <mntent.h> | 71 | #include <mntent.h> |
74 | #endif | 72 | #endif |
75 | 73 | ||
76 | #include <qpe/storage.h> | 74 | #include <qpe/storage.h> |
77 | #include "mediummountgui.h" | 75 | #include "mediummountgui.h" |
78 | 76 | ||
79 | namespace { | 77 | namespace { |
80 | QStringList configToMime( Config *cfg ){ | 78 | QStringList configToMime( Config *cfg ){ |
81 | QStringList mimes; | 79 | QStringList mimes; |
82 | bool tmpMime = true; | 80 | bool tmpMime = true; |
83 | cfg->setGroup("mimetypes" ); | 81 | cfg->setGroup("mimetypes" ); |
84 | tmpMime = cfg->readBoolEntry("all" ,true); | 82 | tmpMime = cfg->readBoolEntry("all" ,true); |
85 | if( tmpMime ){ | 83 | if( tmpMime ){ |
86 | mimes << QString::null; | 84 | mimes << QString::null; |
87 | return mimes; | 85 | return mimes; |
88 | }else{ | 86 | }else{ |
89 | tmpMime = cfg->readBoolEntry("audio", true ); | 87 | tmpMime = cfg->readBoolEntry("audio", true ); |
90 | if(tmpMime ) | 88 | if(tmpMime ) |
91 | mimes.append("audio/*" ); | 89 | mimes.append("audio/*" ); |
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 073e19a..762a596 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -1,172 +1,173 @@ | |||
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_CUSTOM ) || defined( QT_QWS_IPAQ ) | 28 | #if defined( QT_QWS_CUSTOM ) || 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 | 33 | ||
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qimage.h> | ||
35 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
36 | #include <qpe/qcopenvelope_qws.h> | 37 | #include <qpe/qcopenvelope_qws.h> |
37 | #include <qpe/alarmserver.h> | 38 | #include <qpe/alarmserver.h> |
38 | 39 | ||
39 | #include <stdlib.h> | 40 | #include <stdlib.h> |
40 | #include <stdio.h> | 41 | #include <stdio.h> |
41 | #include <signal.h> | 42 | #include <signal.h> |
42 | #include <unistd.h> | 43 | #include <unistd.h> |
43 | 44 | ||
44 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 45 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
45 | #include "../calibrate/calibrate.h" | 46 | #include "../calibrate/calibrate.h" |
46 | #endif | 47 | #endif |
47 | 48 | ||
48 | using namespace Opie; | 49 | using namespace Opie; |
49 | 50 | ||
50 | void initEnvironment() | 51 | void initEnvironment() |
51 | { | 52 | { |
52 | Config config("locale"); | 53 | Config config("locale"); |
53 | config.setGroup( "Location" ); | 54 | config.setGroup( "Location" ); |
54 | QString tz = config.readEntry( "Timezone", getenv("TZ") ); | 55 | QString tz = config.readEntry( "Timezone", getenv("TZ") ); |
55 | 56 | ||
56 | // if not timezone set, pick New York | 57 | // if not timezone set, pick New York |
57 | if (tz.isNull()) | 58 | if (tz.isNull()) |
58 | tz = "America/New_York"; | 59 | tz = "America/New_York"; |
59 | 60 | ||
60 | setenv( "TZ", tz, 1 ); | 61 | setenv( "TZ", tz, 1 ); |
61 | config.writeEntry( "Timezone", tz); | 62 | config.writeEntry( "Timezone", tz); |
62 | 63 | ||
63 | config.setGroup( "Language" ); | 64 | config.setGroup( "Language" ); |
64 | QString lang = config.readEntry( "Language", getenv("LANG") ); | 65 | QString lang = config.readEntry( "Language", getenv("LANG") ); |
65 | if ( !lang.isNull() ) | 66 | if ( !lang.isNull() ) |
66 | setenv( "LANG", lang, 1 ); | 67 | setenv( "LANG", lang, 1 ); |
67 | } | 68 | } |
68 | 69 | ||
69 | 70 | ||
70 | int initApplication( int argc, char ** argv ) | 71 | int initApplication( int argc, char ** argv ) |
71 | { | 72 | { |
72 | initEnvironment(); | 73 | initEnvironment(); |
73 | 74 | ||
74 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) | 75 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) |
75 | setenv( "QWS_SIZE", "240x320", 0 ); | 76 | setenv( "QWS_SIZE", "240x320", 0 ); |
76 | #endif | 77 | #endif |
77 | 78 | ||
78 | //Don't flicker at startup: | 79 | //Don't flicker at startup: |
79 | QWSServer::setDesktopBackground( QImage() ); | 80 | QWSServer::setDesktopBackground( QImage() ); |
80 | DesktopApplication a( argc, argv, QApplication::GuiServer ); | 81 | DesktopApplication a( argc, argv, QApplication::GuiServer ); |
81 | 82 | ||
82 | ODevice::inst ( )-> setSoftSuspend ( true ); | 83 | ODevice::inst ( )-> setSoftSuspend ( true ); |
83 | 84 | ||
84 | { // init backlight | 85 | { // init backlight |
85 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 86 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
86 | e << -3; // Forced on | 87 | e << -3; // Forced on |
87 | } | 88 | } |
88 | 89 | ||
89 | AlarmServer::initialize(); | 90 | AlarmServer::initialize(); |
90 | 91 | ||
91 | Desktop *d = new Desktop(); | 92 | Desktop *d = new Desktop(); |
92 | 93 | ||
93 | QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) ); | 94 | QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) ); |
94 | QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); | 95 | QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); |
95 | QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); | 96 | QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); |
96 | QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); | 97 | QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); |
97 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); | 98 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); |
98 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); | 99 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); |
99 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); | 100 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); |
100 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); | 101 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); |
101 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); | 102 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); |
102 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); | 103 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); |
103 | 104 | ||
104 | (void)new SysFileMonitor(d); | 105 | (void)new SysFileMonitor(d); |
105 | Network::createServer(d); | 106 | Network::createServer(d); |
106 | 107 | ||
107 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 108 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
108 | if ( !QFile::exists( "/etc/pointercal" ) ) { | 109 | if ( !QFile::exists( "/etc/pointercal" ) ) { |
109 | // Make sure calibration widget starts on top. | 110 | // Make sure calibration widget starts on top. |
110 | Calibrate *cal = new Calibrate; | 111 | Calibrate *cal = new Calibrate; |
111 | cal->exec(); | 112 | cal->exec(); |
112 | delete cal; | 113 | delete cal; |
113 | } | 114 | } |
114 | #endif | 115 | #endif |
115 | 116 | ||
116 | d->show(); | 117 | d->show(); |
117 | 118 | ||
118 | int rv = a.exec(); | 119 | int rv = a.exec(); |
119 | 120 | ||
120 | delete d; | 121 | delete d; |
121 | 122 | ||
122 | ODevice::inst ( )-> setSoftSuspend ( false ); | 123 | ODevice::inst ( )-> setSoftSuspend ( false ); |
123 | 124 | ||
124 | return rv; | 125 | return rv; |
125 | } | 126 | } |
126 | 127 | ||
127 | static const char *pidfile_path = "/var/run/opie.pid"; | 128 | static const char *pidfile_path = "/var/run/opie.pid"; |
128 | 129 | ||
129 | void create_pidfile ( ) | 130 | void create_pidfile ( ) |
130 | { | 131 | { |
131 | FILE *f; | 132 | FILE *f; |
132 | 133 | ||
133 | if (( f = ::fopen ( pidfile_path, "w" ))) { | 134 | if (( f = ::fopen ( pidfile_path, "w" ))) { |
134 | ::fprintf ( f, "%d", getpid ( )); | 135 | ::fprintf ( f, "%d", getpid ( )); |
135 | ::fclose ( f ); | 136 | ::fclose ( f ); |
136 | } | 137 | } |
137 | } | 138 | } |
138 | 139 | ||
139 | void remove_pidfile ( ) | 140 | void remove_pidfile ( ) |
140 | { | 141 | { |
141 | ::unlink ( pidfile_path ); | 142 | ::unlink ( pidfile_path ); |
142 | } | 143 | } |
143 | 144 | ||
144 | void handle_sigterm ( int /* sig */ ) | 145 | void handle_sigterm ( int /* sig */ ) |
145 | { | 146 | { |
146 | if ( qApp ) | 147 | if ( qApp ) |
147 | qApp-> quit ( ); | 148 | qApp-> quit ( ); |
148 | } | 149 | } |
149 | 150 | ||
150 | int main( int argc, char ** argv ) | 151 | int main( int argc, char ** argv ) |
151 | { | 152 | { |
152 | ::signal ( SIGCHLD, SIG_IGN ); | 153 | ::signal ( SIGCHLD, SIG_IGN ); |
153 | 154 | ||
154 | ::signal ( SIGTERM, handle_sigterm ); | 155 | ::signal ( SIGTERM, handle_sigterm ); |
155 | ::signal ( SIGINT, handle_sigterm ); | 156 | ::signal ( SIGINT, handle_sigterm ); |
156 | 157 | ||
157 | ::setsid ( ); | 158 | ::setsid ( ); |
158 | ::setpgid ( 0, 0 ); | 159 | ::setpgid ( 0, 0 ); |
159 | 160 | ||
160 | ::atexit ( remove_pidfile ); | 161 | ::atexit ( remove_pidfile ); |
161 | create_pidfile ( ); | 162 | create_pidfile ( ); |
162 | 163 | ||
163 | int retVal = initApplication ( argc, argv ); | 164 | int retVal = initApplication ( argc, argv ); |
164 | 165 | ||
165 | // Kill them. Kill them all. | 166 | // Kill them. Kill them all. |
166 | ::kill ( 0, SIGTERM ); | 167 | ::kill ( 0, SIGTERM ); |
167 | ::sleep ( 1 ); | 168 | ::sleep ( 1 ); |
168 | ::kill ( 0, SIGKILL ); | 169 | ::kill ( 0, SIGKILL ); |
169 | 170 | ||
170 | return retVal; | 171 | return retVal; |
171 | } | 172 | } |
172 | 173 | ||
diff --git a/core/launcher/qcopbridge.cpp b/core/launcher/qcopbridge.cpp index 85993ee..6177a7c 100644 --- a/core/launcher/qcopbridge.cpp +++ b/core/launcher/qcopbridge.cpp | |||
@@ -1,90 +1,88 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "qcopbridge.h" | 21 | #include "qcopbridge.h" |
22 | #include "transferserver.h" | 22 | #include "transferserver.h" |
23 | 23 | ||
24 | #ifdef QWS | ||
25 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
26 | #endif | ||
27 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/version.h> | 26 | #include <qpe/version.h> |
29 | 27 | ||
30 | #include <qdir.h> | 28 | #include <qdir.h> |
31 | #include <qfile.h> | 29 | #include <qfile.h> |
32 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
33 | #include <qdatastream.h> | 31 | #include <qdatastream.h> |
34 | #include <qstringlist.h> | 32 | #include <qstringlist.h> |
35 | #include <qfileinfo.h> | 33 | #include <qfileinfo.h> |
36 | #include <qregexp.h> | 34 | #include <qregexp.h> |
37 | #ifdef QWS | 35 | #ifdef QWS |
38 | #include <qcopchannel_qws.h> | 36 | #include <qcopchannel_qws.h> |
39 | #endif | 37 | #endif |
40 | 38 | ||
41 | #define _XOPEN_SOURCE | 39 | #define _XOPEN_SOURCE |
42 | #include <pwd.h> | 40 | #include <pwd.h> |
43 | #include <sys/types.h> | 41 | #include <sys/types.h> |
44 | #include <unistd.h> | 42 | #include <unistd.h> |
45 | 43 | ||
46 | #if defined(_OS_LINUX_) | 44 | #if defined(_OS_LINUX_) |
47 | #include <shadow.h> | 45 | #include <shadow.h> |
48 | #endif | 46 | #endif |
49 | 47 | ||
50 | //#define INSECURE | 48 | //#define INSECURE |
51 | 49 | ||
52 | const int block_size = 51200; | 50 | const int block_size = 51200; |
53 | 51 | ||
54 | QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent , | 52 | QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent , |
55 | const char* name ) | 53 | const char* name ) |
56 | : QServerSocket( port, 1, parent, name ), | 54 | : QServerSocket( port, 1, parent, name ), |
57 | desktopChannel( 0 ), | 55 | desktopChannel( 0 ), |
58 | cardChannel( 0 ) | 56 | cardChannel( 0 ) |
59 | { | 57 | { |
60 | if ( !ok() ) | 58 | if ( !ok() ) |
61 | qWarning( "Failed to bind to port %d", port ); | 59 | qWarning( "Failed to bind to port %d", port ); |
62 | else { | 60 | else { |
63 | #ifndef QT_NO_COP | 61 | #ifndef QT_NO_COP |
64 | desktopChannel = new QCopChannel( "QPE/Desktop", this ); | 62 | desktopChannel = new QCopChannel( "QPE/Desktop", this ); |
65 | connect( desktopChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 63 | connect( desktopChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
66 | this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); | 64 | this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); |
67 | cardChannel = new QCopChannel( "QPE/Card", this ); | 65 | cardChannel = new QCopChannel( "QPE/Card", this ); |
68 | connect( cardChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 66 | connect( cardChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
69 | this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); | 67 | this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); |
70 | #endif | 68 | #endif |
71 | } | 69 | } |
72 | sendSync = FALSE; | 70 | sendSync = FALSE; |
73 | } | 71 | } |
74 | 72 | ||
75 | QCopBridge::~QCopBridge() | 73 | QCopBridge::~QCopBridge() |
76 | { | 74 | { |
77 | #ifndef QT_NO_COP | 75 | #ifndef QT_NO_COP |
78 | delete desktopChannel; | 76 | delete desktopChannel; |
79 | #endif | 77 | #endif |
80 | } | 78 | } |
81 | 79 | ||
82 | void QCopBridge::newConnection( int socket ) | 80 | void QCopBridge::newConnection( int socket ) |
83 | { | 81 | { |
84 | QCopBridgePI *pi = new QCopBridgePI( socket, this ); | 82 | QCopBridgePI *pi = new QCopBridgePI( socket, this ); |
85 | openConnections.append( pi ); | 83 | openConnections.append( pi ); |
86 | connect ( pi, SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( connectionClosed( QCopBridgePI *) ) ); | 84 | connect ( pi, SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( connectionClosed( QCopBridgePI *) ) ); |
87 | #ifndef QT_NO_COP | 85 | #ifndef QT_NO_COP |
88 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; | 86 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; |
89 | #endif | 87 | #endif |
90 | 88 | ||
diff --git a/core/launcher/runningappbar.cpp b/core/launcher/runningappbar.cpp index b830d1b..c8f45d5 100644 --- a/core/launcher/runningappbar.cpp +++ b/core/launcher/runningappbar.cpp | |||
@@ -1,112 +1,114 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | ********************************************************************** | 19 | ********************************************************************** |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define QTOPIA_INTERNAL_PRELOADACCESS | 22 | #define QTOPIA_INTERNAL_PRELOADACCESS |
23 | 23 | ||
24 | // For "kill" | 24 | // For "kill" |
25 | #include <sys/types.h> | 25 | #include <sys/types.h> |
26 | #include <signal.h> | 26 | #include <signal.h> |
27 | 27 | ||
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <qpopupmenu.h> | 29 | #include <qpopupmenu.h> |
30 | #include <qmessagebox.h> | 30 | #include <qmessagebox.h> |
31 | #include <qpainter.h> | 31 | #include <qpainter.h> |
32 | #include "qprocess.h" | 32 | #include "qprocess.h" |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #include <qpe/applnk.h> | 34 | #include <qpe/applnk.h> |
35 | #include <qpe/qcopenvelope_qws.h> | 35 | #include <qpe/qcopenvelope_qws.h> |
36 | #include <qpe/global.h> | 36 | #include <qpe/global.h> |
37 | #include <qwindowsystem_qws.h> | 37 | #include <qwindowsystem_qws.h> |
38 | #include "runningappbar.h" | 38 | #include "runningappbar.h" |
39 | 39 | ||
40 | RunningAppBar::RunningAppBar(QWidget* parent) | 40 | RunningAppBar::RunningAppBar(QWidget* parent) |
41 | : QFrame(parent), m_AppLnkSet(0L), m_SelectedAppIndex(-1) | 41 | : QFrame(parent), m_AppLnkSet(0L), m_SelectedAppIndex(-1) |
42 | { | 42 | { |
43 | setBackgroundMode( PaletteBackground ); | 43 | setBackgroundMode( PaletteBackground ); |
44 | 44 | ||
45 | m_AppLnkSet = new AppLnkSet( QPEApplication::qpeDir() + "apps" ); | 45 | m_AppLnkSet = new AppLnkSet( QPEApplication::qpeDir() + "apps" ); |
46 | 46 | ||
47 | #ifdef QWS | ||
47 | connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&))); | 48 | connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&))); |
48 | connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&))); | 49 | connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&))); |
50 | #endif | ||
49 | QCopChannel* channel = new QCopChannel( "QPE/System", this ); | 51 | QCopChannel* channel = new QCopChannel( "QPE/System", this ); |
50 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 52 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
51 | this, SLOT(received(const QCString&, const QByteArray&)) ); | 53 | this, SLOT(received(const QCString&, const QByteArray&)) ); |
52 | 54 | ||
53 | spacing = AppLnk::smallIconSize()+3; | 55 | spacing = AppLnk::smallIconSize()+3; |
54 | } | 56 | } |
55 | 57 | ||
56 | RunningAppBar::~RunningAppBar() { | 58 | RunningAppBar::~RunningAppBar() { |
57 | } | 59 | } |
58 | 60 | ||
59 | void RunningAppBar::newQcopChannel(const QString& channelName) { | 61 | void RunningAppBar::newQcopChannel(const QString& channelName) { |
60 | QString prefix("QPE/Application/"); | 62 | QString prefix("QPE/Application/"); |
61 | if (channelName.startsWith(prefix)) { | 63 | if (channelName.startsWith(prefix)) { |
62 | QString appName = channelName.mid(prefix.length()); | 64 | QString appName = channelName.mid(prefix.length()); |
63 | // qDebug("App %s just connected!", appName.latin1()); | 65 | // qDebug("App %s just connected!", appName.latin1()); |
64 | const AppLnk* newGuy = m_AppLnkSet->findExec(appName); | 66 | const AppLnk* newGuy = m_AppLnkSet->findExec(appName); |
65 | if (newGuy && !newGuy->isPreloaded()) { | 67 | if (newGuy && !newGuy->isPreloaded()) { |
66 | addTask(*newGuy); | 68 | addTask(*newGuy); |
67 | } | 69 | } |
68 | } | 70 | } |
69 | } | 71 | } |
70 | 72 | ||
71 | void RunningAppBar::removedQcopChannel(const QString& channelName) { | 73 | void RunningAppBar::removedQcopChannel(const QString& channelName) { |
72 | QString prefix("QPE/Application/"); | 74 | QString prefix("QPE/Application/"); |
73 | if (channelName.startsWith(prefix)) { | 75 | if (channelName.startsWith(prefix)) { |
74 | QString appName = channelName.mid(prefix.length()); | 76 | QString appName = channelName.mid(prefix.length()); |
75 | qDebug("App %s just disconnected!", appName.latin1()); | 77 | qDebug("App %s just disconnected!", appName.latin1()); |
76 | const AppLnk* newGuy = m_AppLnkSet->findExec(appName); | 78 | const AppLnk* newGuy = m_AppLnkSet->findExec(appName); |
77 | if (newGuy) { | 79 | if (newGuy) { |
78 | removeTask(*newGuy); | 80 | removeTask(*newGuy); |
79 | } | 81 | } |
80 | } | 82 | } |
81 | } | 83 | } |
82 | 84 | ||
83 | void RunningAppBar::received(const QCString& msg, const QByteArray& data) { | 85 | void RunningAppBar::received(const QCString& msg, const QByteArray& data) { |
84 | // Since fast apps appear and disappear without disconnecting from their | 86 | // Since fast apps appear and disappear without disconnecting from their |
85 | // channel we need to watch for the showing/hiding events and update according. | 87 | // channel we need to watch for the showing/hiding events and update according. |
86 | QDataStream stream( data, IO_ReadOnly ); | 88 | QDataStream stream( data, IO_ReadOnly ); |
87 | if ( msg == "fastAppShowing(QString)") { | 89 | if ( msg == "fastAppShowing(QString)") { |
88 | QString appName; | 90 | QString appName; |
89 | stream >> appName; | 91 | stream >> appName; |
90 | addTask(*m_AppLnkSet->findExec(appName)); | 92 | addTask(*m_AppLnkSet->findExec(appName)); |
91 | } else if ( msg == "fastAppHiding(QString)") { | 93 | } else if ( msg == "fastAppHiding(QString)") { |
92 | QString appName; | 94 | QString appName; |
93 | stream >> appName; | 95 | stream >> appName; |
94 | removeTask(*m_AppLnkSet->findExec(appName)); | 96 | removeTask(*m_AppLnkSet->findExec(appName)); |
95 | } | 97 | } |
96 | } | 98 | } |
97 | 99 | ||
98 | void RunningAppBar::addTask(const AppLnk& appLnk) { | 100 | void RunningAppBar::addTask(const AppLnk& appLnk) { |
99 | // qDebug("Added %s to app list.", appLnk.name().latin1()); | 101 | // qDebug("Added %s to app list.", appLnk.name().latin1()); |
100 | AppLnk* newApp = new AppLnk(appLnk); | 102 | AppLnk* newApp = new AppLnk(appLnk); |
101 | newApp->setExec(appLnk.exec()); | 103 | newApp->setExec(appLnk.exec()); |
102 | m_AppList.prepend(newApp); | 104 | m_AppList.prepend(newApp); |
103 | update(); | 105 | update(); |
104 | } | 106 | } |
105 | 107 | ||
106 | void RunningAppBar::removeTask(const AppLnk& appLnk) { | 108 | void RunningAppBar::removeTask(const AppLnk& appLnk) { |
107 | unsigned int i = 0; | 109 | unsigned int i = 0; |
108 | for (; i < m_AppList.count() ; i++) { | 110 | for (; i < m_AppList.count() ; i++) { |
109 | AppLnk* target = m_AppList.at(i); | 111 | AppLnk* target = m_AppList.at(i); |
110 | if (target->exec() == appLnk.exec()) { | 112 | if (target->exec() == appLnk.exec()) { |
111 | qDebug("Removing %s from app list.", appLnk.name().latin1()); | 113 | qDebug("Removing %s from app list.", appLnk.name().latin1()); |
112 | m_AppList.remove(); | 114 | m_AppList.remove(); |
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp index d2f5501..dea140d 100644 --- a/core/launcher/transferserver.cpp +++ b/core/launcher/transferserver.cpp | |||
@@ -1,125 +1,123 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #define _XOPEN_SOURCE | 20 | #define _XOPEN_SOURCE |
21 | #include <pwd.h> | 21 | #include <pwd.h> |
22 | #include <sys/types.h> | 22 | #include <sys/types.h> |
23 | #include <unistd.h> | 23 | #include <unistd.h> |
24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
25 | #include <time.h> | 25 | #include <time.h> |
26 | #include <shadow.h> | 26 | #include <shadow.h> |
27 | 27 | ||
28 | /* we need the _OS_LINUX stuff first ! */ | 28 | /* we need the _OS_LINUX stuff first ! */ |
29 | #include <qglobal.h> | 29 | #include <qglobal.h> |
30 | 30 | ||
31 | #ifndef _OS_LINUX_ | 31 | #ifndef _OS_LINUX_ |
32 | 32 | ||
33 | extern "C" { | 33 | extern "C" { |
34 | #include <uuid/uuid.h> | 34 | #include <uuid/uuid.h> |
35 | #define UUID_H_INCLUDED | 35 | #define UUID_H_INCLUDED |
36 | } | 36 | } |
37 | 37 | ||
38 | #endif // not defined linux | 38 | #endif // not defined linux |
39 | 39 | ||
40 | #if defined(_OS_LINUX_) | 40 | #if defined(_OS_LINUX_) |
41 | #include <shadow.h> | 41 | #include <shadow.h> |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #include <qdir.h> | 44 | #include <qdir.h> |
45 | #include <qfile.h> | 45 | #include <qfile.h> |
46 | #include <qtextstream.h> | 46 | #include <qtextstream.h> |
47 | #include <qdatastream.h> | 47 | #include <qdatastream.h> |
48 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
49 | #include <qstringlist.h> | 49 | #include <qstringlist.h> |
50 | #include <qfileinfo.h> | 50 | #include <qfileinfo.h> |
51 | #include <qregexp.h> | 51 | #include <qregexp.h> |
52 | //#include <qpe/qcopchannel_qws.h> | 52 | //#include <qpe/qcopchannel_qws.h> |
53 | #include <qpe/process.h> | 53 | #include <qpe/process.h> |
54 | #include <qpe/global.h> | 54 | #include <qpe/global.h> |
55 | #include <qpe/config.h> | 55 | #include <qpe/config.h> |
56 | #include <qpe/contact.h> | 56 | #include <qpe/contact.h> |
57 | #include <qpe/quuid.h> | 57 | #include <qpe/quuid.h> |
58 | #include <qpe/version.h> | 58 | #include <qpe/version.h> |
59 | #ifdef QWS | ||
60 | #include <qpe/qcopenvelope_qws.h> | 59 | #include <qpe/qcopenvelope_qws.h> |
61 | #endif | ||
62 | 60 | ||
63 | #include "transferserver.h" | 61 | #include "transferserver.h" |
64 | #include "qprocess.h" | 62 | #include "qprocess.h" |
65 | 63 | ||
66 | const int block_size = 51200; | 64 | const int block_size = 51200; |
67 | 65 | ||
68 | TransferServer::TransferServer( Q_UINT16 port, QObject *parent , | 66 | TransferServer::TransferServer( Q_UINT16 port, QObject *parent , |
69 | const char* name ) | 67 | const char* name ) |
70 | : QServerSocket( port, 1, parent, name ) | 68 | : QServerSocket( port, 1, parent, name ) |
71 | { | 69 | { |
72 | if ( !ok() ) | 70 | if ( !ok() ) |
73 | qWarning( "Failed to bind to port %d", port ); | 71 | qWarning( "Failed to bind to port %d", port ); |
74 | } | 72 | } |
75 | 73 | ||
76 | TransferServer::~TransferServer() | 74 | TransferServer::~TransferServer() |
77 | { | 75 | { |
78 | 76 | ||
79 | } | 77 | } |
80 | 78 | ||
81 | void TransferServer::newConnection( int socket ) | 79 | void TransferServer::newConnection( int socket ) |
82 | { | 80 | { |
83 | (void) new ServerPI( socket, this ); | 81 | (void) new ServerPI( socket, this ); |
84 | } | 82 | } |
85 | 83 | ||
86 | /* | 84 | /* |
87 | * small class in anonymous namespace | 85 | * small class in anonymous namespace |
88 | * to generate a QUUid for us | 86 | * to generate a QUUid for us |
89 | */ | 87 | */ |
90 | namespace { | 88 | namespace { |
91 | struct UidGen { | 89 | struct UidGen { |
92 | QString uuid(); | 90 | QString uuid(); |
93 | }; | 91 | }; |
94 | #if !defined(_OS_LINUX_) | 92 | #if !defined(_OS_LINUX_) |
95 | QString UidGen::uuid() { | 93 | QString UidGen::uuid() { |
96 | uuid_t uuid; | 94 | uuid_t uuid; |
97 | uuid_generate( uuid ); | 95 | uuid_generate( uuid ); |
98 | return QUUid( uuid ).toString(); | 96 | return QUUid( uuid ).toString(); |
99 | } | 97 | } |
100 | #else | 98 | #else |
101 | /* | 99 | /* |
102 | * linux got a /proc/sys/kernel/random/uuid file | 100 | * linux got a /proc/sys/kernel/random/uuid file |
103 | * it'll generate the uuids for us | 101 | * it'll generate the uuids for us |
104 | */ | 102 | */ |
105 | QString UidGen::uuid() { | 103 | QString UidGen::uuid() { |
106 | QFile file( "/proc/sys/kernel/random/uuid" ); | 104 | QFile file( "/proc/sys/kernel/random/uuid" ); |
107 | if (!file.open(IO_ReadOnly ) ) | 105 | if (!file.open(IO_ReadOnly ) ) |
108 | return QString::null; | 106 | return QString::null; |
109 | 107 | ||
110 | QTextStream stream(&file); | 108 | QTextStream stream(&file); |
111 | 109 | ||
112 | return "{" + stream.read().stripWhiteSpace() + "}"; | 110 | return "{" + stream.read().stripWhiteSpace() + "}"; |
113 | } | 111 | } |
114 | #endif | 112 | #endif |
115 | } | 113 | } |
116 | 114 | ||
117 | QString SyncAuthentication::serverId() | 115 | QString SyncAuthentication::serverId() |
118 | { | 116 | { |
119 | Config cfg("Security"); | 117 | Config cfg("Security"); |
120 | cfg.setGroup("Sync"); | 118 | cfg.setGroup("Sync"); |
121 | QString r=cfg.readEntry("serverid"); | 119 | QString r=cfg.readEntry("serverid"); |
122 | if ( r.isEmpty() ) { | 120 | if ( r.isEmpty() ) { |
123 | UidGen gen; | 121 | UidGen gen; |
124 | r = gen.uuid(); | 122 | r = gen.uuid(); |
125 | cfg.writeEntry("serverid", r ); | 123 | cfg.writeEntry("serverid", r ); |