-rw-r--r-- | core/launcher/desktop.cpp | 48 | ||||
-rw-r--r-- | core/launcher/desktop.h | 1 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 60 |
3 files changed, 80 insertions, 29 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index a00fae2..4587ec6 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -31,49 +31,48 @@ | |||
31 | #include "packageslave.h" | 31 | #include "packageslave.h" |
32 | 32 | ||
33 | #include <qpe/applnk.h> | 33 | #include <qpe/applnk.h> |
34 | #include <qpe/mimetype.h> | 34 | #include <qpe/mimetype.h> |
35 | #include <qpe/password.h> | 35 | #include <qpe/password.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/power.h> | 37 | #include <qpe/power.h> |
38 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
39 | #include <qpe/global.h> | 39 | #include <qpe/global.h> |
40 | #ifdef QT_QWS_CUSTOM | 40 | #ifdef QT_QWS_CUSTOM |
41 | #include "qpe/custom.h" | 41 | #include "qpe/custom.h" |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #include <qgfx_qws.h> | 44 | #include <qgfx_qws.h> |
45 | #include <qmainwindow.h> | 45 | #include <qmainwindow.h> |
46 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
47 | #include <qtimer.h> | 47 | #include <qtimer.h> |
48 | #include <qwindowsystem_qws.h> | 48 | #include <qwindowsystem_qws.h> |
49 | 49 | ||
50 | #include <qvaluelist.h> | 50 | #include <qvaluelist.h> |
51 | 51 | ||
52 | #include <stdlib.h> | 52 | #include <stdlib.h> |
53 | #include <unistd.h> | 53 | #include <unistd.h> |
54 | 54 | ||
55 | |||
56 | class QCopKeyRegister | 55 | class QCopKeyRegister |
57 | { | 56 | { |
58 | public: | 57 | public: |
59 | QCopKeyRegister() : keyCode(0) { } | 58 | QCopKeyRegister() : keyCode(0) { } |
60 | QCopKeyRegister(int k, const QString &c, const QString &m) | 59 | QCopKeyRegister(int k, const QString &c, const QString &m) |
61 | : keyCode(k), channel(c), message(m) { } | 60 | : keyCode(k), channel(c), message(m) { } |
62 | 61 | ||
63 | int getKeyCode() const { return keyCode; } | 62 | int getKeyCode() const { return keyCode; } |
64 | QString getChannel() const { return channel; } | 63 | QString getChannel() const { return channel; } |
65 | QString getMessage() const { return message; } | 64 | QString getMessage() const { return message; } |
66 | 65 | ||
67 | private: | 66 | private: |
68 | int keyCode; | 67 | int keyCode; |
69 | QString channel, message; | 68 | QString channel, message; |
70 | }; | 69 | }; |
71 | 70 | ||
72 | typedef QValueList<QCopKeyRegister> KeyRegisterList; | 71 | typedef QValueList<QCopKeyRegister> KeyRegisterList; |
73 | KeyRegisterList keyRegisterList; | 72 | KeyRegisterList keyRegisterList; |
74 | 73 | ||
75 | static Desktop* qpedesktop = 0; | 74 | static Desktop* qpedesktop = 0; |
76 | static int loggedin=0; | 75 | static int loggedin=0; |
77 | static void login(bool at_poweron) | 76 | static void login(bool at_poweron) |
78 | { | 77 | { |
79 | if ( !loggedin ) { | 78 | if ( !loggedin ) { |
@@ -476,98 +475,113 @@ void Desktop::executeOrModify(const QString& appLnkFile) | |||
476 | } | 475 | } |
477 | } | 476 | } |
478 | 477 | ||
479 | void Desktop::raiseDatebook() | 478 | void Desktop::raiseDatebook() |
480 | { | 479 | { |
481 | executeOrModify("Applications/datebook.desktop"); | 480 | executeOrModify("Applications/datebook.desktop"); |
482 | } | 481 | } |
483 | 482 | ||
484 | void Desktop::raiseContacts() | 483 | void Desktop::raiseContacts() |
485 | { | 484 | { |
486 | executeOrModify("Applications/addressbook.desktop"); | 485 | executeOrModify("Applications/addressbook.desktop"); |
487 | } | 486 | } |
488 | 487 | ||
489 | void Desktop::raiseMenu() | 488 | void Desktop::raiseMenu() |
490 | { | 489 | { |
491 | Global::terminateBuiltin("calibrate"); | 490 | Global::terminateBuiltin("calibrate"); |
492 | tb->startMenu()->launch(); | 491 | tb->startMenu()->launch(); |
493 | } | 492 | } |
494 | 493 | ||
495 | void Desktop::raiseEmail() | 494 | void Desktop::raiseEmail() |
496 | { | 495 | { |
497 | executeOrModify("Applications/qtmail.desktop"); | 496 | executeOrModify("Applications/qtmail.desktop"); |
498 | } | 497 | } |
499 | 498 | ||
499 | // autoStarts apps on resume and start | ||
500 | void Desktop::execAutoStart() | ||
501 | { | ||
502 | QString appName; | ||
503 | Config cfg( "autostart" ); | ||
504 | cfg.setGroup( "AutoStart" ); | ||
505 | appName = cfg.readEntry("Apps", ""); | ||
506 | QCopEnvelope e("QPE/System", "execute(QString)"); | ||
507 | e << QString(appName); | ||
508 | } | ||
509 | |||
500 | #if defined(QPE_HAVE_TOGGLELIGHT) | 510 | #if defined(QPE_HAVE_TOGGLELIGHT) |
501 | #include <qpe/config.h> | 511 | #include <qpe/config.h> |
502 | 512 | ||
503 | #include <sys/ioctl.h> | 513 | #include <sys/ioctl.h> |
504 | #include <sys/types.h> | 514 | #include <sys/types.h> |
505 | #include <fcntl.h> | 515 | #include <fcntl.h> |
506 | #include <unistd.h> | 516 | #include <unistd.h> |
507 | #include <errno.h> | 517 | #include <errno.h> |
508 | #include <linux/ioctl.h> | 518 | #include <linux/ioctl.h> |
509 | #include <time.h> | 519 | #include <time.h> |
510 | #endif | 520 | #endif |
511 | 521 | ||
512 | static bool blanked=FALSE; | 522 | static bool blanked=FALSE; |
513 | 523 | ||
514 | static void blankScreen() | 524 | static void blankScreen() |
515 | { | 525 | { |
516 | if ( !qt_screen ) return; | 526 | if ( !qt_screen ) return; |
517 | /* Should use a big black window instead. | 527 | /* Should use a big black window instead. |
518 | QGfx* g = qt_screen->screenGfx(); | 528 | QGfx* g = qt_screen->screenGfx(); |
519 | g->fillRect(0,0,qt_screen->width(),qt_screen->height()); | 529 | g->fillRect(0,0,qt_screen->width(),qt_screen->height()); |
520 | delete g; | 530 | delete g; |
521 | */ | 531 | */ |
522 | blanked = TRUE; | 532 | blanked = TRUE; |
523 | } | 533 | } |
524 | 534 | ||
525 | static void darkScreen() | 535 | static void darkScreen() |
526 | { | 536 | { |
527 | extern void qpe_setBacklight(int); | 537 | extern void qpe_setBacklight(int); |
528 | qpe_setBacklight(0); // force off | 538 | qpe_setBacklight(0); // force off |
529 | } | 539 | } |
530 | 540 | ||
531 | 541 | ||
532 | void Desktop::togglePower() | 542 | void Desktop::togglePower() |
533 | { | 543 | { |
534 | bool wasloggedin = loggedin; | 544 | bool wasloggedin = loggedin; |
535 | loggedin=0; | 545 | loggedin=0; |
536 | darkScreen(); | 546 | darkScreen(); |
537 | if ( wasloggedin ) | 547 | if ( wasloggedin ) |
538 | blankScreen(); | 548 | blankScreen(); |
539 | system("apm --suspend"); | 549 | |
540 | QWSServer::screenSaverActivate( FALSE ); | 550 | system("apm --suspend"); |
541 | { | 551 | execAutoStart(); |
542 | QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep | 552 | QWSServer::screenSaverActivate( FALSE ); |
543 | QCopEnvelope e("QPE/System", "setBacklight(int)"); | 553 | { |
544 | e << -3; // Force on | 554 | QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep |
545 | } | 555 | QCopEnvelope e("QPE/System", "setBacklight(int)"); |
546 | if ( wasloggedin ) | 556 | e << -3; // Force on |
547 | login(TRUE); | 557 | } |
548 | //qcopBridge->closeOpenConnections(); | 558 | if ( wasloggedin ) { |
549 | //qDebug("called togglePower()!!!!!!"); | 559 | login(TRUE); |
560 | } | ||
561 | |||
562 | //qcopBridge->closeOpenConnections(); | ||
563 | //qDebug("called togglePower()!!!!!!"); | ||
550 | } | 564 | } |
551 | 565 | ||
552 | void Desktop::toggleLight() | 566 | void Desktop::toggleLight() |
553 | { | 567 | { |
554 | QCopEnvelope e("QPE/System", "setBacklight(int)"); | 568 | QCopEnvelope e("QPE/System", "setBacklight(int)"); |
555 | e << -2; // toggle | 569 | e << -2; // toggle |
556 | } | 570 | } |
557 | 571 | ||
558 | void Desktop::toggleSymbolInput() | 572 | void Desktop::toggleSymbolInput() |
559 | { | 573 | { |
560 | tb->toggleSymbolInput(); | 574 | tb->toggleSymbolInput(); |
561 | } | 575 | } |
562 | 576 | ||
563 | void Desktop::toggleNumLockState() | 577 | void Desktop::toggleNumLockState() |
564 | { | 578 | { |
565 | tb->toggleNumLockState(); | 579 | tb->toggleNumLockState(); |
566 | } | 580 | } |
567 | 581 | ||
568 | void Desktop::toggleCapsLockState() | 582 | void Desktop::toggleCapsLockState() |
569 | { | 583 | { |
570 | tb->toggleCapsLockState(); | 584 | tb->toggleCapsLockState(); |
571 | } | 585 | } |
572 | 586 | ||
573 | void Desktop::styleChange( QStyle &s ) | 587 | void Desktop::styleChange( QStyle &s ) |
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h index f0a7cba..de0dbf0 100644 --- a/core/launcher/desktop.h +++ b/core/launcher/desktop.h | |||
@@ -78,48 +78,49 @@ private: | |||
78 | }; | 78 | }; |
79 | 79 | ||
80 | 80 | ||
81 | class Desktop : public QWidget { | 81 | class Desktop : public QWidget { |
82 | Q_OBJECT | 82 | Q_OBJECT |
83 | public: | 83 | public: |
84 | Desktop(); | 84 | Desktop(); |
85 | ~Desktop(); | 85 | ~Desktop(); |
86 | 86 | ||
87 | static bool screenLocked(); | 87 | static bool screenLocked(); |
88 | 88 | ||
89 | void show(); | 89 | void show(); |
90 | void checkMemory(); | 90 | void checkMemory(); |
91 | 91 | ||
92 | void keyClick(); | 92 | void keyClick(); |
93 | void screenClick(); | 93 | void screenClick(); |
94 | static void soundAlarm(); | 94 | static void soundAlarm(); |
95 | 95 | ||
96 | public slots: | 96 | public slots: |
97 | void raiseDatebook(); | 97 | void raiseDatebook(); |
98 | void raiseContacts(); | 98 | void raiseContacts(); |
99 | void raiseMenu(); | 99 | void raiseMenu(); |
100 | void raiseLauncher(); | 100 | void raiseLauncher(); |
101 | void raiseEmail(); | 101 | void raiseEmail(); |
102 | void execAutoStart(); | ||
102 | void togglePower(); | 103 | void togglePower(); |
103 | void toggleLight(); | 104 | void toggleLight(); |
104 | void toggleNumLockState(); | 105 | void toggleNumLockState(); |
105 | void toggleCapsLockState(); | 106 | void toggleCapsLockState(); |
106 | void toggleSymbolInput(); | 107 | void toggleSymbolInput(); |
107 | void terminateServers(); | 108 | void terminateServers(); |
108 | void rereadVolumes(); | 109 | void rereadVolumes(); |
109 | 110 | ||
110 | protected: | 111 | protected: |
111 | void executeOrModify(const QString& appLnkFile); | 112 | void executeOrModify(const QString& appLnkFile); |
112 | void styleChange( QStyle & ); | 113 | void styleChange( QStyle & ); |
113 | void timerEvent( QTimerEvent *e ); | 114 | void timerEvent( QTimerEvent *e ); |
114 | bool eventFilter( QObject *, QEvent * ); | 115 | bool eventFilter( QObject *, QEvent * ); |
115 | 116 | ||
116 | QWidget *bg; | 117 | QWidget *bg; |
117 | Launcher *launcher; | 118 | Launcher *launcher; |
118 | TaskBar *tb; | 119 | TaskBar *tb; |
119 | 120 | ||
120 | private: | 121 | private: |
121 | void startTransferServer(); | 122 | void startTransferServer(); |
122 | bool recoverMemory(); | 123 | bool recoverMemory(); |
123 | 124 | ||
124 | QCopBridge *qcopBridge; | 125 | QCopBridge *qcopBridge; |
125 | TransferServer *transferServer; | 126 | TransferServer *transferServer; |
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 66a2ce5..0573330 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -1,44 +1,48 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | ||
22 | // have this class. | ||
23 | #define QTOPIA_INTERNAL_FSLP | ||
24 | |||
21 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
22 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
23 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
24 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
25 | #include <qpe/global.h> | 29 | #include <qpe/global.h> |
26 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/mimetype.h> | 31 | #include <qpe/mimetype.h> |
28 | #include <qpe/storage.h> | 32 | #include <qpe/storage.h> |
29 | #include <qpe/palmtoprecord.h> | 33 | #include <qpe/palmtoprecord.h> |
30 | 34 | ||
31 | #include <qdir.h> | 35 | #include <qdir.h> |
32 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
33 | #include <qtimer.h> | 37 | #include <qtimer.h> |
34 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
35 | #include <qvbox.h> | 39 | #include <qvbox.h> |
36 | #include <qlayout.h> | 40 | #include <qlayout.h> |
37 | #include <qstyle.h> | 41 | #include <qstyle.h> |
38 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
39 | #include <qtabbar.h> | 43 | #include <qtabbar.h> |
40 | #include <qwidgetstack.h> | 44 | #include <qwidgetstack.h> |
41 | #include <qlayout.h> | 45 | #include <qlayout.h> |
42 | #include <qregexp.h> | 46 | #include <qregexp.h> |
43 | #include <qmessagebox.h> | 47 | #include <qmessagebox.h> |
44 | #include <qframe.h> | 48 | #include <qframe.h> |
@@ -610,51 +614,81 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
610 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { | 614 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { |
611 | QString baseFile, deltaFile; | 615 | QString baseFile, deltaFile; |
612 | stream >> baseFile >> deltaFile; | 616 | stream >> baseFile >> deltaFile; |
613 | if ( !QFile::exists( baseFile ) ) { | 617 | if ( !QFile::exists( baseFile ) ) { |
614 | QFile f( baseFile ); | 618 | QFile f( baseFile ); |
615 | f.open( IO_WriteOnly ); | 619 | f.open( IO_WriteOnly ); |
616 | f.close(); | 620 | f.close(); |
617 | } | 621 | } |
618 | QRsync::applyDiff( baseFile, deltaFile ); | 622 | QRsync::applyDiff( baseFile, deltaFile ); |
619 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); | 623 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); |
620 | e << baseFile; | 624 | e << baseFile; |
621 | } else if ( msg == "rdiffCleanup()" ) { | 625 | } else if ( msg == "rdiffCleanup()" ) { |
622 | mkdir( "/tmp/rdiff" ); | 626 | mkdir( "/tmp/rdiff" ); |
623 | QDir dir; | 627 | QDir dir; |
624 | dir.setPath( "/tmp/rdiff" ); | 628 | dir.setPath( "/tmp/rdiff" ); |
625 | QStringList entries = dir.entryList(); | 629 | QStringList entries = dir.entryList(); |
626 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) | 630 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) |
627 | dir.remove( *it ); | 631 | dir.remove( *it ); |
628 | } else if ( msg == "sendHandshakeInfo()" ) { | 632 | } else if ( msg == "sendHandshakeInfo()" ) { |
629 | QString home = getenv( "HOME" ); | 633 | QString home = getenv( "HOME" ); |
630 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); | 634 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); |
631 | e << home; | 635 | e << home; |
632 | int locked = (int) Desktop::screenLocked(); | 636 | int locked = (int) Desktop::screenLocked(); |
633 | e << locked; | 637 | e << locked; |
638 | // register an app for autostart | ||
639 | // if clear is send the list is cleared. | ||
640 | } else if ( msg == "autoStart(QString)" ) { | ||
641 | QString appName; | ||
642 | stream >> appName; | ||
643 | Config cfg( "autostart" ); | ||
644 | cfg.setGroup( "AutoStart" ); | ||
645 | if ( appName.compare("clear") == 0){ | ||
646 | cfg.writeEntry("Apps", ""); | ||
647 | } | ||
648 | } else if ( msg == "autoStart(QString,QString)" ) { | ||
649 | QString modifier, appName; | ||
650 | stream >> modifier >> appName; | ||
651 | Config cfg( "autostart" ); | ||
652 | cfg.setGroup( "AutoStart" ); | ||
653 | if ( modifier.compare("add") == 0 ){ | ||
654 | // only add it appname is entered | ||
655 | if (!appName.isEmpty()) { | ||
656 | cfg.writeEntry("Apps", appName); | ||
657 | } | ||
658 | } else if (modifier.compare("remove") == 0 ) { | ||
659 | // need to change for multiple entries | ||
660 | // actually remove is right now simular to clear, but in future there | ||
661 | // should be multiple apps in autostart possible. | ||
662 | QString checkName; | ||
663 | checkName = cfg.readEntry("Apps", ""); | ||
664 | if (checkName == appName) { | ||
665 | cfg.writeEntry("Apps", ""); | ||
666 | } | ||
667 | } | ||
634 | } else if ( msg == "sendCardInfo()" ) { | 668 | } else if ( msg == "sendCardInfo()" ) { |
635 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); | 669 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); |
636 | const QList<FileSystem> &fs = storage->fileSystems(); | 670 | const QList<FileSystem> &fs = storage->fileSystems(); |
637 | QListIterator<FileSystem> it ( fs ); | 671 | QListIterator<FileSystem> it ( fs ); |
638 | QString s; | 672 | QString s; |
639 | QString homeDir = getenv("HOME"); | 673 | QString homeDir = getenv("HOME"); |
640 | QString hardDiskHome; | 674 | QString hardDiskHome; |
641 | for ( ; it.current(); ++it ) { | 675 | for ( ; it.current(); ++it ) { |
642 | if ( (*it)->isRemovable() ) | 676 | if ( (*it)->isRemovable() ) |
643 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " | 677 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " |
644 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) | 678 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) |
645 | + " " + (*it)->options() + ";"; | 679 | + " " + (*it)->options() + ";"; |
646 | else if ( (*it)->disk() == "/dev/mtdblock1" || | 680 | else if ( (*it)->disk() == "/dev/mtdblock1" || |
647 | (*it)->disk() == "/dev/mtdblock/1" ) | 681 | (*it)->disk() == "/dev/mtdblock/1" ) |
648 | s += (*it)->name() + "=" + homeDir + "/Documents " | 682 | s += (*it)->name() + "=" + homeDir + "/Documents " |
649 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) | 683 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) |
650 | + " " + (*it)->options() + ";"; | 684 | + " " + (*it)->options() + ";"; |
651 | else if ( (*it)->name().contains( "Hard Disk") && | 685 | else if ( (*it)->name().contains( "Hard Disk") && |
652 | homeDir.contains( (*it)->path() ) && | 686 | homeDir.contains( (*it)->path() ) && |
653 | (*it)->path().length() > hardDiskHome.length() ) | 687 | (*it)->path().length() > hardDiskHome.length() ) |
654 | hardDiskHome = | 688 | hardDiskHome = |
655 | (*it)->name() + "=" + homeDir + "/Documents " | 689 | (*it)->name() + "=" + homeDir + "/Documents " |
656 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) | 690 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) |
657 | + " " + (*it)->options() + ";"; | 691 | + " " + (*it)->options() + ";"; |
658 | } | 692 | } |
659 | if ( !hardDiskHome.isEmpty() ) | 693 | if ( !hardDiskHome.isEmpty() ) |
660 | s += hardDiskHome; | 694 | s += hardDiskHome; |
@@ -676,62 +710,64 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
676 | cfg.setGroup("SyncDate"); | 710 | cfg.setGroup("SyncDate"); |
677 | cfg.writeEntry( app, date ); | 711 | cfg.writeEntry( app, date ); |
678 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); | 712 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); |
679 | } else if ( msg == "startSync(QString)" ) { | 713 | } else if ( msg == "startSync(QString)" ) { |
680 | QString what; | 714 | QString what; |
681 | stream >> what; | 715 | stream >> what; |
682 | delete syncDialog; syncDialog = 0; | 716 | delete syncDialog; syncDialog = 0; |
683 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, | 717 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, |
684 | WStyle_Tool | WStyle_Customize | | 718 | WStyle_Tool | WStyle_Customize | |
685 | Qt::WStyle_StaysOnTop ); | 719 | Qt::WStyle_StaysOnTop ); |
686 | syncDialog->showMaximized(); | 720 | syncDialog->showMaximized(); |
687 | syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); | 721 | syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); |
688 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), | 722 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), |
689 | SLOT( cancelSync() ) ); | 723 | SLOT( cancelSync() ) ); |
690 | } | 724 | } |
691 | else if ( msg == "stopSync()") { | 725 | else if ( msg == "stopSync()") { |
692 | delete syncDialog; syncDialog = 0; | 726 | delete syncDialog; syncDialog = 0; |
693 | } else if ( msg == "getAllDocLinks()" ) { | 727 | } else if ( msg == "getAllDocLinks()" ) { |
694 | loadDocs(); | 728 | loadDocs(); |
695 | 729 | ||
696 | QString contents; | 730 | QString contents; |
697 | 731 | ||
698 | for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { | 732 | for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { |
699 | DocLnk *doc = it.current(); | 733 | DocLnk *doc = it.current(); |
700 | QString lfn = doc->linkFile(); | ||
701 | QFileInfo fi( doc->file() ); | 734 | QFileInfo fi( doc->file() ); |
702 | if ( !fi.exists() ) | 735 | if ( !fi.exists() ) |
703 | continue; | 736 | continue; |
704 | 737 | ||
705 | 738 | bool fake = !doc->linkFileKnown(); | |
706 | 739 | if ( !fake ) { | |
707 | QFile f( lfn ); | 740 | QFile f( doc->linkFile() ); |
708 | if ( f.open( IO_ReadOnly ) ) { | 741 | if ( f.open( IO_ReadOnly ) ) { |
709 | QTextStream ts( &f ); | 742 | QTextStream ts( &f ); |
710 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 743 | ts.setEncoding( QTextStream::UnicodeUTF8 ); |
711 | contents += ts.read(); | 744 | contents += ts.read(); |
712 | f.close(); | 745 | f.close(); |
713 | } else { | 746 | } else |
747 | fake = TRUE; | ||
748 | } | ||
749 | if (fake) { | ||
714 | contents += "[Desktop Entry]\n"; | 750 | contents += "[Desktop Entry]\n"; |
715 | contents += "Categories = " + Qtopia::Record::idsToString( doc->categories() ) + "\n"; | 751 | contents += "Categories = " + Qtopia::Record::idsToString( doc->categories() ) + "\n"; |
716 | contents += "File = "+doc->file()+"\n"; | 752 | contents += "File = "+doc->file()+"\n"; |
717 | contents += "Name = "+doc->name()+"\n"; | 753 | contents += "Name = "+doc->name()+"\n"; |
718 | contents += "Type = "+doc->type()+"\n"; | 754 | contents += "Type = "+doc->type()+"\n"; |
719 | } | 755 | } |
720 | contents += QString("Size = %1\n").arg( fi.size() ); | 756 | contents += QString("Size = %1\n").arg( fi.size() ); |
721 | } | 757 | } |
722 | 758 | ||
723 | //qDebug( "sending length %d", contents.length() ); | 759 | //qDebug( "sending length %d", contents.length() ); |
724 | QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); | 760 | QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); |
725 | e << contents; | 761 | e << contents; |
726 | 762 | ||
727 | //qDebug( "================ \n\n%s\n\n===============", | 763 | //qDebug( "================ \n\n%s\n\n===============", |
728 | //contents.latin1() ); | 764 | //contents.latin1() ); |
729 | 765 | ||
730 | delete docsFolder; | 766 | delete docsFolder; |
731 | docsFolder = 0; | 767 | docsFolder = 0; |
732 | } | 768 | } |
733 | } | 769 | } |
734 | 770 | ||
735 | void Launcher::cancelSync() | 771 | void Launcher::cancelSync() |
736 | { | 772 | { |
737 | QCopEnvelope e( "QPE/Desktop", "cancelSync()" ); | 773 | QCopEnvelope e( "QPE/Desktop", "cancelSync()" ); |