author | zecke <zecke> | 2004-07-15 18:58:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-15 18:58:59 (UTC) |
commit | c96296038ac74083c5bf8009449cb22392cd02dc (patch) (unidiff) | |
tree | 0ab461a85b9ab0e13e1382cacc109fd6df277c9c | |
parent | 323e9a7472a110b4befba7320540263147505bae (diff) | |
download | opie-c96296038ac74083c5bf8009449cb22392cd02dc.zip opie-c96296038ac74083c5bf8009449cb22392cd02dc.tar.gz opie-c96296038ac74083c5bf8009449cb22392cd02dc.tar.bz2 |
Start removing #if 0 which originates from a sync and libqtopia dependency
-rw-r--r-- | core/launcher/main.cpp | 56 | ||||
-rw-r--r-- | core/launcher/serverapp.cpp | 28 |
2 files changed, 1 insertions, 83 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index a86aca6..b119399 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -27,179 +27,125 @@ | |||
27 | #include "calibrate.h" | 27 | #include "calibrate.h" |
28 | #include "server.h" | 28 | #include "server.h" |
29 | #include "serverapp.h" | 29 | #include "serverapp.h" |
30 | #include "stabmon.h" | 30 | #include "stabmon.h" |
31 | #include "firstuse.h" | 31 | #include "firstuse.h" |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | #include <opie2/odevice.h> | 35 | #include <opie2/odevice.h> |
36 | #include <opie2/oglobal.h> | 36 | #include <opie2/oglobal.h> |
37 | #include <qtopia/network.h> | 37 | #include <qtopia/network.h> |
38 | #include <qtopia/alarmserver.h> | 38 | #include <qtopia/alarmserver.h> |
39 | using namespace Opie::Core; | 39 | using namespace Opie::Core; |
40 | 40 | ||
41 | /* QT */ | 41 | /* QT */ |
42 | #include <qdir.h> | 42 | #include <qdir.h> |
43 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
44 | #ifdef QWS | 44 | #ifdef QWS |
45 | #include <qwindowsystem_qws.h> | 45 | #include <qwindowsystem_qws.h> |
46 | #include <qtopia/qcopenvelope_qws.h> | 46 | #include <qtopia/qcopenvelope_qws.h> |
47 | #endif | 47 | #endif |
48 | #ifdef Q_WS_QWS | 48 | #ifdef Q_WS_QWS |
49 | #include <qkeyboard_qws.h> | 49 | #include <qkeyboard_qws.h> |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | /* STD */ | 52 | /* STD */ |
53 | #include <stdlib.h> | 53 | #include <stdlib.h> |
54 | #include <stdio.h> | 54 | #include <stdio.h> |
55 | #include <signal.h> | 55 | #include <signal.h> |
56 | #ifndef Q_OS_WIN32 | 56 | #ifndef Q_OS_WIN32 |
57 | #include <unistd.h> | 57 | #include <unistd.h> |
58 | #else | 58 | #else |
59 | #include <process.h> | 59 | #include <process.h> |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | static void cleanup() | 62 | static void cleanup() |
63 | { | 63 | { |
64 | QDir dir( "/tmp", "qcop-msg-*" ); | 64 | QDir dir( "/tmp", "qcop-msg-*" ); |
65 | 65 | ||
66 | QStringList stale = dir.entryList(); | 66 | QStringList stale = dir.entryList(); |
67 | QStringList::Iterator it; | 67 | QStringList::Iterator it; |
68 | for ( it = stale.begin(); it != stale.end(); ++it ) { | 68 | for ( it = stale.begin(); it != stale.end(); ++it ) { |
69 | dir.remove( *it ); | 69 | dir.remove( *it ); |
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | static void refreshTimeZoneConfig() | 73 | static void refreshTimeZoneConfig() |
74 | { | 74 | { |
75 | /* ### FIXME timezone handling */ | 75 | /* ### FIXME timezone handling for qtopia */ |
76 | #if 0 | ||
77 | // We need to help WorldTime in setting up its configuration for | ||
78 | // the current translation | ||
79 | // BEGIN no tr | ||
80 | const char *defaultTz[] = { | ||
81 | "America/New_York", | ||
82 | "America/Los_Angeles", | ||
83 | "Europe/Oslo", | ||
84 | "Asia/Tokyo", | ||
85 | "Asia/Hong_Kong", | ||
86 | "Australia/Brisbane", | ||
87 | 0 | ||
88 | }; | ||
89 | // END no tr | ||
90 | |||
91 | TimeZone curZone; | ||
92 | QString zoneID; | ||
93 | int zoneIndex; | ||
94 | Config cfg = Config( "WorldTime" ); | ||
95 | cfg.setGroup( "TimeZones" ); | ||
96 | if (!cfg.hasKey( "Zone0" )){ | ||
97 | // We have no existing timezones use the defaults which are untranslated strings | ||
98 | QString currTz = TimeZone::current().id(); | ||
99 | QStringList zoneDefaults; | ||
100 | zoneDefaults.append( currTz ); | ||
101 | for ( int i = 0; defaultTz[i] && zoneDefaults.count() < 6; i++ ) { | ||
102 | if ( defaultTz[i] != currTz ) | ||
103 | zoneDefaults.append( defaultTz[i] ); | ||
104 | } | ||
105 | zoneIndex = 0; | ||
106 | for (QStringList::Iterator it = zoneDefaults.begin(); it != zoneDefaults.end() ; ++it){ | ||
107 | cfg.writeEntry( "Zone" + QString::number( zoneIndex ) , *it); | ||
108 | zoneIndex++; | ||
109 | } | ||
110 | } | ||
111 | // We have an existing list of timezones refresh the | ||
112 | // translations of TimeZone name | ||
113 | zoneIndex = 0; | ||
114 | while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){ | ||
115 | zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex )); | ||
116 | curZone = TimeZone( zoneID ); | ||
117 | if ( !curZone.isValid() ){ | ||
118 | odebug << "initEnvironment() Invalid TimeZone " << zoneID << "" << oendl; | ||
119 | break; | ||
120 | } | ||
121 | cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() ); | ||
122 | zoneIndex++; | ||
123 | } | ||
124 | #endif | ||
125 | } | 76 | } |
126 | 77 | ||
127 | void initEnvironment() | 78 | void initEnvironment() |
128 | { | 79 | { |
129 | #ifdef Q_OS_WIN32 | 80 | #ifdef Q_OS_WIN32 |
130 | // Config file requires HOME dir which uses QDir which needs the winver | 81 | // Config file requires HOME dir which uses QDir which needs the winver |
131 | qt_init_winver(); | 82 | qt_init_winver(); |
132 | #endif | 83 | #endif |
133 | Config config("locale"); | 84 | Config config("locale"); |
134 | config.setGroup( "Location" ); | 85 | config.setGroup( "Location" ); |
135 | QString tz = config.readEntry( "Timezone", getenv("TZ") ).stripWhiteSpace(); | 86 | QString tz = config.readEntry( "Timezone", getenv("TZ") ).stripWhiteSpace(); |
136 | 87 | ||
137 | // if not timezone set, pick New York | 88 | // if not timezone set, pick New York |
138 | if (tz.isNull() || tz.isEmpty()) | 89 | if (tz.isNull() || tz.isEmpty()) |
139 | tz = "America/New_York"; | 90 | tz = "America/New_York"; |
140 | 91 | ||
141 | setenv( "TZ", tz, 1 ); | 92 | setenv( "TZ", tz, 1 ); |
142 | config.writeEntry( "Timezone", tz); | 93 | config.writeEntry( "Timezone", tz); |
143 | 94 | ||
144 | config.setGroup( "Language" ); | 95 | config.setGroup( "Language" ); |
145 | QString lang = config.readEntry( "Language", getenv("LANG") ).stripWhiteSpace(); | 96 | QString lang = config.readEntry( "Language", getenv("LANG") ).stripWhiteSpace(); |
146 | if( lang.isNull() || lang.isEmpty()) | 97 | if( lang.isNull() || lang.isEmpty()) |
147 | lang = "en_US"; | 98 | lang = "en_US"; |
148 | 99 | ||
149 | setenv( "LANG", lang, 1 ); | 100 | setenv( "LANG", lang, 1 ); |
150 | config.writeEntry("Language", lang); | 101 | config.writeEntry("Language", lang); |
151 | config.write(); | 102 | config.write(); |
152 | 103 | ||
153 | #if 0 | ||
154 | setenv( "QWS_SIZE", "240x320", 0 ); | ||
155 | #endif | ||
156 | |||
157 | |||
158 | 104 | ||
159 | QString env(getenv("QWS_DISPLAY")); | 105 | QString env(getenv("QWS_DISPLAY")); |
160 | if (env.contains("Transformed")) { | 106 | if (env.contains("Transformed")) { |
161 | int rot; | 107 | int rot; |
162 | // transformed driver default rotation is controlled by the hardware. | 108 | // transformed driver default rotation is controlled by the hardware. |
163 | Config config("qpe"); | 109 | Config config("qpe"); |
164 | config.setGroup( "Rotation" ); | 110 | config.setGroup( "Rotation" ); |
165 | if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 ) | 111 | if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 ) |
166 | rot = ODevice::inst ( )-> rotation ( ) * 90; | 112 | rot = ODevice::inst ( )-> rotation ( ) * 90; |
167 | 113 | ||
168 | setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); | 114 | setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); |
169 | QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */ | 115 | QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */ |
170 | } | 116 | } |
171 | } | 117 | } |
172 | 118 | ||
173 | static void initKeyboard() | 119 | static void initKeyboard() |
174 | { | 120 | { |
175 | Config config("qpe"); | 121 | Config config("qpe"); |
176 | 122 | ||
177 | config.setGroup( "Keyboard" ); | 123 | config.setGroup( "Keyboard" ); |
178 | 124 | ||
179 | int ard = config.readNumEntry( "RepeatDelay" ); | 125 | int ard = config.readNumEntry( "RepeatDelay" ); |
180 | int arp = config.readNumEntry( "RepeatPeriod" ); | 126 | int arp = config.readNumEntry( "RepeatPeriod" ); |
181 | if ( ard > 0 && arp > 0 ) | 127 | if ( ard > 0 && arp > 0 ) |
182 | qwsSetKeyboardAutoRepeat( ard, arp ); | 128 | qwsSetKeyboardAutoRepeat( ard, arp ); |
183 | 129 | ||
184 | QString layout = config.readEntry( "Layout", "us101" ); | 130 | QString layout = config.readEntry( "Layout", "us101" ); |
185 | Server::setKeyboardLayout( layout ); | 131 | Server::setKeyboardLayout( layout ); |
186 | } | 132 | } |
187 | 133 | ||
188 | static bool firstUse() | 134 | static bool firstUse() |
189 | { | 135 | { |
190 | bool needFirstUse = FALSE; | 136 | bool needFirstUse = FALSE; |
191 | if ( QWSServer::mouseHandler() && | 137 | if ( QWSServer::mouseHandler() && |
192 | QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { | 138 | QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { |
193 | if ( !QFile::exists( "/etc/pointercal" ) ) | 139 | if ( !QFile::exists( "/etc/pointercal" ) ) |
194 | needFirstUse = TRUE; | 140 | needFirstUse = TRUE; |
195 | } | 141 | } |
196 | 142 | ||
197 | { | 143 | { |
198 | Config config( "qpe" ); | 144 | Config config( "qpe" ); |
199 | config.setGroup( "Startup" ); | 145 | config.setGroup( "Startup" ); |
200 | needFirstUse |= config.readBoolEntry( "FirstUse", TRUE ); | 146 | needFirstUse |= config.readBoolEntry( "FirstUse", TRUE ); |
201 | } | 147 | } |
202 | 148 | ||
203 | if ( !needFirstUse ) | 149 | if ( !needFirstUse ) |
204 | return FALSE; | 150 | return FALSE; |
205 | 151 | ||
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp index 54cc313..3d88873 100644 --- a/core/launcher/serverapp.cpp +++ b/core/launcher/serverapp.cpp | |||
@@ -471,124 +471,96 @@ void ServerApplication::launcherMessage( const QCString & msg, const QByteArray | |||
471 | { | 471 | { |
472 | QDataStream stream ( data, IO_ReadOnly ); | 472 | QDataStream stream ( data, IO_ReadOnly ); |
473 | 473 | ||
474 | if ( msg == "deviceButton(int,int,int)" ) { | 474 | if ( msg == "deviceButton(int,int,int)" ) { |
475 | int keycode, press, autoRepeat; | 475 | int keycode, press, autoRepeat; |
476 | stream >> keycode >> press >> autoRepeat; | 476 | stream >> keycode >> press >> autoRepeat; |
477 | 477 | ||
478 | kf->checkButtonAction ( true, keycode, press, autoRepeat ); | 478 | kf->checkButtonAction ( true, keycode, press, autoRepeat ); |
479 | } | 479 | } |
480 | else if ( msg == "keyRegister(int,QCString,QCString)" ) { | 480 | else if ( msg == "keyRegister(int,QCString,QCString)" ) { |
481 | int k; | 481 | int k; |
482 | QCString c, m; | 482 | QCString c, m; |
483 | stream >> k >> c >> m; | 483 | stream >> k >> c >> m; |
484 | 484 | ||
485 | kf -> registerKey( QCopKeyRegister(k, c, m) ); | 485 | kf -> registerKey( QCopKeyRegister(k, c, m) ); |
486 | } | 486 | } |
487 | } | 487 | } |
488 | 488 | ||
489 | 489 | ||
490 | bool ServerApplication::screenLocked() | 490 | bool ServerApplication::screenLocked() |
491 | { | 491 | { |
492 | return loggedin == 0; | 492 | return loggedin == 0; |
493 | } | 493 | } |
494 | 494 | ||
495 | void ServerApplication::login(bool at_poweron) | 495 | void ServerApplication::login(bool at_poweron) |
496 | { | 496 | { |
497 | if ( !loggedin ) { | 497 | if ( !loggedin ) { |
498 | Global::terminateBuiltin("calibrate"); // No tr | 498 | Global::terminateBuiltin("calibrate"); // No tr |
499 | Password::authenticate(at_poweron); | 499 | Password::authenticate(at_poweron); |
500 | loggedin=1; | 500 | loggedin=1; |
501 | #ifndef QT_NO_COP | 501 | #ifndef QT_NO_COP |
502 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); | 502 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); |
503 | #endif | 503 | #endif |
504 | } | 504 | } |
505 | } | 505 | } |
506 | 506 | ||
507 | #if defined(QPE_HAVE_TOGGLELIGHT) | 507 | #if defined(QPE_HAVE_TOGGLELIGHT) |
508 | #include <qtopia/config.h> | 508 | #include <qtopia/config.h> |
509 | 509 | ||
510 | #include <sys/ioctl.h> | 510 | #include <sys/ioctl.h> |
511 | #include <sys/types.h> | 511 | #include <sys/types.h> |
512 | #include <fcntl.h> | 512 | #include <fcntl.h> |
513 | #include <unistd.h> | 513 | #include <unistd.h> |
514 | #include <errno.h> | 514 | #include <errno.h> |
515 | #include <linux/ioctl.h> | 515 | #include <linux/ioctl.h> |
516 | #include <time.h> | 516 | #include <time.h> |
517 | #endif | 517 | #endif |
518 | 518 | ||
519 | #if 0 | ||
520 | static bool blanked=FALSE; | ||
521 | |||
522 | static void blankScreen() | ||
523 | { | ||
524 | #ifdef QWS | ||
525 | QWidget w(0, 0, Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool | Qt::WStyle_StaysOnTop | Qt::WPaintUnclipped); | ||
526 | w.resize( qt_screen->width(), qt_screen->height() ); | ||
527 | w.move(0, 0); | ||
528 | |||
529 | QPainter p(&w); | ||
530 | p.fillRect(w.rect(), QBrush(QColor(255,255,255)) ); | ||
531 | p.end(); | ||
532 | w.repaint(); | ||
533 | |||
534 | blanked = TRUE; | ||
535 | #endif | ||
536 | } | ||
537 | |||
538 | static void darkScreen() | ||
539 | { | ||
540 | /* ### Screen blanking ODevice */ | ||
541 | #if 0 | ||
542 | qpe_setBacklight(0); // force off | ||
543 | #endif | ||
544 | } | ||
545 | #endif | ||
546 | |||
547 | namespace { | 519 | namespace { |
548 | void execAutoStart(const QDateTime& suspendTime ) { | 520 | void execAutoStart(const QDateTime& suspendTime ) { |
549 | QString appName; | 521 | QString appName; |
550 | int delay; | 522 | int delay; |
551 | QDateTime now = QDateTime::currentDateTime(); | 523 | QDateTime now = QDateTime::currentDateTime(); |
552 | 524 | ||
553 | Config cfg( "autostart" ); | 525 | Config cfg( "autostart" ); |
554 | cfg.setGroup( "AutoStart" ); | 526 | cfg.setGroup( "AutoStart" ); |
555 | appName = cfg.readEntry( "Apps", "" ); | 527 | appName = cfg.readEntry( "Apps", "" ); |
556 | delay = cfg.readNumEntry( "Delay", 0 ); | 528 | delay = cfg.readNumEntry( "Delay", 0 ); |
557 | 529 | ||
558 | // If the time between suspend and resume was longer then the | 530 | // If the time between suspend and resume was longer then the |
559 | // value saved as delay, start the app | 531 | // value saved as delay, start the app |
560 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { | 532 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { |
561 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 533 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
562 | e << QString( appName ); | 534 | e << QString( appName ); |
563 | } | 535 | } |
564 | } | 536 | } |
565 | } | 537 | } |
566 | 538 | ||
567 | 539 | ||
568 | void ServerApplication::togglePower() | 540 | void ServerApplication::togglePower() |
569 | { | 541 | { |
570 | static bool excllock = false; | 542 | static bool excllock = false; |
571 | 543 | ||
572 | if ( excllock ) | 544 | if ( excllock ) |
573 | return ; | 545 | return ; |
574 | 546 | ||
575 | excllock = true; | 547 | excllock = true; |
576 | 548 | ||
577 | bool wasloggedin = loggedin; | 549 | bool wasloggedin = loggedin; |
578 | loggedin = 0; | 550 | loggedin = 0; |
579 | m_suspendTime = QDateTime::currentDateTime(); | 551 | m_suspendTime = QDateTime::currentDateTime(); |
580 | 552 | ||
581 | #ifdef QWS | 553 | #ifdef QWS |
582 | 554 | ||
583 | if ( Password::needToAuthenticate ( true ) && qt_screen ) { | 555 | if ( Password::needToAuthenticate ( true ) && qt_screen ) { |
584 | // Should use a big black window instead. | 556 | // Should use a big black window instead. |
585 | // But this would not show up fast enough | 557 | // But this would not show up fast enough |
586 | QGfx *g = qt_screen-> screenGfx ( ); | 558 | QGfx *g = qt_screen-> screenGfx ( ); |
587 | g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); | 559 | g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); |
588 | delete g; | 560 | delete g; |
589 | } | 561 | } |
590 | #endif | 562 | #endif |
591 | 563 | ||
592 | ODevice::inst ( )-> suspend ( ); | 564 | ODevice::inst ( )-> suspend ( ); |
593 | 565 | ||
594 | ServerApplication::switchLCD ( true ); // force LCD on without slow qcop call | 566 | ServerApplication::switchLCD ( true ); // force LCD on without slow qcop call |