summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-11-05 10:29:08 (UTC)
committer llornkcor <llornkcor>2003-11-05 10:29:08 (UTC)
commit91369ae9ca93f499fd0883a13f046a4b435d1b56 (patch) (unidiff)
tree212e2dcaa21365a55bd16451c4087e684283b8ba
parentd0e7b4f9da3275e6d2fb4dcc8e1b38a2117443f5 (diff)
downloadopie-91369ae9ca93f499fd0883a13f046a4b435d1b56.zip
opie-91369ae9ca93f499fd0883a13f046a4b435d1b56.tar.gz
opie-91369ae9ca93f499fd0883a13f046a4b435d1b56.tar.bz2
removed include custom.h cause build system doesn't create it for me and I am tired of not having a compiling opie to work on. fix it if you need too
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/firstuse.cpp2
-rw-r--r--core/launcher/launcher.cpp2
-rw-r--r--core/launcher/main.cpp2
-rw-r--r--core/launcher/server.cpp2
-rw-r--r--core/launcher/serverapp.cpp2
-rw-r--r--core/launcher/taskbar.cpp2
6 files changed, 6 insertions, 6 deletions
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp
index 3f769ae..57469cf 100644
--- a/core/launcher/firstuse.cpp
+++ b/core/launcher/firstuse.cpp
@@ -1,224 +1,224 @@
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> 39#include <qtopia/qpeapplication.h>
40#include <qtopia/config.h> 40#include <qtopia/config.h>
41#include <qtopia/applnk.h> 41#include <qtopia/applnk.h>
42#include <qtopia/mimetype.h> 42#include <qtopia/mimetype.h>
43#include <qtopia/fontmanager.h> 43#include <qtopia/fontmanager.h>
44 44
45#include <qapplication.h> 45#include <qapplication.h>
46#include <qfile.h> 46#include <qfile.h>
47#include <qpainter.h> 47#include <qpainter.h>
48#include <qcstring.h> 48#include <qcstring.h>
49#include <qsimplerichtext.h> 49#include <qsimplerichtext.h>
50#include <qcolor.h> 50#include <qcolor.h>
51#include <qpushbutton.h> 51#include <qpushbutton.h>
52#include <qhbox.h> 52#include <qhbox.h>
53#include <qlabel.h> 53#include <qlabel.h>
54#include <qtimer.h> 54#include <qtimer.h>
55 55
56#if defined( Q_WS_QWS ) 56#if defined( Q_WS_QWS )
57#include <qwsdisplay_qws.h> 57#include <qwsdisplay_qws.h>
58#include <qgfx_qws.h> 58#include <qgfx_qws.h>
59#endif 59#endif
60 60
61#include <qwindowsystem_qws.h> 61#include <qwindowsystem_qws.h>
62 62
63#include <stdlib.h> 63#include <stdlib.h>
64#include <sys/types.h> 64#include <sys/types.h>
65#if defined(Q_OS_LINUX) || defined(_OS_LINUX_) 65#if defined(Q_OS_LINUX) || defined(_OS_LINUX_)
66#include <unistd.h> 66#include <unistd.h>
67#endif 67#endif
68 68
69 69
70struct { 70struct {
71 bool enabled; 71 bool enabled;
72 const char *app; 72 const char *app;
73 const char *start; 73 const char *start;
74 const char *stop; 74 const char *stop;
75 const char *desc; 75 const char *desc;
76} 76}
77settingsTable [] = 77settingsTable [] =
78{ 78{
79 { FALSE, "language", "raise()", "accept()", // No tr 79 { FALSE, "language", "raise()", "accept()", // No tr
80 QT_TR_NOOP("Language") }, 80 QT_TR_NOOP("Language") },
81#ifndef Q_OS_WIN32 81#ifndef Q_OS_WIN32
82 { FALSE, "systemtime", "raise()", "accept()", // No tr 82 { FALSE, "systemtime", "raise()", "accept()", // No tr
83 QT_TR_NOOP("Time and Date") }, 83 QT_TR_NOOP("Time and Date") },
84#endif 84#endif
85 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr 85 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr
86 QT_TR_NOOP("Personal Information") }, 86 QT_TR_NOOP("Personal Information") },
87 { FALSE, 0, 0, 0, 0 } 87 { FALSE, 0, 0, 0, 0 }
88}; 88};
89 89
90 90
91FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : 91FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) :
92 QDialog( parent, name, TRUE, wf), 92 QDialog( parent, name, TRUE, wf),
93 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), 93 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1),
94 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) 94 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE)
95{ 95{
96 ServerApplication::allowRestart = FALSE; 96 ServerApplication::allowRestart = FALSE;
97 // we force our height beyound the maximum (which we set anyway) 97 // we force our height beyound the maximum (which we set anyway)
98 QRect desk = qApp->desktop()->geometry(); 98 QRect desk = qApp->desktop()->geometry();
99 setGeometry( 0, 0, desk.width(), desk.height() ); 99 setGeometry( 0, 0, desk.width(), desk.height() );
100 100
101 connect(qwsServer, SIGNAL(newChannel(const QString&)), 101 connect(qwsServer, SIGNAL(newChannel(const QString&)),
102 this, SLOT(newQcopChannel(const QString&))); 102 this, SLOT(newQcopChannel(const QString&)));
103 103
104 // Create a DocumentList so appLauncher has appLnkSet to search 104 // Create a DocumentList so appLauncher has appLnkSet to search
105 docList = new DocumentList( 0, FALSE ); 105 docList = new DocumentList( 0, FALSE );
106 appLauncher = new AppLauncher( this ); 106 appLauncher = new AppLauncher( this );
107 connect( appLauncher, SIGNAL(terminated(int, const QString&)), 107 connect( appLauncher, SIGNAL(terminated(int, const QString&)),
108 this, SLOT(terminated(int, const QString&)) ); 108 this, SLOT(terminated(int, const QString&)) );
109 109
110 // more hackery 110 // more hackery
111 // I will be run as either the main server or as part of the main server 111 // I will be run as either the main server or as part of the main server
112 QWSServer::setScreenSaverIntervals(0); 112 QWSServer::setScreenSaverIntervals(0);
113 loadPixmaps(); 113 loadPixmaps();
114 114
115 //check if there is a language program 115 //check if there is a language program
116#ifndef Q_OS_WIN32 116#ifndef Q_OS_WIN32
117 QString exeSuffix; 117 QString exeSuffix;
118#else 118#else
119 QString exeSuffix(".exe"); 119 QString exeSuffix(".exe");
120#endif 120#endif
121 121
122 for ( int i = 0; settingsTable[i].app; i++ ) { 122 for ( int i = 0; settingsTable[i].app; i++ ) {
123 QString file = QPEApplication::qpeDir() + "bin/"; 123 QString file = QPEApplication::qpeDir() + "bin/";
124 file += settingsTable[i].app; 124 file += settingsTable[i].app;
125 file += exeSuffix; 125 file += exeSuffix;
126 if ( QFile::exists(file) ) 126 if ( QFile::exists(file) )
127 settingsTable[i].enabled = TRUE; 127 settingsTable[i].enabled = TRUE;
128 } 128 }
129 129
130 setFocusPolicy(NoFocus); 130 setFocusPolicy(NoFocus);
131 131
132 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); 132 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader);
133 133
134 inputMethods = new InputMethods(taskBar); 134 inputMethods = new InputMethods(taskBar);
135 connect(inputMethods, SIGNAL(inputToggled(bool)), 135 connect(inputMethods, SIGNAL(inputToggled(bool)),
136 this, SLOT(calcMaxWindowRect())); 136 this, SLOT(calcMaxWindowRect()));
137 137
138 back = new QPushButton(tr("<< Back"), taskBar); 138 back = new QPushButton(tr("<< Back"), taskBar);
139 back->setFocusPolicy(NoFocus); 139 back->setFocusPolicy(NoFocus);
140 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); 140 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) );
141 141
142 next = new QPushButton(tr("Next >>"), taskBar); 142 next = new QPushButton(tr("Next >>"), taskBar);
143 next->setFocusPolicy(NoFocus); 143 next->setFocusPolicy(NoFocus);
144 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); 144 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) );
145 145
146 // need to set the geom to lower corner 146 // need to set the geom to lower corner
147 QSize sz = inputMethods->sizeHint(); 147 QSize sz = inputMethods->sizeHint();
148 int buttonWidth = (width() - sz.width()) / 2; 148 int buttonWidth = (width() - sz.width()) / 2;
149 int x = 0; 149 int x = 0;
150 150
151 controlHeight = back->sizeHint().height(); 151 controlHeight = back->sizeHint().height();
152 152
153 inputMethods->setGeometry(0,0, sz.width(), controlHeight ); 153 inputMethods->setGeometry(0,0, sz.width(), controlHeight );
154 x += sz.width(); 154 x += sz.width();
155 155
156 back->setGeometry(x, 0, buttonWidth, controlHeight); 156 back->setGeometry(x, 0, buttonWidth, controlHeight);
157 x += buttonWidth; 157 x += buttonWidth;
158 next->setGeometry(x, 0, buttonWidth, controlHeight); 158 next->setGeometry(x, 0, buttonWidth, controlHeight);
159 159
160 taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); 160 taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight);
161 taskBar->hide(); 161 taskBar->hide();
162 162
163#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 163#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
164 qDebug("Setting up QCop to QPE/System"); 164 qDebug("Setting up QCop to QPE/System");
165 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 165 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
166 connect(sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), 166 connect(sysChannel, SIGNAL(received(const QCString &, const QByteArray &)),
167 this, SLOT(message(const QCString &, const QByteArray &)) ); 167 this, SLOT(message(const QCString &, const QByteArray &)) );
168#endif 168#endif
169 calcMaxWindowRect(); 169 calcMaxWindowRect();
170 170
171 m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; 171 m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false;
172 172
173 if ( m_calHandler) { 173 if ( m_calHandler) {
174 if ( !QFile::exists("/etc/pointercal") ) { 174 if ( !QFile::exists("/etc/pointercal") ) {
175 needCalibrate = TRUE; 175 needCalibrate = TRUE;
176 grabMouse(); 176 grabMouse();
177 } 177 }
178 } 178 }
179 179
180 Config config("locale"); 180 Config config("locale");
181 config.setGroup( "Language"); 181 config.setGroup( "Language");
182 lang = config.readEntry( "Language", "en"); 182 lang = config.readEntry( "Language", "en");
183 183
184 defaultFont = font(); 184 defaultFont = font();
185 185
186 //###language/font hack; should look it up somewhere 186 //###language/font hack; should look it up somewhere
187#ifdef Q_WS_QWS 187#ifdef Q_WS_QWS
188 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 188 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
189 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 189 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
190 qApp->setFont( fn, TRUE ); 190 qApp->setFont( fn, TRUE );
191 } 191 }
192#endif 192#endif
193} 193}
194 194
195FirstUse::~FirstUse() 195FirstUse::~FirstUse()
196{ 196{
197 delete appLauncher; 197 delete appLauncher;
198 delete docList; 198 delete docList;
199 delete taskBar; 199 delete taskBar;
200 ServerApplication::allowRestart = TRUE; 200 ServerApplication::allowRestart = TRUE;
201} 201}
202 202
203void FirstUse::calcMaxWindowRect() 203void FirstUse::calcMaxWindowRect()
204{ 204{
205#ifdef Q_WS_QWS 205#ifdef Q_WS_QWS
206 QRect wr; 206 QRect wr;
207 int displayWidth = qApp->desktop()->width(); 207 int displayWidth = qApp->desktop()->width();
208 QRect ir = inputMethods->inputRect(); 208 QRect ir = inputMethods->inputRect();
209 if ( ir.isValid() ) { 209 if ( ir.isValid() ) {
210 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 210 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
211 } else { 211 } else {
212 wr.setCoords( 0, 0, displayWidth-1, 212 wr.setCoords( 0, 0, displayWidth-1,
213 qApp->desktop()->height() - controlHeight-1); 213 qApp->desktop()->height() - controlHeight-1);
214 } 214 }
215 215
216#if QT_VERSION < 0x030000 216#if QT_VERSION < 0x030000
217 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, 217 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
218 QSize(qt_screen->width(),qt_screen->height())) 218 QSize(qt_screen->width(),qt_screen->height()))
219 ); 219 );
220#else 220#else
221 QWSServer::setMaxWindowRect( wr ); 221 QWSServer::setMaxWindowRect( wr );
222#endif 222#endif
223#endif 223#endif
224} 224}
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 35d404a..d697c43 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -1,224 +1,224 @@
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> 28#include <qtopia/global.h>
29#include <qtopia/qpeapplication.h> 29#include <qtopia/qpeapplication.h>
30#include <qtopia/mimetype.h> 30#include <qtopia/mimetype.h>
31#include <qtopia/private/categories.h> 31#include <qtopia/private/categories.h>
32#include <qtopia/custom.h> 32//#include <qtopia/custom.h>
33 33
34#include <qdir.h> 34#include <qdir.h>
35#ifdef Q_WS_QWS 35#ifdef Q_WS_QWS
36#include <qwindowsystem_qws.h> 36#include <qwindowsystem_qws.h>
37#endif 37#endif
38#include <qtimer.h> 38#include <qtimer.h>
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qvbox.h> 40#include <qvbox.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qstyle.h> 42#include <qstyle.h>
43#include <qpushbutton.h> 43#include <qpushbutton.h>
44#include <qtabbar.h> 44#include <qtabbar.h>
45#include <qwidgetstack.h> 45#include <qwidgetstack.h>
46#include <qlayout.h> 46#include <qlayout.h>
47#include <qregexp.h> 47#include <qregexp.h>
48#include <qmessagebox.h> 48#include <qmessagebox.h>
49#include <qframe.h> 49#include <qframe.h>
50#include <qpainter.h> 50#include <qpainter.h>
51#include <qlabel.h> 51#include <qlabel.h>
52#include <qtextstream.h> 52#include <qtextstream.h>
53#include <qpopupmenu.h> 53#include <qpopupmenu.h>
54 54
55#include "startmenu.h" 55#include "startmenu.h"
56#include "taskbar.h" 56#include "taskbar.h"
57 57
58#include "serverinterface.h" 58#include "serverinterface.h"
59#include "launcherview.h" 59#include "launcherview.h"
60#include "launcher.h" 60#include "launcher.h"
61#include "server.h" 61#include "server.h"
62 62
63#define QTOPIA_INTERNAL_FSLP 63#define QTOPIA_INTERNAL_FSLP
64#include <qtopia/lnkproperties.h> 64#include <qtopia/lnkproperties.h>
65#include <stdlib.h> 65#include <stdlib.h>
66#include <assert.h> 66#include <assert.h>
67 67
68#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 68#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
69#include <unistd.h> 69#include <unistd.h>
70#include <stdio.h> 70#include <stdio.h>
71#include <sys/vfs.h> 71#include <sys/vfs.h>
72#include <mntent.h> 72#include <mntent.h>
73#endif 73#endif
74 74
75#ifdef Q_WS_QWS 75#ifdef Q_WS_QWS
76#include <qkeyboard_qws.h> 76#include <qkeyboard_qws.h>
77#include <qpe/lnkproperties.h> 77#include <qpe/lnkproperties.h>
78#endif 78#endif
79 79
80 80
81static bool isVisibleWindow( int ); 81static bool isVisibleWindow( int );
82//=========================================================================== 82//===========================================================================
83 83
84LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : 84LauncherTabWidget::LauncherTabWidget( Launcher* parent ) :
85 QVBox( parent ) 85 QVBox( parent )
86{ 86{
87 docLoadingWidgetEnabled = false; 87 docLoadingWidgetEnabled = false;
88 docLoadingWidget = 0; 88 docLoadingWidget = 0;
89 docLoadingWidgetProgress = 0; 89 docLoadingWidgetProgress = 0;
90 launcher = parent; 90 launcher = parent;
91 categoryBar = new LauncherTabBar( this ); 91 categoryBar = new LauncherTabBar( this );
92 QPalette pal = categoryBar->palette(); 92 QPalette pal = categoryBar->palette();
93 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); 93 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
94 pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); 94 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
95 categoryBar->setPalette( pal ); 95 categoryBar->setPalette( pal );
96 stack = new QWidgetStack(this); 96 stack = new QWidgetStack(this);
97 connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); 97 connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) );
98 categoryBar->show(); 98 categoryBar->show();
99 stack->show(); 99 stack->show();
100 100
101#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 101#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
102 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); 102 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this );
103 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 103 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
104 this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); 104 this, SLOT(launcherMessage(const QCString&, const QByteArray&)) );
105 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 105 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
106 this, SLOT(appMessage(const QCString&, const QByteArray&))); 106 this, SLOT(appMessage(const QCString&, const QByteArray&)));
107#endif 107#endif
108 108
109 createDocLoadingWidget(); 109 createDocLoadingWidget();
110} 110}
111 111
112void LauncherTabWidget::createDocLoadingWidget() 112void LauncherTabWidget::createDocLoadingWidget()
113{ 113{
114 // Construct the 'doc loading widget' shown when finding documents 114 // Construct the 'doc loading widget' shown when finding documents
115 115
116 // ### LauncherView class needs changing to be more generic so 116 // ### LauncherView class needs changing to be more generic so
117 // this widget can change its background similar to the iconviews 117 // this widget can change its background similar to the iconviews
118 // so the background for this matches 118 // so the background for this matches
119 docLoadingWidget = new LauncherView( stack ); 119 docLoadingWidget = new LauncherView( stack );
120 docLoadingWidget->hideIcons(); 120 docLoadingWidget->hideIcons();
121 QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); 121 QVBox *docLoadingVBox = new QVBox( docLoadingWidget );
122 122
123 docLoadingVBox->setSpacing( 20 ); 123 docLoadingVBox->setSpacing( 20 );
124 docLoadingVBox->setMargin( 10 ); 124 docLoadingVBox->setMargin( 10 );
125 125
126 QWidget *space1 = new QWidget( docLoadingVBox ); 126 QWidget *space1 = new QWidget( docLoadingVBox );
127 docLoadingVBox->setStretchFactor( space1, 1 ); 127 docLoadingVBox->setStretchFactor( space1, 1 );
128 128
129 QLabel *waitPixmap = new QLabel( docLoadingVBox ); 129 QLabel *waitPixmap = new QLabel( docLoadingVBox );
130 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); 130 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) );
131 waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); 131 waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) );
132 waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); 132 waitPixmap->setAlignment( int( QLabel::AlignCenter ) );
133 133
134 QLabel *textLabel = new QLabel( docLoadingVBox ); 134 QLabel *textLabel = new QLabel( docLoadingVBox );
135 textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); 135 textLabel->setText( tr( "<b>Finding Documents...</b>" ) );
136 textLabel->setAlignment( int( QLabel::AlignCenter ) ); 136 textLabel->setAlignment( int( QLabel::AlignCenter ) );
137 137
138 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); 138 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox );
139 docLoadingWidgetProgress->setProgress( 0 ); 139 docLoadingWidgetProgress->setProgress( 0 );
140 docLoadingWidgetProgress->setCenterIndicator( TRUE ); 140 docLoadingWidgetProgress->setCenterIndicator( TRUE );
141 docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker 141 docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker
142 setProgressStyle(); 142 setProgressStyle();
143 143
144 QWidget *space2 = new QWidget( docLoadingVBox ); 144 QWidget *space2 = new QWidget( docLoadingVBox );
145 docLoadingVBox->setStretchFactor( space2, 1 ); 145 docLoadingVBox->setStretchFactor( space2, 1 );
146 146
147 Config cfg("Launcher"); 147 Config cfg("Launcher");
148 cfg.setGroup( "Tab Documents" ); // No tr 148 cfg.setGroup( "Tab Documents" ); // No tr
149 setTabViewAppearance( docLoadingWidget, cfg ); 149 setTabViewAppearance( docLoadingWidget, cfg );
150 150
151 stack->addWidget( docLoadingWidget, 0 ); 151 stack->addWidget( docLoadingWidget, 0 );
152} 152}
153 153
154void LauncherTabWidget::initLayout() 154void LauncherTabWidget::initLayout()
155{ 155{
156 layout()->activate(); 156 layout()->activate();
157 docView()->setFocus(); 157 docView()->setFocus();
158 categoryBar->showTab("Documents"); 158 categoryBar->showTab("Documents");
159} 159}
160 160
161void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) 161void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&)
162{ 162{
163 if ( message == "nextView()" ) 163 if ( message == "nextView()" )
164 categoryBar->nextTab(); 164 categoryBar->nextTab();
165} 165}
166 166
167void LauncherTabWidget::raiseTabWidget() 167void LauncherTabWidget::raiseTabWidget()
168{ 168{
169 if ( categoryBar->currentView() == docView() 169 if ( categoryBar->currentView() == docView()
170 && docLoadingWidgetEnabled ) { 170 && docLoadingWidgetEnabled ) {
171 stack->raiseWidget( docLoadingWidget ); 171 stack->raiseWidget( docLoadingWidget );
172 docLoadingWidget->updateGeometry(); 172 docLoadingWidget->updateGeometry();
173 } else { 173 } else {
174 stack->raiseWidget( categoryBar->currentView() ); 174 stack->raiseWidget( categoryBar->currentView() );
175 } 175 }
176} 176}
177 177
178void LauncherTabWidget::tabProperties() 178void LauncherTabWidget::tabProperties()
179{ 179{
180 LauncherView *view = categoryBar->currentView(); 180 LauncherView *view = categoryBar->currentView();
181 QPopupMenu *m = new QPopupMenu( this ); 181 QPopupMenu *m = new QPopupMenu( this );
182 m->insertItem( tr("Icon View"), LauncherView::Icon ); 182 m->insertItem( tr("Icon View"), LauncherView::Icon );
183 m->insertItem( tr("List View"), LauncherView::List ); 183 m->insertItem( tr("List View"), LauncherView::List );
184 m->setItemChecked( (int)view->viewMode(), TRUE ); 184 m->setItemChecked( (int)view->viewMode(), TRUE );
185 int rv = m->exec( QCursor::pos() ); 185 int rv = m->exec( QCursor::pos() );
186 if ( rv >= 0 && rv != view->viewMode() ) { 186 if ( rv >= 0 && rv != view->viewMode() ) {
187 view->setViewMode( (LauncherView::ViewMode)rv ); 187 view->setViewMode( (LauncherView::ViewMode)rv );
188 } 188 }
189 189
190 delete m; 190 delete m;
191} 191}
192 192
193void LauncherTabWidget::deleteView( const QString& id ) 193void LauncherTabWidget::deleteView( const QString& id )
194{ 194{
195 LauncherTab *t = categoryBar->launcherTab(id); 195 LauncherTab *t = categoryBar->launcherTab(id);
196 if ( t ) { 196 if ( t ) {
197 stack->removeWidget( t->view ); 197 stack->removeWidget( t->view );
198 delete t->view; 198 delete t->view;
199 categoryBar->removeTab( t ); 199 categoryBar->removeTab( t );
200 } 200 }
201} 201}
202 202
203LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) 203LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label )
204{ 204{
205 LauncherView* view = new LauncherView( stack ); 205 LauncherView* view = new LauncherView( stack );
206 connect( view, SIGNAL(clicked(const AppLnk*)), 206 connect( view, SIGNAL(clicked(const AppLnk*)),
207 this, SIGNAL(clicked(const AppLnk*))); 207 this, SIGNAL(clicked(const AppLnk*)));
208 connect( view, SIGNAL(rightPressed(AppLnk*)), 208 connect( view, SIGNAL(rightPressed(AppLnk*)),
209 this, SIGNAL(rightPressed(AppLnk*))); 209 this, SIGNAL(rightPressed(AppLnk*)));
210 210
211 int n = categoryBar->count(); 211 int n = categoryBar->count();
212 stack->addWidget( view, n ); 212 stack->addWidget( view, n );
213 213
214 LauncherTab *tab = new LauncherTab( id, view, pm, label ); 214 LauncherTab *tab = new LauncherTab( id, view, pm, label );
215 categoryBar->insertTab( tab, n-1 ); 215 categoryBar->insertTab( tab, n-1 );
216 216
217 if ( id == "Documents" ) 217 if ( id == "Documents" )
218 docview = view; 218 docview = view;
219 219
220 qDebug("inserting %s at %d", id.latin1(), n-1 ); 220 qDebug("inserting %s at %d", id.latin1(), n-1 );
221 221
222 Config cfg("Launcher"); 222 Config cfg("Launcher");
223 setTabAppearance( tab, cfg ); 223 setTabAppearance( tab, cfg );
224 224
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index 5416d33..988e432 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -1,227 +1,227 @@
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" 26#include "taskbar.h"
27#include "stabmon.h" 27#include "stabmon.h"
28#include "launcher.h" 28#include "launcher.h"
29#include "firstuse.h" 29#include "firstuse.h"
30#include "launcherglobal.h" 30#include "launcherglobal.h"
31 31
32#include <qtopia/qpeapplication.h> 32#include <qtopia/qpeapplication.h>
33#include <qtopia/network.h> 33#include <qtopia/network.h>
34#include <qtopia/config.h> 34#include <qtopia/config.h>
35#include <qtopia/custom.h> 35//#include <qtopia/custom.h>
36#include <qtopia/global.h> 36#include <qtopia/global.h>
37 37
38#include <qfile.h> 38#include <qfile.h>
39#include <qdir.h> 39#include <qdir.h>
40#ifdef QWS 40#ifdef QWS
41#include <qwindowsystem_qws.h> 41#include <qwindowsystem_qws.h>
42#include <qtopia/qcopenvelope_qws.h> 42#include <qtopia/qcopenvelope_qws.h>
43#endif 43#endif
44#include <qtopia/alarmserver.h> 44#include <qtopia/alarmserver.h>
45 45
46#include <stdlib.h> 46#include <stdlib.h>
47#include <stdio.h> 47#include <stdio.h>
48#include <signal.h> 48#include <signal.h>
49#ifndef Q_OS_WIN32 49#ifndef Q_OS_WIN32
50#include <unistd.h> 50#include <unistd.h>
51#else 51#else
52#include <process.h> 52#include <process.h>
53#endif 53#endif
54 54
55#include "calibrate.h" 55#include "calibrate.h"
56 56
57 57
58#ifdef QT_QWS_LOGIN 58#ifdef QT_QWS_LOGIN
59#include "../login/qdmdialogimpl.h" 59#include "../login/qdmdialogimpl.h"
60#endif 60#endif
61 61
62#ifdef Q_WS_QWS 62#ifdef Q_WS_QWS
63#include <qkeyboard_qws.h> 63#include <qkeyboard_qws.h>
64#endif 64#endif
65 65
66#include <qmessagebox.h> 66#include <qmessagebox.h>
67#include <opie/odevice.h> 67#include <opie/odevice.h>
68 68
69using namespace Opie; 69using namespace Opie;
70 70
71 71
72static void cleanup() 72static void cleanup()
73{ 73{
74 QDir dir( Opie::Global::tempDir(), "qcop-msg-*" ); 74 QDir dir( Opie::Global::tempDir(), "qcop-msg-*" );
75 75
76 QStringList stale = dir.entryList(); 76 QStringList stale = dir.entryList();
77 QStringList::Iterator it; 77 QStringList::Iterator it;
78 for ( it = stale.begin(); it != stale.end(); ++it ) { 78 for ( it = stale.begin(); it != stale.end(); ++it ) {
79 dir.remove( *it ); 79 dir.remove( *it );
80 } 80 }
81} 81}
82 82
83static void refreshTimeZoneConfig() 83static void refreshTimeZoneConfig()
84{ 84{
85 /* ### FIXME timezone handling */ 85 /* ### FIXME timezone handling */
86#if 0 86#if 0
87 // We need to help WorldTime in setting up its configuration for 87 // We need to help WorldTime in setting up its configuration for
88 // the current translation 88 // the current translation
89 // BEGIN no tr 89 // BEGIN no tr
90 const char *defaultTz[] = { 90 const char *defaultTz[] = {
91 "America/New_York", 91 "America/New_York",
92 "America/Los_Angeles", 92 "America/Los_Angeles",
93 "Europe/Oslo", 93 "Europe/Oslo",
94 "Asia/Tokyo", 94 "Asia/Tokyo",
95 "Asia/Hong_Kong", 95 "Asia/Hong_Kong",
96 "Australia/Brisbane", 96 "Australia/Brisbane",
97 0 97 0
98 }; 98 };
99 // END no tr 99 // END no tr
100 100
101 TimeZone curZone; 101 TimeZone curZone;
102 QString zoneID; 102 QString zoneID;
103 int zoneIndex; 103 int zoneIndex;
104 Config cfg = Config( "WorldTime" ); 104 Config cfg = Config( "WorldTime" );
105 cfg.setGroup( "TimeZones" ); 105 cfg.setGroup( "TimeZones" );
106 if (!cfg.hasKey( "Zone0" )){ 106 if (!cfg.hasKey( "Zone0" )){
107 // We have no existing timezones use the defaults which are untranslated strings 107 // We have no existing timezones use the defaults which are untranslated strings
108 QString currTz = TimeZone::current().id(); 108 QString currTz = TimeZone::current().id();
109 QStringList zoneDefaults; 109 QStringList zoneDefaults;
110 zoneDefaults.append( currTz ); 110 zoneDefaults.append( currTz );
111 for ( int i = 0; defaultTz[i] && zoneDefaults.count() < 6; i++ ) { 111 for ( int i = 0; defaultTz[i] && zoneDefaults.count() < 6; i++ ) {
112 if ( defaultTz[i] != currTz ) 112 if ( defaultTz[i] != currTz )
113 zoneDefaults.append( defaultTz[i] ); 113 zoneDefaults.append( defaultTz[i] );
114 } 114 }
115 zoneIndex = 0; 115 zoneIndex = 0;
116 for (QStringList::Iterator it = zoneDefaults.begin(); it != zoneDefaults.end() ; ++it){ 116 for (QStringList::Iterator it = zoneDefaults.begin(); it != zoneDefaults.end() ; ++it){
117 cfg.writeEntry( "Zone" + QString::number( zoneIndex ) , *it); 117 cfg.writeEntry( "Zone" + QString::number( zoneIndex ) , *it);
118 zoneIndex++; 118 zoneIndex++;
119 } 119 }
120 } 120 }
121 // We have an existing list of timezones refresh the 121 // We have an existing list of timezones refresh the
122 // translations of TimeZone name 122 // translations of TimeZone name
123 zoneIndex = 0; 123 zoneIndex = 0;
124 while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){ 124 while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){
125 zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex )); 125 zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex ));
126 curZone = TimeZone( zoneID ); 126 curZone = TimeZone( zoneID );
127 if ( !curZone.isValid() ){ 127 if ( !curZone.isValid() ){
128 qDebug( "initEnvironment() Invalid TimeZone %s", zoneID.latin1() ); 128 qDebug( "initEnvironment() Invalid TimeZone %s", zoneID.latin1() );
129 break; 129 break;
130 } 130 }
131 cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() ); 131 cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() );
132 zoneIndex++; 132 zoneIndex++;
133 } 133 }
134#endif 134#endif
135} 135}
136 136
137void initEnvironment() 137void initEnvironment()
138{ 138{
139#ifdef Q_OS_WIN32 139#ifdef Q_OS_WIN32
140 // Config file requires HOME dir which uses QDir which needs the winver 140 // Config file requires HOME dir which uses QDir which needs the winver
141 qt_init_winver(); 141 qt_init_winver();
142#endif 142#endif
143 Config config("locale"); 143 Config config("locale");
144 config.setGroup( "Location" ); 144 config.setGroup( "Location" );
145 QString tz = config.readEntry( "Timezone", getenv("TZ") ).stripWhiteSpace(); 145 QString tz = config.readEntry( "Timezone", getenv("TZ") ).stripWhiteSpace();
146 146
147 // if not timezone set, pick New York 147 // if not timezone set, pick New York
148 if (tz.isNull() || tz.isEmpty()) 148 if (tz.isNull() || tz.isEmpty())
149 tz = "America/New_York"; 149 tz = "America/New_York";
150 150
151 setenv( "TZ", tz, 1 ); 151 setenv( "TZ", tz, 1 );
152 config.writeEntry( "Timezone", tz); 152 config.writeEntry( "Timezone", tz);
153 153
154 config.setGroup( "Language" ); 154 config.setGroup( "Language" );
155 QString lang = config.readEntry( "Language", getenv("LANG") ).stripWhiteSpace(); 155 QString lang = config.readEntry( "Language", getenv("LANG") ).stripWhiteSpace();
156 if( lang.isNull() || lang.isEmpty()) 156 if( lang.isNull() || lang.isEmpty())
157 lang = "en_US"; 157 lang = "en_US";
158 158
159 setenv( "LANG", lang, 1 ); 159 setenv( "LANG", lang, 1 );
160 config.writeEntry("Language", lang); 160 config.writeEntry("Language", lang);
161 config.write(); 161 config.write();
162 162
163#if 0 163#if 0
164 setenv( "QWS_SIZE", "240x320", 0 ); 164 setenv( "QWS_SIZE", "240x320", 0 );
165#endif 165#endif
166 166
167 167
168 168
169 QString env(getenv("QWS_DISPLAY")); 169 QString env(getenv("QWS_DISPLAY"));
170 if (env.contains("Transformed")) { 170 if (env.contains("Transformed")) {
171 int rot; 171 int rot;
172 // transformed driver default rotation is controlled by the hardware. 172 // transformed driver default rotation is controlled by the hardware.
173 Config config("qpe"); 173 Config config("qpe");
174 config.setGroup( "Rotation" ); 174 config.setGroup( "Rotation" );
175 if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 ) 175 if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 )
176 rot = ODevice::inst ( )-> rotation ( ) * 90; 176 rot = ODevice::inst ( )-> rotation ( ) * 90;
177 177
178 setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); 178 setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1);
179 QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */ 179 QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */
180 } 180 }
181} 181}
182 182
183static void initKeyboard() 183static void initKeyboard()
184{ 184{
185 Config config("qpe"); 185 Config config("qpe");
186 186
187 config.setGroup( "Keyboard" ); 187 config.setGroup( "Keyboard" );
188 188
189 int ard = config.readNumEntry( "RepeatDelay" ); 189 int ard = config.readNumEntry( "RepeatDelay" );
190 int arp = config.readNumEntry( "RepeatPeriod" ); 190 int arp = config.readNumEntry( "RepeatPeriod" );
191 if ( ard > 0 && arp > 0 ) 191 if ( ard > 0 && arp > 0 )
192 qwsSetKeyboardAutoRepeat( ard, arp ); 192 qwsSetKeyboardAutoRepeat( ard, arp );
193 193
194 QString layout = config.readEntry( "Layout", "us101" ); 194 QString layout = config.readEntry( "Layout", "us101" );
195 Server::setKeyboardLayout( layout ); 195 Server::setKeyboardLayout( layout );
196} 196}
197 197
198static bool firstUse() 198static bool firstUse()
199{ 199{
200 bool needFirstUse = FALSE; 200 bool needFirstUse = FALSE;
201 if ( QWSServer::mouseHandler() && 201 if ( QWSServer::mouseHandler() &&
202 QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { 202 QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) {
203 if ( !QFile::exists( "/etc/pointercal" ) ) 203 if ( !QFile::exists( "/etc/pointercal" ) )
204 needFirstUse = TRUE; 204 needFirstUse = TRUE;
205 } 205 }
206 206
207 { 207 {
208 Config config( "qpe" ); 208 Config config( "qpe" );
209 config.setGroup( "Startup" ); 209 config.setGroup( "Startup" );
210 needFirstUse |= config.readBoolEntry( "FirstUse", TRUE ); 210 needFirstUse |= config.readBoolEntry( "FirstUse", TRUE );
211 } 211 }
212 212
213 if ( !needFirstUse ) 213 if ( !needFirstUse )
214 return FALSE; 214 return FALSE;
215 215
216 FirstUse *fu = new FirstUse(); 216 FirstUse *fu = new FirstUse();
217 fu->exec(); 217 fu->exec();
218 bool rs = fu->restartNeeded(); 218 bool rs = fu->restartNeeded();
219 delete fu; 219 delete fu;
220 return rs; 220 return rs;
221} 221}
222 222
223int initApplication( int argc, char ** argv ) 223int initApplication( int argc, char ** argv )
224{ 224{
225 cleanup(); 225 cleanup();
226 226
227 227
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index 4c62b78..6a140e9 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -1,244 +1,244 @@
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" 23#include "launcher.h"
24#include "startmenu.h" 24#include "startmenu.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" 32#include "launcher.h"
33#include "shutdownimpl.h" 33#include "shutdownimpl.h"
34#include "applauncher.h" 34#include "applauncher.h"
35#if 0 35#if 0
36#include "suspendmonitor.h" 36#include "suspendmonitor.h"
37#endif 37#endif
38#include "documentlist.h" 38#include "documentlist.h"
39 39
40#include <qtopia/applnk.h> 40#include <qtopia/applnk.h>
41#include <qtopia/private/categories.h> 41#include <qtopia/private/categories.h>
42#include <qtopia/mimetype.h> 42#include <qtopia/mimetype.h>
43#include <qtopia/config.h> 43#include <qtopia/config.h>
44#include <qtopia/resource.h> 44#include <qtopia/resource.h>
45#include <qtopia/version.h> 45#include <qtopia/version.h>
46#include <qtopia/storage.h> 46#include <qtopia/storage.h>
47 47
48#include <qtopia/qcopenvelope_qws.h> 48#include <qtopia/qcopenvelope_qws.h>
49#include <qwindowsystem_qws.h> 49#include <qwindowsystem_qws.h>
50#include <qgfx_qws.h> 50#include <qgfx_qws.h>
51#include <qtopia/global.h> 51#include <qtopia/global.h>
52#include <qtopia/custom.h> 52//#include <qtopia/custom.h>
53 53
54#include <opie/odevicebutton.h> 54#include <opie/odevicebutton.h>
55#include <opie/odevice.h> 55#include <opie/odevice.h>
56 56
57#include <unistd.h> 57#include <unistd.h>
58#include <qmainwindow.h> 58#include <qmainwindow.h>
59#include <qmessagebox.h> 59#include <qmessagebox.h>
60#include <qtimer.h> 60#include <qtimer.h>
61#include <qtextstream.h> 61#include <qtextstream.h>
62 62
63#include <stdlib.h> 63#include <stdlib.h>
64 64
65extern QRect qt_maxWindowRect; 65extern QRect qt_maxWindowRect;
66 66
67using namespace Opie; 67using namespace Opie;
68 68
69static QWidget *calibrate(bool) 69static QWidget *calibrate(bool)
70{ 70{
71#ifdef Q_WS_QWS 71#ifdef Q_WS_QWS
72 Calibrate *c = new Calibrate; 72 Calibrate *c = new Calibrate;
73 c->show(); 73 c->show();
74 return c; 74 return c;
75#else 75#else
76 return 0; 76 return 0;
77#endif 77#endif
78} 78}
79 79
80#define FACTORY(T) \ 80#define FACTORY(T) \
81 static QWidget *new##T( bool maximized ) { \ 81 static QWidget *new##T( bool maximized ) { \
82 QWidget *w = new T( 0, 0, QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ 82 QWidget *w = new T( 0, 0, QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
83 if ( maximized ) { \ 83 if ( maximized ) { \
84 if ( qApp->desktop()->width() <= 350 ) { \ 84 if ( qApp->desktop()->width() <= 350 ) { \
85 w->showMaximized(); \ 85 w->showMaximized(); \
86 } else { \ 86 } else { \
87 w->resize( QSize( 300, 300 ) ); \ 87 w->resize( QSize( 300, 300 ) ); \
88 } \ 88 } \
89 } \ 89 } \
90 w->show(); \ 90 w->show(); \
91 return w; \ 91 return w; \
92 } 92 }
93 93
94 94
95#ifdef SINGLE_APP 95#ifdef SINGLE_APP
96#define APP(a,b,c,d) FACTORY(b) 96#define APP(a,b,c,d) FACTORY(b)
97#include "apps.h" 97#include "apps.h"
98#undef APP 98#undef APP
99#endif // SINGLE_APP 99#endif // SINGLE_APP
100 100
101static Global::Command builtins[] = { 101static Global::Command builtins[] = {
102 102
103#ifdef SINGLE_APP 103#ifdef SINGLE_APP
104#define APP(a,b,c,d) { a, new##b, c, d }, 104#define APP(a,b,c,d) { a, new##b, c, d },
105#include "apps.h" 105#include "apps.h"
106#undef APP 106#undef APP
107#endif 107#endif
108 108
109 /* FIXME defines need to be defined*/ 109 /* FIXME defines need to be defined*/
110#if defined(QPE_NEED_CALIBRATION) 110#if defined(QPE_NEED_CALIBRATION)
111 { "calibrate", calibrate, 1, 0 }, // No tr 111 { "calibrate", calibrate, 1, 0 }, // No tr
112#endif 112#endif
113#if !defined(OPIE_NO_BUILTIN_SHUTDOWN) 113#if !defined(OPIE_NO_BUILTIN_SHUTDOWN)
114 { "shutdown", Global::shutdown, 1, 0 }, // No tr 114 { "shutdown", Global::shutdown, 1, 0 }, // No tr
115 // { "run", run, 1, 0 }, // No tr 115 // { "run", run, 1, 0 }, // No tr
116#endif 116#endif
117 117
118 { 0, calibrate,0, 0 }, 118 { 0, calibrate,0, 0 },
119}; 119};
120 120
121 121
122//--------------------------------------------------------------------------- 122//---------------------------------------------------------------------------
123 123
124 124
125//=========================================================================== 125//===========================================================================
126 126
127Server::Server() : 127Server::Server() :
128 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), 128 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ),
129 qcopBridge( 0 ), 129 qcopBridge( 0 ),
130 transferServer( 0 ), 130 transferServer( 0 ),
131 packageHandler( 0 ), 131 packageHandler( 0 ),
132 syncDialog( 0 ) 132 syncDialog( 0 )
133{ 133{
134 Global::setBuiltinCommands(builtins); 134 Global::setBuiltinCommands(builtins);
135 135
136 tid_xfer = 0; 136 tid_xfer = 0;
137 /* ### FIXME ### */ 137 /* ### FIXME ### */
138/* tid_today = startTimer(3600*2*1000);*/ 138/* tid_today = startTimer(3600*2*1000);*/
139 last_today_show = QDate::currentDate(); 139 last_today_show = QDate::currentDate();
140 140
141#if 0 141#if 0
142 tsmMonitor = new TempScreenSaverMode(); 142 tsmMonitor = new TempScreenSaverMode();
143 connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) ); 143 connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) );
144#endif 144#endif
145 145
146 serverGui = new Launcher; 146 serverGui = new Launcher;
147 serverGui->createGUI(); 147 serverGui->createGUI();
148 148
149 docList = new DocumentList( serverGui ); 149 docList = new DocumentList( serverGui );
150 appLauncher = new AppLauncher(this); 150 appLauncher = new AppLauncher(this);
151 connect(appLauncher, SIGNAL(launched(int, const QString &)), this, SLOT(applicationLaunched(int, const QString &)) ); 151 connect(appLauncher, SIGNAL(launched(int, const QString &)), this, SLOT(applicationLaunched(int, const QString &)) );
152 connect(appLauncher, SIGNAL(terminated(int, const QString &)), this, SLOT(applicationTerminated(int, const QString &)) ); 152 connect(appLauncher, SIGNAL(terminated(int, const QString &)), this, SLOT(applicationTerminated(int, const QString &)) );
153 connect(appLauncher, SIGNAL(connected(const QString &)), this, SLOT(applicationConnected(const QString &)) ); 153 connect(appLauncher, SIGNAL(connected(const QString &)), this, SLOT(applicationConnected(const QString &)) );
154 154
155 storage = new StorageInfo( this ); 155 storage = new StorageInfo( this );
156 connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) ); 156 connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) );
157 157
158 // start services 158 // start services
159 startTransferServer(); 159 startTransferServer();
160 (void) new IrServer( this ); 160 (void) new IrServer( this );
161 161
162 packageHandler = new PackageHandler( this ); 162 packageHandler = new PackageHandler( this );
163 connect(qApp, SIGNAL(activate(const Opie::ODeviceButton*,bool)), 163 connect(qApp, SIGNAL(activate(const Opie::ODeviceButton*,bool)),
164 this,SLOT(activate(const Opie::ODeviceButton*,bool))); 164 this,SLOT(activate(const Opie::ODeviceButton*,bool)));
165 165
166 setGeometry( -10, -10, 9, 9 ); 166 setGeometry( -10, -10, 9, 9 );
167 167
168 QCopChannel *channel = new QCopChannel("QPE/System", this); 168 QCopChannel *channel = new QCopChannel("QPE/System", this);
169 connect(channel, SIGNAL(received(const QCString &, const QByteArray &)), 169 connect(channel, SIGNAL(received(const QCString &, const QByteArray &)),
170 this, SLOT(systemMsg(const QCString &, const QByteArray &)) ); 170 this, SLOT(systemMsg(const QCString &, const QByteArray &)) );
171 171
172 QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this ); 172 QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this );
173 connect( tbChannel, SIGNAL(received(const QCString&, const QByteArray&)), 173 connect( tbChannel, SIGNAL(received(const QCString&, const QByteArray&)),
174 this, SLOT(receiveTaskBar(const QCString&, const QByteArray&)) ); 174 this, SLOT(receiveTaskBar(const QCString&, const QByteArray&)) );
175 175
176 connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) ); 176 connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) );
177 connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) ); 177 connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) );
178 178
179 preloadApps(); 179 preloadApps();
180} 180}
181 181
182void Server::show() 182void Server::show()
183{ 183{
184 ServerApplication::login(TRUE); 184 ServerApplication::login(TRUE);
185 QWidget::show(); 185 QWidget::show();
186} 186}
187 187
188Server::~Server() 188Server::~Server()
189{ 189{
190 serverGui->destroyGUI(); 190 serverGui->destroyGUI();
191 delete docList; 191 delete docList;
192 delete qcopBridge; 192 delete qcopBridge;
193 delete transferServer; 193 delete transferServer;
194 delete serverGui; 194 delete serverGui;
195#if 0 195#if 0
196 delete tsmMonitor; 196 delete tsmMonitor;
197#endif 197#endif
198} 198}
199 199
200static bool hasVisibleWindow(const QString& clientname, bool partial) 200static bool hasVisibleWindow(const QString& clientname, bool partial)
201{ 201{
202#ifdef QWS 202#ifdef QWS
203 const QList<QWSWindow> &list = qwsServer->clientWindows(); 203 const QList<QWSWindow> &list = qwsServer->clientWindows();
204 QWSWindow* w; 204 QWSWindow* w;
205 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 205 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
206 if ( w->client()->identity() == clientname ) { 206 if ( w->client()->identity() == clientname ) {
207 if ( partial && !w->isFullyObscured() ) 207 if ( partial && !w->isFullyObscured() )
208 return TRUE; 208 return TRUE;
209 if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) { 209 if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) {
210# if QT_VERSION < 0x030000 210# if QT_VERSION < 0x030000
211 QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect, 211 QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect,
212 QSize(qt_screen->width(),qt_screen->height()) ); 212 QSize(qt_screen->width(),qt_screen->height()) );
213# else 213# else
214 QRect mwr = qt_maxWindowRect; 214 QRect mwr = qt_maxWindowRect;
215# endif 215# endif
216 if ( mwr.contains(w->requested().boundingRect()) ) 216 if ( mwr.contains(w->requested().boundingRect()) )
217 return TRUE; 217 return TRUE;
218 } 218 }
219 } 219 }
220 } 220 }
221#endif 221#endif
222 return FALSE; 222 return FALSE;
223} 223}
224 224
225void Server::activate(const Opie::ODeviceButton* button, bool held) 225void Server::activate(const Opie::ODeviceButton* button, bool held)
226{ 226{
227 Global::terminateBuiltin("calibrate"); // No tr 227 Global::terminateBuiltin("calibrate"); // No tr
228 Opie::OQCopMessage om; 228 Opie::OQCopMessage om;
229 if ( held ) { 229 if ( held ) {
230 om = button->heldAction(); 230 om = button->heldAction();
231 } else { 231 } else {
232 om = button->pressedAction(); 232 om = button->pressedAction();
233 } 233 }
234 234
235 if ( om.channel() != "ignore" ) 235 if ( om.channel() != "ignore" )
236 om.send(); 236 om.send();
237 237
238 // A button with no action defined, will return a null ServiceRequest. Don't attempt 238 // A button with no action defined, will return a null ServiceRequest. Don't attempt
239 // to send/do anything with this as it will crash 239 // to send/do anything with this as it will crash
240 /* ### FIXME */ 240 /* ### FIXME */
241#if 0 241#if 0
242 if ( !sr.isNull() ) { 242 if ( !sr.isNull() ) {
243 QString app = sr.app(); 243 QString app = sr.app();
244 bool vis = hasVisibleWindow(app, app != "qpe"); 244 bool vis = hasVisibleWindow(app, app != "qpe");
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp
index 69e083d..23a7f95 100644
--- a/core/launcher/serverapp.cpp
+++ b/core/launcher/serverapp.cpp
@@ -1,225 +1,225 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2003 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2003 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 "serverapp.h" 21#include "serverapp.h"
22 22
23#include <opie/odevice.h> 23#include <opie/odevice.h>
24 24
25#include <qtopia/password.h> 25#include <qtopia/password.h>
26#include <qtopia/config.h> 26#include <qtopia/config.h>
27#include <qtopia/power.h> 27#include <qtopia/power.h>
28 28
29#ifdef Q_WS_QWS 29#ifdef Q_WS_QWS
30#include <qtopia/qcopenvelope_qws.h> 30#include <qtopia/qcopenvelope_qws.h>
31#endif 31#endif
32#include <qtopia/global.h> 32#include <qtopia/global.h>
33#include <qtopia/custom.h> 33//#include <qtopia/custom.h>
34 34
35#ifdef Q_WS_QWS 35#ifdef Q_WS_QWS
36#include <qgfx_qws.h> 36#include <qgfx_qws.h>
37#endif 37#endif
38#ifdef Q_OS_WIN32 38#ifdef Q_OS_WIN32
39#include <io.h> 39#include <io.h>
40#include <process.h> 40#include <process.h>
41#else 41#else
42#include <unistd.h> 42#include <unistd.h>
43#endif 43#endif
44#include <qmessagebox.h> 44#include <qmessagebox.h>
45#include <qtimer.h> 45#include <qtimer.h>
46#include <qpainter.h> 46#include <qpainter.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qpixmapcache.h> 48#include <qpixmapcache.h>
49 49
50#include <stdlib.h> 50#include <stdlib.h>
51#include "screensaver.h" 51#include "screensaver.h"
52 52
53static ServerApplication *serverApp = 0; 53static ServerApplication *serverApp = 0;
54static int loggedin=0; 54static int loggedin=0;
55 55
56using namespace Opie; 56using namespace Opie;
57 57
58QCopKeyRegister::QCopKeyRegister() 58QCopKeyRegister::QCopKeyRegister()
59 : m_keyCode( 0 ) { 59 : m_keyCode( 0 ) {
60} 60}
61 61
62QCopKeyRegister::QCopKeyRegister( int k, const QCString& c, const QCString& m ) 62QCopKeyRegister::QCopKeyRegister( int k, const QCString& c, const QCString& m )
63 :m_keyCode( k ), m_channel( c ), m_message( m ) { 63 :m_keyCode( k ), m_channel( c ), m_message( m ) {
64} 64}
65 65
66int QCopKeyRegister::keyCode()const { 66int QCopKeyRegister::keyCode()const {
67 return m_keyCode; 67 return m_keyCode;
68} 68}
69 69
70QCString QCopKeyRegister::channel()const { 70QCString QCopKeyRegister::channel()const {
71 return m_channel; 71 return m_channel;
72} 72}
73 73
74QCString QCopKeyRegister::message()const { 74QCString QCopKeyRegister::message()const {
75 return m_message; 75 return m_message;
76} 76}
77 77
78bool QCopKeyRegister::send() { 78bool QCopKeyRegister::send() {
79 if (m_channel.isNull() ) 79 if (m_channel.isNull() )
80 return false; 80 return false;
81 81
82 QCopEnvelope( m_channel, m_message ); 82 QCopEnvelope( m_channel, m_message );
83 83
84 return true; 84 return true;
85} 85}
86 86
87//--------------------------------------------------------------------------- 87//---------------------------------------------------------------------------
88 88
89/* 89/*
90 Priority is number of alerts that are needed to pop up 90 Priority is number of alerts that are needed to pop up
91 alert. 91 alert.
92 */ 92 */
93class DesktopPowerAlerter : public QMessageBox 93class DesktopPowerAlerter : public QMessageBox
94{ 94{
95 Q_OBJECT 95 Q_OBJECT
96public: 96public:
97 DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) 97 DesktopPowerAlerter( QWidget *parent, const char *name = 0 )
98 : QMessageBox( tr("Battery Status"), tr("Low Battery"), 98 : QMessageBox( tr("Battery Status"), tr("Low Battery"),
99 QMessageBox::Critical, 99 QMessageBox::Critical,
100 QMessageBox::Ok | QMessageBox::Default, 100 QMessageBox::Ok | QMessageBox::Default,
101 QMessageBox::NoButton, QMessageBox::NoButton, 101 QMessageBox::NoButton, QMessageBox::NoButton,
102 parent, name, FALSE ) 102 parent, name, FALSE )
103 { 103 {
104 currentPriority = INT_MAX; 104 currentPriority = INT_MAX;
105 alertCount = 0; 105 alertCount = 0;
106 } 106 }
107 107
108 void alert( const QString &text, int priority ); 108 void alert( const QString &text, int priority );
109 void hideEvent( QHideEvent * ); 109 void hideEvent( QHideEvent * );
110private: 110private:
111 int currentPriority; 111 int currentPriority;
112 int alertCount; 112 int alertCount;
113}; 113};
114 114
115void DesktopPowerAlerter::alert( const QString &text, int priority ) 115void DesktopPowerAlerter::alert( const QString &text, int priority )
116{ 116{
117 alertCount++; 117 alertCount++;
118 if ( alertCount < priority ) 118 if ( alertCount < priority )
119 return; 119 return;
120 if ( priority > currentPriority ) 120 if ( priority > currentPriority )
121 return; 121 return;
122 currentPriority = priority; 122 currentPriority = priority;
123 setText( text ); 123 setText( text );
124 show(); 124 show();
125} 125}
126 126
127 127
128void DesktopPowerAlerter::hideEvent( QHideEvent *e ) 128void DesktopPowerAlerter::hideEvent( QHideEvent *e )
129{ 129{
130 QMessageBox::hideEvent( e ); 130 QMessageBox::hideEvent( e );
131 alertCount = 0; 131 alertCount = 0;
132 currentPriority = INT_MAX; 132 currentPriority = INT_MAX;
133} 133}
134 134
135//--------------------------------------------------------------------------- 135//---------------------------------------------------------------------------
136 136
137KeyFilter::KeyFilter(QObject* parent) : QObject(parent), held_tid(0), heldButton(0) 137KeyFilter::KeyFilter(QObject* parent) : QObject(parent), held_tid(0), heldButton(0)
138{ 138{
139 /* We don't do this cause it would interfere with ODevice */ 139 /* We don't do this cause it would interfere with ODevice */
140#if 0 140#if 0
141 qwsServer->setKeyboardFilter(this); 141 qwsServer->setKeyboardFilter(this);
142#endif 142#endif
143} 143}
144 144
145void KeyFilter::timerEvent(QTimerEvent* e) 145void KeyFilter::timerEvent(QTimerEvent* e)
146{ 146{
147 if ( e->timerId() == held_tid ) { 147 if ( e->timerId() == held_tid ) {
148 killTimer(held_tid); 148 killTimer(held_tid);
149 // button held 149 // button held
150 if ( heldButton ) { 150 if ( heldButton ) {
151 emit activate(heldButton, TRUE); 151 emit activate(heldButton, TRUE);
152 heldButton = 0; 152 heldButton = 0;
153 } 153 }
154 held_tid = 0; 154 held_tid = 0;
155 } 155 }
156} 156}
157 157
158void KeyFilter::registerKey( const QCopKeyRegister& key ) { 158void KeyFilter::registerKey( const QCopKeyRegister& key ) {
159 m_keys.insert( key.keyCode(), key ); 159 m_keys.insert( key.keyCode(), key );
160} 160}
161 161
162void KeyFilter::unregisterKey( const QCopKeyRegister& key ) { 162void KeyFilter::unregisterKey( const QCopKeyRegister& key ) {
163 m_keys.remove( key.keyCode() ); 163 m_keys.remove( key.keyCode() );
164} 164}
165 165
166bool KeyFilter::keyRegistered( int key ) { 166bool KeyFilter::keyRegistered( int key ) {
167 /* 167 /*
168 * Check if we've a key registered 168 * Check if we've a key registered
169 */ 169 */
170 if ( !m_keys[key].send()) 170 if ( !m_keys[key].send())
171 return false; 171 return false;
172 else 172 else
173 return true; 173 return true;
174 174
175} 175}
176 176
177bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepeat) 177bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepeat)
178{ 178{
179 if ( !loggedin 179 if ( !loggedin
180 // Permitted keys 180 // Permitted keys
181 && keycode != Key_F34 // power 181 && keycode != Key_F34 // power
182 && keycode != Key_F30 // select 182 && keycode != Key_F30 // select
183 && keycode != Key_Enter 183 && keycode != Key_Enter
184 && keycode != Key_Return 184 && keycode != Key_Return
185 && keycode != Key_Space 185 && keycode != Key_Space
186 && keycode != Key_Left 186 && keycode != Key_Left
187 && keycode != Key_Right 187 && keycode != Key_Right
188 && keycode != Key_Up 188 && keycode != Key_Up
189 && keycode != Key_Down ) 189 && keycode != Key_Down )
190 return TRUE; 190 return TRUE;
191 191
192 /* check if it was registered */ 192 /* check if it was registered */
193 if (!db ) { 193 if (!db ) {
194 if (keycode != 0 &&press && !autoRepeat && keyRegistered(keycode) ) 194 if (keycode != 0 &&press && !autoRepeat && keyRegistered(keycode) )
195 return true; 195 return true;
196 }else { 196 }else {
197 197
198 198
199 // First check to see if DeviceButtonManager knows something about this button: 199 // First check to see if DeviceButtonManager knows something about this button:
200 const Opie::ODeviceButton* button = Opie::ODevice::inst()->buttonForKeycode(keycode); 200 const Opie::ODeviceButton* button = Opie::ODevice::inst()->buttonForKeycode(keycode);
201 if (button && !autoRepeat) { 201 if (button && !autoRepeat) {
202 if ( held_tid ) { 202 if ( held_tid ) {
203 killTimer(held_tid); 203 killTimer(held_tid);
204 held_tid = 0; 204 held_tid = 0;
205 } 205 }
206 if ( button->heldAction().isNull() ) { 206 if ( button->heldAction().isNull() ) {
207 if ( press ) 207 if ( press )
208 emit activate(button, FALSE); 208 emit activate(button, FALSE);
209 } else if ( press ) { 209 } else if ( press ) {
210 heldButton = button; 210 heldButton = button;
211 held_tid = startTimer( ODevice::inst ()->buttonHoldTime () ); 211 held_tid = startTimer( ODevice::inst ()->buttonHoldTime () );
212 } else if ( heldButton ) { 212 } else if ( heldButton ) {
213 heldButton = 0; 213 heldButton = 0;
214 emit activate(button, FALSE); 214 emit activate(button, FALSE);
215 } 215 }
216 QWSServer::screenSaverActivate(FALSE); 216 QWSServer::screenSaverActivate(FALSE);
217 return TRUE; 217 return TRUE;
218 } 218 }
219 return false; 219 return false;
220 } 220 }
221 if ( keycode == HardKey_Suspend ) { 221 if ( keycode == HardKey_Suspend ) {
222 if ( press ) emit power(); 222 if ( press ) emit power();
223 return TRUE; 223 return TRUE;
224 } 224 }
225 if ( keycode == HardKey_Backlight ) { 225 if ( keycode == HardKey_Backlight ) {
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 2966168..491a8a3 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -1,229 +1,229 @@
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 "startmenu.h" 21#include "startmenu.h"
22#include "inputmethods.h" 22#include "inputmethods.h"
23#include "runningappbar.h" 23#include "runningappbar.h"
24#include "systray.h" 24#include "systray.h"
25#include "wait.h" 25#include "wait.h"
26#include "appicons.h" 26#include "appicons.h"
27 27
28#include "taskbar.h" 28#include "taskbar.h"
29#include "server.h" 29#include "server.h"
30 30
31#include <qtopia/config.h> 31#include <qtopia/config.h>
32#include <qtopia/qpeapplication.h> 32#include <qtopia/qpeapplication.h>
33#ifdef QWS 33#ifdef QWS
34#include <qtopia/qcopenvelope_qws.h> 34#include <qtopia/qcopenvelope_qws.h>
35#endif 35#endif
36#include <qtopia/global.h> 36#include <qtopia/global.h>
37#include <qtopia/custom.h> 37//#include <qtopia/custom.h>
38 38
39#include <qlabel.h> 39#include <qlabel.h>
40#include <qlayout.h> 40#include <qlayout.h>
41#include <qtimer.h> 41#include <qtimer.h>
42#ifdef QWS 42#ifdef QWS
43#include <qwindowsystem_qws.h> 43#include <qwindowsystem_qws.h>
44#endif 44#endif
45#include <qwidgetstack.h> 45#include <qwidgetstack.h>
46 46
47#if defined( Q_WS_QWS ) 47#if defined( Q_WS_QWS )
48#include <qwsdisplay_qws.h> 48#include <qwsdisplay_qws.h>
49#include <qgfx_qws.h> 49#include <qgfx_qws.h>
50#endif 50#endif
51 51
52 52
53static bool initNumLock() 53static bool initNumLock()
54{ 54{
55#ifdef QPE_INITIAL_NUMLOCK_STATE 55#ifdef QPE_INITIAL_NUMLOCK_STATE
56 QPE_INITIAL_NUMLOCK_STATE 56 QPE_INITIAL_NUMLOCK_STATE
57#endif 57#endif
58 return FALSE; 58 return FALSE;
59} 59}
60 60
61//--------------------------------------------------------------------------- 61//---------------------------------------------------------------------------
62 62
63class SafeMode : public QWidget 63class SafeMode : public QWidget
64{ 64{
65 Q_OBJECT 65 Q_OBJECT
66public: 66public:
67 SafeMode( QWidget *parent ) : QWidget( parent ), menu(0) 67 SafeMode( QWidget *parent ) : QWidget( parent ), menu(0)
68 { 68 {
69 message = tr("Safe Mode"); 69 message = tr("Safe Mode");
70 QFont f( font() ); 70 QFont f( font() );
71 f.setWeight( QFont::Bold ); 71 f.setWeight( QFont::Bold );
72 setFont( f ); 72 setFont( f );
73 } 73 }
74 74
75 void mousePressEvent( QMouseEvent *); 75 void mousePressEvent( QMouseEvent *);
76 QSize sizeHint() const; 76 QSize sizeHint() const;
77 void paintEvent( QPaintEvent* ); 77 void paintEvent( QPaintEvent* );
78 78
79private slots: 79private slots:
80 void action(int i); 80 void action(int i);
81 81
82private: 82private:
83 QString message; 83 QString message;
84 QPopupMenu *menu; 84 QPopupMenu *menu;
85}; 85};
86 86
87void SafeMode::mousePressEvent( QMouseEvent *) 87void SafeMode::mousePressEvent( QMouseEvent *)
88{ 88{
89 if ( !menu ) { 89 if ( !menu ) {
90 menu = new QPopupMenu(this); 90 menu = new QPopupMenu(this);
91 menu->insertItem( tr("Plugin Manager..."), 0 ); 91 menu->insertItem( tr("Plugin Manager..."), 0 );
92 menu->insertItem( tr("Restart Qtopia"), 1 ); 92 menu->insertItem( tr("Restart Qtopia"), 1 );
93 menu->insertItem( tr("Help..."), 2 ); 93 menu->insertItem( tr("Help..."), 2 );
94 connect(menu, SIGNAL(activated(int)), this, SLOT(action(int))); 94 connect(menu, SIGNAL(activated(int)), this, SLOT(action(int)));
95 } 95 }
96 QPoint curPos = mapToGlobal( QPoint(0,0) ); 96 QPoint curPos = mapToGlobal( QPoint(0,0) );
97 QSize sh = menu->sizeHint(); 97 QSize sh = menu->sizeHint();
98 menu->popup( curPos-QPoint((sh.width()-width())/2,sh.height()) ); 98 menu->popup( curPos-QPoint((sh.width()-width())/2,sh.height()) );
99} 99}
100 100
101void SafeMode::action(int i) 101void SafeMode::action(int i)
102{ 102{
103 switch (i) { 103 switch (i) {
104 case 0: 104 case 0:
105 Global::execute( "pluginmanager" ); 105 Global::execute( "pluginmanager" );
106 break; 106 break;
107 case 1: 107 case 1:
108 Global::restart(); 108 Global::restart();
109 break; 109 break;
110 case 2: 110 case 2:
111 Global::execute( "helpbrowser", "safemode.html" ); 111 Global::execute( "helpbrowser", "safemode.html" );
112 break; 112 break;
113 } 113 }
114} 114}
115 115
116QSize SafeMode::sizeHint() const 116QSize SafeMode::sizeHint() const
117{ 117{
118 QFontMetrics fm = fontMetrics(); 118 QFontMetrics fm = fontMetrics();
119 119
120 return QSize( fm.width(message), fm.height() ); 120 return QSize( fm.width(message), fm.height() );
121} 121}
122 122
123void SafeMode::paintEvent( QPaintEvent* ) 123void SafeMode::paintEvent( QPaintEvent* )
124{ 124{
125 QPainter p(this); 125 QPainter p(this);
126 p.drawText( rect(), AlignCenter, message ); 126 p.drawText( rect(), AlignCenter, message );
127} 127}
128 128
129//--------------------------------------------------------------------------- 129//---------------------------------------------------------------------------
130 130
131class LockKeyState : public QWidget 131class LockKeyState : public QWidget
132{ 132{
133public: 133public:
134 LockKeyState( QWidget *parent ) : 134 LockKeyState( QWidget *parent ) :
135 QWidget(parent), 135 QWidget(parent),
136 nl(initNumLock()), cl(FALSE) 136 nl(initNumLock()), cl(FALSE)
137 { 137 {
138 nl_pm = Resource::loadPixmap("numlock"); 138 nl_pm = Resource::loadPixmap("numlock");
139 cl_pm = Resource::loadPixmap("capslock"); 139 cl_pm = Resource::loadPixmap("capslock");
140 } 140 }
141 QSize sizeHint() const 141 QSize sizeHint() const
142 { 142 {
143 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); 143 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1);
144 } 144 }
145 void toggleNumLockState() 145 void toggleNumLockState()
146 { 146 {
147 nl = !nl; repaint(); 147 nl = !nl; repaint();
148 } 148 }
149 void toggleCapsLockState() 149 void toggleCapsLockState()
150 { 150 {
151 cl = !cl; repaint(); 151 cl = !cl; repaint();
152 } 152 }
153 void paintEvent( QPaintEvent * ) 153 void paintEvent( QPaintEvent * )
154 { 154 {
155 int y = (height()-sizeHint().height())/2; 155 int y = (height()-sizeHint().height())/2;
156 QPainter p(this); 156 QPainter p(this);
157 if ( nl ) 157 if ( nl )
158 p.drawPixmap(1,y,nl_pm); 158 p.drawPixmap(1,y,nl_pm);
159 if ( cl ) 159 if ( cl )
160 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); 160 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
161 } 161 }
162private: 162private:
163 QPixmap nl_pm, cl_pm; 163 QPixmap nl_pm, cl_pm;
164 bool nl, cl; 164 bool nl, cl;
165}; 165};
166 166
167//--------------------------------------------------------------------------- 167//---------------------------------------------------------------------------
168 168
169TaskBar::~TaskBar() 169TaskBar::~TaskBar()
170{ 170{
171} 171}
172 172
173 173
174TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 174TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
175{ 175{
176 Config cfg( "Launcher" ); 176 Config cfg( "Launcher" );
177 cfg.setGroup( "InputMethods" ); 177 cfg.setGroup( "InputMethods" );
178 resizeRunningApp = cfg.readBoolEntry( "Resize", true ); 178 resizeRunningApp = cfg.readBoolEntry( "Resize", true );
179 179
180 sm = new StartMenu( this ); 180 sm = new StartMenu( this );
181 connect( sm, SIGNAL(tabSelected(const QString&)), this, 181 connect( sm, SIGNAL(tabSelected(const QString&)), this,
182 SIGNAL(tabSelected(const QString&)) ); 182 SIGNAL(tabSelected(const QString&)) );
183 183
184 inputMethods = new InputMethods( this ); 184 inputMethods = new InputMethods( this );
185 connect( inputMethods, SIGNAL(inputToggled(bool)), 185 connect( inputMethods, SIGNAL(inputToggled(bool)),
186 this, SLOT(calcMaxWindowRect()) ); 186 this, SLOT(calcMaxWindowRect()) );
187 187
188 stack = new QWidgetStack( this ); 188 stack = new QWidgetStack( this );
189 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 189 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
190 label = new QLabel(stack); 190 label = new QLabel(stack);
191 191
192 runningAppBar = new RunningAppBar(stack); 192 runningAppBar = new RunningAppBar(stack);
193 stack->raiseWidget(runningAppBar); 193 stack->raiseWidget(runningAppBar);
194 194
195 waitIcon = new Wait( this ); 195 waitIcon = new Wait( this );
196 (void) new AppIcons( this ); 196 (void) new AppIcons( this );
197 197
198 sysTray = new SysTray( this ); 198 sysTray = new SysTray( this );
199 199
200 /* ### FIXME plugin loader and safe mode */ 200 /* ### FIXME plugin loader and safe mode */
201#if 0 201#if 0
202 if (PluginLoader::inSafeMode()) 202 if (PluginLoader::inSafeMode())
203 (void)new SafeMode( this ); 203 (void)new SafeMode( this );
204#endif 204#endif
205 205
206 // ## make customizable in some way? 206 // ## make customizable in some way?
207#ifdef QT_QWS_CUSTOM 207#ifdef QT_QWS_CUSTOM
208 lockState = new LockKeyState( this ); 208 lockState = new LockKeyState( this );
209#else 209#else
210 lockState = 0; 210 lockState = 0;
211#endif 211#endif
212 212
213#if defined(Q_WS_QWS) 213#if defined(Q_WS_QWS)
214#if !defined(QT_NO_COP) 214#if !defined(QT_NO_COP)
215 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 215 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
216 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 216 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
217 this, SLOT(receive(const QCString&, const QByteArray&)) ); 217 this, SLOT(receive(const QCString&, const QByteArray&)) );
218#endif 218#endif
219#endif 219#endif
220 waitTimer = new QTimer( this ); 220 waitTimer = new QTimer( this );
221 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 221 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
222 clearer = new QTimer( this ); 222 clearer = new QTimer( this );
223 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); 223 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
224 224
225 connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); 225 connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) );
226 connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); 226 connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) );
227 connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); 227 connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) );
228} 228}
229 229