-rw-r--r-- | core/launcher/server.cpp | 434 |
1 files changed, 217 insertions, 217 deletions
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp index b9fa1e5..950032d 100644 --- a/core/launcher/server.cpp +++ b/core/launcher/server.cpp | |||
@@ -73,26 +73,26 @@ static QWidget *calibrate(bool) | |||
73 | return c; | 73 | return c; |
74 | #else | 74 | #else |
75 | return 0; | 75 | return 0; |
76 | #endif | 76 | #endif |
77 | } | 77 | } |
78 | 78 | ||
79 | #define FACTORY(T) \ | 79 | #define FACTORY(T) \ |
80 | static QWidget *new##T( bool maximized ) { \ | 80 | static QWidget *new##T( bool maximized ) { \ |
81 | QWidget *w = new T( 0, 0, QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ | 81 | QWidget *w = new T( 0, 0, QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ |
82 | if ( maximized ) { \ | 82 | if ( maximized ) { \ |
83 | if ( qApp->desktop()->width() <= 350 ) { \ | 83 | if ( qApp->desktop()->width() <= 350 ) { \ |
84 | w->showMaximized(); \ | 84 | w->showMaximized(); \ |
85 | } else { \ | 85 | } else { \ |
86 | w->resize( QSize( 300, 300 ) ); \ | 86 | w->resize( QSize( 300, 300 ) ); \ |
87 | } \ | 87 | } \ |
88 | } \ | 88 | } \ |
89 | w->show(); \ | 89 | w->show(); \ |
90 | return w; \ | 90 | return w; \ |
91 | } | 91 | } |
92 | 92 | ||
93 | 93 | ||
94 | #ifdef SINGLE_APP | 94 | #ifdef SINGLE_APP |
95 | #define APP(a,b,c,d) FACTORY(b) | 95 | #define APP(a,b,c,d) FACTORY(b) |
96 | #include "apps.h" | 96 | #include "apps.h" |
97 | #undef APP | 97 | #undef APP |
98 | #endif // SINGLE_APP | 98 | #endif // SINGLE_APP |
@@ -102,24 +102,24 @@ static Global::Command builtins[] = { | |||
102 | #ifdef SINGLE_APP | 102 | #ifdef SINGLE_APP |
103 | #define APP(a,b,c,d) { a, new##b, c, d }, | 103 | #define APP(a,b,c,d) { a, new##b, c, d }, |
104 | #include "apps.h" | 104 | #include "apps.h" |
105 | #undef APP | 105 | #undef APP |
106 | #endif | 106 | #endif |
107 | 107 | ||
108 | /* FIXME defines need to be defined*/ | 108 | /* FIXME defines need to be defined*/ |
109 | #if !defined(OPIE_NO_BUILTIN_CALIBRATE) | 109 | #if !defined(OPIE_NO_BUILTIN_CALIBRATE) |
110 | { "calibrate", calibrate, 1, 0 }, // No tr | 110 | { "calibrate", calibrate, 1, 0 }, // No tr |
111 | #endif | 111 | #endif |
112 | #if !defined(OPIE_NO_BUILTIN_SHUTDOWN) | 112 | #if !defined(OPIE_NO_BUILTIN_SHUTDOWN) |
113 | { "shutdown", Global::shutdown, 1, 0 }, // No tr | 113 | { "shutdown", Global::shutdown, 1, 0 }, // No tr |
114 | // { "run", run, 1, 0 }, // No tr | 114 | // { "run", run, 1, 0 }, // No tr |
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | { 0, calibrate,0, 0 }, | 117 | { 0, calibrate, 0, 0 }, |
118 | }; | 118 | }; |
119 | 119 | ||
120 | 120 | ||
121 | //--------------------------------------------------------------------------- | 121 | //--------------------------------------------------------------------------- |
122 | 122 | ||
123 | 123 | ||
124 | //=========================================================================== | 124 | //=========================================================================== |
125 | 125 | ||
@@ -161,21 +161,21 @@ Server::Server() : | |||
161 | packageHandler = new PackageHandler( this ); | 161 | packageHandler = new PackageHandler( this ); |
162 | connect(qApp, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)), | 162 | connect(qApp, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)), |
163 | this,SLOT(activate(const Opie::Core::ODeviceButton*,bool))); | 163 | this,SLOT(activate(const Opie::Core::ODeviceButton*,bool))); |
164 | 164 | ||
165 | setGeometry( -10, -10, 9, 9 ); | 165 | setGeometry( -10, -10, 9, 9 ); |
166 | 166 | ||
167 | QCopChannel *channel = new QCopChannel("QPE/System", this); | 167 | QCopChannel *channel = new QCopChannel("QPE/System", this); |
168 | connect(channel, SIGNAL(received(const QCString&,const QByteArray&)), | 168 | connect(channel, SIGNAL(received(const QCString&,const QByteArray&)), |
169 | this, SLOT(systemMsg(const QCString&,const QByteArray&)) ); | 169 | this, SLOT(systemMsg(const QCString&,const QByteArray&)) ); |
170 | 170 | ||
171 | QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this ); | 171 | QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this ); |
172 | connect( tbChannel, SIGNAL(received(const QCString&,const QByteArray&)), | 172 | connect( tbChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
173 | this, SLOT(receiveTaskBar(const QCString&,const QByteArray&)) ); | 173 | this, SLOT(receiveTaskBar(const QCString&,const QByteArray&)) ); |
174 | 174 | ||
175 | connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) ); | 175 | connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) ); |
176 | connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) ); | 176 | connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) ); |
177 | 177 | ||
178 | preloadApps(); | 178 | preloadApps(); |
179 | } | 179 | } |
180 | 180 | ||
181 | void Server::show() | 181 | void Server::show() |
@@ -197,63 +197,63 @@ Server::~Server() | |||
197 | } | 197 | } |
198 | 198 | ||
199 | static bool hasVisibleWindow(const QString& clientname, bool partial) | 199 | static bool hasVisibleWindow(const QString& clientname, bool partial) |
200 | { | 200 | { |
201 | #ifdef QWS | 201 | #ifdef QWS |
202 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 202 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
203 | QWSWindow* w; | 203 | QWSWindow* w; |
204 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 204 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
205 | if ( w->client()->identity() == clientname ) { | 205 | if ( w->client()->identity() == clientname ) { |
206 | if ( partial && !w->isFullyObscured() ) | 206 | if ( partial && !w->isFullyObscured() ) |
207 | return TRUE; | 207 | return TRUE; |
208 | if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) { | 208 | if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) { |
209 | # if QT_VERSION < 0x030000 | 209 | # if QT_VERSION < 0x030000 |
210 | QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect, | 210 | QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect, |
211 | QSize(qt_screen->width(),qt_screen->height()) ); | 211 | QSize(qt_screen->width(),qt_screen->height()) ); |
212 | # else | 212 | # else |
213 | QRect mwr = qt_maxWindowRect; | 213 | QRect mwr = qt_maxWindowRect; |
214 | # endif | 214 | # endif |
215 | if ( mwr.contains(w->requested().boundingRect()) ) | 215 | if ( mwr.contains(w->requested().boundingRect()) ) |
216 | return TRUE; | 216 | return TRUE; |
217 | } | 217 | } |
218 | } | 218 | } |
219 | } | 219 | } |
220 | #endif | 220 | #endif |
221 | return FALSE; | 221 | return FALSE; |
222 | } | 222 | } |
223 | 223 | ||
224 | void Server::activate(const ODeviceButton* button, bool held) | 224 | void Server::activate(const ODeviceButton* button, bool held) |
225 | { | 225 | { |
226 | Global::terminateBuiltin("calibrate"); // No tr | 226 | Global::terminateBuiltin("calibrate"); // No tr |
227 | OQCopMessage om; | 227 | OQCopMessage om; |
228 | if ( held ) { | 228 | if ( held ) { |
229 | om = button->heldAction(); | 229 | om = button->heldAction(); |
230 | } else { | 230 | } else { |
231 | om = button->pressedAction(); | 231 | om = button->pressedAction(); |
232 | } | 232 | } |
233 | 233 | ||
234 | if ( om.channel() != "ignore" ) | 234 | if ( om.channel() != "ignore" ) |
235 | om.send(); | 235 | om.send(); |
236 | 236 | ||
237 | // A button with no action defined, will return a null ServiceRequest. Don't attempt | 237 | // A button with no action defined, will return a null ServiceRequest. Don't attempt |
238 | // to send/do anything with this as it will crash | 238 | // to send/do anything with this as it will crash |
239 | /* ### FIXME */ | 239 | /* ### FIXME */ |
240 | #if 0 | 240 | #if 0 |
241 | if ( !sr.isNull() ) { | 241 | if ( !sr.isNull() ) { |
242 | QString app = sr.app(); | 242 | QString app = sr.app(); |
243 | bool vis = hasVisibleWindow(app, app != "qpe"); | 243 | bool vis = hasVisibleWindow(app, app != "qpe"); |
244 | if ( sr.message() == "raise()" && vis ) { | 244 | if ( sr.message() == "raise()" && vis ) { |
245 | sr.setMessage("nextView()"); | 245 | sr.setMessage("nextView()"); |
246 | } else { | 246 | } else { |
247 | // "back door" | 247 | // "back door" |
248 | sr << (int)vis; | 248 | sr << (int)vis; |
249 | } | 249 | } |
250 | 250 | ||
251 | sr.send(); | 251 | sr.send(); |
252 | } | 252 | } |
253 | #endif | 253 | #endif |
254 | } | 254 | } |
255 | 255 | ||
256 | 256 | ||
257 | #ifdef Q_WS_QWS | 257 | #ifdef Q_WS_QWS |
258 | 258 | ||
259 | 259 | ||
@@ -287,201 +287,201 @@ static const KeyOverride jp109keys[] = { | |||
287 | }; | 287 | }; |
288 | 288 | ||
289 | bool Server::setKeyboardLayout( const QString &kb ) | 289 | bool Server::setKeyboardLayout( const QString &kb ) |
290 | { | 290 | { |
291 | //quick demo version that can be extended | 291 | //quick demo version that can be extended |
292 | 292 | ||
293 | QIntDict<QWSServer::KeyMap> *om = 0; | 293 | QIntDict<QWSServer::KeyMap> *om = 0; |
294 | if ( kb == "us101" ) { // No tr | 294 | if ( kb == "us101" ) { // No tr |
295 | om = 0; | 295 | om = 0; |
296 | } else if ( kb == "jp109" ) { | 296 | } else if ( kb == "jp109" ) { |
297 | om = new QIntDict<QWSServer::KeyMap>(37); | 297 | om = new QIntDict<QWSServer::KeyMap>(37); |
298 | const KeyOverride *k = jp109keys; | 298 | const KeyOverride *k = jp109keys; |
299 | while ( k->scan_code ) { | 299 | while ( k->scan_code ) { |
300 | om->insert( k->scan_code, &k->map ); | 300 | om->insert( k->scan_code, &k->map ); |
301 | k++; | 301 | k++; |
302 | } | 302 | } |
303 | } | 303 | } |
304 | QWSServer::setOverrideKeys( om ); | 304 | QWSServer::setOverrideKeys( om ); |
305 | 305 | ||
306 | return TRUE; | 306 | return TRUE; |
307 | } | 307 | } |
308 | 308 | ||
309 | #endif | 309 | #endif |
310 | 310 | ||
311 | void Server::systemMsg(const QCString &msg, const QByteArray &data) | 311 | void Server::systemMsg(const QCString &msg, const QByteArray &data) |
312 | { | 312 | { |
313 | QDataStream stream( data, IO_ReadOnly ); | 313 | QDataStream stream( data, IO_ReadOnly ); |
314 | 314 | ||
315 | if ( msg == "securityChanged()" ) { | 315 | if ( msg == "securityChanged()" ) { |
316 | if ( transferServer ) | 316 | if ( transferServer ) |
317 | transferServer->authorizeConnections(); | 317 | transferServer->authorizeConnections(); |
318 | if ( qcopBridge ) | 318 | if ( qcopBridge ) |
319 | qcopBridge->authorizeConnections(); | 319 | qcopBridge->authorizeConnections(); |
320 | } | 320 | } |
321 | /* ### FIXME support TempScreenSaverMode */ | 321 | /* ### FIXME support TempScreenSaverMode */ |
322 | #if 0 | 322 | #if 0 |
323 | else if ( msg == "setTempScreenSaverMode(int,int)" ) { | 323 | else if ( msg == "setTempScreenSaverMode(int,int)" ) { |
324 | int mode, pid; | 324 | int mode, pid; |
325 | stream >> mode >> pid; | 325 | stream >> mode >> pid; |
326 | tsmMonitor->setTempMode(mode, pid); | 326 | tsmMonitor->setTempMode(mode, pid); |
327 | } | 327 | } |
328 | #endif | 328 | #endif |
329 | else if ( msg == "linkChanged(QString)" ) { | 329 | else if ( msg == "linkChanged(QString)" ) { |
330 | QString link; | 330 | QString link; |
331 | stream >> link; | 331 | stream >> link; |
332 | odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl; | 332 | odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl; |
333 | docList->linkChanged(link); | 333 | docList->linkChanged(link); |
334 | } else if ( msg == "serviceChanged(QString)" ) { | 334 | } else if ( msg == "serviceChanged(QString)" ) { |
335 | MimeType::updateApplications(); | 335 | MimeType::updateApplications(); |
336 | } else if ( msg == "mkdir(QString)" ) { | 336 | } else if ( msg == "mkdir(QString)" ) { |
337 | QString dir; | 337 | QString dir; |
338 | stream >> dir; | 338 | stream >> dir; |
339 | if ( !dir.isEmpty() ) | 339 | if ( !dir.isEmpty() ) |
340 | mkdir( dir ); | 340 | mkdir( dir ); |
341 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { | 341 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { |
342 | QString baseFile, sigFile; | 342 | QString baseFile, sigFile; |
343 | stream >> baseFile >> sigFile; | 343 | stream >> baseFile >> sigFile; |
344 | QRsync::generateSignature( baseFile, sigFile ); | 344 | QRsync::generateSignature( baseFile, sigFile ); |
345 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { | 345 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { |
346 | QString baseFile, sigFile, deltaFile; | 346 | QString baseFile, sigFile, deltaFile; |
347 | stream >> baseFile >> sigFile >> deltaFile; | 347 | stream >> baseFile >> sigFile >> deltaFile; |
348 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); | 348 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); |
349 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { | 349 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { |
350 | QString baseFile, deltaFile; | 350 | QString baseFile, deltaFile; |
351 | stream >> baseFile >> deltaFile; | 351 | stream >> baseFile >> deltaFile; |
352 | if ( !QFile::exists( baseFile ) ) { | 352 | if ( !QFile::exists( baseFile ) ) { |
353 | QFile f( baseFile ); | 353 | QFile f( baseFile ); |
354 | f.open( IO_WriteOnly ); | 354 | f.open( IO_WriteOnly ); |
355 | f.close(); | 355 | f.close(); |
356 | } | 356 | } |
357 | QRsync::applyDiff( baseFile, deltaFile ); | 357 | QRsync::applyDiff( baseFile, deltaFile ); |
358 | #ifndef QT_NO_COP | 358 | #ifndef QT_NO_COP |
359 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); | 359 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); |
360 | e << baseFile; | 360 | e << baseFile; |
361 | #endif | 361 | #endif |
362 | } else if ( msg == "rdiffCleanup()" ) { | 362 | } else if ( msg == "rdiffCleanup()" ) { |
363 | mkdir( "/tmp/rdiff" ); | 363 | mkdir( "/tmp/rdiff" ); |
364 | QDir dir; | 364 | QDir dir; |
365 | dir.setPath( "/tmp/rdiff" ); | 365 | dir.setPath( "/tmp/rdiff" ); |
366 | QStringList entries = dir.entryList(); | 366 | QStringList entries = dir.entryList(); |
367 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) | 367 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) |
368 | dir.remove( *it ); | 368 | dir.remove( *it ); |
369 | } else if ( msg == "sendHandshakeInfo()" ) { | 369 | } else if ( msg == "sendHandshakeInfo()" ) { |
370 | QString home = getenv( "HOME" ); | 370 | QString home = getenv( "HOME" ); |
371 | #ifndef QT_NO_COP | 371 | #ifndef QT_NO_COP |
372 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); | 372 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); |
373 | e << home; | 373 | e << home; |
374 | int locked = (int) ServerApplication::screenLocked(); | 374 | int locked = (int) ServerApplication::screenLocked(); |
375 | e << locked; | 375 | e << locked; |
376 | #endif | 376 | #endif |
377 | 377 | ||
378 | } | 378 | } |
379 | /* | 379 | /* |
380 | * QtopiaDesktop relies on the major number | 380 | * QtopiaDesktop relies on the major number |
381 | * to start with 1. We're at 0.9 | 381 | * to start with 1. We're at 0.9 |
382 | * so wee need to fake at least 1.4 to be able | 382 | * so wee need to fake at least 1.4 to be able |
383 | * to sync with QtopiaDesktop1.6 | 383 | * to sync with QtopiaDesktop1.6 |
384 | */ | 384 | */ |
385 | else if ( msg == "sendVersionInfo()" ) { | 385 | else if ( msg == "sendVersionInfo()" ) { |
386 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); | 386 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); |
387 | /* ### FIXME Architecture ### */ | 387 | /* ### FIXME Architecture ### */ |
388 | e << QString::fromLatin1("1.7") << "Uncustomized Device"; | 388 | e << QString::fromLatin1("1.7") << "Uncustomized Device"; |
389 | } else if ( msg == "sendCardInfo()" ) { | 389 | } else if ( msg == "sendCardInfo()" ) { |
390 | #ifndef QT_NO_COP | 390 | #ifndef QT_NO_COP |
391 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); | 391 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); |
392 | #endif | 392 | #endif |
393 | storage->update(); | 393 | storage->update(); |
394 | const QList<FileSystem> &fs = storage->fileSystems(); | 394 | const QList<FileSystem> &fs = storage->fileSystems(); |
395 | QListIterator<FileSystem> it ( fs ); | 395 | QListIterator<FileSystem> it ( fs ); |
396 | QString s; | 396 | QString s; |
397 | QString homeDir = getenv("HOME"); | 397 | QString homeDir = getenv("HOME"); |
398 | QString homeFs, homeFsPath; | 398 | QString homeFs, homeFsPath; |
399 | for ( ; it.current(); ++it ) { | 399 | for ( ; it.current(); ++it ) { |
400 | int k4 = (*it)->blockSize()/256; | 400 | int k4 = (*it)->blockSize()/256; |
401 | if ( (*it)->isRemovable() ) { | 401 | if ( (*it)->isRemovable() ) { |
402 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr | 402 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr |
403 | + QString::number( (*it)->availBlocks() * k4/4 ) | 403 | + QString::number( (*it)->availBlocks() * k4/4 ) |
404 | + "K " + (*it)->options() + ";"; | 404 | + "K " + (*it)->options() + ";"; |
405 | } else if ( homeDir.contains( (*it)->path() ) && | 405 | } else if ( homeDir.contains( (*it)->path() ) && |
406 | (*it)->path().length() > homeFsPath.length() ) { | 406 | (*it)->path().length() > homeFsPath.length() ) { |
407 | homeFsPath = (*it)->path(); | 407 | homeFsPath = (*it)->path(); |
408 | homeFs = | 408 | homeFs = |
409 | (*it)->name() + "=" + homeDir + "/Documents " // No tr | 409 | (*it)->name() + "=" + homeDir + "/Documents " // No tr |
410 | + QString::number( (*it)->availBlocks() * k4/4 ) | 410 | + QString::number( (*it)->availBlocks() * k4/4 ) |
411 | + "K " + (*it)->options() + ";"; | 411 | + "K " + (*it)->options() + ";"; |
412 | } | 412 | } |
413 | } | 413 | } |
414 | if ( !homeFs.isEmpty() ) | 414 | if ( !homeFs.isEmpty() ) |
415 | s += homeFs; | 415 | s += homeFs; |
416 | 416 | ||
417 | #ifndef QT_NO_COP | 417 | #ifndef QT_NO_COP |
418 | e << s; | 418 | e << s; |
419 | #endif | 419 | #endif |
420 | } else if ( msg == "sendSyncDate(QString)" ) { | 420 | } else if ( msg == "sendSyncDate(QString)" ) { |
421 | QString app; | 421 | QString app; |
422 | stream >> app; | 422 | stream >> app; |
423 | Config cfg( "qpe" ); | 423 | Config cfg( "qpe" ); |
424 | cfg.setGroup("SyncDate"); | 424 | cfg.setGroup("SyncDate"); |
425 | #ifndef QT_NO_COP | 425 | #ifndef QT_NO_COP |
426 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); | 426 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); |
427 | e << app << cfg.readEntry( app ); | 427 | e << app << cfg.readEntry( app ); |
428 | #endif | 428 | #endif |
429 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), | 429 | //odebug << "QPE/System sendSyncDate for " << app.latin1() << ": response " |
430 | //cfg.readEntry( app ).latin1() ); | 430 | // << cfg.readEntry( app ).latin1() << oendl; |
431 | } else if ( msg == "setSyncDate(QString,QString)" ) { | 431 | } else if ( msg == "setSyncDate(QString,QString)" ) { |
432 | QString app, date; | 432 | QString app, date; |
433 | stream >> app >> date; | 433 | stream >> app >> date; |
434 | Config cfg( "qpe" ); | 434 | Config cfg( "qpe" ); |
435 | cfg.setGroup("SyncDate"); | 435 | cfg.setGroup("SyncDate"); |
436 | cfg.writeEntry( app, date ); | 436 | cfg.writeEntry( app, date ); |
437 | //odebug << "setSyncDate(QString,QString) " << app << " " << date << "" << oendl; | 437 | //odebug << "setSyncDate(QString,QString) " << app << " " << date << "" << oendl; |
438 | } else if ( msg == "startSync(QString)" ) { | 438 | } else if ( msg == "startSync(QString)" ) { |
439 | QString what; | 439 | QString what; |
440 | stream >> what; | 440 | stream >> what; |
441 | delete syncDialog; | 441 | delete syncDialog; |
442 | syncDialog = new SyncDialog( this, what ); | 442 | syncDialog = new SyncDialog( this, what ); |
443 | syncDialog->show(); | 443 | syncDialog->show(); |
444 | connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); | 444 | connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); |
445 | } else if ( msg == "stopSync()") { | 445 | } else if ( msg == "stopSync()") { |
446 | delete syncDialog; | 446 | delete syncDialog; |
447 | syncDialog = 0; | 447 | syncDialog = 0; |
448 | } else if (msg == "restoreDone(QString)") { | 448 | } else if (msg == "restoreDone(QString)") { |
449 | docList->restoreDone(); | 449 | docList->restoreDone(); |
450 | } else if ( msg == "getAllDocLinks()" ) { | 450 | } else if ( msg == "getAllDocLinks()" ) { |
451 | docList->sendAllDocLinks(); | 451 | docList->sendAllDocLinks(); |
452 | } | 452 | } |
453 | #ifdef Q_WS_QWS | 453 | #ifdef Q_WS_QWS |
454 | else if ( msg == "setMouseProto(QString)" ) { | 454 | else if ( msg == "setMouseProto(QString)" ) { |
455 | QString mice; | 455 | QString mice; |
456 | stream >> mice; | 456 | stream >> mice; |
457 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); | 457 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); |
458 | qwsServer->openMouse(); | 458 | qwsServer->openMouse(); |
459 | } else if ( msg == "setKeyboard(QString)" ) { | 459 | } else if ( msg == "setKeyboard(QString)" ) { |
460 | QString kb; | 460 | QString kb; |
461 | stream >> kb; | 461 | stream >> kb; |
462 | setenv("QWS_KEYBOARD",kb.latin1(),1); | 462 | setenv("QWS_KEYBOARD",kb.latin1(),1); |
463 | qwsServer->openKeyboard(); | 463 | qwsServer->openKeyboard(); |
464 | 464 | ||
465 | } else if ( msg == "setKeyboardAutoRepeat(int,int)" ) { | 465 | } else if ( msg == "setKeyboardAutoRepeat(int,int)" ) { |
466 | int delay, period; | 466 | int delay, period; |
467 | stream >> delay >> period; | 467 | stream >> delay >> period; |
468 | qwsSetKeyboardAutoRepeat( delay, period ); | 468 | qwsSetKeyboardAutoRepeat( delay, period ); |
469 | Config cfg( "qpe" ); | 469 | Config cfg( "qpe" ); |
470 | cfg.setGroup("Keyboard"); | 470 | cfg.setGroup("Keyboard"); |
471 | cfg.writeEntry( "RepeatDelay", delay ); | 471 | cfg.writeEntry( "RepeatDelay", delay ); |
472 | cfg.writeEntry( "RepeatPeriod", period ); | 472 | cfg.writeEntry( "RepeatPeriod", period ); |
473 | } else if ( msg == "setKeyboardLayout(QString)" ) { | 473 | } else if ( msg == "setKeyboardLayout(QString)" ) { |
474 | QString kb; | 474 | QString kb; |
475 | stream >> kb; | 475 | stream >> kb; |
476 | setKeyboardLayout( kb ); | 476 | setKeyboardLayout( kb ); |
477 | Config cfg( "qpe" ); | 477 | Config cfg( "qpe" ); |
478 | cfg.setGroup("Keyboard"); | 478 | cfg.setGroup("Keyboard"); |
479 | cfg.writeEntry( "Layout", kb ); | 479 | cfg.writeEntry( "Layout", kb ); |
480 | } else if ( msg == "autoStart(QString)" ) { | 480 | } else if ( msg == "autoStart(QString)" ) { |
481 | QString appName; | 481 | QString appName; |
482 | stream >> appName; | 482 | stream >> appName; |
483 | Config cfg( "autostart" ); | 483 | Config cfg( "autostart" ); |
484 | cfg.setGroup( "AutoStart" ); | 484 | cfg.setGroup( "AutoStart" ); |
485 | if ( appName.compare("clear") == 0){ | 485 | if ( appName.compare("clear") == 0){ |
486 | cfg.writeEntry("Apps", ""); | 486 | cfg.writeEntry("Apps", ""); |
487 | } | 487 | } |
@@ -524,26 +524,26 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
524 | #endif | 524 | #endif |
525 | } | 525 | } |
526 | 526 | ||
527 | void Server::receiveTaskBar(const QCString &msg, const QByteArray &data) | 527 | void Server::receiveTaskBar(const QCString &msg, const QByteArray &data) |
528 | { | 528 | { |
529 | QDataStream stream( data, IO_ReadOnly ); | 529 | QDataStream stream( data, IO_ReadOnly ); |
530 | 530 | ||
531 | if ( msg == "reloadApps()" ) { | 531 | if ( msg == "reloadApps()" ) { |
532 | docList->reloadAppLnks(); | 532 | docList->reloadAppLnks(); |
533 | } else if ( msg == "soundAlarm()" ) { | 533 | } else if ( msg == "soundAlarm()" ) { |
534 | ServerApplication::soundAlarm(); | 534 | ServerApplication::soundAlarm(); |
535 | } | 535 | } |
536 | else if ( msg == "setLed(int,bool)" ) { | 536 | else if ( msg == "setLed(int,bool)" ) { |
537 | int led, status; | 537 | int led, status; |
538 | stream >> led >> status; | 538 | stream >> led >> status; |
539 | 539 | ||
540 | QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); | 540 | QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); |
541 | if ( ll. count ( )){ | 541 | if ( ll. count ( )) { |
542 | OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0]; | 542 | OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0]; |
543 | bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow ); | 543 | bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow ); |
544 | 544 | ||
545 | ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off ); | 545 | ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off ); |
546 | } | 546 | } |
547 | } | 547 | } |
548 | } | 548 | } |
549 | 549 | ||
@@ -555,112 +555,112 @@ void Server::cancelSync() | |||
555 | delete syncDialog; | 555 | delete syncDialog; |
556 | syncDialog = 0; | 556 | syncDialog = 0; |
557 | } | 557 | } |
558 | 558 | ||
559 | bool Server::mkdir(const QString &localPath) | 559 | bool Server::mkdir(const QString &localPath) |
560 | { | 560 | { |
561 | QDir fullDir(localPath); | 561 | QDir fullDir(localPath); |
562 | if (fullDir.exists()) | 562 | if (fullDir.exists()) |
563 | return true; | 563 | return true; |
564 | 564 | ||
565 | // at this point the directory doesn't exist | 565 | // at this point the directory doesn't exist |
566 | // go through the directory tree and start creating the direcotories | 566 | // go through the directory tree and start creating the direcotories |
567 | // that don't exist; if we can't create the directories, return false | 567 | // that don't exist; if we can't create the directories, return false |
568 | 568 | ||
569 | QString dirSeps = "/"; | 569 | QString dirSeps = "/"; |
570 | int dirIndex = localPath.find(dirSeps); | 570 | int dirIndex = localPath.find(dirSeps); |
571 | QString checkedPath; | 571 | QString checkedPath; |
572 | 572 | ||
573 | // didn't find any seps; weird, use the cur dir instead | 573 | // didn't find any seps; weird, use the cur dir instead |
574 | if (dirIndex == -1) { | 574 | if (dirIndex == -1) { |
575 | //odebug << "No seperators found in path " << localPath << "" << oendl; | 575 | //odebug << "No seperators found in path " << localPath << "" << oendl; |
576 | checkedPath = QDir::currentDirPath(); | 576 | checkedPath = QDir::currentDirPath(); |
577 | } | 577 | } |
578 | 578 | ||
579 | while (checkedPath != localPath) { | 579 | while (checkedPath != localPath) { |
580 | // no more seperators found, use the local path | 580 | // no more seperators found, use the local path |
581 | if (dirIndex == -1) | 581 | if (dirIndex == -1) |
582 | checkedPath = localPath; | 582 | checkedPath = localPath; |
583 | else { | 583 | else { |
584 | // the next directory to check | 584 | // the next directory to check |
585 | checkedPath = localPath.left(dirIndex) + "/"; | 585 | checkedPath = localPath.left(dirIndex) + "/"; |
586 | // advance the iterator; the next dir seperator | 586 | // advance the iterator; the next dir seperator |
587 | dirIndex = localPath.find(dirSeps, dirIndex+1); | 587 | dirIndex = localPath.find(dirSeps, dirIndex+1); |
588 | } | 588 | } |
589 | 589 | ||
590 | QDir checkDir(checkedPath); | 590 | QDir checkDir(checkedPath); |
591 | if (!checkDir.exists()) { | 591 | if (!checkDir.exists()) { |
592 | //odebug << "mkdir making dir " << checkedPath << "" << oendl; | 592 | //odebug << "mkdir making dir " << checkedPath << "" << oendl; |
593 | 593 | ||
594 | if (!checkDir.mkdir(checkedPath)) { | 594 | if (!checkDir.mkdir(checkedPath)) { |
595 | odebug << "Unable to make directory " << checkedPath << "" << oendl; | 595 | odebug << "Unable to make directory " << checkedPath << "" << oendl; |
596 | return FALSE; | 596 | return FALSE; |
597 | } | 597 | } |
598 | } | 598 | } |
599 | 599 | ||
600 | } | 600 | } |
601 | return TRUE; | 601 | return TRUE; |
602 | } | 602 | } |
603 | 603 | ||
604 | void Server::styleChange( QStyle &s ) | 604 | void Server::styleChange( QStyle &s ) |
605 | { | 605 | { |
606 | QWidget::styleChange( s ); | 606 | QWidget::styleChange( s ); |
607 | } | 607 | } |
608 | 608 | ||
609 | void Server::startTransferServer() | 609 | void Server::startTransferServer() |
610 | { | 610 | { |
611 | if ( !qcopBridge ) { | 611 | if ( !qcopBridge ) { |
612 | // start qcop bridge server | 612 | // start qcop bridge server |
613 | qcopBridge = new QCopBridge( 4243 ); | 613 | qcopBridge = new QCopBridge( 4243 ); |
614 | if ( qcopBridge->ok() ) { | 614 | if ( qcopBridge->ok() ) { |
615 | // ... OK | 615 | // ... OK |
616 | connect( qcopBridge, SIGNAL(connectionClosed(const QHostAddress&)), | 616 | connect( qcopBridge, SIGNAL(connectionClosed(const QHostAddress&)), |
617 | this, SLOT(syncConnectionClosed(const QHostAddress&)) ); | 617 | this, SLOT(syncConnectionClosed(const QHostAddress&)) ); |
618 | } else { | 618 | } else { |
619 | delete qcopBridge; | 619 | delete qcopBridge; |
620 | qcopBridge = 0; | 620 | qcopBridge = 0; |
621 | } | 621 | } |
622 | } | 622 | } |
623 | if ( !transferServer ) { | 623 | if ( !transferServer ) { |
624 | // start transfer server | 624 | // start transfer server |
625 | transferServer = new TransferServer( 4242 ); | 625 | transferServer = new TransferServer( 4242 ); |
626 | if ( transferServer->ok() ) { | 626 | if ( transferServer->ok() ) { |
627 | // ... OK | 627 | // ... OK |
628 | } else { | 628 | } else { |
629 | delete transferServer; | 629 | delete transferServer; |
630 | transferServer = 0; | 630 | transferServer = 0; |
631 | } | 631 | } |
632 | } | 632 | } |
633 | if ( !transferServer || !qcopBridge ) | 633 | if ( !transferServer || !qcopBridge ) |
634 | tid_xfer = startTimer( 2000 ); | 634 | tid_xfer = startTimer( 2000 ); |
635 | } | 635 | } |
636 | 636 | ||
637 | void Server::timerEvent( QTimerEvent *e ) | 637 | void Server::timerEvent( QTimerEvent *e ) |
638 | { | 638 | { |
639 | if ( e->timerId() == tid_xfer ) { | 639 | if ( e->timerId() == tid_xfer ) { |
640 | killTimer( tid_xfer ); | 640 | killTimer( tid_xfer ); |
641 | tid_xfer = 0; | 641 | tid_xfer = 0; |
642 | startTransferServer(); | 642 | startTransferServer(); |
643 | } | 643 | } |
644 | /* ### FIXME today startin */ | 644 | /* ### FIXME today startin */ |
645 | #if 0 | 645 | #if 0 |
646 | else if ( e->timerId() == tid_today ) { | 646 | else if ( e->timerId() == tid_today ) { |
647 | QDate today = QDate::currentDate(); | 647 | QDate today = QDate::currentDate(); |
648 | if ( today != last_today_show ) { | 648 | if ( today != last_today_show ) { |
649 | last_today_show = today; | 649 | last_today_show = today; |
650 | Config cfg("today"); | 650 | Config cfg("today"); |
651 | cfg.setGroup("Start"); | 651 | cfg.setGroup("Start"); |
652 | #ifndef QPE_DEFAULT_TODAY_MODE | 652 | #ifndef QPE_DEFAULT_TODAY_MODE |
653 | #define QPE_DEFAULT_TODAY_MODE "Never" | 653 | #define QPE_DEFAULT_TODAY_MODE "Never" |
654 | #endif | 654 | #endif |
655 | if ( cfg.readEntry("Mode",QPE_DEFAULT_TODAY_MODE) == "Daily" ) { | 655 | if ( cfg.readEntry("Mode",QPE_DEFAULT_TODAY_MODE) == "Daily" ) { |
656 | QCopEnvelope env(Service::channel("today"),"raise()"); | 656 | QCopEnvelope env(Service::channel("today"),"raise()"); |
657 | } | 657 | } |
658 | } | 658 | } |
659 | } | 659 | } |
660 | #endif | 660 | #endif |
661 | } | 661 | } |
662 | 662 | ||
663 | void Server::terminateServers() | 663 | void Server::terminateServers() |
664 | { | 664 | { |
665 | delete transferServer; | 665 | delete transferServer; |
666 | delete qcopBridge; | 666 | delete qcopBridge; |
@@ -676,19 +676,19 @@ void Server::syncConnectionClosed( const QHostAddress & ) | |||
676 | } | 676 | } |
677 | 677 | ||
678 | void Server::pokeTimeMonitors() | 678 | void Server::pokeTimeMonitors() |
679 | { | 679 | { |
680 | #if 0 | 680 | #if 0 |
681 | // inform all TimeMonitors | 681 | // inform all TimeMonitors |
682 | QStrList tms = Service::channels("TimeMonitor"); | 682 | QStrList tms = Service::channels("TimeMonitor"); |
683 | for (const char* ch = tms.first(); ch; ch=tms.next()) { | 683 | for (const char* ch = tms.first(); ch; ch=tms.next()) { |
684 | QString t = getenv("TZ"); | 684 | QString t = getenv("TZ"); |
685 | QCopEnvelope e(ch, "timeChange(QString)"); | 685 | QCopEnvelope e(ch, "timeChange(QString)"); |
686 | e << t; | 686 | e << t; |
687 | } | 687 | } |
688 | #endif | 688 | #endif |
689 | } | 689 | } |
690 | 690 | ||
691 | void Server::applicationLaunched(int, const QString &app) | 691 | void Server::applicationLaunched(int, const QString &app) |
692 | { | 692 | { |
693 | serverGui->applicationStateChanged( app, ServerInterface::Launching ); | 693 | serverGui->applicationStateChanged( app, ServerInterface::Launching ); |
694 | } | 694 | } |
@@ -717,13 +717,13 @@ void Server::storageChanged() | |||
717 | 717 | ||
718 | void Server::preloadApps() | 718 | void Server::preloadApps() |
719 | { | 719 | { |
720 | Config cfg("Launcher"); | 720 | Config cfg("Launcher"); |
721 | cfg.setGroup("Preload"); | 721 | cfg.setGroup("Preload"); |
722 | QStringList apps = cfg.readListEntry("Apps",','); | 722 | QStringList apps = cfg.readListEntry("Apps",','); |
723 | for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { | 723 | for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { |
724 | #ifndef QT_NO_COP | 724 | #ifndef QT_NO_COP |
725 | QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); | 725 | QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); |
726 | #endif | 726 | #endif |
727 | } | 727 | } |
728 | } | 728 | } |
729 | 729 | ||