summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/batteryapplet/battery.cpp1
-rw-r--r--core/applets/batteryapplet/batterystatus.cpp2
-rw-r--r--core/applets/cardmon/cardmon.cpp2
-rw-r--r--core/applets/homeapplet/home.cpp2
-rw-r--r--core/applets/irdaapplet/irda.cpp5
-rw-r--r--core/applets/logoutapplet/logout.cpp2
-rw-r--r--core/applets/multikeyapplet/multikey.cpp6
-rw-r--r--core/launcher/applauncher.cpp4
-rw-r--r--core/launcher/firstuse.cpp8
-rw-r--r--core/launcher/inputmethods.cpp6
-rw-r--r--core/launcher/irserver.cpp1
-rw-r--r--core/launcher/launcher.cpp2
-rw-r--r--core/launcher/launcherglobal.cpp4
-rw-r--r--core/launcher/launchertab.cpp3
-rw-r--r--core/launcher/launcherview.cpp14
-rw-r--r--core/launcher/main.cpp5
-rw-r--r--core/launcher/packageslave.cpp2
-rw-r--r--core/launcher/qcopbridge.cpp8
-rw-r--r--core/launcher/runningappbar.cpp7
-rw-r--r--core/launcher/screensaver.cpp1
-rw-r--r--core/launcher/server.cpp3
-rw-r--r--core/launcher/shutdownimpl.cpp1
-rw-r--r--core/launcher/stabmon.cpp1
-rw-r--r--core/launcher/startmenu.cpp4
-rw-r--r--core/launcher/syncdialog.cpp1
-rw-r--r--core/launcher/systray.cpp2
-rw-r--r--core/launcher/transferserver.cpp10
-rw-r--r--core/launcher/wait.cpp4
28 files changed, 1 insertions, 110 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp
index fed9b34..b2cef55 100644
--- a/core/applets/batteryapplet/battery.cpp
+++ b/core/applets/batteryapplet/battery.cpp
@@ -1,124 +1,123 @@
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#include "battery.h" 20#include "battery.h"
21#include "batterystatus.h" 21#include "batterystatus.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/otaskbarapplet.h> 24#include <opie2/otaskbarapplet.h>
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/power.h> 27#include <qpe/power.h>
28#include <qpe/qpeapplication.h>
29 28
30/* QT */ 29/* QT */
31#include <qpainter.h> 30#include <qpainter.h>
32#include <qtimer.h> 31#include <qtimer.h>
33 32
34 33
35BatteryMeter::BatteryMeter( QWidget *parent ) 34BatteryMeter::BatteryMeter( QWidget *parent )
36 : QWidget( parent ), charging(false) 35 : QWidget( parent ), charging(false)
37{ 36{
38 ps = new PowerStatus; 37 ps = new PowerStatus;
39 startTimer( 10000 ); 38 startTimer( 10000 );
40 39
41 setFixedWidth( QMAX(AppLnk::smallIconSize()*3/4, 6) ); 40 setFixedWidth( QMAX(AppLnk::smallIconSize()*3/4, 6) );
42 setFixedHeight( AppLnk::smallIconSize() ); 41 setFixedHeight( AppLnk::smallIconSize() );
43 42
44 chargeTimer = new QTimer( this ); 43 chargeTimer = new QTimer( this );
45 connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) ); 44 connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) );
46 timerEvent(0); 45 timerEvent(0);
47 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 46 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
48 Config c( "qpe" ); 47 Config c( "qpe" );
49 c.setGroup( "Battery" ); 48 c.setGroup( "Battery" );
50 style = c.readNumEntry( "Style", 0 ); 49 style = c.readNumEntry( "Style", 0 );
51} 50}
52 51
53BatteryMeter::~BatteryMeter() 52BatteryMeter::~BatteryMeter()
54{ 53{
55 delete ps; 54 delete ps;
56} 55}
57 56
58QSize BatteryMeter::sizeHint() const 57QSize BatteryMeter::sizeHint() const
59{ 58{
60 return QSize(QMAX(AppLnk::smallIconSize()*3/4, 6), height() ); 59 return QSize(QMAX(AppLnk::smallIconSize()*3/4, 6), height() );
61} 60}
62 61
63void BatteryMeter::mousePressEvent( QMouseEvent* e ) 62void BatteryMeter::mousePressEvent( QMouseEvent* e )
64{ 63{
65 if ( e->button() == RightButton ) 64 if ( e->button() == RightButton )
66 { 65 {
67 style = 1-style; 66 style = 1-style;
68 Config c( "qpe" ); 67 Config c( "qpe" );
69 c.setGroup( "Battery" ); 68 c.setGroup( "Battery" );
70 c.writeEntry( "Style", style ); 69 c.writeEntry( "Style", style );
71 repaint( true ); 70 repaint( true );
72 } 71 }
73 QWidget::mousePressEvent( e ); 72 QWidget::mousePressEvent( e );
74} 73}
75 74
76void BatteryMeter::mouseReleaseEvent( QMouseEvent* /*e*/ ) 75void BatteryMeter::mouseReleaseEvent( QMouseEvent* /*e*/ )
77{ 76{
78 if ( batteryView && batteryView->isVisible() ) { 77 if ( batteryView && batteryView->isVisible() ) {
79 delete (QWidget *) batteryView; 78 delete (QWidget *) batteryView;
80 } else { 79 } else {
81 if ( !batteryView ) batteryView = new BatteryStatus( ps ); 80 if ( !batteryView ) batteryView = new BatteryStatus( ps );
82 QPEApplication::showWidget( batteryView ); 81 QPEApplication::showWidget( batteryView );
83 batteryView->raise(); 82 batteryView->raise();
84 batteryView->show(); 83 batteryView->show();
85 } 84 }
86} 85}
87 86
88void BatteryMeter::timerEvent( QTimerEvent * ) 87void BatteryMeter::timerEvent( QTimerEvent * )
89{ 88{
90 PowerStatus prev = *ps; 89 PowerStatus prev = *ps;
91 90
92 *ps = PowerStatusManager::readStatus(); 91 *ps = PowerStatusManager::readStatus();
93 92
94 if ( prev != *ps ) { 93 if ( prev != *ps ) {
95 percent = ps->batteryPercentRemaining(); 94 percent = ps->batteryPercentRemaining();
96 if ( !charging && ps->batteryStatus() == PowerStatus::Charging ) { 95 if ( !charging && ps->batteryStatus() == PowerStatus::Charging ) {
97 percent = 0; 96 percent = 0;
98 charging = true; 97 charging = true;
99 chargeTimer->start( 500 ); 98 chargeTimer->start( 500 );
100 } else if ( charging && ps->batteryStatus() != PowerStatus::Charging ) { 99 } else if ( charging && ps->batteryStatus() != PowerStatus::Charging ) {
101 charging = false; 100 charging = false;
102 chargeTimer->stop(); 101 chargeTimer->stop();
103 if ( batteryView ) 102 if ( batteryView )
104 batteryView->updatePercent( percent ); 103 batteryView->updatePercent( percent );
105 } 104 }
106 repaint( style != 0 ); 105 repaint( style != 0 );
107 if ( batteryView ) 106 if ( batteryView )
108 batteryView->repaint(); 107 batteryView->repaint();
109 } 108 }
110} 109}
111 110
112void BatteryMeter::chargeTimeout() 111void BatteryMeter::chargeTimeout()
113{ 112{
114 percent += 20; 113 percent += 20;
115 if ( percent > 100 ) 114 if ( percent > 100 )
116 percent = 0; 115 percent = 0;
117 116
118 repaint(FALSE); 117 repaint(FALSE);
119 if ( batteryView ) 118 if ( batteryView )
120 batteryView->updatePercent( percent ); 119 batteryView->updatePercent( percent );
121} 120}
122 121
123void BatteryMeter::paintEvent( QPaintEvent* ) 122void BatteryMeter::paintEvent( QPaintEvent* )
124{ 123{
diff --git a/core/applets/batteryapplet/batterystatus.cpp b/core/applets/batteryapplet/batterystatus.cpp
index b9ca7b5..ea11495 100644
--- a/core/applets/batteryapplet/batterystatus.cpp
+++ b/core/applets/batteryapplet/batterystatus.cpp
@@ -1,111 +1,109 @@
1 1
2#include "batterystatus.h" 2#include "batterystatus.h"
3 3
4/* OPIE */ 4/* OPIE */
5#include <opie2/odevice.h> 5#include <opie2/odevice.h>
6#include <qpe/power.h> 6#include <qpe/power.h>
7 7
8/* QT */ 8/* QT */
9#include <qpainter.h>
10#include <qpushbutton.h> 9#include <qpushbutton.h>
11#include <qdrawutil.h> 10#include <qdrawutil.h>
12#include <qfile.h> 11#include <qfile.h>
13#include <qlayout.h> 12#include <qlayout.h>
14#include <qtextstream.h> 13#include <qtextstream.h>
15#include <qapplication.h>
16#include <qmessagebox.h> 14#include <qmessagebox.h>
17 15
18using namespace Opie; 16using namespace Opie;
19 17
20BatteryStatus::BatteryStatus( const PowerStatus *p, QWidget *parent ) 18BatteryStatus::BatteryStatus( const PowerStatus *p, QWidget *parent )
21 : QWidget( parent, 0, WDestructiveClose), ps(p), bat2(false) { 19 : QWidget( parent, 0, WDestructiveClose), ps(p), bat2(false) {
22 setCaption( tr("Battery status") ); 20 setCaption( tr("Battery status") );
23 setMinimumSize( 150, 200 ); 21 setMinimumSize( 150, 200 );
24 22
25 QPushButton *pb = new QPushButton( tr("Close"), this ); 23 QPushButton *pb = new QPushButton( tr("Close"), this );
26 QVBoxLayout *layout = new QVBoxLayout ( this ); 24 QVBoxLayout *layout = new QVBoxLayout ( this );
27 25
28 jackPercent = 0; 26 jackPercent = 0;
29 27
30 pb->setMaximumSize( 120, 40 ); 28 pb->setMaximumSize( 120, 40 );
31 29
32 pb->show(); 30 pb->show();
33 31
34 layout->addStretch(); 32 layout->addStretch();
35 layout->addWidget( pb ); 33 layout->addWidget( pb );
36 34
37 if ( ODevice::inst ( )-> series ( ) == Model_iPAQ ) { 35 if ( ODevice::inst ( )-> series ( ) == Model_iPAQ ) {
38 getProcApmStatusIpaq(); 36 getProcApmStatusIpaq();
39 } 37 }
40 connect( pb, SIGNAL( clicked() ), this, SLOT( close() ) ); 38 connect( pb, SIGNAL( clicked() ), this, SLOT( close() ) );
41 percent = ps->batteryPercentRemaining(); 39 percent = ps->batteryPercentRemaining();
42 show(); 40 show();
43} 41}
44 42
45BatteryStatus::~BatteryStatus() 43BatteryStatus::~BatteryStatus()
46{ 44{
47} 45}
48 46
49/* 47/*
50 * Make use of the advanced apm interface of the ipaq 48 * Make use of the advanced apm interface of the ipaq
51 */ 49 */
52bool BatteryStatus::getProcApmStatusIpaq() { 50bool BatteryStatus::getProcApmStatusIpaq() {
53 51
54 bat2 = false; 52 bat2 = false;
55 53
56 QFile procApmIpaq("/proc/hal/battery"); 54 QFile procApmIpaq("/proc/hal/battery");
57 55
58 if (procApmIpaq.open(IO_ReadOnly) ) { 56 if (procApmIpaq.open(IO_ReadOnly) ) {
59 QStringList list; 57 QStringList list;
60 // since it is /proc we _must_ use QTextStream 58 // since it is /proc we _must_ use QTextStream
61 QTextStream stream ( &procApmIpaq); 59 QTextStream stream ( &procApmIpaq);
62 QString streamIn; 60 QString streamIn;
63 streamIn = stream.read(); 61 streamIn = stream.read();
64 list = QStringList::split("\n", streamIn); 62 list = QStringList::split("\n", streamIn);
65 63
66 for(QStringList::Iterator line=list.begin(); line!=list.end(); line++) { 64 for(QStringList::Iterator line=list.begin(); line!=list.end(); line++) {
67 // not nice, need a rewrite later 65 // not nice, need a rewrite later
68 if( (*line).startsWith(" Percentage") ){ 66 if( (*line).startsWith(" Percentage") ){
69 if (bat2 == true) { 67 if (bat2 == true) {
70 perc2 = (*line).mid(((*line).find('('))+1,(*line).find(')')-(*line).find('(')-2); 68 perc2 = (*line).mid(((*line).find('('))+1,(*line).find(')')-(*line).find('(')-2);
71 } else { 69 } else {
72 perc1 = (*line).mid(((*line).find('('))+1,(*line).find(')')-(*line).find('(')-2); 70 perc1 = (*line).mid(((*line).find('('))+1,(*line).find(')')-(*line).find('(')-2);
73 } 71 }
74 }else if( (*line).startsWith(" Life") ){ 72 }else if( (*line).startsWith(" Life") ){
75 if (bat2 == true) { 73 if (bat2 == true) {
76 sec2 = (*line).mid(((*line).find(':')+2), 5 ); 74 sec2 = (*line).mid(((*line).find(':')+2), 5 );
77 } else { 75 } else {
78 sec1 = (*line).mid(((*line).find(':')+2), 5 ); 76 sec1 = (*line).mid(((*line).find(':')+2), 5 );
79 } 77 }
80 }else if( (*line).startsWith("Battery #1") ){ 78 }else if( (*line).startsWith("Battery #1") ){
81 bat2 = true; 79 bat2 = true;
82 }else if( (*line).startsWith(" Status") ){ 80 }else if( (*line).startsWith(" Status") ){
83 if (bat2 == true) { 81 if (bat2 == true) {
84 jackStatus = (*line).mid((*line).find('(')+1, (*line).find(')')-(*line).find('(')-1); 82 jackStatus = (*line).mid((*line).find('(')+1, (*line).find(')')-(*line).find('(')-1);
85 } else { 83 } else {
86 ipaqStatus = (*line).mid((*line).find('(')+1, (*line).find(')')-(*line).find('(')-1); 84 ipaqStatus = (*line).mid((*line).find('(')+1, (*line).find(')')-(*line).find('(')-1);
87 } 85 }
88 }else if( (*line).startsWith(" Chemistry") ) { 86 }else if( (*line).startsWith(" Chemistry") ) {
89 if (bat2 == true) { 87 if (bat2 == true) {
90 jackChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1); 88 jackChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1);
91 } else { 89 } else {
92 ipaqChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1); 90 ipaqChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1);
93 } 91 }
94 } 92 }
95 } 93 }
96 } else { 94 } else {
97 QMessageBox::warning(this, tr("Failure"),tr("could not open file")); 95 QMessageBox::warning(this, tr("Failure"),tr("could not open file"));
98 } 96 }
99 97
100 procApmIpaq.close(); 98 procApmIpaq.close();
101 99
102 jackPercent = perc2.toInt(); 100 jackPercent = perc2.toInt();
103 ipaqPercent = perc1.toInt(); 101 ipaqPercent = perc1.toInt();
104 102
105 if (perc2.isEmpty()) { 103 if (perc2.isEmpty()) {
106 perc2 = tr("no data"); 104 perc2 = tr("no data");
107 } else { 105 } else {
108 perc2 += " %"; 106 perc2 += " %";
109 } 107 }
110 108
111 109
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp
index 8ffaada..7625545 100644
--- a/core/applets/cardmon/cardmon.cpp
+++ b/core/applets/cardmon/cardmon.cpp
@@ -1,127 +1,125 @@
1/* 1/*
2* cardmon.cpp 2* cardmon.cpp
3* 3*
4* --------------------- 4* ---------------------
5* 5*
6* copyright : (c) 2002 by Maximilian Reiss 6* copyright : (c) 2002 by Maximilian Reiss
7* email : max.reiss@gmx.de 7* email : max.reiss@gmx.de
8* based on two apps by Devin Butterfield 8* based on two apps by Devin Butterfield
9*/ 9*/
10/*************************************************************************** 10/***************************************************************************
11 * * 11 * *
12 * This program is free software; you can redistribute it and/or modify * 12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by * 13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or * 14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. * 15 * (at your option) any later version. *
16 * * 16 * *
17 ***************************************************************************/ 17 ***************************************************************************/
18 18
19#include "cardmon.h" 19#include "cardmon.h"
20 20
21/* OPIE */ 21/* OPIE */
22#include <opie2/odevice.h> 22#include <opie2/odevice.h>
23#include <opie2/otaskbarapplet.h> 23#include <opie2/otaskbarapplet.h>
24#include <qpe/applnk.h> 24#include <qpe/applnk.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26 26
27/* QT */ 27/* QT */
28#include <qapplication.h>
29#include <qcopchannel_qws.h> 28#include <qcopchannel_qws.h>
30#include <qpainter.h> 29#include <qpainter.h>
31#include <qmessagebox.h>
32#include <qfile.h> 30#include <qfile.h>
33#include <qtextstream.h> 31#include <qtextstream.h>
34#include <qsound.h> 32#include <qsound.h>
35#include <qtimer.h> 33#include <qtimer.h>
36 34
37/* STD */ 35/* STD */
38#include <stdio.h> 36#include <stdio.h>
39#include <unistd.h> 37#include <unistd.h>
40#include <stdlib.h> 38#include <stdlib.h>
41#include <string.h> 39#include <string.h>
42#include <fcntl.h> 40#include <fcntl.h>
43 41
44#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 42#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
45#include <sys/vfs.h> 43#include <sys/vfs.h>
46#include <mntent.h> 44#include <mntent.h>
47#endif 45#endif
48 46
49using namespace Opie; 47using namespace Opie;
50 48
51CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ), 49CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ),
52 pm( Resource::loadPixmap( "cardmon/pcmcia" ) ) 50 pm( Resource::loadPixmap( "cardmon/pcmcia" ) )
53{ 51{
54 52
55 QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); 53 QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this );
56 connect( pcmciaChannel, 54 connect( pcmciaChannel,
57 SIGNAL( received( const QCString &, const QByteArray & ) ), this, 55 SIGNAL( received( const QCString &, const QByteArray & ) ), this,
58 SLOT( cardMessage( const QCString &, const QByteArray & ) ) ); 56 SLOT( cardMessage( const QCString &, const QByteArray & ) ) );
59 57
60 QCopChannel *sdChannel = new QCopChannel( "QPE/Card", this ); 58 QCopChannel *sdChannel = new QCopChannel( "QPE/Card", this );
61 connect( sdChannel, 59 connect( sdChannel,
62 SIGNAL( received( const QCString &, const QByteArray & ) ), this, 60 SIGNAL( received( const QCString &, const QByteArray & ) ), this,
63 SLOT( cardMessage( const QCString &, const QByteArray & ) ) ); 61 SLOT( cardMessage( const QCString &, const QByteArray & ) ) );
64 62
65 cardInPcmcia0 = FALSE; 63 cardInPcmcia0 = FALSE;
66 cardInPcmcia1 = FALSE; 64 cardInPcmcia1 = FALSE;
67 cardInSd = FALSE; 65 cardInSd = FALSE;
68 66
69 setFocusPolicy( NoFocus ); 67 setFocusPolicy( NoFocus );
70 68
71 setFixedWidth ( AppLnk::smallIconSize() ); 69 setFixedWidth ( AppLnk::smallIconSize() );
72 setFixedHeight ( AppLnk::smallIconSize() ); 70 setFixedHeight ( AppLnk::smallIconSize() );
73 71
74 getStatusPcmcia( TRUE ); 72 getStatusPcmcia( TRUE );
75 getStatusSd( TRUE ); 73 getStatusSd( TRUE );
76 repaint( FALSE ); 74 repaint( FALSE );
77 popupMenu = 0; 75 popupMenu = 0;
78} 76}
79 77
80CardMonitor::~CardMonitor() 78CardMonitor::~CardMonitor()
81{ 79{
82 if ( popupMenu ) 80 if ( popupMenu )
83 { 81 {
84 delete popupMenu; 82 delete popupMenu;
85 } 83 }
86} 84}
87 85
88void CardMonitor::popUp( QString message, QString icon ) 86void CardMonitor::popUp( QString message, QString icon )
89{ 87{
90 if ( !popupMenu ) 88 if ( !popupMenu )
91 { 89 {
92 popupMenu = new QPopupMenu( this ); 90 popupMenu = new QPopupMenu( this );
93 } 91 }
94 92
95 popupMenu->clear(); 93 popupMenu->clear();
96 if ( icon.isEmpty() ) 94 if ( icon.isEmpty() )
97 { 95 {
98 popupMenu->insertItem( message, 0 ); 96 popupMenu->insertItem( message, 0 );
99 } 97 }
100 else 98 else
101 { 99 {
102 popupMenu->insertItem( QIconSet( Resource::loadPixmap( icon ) ), 100 popupMenu->insertItem( QIconSet( Resource::loadPixmap( icon ) ),
103 message, 0 ); 101 message, 0 );
104 } 102 }
105 103
106 QPoint p = mapToGlobal( QPoint( 0, 0 ) ); 104 QPoint p = mapToGlobal( QPoint( 0, 0 ) );
107 QSize s = popupMenu->sizeHint(); 105 QSize s = popupMenu->sizeHint();
108 popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), 106 popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ),
109 p.y() - s.height() ), 0 ); 107 p.y() - s.height() ), 0 );
110 108
111 QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) ); 109 QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) );
112} 110}
113 111
114void CardMonitor::popupTimeout() 112void CardMonitor::popupTimeout()
115{ 113{
116 popupMenu->hide(); 114 popupMenu->hide();
117} 115}
118 116
119void CardMonitor::mousePressEvent( QMouseEvent * ) 117void CardMonitor::mousePressEvent( QMouseEvent * )
120{ 118{
121 QPopupMenu * menu = new QPopupMenu( this ); 119 QPopupMenu * menu = new QPopupMenu( this );
122 QString cmd; 120 QString cmd;
123 int err = 0; 121 int err = 0;
124 122
125 if ( cardInSd ) 123 if ( cardInSd )
126 { 124 {
127 menu->insertItem( QIconSet( Resource::loadPixmap( "cardmon/ide" ) ), 125 menu->insertItem( QIconSet( Resource::loadPixmap( "cardmon/ide" ) ),
diff --git a/core/applets/homeapplet/home.cpp b/core/applets/homeapplet/home.cpp
index 455575f..8a930be 100644
--- a/core/applets/homeapplet/home.cpp
+++ b/core/applets/homeapplet/home.cpp
@@ -1,87 +1,85 @@
1#include <qpe/resource.h> 1#include <qpe/resource.h>
2#include <qpe/qcopenvelope_qws.h> 2#include <qpe/qcopenvelope_qws.h>
3 3
4#include <qapplication.h> 4#include <qapplication.h>
5#include <qiconset.h>
6#include <qpopupmenu.h>
7 5
8#include "home.h" 6#include "home.h"
9 7
10 8
11HomeApplet::HomeApplet ( ) 9HomeApplet::HomeApplet ( )
12 : QObject ( 0, "HomeApplet" ) 10 : QObject ( 0, "HomeApplet" )
13{ 11{
14} 12}
15 13
16HomeApplet::~HomeApplet ( ) 14HomeApplet::~HomeApplet ( )
17{ 15{
18} 16}
19 17
20int HomeApplet::position ( ) const 18int HomeApplet::position ( ) const
21{ 19{
22 return 4; 20 return 4;
23} 21}
24 22
25QString HomeApplet::name ( ) const 23QString HomeApplet::name ( ) const
26{ 24{
27 return tr( "Home shortcut" ); 25 return tr( "Home shortcut" );
28} 26}
29 27
30QString HomeApplet::text ( ) const 28QString HomeApplet::text ( ) const
31{ 29{
32 return tr( "Desktop" ); 30 return tr( "Desktop" );
33} 31}
34 32
35QString HomeApplet::tr( const char* s ) const 33QString HomeApplet::tr( const char* s ) const
36{ 34{
37 return qApp->translate( "HomeApplet", s, 0 ); 35 return qApp->translate( "HomeApplet", s, 0 );
38} 36}
39 37
40QString HomeApplet::tr( const char* s, const char* p ) const 38QString HomeApplet::tr( const char* s, const char* p ) const
41{ 39{
42 return qApp->translate( "HomeApplet", s, p ); 40 return qApp->translate( "HomeApplet", s, p );
43} 41}
44 42
45QIconSet HomeApplet::icon ( ) const 43QIconSet HomeApplet::icon ( ) const
46{ 44{
47 QPixmap pix; 45 QPixmap pix;
48 QImage img = Resource::loadImage ( "home" ); 46 QImage img = Resource::loadImage ( "home" );
49 47
50 if ( !img. isNull ( )) 48 if ( !img. isNull ( ))
51 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 49 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
52 return pix; 50 return pix;
53} 51}
54 52
55QPopupMenu *HomeApplet::popup ( QWidget * ) const 53QPopupMenu *HomeApplet::popup ( QWidget * ) const
56{ 54{
57 return 0; 55 return 0;
58} 56}
59 57
60void HomeApplet::activated ( ) 58void HomeApplet::activated ( )
61{ 59{
62 // to desktop (home) 60 // to desktop (home)
63 QCopEnvelope ( "QPE/Application/qpe", "raise()" ); 61 QCopEnvelope ( "QPE/Application/qpe", "raise()" );
64} 62}
65 63
66 64
67QRESULT HomeApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 65QRESULT HomeApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
68{ 66{
69 *iface = 0; 67 *iface = 0;
70 if ( uuid == IID_QUnknown ) 68 if ( uuid == IID_QUnknown )
71 *iface = this; 69 *iface = this;
72 else if ( uuid == IID_MenuApplet ) 70 else if ( uuid == IID_MenuApplet )
73 *iface = this; 71 *iface = this;
74 else 72 else
75 return QS_FALSE; 73 return QS_FALSE;
76 74
77 if ( *iface ) 75 if ( *iface )
78 (*iface)-> addRef ( ); 76 (*iface)-> addRef ( );
79 return QS_OK; 77 return QS_OK;
80} 78}
81 79
82Q_EXPORT_INTERFACE( ) 80Q_EXPORT_INTERFACE( )
83{ 81{
84 Q_CREATE_INSTANCE( HomeApplet ) 82 Q_CREATE_INSTANCE( HomeApplet )
85} 83}
86 84
87 85
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index f850424..a47f33d 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -1,125 +1,120 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 David Woodhouse <dwmw2@infradead.org> 2** Copyright (C) 2002 David Woodhouse <dwmw2@infradead.org>
3** Max Reiss <harlekin@handhelds.org> [trivial stuff] 3** Max Reiss <harlekin@handhelds.org> [trivial stuff]
4** Robert Griebl <sandman@handhelds.org> 4** Robert Griebl <sandman@handhelds.org>
5** Holger Freyther <zecke@handhelds.org> QCOP Interface 5** Holger Freyther <zecke@handhelds.org> QCOP Interface
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 14**
15**********************************************************************/ 15**********************************************************************/
16 16
17#include <qcopchannel_qws.h>
18 17
19#include <qpe/qpeapplication.h>
20#include <qpe/resource.h> 18#include <qpe/resource.h>
21#include <qpe/ir.h>
22#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
23#include <qpe/sound.h>
24 20
25#include <qpainter.h> 21#include <qpainter.h>
26#include <qfile.h> 22#include <qfile.h>
27#include <qtimer.h> 23#include <qtimer.h>
28#include <qtextstream.h> 24#include <qtextstream.h>
29#include <qpopupmenu.h>
30 25
31#include <unistd.h> 26#include <unistd.h>
32#include <net/if.h> 27#include <net/if.h>
33#include <netinet/in.h> 28#include <netinet/in.h>
34#include <sys/types.h> 29#include <sys/types.h>
35#include <sys/socket.h> 30#include <sys/socket.h>
36#include <sys/ioctl.h> 31#include <sys/ioctl.h>
37 32
38#include "irda.h" 33#include "irda.h"
39 34
40//=========================================================================== 35//===========================================================================
41 36
42IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) 37IrdaApplet::IrdaApplet ( QWidget *parent, const char *name )
43 : QWidget ( parent, name ) 38 : QWidget ( parent, name )
44{ 39{
45 setFixedHeight ( 18 ); 40 setFixedHeight ( 18 );
46 setFixedWidth ( 14 ); 41 setFixedWidth ( 14 );
47 42
48 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); 43 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP );
49 44
50 m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); 45 m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" );
51 m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); 46 m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" );
52 m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" ); 47 m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" );
53 m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" ); 48 m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" );
54 49
55 m_irda_active = false; 50 m_irda_active = false;
56 m_irda_discovery_active = false; 51 m_irda_discovery_active = false;
57 m_receive_active = false; 52 m_receive_active = false;
58 m_receive_state_changed = false; 53 m_receive_state_changed = false;
59 m_popup = 0; 54 m_popup = 0;
60 m_wasOn = false; 55 m_wasOn = false;
61 m_wasDiscover = false; 56 m_wasDiscover = false;
62 57
63 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); 58 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this );
64 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 59 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
65 this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) ); 60 this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) );
66} 61}
67 62
68void IrdaApplet::show() 63void IrdaApplet::show()
69{ 64{
70 QWidget::show ( ); 65 QWidget::show ( );
71 startTimer ( 2000 ); 66 startTimer ( 2000 );
72} 67}
73 68
74IrdaApplet::~IrdaApplet() 69IrdaApplet::~IrdaApplet()
75{ 70{
76 if ( m_sockfd >= 0 ) 71 if ( m_sockfd >= 0 )
77 ::close ( m_sockfd ); 72 ::close ( m_sockfd );
78} 73}
79 74
80void IrdaApplet::popup ( QString message, QString icon ) 75void IrdaApplet::popup ( QString message, QString icon )
81{ 76{
82 if ( !m_popup ) 77 if ( !m_popup )
83 m_popup = new QPopupMenu ( this ); 78 m_popup = new QPopupMenu ( this );
84 79
85 m_popup-> clear ( ); 80 m_popup-> clear ( );
86 81
87 if ( icon. isEmpty ( )) 82 if ( icon. isEmpty ( ))
88 m_popup-> insertItem ( message, 0 ); 83 m_popup-> insertItem ( message, 0 );
89 else 84 else
90 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 ); 85 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 );
91 86
92 QPoint p = mapToGlobal ( QPoint ( 0, 0 )); 87 QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
93 QSize s = m_popup-> sizeHint ( ); 88 QSize s = m_popup-> sizeHint ( );
94 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), 89 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ),
95 p. y ( ) - s. height ( ))); 90 p. y ( ) - s. height ( )));
96 91
97 QTimer::singleShot ( 2000, this, SLOT( popupTimeout ( ))); 92 QTimer::singleShot ( 2000, this, SLOT( popupTimeout ( )));
98} 93}
99 94
100void IrdaApplet::popupTimeout ( ) 95void IrdaApplet::popupTimeout ( )
101{ 96{
102 m_popup-> hide ( ); 97 m_popup-> hide ( );
103} 98}
104 99
105bool IrdaApplet::checkIrdaStatus ( ) 100bool IrdaApplet::checkIrdaStatus ( )
106{ 101{
107 struct ifreq ifr; 102 struct ifreq ifr;
108 strcpy ( ifr. ifr_name, "irda0" ); 103 strcpy ( ifr. ifr_name, "irda0" );
109 104
110 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) 105 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
111 return false; 106 return false;
112 107
113 return ( ifr. ifr_flags & IFF_UP ); 108 return ( ifr. ifr_flags & IFF_UP );
114} 109}
115 110
116bool IrdaApplet::setIrdaStatus ( bool b ) 111bool IrdaApplet::setIrdaStatus ( bool b )
117{ 112{
118 struct ifreq ifr; 113 struct ifreq ifr;
119 strcpy ( ifr. ifr_name, "irda0" ); 114 strcpy ( ifr. ifr_name, "irda0" );
120 115
121 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) 116 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
122 return false; 117 return false;
123 118
124 if ( b ) { 119 if ( b ) {
125 ifr. ifr_flags |= IFF_UP; 120 ifr. ifr_flags |= IFF_UP;
diff --git a/core/applets/logoutapplet/logout.cpp b/core/applets/logoutapplet/logout.cpp
index 92222c9..0ac0067 100644
--- a/core/applets/logoutapplet/logout.cpp
+++ b/core/applets/logoutapplet/logout.cpp
@@ -1,102 +1,100 @@
1#include <qpe/resource.h> 1#include <qpe/resource.h>
2#include <qpe/qcopenvelope_qws.h> 2#include <qpe/qcopenvelope_qws.h>
3 3
4#include <qapplication.h> 4#include <qapplication.h>
5#include <qiconset.h>
6#include <qpopupmenu.h>
7#include <qmessagebox.h> 5#include <qmessagebox.h>
8 6
9#include <unistd.h> 7#include <unistd.h>
10 8
11#include "logout.h" 9#include "logout.h"
12 10
13 11
14LogoutApplet::LogoutApplet ( ) 12LogoutApplet::LogoutApplet ( )
15 : QObject ( 0, "LogoutApplet" ) 13 : QObject ( 0, "LogoutApplet" )
16{ 14{
17} 15}
18 16
19LogoutApplet::~LogoutApplet ( ) 17LogoutApplet::~LogoutApplet ( )
20{ 18{
21} 19}
22 20
23int LogoutApplet::position ( ) const 21int LogoutApplet::position ( ) const
24{ 22{
25 return 0; 23 return 0;
26} 24}
27 25
28QString LogoutApplet::name ( ) const 26QString LogoutApplet::name ( ) const
29{ 27{
30 return tr( "Logout shortcut" ); 28 return tr( "Logout shortcut" );
31} 29}
32 30
33QString LogoutApplet::text ( ) const 31QString LogoutApplet::text ( ) const
34{ 32{
35 return tr( "Logout" ); 33 return tr( "Logout" );
36} 34}
37 35
38QString LogoutApplet::tr( const char* s ) const 36QString LogoutApplet::tr( const char* s ) const
39{ 37{
40 return qApp->translate( "LogoutApplet", s, 0 ); 38 return qApp->translate( "LogoutApplet", s, 0 );
41} 39}
42 40
43QString LogoutApplet::tr( const char* s, const char* p ) const 41QString LogoutApplet::tr( const char* s, const char* p ) const
44{ 42{
45 return qApp->translate( "LogoutApplet", s, p ); 43 return qApp->translate( "LogoutApplet", s, p );
46} 44}
47 45
48QIconSet LogoutApplet::icon ( ) const 46QIconSet LogoutApplet::icon ( ) const
49{ 47{
50 QPixmap pix; 48 QPixmap pix;
51 QImage img = Resource::loadImage ( "logout" ); 49 QImage img = Resource::loadImage ( "logout" );
52 50
53 if ( !img. isNull ( )) 51 if ( !img. isNull ( ))
54 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 52 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
55 return pix; 53 return pix;
56} 54}
57 55
58QPopupMenu *LogoutApplet::popup ( QWidget * ) const 56QPopupMenu *LogoutApplet::popup ( QWidget * ) const
59{ 57{
60 return 0; 58 return 0;
61} 59}
62 60
63// This is a workaround for a Qt bug 61// This is a workaround for a Qt bug
64// clipboard applet has to stop its poll timer, or Qt/E 62// clipboard applet has to stop its poll timer, or Qt/E
65// will hang on quit() right before it emits aboutToQuit() 63// will hang on quit() right before it emits aboutToQuit()
66 64
67class HackApplication : public QApplication { 65class HackApplication : public QApplication {
68public: 66public:
69 HackApplication ( ) : QApplication ( dummy, 0 ) 67 HackApplication ( ) : QApplication ( dummy, 0 )
70 { 68 {
71 } 69 }
72 70
73 void emit_about_to_quit ( ) 71 void emit_about_to_quit ( )
74 { 72 {
75 emit aboutToQuit ( ); 73 emit aboutToQuit ( );
76 } 74 }
77 75
78 int dummy; 76 int dummy;
79}; 77};
80 78
81 79
82void LogoutApplet::activated ( ) 80void LogoutApplet::activated ( )
83{ 81{
84 QMessageBox mb ( tr( "Logout" ), 82 QMessageBox mb ( tr( "Logout" ),
85 tr( "Do you really want to\nend this session ?" ), 83 tr( "Do you really want to\nend this session ?" ),
86 QMessageBox::NoIcon, 84 QMessageBox::NoIcon,
87 QMessageBox::Yes | QMessageBox::Default, 85 QMessageBox::Yes | QMessageBox::Default,
88 QMessageBox::No | QMessageBox::Escape, 86 QMessageBox::No | QMessageBox::Escape,
89 QMessageBox::NoButton ); 87 QMessageBox::NoButton );
90 88
91 mb. setButtonText ( QMessageBox::Yes, "Yes" ); 89 mb. setButtonText ( QMessageBox::Yes, "Yes" );
92 mb. setButtonText ( QMessageBox::No, "No" ); 90 mb. setButtonText ( QMessageBox::No, "No" );
93 mb. setIconPixmap ( icon ( ). pixmap ( )); 91 mb. setIconPixmap ( icon ( ). pixmap ( ));
94 92
95 if ( mb. exec ( ) == QMessageBox::Yes ) { 93 if ( mb. exec ( ) == QMessageBox::Yes ) {
96 { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); } 94 { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); }
97 95
98 qApp-> processEvents ( ); // ensure the message goes out. 96 qApp-> processEvents ( ); // ensure the message goes out.
99 sleep ( 1 ); // You have 1 second to comply. 97 sleep ( 1 ); // You have 1 second to comply.
100 98
101 ((HackApplication *) qApp )-> emit_about_to_quit ( ); 99 ((HackApplication *) qApp )-> emit_about_to_quit ( );
102 qApp-> quit(); 100 qApp-> quit();
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp
index b36ee12..b17498d 100644
--- a/core/applets/multikeyapplet/multikey.cpp
+++ b/core/applets/multikeyapplet/multikey.cpp
@@ -1,124 +1,118 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru 2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru
3** All rights reserved. 3** All rights reserved.
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13**********************************************************************/ 13**********************************************************************/
14 14
15#include "multikey.h" 15#include "multikey.h"
16 16
17/* OPIE */ 17/* OPIE */
18#include <opie2/otaskbarapplet.h> 18#include <opie2/otaskbarapplet.h>
19#include <qpe/global.h>
20#include <qpe/config.h>
21#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
22#include <qpe/qpeapplication.h>
23 20
24/* QT */ 21/* QT */
25#include <qlabel.h>
26#include <qdir.h> 22#include <qdir.h>
27#include <qfileinfo.h>
28#include <qcopchannel_qws.h>
29 23
30Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN") 24Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN")
31{ 25{
32 QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); 26 QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this);
33 connect( swChannel, SIGNAL(received(const QCString &, const QByteArray &)), 27 connect( swChannel, SIGNAL(received(const QCString &, const QByteArray &)),
34 this, SLOT(message(const QCString &, const QByteArray &))); 28 this, SLOT(message(const QCString &, const QByteArray &)));
35 29
36 setFont( QFont( "Helvetica", 10, QFont::Normal ) ); 30 setFont( QFont( "Helvetica", 10, QFont::Normal ) );
37 QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold); 31 QPEApplication::setStylusOperation(this, QPEApplication::RightOnHold);
38 lang = 0; 32 lang = 0;
39 QCopEnvelope e("MultiKey/Keyboard", "getmultikey()"); 33 QCopEnvelope e("MultiKey/Keyboard", "getmultikey()");
40 setText("EN"); 34 setText("EN");
41 popupMenu.insertItem("EN", 0); 35 popupMenu.insertItem("EN", 0);
42 show(); 36 show();
43} 37}
44 38
45void Multikey::mousePressEvent(QMouseEvent *ev) 39void Multikey::mousePressEvent(QMouseEvent *ev)
46{ 40{
47 if (!sw_maps.count()) 41 if (!sw_maps.count())
48 return; 42 return;
49 43
50 if (ev->button() == RightButton) { 44 if (ev->button() == RightButton) {
51 45
52 QPoint p = mapToGlobal(QPoint(0, 0)); 46 QPoint p = mapToGlobal(QPoint(0, 0));
53 QSize s = popupMenu.sizeHint(); 47 QSize s = popupMenu.sizeHint();
54 int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), 48 int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2),
55 p.y() - s.height()), 0); 49 p.y() - s.height()), 0);
56 50
57 if (opt == -1) 51 if (opt == -1)
58 return; 52 return;
59 lang = opt; 53 lang = opt;
60 54
61 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); 55 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)");
62 e << sw_maps[lang]; 56 e << sw_maps[lang];
63 setText(labels[lang]); 57 setText(labels[lang]);
64 } 58 }
65 QWidget::mousePressEvent(ev); 59 QWidget::mousePressEvent(ev);
66} 60}
67 61
68void Multikey::mouseReleaseEvent(QMouseEvent *ev) 62void Multikey::mouseReleaseEvent(QMouseEvent *ev)
69{ 63{
70 if (!sw_maps.count()) 64 if (!sw_maps.count())
71 return; 65 return;
72 66
73 lang = lang < sw_maps.count()-1 ? lang+1 : 0; 67 lang = lang < sw_maps.count()-1 ? lang+1 : 0;
74 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); 68 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)");
75 //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii()); 69 //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii());
76 e << sw_maps[lang]; 70 e << sw_maps[lang];
77 setText(labels[lang]); 71 setText(labels[lang]);
78} 72}
79 73
80void Multikey::message(const QCString &message, const QByteArray &data) 74void Multikey::message(const QCString &message, const QByteArray &data)
81{ 75{
82 if ( message == "setsw(QString,QString)" ) { 76 if ( message == "setsw(QString,QString)" ) {
83 77
84 QDataStream stream(data, IO_ReadOnly); 78 QDataStream stream(data, IO_ReadOnly);
85 QString maps, current_map; 79 QString maps, current_map;
86 stream >> maps >> current_map; 80 stream >> maps >> current_map;
87 QStringList sw = QStringList::split(QChar('|'), maps); 81 QStringList sw = QStringList::split(QChar('|'), maps);
88 sw.append(current_map); 82 sw.append(current_map);
89 83
90 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey/", "*.keymap"); 84 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey/", "*.keymap");
91 lang = 0; 85 lang = 0;
92 labels.clear(); 86 labels.clear();
93 sw_maps.clear(); 87 sw_maps.clear();
94 popupMenu.clear(); 88 popupMenu.clear();
95 89
96 for (uint i = 0; i < sw.count(); ++i) { 90 for (uint i = 0; i < sw.count(); ++i) {
97 QString keymap_map; 91 QString keymap_map;
98 if (sw[i][0] != '/') { 92 if (sw[i][0] != '/') {
99 93
100 keymap_map = map_dir.absPath() + "/" + sw[i]; 94 keymap_map = map_dir.absPath() + "/" + sw[i];
101 } else { 95 } else {
102 96
103 if ((map_dir.exists(QFileInfo(sw[i]).fileName(), false) 97 if ((map_dir.exists(QFileInfo(sw[i]).fileName(), false)
104 && i != sw.count()-1) || !QFile::exists(sw[i])) { 98 && i != sw.count()-1) || !QFile::exists(sw[i])) {
105 continue; 99 continue;
106 } 100 }
107 keymap_map = sw[i]; 101 keymap_map = sw[i];
108 } 102 }
109 103
110 QFile map(keymap_map); 104 QFile map(keymap_map);
111 if (map.open(IO_ReadOnly)) { 105 if (map.open(IO_ReadOnly)) {
112 QString line; 106 QString line;
113 107
114 map.readLine(line, 1024); 108 map.readLine(line, 1024);
115 while (!map.atEnd()) { 109 while (!map.atEnd()) {
116 110
117 if (line.find(QRegExp("^sw\\s*=\\s*")) != -1) { 111 if (line.find(QRegExp("^sw\\s*=\\s*")) != -1) {
118 112
119 if (i != sw.count()-1) { 113 if (i != sw.count()-1) {
120 if (keymap_map == current_map) { 114 if (keymap_map == current_map) {
121 lang = i; 115 lang = i;
122 } 116 }
123 sw_maps.append(keymap_map); 117 sw_maps.append(keymap_map);
124 labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); 118 labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace());
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp
index c3584ad..7d3c032 100644
--- a/core/launcher/applauncher.cpp
+++ b/core/launcher/applauncher.cpp
@@ -1,156 +1,152 @@
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#ifndef QTOPIA_INTERNAL_PRELOADACCESS 21#ifndef QTOPIA_INTERNAL_PRELOADACCESS
22#define QTOPIA_INTERNAL_PRELOADACCESS 22#define QTOPIA_INTERNAL_PRELOADACCESS
23#endif 23#endif
24#ifndef QTOPIA_INTERNAL_FILEOPERATIONS 24#ifndef QTOPIA_INTERNAL_FILEOPERATIONS
25#define QTOPIA_INTERNAL_FILEOPERATIONS 25#define QTOPIA_INTERNAL_FILEOPERATIONS
26#endif 26#endif
27#ifndef QTOPIA_PROGRAM_MONITOR 27#ifndef QTOPIA_PROGRAM_MONITOR
28#define QTOPIA_PROGRAM_MONITOR 28#define QTOPIA_PROGRAM_MONITOR
29#endif 29#endif
30#include <opie2/oglobal.h> 30#include <opie2/oglobal.h>
31 31
32#ifndef Q_OS_WIN32 32#ifndef Q_OS_WIN32
33#include <sys/stat.h> 33#include <sys/stat.h>
34#include <sys/wait.h> 34#include <sys/wait.h>
35#include <sys/file.h> 35#include <sys/file.h>
36#include <unistd.h> 36#include <unistd.h>
37#include <sys/time.h> 37#include <sys/time.h>
38#include <sys/resource.h> 38#include <sys/resource.h>
39#include <errno.h> 39#include <errno.h>
40#else 40#else
41#include <process.h> 41#include <process.h>
42#include <windows.h> 42#include <windows.h>
43#include <winbase.h> 43#include <winbase.h>
44#endif 44#endif
45 45
46#include <signal.h> 46#include <signal.h>
47#include <sys/types.h> 47#include <sys/types.h>
48#include <stdlib.h> 48#include <stdlib.h>
49 49
50#include <qtimer.h> 50#include <qtimer.h>
51#include <qwindowsystem_qws.h> 51#include <qwindowsystem_qws.h>
52#include <qmessagebox.h> 52#include <qmessagebox.h>
53#include <qfile.h>
54#include <qfileinfo.h> 53#include <qfileinfo.h>
55 54
56#include <qtopia/qcopenvelope_qws.h> 55#include <qtopia/qcopenvelope_qws.h>
57#include <qtopia/applnk.h>
58#include <qtopia/qpeapplication.h> 56#include <qtopia/qpeapplication.h>
59#include <qtopia/config.h>
60#include <qtopia/global.h>
61 57
62#include "applauncher.h" 58#include "applauncher.h"
63#include "documentlist.h" 59#include "documentlist.h"
64 60
65const int AppLauncher::RAISE_TIMEOUT_MS = 5000; 61const int AppLauncher::RAISE_TIMEOUT_MS = 5000;
66 62
67//--------------------------------------------------------------------------- 63//---------------------------------------------------------------------------
68 64
69static AppLauncher* appLauncherPtr; 65static AppLauncher* appLauncherPtr;
70 66
71const int appStopEventID = 1290; 67const int appStopEventID = 1290;
72 68
73class AppStoppedEvent : public QCustomEvent 69class AppStoppedEvent : public QCustomEvent
74{ 70{
75public: 71public:
76 AppStoppedEvent(int pid, int status) 72 AppStoppedEvent(int pid, int status)
77 : QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { } 73 : QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { }
78 74
79 int pid() { return mPid; } 75 int pid() { return mPid; }
80 int status() { return mStatus; } 76 int status() { return mStatus; }
81 77
82private: 78private:
83 int mPid, mStatus; 79 int mPid, mStatus;
84}; 80};
85 81
86AppLauncher::AppLauncher(QObject *parent, const char *name) 82AppLauncher::AppLauncher(QObject *parent, const char *name)
87 : QObject(parent, name), qlPid(0), qlReady(FALSE), 83 : QObject(parent, name), qlPid(0), qlReady(FALSE),
88 appKillerBox(0) 84 appKillerBox(0)
89{ 85{
90 connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&))); 86 connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&)));
91 connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&))); 87 connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&)));
92 QCopChannel* channel = new QCopChannel( "QPE/System", this ); 88 QCopChannel* channel = new QCopChannel( "QPE/System", this );
93 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 89 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
94 this, SLOT(received(const QCString&, const QByteArray&)) ); 90 this, SLOT(received(const QCString&, const QByteArray&)) );
95 91
96 channel = new QCopChannel( "QPE/Server", this ); 92 channel = new QCopChannel( "QPE/Server", this );
97 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 93 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
98 this, SLOT(received(const QCString&, const QByteArray&)) ); 94 this, SLOT(received(const QCString&, const QByteArray&)) );
99 95
100#ifndef Q_OS_WIN32 96#ifndef Q_OS_WIN32
101 signal(SIGCHLD, signalHandler); 97 signal(SIGCHLD, signalHandler);
102#else 98#else
103 runningAppsProc.setAutoDelete( TRUE ); 99 runningAppsProc.setAutoDelete( TRUE );
104#endif 100#endif
105 QString tmp = qApp->argv()[0]; 101 QString tmp = qApp->argv()[0];
106 int pos = tmp.findRev('/'); 102 int pos = tmp.findRev('/');
107 if ( pos > -1 ) 103 if ( pos > -1 )
108 tmp = tmp.mid(++pos); 104 tmp = tmp.mid(++pos);
109 runningApps[::getpid()] = tmp; 105 runningApps[::getpid()] = tmp;
110 106
111 appLauncherPtr = this; 107 appLauncherPtr = this;
112 108
113 QTimer::singleShot( 1000, this, SLOT(createQuickLauncher()) ); 109 QTimer::singleShot( 1000, this, SLOT(createQuickLauncher()) );
114} 110}
115 111
116AppLauncher::~AppLauncher() 112AppLauncher::~AppLauncher()
117{ 113{
118 appLauncherPtr = 0; 114 appLauncherPtr = 0;
119#ifndef Q_OS_WIN32 115#ifndef Q_OS_WIN32
120 signal(SIGCHLD, SIG_DFL); 116 signal(SIGCHLD, SIG_DFL);
121#endif 117#endif
122 if ( qlPid ) { 118 if ( qlPid ) {
123 int status; 119 int status;
124 ::kill( qlPid, SIGTERM ); 120 ::kill( qlPid, SIGTERM );
125 waitpid( qlPid, &status, 0 ); 121 waitpid( qlPid, &status, 0 );
126 } 122 }
127} 123}
128 124
129/* We use the QCopChannel of the app as an indicator of when it has been launched 125/* We use the QCopChannel of the app as an indicator of when it has been launched
130 so that we can disable the busy indicators */ 126 so that we can disable the busy indicators */
131void AppLauncher::newQcopChannel(const QString& channelName) 127void AppLauncher::newQcopChannel(const QString& channelName)
132{ 128{
133// qDebug("channel %s added", channelName.data() ); 129// qDebug("channel %s added", channelName.data() );
134 QString prefix("QPE/Application/"); 130 QString prefix("QPE/Application/");
135 if (channelName.startsWith(prefix)) { 131 if (channelName.startsWith(prefix)) {
136 { 132 {
137 QCopEnvelope e("QPE/System", "newChannel(QString)"); 133 QCopEnvelope e("QPE/System", "newChannel(QString)");
138 e << channelName; 134 e << channelName;
139 } 135 }
140 QString appName = channelName.mid(prefix.length()); 136 QString appName = channelName.mid(prefix.length());
141 if ( appName != "quicklauncher" ) { 137 if ( appName != "quicklauncher" ) {
142 emit connected( appName ); 138 emit connected( appName );
143 QCopEnvelope e("QPE/System", "notBusy(QString)"); 139 QCopEnvelope e("QPE/System", "notBusy(QString)");
144 e << appName; 140 e << appName;
145 } 141 }
146 } else if (channelName.startsWith("QPE/QuickLauncher-")) { 142 } else if (channelName.startsWith("QPE/QuickLauncher-")) {
147 qDebug("Registered %s", channelName.latin1()); 143 qDebug("Registered %s", channelName.latin1());
148 int pid = channelName.mid(18).toInt(); 144 int pid = channelName.mid(18).toInt();
149 if (pid == qlPid) 145 if (pid == qlPid)
150 qlReady = TRUE; 146 qlReady = TRUE;
151 } 147 }
152} 148}
153 149
154void AppLauncher::removedQcopChannel(const QString& channelName) 150void AppLauncher::removedQcopChannel(const QString& channelName)
155{ 151{
156 if (channelName.startsWith("QPE/Application/")) { 152 if (channelName.startsWith("QPE/Application/")) {
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp
index e07920f..50ae6c2 100644
--- a/core/launcher/firstuse.cpp
+++ b/core/launcher/firstuse.cpp
@@ -1,157 +1,149 @@
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// I need access to some things you don't normally get access to. 21// I need access to some things you don't normally get access to.
22 22
23#ifndef _MSC_VER 23#ifndef _MSC_VER
24 //### revise to allow removal of translators under MSVC 24 //### revise to allow removal of translators under MSVC
25#define private public 25#define private public
26#define protected public 26#define protected public
27#endif 27#endif
28#include "firstuse.h" 28#include "firstuse.h"
29#include "inputmethods.h" 29#include "inputmethods.h"
30#include "applauncher.h" 30#include "applauncher.h"
31#include "serverapp.h" 31#include "serverapp.h"
32//#include <qtopia/custom.h> 32//#include <qtopia/custom.h>
33 33
34#include "calibrate.h" 34#include "calibrate.h"
35#include "documentlist.h" 35#include "documentlist.h"
36 36
37#include <qtopia/resource.h> 37#include <qtopia/resource.h>
38#include <qtopia/qcopenvelope_qws.h> 38#include <qtopia/qcopenvelope_qws.h>
39#include <qtopia/qpeapplication.h>
40#include <qtopia/config.h> 39#include <qtopia/config.h>
41#include <qtopia/applnk.h>
42#include <qtopia/mimetype.h>
43#include <qtopia/fontmanager.h> 40#include <qtopia/fontmanager.h>
44 41
45#include <qapplication.h>
46#include <qfile.h> 42#include <qfile.h>
47#include <qpainter.h> 43#include <qpainter.h>
48#include <qcstring.h>
49#include <qsimplerichtext.h> 44#include <qsimplerichtext.h>
50#include <qcolor.h>
51#include <qpushbutton.h> 45#include <qpushbutton.h>
52#include <qhbox.h>
53#include <qlabel.h> 46#include <qlabel.h>
54#include <qtimer.h> 47#include <qtimer.h>
55 48
56#if defined( Q_WS_QWS ) 49#if defined( Q_WS_QWS )
57#include <qwsdisplay_qws.h> 50#include <qwsdisplay_qws.h>
58#include <qgfx_qws.h> 51#include <qgfx_qws.h>
59#endif 52#endif
60 53
61#include <qwindowsystem_qws.h>
62 54
63#include <stdlib.h> 55#include <stdlib.h>
64#include <sys/types.h> 56#include <sys/types.h>
65#if defined(Q_OS_LINUX) || defined(_OS_LINUX_) 57#if defined(Q_OS_LINUX) || defined(_OS_LINUX_)
66#include <unistd.h> 58#include <unistd.h>
67#endif 59#endif
68 60
69 61
70struct { 62struct {
71 bool enabled; 63 bool enabled;
72 const char *app; 64 const char *app;
73 const char *start; 65 const char *start;
74 const char *stop; 66 const char *stop;
75 const char *desc; 67 const char *desc;
76} 68}
77settingsTable [] = 69settingsTable [] =
78{ 70{
79 { FALSE, "language", "raise()", "accept()", // No tr 71 { FALSE, "language", "raise()", "accept()", // No tr
80 QT_TR_NOOP("Language") }, 72 QT_TR_NOOP("Language") },
81 { FALSE, "doctab", "raise()", "accept()", // No tr 73 { FALSE, "doctab", "raise()", "accept()", // No tr
82 QT_TR_NOOP("DocTab") }, 74 QT_TR_NOOP("DocTab") },
83#ifndef Q_OS_WIN32 75#ifndef Q_OS_WIN32
84 { FALSE, "systemtime", "raise()", "accept()", // No tr 76 { FALSE, "systemtime", "raise()", "accept()", // No tr
85 QT_TR_NOOP("Time and Date") }, 77 QT_TR_NOOP("Time and Date") },
86#endif 78#endif
87 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr 79 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr
88 QT_TR_NOOP("Personal Information") }, 80 QT_TR_NOOP("Personal Information") },
89 { FALSE, 0, 0, 0, 0 } 81 { FALSE, 0, 0, 0, 0 }
90}; 82};
91 83
92 84
93FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : 85FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) :
94 QDialog( parent, name, TRUE, wf), 86 QDialog( parent, name, TRUE, wf),
95 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), 87 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1),
96 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) 88 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE)
97{ 89{
98 ServerApplication::allowRestart = FALSE; 90 ServerApplication::allowRestart = FALSE;
99 // we force our height beyound the maximum (which we set anyway) 91 // we force our height beyound the maximum (which we set anyway)
100 QRect desk = qApp->desktop()->geometry(); 92 QRect desk = qApp->desktop()->geometry();
101 setGeometry( 0, 0, desk.width(), desk.height() ); 93 setGeometry( 0, 0, desk.width(), desk.height() );
102 94
103 connect(qwsServer, SIGNAL(newChannel(const QString&)), 95 connect(qwsServer, SIGNAL(newChannel(const QString&)),
104 this, SLOT(newQcopChannel(const QString&))); 96 this, SLOT(newQcopChannel(const QString&)));
105 97
106 // Create a DocumentList so appLauncher has appLnkSet to search 98 // Create a DocumentList so appLauncher has appLnkSet to search
107 docList = new DocumentList( 0, FALSE ); 99 docList = new DocumentList( 0, FALSE );
108 appLauncher = new AppLauncher( this ); 100 appLauncher = new AppLauncher( this );
109 connect( appLauncher, SIGNAL(terminated(int, const QString&)), 101 connect( appLauncher, SIGNAL(terminated(int, const QString&)),
110 this, SLOT(terminated(int, const QString&)) ); 102 this, SLOT(terminated(int, const QString&)) );
111 103
112 // more hackery 104 // more hackery
113 // I will be run as either the main server or as part of the main server 105 // I will be run as either the main server or as part of the main server
114 QWSServer::setScreenSaverIntervals(0); 106 QWSServer::setScreenSaverIntervals(0);
115 loadPixmaps(); 107 loadPixmaps();
116 108
117 //check if there is a language program 109 //check if there is a language program
118#ifndef Q_OS_WIN32 110#ifndef Q_OS_WIN32
119 QString exeSuffix; 111 QString exeSuffix;
120#else 112#else
121 QString exeSuffix(".exe"); 113 QString exeSuffix(".exe");
122#endif 114#endif
123 115
124 for ( int i = 0; settingsTable[i].app; i++ ) { 116 for ( int i = 0; settingsTable[i].app; i++ ) {
125 QString file = QPEApplication::qpeDir() + "bin/"; 117 QString file = QPEApplication::qpeDir() + "bin/";
126 file += settingsTable[i].app; 118 file += settingsTable[i].app;
127 file += exeSuffix; 119 file += exeSuffix;
128 if ( QFile::exists(file) ) 120 if ( QFile::exists(file) )
129 settingsTable[i].enabled = TRUE; 121 settingsTable[i].enabled = TRUE;
130 } 122 }
131 123
132 setFocusPolicy(NoFocus); 124 setFocusPolicy(NoFocus);
133 125
134 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); 126 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader);
135 127
136 inputMethods = new InputMethods(taskBar); 128 inputMethods = new InputMethods(taskBar);
137 connect(inputMethods, SIGNAL(inputToggled(bool)), 129 connect(inputMethods, SIGNAL(inputToggled(bool)),
138 this, SLOT(calcMaxWindowRect())); 130 this, SLOT(calcMaxWindowRect()));
139 131
140 back = new QPushButton(tr("<< Back"), taskBar); 132 back = new QPushButton(tr("<< Back"), taskBar);
141 back->setFocusPolicy(NoFocus); 133 back->setFocusPolicy(NoFocus);
142 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); 134 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) );
143 135
144 next = new QPushButton(tr("Next >>"), taskBar); 136 next = new QPushButton(tr("Next >>"), taskBar);
145 next->setFocusPolicy(NoFocus); 137 next->setFocusPolicy(NoFocus);
146 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); 138 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) );
147 139
148 // need to set the geom to lower corner 140 // need to set the geom to lower corner
149 QSize sz = inputMethods->sizeHint(); 141 QSize sz = inputMethods->sizeHint();
150 int buttonWidth = (width() - sz.width()) / 2; 142 int buttonWidth = (width() - sz.width()) / 2;
151 int x = 0; 143 int x = 0;
152 144
153 controlHeight = back->sizeHint().height(); 145 controlHeight = back->sizeHint().height();
154 146
155 inputMethods->setGeometry(0,0, sz.width(), controlHeight ); 147 inputMethods->setGeometry(0,0, sz.width(), controlHeight );
156 x += sz.width(); 148 x += sz.width();
157 149
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp
index 5d8faf7..683f1e2 100644
--- a/core/launcher/inputmethods.cpp
+++ b/core/launcher/inputmethods.cpp
@@ -1,134 +1,128 @@
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#define QTOPIA_INTERNAL_LANGLIST 21#define QTOPIA_INTERNAL_LANGLIST
22#include "inputmethods.h" 22#include "inputmethods.h"
23 23
24#include <qtopia/config.h> 24#include <qtopia/config.h>
25#include <qtopia/qpeapplication.h> 25#include <qtopia/qpeapplication.h>
26#include <qtopia/inputmethodinterface.h>
27#include <qtopia/global.h>
28 26
29#include <qpopupmenu.h> 27#include <qpopupmenu.h>
30#include <qpushbutton.h>
31#include <qtoolbutton.h> 28#include <qtoolbutton.h>
32#include <qwidgetstack.h> 29#include <qwidgetstack.h>
33#include <qwidget.h>
34#include <qlayout.h> 30#include <qlayout.h>
35#include <qtimer.h>
36#include <qdir.h> 31#include <qdir.h>
37#include <stdlib.h> 32#include <stdlib.h>
38#include <qtranslator.h>
39#include <qtl.h> 33#include <qtl.h>
40 34
41#ifdef Q_WS_QWS 35#ifdef Q_WS_QWS
42#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
43#include <qwsevent_qws.h> 37#include <qwsevent_qws.h>
44#include <qcopchannel_qws.h> 38#include <qcopchannel_qws.h>
45#endif 39#endif
46 40
47/* ### SingleFloppy if someone is interested? */ 41/* ### SingleFloppy if someone is interested? */
48#if 0 42#if 0
49#ifdef QT_NO_COMPONENT 43#ifdef QT_NO_COMPONENT
50#include "../plugins/inputmethods/handwriting/handwritingimpl.h" 44#include "../plugins/inputmethods/handwriting/handwritingimpl.h"
51#include "../plugins/inputmethods/keyboard/keyboardimpl.h" 45#include "../plugins/inputmethods/keyboard/keyboardimpl.h"
52#include "../3rdparty/plugins/inputmethods/pickboard/pickboardimpl.h" 46#include "../3rdparty/plugins/inputmethods/pickboard/pickboardimpl.h"
53#endif 47#endif
54#endif 48#endif
55 49
56/* XPM */ 50/* XPM */
57static const char * tri_xpm[]={ 51static const char * tri_xpm[]={
58"9 9 2 1", 52"9 9 2 1",
59"a c #000000", 53"a c #000000",
60". c None", 54". c None",
61".........", 55".........",
62".........", 56".........",
63".........", 57".........",
64"....a....", 58"....a....",
65"...aaa...", 59"...aaa...",
66"..aaaaa..", 60"..aaaaa..",
67".aaaaaaa.", 61".aaaaaaa.",
68".........", 62".........",
69"........."}; 63"........."};
70 64
71int InputMethod::operator <(const InputMethod& o) const 65int InputMethod::operator <(const InputMethod& o) const
72{ 66{
73 return name() < o.name(); 67 return name() < o.name();
74} 68}
75int InputMethod::operator >(const InputMethod& o) const 69int InputMethod::operator >(const InputMethod& o) const
76{ 70{
77 return name() > o.name(); 71 return name() > o.name();
78} 72}
79int InputMethod::operator <=(const InputMethod& o) const 73int InputMethod::operator <=(const InputMethod& o) const
80{ 74{
81 return name() <= o.name(); 75 return name() <= o.name();
82} 76}
83 77
84 78
85/* 79/*
86 Slightly hacky: We use WStyle_Tool as a flag to say "this widget 80 Slightly hacky: We use WStyle_Tool as a flag to say "this widget
87 belongs to the IM system, so clicking it should not cause a reset". 81 belongs to the IM system, so clicking it should not cause a reset".
88 */ 82 */
89class IMToolButton : public QToolButton 83class IMToolButton : public QToolButton
90{ 84{
91public: 85public:
92 IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent ) 86 IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent )
93 { setWFlags( WStyle_Tool ); } 87 { setWFlags( WStyle_Tool ); }
94}; 88};
95 89
96 90
97InputMethods::InputMethods( QWidget *parent ) : 91InputMethods::InputMethods( QWidget *parent ) :
98 QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), 92 QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ),
99 mkeyboard(0), imethod(0) 93 mkeyboard(0), imethod(0)
100{ 94{
101 Config cfg( "Launcher" ); 95 Config cfg( "Launcher" );
102 cfg.setGroup( "InputMethods" ); 96 cfg.setGroup( "InputMethods" );
103 inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader | QWidget::WStyle_Tool; 97 inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader | QWidget::WStyle_Tool;
104 inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? QWidget::WStyle_DialogBorder : 0; 98 inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? QWidget::WStyle_DialogBorder : 0;
105 inputWidgetWidth = cfg.readNumEntry( "Width", 100 ); 99 inputWidgetWidth = cfg.readNumEntry( "Width", 100 );
106 100
107 setBackgroundMode( PaletteBackground ); 101 setBackgroundMode( PaletteBackground );
108 QHBoxLayout *hbox = new QHBoxLayout( this ); 102 QHBoxLayout *hbox = new QHBoxLayout( this );
109 103
110 kbdButton = new IMToolButton( this); 104 kbdButton = new IMToolButton( this);
111 kbdButton->setFocusPolicy(NoFocus); 105 kbdButton->setFocusPolicy(NoFocus);
112 kbdButton->setToggleButton( TRUE ); 106 kbdButton->setToggleButton( TRUE );
113 if (parent->sizeHint().height() > 0) 107 if (parent->sizeHint().height() > 0)
114 kbdButton->setFixedHeight( parent->sizeHint().height() ); 108 kbdButton->setFixedHeight( parent->sizeHint().height() );
115 kbdButton->setFixedWidth( 32 ); 109 kbdButton->setFixedWidth( 32 );
116 kbdButton->setAutoRaise( TRUE ); 110 kbdButton->setAutoRaise( TRUE );
117 kbdButton->setUsesBigPixmap( TRUE ); 111 kbdButton->setUsesBigPixmap( TRUE );
118 hbox->addWidget( kbdButton ); 112 hbox->addWidget( kbdButton );
119 connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); 113 connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) );
120 114
121 kbdChoice = new IMToolButton( this ); 115 kbdChoice = new IMToolButton( this );
122 kbdChoice->setFocusPolicy(NoFocus); 116 kbdChoice->setFocusPolicy(NoFocus);
123 kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); 117 kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) );
124 if (parent->sizeHint().height() > 0) 118 if (parent->sizeHint().height() > 0)
125 kbdChoice->setFixedHeight( parent->sizeHint().height() ); 119 kbdChoice->setFixedHeight( parent->sizeHint().height() );
126 kbdChoice->setFixedWidth( 13 ); 120 kbdChoice->setFixedWidth( 13 );
127 kbdChoice->setAutoRaise( TRUE ); 121 kbdChoice->setAutoRaise( TRUE );
128 hbox->addWidget( kbdChoice ); 122 hbox->addWidget( kbdChoice );
129 connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); 123 connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) );
130 124
131 connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), 125 connect( (QPEApplication*)qApp, SIGNAL(clientMoused()),
132 this, SLOT(resetStates()) ); 126 this, SLOT(resetStates()) );
133 127
134 128
diff --git a/core/launcher/irserver.cpp b/core/launcher/irserver.cpp
index 63f8d05..a0e9c16 100644
--- a/core/launcher/irserver.cpp
+++ b/core/launcher/irserver.cpp
@@ -1,77 +1,76 @@
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#include "irserver.h" 22#include "irserver.h"
23 23
24#include <qtopia/qlibrary.h> 24#include <qtopia/qlibrary.h>
25#include <qtopia/qpeapplication.h> 25#include <qtopia/qpeapplication.h>
26 26
27#include <qtranslator.h>
28 27
29#include "obexinterface.h" 28#include "obexinterface.h"
30 29
31#include <qdir.h> 30#include <qdir.h>
32 31
33IrServer::IrServer( QObject *parent, const char *name ) 32IrServer::IrServer( QObject *parent, const char *name )
34 : QObject( parent, name ), obexIface(0) 33 : QObject( parent, name ), obexIface(0)
35{ 34{
36 lib = 0; 35 lib = 0;
37 obexIface = 0; 36 obexIface = 0;
38 QString path = QPEApplication::qpeDir() + "/plugins/obex/"; 37 QString path = QPEApplication::qpeDir() + "/plugins/obex/";
39#ifdef Q_OS_MACX 38#ifdef Q_OS_MACX
40 QDir dir( path, "lib*.dylib" ); 39 QDir dir( path, "lib*.dylib" );
41#else 40#else
42 QDir dir( path, "lib*.so" ); 41 QDir dir( path, "lib*.so" );
43#endif /* Q_OS_MACX */ 42#endif /* Q_OS_MACX */
44 QStringList list = dir.entryList(); 43 QStringList list = dir.entryList();
45 QStringList::Iterator it; 44 QStringList::Iterator it;
46 for ( it = list.begin(); it != list.end(); ++it ) { 45 for ( it = list.begin(); it != list.end(); ++it ) {
47 QLibrary *trylib = new QLibrary( path + *it ); 46 QLibrary *trylib = new QLibrary( path + *it );
48 //qDebug("trying lib %s", (path + (*it)).latin1() ); 47 //qDebug("trying lib %s", (path + (*it)).latin1() );
49 if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) { 48 if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) {
50 lib = trylib; 49 lib = trylib;
51 //qDebug("found obex lib" ); 50 //qDebug("found obex lib" );
52 QString lang = getenv( "LANG" ); 51 QString lang = getenv( "LANG" );
53 QTranslator * trans = new QTranslator(qApp); 52 QTranslator * trans = new QTranslator(qApp);
54 QString type = (*it).left( (*it).find(".") ); 53 QString type = (*it).left( (*it).find(".") );
55 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 54 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
56 //qDebug("tr fpr obex: %s", tfn.latin1() ); 55 //qDebug("tr fpr obex: %s", tfn.latin1() );
57 if ( trans->load( tfn )) 56 if ( trans->load( tfn ))
58 qApp->installTranslator( trans ); 57 qApp->installTranslator( trans );
59 else 58 else
60 delete trans; 59 delete trans;
61 60
62 break; 61 break;
63 } else { 62 } else {
64 delete lib; 63 delete lib;
65 } 64 }
66 } 65 }
67 if ( !lib ) 66 if ( !lib )
68 qDebug("could not load IR plugin" ); 67 qDebug("could not load IR plugin" );
69} 68}
70 69
71IrServer::~IrServer() 70IrServer::~IrServer()
72{ 71{
73 if ( obexIface ) 72 if ( obexIface )
74 obexIface->release(); 73 obexIface->release();
75 delete lib; 74 delete lib;
76} 75}
77 76
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 984a57d..54efb0b 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -1,142 +1,140 @@
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 <qtopia/global.h> 21#include <qtopia/global.h>
22#ifdef Q_WS_QWS 22#ifdef Q_WS_QWS
23#include <qtopia/qcopenvelope_qws.h> 23#include <qtopia/qcopenvelope_qws.h>
24#endif 24#endif
25#include <qtopia/resource.h> 25#include <qtopia/resource.h>
26#include <qtopia/applnk.h> 26#include <qtopia/applnk.h>
27#include <qtopia/config.h> 27#include <qtopia/config.h>
28#include <qtopia/global.h>
29#include <qtopia/qpeapplication.h> 28#include <qtopia/qpeapplication.h>
30#include <qtopia/mimetype.h> 29#include <qtopia/mimetype.h>
31#include <qtopia/private/categories.h> 30#include <qtopia/private/categories.h>
32//#include <qtopia/custom.h> 31//#include <qtopia/custom.h>
33 32
34#include <qdir.h> 33#include <qdir.h>
35#ifdef Q_WS_QWS 34#ifdef Q_WS_QWS
36#include <qwindowsystem_qws.h> 35#include <qwindowsystem_qws.h>
37#endif 36#endif
38#include <qtimer.h> 37#include <qtimer.h>
39#include <qcombobox.h> 38#include <qcombobox.h>
40#include <qvbox.h> 39#include <qvbox.h>
41#include <qlayout.h> 40#include <qlayout.h>
42#include <qstyle.h> 41#include <qstyle.h>
43#include <qpushbutton.h> 42#include <qpushbutton.h>
44#include <qtabbar.h> 43#include <qtabbar.h>
45#include <qwidgetstack.h> 44#include <qwidgetstack.h>
46#include <qlayout.h>
47#include <qregexp.h> 45#include <qregexp.h>
48#include <qmessagebox.h> 46#include <qmessagebox.h>
49#include <qframe.h> 47#include <qframe.h>
50#include <qpainter.h> 48#include <qpainter.h>
51#include <qlabel.h> 49#include <qlabel.h>
52#include <qtextstream.h> 50#include <qtextstream.h>
53#include <qpopupmenu.h> 51#include <qpopupmenu.h>
54 52
55#include "startmenu.h" 53#include "startmenu.h"
56#include "taskbar.h" 54#include "taskbar.h"
57 55
58#include "serverinterface.h" 56#include "serverinterface.h"
59#include "launcherview.h" 57#include "launcherview.h"
60#include "launcher.h" 58#include "launcher.h"
61#include "server.h" 59#include "server.h"
62 60
63#define QTOPIA_INTERNAL_FSLP 61#define QTOPIA_INTERNAL_FSLP
64#include <qtopia/lnkproperties.h> 62#include <qtopia/lnkproperties.h>
65#include <stdlib.h> 63#include <stdlib.h>
66#include <assert.h> 64#include <assert.h>
67 65
68#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 66#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
69#include <unistd.h> 67#include <unistd.h>
70#include <stdio.h> 68#include <stdio.h>
71#include <sys/vfs.h> 69#include <sys/vfs.h>
72#include <mntent.h> 70#include <mntent.h>
73#endif 71#endif
74 72
75#ifdef Q_WS_QWS 73#ifdef Q_WS_QWS
76#include <qkeyboard_qws.h> 74#include <qkeyboard_qws.h>
77#include <qpe/lnkproperties.h> 75#include <qpe/lnkproperties.h>
78#endif 76#endif
79 77
80 78
81static bool isVisibleWindow( int ); 79static bool isVisibleWindow( int );
82//=========================================================================== 80//===========================================================================
83 81
84LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : 82LauncherTabWidget::LauncherTabWidget( Launcher* parent ) :
85 QVBox( parent ), docview( 0 ) 83 QVBox( parent ), docview( 0 )
86{ 84{
87 docLoadingWidgetEnabled = false; 85 docLoadingWidgetEnabled = false;
88 docLoadingWidget = 0; 86 docLoadingWidget = 0;
89 docLoadingWidgetProgress = 0; 87 docLoadingWidgetProgress = 0;
90 launcher = parent; 88 launcher = parent;
91 categoryBar = new LauncherTabBar( this ); 89 categoryBar = new LauncherTabBar( this );
92 QPalette pal = categoryBar->palette(); 90 QPalette pal = categoryBar->palette();
93 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); 91 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
94 pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); 92 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
95 categoryBar->setPalette( pal ); 93 categoryBar->setPalette( pal );
96 stack = new QWidgetStack(this); 94 stack = new QWidgetStack(this);
97 connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); 95 connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) );
98 categoryBar->show(); 96 categoryBar->show();
99 stack->show(); 97 stack->show();
100 98
101#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 99#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
102 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); 100 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this );
103 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 101 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
104 this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); 102 this, SLOT(launcherMessage(const QCString&, const QByteArray&)) );
105 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 103 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
106 this, SLOT(appMessage(const QCString&, const QByteArray&))); 104 this, SLOT(appMessage(const QCString&, const QByteArray&)));
107#endif 105#endif
108 106
109 createDocLoadingWidget(); 107 createDocLoadingWidget();
110} 108}
111 109
112void LauncherTabWidget::createDocLoadingWidget() 110void LauncherTabWidget::createDocLoadingWidget()
113{ 111{
114 // Construct the 'doc loading widget' shown when finding documents 112 // Construct the 'doc loading widget' shown when finding documents
115 113
116 // ### LauncherView class needs changing to be more generic so 114 // ### LauncherView class needs changing to be more generic so
117 // this widget can change its background similar to the iconviews 115 // this widget can change its background similar to the iconviews
118 // so the background for this matches 116 // so the background for this matches
119 docLoadingWidget = new LauncherView( stack ); 117 docLoadingWidget = new LauncherView( stack );
120 docLoadingWidget->hideIcons(); 118 docLoadingWidget->hideIcons();
121 QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); 119 QVBox *docLoadingVBox = new QVBox( docLoadingWidget );
122 120
123 docLoadingVBox->setSpacing( 20 ); 121 docLoadingVBox->setSpacing( 20 );
124 docLoadingVBox->setMargin( 10 ); 122 docLoadingVBox->setMargin( 10 );
125 123
126 QWidget *space1 = new QWidget( docLoadingVBox ); 124 QWidget *space1 = new QWidget( docLoadingVBox );
127 docLoadingVBox->setStretchFactor( space1, 1 ); 125 docLoadingVBox->setStretchFactor( space1, 1 );
128 126
129 QLabel *waitPixmap = new QLabel( docLoadingVBox ); 127 QLabel *waitPixmap = new QLabel( docLoadingVBox );
130 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); 128 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) );
131 waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); 129 waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) );
132 waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); 130 waitPixmap->setAlignment( int( QLabel::AlignCenter ) );
133 131
134 Config cfg( "Launcher" ); 132 Config cfg( "Launcher" );
135 cfg.setGroup( "DocTab" ); 133 cfg.setGroup( "DocTab" );
136 bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); 134 bool docTabEnabled = cfg.readBoolEntry( "Enable", true );
137 135
138 QLabel *textLabel = new QLabel( docLoadingVBox ); 136 QLabel *textLabel = new QLabel( docLoadingVBox );
139 textLabel->setAlignment( int( QLabel::AlignCenter ) ); 137 textLabel->setAlignment( int( QLabel::AlignCenter ) );
140 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); 138 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox );
141 docLoadingWidgetProgress->setProgress( 0 ); 139 docLoadingWidgetProgress->setProgress( 0 );
142 docLoadingWidgetProgress->setCenterIndicator( TRUE ); 140 docLoadingWidgetProgress->setCenterIndicator( TRUE );
diff --git a/core/launcher/launcherglobal.cpp b/core/launcher/launcherglobal.cpp
index 84caa93..9abcae9 100644
--- a/core/launcher/launcherglobal.cpp
+++ b/core/launcher/launcherglobal.cpp
@@ -1,83 +1,79 @@
1/* 1/*
2 * GPLv2 only 2 * GPLv2 only
3 * 3 *
4 * TT 2002-2002,2003 4 * TT 2002-2002,2003
5 */ 5 */
6#include <qstring.h>
7#include <qcstring.h>
8#include <qwidget.h>
9#include <qguardedptr.h>
10#include <qfile.h> 6#include <qfile.h>
11#include <qtextstream.h> 7#include <qtextstream.h>
12 8
13#include <qtopia/mimetype.h> 9#include <qtopia/mimetype.h>
14 10
15#include "launcherglobal.h" 11#include "launcherglobal.h"
16 12
17bool Opie::Global::isAppLnkFileName( const QString& file ) { 13bool Opie::Global::isAppLnkFileName( const QString& file ) {
18 if ( file.right(1) == "/" ) 14 if ( file.right(1) == "/" )
19 return FALSE; 15 return FALSE;
20 16
21 return file.find(MimeType::appsFolderName()+"/")==0; 17 return file.find(MimeType::appsFolderName()+"/")==0;
22} 18}
23 19
24QString Opie::Global::tempDir() { 20QString Opie::Global::tempDir() {
25 return QString::fromLatin1("/tmp/"); 21 return QString::fromLatin1("/tmp/");
26} 22}
27 23
28Global::Command* Opie::Global::builtinCommands() { 24Global::Command* Opie::Global::builtinCommands() {
29 return builtin; 25 return builtin;
30} 26}
31 27
32QGuardedPtr<QWidget>* Opie::Global::builtinRunning() { 28QGuardedPtr<QWidget>* Opie::Global::builtinRunning() {
33 return running; 29 return running;
34} 30}
35 31
36QString Opie::Global::uuid() { 32QString Opie::Global::uuid() {
37 QFile file( "/proc/sys/kernel/random/uuid" ); 33 QFile file( "/proc/sys/kernel/random/uuid" );
38 if (!file.open(IO_ReadOnly ) ) 34 if (!file.open(IO_ReadOnly ) )
39 return QString::null; 35 return QString::null;
40 36
41 QTextStream stream(&file); 37 QTextStream stream(&file);
42 38
43 return "{" + stream.read().stripWhiteSpace() + "}"; 39 return "{" + stream.read().stripWhiteSpace() + "}";
44} 40}
45 41
46QByteArray Opie::Global::encodeBase64(const QByteArray& origData ) { 42QByteArray Opie::Global::encodeBase64(const QByteArray& origData ) {
47// follows simple algorithm from rsync code 43// follows simple algorithm from rsync code
48 uchar *in = (uchar*)origData.data(); 44 uchar *in = (uchar*)origData.data();
49 45
50 int inbytes = origData.size(); 46 int inbytes = origData.size();
51 int outbytes = ((inbytes * 8) + 5) / 6; 47 int outbytes = ((inbytes * 8) + 5) / 6;
52 int padding = 4-outbytes%4; if ( padding == 4 ) padding = 0; 48 int padding = 4-outbytes%4; if ( padding == 4 ) padding = 0;
53 49
54 QByteArray outbuf(outbytes+padding); 50 QByteArray outbuf(outbytes+padding);
55 uchar* out = (uchar*)outbuf.data(); 51 uchar* out = (uchar*)outbuf.data();
56 52
57 const char *b64 = 53 const char *b64 =
58 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 54 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
59 55
60 for (int i = 0; i < outbytes; i++) { 56 for (int i = 0; i < outbytes; i++) {
61 int byte = (i * 6) / 8; 57 int byte = (i * 6) / 8;
62 int bit = (i * 6) % 8; 58 int bit = (i * 6) % 8;
63 if (bit < 3) { 59 if (bit < 3) {
64 if (byte < inbytes) 60 if (byte < inbytes)
65 *out = (b64[(in[byte] >> (2 - bit)) & 0x3F]); 61 *out = (b64[(in[byte] >> (2 - bit)) & 0x3F]);
66 } else { 62 } else {
67 if (byte + 1 == inbytes) { 63 if (byte + 1 == inbytes) {
68 *out = (b64[(in[byte] << (bit - 2)) & 0x3F]); 64 *out = (b64[(in[byte] << (bit - 2)) & 0x3F]);
69 } else { 65 } else {
70 *out = (b64[(in[byte] << (bit - 2) | 66 *out = (b64[(in[byte] << (bit - 2) |
71 in[byte + 1] >> (10 - bit)) & 0x3F]); 67 in[byte + 1] >> (10 - bit)) & 0x3F]);
72 } 68 }
73 } 69 }
74 ++out; 70 ++out;
75 } 71 }
76 ASSERT(out == (uchar*)outbuf.data() + outbuf.size() - padding); 72 ASSERT(out == (uchar*)outbuf.data() + outbuf.size() - padding);
77 while ( padding-- ) 73 while ( padding-- )
78 *out++='='; 74 *out++='=';
79 75
80 return outbuf; 76 return outbuf;
81} 77}
82 78
83 79
diff --git a/core/launcher/launchertab.cpp b/core/launcher/launchertab.cpp
index 10cfd5f..710f259 100644
--- a/core/launcher/launchertab.cpp
+++ b/core/launcher/launchertab.cpp
@@ -1,120 +1,117 @@
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#include "launchertab.h" 20#include "launchertab.h"
21#include <qapplication.h> 21#include <qapplication.h>
22#include <qstyle.h>
23#include <qpainter.h>
24#include <qbitmap.h>
25 22
26 23
27LauncherTabBar::LauncherTabBar( QWidget *parent, const char *name ) 24LauncherTabBar::LauncherTabBar( QWidget *parent, const char *name )
28 : QTabBar( parent, name ) 25 : QTabBar( parent, name )
29{ 26{
30 setFocusPolicy( NoFocus ); 27 setFocusPolicy( NoFocus );
31 connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); 28 connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) );
32} 29}
33 30
34LauncherTabBar::~LauncherTabBar() 31LauncherTabBar::~LauncherTabBar()
35{ 32{
36} 33}
37 34
38void LauncherTabBar::insertTab( LauncherTab *t, int index ) 35void LauncherTabBar::insertTab( LauncherTab *t, int index )
39{ 36{
40 if ( index < 0 ) 37 if ( index < 0 )
41 items.append( t ); 38 items.append( t );
42 else 39 else
43 items.insert( (uint)index, t ); 40 items.insert( (uint)index, t );
44 tabs.insert( t->type, t ); 41 tabs.insert( t->type, t );
45 QTabBar::insertTab( t, index ); 42 QTabBar::insertTab( t, index );
46} 43}
47 44
48void LauncherTabBar::removeTab( QTab *tab ) 45void LauncherTabBar::removeTab( QTab *tab )
49{ 46{
50 LauncherTab *t = (LauncherTab *)tab; 47 LauncherTab *t = (LauncherTab *)tab;
51 tabs.remove( t->type ); 48 tabs.remove( t->type );
52 items.remove( t ); 49 items.remove( t );
53 QTabBar::removeTab( t ); 50 QTabBar::removeTab( t );
54} 51}
55 52
56void LauncherTabBar::prevTab() 53void LauncherTabBar::prevTab()
57{ 54{
58 int n = count(); 55 int n = count();
59 int tab = currentTab(); 56 int tab = currentTab();
60 if ( tab >= 0 ) 57 if ( tab >= 0 )
61 setCurrentTab( (tab - 1 + n)%n ); 58 setCurrentTab( (tab - 1 + n)%n );
62} 59}
63 60
64void LauncherTabBar::nextTab() 61void LauncherTabBar::nextTab()
65{ 62{
66 int n = count(); 63 int n = count();
67 int tab = currentTab(); 64 int tab = currentTab();
68 setCurrentTab( (tab + 1)%n ); 65 setCurrentTab( (tab + 1)%n );
69} 66}
70 67
71void LauncherTabBar::showTab( const QString& id ) 68void LauncherTabBar::showTab( const QString& id )
72{ 69{
73 setCurrentTab( tabs[id] ); 70 setCurrentTab( tabs[id] );
74} 71}
75 72
76void LauncherTabBar::layoutTabs() 73void LauncherTabBar::layoutTabs()
77{ 74{
78 if ( !count() ) 75 if ( !count() )
79 return; 76 return;
80 77
81 int available = width()-1; 78 int available = width()-1;
82 79
83 QFontMetrics fm = fontMetrics(); 80 QFontMetrics fm = fontMetrics();
84 int hiddenTabWidth = -12; 81 int hiddenTabWidth = -12;
85 LauncherTab *current = currentLauncherTab(); 82 LauncherTab *current = currentLauncherTab();
86 int hframe, vframe, overlap; 83 int hframe, vframe, overlap;
87 style().tabbarMetrics( this, hframe, vframe, overlap ); 84 style().tabbarMetrics( this, hframe, vframe, overlap );
88 int x = 0; 85 int x = 0;
89 QRect r; 86 QRect r;
90 LauncherTab *t; 87 LauncherTab *t;
91 QListIterator< LauncherTab > it( items ); 88 QListIterator< LauncherTab > it( items );
92 int required = 0; 89 int required = 0;
93 int eventabwidth = (width()-1)/count(); 90 int eventabwidth = (width()-1)/count();
94 enum Mode { HideBackText, Pack, Even } mode=Even; 91 enum Mode { HideBackText, Pack, Even } mode=Even;
95 for (it.toFirst(); it.current(); ++it ) { 92 for (it.toFirst(); it.current(); ++it ) {
96 t = it.current(); 93 t = it.current();
97 if ( !t ) 94 if ( !t )
98 continue; 95 continue;
99 int iw = fm.width( t->text() ) + hframe - overlap; 96 int iw = fm.width( t->text() ) + hframe - overlap;
100 if ( t != current ) { 97 if ( t != current ) {
101 available -= hiddenTabWidth + hframe - overlap; 98 available -= hiddenTabWidth + hframe - overlap;
102 if ( t->iconSet() != 0 ) 99 if ( t->iconSet() != 0 )
103 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 100 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
104 } 101 }
105 if ( t->iconSet() != 0 ) 102 if ( t->iconSet() != 0 )
106 iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); 103 iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
107 required += iw; 104 required += iw;
108 // As space gets tight, packed looks better than even. "10" must be at least 0. 105 // As space gets tight, packed looks better than even. "10" must be at least 0.
109 if ( iw >= eventabwidth-10 ) 106 if ( iw >= eventabwidth-10 )
110 mode = Pack; 107 mode = Pack;
111 } 108 }
112 if ( mode == Pack && required > width()-1 ) 109 if ( mode == Pack && required > width()-1 )
113 mode = HideBackText; 110 mode = HideBackText;
114 for ( it.toFirst(); it.current(); ++it ) { 111 for ( it.toFirst(); it.current(); ++it ) {
115 t = it.current(); 112 t = it.current();
116 if ( !t ) 113 if ( !t )
117 continue; 114 continue;
118 if ( mode != HideBackText ) { 115 if ( mode != HideBackText ) {
119 int w = fm.width( t->text() ); 116 int w = fm.width( t->text() );
120 int ih = 0; 117 int ih = 0;
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 62c678d..513b1bd 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -1,142 +1,128 @@
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 "launcherview.h" 21#include "launcherview.h"
22 22
23#include <qtopia/qpeapplication.h> 23#include <qtopia/qpeapplication.h>
24#include <qtopia/applnk.h>
25#include <qtopia/qpedebug.h>
26#include <qtopia/private/categories.h> 24#include <qtopia/private/categories.h>
27#include <qtopia/categoryselect.h> 25#include <qtopia/categoryselect.h>
28#include <qtopia/menubutton.h>
29#include <qtopia/mimetype.h> 26#include <qtopia/mimetype.h>
30#include <qtopia/resource.h> 27#include <qtopia/resource.h>
31#include <qtopia/qpetoolbar.h>
32//#include <qtopia/private/palmtoprecord.h> 28//#include <qtopia/private/palmtoprecord.h>
33 29
34#include <qtimer.h> 30#include <qtimer.h>
35#include <qtextstream.h>
36#include <qdict.h>
37#include <qfile.h>
38#include <qfileinfo.h> 31#include <qfileinfo.h>
39#include <qhbox.h>
40#include <qiconview.h> 32#include <qiconview.h>
41#include <qwidgetstack.h>
42#include <qpainter.h>
43#include <qregexp.h>
44#include <qtoolbutton.h>
45#include <qimage.h>
46#include <qlabel.h>
47#include <qobjectlist.h> 33#include <qobjectlist.h>
48 34
49 35
50// These define how the busy icon is animated and highlighted 36// These define how the busy icon is animated and highlighted
51#define BRIGHTEN_BUSY_ICON 37#define BRIGHTEN_BUSY_ICON
52//#define ALPHA_FADE_BUSY_ICON 38//#define ALPHA_FADE_BUSY_ICON
53//#define USE_ANIMATED_BUSY_ICON_OVERLAY 39//#define USE_ANIMATED_BUSY_ICON_OVERLAY
54#define BOUNCE_BUSY_ICON 40#define BOUNCE_BUSY_ICON
55 41
56 42
57class BgPixmap 43class BgPixmap
58{ 44{
59public: 45public:
60 BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} 46 BgPixmap( const QPixmap &p ) : pm(p), ref(1) {}
61 QPixmap pm; 47 QPixmap pm;
62 int ref; 48 int ref;
63}; 49};
64 50
65 51
66static QMap<QString,BgPixmap*> *bgCache = 0; 52static QMap<QString,BgPixmap*> *bgCache = 0;
67 53
68static void cleanup_cache() 54static void cleanup_cache()
69{ 55{
70 QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); 56 QMap<QString,BgPixmap*>::Iterator it = bgCache->begin();
71 while ( it != bgCache->end() ) { 57 while ( it != bgCache->end() ) {
72 QMap<QString,BgPixmap*>::Iterator curr = it; 58 QMap<QString,BgPixmap*>::Iterator curr = it;
73 ++it; 59 ++it;
74 delete (*curr); 60 delete (*curr);
75 bgCache->remove( curr ); 61 bgCache->remove( curr );
76 } 62 }
77 delete bgCache; 63 delete bgCache;
78 bgCache = 0; 64 bgCache = 0;
79} 65}
80 66
81 67
82class LauncherItem : public QIconViewItem 68class LauncherItem : public QIconViewItem
83{ 69{
84public: 70public:
85 LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE ); 71 LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE );
86 ~LauncherItem(); 72 ~LauncherItem();
87 73
88 AppLnk *appLnk() const { return app; } 74 AppLnk *appLnk() const { return app; }
89 AppLnk *takeAppLnk() { AppLnk* r=app; app=0; return r; } 75 AppLnk *takeAppLnk() { AppLnk* r=app; app=0; return r; }
90 76
91 void animateIcon(); 77 void animateIcon();
92 void resetIcon(); 78 void resetIcon();
93 79
94 virtual int compare ( QIconViewItem * i ) const; 80 virtual int compare ( QIconViewItem * i ) const;
95 void paintItem( QPainter *p, const QColorGroup &cg ); 81 void paintItem( QPainter *p, const QColorGroup &cg );
96 82
97 void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } 83 void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; }
98protected: 84protected:
99 bool isBigIcon; 85 bool isBigIcon;
100 int iteration; 86 int iteration;
101 AppLnk* app; 87 AppLnk* app;
102private: 88private:
103 void paintAnimatedIcon( QPainter *p ); 89 void paintAnimatedIcon( QPainter *p );
104 BusyIndicatorType busyType; 90 BusyIndicatorType busyType;
105}; 91};
106 92
107 93
108class LauncherIconView : public QIconView { 94class LauncherIconView : public QIconView {
109public: 95public:
110 LauncherIconView( QWidget* parent, const char* name=0 ) : 96 LauncherIconView( QWidget* parent, const char* name=0 ) :
111 QIconView(parent,name), 97 QIconView(parent,name),
112 tf(""), 98 tf(""),
113 cf(0), 99 cf(0),
114 bsy(0), 100 bsy(0),
115 busyTimer(0), 101 busyTimer(0),
116 bigIcns(TRUE), 102 bigIcns(TRUE),
117 bgColor(white) 103 bgColor(white)
118 { 104 {
119 sortmeth = Name; 105 sortmeth = Name;
120 hidden.setAutoDelete(TRUE); 106 hidden.setAutoDelete(TRUE);
121 ike = FALSE; 107 ike = FALSE;
122 calculateGrid( Bottom ); 108 calculateGrid( Bottom );
123 } 109 }
124 110
125 ~LauncherIconView() 111 ~LauncherIconView()
126 { 112 {
127#if 0 // debuggery 113#if 0 // debuggery
128 QListIterator<AppLnk> it(hidden); 114 QListIterator<AppLnk> it(hidden);
129 AppLnk* l; 115 AppLnk* l;
130 while ((l=it.current())) { 116 while ((l=it.current())) {
131 ++it; 117 ++it;
132 //qDebug("%p: hidden (should remove)",l); 118 //qDebug("%p: hidden (should remove)",l);
133 } 119 }
134#endif 120#endif
135 } 121 }
136 122
137 QIconViewItem* busyItem() const { return bsy; } 123 QIconViewItem* busyItem() const { return bsy; }
138#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 124#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
139 QPixmap busyPixmap() const { return busyPix; } 125 QPixmap busyPixmap() const { return busyPix; }
140#endif 126#endif
141 void setBigIcons( bool bi ) { 127 void setBigIcons( bool bi ) {
142 bigIcns = bi; 128 bigIcns = bi;
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index 9e53bb0..c136bd9 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -1,135 +1,130 @@
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#ifndef QTOPIA_INTERNAL_FILEOPERATIONS 21#ifndef QTOPIA_INTERNAL_FILEOPERATIONS
22#define QTOPIA_INTERNAL_FILEOPERATIONS 22#define QTOPIA_INTERNAL_FILEOPERATIONS
23#endif 23#endif
24#include "server.h" 24#include "server.h"
25#include "serverapp.h" 25#include "serverapp.h"
26#include "taskbar.h"
27#include "stabmon.h" 26#include "stabmon.h"
28#include "launcher.h"
29#include "firstuse.h" 27#include "firstuse.h"
30 28
31#include <opie2/oglobal.h> 29#include <opie2/oglobal.h>
32 30
33#include <qtopia/qpeapplication.h>
34#include <qtopia/network.h> 31#include <qtopia/network.h>
35#include <qtopia/config.h>
36//#include <qtopia/custom.h> 32//#include <qtopia/custom.h>
37 33
38 34
39#include <qfile.h>
40#include <qdir.h> 35#include <qdir.h>
41#ifdef QWS 36#ifdef QWS
42#include <qwindowsystem_qws.h> 37#include <qwindowsystem_qws.h>
43#include <qtopia/qcopenvelope_qws.h> 38#include <qtopia/qcopenvelope_qws.h>
44#endif 39#endif
45#include <qtopia/alarmserver.h> 40#include <qtopia/alarmserver.h>
46 41
47#include <stdlib.h> 42#include <stdlib.h>
48#include <stdio.h> 43#include <stdio.h>
49#include <signal.h> 44#include <signal.h>
50#ifndef Q_OS_WIN32 45#ifndef Q_OS_WIN32
51#include <unistd.h> 46#include <unistd.h>
52#else 47#else
53#include <process.h> 48#include <process.h>
54#endif 49#endif
55 50
56#include "calibrate.h" 51#include "calibrate.h"
57 52
58 53
59#ifdef QT_QWS_LOGIN 54#ifdef QT_QWS_LOGIN
60#include "../login/qdmdialogimpl.h" 55#include "../login/qdmdialogimpl.h"
61#endif 56#endif
62 57
63#ifdef Q_WS_QWS 58#ifdef Q_WS_QWS
64#include <qkeyboard_qws.h> 59#include <qkeyboard_qws.h>
65#endif 60#endif
66 61
67#include <qmessagebox.h> 62#include <qmessagebox.h>
68#include <opie2/odevice.h> 63#include <opie2/odevice.h>
69 64
70using namespace Opie; 65using namespace Opie;
71 66
72 67
73static void cleanup() 68static void cleanup()
74{ 69{
75 QDir dir( "/tmp", "qcop-msg-*" ); 70 QDir dir( "/tmp", "qcop-msg-*" );
76 71
77 QStringList stale = dir.entryList(); 72 QStringList stale = dir.entryList();
78 QStringList::Iterator it; 73 QStringList::Iterator it;
79 for ( it = stale.begin(); it != stale.end(); ++it ) { 74 for ( it = stale.begin(); it != stale.end(); ++it ) {
80 dir.remove( *it ); 75 dir.remove( *it );
81 } 76 }
82} 77}
83 78
84static void refreshTimeZoneConfig() 79static void refreshTimeZoneConfig()
85{ 80{
86 /* ### FIXME timezone handling */ 81 /* ### FIXME timezone handling */
87#if 0 82#if 0
88 // We need to help WorldTime in setting up its configuration for 83 // We need to help WorldTime in setting up its configuration for
89 // the current translation 84 // the current translation
90 // BEGIN no tr 85 // BEGIN no tr
91 const char *defaultTz[] = { 86 const char *defaultTz[] = {
92 "America/New_York", 87 "America/New_York",
93 "America/Los_Angeles", 88 "America/Los_Angeles",
94 "Europe/Oslo", 89 "Europe/Oslo",
95 "Asia/Tokyo", 90 "Asia/Tokyo",
96 "Asia/Hong_Kong", 91 "Asia/Hong_Kong",
97 "Australia/Brisbane", 92 "Australia/Brisbane",
98 0 93 0
99 }; 94 };
100 // END no tr 95 // END no tr
101 96
102 TimeZone curZone; 97 TimeZone curZone;
103 QString zoneID; 98 QString zoneID;
104 int zoneIndex; 99 int zoneIndex;
105 Config cfg = Config( "WorldTime" ); 100 Config cfg = Config( "WorldTime" );
106 cfg.setGroup( "TimeZones" ); 101 cfg.setGroup( "TimeZones" );
107 if (!cfg.hasKey( "Zone0" )){ 102 if (!cfg.hasKey( "Zone0" )){
108 // We have no existing timezones use the defaults which are untranslated strings 103 // We have no existing timezones use the defaults which are untranslated strings
109 QString currTz = TimeZone::current().id(); 104 QString currTz = TimeZone::current().id();
110 QStringList zoneDefaults; 105 QStringList zoneDefaults;
111 zoneDefaults.append( currTz ); 106 zoneDefaults.append( currTz );
112 for ( int i = 0; defaultTz[i] && zoneDefaults.count() < 6; i++ ) { 107 for ( int i = 0; defaultTz[i] && zoneDefaults.count() < 6; i++ ) {
113 if ( defaultTz[i] != currTz ) 108 if ( defaultTz[i] != currTz )
114 zoneDefaults.append( defaultTz[i] ); 109 zoneDefaults.append( defaultTz[i] );
115 } 110 }
116 zoneIndex = 0; 111 zoneIndex = 0;
117 for (QStringList::Iterator it = zoneDefaults.begin(); it != zoneDefaults.end() ; ++it){ 112 for (QStringList::Iterator it = zoneDefaults.begin(); it != zoneDefaults.end() ; ++it){
118 cfg.writeEntry( "Zone" + QString::number( zoneIndex ) , *it); 113 cfg.writeEntry( "Zone" + QString::number( zoneIndex ) , *it);
119 zoneIndex++; 114 zoneIndex++;
120 } 115 }
121 } 116 }
122 // We have an existing list of timezones refresh the 117 // We have an existing list of timezones refresh the
123 // translations of TimeZone name 118 // translations of TimeZone name
124 zoneIndex = 0; 119 zoneIndex = 0;
125 while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){ 120 while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){
126 zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex )); 121 zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex ));
127 curZone = TimeZone( zoneID ); 122 curZone = TimeZone( zoneID );
128 if ( !curZone.isValid() ){ 123 if ( !curZone.isValid() ){
129 qDebug( "initEnvironment() Invalid TimeZone %s", zoneID.latin1() ); 124 qDebug( "initEnvironment() Invalid TimeZone %s", zoneID.latin1() );
130 break; 125 break;
131 } 126 }
132 cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() ); 127 cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() );
133 zoneIndex++; 128 zoneIndex++;
134 } 129 }
135#endif 130#endif
diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp
index bf34368..321b5dd 100644
--- a/core/launcher/packageslave.cpp
+++ b/core/launcher/packageslave.cpp
@@ -1,130 +1,128 @@
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 "packageslave.h" 21#include "packageslave.h"
22#include <qtopia/qprocess.h> 22#include <qtopia/qprocess.h>
23 23
24#ifdef Q_WS_QWS 24#ifdef Q_WS_QWS
25#include <qtopia/qcopenvelope_qws.h> 25#include <qtopia/qcopenvelope_qws.h>
26#endif 26#endif
27 27
28#include <qdatastream.h>
29#ifdef Q_WS_QWS 28#ifdef Q_WS_QWS
30#include <qcopchannel_qws.h> 29#include <qcopchannel_qws.h>
31#endif 30#endif
32 31
33#include <qtextstream.h> 32#include <qtextstream.h>
34#include <qdir.h>
35 33
36#include <stdlib.h> 34#include <stdlib.h>
37#include <sys/stat.h> // mkdir() 35#include <sys/stat.h> // mkdir()
38 36
39#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 37#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
40#include <unistd.h> 38#include <unistd.h>
41#include <sys/vfs.h> 39#include <sys/vfs.h>
42#include <mntent.h> 40#include <mntent.h>
43#elif defined(Q_OS_WIN32) 41#elif defined(Q_OS_WIN32)
44#include <windows.h> 42#include <windows.h>
45#include <winbase.h> 43#include <winbase.h>
46#elif defined(Q_OS_MACX) 44#elif defined(Q_OS_MACX)
47#include <unistd.h> 45#include <unistd.h>
48#endif 46#endif
49 47
50 48
51PackageHandler::PackageHandler( QObject *parent, char* name ) 49PackageHandler::PackageHandler( QObject *parent, char* name )
52 : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE ) 50 : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE )
53{ 51{
54 // setup qcop channel 52 // setup qcop channel
55#ifndef QT_NO_COP 53#ifndef QT_NO_COP
56 packageChannel = new QCopChannel( "QPE/Package", this ); 54 packageChannel = new QCopChannel( "QPE/Package", this );
57 connect( packageChannel, SIGNAL( received(const QCString &, const QByteArray &) ), 55 connect( packageChannel, SIGNAL( received(const QCString &, const QByteArray &) ),
58 this, SLOT( qcopMessage( const QCString &, const QByteArray &) ) ); 56 this, SLOT( qcopMessage( const QCString &, const QByteArray &) ) );
59#endif 57#endif
60} 58}
61 59
62void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data ) 60void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data )
63{ 61{
64 QDataStream stream( data, IO_ReadOnly ); 62 QDataStream stream( data, IO_ReadOnly );
65 63
66 if ( msg == "installPackage(QString)" ) { 64 if ( msg == "installPackage(QString)" ) {
67 QString file; 65 QString file;
68 stream >> file; 66 stream >> file;
69 installPackage( file ); 67 installPackage( file );
70 } else if ( msg == "removePackage(QString)" ) { 68 } else if ( msg == "removePackage(QString)" ) {
71 QString file; 69 QString file;
72 stream >> file; 70 stream >> file;
73 removePackage( file ); 71 removePackage( file );
74 } else if ( msg == "addPackageFiles(QString,QString)" ) { 72 } else if ( msg == "addPackageFiles(QString,QString)" ) {
75 QString location, listfile; 73 QString location, listfile;
76 stream >> location >> listfile; 74 stream >> location >> listfile;
77 addPackageFiles( location, listfile); 75 addPackageFiles( location, listfile);
78 } else if ( msg == "addPackages(QString)" ) { 76 } else if ( msg == "addPackages(QString)" ) {
79 QString location; 77 QString location;
80 stream >> location; 78 stream >> location;
81 addPackages( location ); 79 addPackages( location );
82 } else if ( msg == "cleanupPackageFiles(QString)" ) { 80 } else if ( msg == "cleanupPackageFiles(QString)" ) {
83 QString listfile; 81 QString listfile;
84 stream >> listfile; 82 stream >> listfile;
85 cleanupPackageFiles( listfile ); 83 cleanupPackageFiles( listfile );
86 } else if ( msg == "cleanupPackages(QString)" ) { 84 } else if ( msg == "cleanupPackages(QString)" ) {
87 QString location; 85 QString location;
88 stream >> location; 86 stream >> location;
89 cleanupPackages( location ); 87 cleanupPackages( location );
90 } else if ( msg == "prepareInstall(QString,QString)" ) { 88 } else if ( msg == "prepareInstall(QString,QString)" ) {
91 QString size, path; 89 QString size, path;
92 stream >> size; 90 stream >> size;
93 stream >> path; 91 stream >> path;
94 prepareInstall( size, path ); 92 prepareInstall( size, path );
95 } 93 }
96} 94}
97 95
98void PackageHandler::installPackage( const QString &package ) 96void PackageHandler::installPackage( const QString &package )
99{ 97{
100 if ( mNoSpaceLeft ) { 98 if ( mNoSpaceLeft ) {
101 mNoSpaceLeft = FALSE; 99 mNoSpaceLeft = FALSE;
102 // Don't emit that for now, I still couldn't test it (Wener) 100 // Don't emit that for now, I still couldn't test it (Wener)
103 //sendReply( "installFailed(QString)", package ); 101 //sendReply( "installFailed(QString)", package );
104 //return; 102 //return;
105 } 103 }
106 104
107 currentProcess = new QProcess( QStringList() << "ipkg" << "install" << package ); // No tr 105 currentProcess = new QProcess( QStringList() << "ipkg" << "install" << package ); // No tr
108 connect( currentProcess, SIGNAL( processExited() ), SLOT( iProcessExited() ) ); 106 connect( currentProcess, SIGNAL( processExited() ), SLOT( iProcessExited() ) );
109 connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) ); 107 connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) );
110 connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) ); 108 connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) );
111 currentPackage = package; 109 currentPackage = package;
112 110
113 currentProcessError=""; 111 currentProcessError="";
114 sendReply( "installStarted(QString)", package ); 112 sendReply( "installStarted(QString)", package );
115 currentProcess->start(); 113 currentProcess->start();
116} 114}
117 115
118void PackageHandler::removePackage( const QString &package ) 116void PackageHandler::removePackage( const QString &package )
119{ 117{
120 currentProcess = new QProcess( QStringList() << "ipkg" << "remove" << package ); // No tr 118 currentProcess = new QProcess( QStringList() << "ipkg" << "remove" << package ); // No tr
121 connect( currentProcess, SIGNAL( processExited() ), SLOT( rmProcessExited() ) ); 119 connect( currentProcess, SIGNAL( processExited() ), SLOT( rmProcessExited() ) );
122 connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) ); 120 connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) );
123 connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) ); 121 connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) );
124 currentPackage = package; 122 currentPackage = package;
125 123
126 currentProcessError=""; 124 currentProcessError="";
127 sendReply( "removeStarted(QString)", package ); 125 sendReply( "removeStarted(QString)", package );
128 currentProcess->start(); 126 currentProcess->start();
129} 127}
130 128
diff --git a/core/launcher/qcopbridge.cpp b/core/launcher/qcopbridge.cpp
index 9bca360..24f471d 100644
--- a/core/launcher/qcopbridge.cpp
+++ b/core/launcher/qcopbridge.cpp
@@ -1,137 +1,129 @@
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#include <opie2/oglobal.h> 24#include <opie2/oglobal.h>
25 25
26#ifdef Q_WS_QWS 26#ifdef Q_WS_QWS
27#include <qtopia/qcopenvelope_qws.h> 27#include <qtopia/qcopenvelope_qws.h>
28#endif 28#endif
29#include <qtopia/qpeapplication.h> 29#include <qtopia/qpeapplication.h>
30 30
31#include <qtopia/version.h> 31#include <qtopia/version.h>
32#include <qtopia/config.h>
33 32
34#include <qdir.h>
35#include <qfile.h>
36#include <qtextstream.h> 33#include <qtextstream.h>
37#include <qdatastream.h>
38#include <qcstring.h>
39#include <qstringlist.h>
40#include <qfileinfo.h>
41#include <qregexp.h>
42#include <qtimer.h> 34#include <qtimer.h>
43#ifdef Q_WS_QWS 35#ifdef Q_WS_QWS
44#include <qcopchannel_qws.h> 36#include <qcopchannel_qws.h>
45#endif 37#endif
46 38
47#ifndef _XOPEN_SOURCE 39#ifndef _XOPEN_SOURCE
48#define _XOPEN_SOURCE 40#define _XOPEN_SOURCE
49#endif 41#endif
50#ifndef Q_OS_WIN32 42#ifndef Q_OS_WIN32
51#include <pwd.h> 43#include <pwd.h>
52#include <unistd.h> 44#include <unistd.h>
53#include <sys/types.h> 45#include <sys/types.h>
54#endif 46#endif
55 47
56#if defined(_OS_LINUX_) 48#if defined(_OS_LINUX_)
57#include <shadow.h> 49#include <shadow.h>
58#endif 50#endif
59 51
60 52
61//#define INSECURE 53//#define INSECURE
62 54
63const int block_size = 51200; 55const int block_size = 51200;
64 56
65QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent, 57QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent,
66 const char* name ) 58 const char* name )
67 : QServerSocket( port, 1, parent, name ), 59 : QServerSocket( port, 1, parent, name ),
68 desktopChannel( 0 ), 60 desktopChannel( 0 ),
69 cardChannel( 0 ) 61 cardChannel( 0 )
70{ 62{
71 if ( !ok() ) 63 if ( !ok() )
72 qWarning( "Failed to bind to port %d", port ); 64 qWarning( "Failed to bind to port %d", port );
73 else { 65 else {
74#ifndef QT_NO_COP 66#ifndef QT_NO_COP
75 desktopChannel = new QCopChannel( "QPE/Desktop", this ); 67 desktopChannel = new QCopChannel( "QPE/Desktop", this );
76 connect( desktopChannel, SIGNAL(received(const QCString &, const QByteArray &)), 68 connect( desktopChannel, SIGNAL(received(const QCString &, const QByteArray &)),
77 this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); 69 this, SLOT(desktopMessage( const QCString &, const QByteArray &)) );
78 cardChannel = new QCopChannel( "QPE/Card", this ); 70 cardChannel = new QCopChannel( "QPE/Card", this );
79 connect( cardChannel, SIGNAL(received(const QCString &, const QByteArray &)), 71 connect( cardChannel, SIGNAL(received(const QCString &, const QByteArray &)),
80 this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); 72 this, SLOT(desktopMessage( const QCString &, const QByteArray &)) );
81#endif 73#endif
82 } 74 }
83 sendSync = FALSE; 75 sendSync = FALSE;
84 openConnections.setAutoDelete( TRUE ); 76 openConnections.setAutoDelete( TRUE );
85 authorizeConnections(); 77 authorizeConnections();
86} 78}
87 79
88QCopBridge::~QCopBridge() 80QCopBridge::~QCopBridge()
89{ 81{
90#ifndef QT_NO_COP 82#ifndef QT_NO_COP
91 delete desktopChannel; 83 delete desktopChannel;
92#endif 84#endif
93} 85}
94 86
95void QCopBridge::authorizeConnections() 87void QCopBridge::authorizeConnections()
96{ 88{
97 Config cfg("Security"); 89 Config cfg("Security");
98 cfg.setGroup("SyncMode"); 90 cfg.setGroup("SyncMode");
99 m_mode = Mode(cfg.readNumEntry("Mode", Sharp )); 91 m_mode = Mode(cfg.readNumEntry("Mode", Sharp ));
100 QListIterator<QCopBridgePI> it(openConnections); 92 QListIterator<QCopBridgePI> it(openConnections);
101 while ( it.current() ) { 93 while ( it.current() ) {
102 if ( !it.current()->verifyAuthorised() ) { 94 if ( !it.current()->verifyAuthorised() ) {
103 disconnect ( it.current(), SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( closed( QCopBridgePI *) ) ); 95 disconnect ( it.current(), SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( closed( QCopBridgePI *) ) );
104 openConnections.removeRef( it.current() ); 96 openConnections.removeRef( it.current() );
105 } else 97 } else
106 ++it; 98 ++it;
107 } 99 }
108} 100}
109 101
110void QCopBridge::newConnection( int socket ) 102void QCopBridge::newConnection( int socket )
111{ 103{
112 QCopBridgePI *pi = new QCopBridgePI( socket, this ); 104 QCopBridgePI *pi = new QCopBridgePI( socket, this );
113 openConnections.append( pi ); 105 openConnections.append( pi );
114 connect ( pi, SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( closed( QCopBridgePI *) ) ); 106 connect ( pi, SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( closed( QCopBridgePI *) ) );
115 107
116 /* ### libqtopia merge FIXME */ 108 /* ### libqtopia merge FIXME */
117#if 0 109#if 0
118 QPEApplication::setTempScreenSaverMode( QPEApplication::DisableSuspend ); 110 QPEApplication::setTempScreenSaverMode( QPEApplication::DisableSuspend );
119#endif 111#endif
120#ifndef QT_NO_COP 112#ifndef QT_NO_COP
121 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; 113 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
122#endif 114#endif
123 115
124 if ( sendSync ) { 116 if ( sendSync ) {
125 pi ->startSync(); 117 pi ->startSync();
126 sendSync = FALSE; 118 sendSync = FALSE;
127 } 119 }
128} 120}
129 121
130void QCopBridge::closed( QCopBridgePI *pi ) 122void QCopBridge::closed( QCopBridgePI *pi )
131{ 123{
132 emit connectionClosed( pi->peerAddress() ); 124 emit connectionClosed( pi->peerAddress() );
133 openConnections.removeRef( pi ); 125 openConnections.removeRef( pi );
134 if ( openConnections.count() == 0 ) { 126 if ( openConnections.count() == 0 ) {
135 /* ### FIXME libqtopia merge */ 127 /* ### FIXME libqtopia merge */
136#if 0 128#if 0
137 QPEApplication::setTempScreenSaverMode( QPEApplication::Enable ); 129 QPEApplication::setTempScreenSaverMode( QPEApplication::Enable );
diff --git a/core/launcher/runningappbar.cpp b/core/launcher/runningappbar.cpp
index 1fda5a4..11d10dc 100644
--- a/core/launcher/runningappbar.cpp
+++ b/core/launcher/runningappbar.cpp
@@ -1,131 +1,124 @@
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#define QTOPIA_INTERNAL_PRELOADACCESS 21#define QTOPIA_INTERNAL_PRELOADACCESS
22 22
23#include <qtopia/global.h>
24 23
25#include <stdlib.h> 24#include <stdlib.h>
26 25
27#include <qtimer.h>
28#include <qpopupmenu.h>
29#include <qpainter.h> 26#include <qpainter.h>
30#include <qmessagebox.h>
31 27
32#include <qtopia/qpeapplication.h>
33#include <qtopia/applnk.h>
34#include <qtopia/qcopenvelope_qws.h> 28#include <qtopia/qcopenvelope_qws.h>
35#include <qtopia/mimetype.h>
36 29
37#include "runningappbar.h" 30#include "runningappbar.h"
38#include "serverinterface.h" 31#include "serverinterface.h"
39 32
40RunningAppBar::RunningAppBar(QWidget* parent) 33RunningAppBar::RunningAppBar(QWidget* parent)
41 : QFrame(parent), selectedAppIndex(-1) 34 : QFrame(parent), selectedAppIndex(-1)
42{ 35{
43 QCopChannel* channel = new QCopChannel( "QPE/System", this ); 36 QCopChannel* channel = new QCopChannel( "QPE/System", this );
44 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 37 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
45 this, SLOT(received(const QCString&, const QByteArray&)) ); 38 this, SLOT(received(const QCString&, const QByteArray&)) );
46 39
47 spacing = AppLnk::smallIconSize()+3; 40 spacing = AppLnk::smallIconSize()+3;
48} 41}
49 42
50RunningAppBar::~RunningAppBar() 43RunningAppBar::~RunningAppBar()
51{ 44{
52} 45}
53 46
54void RunningAppBar::received(const QCString& msg, const QByteArray& data) { 47void RunningAppBar::received(const QCString& msg, const QByteArray& data) {
55 // Since fast apps appear and disappear without disconnecting from their 48 // Since fast apps appear and disappear without disconnecting from their
56 // channel we need to watch for the showing/hiding events and update according. 49 // channel we need to watch for the showing/hiding events and update according.
57 QDataStream stream( data, IO_ReadOnly ); 50 QDataStream stream( data, IO_ReadOnly );
58 if ( msg == "fastAppShowing(QString)") { 51 if ( msg == "fastAppShowing(QString)") {
59 QString appName; 52 QString appName;
60 stream >> appName; 53 stream >> appName;
61 // qDebug("fastAppShowing %s", appName.data() ); 54 // qDebug("fastAppShowing %s", appName.data() );
62 const AppLnk* f = ServerInterface::appLnks().findExec(appName); 55 const AppLnk* f = ServerInterface::appLnks().findExec(appName);
63 if ( f ) addTask(*f); 56 if ( f ) addTask(*f);
64 } else if ( msg == "fastAppHiding(QString)") { 57 } else if ( msg == "fastAppHiding(QString)") {
65 QString appName; 58 QString appName;
66 stream >> appName; 59 stream >> appName;
67 const AppLnk* f = ServerInterface::appLnks().findExec(appName); 60 const AppLnk* f = ServerInterface::appLnks().findExec(appName);
68 if ( f ) removeTask(*f); 61 if ( f ) removeTask(*f);
69 } 62 }
70} 63}
71 64
72void RunningAppBar::addTask(const AppLnk& appLnk) { 65void RunningAppBar::addTask(const AppLnk& appLnk) {
73 qDebug("Added %s to app list.", appLnk.name().latin1()); 66 qDebug("Added %s to app list.", appLnk.name().latin1());
74 AppLnk* newApp = new AppLnk(appLnk); 67 AppLnk* newApp = new AppLnk(appLnk);
75 newApp->setExec(appLnk.exec()); 68 newApp->setExec(appLnk.exec());
76 appList.prepend(newApp); 69 appList.prepend(newApp);
77 update(); 70 update();
78} 71}
79 72
80void RunningAppBar::removeTask(const AppLnk& appLnk) { 73void RunningAppBar::removeTask(const AppLnk& appLnk) {
81 unsigned int i = 0; 74 unsigned int i = 0;
82 for (; i < appList.count() ; i++) { 75 for (; i < appList.count() ; i++) {
83 AppLnk* target = appList.at(i); 76 AppLnk* target = appList.at(i);
84 if (target->exec() == appLnk.exec()) { 77 if (target->exec() == appLnk.exec()) {
85 qDebug("Removing %s from app list.", appLnk.name().latin1()); 78 qDebug("Removing %s from app list.", appLnk.name().latin1());
86 appList.remove(); 79 appList.remove();
87 delete target; 80 delete target;
88 } 81 }
89 } 82 }
90 update(); 83 update();
91} 84}
92 85
93void RunningAppBar::mousePressEvent(QMouseEvent *e) 86void RunningAppBar::mousePressEvent(QMouseEvent *e)
94{ 87{
95 // Find out if the user is clicking on an app icon... 88 // Find out if the user is clicking on an app icon...
96 // If so, snag the index so when we repaint we show it 89 // If so, snag the index so when we repaint we show it
97 // as highlighed. 90 // as highlighed.
98 selectedAppIndex = 0; 91 selectedAppIndex = 0;
99 int x=0; 92 int x=0;
100 QListIterator<AppLnk> it( appList ); 93 QListIterator<AppLnk> it( appList );
101 for ( ; it.current(); ++it,++selectedAppIndex,x+=spacing ) { 94 for ( ; it.current(); ++it,++selectedAppIndex,x+=spacing ) {
102 if ( x + spacing <= width() ) { 95 if ( x + spacing <= width() ) {
103 if ( e->x() >= x && e->x() < x+spacing ) { 96 if ( e->x() >= x && e->x() < x+spacing ) {
104 if ( selectedAppIndex < (int)appList.count() ) { 97 if ( selectedAppIndex < (int)appList.count() ) {
105 repaint(FALSE); 98 repaint(FALSE);
106 return; 99 return;
107 } 100 }
108 } 101 }
109 } else { 102 } else {
110 break; 103 break;
111 } 104 }
112 } 105 }
113 selectedAppIndex = -1; 106 selectedAppIndex = -1;
114 repaint( FALSE ); 107 repaint( FALSE );
115} 108}
116 109
117void RunningAppBar::mouseReleaseEvent(QMouseEvent *e) 110void RunningAppBar::mouseReleaseEvent(QMouseEvent *e)
118{ 111{
119 if (e->button() == QMouseEvent::RightButton) 112 if (e->button() == QMouseEvent::RightButton)
120 return; 113 return;
121 if ( selectedAppIndex >= 0 ) { 114 if ( selectedAppIndex >= 0 ) {
122 QString app = appList.at(selectedAppIndex)->exec(); 115 QString app = appList.at(selectedAppIndex)->exec();
123 QCopEnvelope e("QPE/System", "raise(QString)"); 116 QCopEnvelope e("QPE/System", "raise(QString)");
124 e << app; 117 e << app;
125 selectedAppIndex = -1; 118 selectedAppIndex = -1;
126 update(); 119 update();
127 } 120 }
128} 121}
129 122
130void RunningAppBar::paintEvent( QPaintEvent * ) 123void RunningAppBar::paintEvent( QPaintEvent * )
131{ 124{
diff --git a/core/launcher/screensaver.cpp b/core/launcher/screensaver.cpp
index 1146dcd..e544c61 100644
--- a/core/launcher/screensaver.cpp
+++ b/core/launcher/screensaver.cpp
@@ -1,101 +1,100 @@
1 1
2#include "screensaver.h" 2#include "screensaver.h"
3 3
4#include <qpe/config.h> 4#include <qpe/config.h>
5#include <qpe/power.h>
6#include <qpe/network.h> 5#include <qpe/network.h>
7 6
8#include <opie2/odevice.h> 7#include <opie2/odevice.h>
9 8
10 9
11using namespace Opie; 10using namespace Opie;
12 11
13 12
14 13
15OpieScreenSaver::OpieScreenSaver ( ) 14OpieScreenSaver::OpieScreenSaver ( )
16 : QObject ( 0, "screensaver" ), QWSScreenSaver ( ) 15 : QObject ( 0, "screensaver" ), QWSScreenSaver ( )
17{ 16{
18 m_disable_suspend = 100; 17 m_disable_suspend = 100;
19 m_enable_dim = false; 18 m_enable_dim = false;
20 m_enable_lightoff = false; 19 m_enable_lightoff = false;
21 m_enable_suspend = false; 20 m_enable_suspend = false;
22 m_onlylcdoff = false; 21 m_onlylcdoff = false;
23 22
24 m_enable_dim_ac = false; 23 m_enable_dim_ac = false;
25 m_enable_lightoff_ac = false; 24 m_enable_lightoff_ac = false;
26 m_enable_suspend_ac = false; 25 m_enable_suspend_ac = false;
27 m_onlylcdoff_ac = false; 26 m_onlylcdoff_ac = false;
28 27
29 m_use_light_sensor = false; 28 m_use_light_sensor = false;
30 m_backlight_sensor = -1; 29 m_backlight_sensor = -1;
31 ::memset ( m_sensordata, 0xff, LS_Count * sizeof( m_sensordata [0] )); 30 ::memset ( m_sensordata, 0xff, LS_Count * sizeof( m_sensordata [0] ));
32 31
33 m_lcd_status = true; 32 m_lcd_status = true;
34 33
35 m_backlight_normal = -1; 34 m_backlight_normal = -1;
36 m_backlight_current = -1; 35 m_backlight_current = -1;
37 m_backlight_forcedoff = false; 36 m_backlight_forcedoff = false;
38 37
39 m_on_ac = false; 38 m_on_ac = false;
40 39
41 m_level = -1; 40 m_level = -1;
42 41
43 // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) 42 // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off)
44 ODevice::inst ( )-> setDisplayStatus ( true ); 43 ODevice::inst ( )-> setDisplayStatus ( true );
45 setBacklight ( -1 ); 44 setBacklight ( -1 );
46} 45}
47 46
48 47
49/** 48/**
50 * Stops the screen saver 49 * Stops the screen saver
51 */ 50 */
52void OpieScreenSaver::restore() 51void OpieScreenSaver::restore()
53{ 52{
54 m_level = -1; 53 m_level = -1;
55 54
56 if ( !m_lcd_status ) { // We must have turned it off 55 if ( !m_lcd_status ) { // We must have turned it off
57 ODevice::inst ( ) -> setDisplayStatus ( true ); 56 ODevice::inst ( ) -> setDisplayStatus ( true );
58 m_lcd_status = true; 57 m_lcd_status = true;
59 } 58 }
60 59
61 setBacklightInternal ( -1 ); 60 setBacklightInternal ( -1 );
62} 61}
63 62
64 63
65/** 64/**
66 * Starts the screen saver 65 * Starts the screen saver
67 * 66 *
68 * @param level what level of screen saving should happen (0=lowest non-off, 1=off, 67 * @param level what level of screen saving should happen (0=lowest non-off, 1=off,
69 * 2=suspend whole machine) 68 * 2=suspend whole machine)
70 * @returns true on success 69 * @returns true on success
71 */ 70 */
72bool OpieScreenSaver::save( int level ) 71bool OpieScreenSaver::save( int level )
73{ 72{
74 m_level = level; 73 m_level = level;
75 74
76 switch ( level ) { 75 switch ( level ) {
77 case 0: 76 case 0:
78 if (( m_on_ac && m_enable_dim_ac ) || 77 if (( m_on_ac && m_enable_dim_ac ) ||
79 ( !m_on_ac && m_enable_dim )) { 78 ( !m_on_ac && m_enable_dim )) {
80 if (( m_disable_suspend > 0 ) && ( m_backlight_current > 1 ) && !m_use_light_sensor ) 79 if (( m_disable_suspend > 0 ) && ( m_backlight_current > 1 ) && !m_use_light_sensor )
81 setBacklightInternal ( 1 ); // lowest non-off 80 setBacklightInternal ( 1 ); // lowest non-off
82 } 81 }
83 return true; 82 return true;
84 break; 83 break;
85 84
86 case 1: 85 case 1:
87 if (( m_on_ac && m_enable_lightoff_ac ) || 86 if (( m_on_ac && m_enable_lightoff_ac ) ||
88 ( !m_on_ac && m_enable_lightoff )) { 87 ( !m_on_ac && m_enable_lightoff )) {
89 if ( m_disable_suspend > 1 ) 88 if ( m_disable_suspend > 1 )
90 setBacklightInternal ( 0 ); // off 89 setBacklightInternal ( 0 ); // off
91 } 90 }
92 return true; 91 return true;
93 break; 92 break;
94 93
95 case 2: 94 case 2:
96 if (( m_on_ac && !m_enable_suspend_ac ) || 95 if (( m_on_ac && !m_enable_suspend_ac ) ||
97 ( !m_on_ac && !m_enable_suspend )) { 96 ( !m_on_ac && !m_enable_suspend )) {
98 return true; 97 return true;
99 } 98 }
100 99
101 if (( m_on_ac && m_onlylcdoff_ac ) || 100 if (( m_on_ac && m_onlylcdoff_ac ) ||
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index 32fcdd0..068d716 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -1,128 +1,127 @@
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 "server.h" 21#include "server.h"
22#include "serverapp.h" 22#include "serverapp.h"
23#include "launcher.h"
24#include "startmenu.h" 23#include "startmenu.h"
24#include "launcher.h"
25#include "transferserver.h" 25#include "transferserver.h"
26#include "qcopbridge.h" 26#include "qcopbridge.h"
27#include "irserver.h" 27#include "irserver.h"
28#include "packageslave.h" 28#include "packageslave.h"
29#include "calibrate.h" 29#include "calibrate.h"
30#include "qrsync.h" 30#include "qrsync.h"
31#include "syncdialog.h" 31#include "syncdialog.h"
32#include "launcher.h"
33#include "shutdownimpl.h" 32#include "shutdownimpl.h"
34#include "applauncher.h" 33#include "applauncher.h"
35#if 0 34#if 0
36#include "suspendmonitor.h" 35#include "suspendmonitor.h"
37#endif 36#endif
38#include "documentlist.h" 37#include "documentlist.h"
39 38
40#include <qtopia/applnk.h> 39#include <qtopia/applnk.h>
41#include <qtopia/private/categories.h> 40#include <qtopia/private/categories.h>
42#include <qtopia/mimetype.h> 41#include <qtopia/mimetype.h>
43#include <qtopia/config.h> 42#include <qtopia/config.h>
44#include <qtopia/resource.h> 43#include <qtopia/resource.h>
45#include <qtopia/version.h> 44#include <qtopia/version.h>
46#include <qtopia/storage.h> 45#include <qtopia/storage.h>
47 46
48#include <qtopia/qcopenvelope_qws.h> 47#include <qtopia/qcopenvelope_qws.h>
49#include <qwindowsystem_qws.h> 48#include <qwindowsystem_qws.h>
50#include <qgfx_qws.h> 49#include <qgfx_qws.h>
51#include <qtopia/global.h> 50#include <qtopia/global.h>
52//#include <qtopia/custom.h> 51//#include <qtopia/custom.h>
53 52
54#include <opie2/odevicebutton.h> 53#include <opie2/odevicebutton.h>
55#include <opie2/odevice.h> 54#include <opie2/odevice.h>
56 55
57#include <unistd.h> 56#include <unistd.h>
58#include <qmainwindow.h> 57#include <qmainwindow.h>
59#include <qmessagebox.h> 58#include <qmessagebox.h>
60#include <qtimer.h> 59#include <qtimer.h>
61#include <qtextstream.h> 60#include <qtextstream.h>
62 61
63#include <stdlib.h> 62#include <stdlib.h>
64 63
65extern QRect qt_maxWindowRect; 64extern QRect qt_maxWindowRect;
66 65
67using namespace Opie; 66using namespace Opie;
68 67
69static QWidget *calibrate(bool) 68static QWidget *calibrate(bool)
70{ 69{
71#ifdef Q_WS_QWS 70#ifdef Q_WS_QWS
72 Calibrate *c = new Calibrate; 71 Calibrate *c = new Calibrate;
73 c->show(); 72 c->show();
74 return c; 73 return c;
75#else 74#else
76 return 0; 75 return 0;
77#endif 76#endif
78} 77}
79 78
80#define FACTORY(T) \ 79#define FACTORY(T) \
81 static QWidget *new##T( bool maximized ) { \ 80 static QWidget *new##T( bool maximized ) { \
82 QWidget *w = new T( 0, 0, QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ 81 QWidget *w = new T( 0, 0, QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
83 if ( maximized ) { \ 82 if ( maximized ) { \
84 if ( qApp->desktop()->width() <= 350 ) { \ 83 if ( qApp->desktop()->width() <= 350 ) { \
85 w->showMaximized(); \ 84 w->showMaximized(); \
86 } else { \ 85 } else { \
87 w->resize( QSize( 300, 300 ) ); \ 86 w->resize( QSize( 300, 300 ) ); \
88 } \ 87 } \
89 } \ 88 } \
90 w->show(); \ 89 w->show(); \
91 return w; \ 90 return w; \
92 } 91 }
93 92
94 93
95#ifdef SINGLE_APP 94#ifdef SINGLE_APP
96#define APP(a,b,c,d) FACTORY(b) 95#define APP(a,b,c,d) FACTORY(b)
97#include "apps.h" 96#include "apps.h"
98#undef APP 97#undef APP
99#endif // SINGLE_APP 98#endif // SINGLE_APP
100 99
101static Global::Command builtins[] = { 100static Global::Command builtins[] = {
102 101
103#ifdef SINGLE_APP 102#ifdef SINGLE_APP
104#define APP(a,b,c,d) { a, new##b, c, d }, 103#define APP(a,b,c,d) { a, new##b, c, d },
105#include "apps.h" 104#include "apps.h"
106#undef APP 105#undef APP
107#endif 106#endif
108 107
109 /* FIXME defines need to be defined*/ 108 /* FIXME defines need to be defined*/
110#if !defined(OPIE_NO_BUILTIN_CALIBRATE) 109#if !defined(OPIE_NO_BUILTIN_CALIBRATE)
111 { "calibrate", calibrate, 1, 0 }, // No tr 110 { "calibrate", calibrate, 1, 0 }, // No tr
112#endif 111#endif
113#if !defined(OPIE_NO_BUILTIN_SHUTDOWN) 112#if !defined(OPIE_NO_BUILTIN_SHUTDOWN)
114 { "shutdown", Global::shutdown, 1, 0 }, // No tr 113 { "shutdown", Global::shutdown, 1, 0 }, // No tr
115 // { "run", run, 1, 0 }, // No tr 114 // { "run", run, 1, 0 }, // No tr
116#endif 115#endif
117 116
118 { 0, calibrate,0, 0 }, 117 { 0, calibrate,0, 0 },
119}; 118};
120 119
121 120
122//--------------------------------------------------------------------------- 121//---------------------------------------------------------------------------
123 122
124 123
125//=========================================================================== 124//===========================================================================
126 125
127Server::Server() : 126Server::Server() :
128 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), 127 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ),
diff --git a/core/launcher/shutdownimpl.cpp b/core/launcher/shutdownimpl.cpp
index 899d9ac..f43a2a3 100644
--- a/core/launcher/shutdownimpl.cpp
+++ b/core/launcher/shutdownimpl.cpp
@@ -1,128 +1,127 @@
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 "shutdownimpl.h" 21#include "shutdownimpl.h"
22 22
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25 25
26#include <qtimer.h> 26#include <qtimer.h>
27#include <qprogressbar.h> 27#include <qprogressbar.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qbuttongroup.h> 29#include <qbuttongroup.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qpalette.h>
33 32
34 33
35static void changeButtonColor ( QPushButton *btn, const QColor &col ) 34static void changeButtonColor ( QPushButton *btn, const QColor &col )
36{ 35{
37 QPalette pal = btn-> palette ( ); 36 QPalette pal = btn-> palette ( );
38 37
39 pal. setColor ( QPalette::Active, QColorGroup::Button, col ); 38 pal. setColor ( QPalette::Active, QColorGroup::Button, col );
40 pal. setColor ( QPalette::Disabled, QColorGroup::Button, col ); 39 pal. setColor ( QPalette::Disabled, QColorGroup::Button, col );
41 pal. setColor ( QPalette::Inactive, QColorGroup::Button, col ); 40 pal. setColor ( QPalette::Inactive, QColorGroup::Button, col );
42 41
43 btn-> setPalette ( pal ); 42 btn-> setPalette ( pal );
44} 43}
45 44
46 45
47ShutdownImpl::ShutdownImpl( QWidget* parent, const char *name, WFlags fl ) 46ShutdownImpl::ShutdownImpl( QWidget* parent, const char *name, WFlags fl )
48 : QWidget ( parent, name, fl ) 47 : QWidget ( parent, name, fl )
49{ 48{
50 setCaption ( tr( "Shutdown..." ) ); 49 setCaption ( tr( "Shutdown..." ) );
51 50
52 QVBoxLayout *vbox = new QVBoxLayout ( this ); 51 QVBoxLayout *vbox = new QVBoxLayout ( this );
53 vbox-> setSpacing ( 3 ); 52 vbox-> setSpacing ( 3 );
54 vbox-> setMargin ( 6 ); 53 vbox-> setMargin ( 6 );
55 54
56 QButtonGroup *btngrp = new QButtonGroup ( this ); 55 QButtonGroup *btngrp = new QButtonGroup ( this );
57 56
58 btngrp-> setTitle ( tr( "Terminate" ) ); 57 btngrp-> setTitle ( tr( "Terminate" ) );
59 btngrp-> setColumnLayout ( 0, Qt::Vertical ); 58 btngrp-> setColumnLayout ( 0, Qt::Vertical );
60 btngrp-> layout ( ) -> setSpacing ( 0 ); 59 btngrp-> layout ( ) -> setSpacing ( 0 );
61 btngrp-> layout ( ) -> setMargin ( 0 ); 60 btngrp-> layout ( ) -> setMargin ( 0 );
62 61
63 QGridLayout *grid = new QGridLayout ( btngrp-> layout ( ) ); 62 QGridLayout *grid = new QGridLayout ( btngrp-> layout ( ) );
64 grid-> setAlignment ( Qt::AlignTop ); 63 grid-> setAlignment ( Qt::AlignTop );
65 grid-> setSpacing ( 3 ); 64 grid-> setSpacing ( 3 );
66 grid-> setMargin ( 7 ); 65 grid-> setMargin ( 7 );
67 66
68 QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" ); 67 QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" );
69 changeButtonColor ( quit, QColor ( 236, 236, 179 ) ); 68 changeButtonColor ( quit, QColor ( 236, 236, 179 ) );
70 btngrp-> insert ( quit, 4 ); 69 btngrp-> insert ( quit, 4 );
71 grid-> addWidget ( quit, 1, 1 ); 70 grid-> addWidget ( quit, 1, 1 );
72 71
73 QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" ); 72 QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" );
74 changeButtonColor ( reboot, QColor( 236, 183, 181 ) ); 73 changeButtonColor ( reboot, QColor( 236, 183, 181 ) );
75 btngrp-> insert ( reboot, 2 ); 74 btngrp-> insert ( reboot, 2 );
76 grid-> addWidget( reboot, 1, 0 ); 75 grid-> addWidget( reboot, 1, 0 );
77 76
78 QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" ); 77 QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" );
79 changeButtonColor ( restart, QColor( 236, 236, 179 ) ); 78 changeButtonColor ( restart, QColor( 236, 236, 179 ) );
80 btngrp-> insert ( restart, 3 ); 79 btngrp-> insert ( restart, 3 );
81 grid-> addWidget ( restart, 0, 1 ); 80 grid-> addWidget ( restart, 0, 1 );
82 81
83 QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" ); 82 QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" );
84 changeButtonColor ( shutdown, QColor( 236, 183, 181 ) ); 83 changeButtonColor ( shutdown, QColor( 236, 183, 181 ) );
85 btngrp-> insert ( shutdown, 1 ); 84 btngrp-> insert ( shutdown, 1 );
86 grid-> addWidget ( shutdown, 0, 0 ); 85 grid-> addWidget ( shutdown, 0, 0 );
87 86
88 vbox-> addWidget ( btngrp ); 87 vbox-> addWidget ( btngrp );
89 88
90 m_info = new QLabel ( this, "info" ); 89 m_info = new QLabel ( this, "info" );
91 m_info-> setText( tr( "<p>\n" "These termination options are provided primarily for use while developing and testing the Opie system. In a normal environment, these concepts are unnecessary." ) ); 90 m_info-> setText( tr( "<p>\n" "These termination options are provided primarily for use while developing and testing the Opie system. In a normal environment, these concepts are unnecessary." ) );
92 vbox-> addWidget ( m_info ); 91 vbox-> addWidget ( m_info );
93 92
94 m_progress = new QProgressBar ( this, "progressBar" ); 93 m_progress = new QProgressBar ( this, "progressBar" );
95 m_progress-> setFrameShape ( QProgressBar::Panel ); 94 m_progress-> setFrameShape ( QProgressBar::Panel );
96 m_progress-> setFrameShadow ( QProgressBar::Sunken ); 95 m_progress-> setFrameShadow ( QProgressBar::Sunken );
97 m_progress-> setTotalSteps ( 20 ); 96 m_progress-> setTotalSteps ( 20 );
98 m_progress-> setIndicatorFollowsStyle ( false ); 97 m_progress-> setIndicatorFollowsStyle ( false );
99 vbox-> addWidget ( m_progress ); 98 vbox-> addWidget ( m_progress );
100 99
101 vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); 100 vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
102 101
103 QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" ); 102 QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" );
104 changeButtonColor ( cancel, QColor( 181, 222, 178 ) ); 103 changeButtonColor ( cancel, QColor( 181, 222, 178 ) );
105 cancel-> setDefault ( true ); 104 cancel-> setDefault ( true );
106 cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) ); 105 cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) );
107 vbox-> addWidget ( cancel ); 106 vbox-> addWidget ( cancel );
108 107
109 m_timer = new QTimer ( this ); 108 m_timer = new QTimer ( this );
110 connect ( m_timer, SIGNAL( timeout ( ) ), this, SLOT( timeout ( ) ) ); 109 connect ( m_timer, SIGNAL( timeout ( ) ), this, SLOT( timeout ( ) ) );
111 110
112 connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( buttonClicked ( int ) ) ); 111 connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( buttonClicked ( int ) ) );
113 connect ( cancel, SIGNAL( clicked ( ) ), this, SLOT( cancelClicked ( ) ) ); 112 connect ( cancel, SIGNAL( clicked ( ) ), this, SLOT( cancelClicked ( ) ) );
114 113
115 m_progress-> hide ( ); 114 m_progress-> hide ( );
116 Global::hideInputMethod ( ); 115 Global::hideInputMethod ( );
117} 116}
118 117
119void ShutdownImpl::buttonClicked ( int b ) 118void ShutdownImpl::buttonClicked ( int b )
120{ 119{
121 m_counter = 0; 120 m_counter = 0;
122 121
123 switch ( b ) { 122 switch ( b ) {
124 case 1: 123 case 1:
125 m_operation = ShutdownSystem; 124 m_operation = ShutdownSystem;
126 break; 125 break;
127 case 2: 126 case 2:
128 m_operation = RebootSystem; 127 m_operation = RebootSystem;
diff --git a/core/launcher/stabmon.cpp b/core/launcher/stabmon.cpp
index 4e5f290..f2d694b 100644
--- a/core/launcher/stabmon.cpp
+++ b/core/launcher/stabmon.cpp
@@ -1,102 +1,101 @@
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#include "stabmon.h" 22#include "stabmon.h"
23 23
24#ifdef QWS 24#ifdef QWS
25#include <qtopia/qcopenvelope_qws.h> 25#include <qtopia/qcopenvelope_qws.h>
26#endif 26#endif
27 27
28#include <qfile.h> 28#include <qfile.h>
29#include <qcstring.h>
30 29
31#include <sys/stat.h> 30#include <sys/stat.h>
32#if defined(Q_OS_LINUX) || defined(_OS_LINUX_) 31#if defined(Q_OS_LINUX) || defined(_OS_LINUX_)
33#include <unistd.h> 32#include <unistd.h>
34#endif 33#endif
35#include <stdlib.h> 34#include <stdlib.h>
36 35
37SysFileMonitor::SysFileMonitor(QObject* parent) : 36SysFileMonitor::SysFileMonitor(QObject* parent) :
38 QObject(parent) 37 QObject(parent)
39{ 38{
40 startTimer(2000); 39 startTimer(2000);
41} 40}
42 41
43const char * stab0 = "/var/run/stab"; 42const char * stab0 = "/var/run/stab";
44const char * stab1 = "/var/state/pcmcia/stab"; 43const char * stab1 = "/var/state/pcmcia/stab";
45const char * stab2 = "/var/lib/pcmcia/stab"; 44const char * stab2 = "/var/lib/pcmcia/stab";
46 45
47void SysFileMonitor::timerEvent(QTimerEvent*) 46void SysFileMonitor::timerEvent(QTimerEvent*)
48{ 47{
49 struct stat s; 48 struct stat s;
50 49
51 static const char * tab [] = { 50 static const char * tab [] = {
52 stab0, 51 stab0,
53 stab1, 52 stab1,
54 stab2 53 stab2
55 }; 54 };
56 static const int nstab = sizeof(tab)/sizeof(const char *); 55 static const int nstab = sizeof(tab)/sizeof(const char *);
57 static int last[nstab]; 56 static int last[nstab];
58 57
59 bool ch = FALSE; 58 bool ch = FALSE;
60 for ( int i=0; i<nstab; i++ ) { 59 for ( int i=0; i<nstab; i++ ) {
61 if ( ::stat(tab[i], &s)==0 && (long)s.st_mtime != last[i] ) { 60 if ( ::stat(tab[i], &s)==0 && (long)s.st_mtime != last[i] ) {
62 last[i] = (long)s.st_mtime; 61 last[i] = (long)s.st_mtime;
63 ch=TRUE; 62 ch=TRUE;
64 } 63 }
65 if ( ch ) { 64 if ( ch ) {
66#ifndef QT_NO_COP 65#ifndef QT_NO_COP
67 QCopEnvelope("QPE/Card", "stabChanged()" ); 66 QCopEnvelope("QPE/Card", "stabChanged()" );
68#endif 67#endif
69 break; 68 break;
70 } 69 }
71 } 70 }
72 71
73 // st_size is no use, it's 0 for /proc/mounts too. Read it all. 72 // st_size is no use, it's 0 for /proc/mounts too. Read it all.
74 static int mtabSize = 0; 73 static int mtabSize = 0;
75 QFile f( "/proc/mounts" ); 74 QFile f( "/proc/mounts" );
76 if ( f.open(IO_ReadOnly) ) { 75 if ( f.open(IO_ReadOnly) ) {
77#if 0 76#if 0
78 // readAll does not work correctly on sequential devices (as eg. /proc files) 77 // readAll does not work correctly on sequential devices (as eg. /proc files)
79 QByteArray ba = f.readAll(); 78 QByteArray ba = f.readAll();
80 if ( (int)ba.size() != mtabSize ) { 79 if ( (int)ba.size() != mtabSize ) {
81 mtabSize = (int)ba.size(); 80 mtabSize = (int)ba.size();
82#ifndef QT_NO_COP 81#ifndef QT_NO_COP
83 QCopEnvelope("QPE/Card", "mtabChanged()" ); 82 QCopEnvelope("QPE/Card", "mtabChanged()" );
84#endif 83#endif
85 } 84 }
86#else 85#else
87 QString s; 86 QString s;
88 while( !f.atEnd() ) { 87 while( !f.atEnd() ) {
89 QString tmp; 88 QString tmp;
90 f.readLine( tmp, 1024 ); 89 f.readLine( tmp, 1024 );
91 s += tmp; 90 s += tmp;
92 } 91 }
93 if ( (int)s.length() != mtabSize ) { 92 if ( (int)s.length() != mtabSize ) {
94 mtabSize = (int)s.length(); 93 mtabSize = (int)s.length();
95#ifndef QT_NO_COP 94#ifndef QT_NO_COP
96 QCopEnvelope("QPE/Card", "mtabChanged()" ); 95 QCopEnvelope("QPE/Card", "mtabChanged()" );
97#endif 96#endif
98 } 97 }
99#endif 98#endif
100 } 99 }
101} 100}
102 101
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index c199063..f3a7651 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -1,135 +1,131 @@
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// TODO. During startup 21// TODO. During startup
22// Launcher::typeAdded 22// Launcher::typeAdded
23// is called for each new tab and calls then each time the refresh of startmenu 23// is called for each new tab and calls then each time the refresh of startmenu
24// suboptimal 24// suboptimal
25 25
26#define INCLUDE_MENUITEM_DEF 26#define INCLUDE_MENUITEM_DEF
27 27
28#include "startmenu.h" 28#include "startmenu.h"
29 29
30#include <qtopia/qpeapplication.h> 30#include <qtopia/qpeapplication.h>
31#include <qtopia/config.h> 31#include <qtopia/config.h>
32#include <qtopia/applnk.h>
33#include <qtopia/global.h>
34#include <qtopia/resource.h> 32#include <qtopia/resource.h>
35#include <qtopia/mimetype.h> 33#include <qtopia/mimetype.h>
36#include <qtopia/qlibrary.h> 34#include <qtopia/qlibrary.h>
37 35
38#include <qdict.h>
39#include <qdir.h>
40//#include <qpainter.h> 36//#include <qpainter.h>
41 37
42//#include <stdlib.h> 38//#include <stdlib.h>
43 39
44 40
45#define APPLNK_ID_OFFSET 250 41#define APPLNK_ID_OFFSET 250
46#define NO_ID -1 42#define NO_ID -1
47 43
48 44
49void StartPopupMenu::keyPressEvent( QKeyEvent *e ) 45void StartPopupMenu::keyPressEvent( QKeyEvent *e )
50{ 46{
51 if ( e->key() == Key_F33 || e->key() == Key_Space ) { 47 if ( e->key() == Key_F33 || e->key() == Key_Space ) {
52 // "OK" button, little hacky 48 // "OK" button, little hacky
53 QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); 49 QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0);
54 QPopupMenu::keyPressEvent( &ke ); 50 QPopupMenu::keyPressEvent( &ke );
55 } else { 51 } else {
56 QPopupMenu::keyPressEvent( e ); 52 QPopupMenu::keyPressEvent( e );
57 } 53 }
58} 54}
59 55
60//--------------------------------------------------------------------------- 56//---------------------------------------------------------------------------
61 57
62StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) 58StartMenu::StartMenu(QWidget *parent) : QLabel( parent )
63{ 59{
64 startButtonPixmap = "go"; // No tr 60 startButtonPixmap = "go"; // No tr
65 61
66 int sz = AppLnk::smallIconSize()+3; 62 int sz = AppLnk::smallIconSize()+3;
67 QPixmap pm; 63 QPixmap pm;
68 pm.convertFromImage(Resource::loadImage( startButtonPixmap).smoothScale( sz,sz) ); 64 pm.convertFromImage(Resource::loadImage( startButtonPixmap).smoothScale( sz,sz) );
69 setPixmap(pm); 65 setPixmap(pm);
70 setFocusPolicy( NoFocus ); 66 setFocusPolicy( NoFocus );
71 67
72 useWidePopupMenu = true; 68 useWidePopupMenu = true;
73 launchMenu = 0; 69 launchMenu = 0;
74 refreshMenu(); 70 refreshMenu();
75} 71}
76 72
77 73
78void StartMenu::mousePressEvent( QMouseEvent * ) 74void StartMenu::mousePressEvent( QMouseEvent * )
79{ 75{
80 launch(); 76 launch();
81} 77}
82 78
83 79
84StartMenu::~StartMenu() 80StartMenu::~StartMenu()
85{ 81{
86 clearApplets(); 82 clearApplets();
87} 83}
88 84
89void StartMenu::createMenu() 85void StartMenu::createMenu()
90{ 86{
91 clearApplets(); 87 clearApplets();
92 delete launchMenu; 88 delete launchMenu;
93 89
94 launchMenu = new StartPopupMenu( this ); 90 launchMenu = new StartPopupMenu( this );
95 loadMenu( launchMenu ); 91 loadMenu( launchMenu );
96 loadApplets(); 92 loadApplets();
97 93
98 bool result = currentItem || menuApplets.count(); 94 bool result = currentItem || menuApplets.count();
99 if ( result ) 95 if ( result )
100 connect( launchMenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); 96 connect( launchMenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) );
101} 97}
102 98
103void StartMenu::refreshMenu() 99void StartMenu::refreshMenu()
104{ 100{
105 Config cfg( "StartMenu" ); 101 Config cfg( "StartMenu" );
106 cfg.setGroup( "Menu" ); 102 cfg.setGroup( "Menu" );
107 bool ltabs = cfg.readBoolEntry( "LauncherTabs", TRUE ); 103 bool ltabs = cfg.readBoolEntry( "LauncherTabs", TRUE );
108 bool lot = cfg.readBoolEntry( "LauncherOther", TRUE ); 104 bool lot = cfg.readBoolEntry( "LauncherOther", TRUE );
109 useWidePopupMenu = cfg.readBoolEntry( "LauncherSubPopup", TRUE ); 105 useWidePopupMenu = cfg.readBoolEntry( "LauncherSubPopup", TRUE );
110 106
111 if ( launchMenu && !(ltabs || lot) ) return; // nothing to do 107 if ( launchMenu && !(ltabs || lot) ) return; // nothing to do
112 108
113 createMenu(); 109 createMenu();
114} 110}
115 111
116void StartMenu::itemSelected( int id ) 112void StartMenu::itemSelected( int id )
117{ 113{
118 if ( id == NO_ID ) return; 114 if ( id == NO_ID ) return;
119 115
120 if ( id < 0 ) { 116 if ( id < 0 ) {
121 MenuApplet *applet = menuApplets.find( id ); 117 MenuApplet *applet = menuApplets.find( id );
122 if ( applet ) { 118 if ( applet ) {
123 applet->iface->activated(); 119 applet->iface->activated();
124 } 120 }
125 } else if ( id >= APPLNK_ID_OFFSET ) { 121 } else if ( id >= APPLNK_ID_OFFSET ) {
126 AppLnk * appLnk = appLnks.find( id ); 122 AppLnk * appLnk = appLnks.find( id );
127 if ( appLnk ) { 123 if ( appLnk ) {
128 appLnk->execute(); 124 appLnk->execute();
129 } 125 }
130 } else { 126 } else {
131 QString *tabName = tabNames.find( id ); 127 QString *tabName = tabNames.find( id );
132 if ( tabName ) { 128 if ( tabName ) {
133 emit tabSelected( *tabName ); 129 emit tabSelected( *tabName );
134 } 130 }
135 } 131 }
diff --git a/core/launcher/syncdialog.cpp b/core/launcher/syncdialog.cpp
index 6f6c781..4a2b8ff 100644
--- a/core/launcher/syncdialog.cpp
+++ b/core/launcher/syncdialog.cpp
@@ -1,121 +1,120 @@
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 "syncdialog.h" 21#include "syncdialog.h"
22 22
23#include <qtopia/resource.h> 23#include <qtopia/resource.h>
24 24
25#include <qimage.h>
26#include <qpainter.h> 25#include <qpainter.h>
27#include <qapplication.h> 26#include <qapplication.h>
28#include <qpushbutton.h> 27#include <qpushbutton.h>
29#include <qfile.h> 28#include <qfile.h>
30 29
31 30
32SyncDialog::SyncDialog( QWidget *parent, const QString &w ) 31SyncDialog::SyncDialog( QWidget *parent, const QString &w )
33 : QDialog( parent, "SyncDialog", FALSE, WStyle_Tool | WStyle_Customize | 32 : QDialog( parent, "SyncDialog", FALSE, WStyle_Tool | WStyle_Customize |
34 WStyle_StaysOnTop ), what(w), nextPt(0), rev(FALSE), hideDot(TRUE) 33 WStyle_StaysOnTop ), what(w), nextPt(0), rev(FALSE), hideDot(TRUE)
35{ 34{
36 QFont f( font() ); 35 QFont f( font() );
37 f.setPointSize( 16 ); 36 f.setPointSize( 16 );
38 setFont(f); 37 setFont(f);
39 38
40 loadPath(); 39 loadPath();
41 40
42 QSize ds = qApp->desktop()->size(); 41 QSize ds = qApp->desktop()->size();
43 setGeometry( 0, 0, ds.width(), ds.height() ); 42 setGeometry( 0, 0, ds.width(), ds.height() );
44 img = Resource::loadImage( "SyncScreen" ); 43 img = Resource::loadImage( "SyncScreen" );
45 if ( img.width() > ds.width() || img.height() > ds.height() ) { 44 if ( img.width() > ds.width() || img.height() > ds.height() ) {
46 path = scalePath( path, ds.width(), img.width(), ds.height(), img.height() ); 45 path = scalePath( path, ds.width(), img.width(), ds.height(), img.height() );
47 img = img.smoothScale( ds.width(), ds.height() ); 46 img = img.smoothScale( ds.width(), ds.height() );
48 } 47 }
49 dot = Resource::loadImage( "syncdot" ); 48 dot = Resource::loadImage( "syncdot" );
50 setBackgroundColor( white ); 49 setBackgroundColor( white );
51 50
52 QPushButton *pb = new QPushButton( tr("Abort"), this, "CancelSync" ); 51 QPushButton *pb = new QPushButton( tr("Abort"), this, "CancelSync" );
53 QSize bs = pb->sizeHint(); 52 QSize bs = pb->sizeHint();
54 bs.rwidth() += 10; 53 bs.rwidth() += 10;
55 bs.rheight() += 5; 54 bs.rheight() += 5;
56 pb->setGeometry( (ds.width()-bs.width())/2, 4*ds.height()/5, 55 pb->setGeometry( (ds.width()-bs.width())/2, 4*ds.height()/5,
57 bs.width(), bs.height() ); 56 bs.width(), bs.height() );
58 connect( pb, SIGNAL(clicked()), this, SIGNAL(cancel()) ); 57 connect( pb, SIGNAL(clicked()), this, SIGNAL(cancel()) );
59 58
60 if ( path.count() >= 2 ) { 59 if ( path.count() >= 2 ) {
61 path = generatePath( path, 8 ); 60 path = generatePath( path, 8 );
62 startTimer( 200 ); 61 startTimer( 200 );
63 } 62 }
64} 63}
65 64
66void SyncDialog::paintEvent( QPaintEvent *pe ) 65void SyncDialog::paintEvent( QPaintEvent *pe )
67{ 66{
68 QPainter p(this ); 67 QPainter p(this );
69 p.setClipRect( pe->rect() ); 68 p.setClipRect( pe->rect() );
70 int ox = (width() - img.width())/2; 69 int ox = (width() - img.width())/2;
71 int oy = (height() - img.height())/2; 70 int oy = (height() - img.height())/2;
72 71
73 QRect ir = QRect(ox, oy, img.width(), img.height()) & pe->rect(); 72 QRect ir = QRect(ox, oy, img.width(), img.height()) & pe->rect();
74 73
75 if ( ir.isValid() ) 74 if ( ir.isValid() )
76 p.drawImage( ir.x(), ir.y(), img, ir.x()-ox, ir.y()-oy, ir.width(), ir.height() ); 75 p.drawImage( ir.x(), ir.y(), img, ir.x()-ox, ir.y()-oy, ir.width(), ir.height() );
77 76
78 QString syncMsg = tr("Syncing:"); 77 QString syncMsg = tr("Syncing:");
79 p.setPen( black ); 78 p.setPen( black );
80 QRect r( 0, 0, width()/2-5, QMAX(oy,80) ); 79 QRect r( 0, 0, width()/2-5, QMAX(oy,80) );
81 p.drawText( r, AlignRight | AlignVCenter, syncMsg ); 80 p.drawText( r, AlignRight | AlignVCenter, syncMsg );
82 r.moveBy( width()/2, 0 ); 81 r.moveBy( width()/2, 0 );
83 QFont f( font() ); 82 QFont f( font() );
84 f.setWeight( QFont::Bold ); 83 f.setWeight( QFont::Bold );
85 p.setFont( f ); 84 p.setFont( f );
86 p.drawText( r, AlignLeft | AlignVCenter, what ); 85 p.drawText( r, AlignLeft | AlignVCenter, what );
87 86
88 if ( !hideDot ) 87 if ( !hideDot )
89 p.drawImage( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2, dot ); 88 p.drawImage( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2, dot );
90} 89}
91 90
92void SyncDialog::timerEvent( QTimerEvent * ) 91void SyncDialog::timerEvent( QTimerEvent * )
93{ 92{
94 int ox = (width() - img.width())/2; 93 int ox = (width() - img.width())/2;
95 int oy = (height() - img.height())/2; 94 int oy = (height() - img.height())/2;
96 int oldPt = nextPt; 95 int oldPt = nextPt;
97 96
98 if ( !rev ) { 97 if ( !rev ) {
99 nextPt++; 98 nextPt++;
100 if ( nextPt == (int)path.count() ) { 99 if ( nextPt == (int)path.count() ) {
101 nextPt -= 2; 100 nextPt -= 2;
102 rev = TRUE; 101 rev = TRUE;
103 } 102 }
104 } else { 103 } else {
105 nextPt--; 104 nextPt--;
106 if ( nextPt < 0 ) { 105 if ( nextPt < 0 ) {
107 nextPt = 1; 106 nextPt = 1;
108 rev = FALSE; 107 rev = FALSE;
109 } 108 }
110 } 109 }
111 110
112 hideDot = FALSE; 111 hideDot = FALSE;
113 repaint( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2, 112 repaint( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2,
114 dot.width(), dot.height() ); 113 dot.width(), dot.height() );
115 hideDot = TRUE; 114 hideDot = TRUE;
116 repaint( ox+path[oldPt].x()-dot.width()/2, oy+path[oldPt].y()-dot.height()/2, 115 repaint( ox+path[oldPt].x()-dot.width()/2, oy+path[oldPt].y()-dot.height()/2,
117 dot.width(), dot.height() ); 116 dot.width(), dot.height() );
118} 117}
119 118
120void SyncDialog::loadPath() 119void SyncDialog::loadPath()
121{ 120{
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp
index 691f6b8..6cc1446 100644
--- a/core/launcher/systray.cpp
+++ b/core/launcher/systray.cpp
@@ -1,124 +1,122 @@
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 <qtopia/qpeapplication.h> 21#include <qtopia/qpeapplication.h>
22#include <qtopia/qlibrary.h> 22#include <qtopia/qlibrary.h>
23#include <qtopia/config.h> 23#include <qtopia/config.h>
24 24
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qdir.h> 26#include <qdir.h>
27#include <qmessagebox.h>
28#include <qtranslator.h>
29 27
30#include "systray.h" 28#include "systray.h"
31 29
32#include <stdlib.h> 30#include <stdlib.h>
33 31
34/* ### Single build floppies ### */ 32/* ### Single build floppies ### */
35#if 0 33#if 0
36#ifdef QT_NO_COMPONENTS 34#ifdef QT_NO_COMPONENTS
37#include "../plugins/applets/clockapplet/clockappletimpl.h" 35#include "../plugins/applets/clockapplet/clockappletimpl.h"
38#endif 36#endif
39#endif 37#endif
40 38
41SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) 39SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0)
42{ 40{
43 //setFrameStyle( QFrame::Panel | QFrame::Sunken ); 41 //setFrameStyle( QFrame::Panel | QFrame::Sunken );
44 loadApplets(); 42 loadApplets();
45} 43}
46 44
47SysTray::~SysTray() 45SysTray::~SysTray()
48{ 46{
49 clearApplets(); 47 clearApplets();
50} 48}
51 49
52static int compareAppletPositions(const void *a, const void *b) 50static int compareAppletPositions(const void *a, const void *b)
53{ 51{
54 const TaskbarApplet* aa = *(const TaskbarApplet**)a; 52 const TaskbarApplet* aa = *(const TaskbarApplet**)a;
55 const TaskbarApplet* ab = *(const TaskbarApplet**)b; 53 const TaskbarApplet* ab = *(const TaskbarApplet**)b;
56 int d = ab->iface->position() - aa->iface->position(); 54 int d = ab->iface->position() - aa->iface->position();
57 if ( d ) return d; 55 if ( d ) return d;
58 return QString::compare(ab->name,aa->name); 56 return QString::compare(ab->name,aa->name);
59} 57}
60 58
61void SysTray::loadApplets() 59void SysTray::loadApplets()
62{ 60{
63 hide(); 61 hide();
64 clearApplets(); 62 clearApplets();
65 addApplets(); 63 addApplets();
66} 64}
67 65
68void SysTray::clearApplets() 66void SysTray::clearApplets()
69{ 67{
70#ifndef QT_NO_COMPONENTS 68#ifndef QT_NO_COMPONENTS
71 69
72 /* 70 /*
73 * Note on clearing. SOme applets delete their 71 * Note on clearing. SOme applets delete their
74 * applets themselves some don't do it 72 * applets themselves some don't do it
75 * and on restart this can crash. If we delete it 73 * and on restart this can crash. If we delete it
76 * here we might end up in a double deletion. We could 74 * here we might end up in a double deletion. We could
77 * use QGuardedPtr but that would be one QOBject 75 * use QGuardedPtr but that would be one QOBject
78 * for every applet more but only useful for restart 76 * for every applet more but only useful for restart
79 */ 77 */
80 QValueList<TaskbarApplet>::Iterator mit; 78 QValueList<TaskbarApplet>::Iterator mit;
81 for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { 79 for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) {
82 (*mit).iface->release(); 80 (*mit).iface->release();
83 (*mit).library->unload(); 81 (*mit).library->unload();
84 delete (*mit).library; 82 delete (*mit).library;
85 } 83 }
86 84
87#endif 85#endif
88 appletList.clear(); 86 appletList.clear();
89 if ( layout ) 87 if ( layout )
90 delete layout; 88 delete layout;
91 layout = new QHBoxLayout( this, 0, 1 ); 89 layout = new QHBoxLayout( this, 0, 1 );
92 layout->setAutoAdd(TRUE); 90 layout->setAutoAdd(TRUE);
93} 91}
94 92
95void SysTray::addApplets() 93void SysTray::addApplets()
96{ 94{
97 hide(); 95 hide();
98#ifndef QT_NO_COMPONENTS 96#ifndef QT_NO_COMPONENTS
99 Config cfg( "Taskbar" ); 97 Config cfg( "Taskbar" );
100 cfg.setGroup( "Applets" ); 98 cfg.setGroup( "Applets" );
101 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); 99 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
102 100
103 QString lang = getenv( "LANG" ); 101 QString lang = getenv( "LANG" );
104 QString path = QPEApplication::qpeDir() + "/plugins/applets"; 102 QString path = QPEApplication::qpeDir() + "/plugins/applets";
105#ifdef Q_OS_MACX 103#ifdef Q_OS_MACX
106 QDir dir( path, "lib*.dylib" ); 104 QDir dir( path, "lib*.dylib" );
107#else 105#else
108 QDir dir( path, "lib*.so" ); 106 QDir dir( path, "lib*.so" );
109#endif /* Q_OS_MACX */ 107#endif /* Q_OS_MACX */
110 QStringList list = dir.entryList(); 108 QStringList list = dir.entryList();
111 QStringList::Iterator it; 109 QStringList::Iterator it;
112 int napplets=0; 110 int napplets=0;
113 TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; 111 TaskbarApplet* *applets = new TaskbarApplet*[list.count()];
114 for ( it = list.begin(); it != list.end(); ++it ) { 112 for ( it = list.begin(); it != list.end(); ++it ) {
115 if ( exclude.find( *it ) != exclude.end() ) 113 if ( exclude.find( *it ) != exclude.end() )
116 continue; 114 continue;
117 qWarning( "Found Applet: %s", (*it).latin1() ); 115 qWarning( "Found Applet: %s", (*it).latin1() );
118 TaskbarAppletInterface *iface = 0; 116 TaskbarAppletInterface *iface = 0;
119 QLibrary *lib = new QLibrary( path + "/" + *it ); 117 QLibrary *lib = new QLibrary( path + "/" + *it );
120 if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { 118 if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) {
121 TaskbarApplet *applet = new TaskbarApplet; 119 TaskbarApplet *applet = new TaskbarApplet;
122 applets[napplets++] = applet; 120 applets[napplets++] = applet;
123 applet->library = lib; 121 applet->library = lib;
124 applet->iface = iface; 122 applet->iface = iface;
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
index 8367a62..b998e95 100644
--- a/core/launcher/transferserver.cpp
+++ b/core/launcher/transferserver.cpp
@@ -1,156 +1,146 @@
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 21
22#include <opie2/oglobal.h> 22#include <opie2/oglobal.h>
23#include <qtopia/qpeapplication.h>
24 23
25#ifndef Q_OS_WIN32 24#ifndef Q_OS_WIN32
26#include <pwd.h> 25#include <pwd.h>
27#include <sys/types.h> 26#include <sys/types.h>
28#include <unistd.h> 27#include <unistd.h>
29#include <stdlib.h> 28#include <stdlib.h>
30#include <time.h> 29#include <time.h>
31 30
32#ifndef Q_OS_MACX 31#ifndef Q_OS_MACX
33#include <shadow.h> 32#include <shadow.h>
34#include <crypt.h> 33#include <crypt.h>
35#endif /* Q_OS_MACX */ 34#endif /* Q_OS_MACX */
36 35
37#else 36#else
38#include <stdlib.h> 37#include <stdlib.h>
39#include <time.h> 38#include <time.h>
40#endif 39#endif
41 40
42 41
43#if defined(_OS_LINUX_) 42#if defined(_OS_LINUX_)
44#include <shadow.h> 43#include <shadow.h>
45#endif 44#endif
46 45
47#include <qdir.h>
48#include <qfile.h>
49#include <qtextstream.h> 46#include <qtextstream.h>
50#include <qdatastream.h>
51#include <qmessagebox.h> 47#include <qmessagebox.h>
52#include <qstringlist.h>
53#include <qfileinfo.h>
54#include <qregexp.h>
55//#include <qtopia/qcopchannel_qws.h> 48//#include <qtopia/qcopchannel_qws.h>
56#include <qtopia/process.h> 49#include <qtopia/process.h>
57#include <qtopia/global.h>
58#include <qtopia/config.h>
59#include <qtopia/private/contact.h> 50#include <qtopia/private/contact.h>
60#include <qtopia/quuid.h>
61#include <qtopia/version.h> 51#include <qtopia/version.h>
62#ifdef Q_WS_QWS 52#ifdef Q_WS_QWS
63#include <qtopia/qcopenvelope_qws.h> 53#include <qtopia/qcopenvelope_qws.h>
64#endif 54#endif
65 55
66 56
67#include "transferserver.h" 57#include "transferserver.h"
68#include <qtopia/qprocess.h> 58#include <qtopia/qprocess.h>
69 59
70const int block_size = 51200; 60const int block_size = 51200;
71 61
72TransferServer::TransferServer( Q_UINT16 port, QObject *parent, 62TransferServer::TransferServer( Q_UINT16 port, QObject *parent,
73 const char* name) 63 const char* name)
74 : QServerSocket( port, 1, parent, name ) 64 : QServerSocket( port, 1, parent, name )
75{ 65{
76 connections.setAutoDelete( TRUE ); 66 connections.setAutoDelete( TRUE );
77 if ( !ok() ) 67 if ( !ok() )
78 qWarning( "Failed to bind to port %d", port ); 68 qWarning( "Failed to bind to port %d", port );
79} 69}
80 70
81void TransferServer::authorizeConnections() 71void TransferServer::authorizeConnections()
82{ 72{
83 QListIterator<ServerPI> it(connections); 73 QListIterator<ServerPI> it(connections);
84 while ( it.current() ) { 74 while ( it.current() ) {
85 if ( !it.current()->verifyAuthorised() ) { 75 if ( !it.current()->verifyAuthorised() ) {
86 disconnect( it.current(), SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) ); 76 disconnect( it.current(), SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) );
87 connections.removeRef( it.current() ); 77 connections.removeRef( it.current() );
88 } else 78 } else
89 ++it; 79 ++it;
90 } 80 }
91} 81}
92 82
93void TransferServer::closed(ServerPI *item) 83void TransferServer::closed(ServerPI *item)
94{ 84{
95 connections.removeRef(item); 85 connections.removeRef(item);
96} 86}
97 87
98TransferServer::~TransferServer() 88TransferServer::~TransferServer()
99{ 89{
100} 90}
101 91
102void TransferServer::newConnection( int socket ) 92void TransferServer::newConnection( int socket )
103{ 93{
104 ServerPI *ptr = new ServerPI( socket, this ); 94 ServerPI *ptr = new ServerPI( socket, this );
105 connect( ptr, SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) ); 95 connect( ptr, SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) );
106 connections.append( ptr ); 96 connections.append( ptr );
107} 97}
108 98
109QString SyncAuthentication::serverId() 99QString SyncAuthentication::serverId()
110{ 100{
111 Config cfg("Security"); 101 Config cfg("Security");
112 cfg.setGroup("Sync"); 102 cfg.setGroup("Sync");
113 QString r = cfg.readEntry("serverid"); 103 QString r = cfg.readEntry("serverid");
114 104
115 if ( r.isEmpty() ) { 105 if ( r.isEmpty() ) {
116 r = OGlobal::generateUuid(); 106 r = OGlobal::generateUuid();
117 cfg.writeEntry("serverid", r ); 107 cfg.writeEntry("serverid", r );
118 } 108 }
119 return r; 109 return r;
120} 110}
121 111
122QString SyncAuthentication::ownerName() 112QString SyncAuthentication::ownerName()
123{ 113{
124 QString vfilename = Global::applicationFileName("addressbook", 114 QString vfilename = Global::applicationFileName("addressbook",
125 "businesscard.vcf"); 115 "businesscard.vcf");
126 if (QFile::exists(vfilename)) { 116 if (QFile::exists(vfilename)) {
127 Contact c; 117 Contact c;
128 c = Contact::readVCard( vfilename )[0]; 118 c = Contact::readVCard( vfilename )[0];
129 return c.fullName(); 119 return c.fullName();
130 } 120 }
131 121
132 return QString::null; 122 return QString::null;
133} 123}
134 124
135QString SyncAuthentication::loginName() 125QString SyncAuthentication::loginName()
136{ 126{
137 struct passwd *pw = 0L; 127 struct passwd *pw = 0L;
138#ifndef Q_OS_WIN32 128#ifndef Q_OS_WIN32
139 pw = getpwuid( geteuid() ); 129 pw = getpwuid( geteuid() );
140 return QString::fromLocal8Bit( pw->pw_name ); 130 return QString::fromLocal8Bit( pw->pw_name );
141#else 131#else
142 //### revise 132 //### revise
143 return QString(); 133 return QString();
144#endif 134#endif
145} 135}
146 136
147int SyncAuthentication::isAuthorized(QHostAddress peeraddress) 137int SyncAuthentication::isAuthorized(QHostAddress peeraddress)
148{ 138{
149 Config cfg("Security"); 139 Config cfg("Security");
150 cfg.setGroup("Sync"); 140 cfg.setGroup("Sync");
151 // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0"); 141 // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0");
152 uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100); 142 uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100);
153 143
154 // QHostAddress allowed; 144 // QHostAddress allowed;
155 // allowed.setAddress(allowedstr); 145 // allowed.setAddress(allowedstr);
156 // uint auth_peer = allowed.ip4Addr(); 146 // uint auth_peer = allowed.ip4Addr();
diff --git a/core/launcher/wait.cpp b/core/launcher/wait.cpp
index 34ffd1a..4148e57 100644
--- a/core/launcher/wait.cpp
+++ b/core/launcher/wait.cpp
@@ -1,78 +1,74 @@
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 "wait.h" 21#include "wait.h"
22 22
23#include <qtopia/resource.h>
24#include <qtopia/config.h> 23#include <qtopia/config.h>
25 24
26#include <opie2/owait.h> 25#include <opie2/owait.h>
27 26
28#include <qwidget.h>
29#include <qpixmap.h>
30#include <qpainter.h>
31 27
32 28
33Wait *lastWaitObject = NULL; 29Wait *lastWaitObject = NULL;
34 30
35 31
36Wait::Wait( QWidget *parent ) : QWidget( parent ), 32Wait::Wait( QWidget *parent ) : QWidget( parent ),
37 pm( Resource::loadPixmap( "wait" ) ), waiting( FALSE ) 33 pm( Resource::loadPixmap( "wait" ) ), waiting( FALSE )
38{ 34{
39 setFixedSize( pm.size() ); 35 setFixedSize( pm.size() );
40 lastWaitObject = this; 36 lastWaitObject = this;
41 m_centralWait = new OWait( 0l ); 37 m_centralWait = new OWait( 0l );
42 m_centralWait->hide(); 38 m_centralWait->hide();
43 hide(); 39 hide();
44} 40}
45 41
46 42
47Wait *Wait::getWaitObject() 43Wait *Wait::getWaitObject()
48{ 44{
49 return lastWaitObject; 45 return lastWaitObject;
50} 46}
51 47
52 48
53void Wait::setWaiting( bool w ) 49void Wait::setWaiting( bool w )
54{ 50{
55 Config cfg ( "Launcher" ); 51 Config cfg ( "Launcher" );
56 cfg.setGroup("GUI"); 52 cfg.setGroup("GUI");
57 53
58 54
59 waiting = w; 55 waiting = w;
60 if ( w ) { 56 if ( w ) {
61 if ( cfg. readBoolEntry( "BigBusy" ) ) 57 if ( cfg. readBoolEntry( "BigBusy" ) )
62 m_centralWait->show(); 58 m_centralWait->show();
63 else 59 else
64 show(); 60 show();
65 }else{ 61 }else{
66 m_centralWait->hide(); 62 m_centralWait->hide();
67 hide(); 63 hide();
68 } 64 }
69} 65}
70 66
71 67
72void Wait::paintEvent( QPaintEvent * ) 68void Wait::paintEvent( QPaintEvent * )
73{ 69{
74 QPainter p( this ); 70 QPainter p( this );
75 p.drawPixmap( 0, 0, pm ); 71 p.drawPixmap( 0, 0, pm );
76} 72}
77 73
78 74