author | chicken <chicken> | 2004-03-01 18:10:37 (UTC) |
---|---|---|
committer | chicken <chicken> | 2004-03-01 18:10:37 (UTC) |
commit | 7fd20d139e2d9bc37ce22bbdb07f4ebc54903f91 (patch) (unidiff) | |
tree | 15ef5e3d00c5476ea98ca36ba6c8392eb02e53c8 /library/qpeapplication.cpp | |
parent | 5b4e342004537f84fa53911a46cd00d810378da7 (diff) | |
download | opie-7fd20d139e2d9bc37ce22bbdb07f4ebc54903f91.zip opie-7fd20d139e2d9bc37ce22bbdb07f4ebc54903f91.tar.gz opie-7fd20d139e2d9bc37ce22bbdb07f4ebc54903f91.tar.bz2 |
fix includes
-rw-r--r-- | library/qpeapplication.cpp | 1 |
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 | |||
@@ -849,513 +849,512 @@ void 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 | ||
866 | class HackWidget : public QWidget | 866 | class HackWidget : public QWidget |
867 | { | 867 | { |
868 | public: | 868 | public: |
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 |
880 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) | 880 | bool 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 | */ |
1018 | QPEApplication::~QPEApplication() | 1018 | QPEApplication::~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 | */ |
1034 | QString QPEApplication::qpeDir() | 1034 | QString 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 | */ |
1047 | QString QPEApplication::documentDir() | 1047 | QString 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 | ||
1056 | static int deforient = -1; | 1056 | static int deforient = -1; |
1057 | 1057 | ||
1058 | /*! | 1058 | /*! |
1059 | \internal | 1059 | \internal |
1060 | */ | 1060 | */ |
1061 | int QPEApplication::defaultRotation() | 1061 | int 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 | */ |
1084 | void QPEApplication::setDefaultRotation( int r ) | 1084 | void 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 | ||
1107 | extern void qws_clearLoadedFonts(); | 1106 | extern void qws_clearLoadedFonts(); |
1108 | 1107 | ||
1109 | void QPEApplication::setCurrentMode( int x, int y, int depth ) | 1108 | void 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 | ||
1128 | void QPEApplication::reset() { | 1127 | void 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 | */ |
1140 | void QPEApplication::applyStyle() | 1139 | void 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 | ||
1227 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1226 | void 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 ); |