summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-17 16:45:38 (UTC)
committer zecke <zecke>2002-10-17 16:45:38 (UTC)
commit0655456f68849bfad9019a7760dec961792d7519 (patch) (unidiff)
tree4651cad54a144385442a26e78f4a83b57501830f
parent8511273d7122d50ffea27f78ba13ab72af60326d (diff)
downloadopie-0655456f68849bfad9019a7760dec961792d7519.zip
opie-0655456f68849bfad9019a7760dec961792d7519.tar.gz
opie-0655456f68849bfad9019a7760dec961792d7519.tar.bz2
Move around some #ifdefs to be able to be built with Qt2/X11
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp10
-rw-r--r--core/launcher/launcher.cpp2
-rw-r--r--core/launcher/main.cpp7
-rw-r--r--core/launcher/qcopbridge.cpp2
-rw-r--r--core/launcher/runningappbar.cpp2
-rw-r--r--core/launcher/transferserver.cpp2
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
@@ -131,49 +131,48 @@ private:
131 int currentPriority; 131 int currentPriority;
132 int alertCount; 132 int alertCount;
133}; 133};
134 134
135void DesktopPowerAlerter::alert( const QString &text, int priority ) 135void 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
148void DesktopPowerAlerter::hideEvent( QHideEvent *e ) 148void 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
156class QPEScreenSaver : public QWSScreenSaver 155class QPEScreenSaver : public QWSScreenSaver
157{ 156{
158private: 157private:
159 int LcdOn; 158 int LcdOn;
160 159
161public: 160public:
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
@@ -304,49 +303,48 @@ public:
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
316private: 315private:
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
329void DesktopApplication::switchLCD ( bool on ) 327void 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
347DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) 345DesktopApplication::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() ) );
@@ -621,49 +619,49 @@ Desktop::Desktop() :
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
649void Desktop::show() 647void Desktop::show()
650{ 648{
651 login( TRUE ); 649 login( TRUE );
652 QWidget::show(); 650 QWidget::show();
653} 651}
654 652
655Desktop::~Desktop() 653Desktop::~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
663bool Desktop::recoverMemory() 661bool Desktop::recoverMemory()
664{ 662{
665 return tb->recoverMemory(); 663 return tb->recoverMemory();
666} 664}
667 665
668void Desktop::checkMemory() 666void Desktop::checkMemory()
669{ 667{
@@ -688,85 +686,89 @@ void Desktop::checkMemory()
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
710static bool isVisibleWindow( int wid ) 708static 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
721static bool hasVisibleWindow( const QString& clientname ) 721static 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
732void Desktop::raiseLauncher() 734void 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
747void Desktop::home ( ) 749void 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
755void Desktop::executeOrModify( const QString& appLnkFile ) 757void 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}
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,51 +1,49 @@
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>
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
@@ -11,70 +11,71 @@
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
48using namespace Opie; 49using namespace Opie;
49 50
50void initEnvironment() 51void 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
70int initApplication( int argc, char ** argv ) 71int 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 );
@@ -108,65 +109,65 @@ int initApplication( int argc, char ** argv )
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
127static const char *pidfile_path = "/var/run/opie.pid"; 128static const char *pidfile_path = "/var/run/opie.pid";
128 129
129void create_pidfile ( ) 130void 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
139void remove_pidfile ( ) 140void remove_pidfile ( )
140{ 141{
141 ::unlink ( pidfile_path ); 142 ::unlink ( pidfile_path );
142} 143}
143 144
144void handle_sigterm ( int /* sig */ ) 145void handle_sigterm ( int /* sig */ )
145{ 146{
146 if ( qApp ) 147 if ( qApp )
147 qApp-> quit ( ); 148 qApp-> quit ( );
148} 149}
149 150
150int main( int argc, char ** argv ) 151int 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,50 +1,48 @@
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
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
@@ -23,50 +23,52 @@
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
40RunningAppBar::RunningAppBar(QWidget* parent) 40RunningAppBar::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
56RunningAppBar::~RunningAppBar() { 58RunningAppBar::~RunningAppBar() {
57} 59}
58 60
59void RunningAppBar::newQcopChannel(const QString& channelName) { 61void 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
71void RunningAppBar::removedQcopChannel(const QString& channelName) { 73void RunningAppBar::removedQcopChannel(const QString& channelName) {
72 QString prefix("QPE/Application/"); 74 QString prefix("QPE/Application/");
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
@@ -35,51 +35,49 @@ extern "C" {
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
66const int block_size = 51200; 64const int block_size = 51200;
67 65
68TransferServer::TransferServer( Q_UINT16 port, QObject *parent , 66TransferServer::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
76TransferServer::~TransferServer() 74TransferServer::~TransferServer()
77{ 75{
78 76
79} 77}
80 78
81void TransferServer::newConnection( int socket ) 79void TransferServer::newConnection( int socket )
82{ 80{
83 (void) new ServerPI( socket, this ); 81 (void) new ServerPI( socket, this );
84} 82}
85 83