-rw-r--r-- | core/launcher/desktop.cpp | 18 | ||||
-rw-r--r-- | core/launcher/desktop.h | 1 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 46 |
3 files changed, 58 insertions, 7 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 | |||
@@ -49,13 +49,12 @@ | |||
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) { } |
@@ -494,12 +493,23 @@ void Desktop::raiseMenu() | |||
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> |
@@ -533,21 +543,25 @@ 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(); |
549 | |||
539 | system("apm --suspend"); | 550 | system("apm --suspend"); |
551 | execAutoStart(); | ||
540 | QWSServer::screenSaverActivate( FALSE ); | 552 | QWSServer::screenSaverActivate( FALSE ); |
541 | { | 553 | { |
542 | QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep | 554 | QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep |
543 | QCopEnvelope e("QPE/System", "setBacklight(int)"); | 555 | QCopEnvelope e("QPE/System", "setBacklight(int)"); |
544 | e << -3; // Force on | 556 | e << -3; // Force on |
545 | } | 557 | } |
546 | if ( wasloggedin ) | 558 | if ( wasloggedin ) { |
547 | login(TRUE); | 559 | login(TRUE); |
560 | } | ||
561 | |||
548 | //qcopBridge->closeOpenConnections(); | 562 | //qcopBridge->closeOpenConnections(); |
549 | //qDebug("called togglePower()!!!!!!"); | 563 | //qDebug("called togglePower()!!!!!!"); |
550 | } | 564 | } |
551 | 565 | ||
552 | void Desktop::toggleLight() | 566 | void Desktop::toggleLight() |
553 | { | 567 | { |
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 | |||
@@ -96,12 +96,13 @@ public: | |||
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(); |
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 | |||
@@ -15,12 +15,16 @@ | |||
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> |
@@ -628,12 +632,42 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
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"); |
@@ -694,26 +728,28 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
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 | } |