summaryrefslogtreecommitdiff
authorzecke <zecke>2003-10-07 12:51:21 (UTC)
committer zecke <zecke>2003-10-07 12:51:21 (UTC)
commitc21de570e101058c5f1c4c5973a96df5a9bf62b2 (patch) (unidiff)
tree5b5b2b440990eac3757549745f7e467d23bde08f
parent37ddd7628c5406f05806b97471db72e2ee943d86 (diff)
downloadopie-c21de570e101058c5f1c4c5973a96df5a9bf62b2.zip
opie-c21de570e101058c5f1c4c5973a96df5a9bf62b2.tar.gz
opie-c21de570e101058c5f1c4c5973a96df5a9bf62b2.tar.bz2
-Kill stupid define which sets QWS_SIZE to 240x320
-Include built-in shutdown only if OPIE_NO_BUILTIN_SHUTDOWN is defined
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/main.cpp2
-rw-r--r--core/launcher/server.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index ad40536..74965df 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -99,129 +99,129 @@ static void refreshTimeZoneConfig()
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 !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX) 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 450d8e5..4c62b78 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -49,129 +49,129 @@
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(QT_QWS_CASSIOPEIA) 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()) );