summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
Unidiff
Diffstat (limited to 'library/qpeapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index c7ef2b7..262221e 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -721,769 +721,768 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t )
721 setVolume(); 721 setVolume();
722 } 722 }
723 723
724 installEventFilter( this ); 724 installEventFilter( this );
725 725
726 QPEMenuToolFocusManager::initialize(); 726 QPEMenuToolFocusManager::initialize();
727 727
728#ifdef QT_NO_QWS_CURSOR 728#ifdef QT_NO_QWS_CURSOR
729 // if we have no cursor, probably don't want tooltips 729 // if we have no cursor, probably don't want tooltips
730 QToolTip::setEnabled( FALSE ); 730 QToolTip::setEnabled( FALSE );
731#endif 731#endif
732} 732}
733 733
734 734
735#ifdef QTOPIA_INTERNAL_INITAPP 735#ifdef QTOPIA_INTERNAL_INITAPP
736void QPEApplication::initApp( int argc, char **argv ) 736void QPEApplication::initApp( int argc, char **argv )
737{ 737{
738 delete pidChannel; 738 delete pidChannel;
739 d->keep_running = TRUE; 739 d->keep_running = TRUE;
740 d->preloaded = FALSE; 740 d->preloaded = FALSE;
741 d->forceshow = FALSE; 741 d->forceshow = FALSE;
742 742
743 QCString channel = QCString(argv[0]); 743 QCString channel = QCString(argv[0]);
744 744
745 channel.replace(QRegExp(".*/"),""); 745 channel.replace(QRegExp(".*/"),"");
746 d->appName = channel; 746 d->appName = channel;
747 747
748 #if QT_VERSION > 235 748 #if QT_VERSION > 235
749 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 749 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6
750 #endif 750 #endif
751 751
752 channel = "QPE/Application/" + channel; 752 channel = "QPE/Application/" + channel;
753 pidChannel = new QCopChannel( channel, this); 753 pidChannel = new QCopChannel( channel, this);
754 connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), 754 connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)),
755 this, SLOT(pidMessage(const QCString &, const QByteArray &))); 755 this, SLOT(pidMessage(const QCString &, const QByteArray &)));
756 756
757 757
758 758
759 processQCopFile(); 759 processQCopFile();
760 d->keep_running = d->qcopq.isEmpty(); 760 d->keep_running = d->qcopq.isEmpty();
761 761
762 for (int a=0; a<argc; a++) { 762 for (int a=0; a<argc; a++) {
763 if ( qstrcmp(argv[a],"-preload")==0 ) { 763 if ( qstrcmp(argv[a],"-preload")==0 ) {
764 argv[a] = argv[a+1]; 764 argv[a] = argv[a+1];
765 a++; 765 a++;
766 d->preloaded = TRUE; 766 d->preloaded = TRUE;
767 argc-=1; 767 argc-=1;
768 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { 768 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) {
769 argv[a] = argv[a+1]; 769 argv[a] = argv[a+1];
770 a++; 770 a++;
771 d->preloaded = TRUE; 771 d->preloaded = TRUE;
772 d->forceshow = TRUE; 772 d->forceshow = TRUE;
773 argc-=1; 773 argc-=1;
774 } 774 }
775 } 775 }
776 776
777 /* overide stored arguments */ 777 /* overide stored arguments */
778 setArgs(argc, argv); 778 setArgs(argc, argv);
779 779
780 /* install translation here */ 780 /* install translation here */
781 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) 781 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it )
782 installTranslation( (*it) + "/" + d->appName + ".qm" ); 782 installTranslation( (*it) + "/" + d->appName + ".qm" );
783} 783}
784#endif 784#endif
785 785
786 786
787static QPtrDict<void>* inputMethodDict = 0; 787static QPtrDict<void>* inputMethodDict = 0;
788static void createInputMethodDict() 788static void createInputMethodDict()
789{ 789{
790 if ( !inputMethodDict ) 790 if ( !inputMethodDict )
791 inputMethodDict = new QPtrDict<void>; 791 inputMethodDict = new QPtrDict<void>;
792} 792}
793 793
794/*! 794/*!
795 Returns the currently set hint to the system as to whether 795 Returns the currently set hint to the system as to whether
796 widget \a w has any use for text input methods. 796 widget \a w has any use for text input methods.
797 797
798 798
799 \sa setInputMethodHint() InputMethodHint 799 \sa setInputMethodHint() InputMethodHint
800*/ 800*/
801QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) 801QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w )
802{ 802{
803 if ( inputMethodDict && w ) 803 if ( inputMethodDict && w )
804 return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); 804 return ( InputMethodHint ) ( int ) inputMethodDict->find( w );
805 return Normal; 805 return Normal;
806} 806}
807 807
808/*! 808/*!
809 \enum QPEApplication::InputMethodHint 809 \enum QPEApplication::InputMethodHint
810 810
811 \value Normal the application sometimes needs text input (the default). 811 \value Normal the application sometimes needs text input (the default).
812 \value AlwaysOff the application never needs text input. 812 \value AlwaysOff the application never needs text input.
813 \value AlwaysOn the application always needs text input. 813 \value AlwaysOn the application always needs text input.
814*/ 814*/
815 815
816/*! 816/*!
817 Hints to the system that widget \a w has use for text input methods 817 Hints to the system that widget \a w has use for text input methods
818 as specified by \a mode. 818 as specified by \a mode.
819 819
820 \sa inputMethodHint() InputMethodHint 820 \sa inputMethodHint() InputMethodHint
821*/ 821*/
822void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) 822void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode )
823{ 823{
824 createInputMethodDict(); 824 createInputMethodDict();
825 if ( mode == Normal ) { 825 if ( mode == Normal ) {
826 inputMethodDict->remove 826 inputMethodDict->remove
827 ( w ); 827 ( w );
828 } 828 }
829 else { 829 else {
830 inputMethodDict->insert( w, ( void* ) mode ); 830 inputMethodDict->insert( w, ( void* ) mode );
831 } 831 }
832} 832}
833 833
834class HackDialog : public QDialog 834class HackDialog : public QDialog
835{ 835{
836public: 836public:
837 void acceptIt() 837 void acceptIt()
838 { 838 {
839 accept(); 839 accept();
840 } 840 }
841 void rejectIt() 841 void rejectIt()
842 { 842 {
843 reject(); 843 reject();
844 } 844 }
845}; 845};
846 846
847 847
848void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) 848void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key )
849{ 849{
850 // specialised actions for certain widgets. May want to 850 // specialised actions for certain widgets. May want to
851 // add more stuff here. 851 // add more stuff here.
852 if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) 852 if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" )
853 && activePopupWidget() ->parentWidget() 853 && activePopupWidget() ->parentWidget()
854 && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) 854 && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) )
855 key = Qt::Key_Return; 855 key = Qt::Key_Return;
856 856
857 if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) 857 if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) )
858 key = Qt::Key_Return; 858 key = Qt::Key_Return;
859 859
860#ifdef QWS 860#ifdef QWS
861 861
862 ke->simpleData.keycode = key; 862 ke->simpleData.keycode = key;
863#endif 863#endif
864} 864}
865 865
866class HackWidget : public QWidget 866class HackWidget : public QWidget
867{ 867{
868public: 868public:
869 bool needsOk() 869 bool needsOk()
870 { 870 {
871 return ( getWState() & WState_Reserved1 ); 871 return ( getWState() & WState_Reserved1 );
872 } 872 }
873}; 873};
874 874
875/*! 875/*!
876 \internal 876 \internal
877*/ 877*/
878 878
879#ifdef QWS 879#ifdef QWS
880bool QPEApplication::qwsEventFilter( QWSEvent * e ) 880bool QPEApplication::qwsEventFilter( QWSEvent * e )
881{ 881{
882 if ( !d->notbusysent && e->type == QWSEvent::Focus ) { 882 if ( !d->notbusysent && e->type == QWSEvent::Focus ) {
883 if ( qApp->type() != QApplication::GuiServer ) { 883 if ( qApp->type() != QApplication::GuiServer ) {
884 QCopEnvelope e( "QPE/System", "notBusy(QString)" ); 884 QCopEnvelope e( "QPE/System", "notBusy(QString)" );
885 e << d->appName; 885 e << d->appName;
886 } 886 }
887 d->notbusysent = TRUE; 887 d->notbusysent = TRUE;
888 } 888 }
889 if ( type() == GuiServer ) { 889 if ( type() == GuiServer ) {
890 switch ( e->type ) { 890 switch ( e->type ) {
891 case QWSEvent::Mouse: 891 case QWSEvent::Mouse:
892 if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) 892 if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) )
893 emit clientMoused(); 893 emit clientMoused();
894 break; 894 break;
895 default: 895 default:
896 break; 896 break;
897 } 897 }
898 } 898 }
899 if ( e->type == QWSEvent::Key ) { 899 if ( e->type == QWSEvent::Key ) {
900 QWSKeyEvent *ke = ( QWSKeyEvent * ) e; 900 QWSKeyEvent *ke = ( QWSKeyEvent * ) e;
901 if ( ke->simpleData.keycode == Qt::Key_F33 ) { 901 if ( ke->simpleData.keycode == Qt::Key_F33 ) {
902 // Use special "OK" key to press "OK" on top level widgets 902 // Use special "OK" key to press "OK" on top level widgets
903 QWidget * active = activeWindow(); 903 QWidget * active = activeWindow();
904 QWidget *popup = 0; 904 QWidget *popup = 0;
905 if ( active && active->isPopup() ) { 905 if ( active && active->isPopup() ) {
906 popup = active; 906 popup = active;
907 active = active->parentWidget(); 907 active = active->parentWidget();
908 } 908 }
909 if ( active && ( int ) active->winId() == ke->simpleData.window && 909 if ( active && ( int ) active->winId() == ke->simpleData.window &&
910 !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { 910 !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) {
911 if ( ke->simpleData.is_press ) { 911 if ( ke->simpleData.is_press ) {
912 if ( popup ) 912 if ( popup )
913 popup->close(); 913 popup->close();
914 if ( active->inherits( "QDialog" ) ) { 914 if ( active->inherits( "QDialog" ) ) {
915 HackDialog * d = ( HackDialog * ) active; 915 HackDialog * d = ( HackDialog * ) active;
916 d->acceptIt(); 916 d->acceptIt();
917 return TRUE; 917 return TRUE;
918 } 918 }
919 else if ( ( ( HackWidget * ) active ) ->needsOk() ) { 919 else if ( ( ( HackWidget * ) active ) ->needsOk() ) {
920 QSignal s; 920 QSignal s;
921 s.connect( active, SLOT( accept() ) ); 921 s.connect( active, SLOT( accept() ) );
922 s.activate(); 922 s.activate();
923 } 923 }
924 else { 924 else {
925 // do the same as with the select key: Map to the default action of the widget: 925 // do the same as with the select key: Map to the default action of the widget:
926 mapToDefaultAction( ke, Qt::Key_Return ); 926 mapToDefaultAction( ke, Qt::Key_Return );
927 } 927 }
928 } 928 }
929 } 929 }
930 } 930 }
931 else if ( ke->simpleData.keycode == Qt::Key_F30 ) { 931 else if ( ke->simpleData.keycode == Qt::Key_F30 ) {
932 // Use special "select" key to do whatever default action a widget has 932 // Use special "select" key to do whatever default action a widget has
933 mapToDefaultAction( ke, Qt::Key_Space ); 933 mapToDefaultAction( ke, Qt::Key_Space );
934 } 934 }
935 else if ( ke->simpleData.keycode == Qt::Key_Escape && 935 else if ( ke->simpleData.keycode == Qt::Key_Escape &&
936 ke->simpleData.is_press ) { 936 ke->simpleData.is_press ) {
937 // Escape key closes app if focus on toplevel 937 // Escape key closes app if focus on toplevel
938 QWidget * active = activeWindow(); 938 QWidget * active = activeWindow();
939 if ( active && active->testWFlags( WType_TopLevel ) && 939 if ( active && active->testWFlags( WType_TopLevel ) &&
940 ( int ) active->winId() == ke->simpleData.window && 940 ( int ) active->winId() == ke->simpleData.window &&
941 !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { 941 !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) {
942 if ( active->inherits( "QDialog" ) ) { 942 if ( active->inherits( "QDialog" ) ) {
943 HackDialog * d = ( HackDialog * ) active; 943 HackDialog * d = ( HackDialog * ) active;
944 d->rejectIt(); 944 d->rejectIt();
945 return TRUE; 945 return TRUE;
946 } 946 }
947 else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { 947 else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) {
948 active->close(); 948 active->close();
949 } 949 }
950 } 950 }
951 } 951 }
952 else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { 952 else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) {
953 // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) 953 // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... ))
954 // but we cannot access libopie function within libqpe :( 954 // but we cannot access libopie function within libqpe :(
955 955
956 QWidget * active = activeWindow ( ); 956 QWidget * active = activeWindow ( );
957 if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { 957 if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) {
958 if ( d-> kbgrabbed ) { // we grabbed the keyboard 958 if ( d-> kbgrabbed ) { // we grabbed the keyboard
959 QChar ch ( ke-> simpleData.unicode ); 959 QChar ch ( ke-> simpleData.unicode );
960 QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, 960 QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease,
961 ke-> simpleData.keycode, 961 ke-> simpleData.keycode,
962 ch. latin1 ( ), 962 ch. latin1 ( ),
963 ke-> simpleData.modifiers, 963 ke-> simpleData.modifiers,
964 QString ( ch ), 964 QString ( ch ),
965 ke-> simpleData.is_auto_repeat, 1 ); 965 ke-> simpleData.is_auto_repeat, 1 );
966 966
967 QObject *which = QWidget::keyboardGrabber ( ); 967 QObject *which = QWidget::keyboardGrabber ( );
968 if ( !which ) 968 if ( !which )
969 which = QApplication::focusWidget ( ); 969 which = QApplication::focusWidget ( );
970 if ( !which ) 970 if ( !which )
971 which = QApplication::activeWindow ( ); 971 which = QApplication::activeWindow ( );
972 if ( !which ) 972 if ( !which )
973 which = qApp; 973 which = qApp;
974 974
975 QApplication::sendEvent ( which, &qke ); 975 QApplication::sendEvent ( which, &qke );
976 } 976 }
977 else { // we didn't grab the keyboard, so send the event to the launcher 977 else { // we didn't grab the keyboard, so send the event to the launcher
978 QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); 978 QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" );
979 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); 979 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat );
980 } 980 }
981 } 981 }
982 return true; 982 return true;
983 } 983 }
984 } 984 }
985 if ( e->type == QWSEvent::Focus ) { 985 if ( e->type == QWSEvent::Focus ) {
986 QWSFocusEvent * fe = ( QWSFocusEvent* ) e; 986 QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
987 if ( !fe->simpleData.get_focus ) { 987 if ( !fe->simpleData.get_focus ) {
988 QWidget * active = activeWindow(); 988 QWidget * active = activeWindow();
989 while ( active && active->isPopup() ) { 989 while ( active && active->isPopup() ) {
990 active->close(); 990 active->close();
991 active = activeWindow(); 991 active = activeWindow();
992 } 992 }
993 } 993 }
994 else { 994 else {
995 // make sure our modal widget is ALWAYS on top 995 // make sure our modal widget is ALWAYS on top
996 QWidget *topm = activeModalWidget(); 996 QWidget *topm = activeModalWidget();
997 if ( topm ) { 997 if ( topm ) {
998 topm->raise(); 998 topm->raise();
999 } 999 }
1000 } 1000 }
1001 if ( fe->simpleData.get_focus && inputMethodDict ) { 1001 if ( fe->simpleData.get_focus && inputMethodDict ) {
1002 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); 1002 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) );
1003 if ( m == AlwaysOff ) 1003 if ( m == AlwaysOff )
1004 Global::hideInputMethod(); 1004 Global::hideInputMethod();
1005 if ( m == AlwaysOn ) 1005 if ( m == AlwaysOn )
1006 Global::showInputMethod(); 1006 Global::showInputMethod();
1007 } 1007 }
1008 } 1008 }
1009 1009
1010 1010
1011 return QApplication::qwsEventFilter( e ); 1011 return QApplication::qwsEventFilter( e );
1012} 1012}
1013#endif 1013#endif
1014 1014
1015/*! 1015/*!
1016 Destroys the QPEApplication. 1016 Destroys the QPEApplication.
1017*/ 1017*/
1018QPEApplication::~QPEApplication() 1018QPEApplication::~QPEApplication()
1019{ 1019{
1020 ungrabKeyboard(); 1020 ungrabKeyboard();
1021#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 1021#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
1022 // Need to delete QCopChannels early, since the display will 1022 // Need to delete QCopChannels early, since the display will
1023 // be gone by the time we get to ~QObject(). 1023 // be gone by the time we get to ~QObject().
1024 delete sysChannel; 1024 delete sysChannel;
1025 delete pidChannel; 1025 delete pidChannel;
1026#endif 1026#endif
1027 1027
1028 delete d; 1028 delete d;
1029} 1029}
1030 1030
1031/*! 1031/*!
1032 Returns <tt>$OPIEDIR/</tt>. 1032 Returns <tt>$OPIEDIR/</tt>.
1033*/ 1033*/
1034QString QPEApplication::qpeDir() 1034QString QPEApplication::qpeDir()
1035{ 1035{
1036 const char * base = getenv( "OPIEDIR" ); 1036 const char * base = getenv( "OPIEDIR" );
1037 if ( base ) 1037 if ( base )
1038 return QString( base ) + "/"; 1038 return QString( base ) + "/";
1039 1039
1040 return QString( "../" ); 1040 return QString( "../" );
1041} 1041}
1042 1042
1043/*! 1043/*!
1044 Returns the user's current Document directory. There is a trailing "/". 1044 Returns the user's current Document directory. There is a trailing "/".
1045 .. well, it does now,, and there's no trailing '/' 1045 .. well, it does now,, and there's no trailing '/'
1046*/ 1046*/
1047QString QPEApplication::documentDir() 1047QString QPEApplication::documentDir()
1048{ 1048{
1049 const char* base = getenv( "HOME"); 1049 const char* base = getenv( "HOME");
1050 if ( base ) 1050 if ( base )
1051 return QString( base ) + "/Documents"; 1051 return QString( base ) + "/Documents";
1052 1052
1053 return QString( "../Documents" ); 1053 return QString( "../Documents" );
1054} 1054}
1055 1055
1056static int deforient = -1; 1056static int deforient = -1;
1057 1057
1058/*! 1058/*!
1059 \internal 1059 \internal
1060*/ 1060*/
1061int QPEApplication::defaultRotation() 1061int QPEApplication::defaultRotation()
1062{ 1062{
1063 if ( deforient < 0 ) { 1063 if ( deforient < 0 ) {
1064 QString d = getenv( "QWS_DISPLAY" ); 1064 QString d = getenv( "QWS_DISPLAY" );
1065 if ( d.contains( "Rot90" ) ) { 1065 if ( d.contains( "Rot90" ) ) {
1066 deforient = 90; 1066 deforient = 90;
1067 } 1067 }
1068 else if ( d.contains( "Rot180" ) ) { 1068 else if ( d.contains( "Rot180" ) ) {
1069 deforient = 180; 1069 deforient = 180;
1070 } 1070 }
1071 else if ( d.contains( "Rot270" ) ) { 1071 else if ( d.contains( "Rot270" ) ) {
1072 deforient = 270; 1072 deforient = 270;
1073 } 1073 }
1074 else { 1074 else {
1075 deforient = 0; 1075 deforient = 0;
1076 } 1076 }
1077 } 1077 }
1078 return deforient; 1078 return deforient;
1079} 1079}
1080 1080
1081/*! 1081/*!
1082 \internal 1082 \internal
1083*/ 1083*/
1084void QPEApplication::setDefaultRotation( int r ) 1084void QPEApplication::setDefaultRotation( int r )
1085{ 1085{
1086 if ( qApp->type() == GuiServer ) { 1086 if ( qApp->type() == GuiServer ) {
1087 deforient = r; 1087 deforient = r;
1088 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 1088 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
1089 Config config("qpe"); 1089 Config config("qpe");
1090 config.setGroup( "Rotation" ); 1090 config.setGroup( "Rotation" );
1091 config.writeEntry( "Rot", r ); 1091 config.writeEntry( "Rot", r );
1092 } 1092 }
1093 else { 1093 else {
1094#ifndef QT_NO_COP 1094#ifndef QT_NO_COP
1095 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); 1095 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" );
1096 e << r; 1096 e << r;
1097 } 1097 }
1098#endif 1098#endif
1099 1099
1100 } 1100 }
1101} 1101}
1102 1102
1103#include <qgfx_qws.h> 1103#include <qgfx_qws.h>
1104#include <qwindowsystem_qws.h> 1104#include <qwindowsystem_qws.h>
1105#include <qpixmapcache.h>
1106 1105
1107extern void qws_clearLoadedFonts(); 1106extern void qws_clearLoadedFonts();
1108 1107
1109void QPEApplication::setCurrentMode( int x, int y, int depth ) 1108void QPEApplication::setCurrentMode( int x, int y, int depth )
1110{ 1109{
1111 // Reset the caches 1110 // Reset the caches
1112 qws_clearLoadedFonts(); 1111 qws_clearLoadedFonts();
1113 QPixmapCache::clear(); 1112 QPixmapCache::clear();
1114 1113
1115 // Change the screen mode 1114 // Change the screen mode
1116 qt_screen->setMode(x, y, depth); 1115 qt_screen->setMode(x, y, depth);
1117 1116
1118 if ( qApp->type() == GuiServer ) { 1117 if ( qApp->type() == GuiServer ) {
1119 // Reconfigure the GuiServer 1118 // Reconfigure the GuiServer
1120 qwsServer->beginDisplayReconfigure(); 1119 qwsServer->beginDisplayReconfigure();
1121 qwsServer->endDisplayReconfigure(); 1120 qwsServer->endDisplayReconfigure();
1122 1121
1123 // Get all the running apps to reset 1122 // Get all the running apps to reset
1124 QCopEnvelope env( "QPE/System", "reset()" ); 1123 QCopEnvelope env( "QPE/System", "reset()" );
1125 } 1124 }
1126} 1125}
1127 1126
1128void QPEApplication::reset() { 1127void QPEApplication::reset() {
1129 // Reconnect to the screen 1128 // Reconnect to the screen
1130 qt_screen->disconnect(); 1129 qt_screen->disconnect();
1131 qt_screen->connect( QString::null ); 1130 qt_screen->connect( QString::null );
1132 1131
1133 // Redraw everything 1132 // Redraw everything
1134 applyStyle(); 1133 applyStyle();
1135} 1134}
1136 1135
1137/*! 1136/*!
1138 \internal 1137 \internal
1139*/ 1138*/
1140void QPEApplication::applyStyle() 1139void QPEApplication::applyStyle()
1141{ 1140{
1142 Config config( "qpe" ); 1141 Config config( "qpe" );
1143 config.setGroup( "Appearance" ); 1142 config.setGroup( "Appearance" );
1144 1143
1145#if QT_VERSION > 233 1144#if QT_VERSION > 233
1146#if !defined(OPIE_NO_OVERRIDE_QT) 1145#if !defined(OPIE_NO_OVERRIDE_QT)
1147 // don't block ourselves ... 1146 // don't block ourselves ...
1148 Opie::force_appearance = 0; 1147 Opie::force_appearance = 0;
1149 1148
1150 static QString appname = Opie::binaryName ( ); 1149 static QString appname = Opie::binaryName ( );
1151 1150
1152 QStringList ex = config. readListEntry ( "NoStyle", ';' ); 1151 QStringList ex = config. readListEntry ( "NoStyle", ';' );
1153 int nostyle = 0; 1152 int nostyle = 0;
1154 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { 1153 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) {
1155 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { 1154 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) {
1156 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); 1155 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 );
1157 break; 1156 break;
1158 } 1157 }
1159 } 1158 }
1160#else 1159#else
1161 int nostyle = 0; 1160 int nostyle = 0;
1162#endif 1161#endif
1163 1162
1164 // Widget style 1163 // Widget style
1165 QString style = config.readEntry( "Style", "FlatStyle" ); 1164 QString style = config.readEntry( "Style", "FlatStyle" );
1166 1165
1167 // don't set a custom style 1166 // don't set a custom style
1168 if ( nostyle & Opie::Force_Style ) 1167 if ( nostyle & Opie::Force_Style )
1169 style = "FlatStyle"; 1168 style = "FlatStyle";
1170 1169
1171 internalSetStyle ( style ); 1170 internalSetStyle ( style );
1172 1171
1173 // Colors - from /etc/colors/Liquid.scheme 1172 // Colors - from /etc/colors/Liquid.scheme
1174 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); 1173 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) );
1175 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); 1174 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) );
1176 QPalette pal( btncolor, bgcolor ); 1175 QPalette pal( btncolor, bgcolor );
1177 QString color = config.readEntry( "Highlight", "#73adef" ); 1176 QString color = config.readEntry( "Highlight", "#73adef" );
1178 pal.setColor( QColorGroup::Highlight, QColor( color ) ); 1177 pal.setColor( QColorGroup::Highlight, QColor( color ) );
1179 color = config.readEntry( "HighlightedText", "#FFFFFF" ); 1178 color = config.readEntry( "HighlightedText", "#FFFFFF" );
1180 pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); 1179 pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
1181 color = config.readEntry( "Text", "#000000" ); 1180 color = config.readEntry( "Text", "#000000" );
1182 pal.setColor( QColorGroup::Text, QColor( color ) ); 1181 pal.setColor( QColorGroup::Text, QColor( color ) );
1183 color = config.readEntry( "ButtonText", "#000000" ); 1182 color = config.readEntry( "ButtonText", "#000000" );
1184 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); 1183 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
1185 color = config.readEntry( "Base", "#FFFFFF" ); 1184 color = config.readEntry( "Base", "#FFFFFF" );
1186 pal.setColor( QColorGroup::Base, QColor( color ) ); 1185 pal.setColor( QColorGroup::Base, QColor( color ) );
1187 1186
1188 pal.setColor( QPalette::Disabled, QColorGroup::Text, 1187 pal.setColor( QPalette::Disabled, QColorGroup::Text,
1189 pal.color( QPalette::Active, QColorGroup::Background ).dark() ); 1188 pal.color( QPalette::Active, QColorGroup::Background ).dark() );
1190 1189
1191 setPalette( pal, TRUE ); 1190 setPalette( pal, TRUE );
1192 1191
1193 // Window Decoration 1192 // Window Decoration
1194 QString dec = config.readEntry( "Decoration", "Flat" ); 1193 QString dec = config.readEntry( "Decoration", "Flat" );
1195 1194
1196 // don't set a custom deco 1195 // don't set a custom deco
1197 if ( nostyle & Opie::Force_Decoration ) 1196 if ( nostyle & Opie::Force_Decoration )
1198 dec = ""; 1197 dec = "";
1199 1198
1200 //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); 1199 //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle);
1201 1200
1202 if ( dec != d->decorationName ) { 1201 if ( dec != d->decorationName ) {
1203 qwsSetDecoration( new QPEDecoration( dec ) ); 1202 qwsSetDecoration( new QPEDecoration( dec ) );
1204 d->decorationName = dec; 1203 d->decorationName = dec;
1205 } 1204 }
1206 1205
1207 // Font 1206 // Font
1208 QString ff = config.readEntry( "FontFamily", font().family() ); 1207 QString ff = config.readEntry( "FontFamily", font().family() );
1209 int fs = config.readNumEntry( "FontSize", font().pointSize() ); 1208 int fs = config.readNumEntry( "FontSize", font().pointSize() );
1210 1209
1211 // don't set a custom font 1210 // don't set a custom font
1212 if ( nostyle & Opie::Force_Font ) { 1211 if ( nostyle & Opie::Force_Font ) {
1213 ff = "Vera"; 1212 ff = "Vera";
1214 fs = 10; 1213 fs = 10;
1215 } 1214 }
1216 1215
1217 setFont ( QFont ( ff, fs ), true ); 1216 setFont ( QFont ( ff, fs ), true );
1218 1217
1219#if !defined(OPIE_NO_OVERRIDE_QT) 1218#if !defined(OPIE_NO_OVERRIDE_QT)
1220 // revert to global blocking policy ... 1219 // revert to global blocking policy ...
1221 Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; 1220 Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None;
1222 Opie::force_appearance &= ~nostyle; 1221 Opie::force_appearance &= ~nostyle;
1223#endif 1222#endif
1224#endif 1223#endif
1225} 1224}
1226 1225
1227void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) 1226void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data )
1228{ 1227{
1229#ifdef Q_WS_QWS 1228#ifdef Q_WS_QWS
1230 QDataStream stream( data, IO_ReadOnly ); 1229 QDataStream stream( data, IO_ReadOnly );
1231 if ( msg == "applyStyle()" ) { 1230 if ( msg == "applyStyle()" ) {
1232 applyStyle(); 1231 applyStyle();
1233 } 1232 }
1234 else if ( msg == "toggleApplicationMenu()" ) { 1233 else if ( msg == "toggleApplicationMenu()" ) {
1235 QWidget *active = activeWindow ( ); 1234 QWidget *active = activeWindow ( );
1236 1235
1237 if ( active ) { 1236 if ( active ) {
1238 QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); 1237 QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( );
1239 bool oldactive = man-> isActive ( ); 1238 bool oldactive = man-> isActive ( );
1240 1239
1241 man-> setActive( !man-> isActive() ); 1240 man-> setActive( !man-> isActive() );
1242 1241
1243 if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu 1242 if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu
1244 QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); 1243 QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" );
1245 } 1244 }
1246 } 1245 }
1247 } 1246 }
1248 else if ( msg == "setDefaultRotation(int)" ) { 1247 else if ( msg == "setDefaultRotation(int)" ) {
1249 if ( type() == GuiServer ) { 1248 if ( type() == GuiServer ) {
1250 int r; 1249 int r;
1251 stream >> r; 1250 stream >> r;
1252 setDefaultRotation( r ); 1251 setDefaultRotation( r );
1253 } 1252 }
1254 } 1253 }
1255 else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> 1254 else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net>
1256 if ( type() == GuiServer ) { 1255 if ( type() == GuiServer ) {
1257 int x, y, depth; 1256 int x, y, depth;
1258 stream >> x; 1257 stream >> x;
1259 stream >> y; 1258 stream >> y;
1260 stream >> depth; 1259 stream >> depth;
1261 setCurrentMode( x, y, depth ); 1260 setCurrentMode( x, y, depth );
1262 } 1261 }
1263 } 1262 }
1264 else if ( msg == "reset()" ) { 1263 else if ( msg == "reset()" ) {
1265 if ( type() != GuiServer ) 1264 if ( type() != GuiServer )
1266 reset(); 1265 reset();
1267 } 1266 }
1268 else if ( msg == "setCurrentRotation(int)" ) { 1267 else if ( msg == "setCurrentRotation(int)" ) {
1269 int r; 1268 int r;
1270 stream >> r; 1269 stream >> r;
1271 setCurrentRotation( r ); 1270 setCurrentRotation( r );
1272 } 1271 }
1273 else if ( msg == "shutdown()" ) { 1272 else if ( msg == "shutdown()" ) {
1274 if ( type() == GuiServer ) 1273 if ( type() == GuiServer )
1275 shutdown(); 1274 shutdown();
1276 } 1275 }
1277 else if ( msg == "quit()" ) { 1276 else if ( msg == "quit()" ) {
1278 if ( type() != GuiServer ) 1277 if ( type() != GuiServer )
1279 tryQuit(); 1278 tryQuit();
1280 } 1279 }
1281 else if ( msg == "forceQuit()" ) { 1280 else if ( msg == "forceQuit()" ) {
1282 if ( type() != GuiServer ) 1281 if ( type() != GuiServer )
1283 quit(); 1282 quit();
1284 } 1283 }
1285 else if ( msg == "restart()" ) { 1284 else if ( msg == "restart()" ) {
1286 if ( type() == GuiServer ) 1285 if ( type() == GuiServer )
1287 restart(); 1286 restart();
1288 } 1287 }
1289 else if ( msg == "language(QString)" ) { 1288 else if ( msg == "language(QString)" ) {
1290 if ( type() == GuiServer ) { 1289 if ( type() == GuiServer ) {
1291 QString l; 1290 QString l;
1292 stream >> l; 1291 stream >> l;
1293 QString cl = getenv( "LANG" ); 1292 QString cl = getenv( "LANG" );
1294 if ( cl != l ) { 1293 if ( cl != l ) {
1295 if ( l.isNull() ) 1294 if ( l.isNull() )
1296 unsetenv( "LANG" ); 1295 unsetenv( "LANG" );
1297 else 1296 else
1298 setenv( "LANG", l.latin1(), 1 ); 1297 setenv( "LANG", l.latin1(), 1 );
1299 restart(); 1298 restart();
1300 } 1299 }
1301 } 1300 }
1302 } 1301 }
1303 else if ( msg == "timeChange(QString)" ) { 1302 else if ( msg == "timeChange(QString)" ) {
1304 QString t; 1303 QString t;
1305 stream >> t; 1304 stream >> t;
1306 if ( t.isNull() ) 1305 if ( t.isNull() )
1307 unsetenv( "TZ" ); 1306 unsetenv( "TZ" );
1308 else 1307 else
1309 setenv( "TZ", t.latin1(), 1 ); 1308 setenv( "TZ", t.latin1(), 1 );
1310 // emit the signal so everyone else knows... 1309 // emit the signal so everyone else knows...
1311 emit timeChanged(); 1310 emit timeChanged();
1312 } 1311 }
1313 else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { 1312 else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) {
1314 if ( type() == GuiServer ) { 1313 if ( type() == GuiServer ) {
1315 QDateTime when; 1314 QDateTime when;
1316 QCString channel, message; 1315 QCString channel, message;
1317 int data; 1316 int data;
1318 stream >> when >> channel >> message >> data; 1317 stream >> when >> channel >> message >> data;
1319 AlarmServer::addAlarm( when, channel, message, data ); 1318 AlarmServer::addAlarm( when, channel, message, data );
1320 } 1319 }
1321 } 1320 }
1322 else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { 1321 else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) {
1323 if ( type() == GuiServer ) { 1322 if ( type() == GuiServer ) {
1324 QDateTime when; 1323 QDateTime when;
1325 QCString channel, message; 1324 QCString channel, message;
1326 int data; 1325 int data;
1327 stream >> when >> channel >> message >> data; 1326 stream >> when >> channel >> message >> data;
1328 AlarmServer::deleteAlarm( when, channel, message, data ); 1327 AlarmServer::deleteAlarm( when, channel, message, data );
1329 } 1328 }
1330 } 1329 }
1331 else if ( msg == "clockChange(bool)" ) { 1330 else if ( msg == "clockChange(bool)" ) {
1332 int tmp; 1331 int tmp;
1333 stream >> tmp; 1332 stream >> tmp;
1334 emit clockChanged( tmp ); 1333 emit clockChanged( tmp );
1335 } 1334 }
1336 else if ( msg == "weekChange(bool)" ) { 1335 else if ( msg == "weekChange(bool)" ) {
1337 int tmp; 1336 int tmp;
1338 stream >> tmp; 1337 stream >> tmp;
1339 emit weekChanged( tmp ); 1338 emit weekChanged( tmp );
1340 } 1339 }
1341 else if ( msg == "setDateFormat(DateFormat)" ) { 1340 else if ( msg == "setDateFormat(DateFormat)" ) {
1342 DateFormat tmp; 1341 DateFormat tmp;
1343 stream >> tmp; 1342 stream >> tmp;
1344 emit dateFormatChanged( tmp ); 1343 emit dateFormatChanged( tmp );
1345 } 1344 }
1346 else if ( msg == "setVolume(int,int)" ) { 1345 else if ( msg == "setVolume(int,int)" ) {
1347 int t, v; 1346 int t, v;
1348 stream >> t >> v; 1347 stream >> t >> v;
1349 setVolume( t, v ); 1348 setVolume( t, v );
1350 emit volumeChanged( muted ); 1349 emit volumeChanged( muted );
1351 } 1350 }
1352 else if ( msg == "volumeChange(bool)" ) { 1351 else if ( msg == "volumeChange(bool)" ) {
1353 stream >> muted; 1352 stream >> muted;
1354 setVolume(); 1353 setVolume();
1355 emit volumeChanged( muted ); 1354 emit volumeChanged( muted );
1356 } 1355 }
1357 else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> 1356 else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1358 int t, v; 1357 int t, v;
1359 stream >> t >> v; 1358 stream >> t >> v;
1360 setMic( t, v ); 1359 setMic( t, v );
1361 emit micChanged( micMuted ); 1360 emit micChanged( micMuted );
1362 } 1361 }
1363 else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> 1362 else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1364 stream >> micMuted; 1363 stream >> micMuted;
1365 setMic(); 1364 setMic();
1366 emit micChanged( micMuted ); 1365 emit micChanged( micMuted );
1367 } 1366 }
1368 else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1367 else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1369 int t, v; 1368 int t, v;
1370 stream >> t >> v; 1369 stream >> t >> v;
1371 setBass( t, v ); 1370 setBass( t, v );
1372 } 1371 }
1373 else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1372 else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1374 setBass(); 1373 setBass();
1375 } 1374 }
1376 else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1375 else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1377 int t, v; 1376 int t, v;
1378 stream >> t >> v; 1377 stream >> t >> v;
1379 setTreble( t, v ); 1378 setTreble( t, v );
1380 } 1379 }
1381 else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1380 else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1382 setTreble(); 1381 setTreble();
1383 } else if ( msg == "getMarkedText()" ) { 1382 } else if ( msg == "getMarkedText()" ) {
1384 if ( type() == GuiServer ) { 1383 if ( type() == GuiServer ) {
1385 const ushort unicode = 'C'-'@'; 1384 const ushort unicode = 'C'-'@';
1386 const int scan = Key_C; 1385 const int scan = Key_C;
1387 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); 1386 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE );
1388 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); 1387 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE );
1389 } 1388 }
1390 } else if ( msg == "newChannel(QString)") { 1389 } else if ( msg == "newChannel(QString)") {
1391 QString myChannel = "QPE/Application/" + d->appName; 1390 QString myChannel = "QPE/Application/" + d->appName;
1392 QString channel; 1391 QString channel;
1393 stream >> channel; 1392 stream >> channel;
1394 if (channel == myChannel) { 1393 if (channel == myChannel) {
1395 processQCopFile(); 1394 processQCopFile();
1396 d->sendQCopQ(); 1395 d->sendQCopQ();
1397 } 1396 }
1398 } 1397 }
1399 1398
1400 1399
1401#endif 1400#endif
1402} 1401}
1403 1402
1404 1403
1405 1404
1406 1405
1407 1406
1408/*! 1407/*!
1409 \internal 1408 \internal
1410*/ 1409*/
1411bool QPEApplication::raiseAppropriateWindow() 1410bool QPEApplication::raiseAppropriateWindow()
1412{ 1411{
1413 bool r=FALSE; 1412 bool r=FALSE;
1414 1413
1415 // 1. Raise the main widget 1414 // 1. Raise the main widget
1416 QWidget *top = d->qpe_main_widget; 1415 QWidget *top = d->qpe_main_widget;
1417 if ( !top ) top = mainWidget(); 1416 if ( !top ) top = mainWidget();
1418 1417
1419 if ( top && d->keep_running ) { 1418 if ( top && d->keep_running ) {
1420 if ( top->isVisible() ) 1419 if ( top->isVisible() )
1421 r = TRUE; 1420 r = TRUE;
1422 else if (d->preloaded) { 1421 else if (d->preloaded) {
1423 // We are preloaded and not visible.. pretend we just started.. 1422 // We are preloaded and not visible.. pretend we just started..
1424#ifndef QT_NO_COP 1423#ifndef QT_NO_COP
1425 QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); 1424 QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
1426 e << d->appName; 1425 e << d->appName;
1427#endif 1426#endif
1428 } 1427 }
1429 1428
1430 d->show_mx(top,d->nomaximize, d->appName); 1429 d->show_mx(top,d->nomaximize, d->appName);
1431 top->raise(); 1430 top->raise();
1432 } 1431 }
1433 1432
1434 QWidget *topm = activeModalWidget(); 1433 QWidget *topm = activeModalWidget();
1435 1434
1436 // 2. Raise any parentless widgets (except top and topm, as they 1435 // 2. Raise any parentless widgets (except top and topm, as they
1437 // are raised before and after this loop). Order from most 1436 // are raised before and after this loop). Order from most
1438 // recently raised as deepest to least recently as top, so 1437 // recently raised as deepest to least recently as top, so
1439 // that repeated calls cycle through widgets. 1438 // that repeated calls cycle through widgets.
1440 QWidgetList *list = topLevelWidgets(); 1439 QWidgetList *list = topLevelWidgets();
1441 if ( list ) { 1440 if ( list ) {
1442 bool foundlast = FALSE; 1441 bool foundlast = FALSE;
1443 QWidget* topsub = 0; 1442 QWidget* topsub = 0;
1444 if ( d->lastraised ) { 1443 if ( d->lastraised ) {
1445 for (QWidget* w = list->first(); w; w = list->next()) { 1444 for (QWidget* w = list->first(); w; w = list->next()) {
1446 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { 1445 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) {
1447 if ( w == d->lastraised ) 1446 if ( w == d->lastraised )
1448 foundlast = TRUE; 1447 foundlast = TRUE;
1449 if ( foundlast ) { 1448 if ( foundlast ) {
1450 w->raise(); 1449 w->raise();
1451 topsub = w; 1450 topsub = w;
1452 } 1451 }
1453 } 1452 }
1454 } 1453 }
1455 } 1454 }
1456 for (QWidget* w = list->first(); w; w = list->next()) { 1455 for (QWidget* w = list->first(); w; w = list->next()) {
1457 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { 1456 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) {
1458 if ( w == d->lastraised ) 1457 if ( w == d->lastraised )
1459 break; 1458 break;
1460 w->raise(); 1459 w->raise();
1461 topsub = w; 1460 topsub = w;
1462 } 1461 }
1463 } 1462 }
1464 d->lastraised = topsub; 1463 d->lastraised = topsub;
1465 delete list; 1464 delete list;
1466 } 1465 }
1467 1466
1468 // 3. Raise the active modal widget. 1467 // 3. Raise the active modal widget.
1469 if ( topm && topm != top ) { 1468 if ( topm && topm != top ) {
1470 topm->show(); 1469 topm->show();
1471 topm->raise(); 1470 topm->raise();
1472 // If we haven't already handled the fastAppShowing message 1471 // If we haven't already handled the fastAppShowing message
1473 if (!top && d->preloaded) { 1472 if (!top && d->preloaded) {
1474#ifndef QT_NO_COP 1473#ifndef QT_NO_COP
1475 QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); 1474 QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
1476 e << d->appName; 1475 e << d->appName;
1477#endif 1476#endif
1478 } 1477 }
1479 r = FALSE; 1478 r = FALSE;
1480 } 1479 }
1481 1480
1482 return r; 1481 return r;
1483} 1482}
1484 1483
1485 1484
1486void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) 1485void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
1487{ 1486{
1488#ifdef Q_WS_QWS 1487#ifdef Q_WS_QWS
1489 1488