summaryrefslogtreecommitdiff
authorzecke <zecke>2003-08-28 14:33:58 (UTC)
committer zecke <zecke>2003-08-28 14:33:58 (UTC)
commitd9f3423c2e2aca46ab10f08152450b3ebf5221cf (patch) (unidiff)
tree49244c742b0d974bf9bcb81af06ba1bae68131d4
parent2394427a5c34384131922fb6c2a1d35dee3e1197 (diff)
downloadopie-d9f3423c2e2aca46ab10f08152450b3ebf5221cf.zip
opie-d9f3423c2e2aca46ab10f08152450b3ebf5221cf.tar.gz
opie-d9f3423c2e2aca46ab10f08152450b3ebf5221cf.tar.bz2
Make it compile with opie
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/firstuse.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp
index 31b7923..2dc6a72 100644
--- a/core/launcher/firstuse.cpp
+++ b/core/launcher/firstuse.cpp
@@ -1,226 +1,226 @@
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#if defined(QPE_NEED_CALIBRATION) 33#if defined(QPE_NEED_CALIBRATION)
34#include "../settings/calibrate/calibrate.h" 34#include "calibrate.h"
35#endif 35#endif
36#include "documentlist.h" 36#include "documentlist.h"
37 37
38#include <qtopia/resource.h> 38#include <qtopia/resource.h>
39#include <qtopia/qcopenvelope_qws.h> 39#include <qtopia/qcopenvelope_qws.h>
40#include <qtopia/qpeapplication.h> 40#include <qtopia/qpeapplication.h>
41#include <qtopia/config.h> 41#include <qtopia/config.h>
42#include <qtopia/applnk.h> 42#include <qtopia/applnk.h>
43#include <qtopia/mimetype.h> 43#include <qtopia/mimetype.h>
44#include <qtopia/fontmanager.h> 44#include <qtopia/fontmanager.h>
45 45
46#include <qapplication.h> 46#include <qapplication.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qpainter.h> 48#include <qpainter.h>
49#include <qcstring.h> 49#include <qcstring.h>
50#include <qsimplerichtext.h> 50#include <qsimplerichtext.h>
51#include <qcolor.h> 51#include <qcolor.h>
52#include <qpushbutton.h> 52#include <qpushbutton.h>
53#include <qhbox.h> 53#include <qhbox.h>
54#include <qlabel.h> 54#include <qlabel.h>
55#include <qtimer.h> 55#include <qtimer.h>
56 56
57#if defined( Q_WS_QWS ) 57#if defined( Q_WS_QWS )
58#include <qwsdisplay_qws.h> 58#include <qwsdisplay_qws.h>
59#include <qgfx_qws.h> 59#include <qgfx_qws.h>
60#endif 60#endif
61 61
62#include <qwindowsystem_qws.h> 62#include <qwindowsystem_qws.h>
63 63
64#include <stdlib.h> 64#include <stdlib.h>
65#include <sys/types.h> 65#include <sys/types.h>
66#if defined(Q_OS_LINUX) || defined(_OS_LINUX_) 66#if defined(Q_OS_LINUX) || defined(_OS_LINUX_)
67#include <unistd.h> 67#include <unistd.h>
68#endif 68#endif
69 69
70 70
71struct { 71struct {
72 bool enabled; 72 bool enabled;
73 const char *app; 73 const char *app;
74 const char *start; 74 const char *start;
75 const char *stop; 75 const char *stop;
76 const char *desc; 76 const char *desc;
77} 77}
78settingsTable [] = 78settingsTable [] =
79{ 79{
80 { FALSE, "language", "raise()", "accept()", // No tr 80 { FALSE, "language", "raise()", "accept()", // No tr
81 QT_TR_NOOP("Language") }, 81 QT_TR_NOOP("Language") },
82#ifndef Q_OS_WIN32 82#ifndef Q_OS_WIN32
83 { FALSE, "systemtime", "raise()", "accept()", // No tr 83 { FALSE, "systemtime", "raise()", "accept()", // No tr
84 QT_TR_NOOP("Time and Date") }, 84 QT_TR_NOOP("Time and Date") },
85#endif 85#endif
86 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr 86 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr
87 QT_TR_NOOP("Personal Information") }, 87 QT_TR_NOOP("Personal Information") },
88 { FALSE, 0, 0, 0, 0 } 88 { FALSE, 0, 0, 0, 0 }
89}; 89};
90 90
91 91
92FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : 92FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) :
93 QDialog( parent, name, TRUE, wf), 93 QDialog( parent, name, TRUE, wf),
94 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1), 94 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1),
95 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE) 95 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE)
96{ 96{
97 ServerApplication::allowRestart = FALSE; 97 ServerApplication::allowRestart = FALSE;
98 // we force our height beyound the maximum (which we set anyway) 98 // we force our height beyound the maximum (which we set anyway)
99 QRect desk = qApp->desktop()->geometry(); 99 QRect desk = qApp->desktop()->geometry();
100 setGeometry( 0, 0, desk.width(), desk.height() ); 100 setGeometry( 0, 0, desk.width(), desk.height() );
101 101
102 connect(qwsServer, SIGNAL(newChannel(const QString&)), 102 connect(qwsServer, SIGNAL(newChannel(const QString&)),
103 this, SLOT(newQcopChannel(const QString&))); 103 this, SLOT(newQcopChannel(const QString&)));
104 104
105 // Create a DocumentList so appLauncher has appLnkSet to search 105 // Create a DocumentList so appLauncher has appLnkSet to search
106 docList = new DocumentList( 0, FALSE ); 106 docList = new DocumentList( 0, FALSE );
107 appLauncher = new AppLauncher( this ); 107 appLauncher = new AppLauncher( this );
108 connect( appLauncher, SIGNAL(terminated(int, const QString&)), 108 connect( appLauncher, SIGNAL(terminated(int, const QString&)),
109 this, SLOT(terminated(int, const QString&)) ); 109 this, SLOT(terminated(int, const QString&)) );
110 110
111 // more hackery 111 // more hackery
112 // I will be run as either the main server or as part of the main server 112 // I will be run as either the main server or as part of the main server
113 QWSServer::setScreenSaverIntervals(0); 113 QWSServer::setScreenSaverIntervals(0);
114 loadPixmaps(); 114 loadPixmaps();
115 115
116 //check if there is a language program 116 //check if there is a language program
117#ifndef Q_OS_WIN32 117#ifndef Q_OS_WIN32
118 QString exeSuffix; 118 QString exeSuffix;
119#else 119#else
120 QString exeSuffix(".exe"); 120 QString exeSuffix(".exe");
121#endif 121#endif
122 122
123 for ( int i = 0; settingsTable[i].app; i++ ) { 123 for ( int i = 0; settingsTable[i].app; i++ ) {
124 QString file = QPEApplication::qpeDir() + "bin/"; 124 QString file = QPEApplication::qpeDir() + "bin/";
125 file += settingsTable[i].app; 125 file += settingsTable[i].app;
126 file += exeSuffix; 126 file += exeSuffix;
127 if ( QFile::exists(file) ) 127 if ( QFile::exists(file) )
128 settingsTable[i].enabled = TRUE; 128 settingsTable[i].enabled = TRUE;
129 } 129 }
130 130
131 setFocusPolicy(NoFocus); 131 setFocusPolicy(NoFocus);
132 132
133 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader); 133 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader);
134 134
135 inputMethods = new InputMethods(taskBar); 135 inputMethods = new InputMethods(taskBar);
136 connect(inputMethods, SIGNAL(inputToggled(bool)), 136 connect(inputMethods, SIGNAL(inputToggled(bool)),
137 this, SLOT(calcMaxWindowRect())); 137 this, SLOT(calcMaxWindowRect()));
138 138
139 back = new QPushButton(tr("<< Back"), taskBar); 139 back = new QPushButton(tr("<< Back"), taskBar);
140 back->setFocusPolicy(NoFocus); 140 back->setFocusPolicy(NoFocus);
141 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) ); 141 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) );
142 142
143 next = new QPushButton(tr("Next >>"), taskBar); 143 next = new QPushButton(tr("Next >>"), taskBar);
144 next->setFocusPolicy(NoFocus); 144 next->setFocusPolicy(NoFocus);
145 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) ); 145 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) );
146 146
147 // need to set the geom to lower corner 147 // need to set the geom to lower corner
148 QSize sz = inputMethods->sizeHint(); 148 QSize sz = inputMethods->sizeHint();
149 int buttonWidth = (width() - sz.width()) / 2; 149 int buttonWidth = (width() - sz.width()) / 2;
150 int x = 0; 150 int x = 0;
151 151
152 controlHeight = back->sizeHint().height(); 152 controlHeight = back->sizeHint().height();
153 153
154 inputMethods->setGeometry(0,0, sz.width(), controlHeight ); 154 inputMethods->setGeometry(0,0, sz.width(), controlHeight );
155 x += sz.width(); 155 x += sz.width();
156 156
157 back->setGeometry(x, 0, buttonWidth, controlHeight); 157 back->setGeometry(x, 0, buttonWidth, controlHeight);
158 x += buttonWidth; 158 x += buttonWidth;
159 next->setGeometry(x, 0, buttonWidth, controlHeight); 159 next->setGeometry(x, 0, buttonWidth, controlHeight);
160 160
161 taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); 161 taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight);
162 taskBar->hide(); 162 taskBar->hide();
163 163
164#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 164#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
165 qDebug("Setting up QCop to QPE/System"); 165 qDebug("Setting up QCop to QPE/System");
166 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 166 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
167 connect(sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), 167 connect(sysChannel, SIGNAL(received(const QCString &, const QByteArray &)),
168 this, SLOT(message(const QCString &, const QByteArray &)) ); 168 this, SLOT(message(const QCString &, const QByteArray &)) );
169#endif 169#endif
170 calcMaxWindowRect(); 170 calcMaxWindowRect();
171#if defined(QPE_NEED_CALIBRATION) 171#if defined(QPE_NEED_CALIBRATION)
172 if ( !QFile::exists("/etc/pointercal") ) { 172 if ( !QFile::exists("/etc/pointercal") ) {
173 needCalibrate = TRUE; 173 needCalibrate = TRUE;
174 grabMouse(); 174 grabMouse();
175 } 175 }
176#endif 176#endif
177 Config config("locale"); 177 Config config("locale");
178 config.setGroup( "Language"); 178 config.setGroup( "Language");
179 lang = config.readEntry( "Language", "en"); 179 lang = config.readEntry( "Language", "en");
180 180
181 defaultFont = font(); 181 defaultFont = font();
182 182
183 //###language/font hack; should look it up somewhere 183 //###language/font hack; should look it up somewhere
184#ifdef Q_WS_QWS 184#ifdef Q_WS_QWS
185 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 185 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
186 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 186 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
187 qApp->setFont( fn, TRUE ); 187 qApp->setFont( fn, TRUE );
188 } 188 }
189#endif 189#endif
190} 190}
191 191
192FirstUse::~FirstUse() 192FirstUse::~FirstUse()
193{ 193{
194 delete appLauncher; 194 delete appLauncher;
195 delete docList; 195 delete docList;
196 delete taskBar; 196 delete taskBar;
197 ServerApplication::allowRestart = TRUE; 197 ServerApplication::allowRestart = TRUE;
198} 198}
199 199
200void FirstUse::calcMaxWindowRect() 200void FirstUse::calcMaxWindowRect()
201{ 201{
202#ifdef Q_WS_QWS 202#ifdef Q_WS_QWS
203 QRect wr; 203 QRect wr;
204 int displayWidth = qApp->desktop()->width(); 204 int displayWidth = qApp->desktop()->width();
205 QRect ir = inputMethods->inputRect(); 205 QRect ir = inputMethods->inputRect();
206 if ( ir.isValid() ) { 206 if ( ir.isValid() ) {
207 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 207 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
208 } else { 208 } else {
209 wr.setCoords( 0, 0, displayWidth-1, 209 wr.setCoords( 0, 0, displayWidth-1,
210 qApp->desktop()->height() - controlHeight-1); 210 qApp->desktop()->height() - controlHeight-1);
211 } 211 }
212 212
213#if QT_VERSION < 0x030000 213#if QT_VERSION < 0x030000
214 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, 214 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
215 QSize(qt_screen->width(),qt_screen->height())) 215 QSize(qt_screen->width(),qt_screen->height()))
216 ); 216 );
217#else 217#else
218 QWSServer::setMaxWindowRect( wr ); 218 QWSServer::setMaxWindowRect( wr );
219#endif 219#endif
220#endif 220#endif
221} 221}
222 222
223/* cancel current dialog, and bring up next */ 223/* cancel current dialog, and bring up next */
224void FirstUse::nextDialog() 224void FirstUse::nextDialog()
225{ 225{
226 int prevApp = currApp; 226 int prevApp = currApp;