summaryrefslogtreecommitdiff
path: root/library
authoreilers <eilers>2003-09-01 12:22:09 (UTC)
committer eilers <eilers>2003-09-01 12:22:09 (UTC)
commit68a308e1166ec4462dea188c3141c7f884f5d6b5 (patch) (unidiff)
treec999c2b0af1f5f2339582c9609d1cb9168d08bcf /library
parent45a479040238764f97eed267c74aed6cf27eece8 (diff)
downloadopie-68a308e1166ec4462dea188c3141c7f884f5d6b5.zip
opie-68a308e1166ec4462dea188c3141c7f884f5d6b5.tar.gz
opie-68a308e1166ec4462dea188c3141c7f884f5d6b5.tar.bz2
Fix to compile..
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp4
-rw-r--r--library/qpeapplication.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 71ec5b3..bf353d4 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -948,276 +948,276 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e )
948 } 948 }
949 return true; 949 return true;
950 } 950 }
951 } 951 }
952 if ( e->type == QWSEvent::Focus ) { 952 if ( e->type == QWSEvent::Focus ) {
953 QWSFocusEvent * fe = ( QWSFocusEvent* ) e; 953 QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
954 if ( !fe->simpleData.get_focus ) { 954 if ( !fe->simpleData.get_focus ) {
955 QWidget * active = activeWindow(); 955 QWidget * active = activeWindow();
956 while ( active && active->isPopup() ) { 956 while ( active && active->isPopup() ) {
957 active->close(); 957 active->close();
958 active = activeWindow(); 958 active = activeWindow();
959 } 959 }
960 } 960 }
961 else { 961 else {
962 // make sure our modal widget is ALWAYS on top 962 // make sure our modal widget is ALWAYS on top
963 QWidget *topm = activeModalWidget(); 963 QWidget *topm = activeModalWidget();
964 if ( topm ) { 964 if ( topm ) {
965 topm->raise(); 965 topm->raise();
966 } 966 }
967 } 967 }
968 if ( fe->simpleData.get_focus && inputMethodDict ) { 968 if ( fe->simpleData.get_focus && inputMethodDict ) {
969 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); 969 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) );
970 if ( m == AlwaysOff ) 970 if ( m == AlwaysOff )
971 Global::hideInputMethod(); 971 Global::hideInputMethod();
972 if ( m == AlwaysOn ) 972 if ( m == AlwaysOn )
973 Global::showInputMethod(); 973 Global::showInputMethod();
974 } 974 }
975 } 975 }
976 976
977 977
978 return QApplication::qwsEventFilter( e ); 978 return QApplication::qwsEventFilter( e );
979} 979}
980#endif 980#endif
981 981
982/*! 982/*!
983 Destroys the QPEApplication. 983 Destroys the QPEApplication.
984*/ 984*/
985QPEApplication::~QPEApplication() 985QPEApplication::~QPEApplication()
986{ 986{
987 ungrabKeyboard(); 987 ungrabKeyboard();
988#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 988#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
989 // Need to delete QCopChannels early, since the display will 989 // Need to delete QCopChannels early, since the display will
990 // be gone by the time we get to ~QObject(). 990 // be gone by the time we get to ~QObject().
991 delete sysChannel; 991 delete sysChannel;
992 delete pidChannel; 992 delete pidChannel;
993#endif 993#endif
994 994
995 delete d; 995 delete d;
996} 996}
997 997
998/*! 998/*!
999 Returns <tt>$OPIEDIR/</tt>. 999 Returns <tt>$OPIEDIR/</tt>.
1000*/ 1000*/
1001QString QPEApplication::qpeDir() 1001QString QPEApplication::qpeDir()
1002{ 1002{
1003 const char * base = getenv( "OPIEDIR" ); 1003 const char * base = getenv( "OPIEDIR" );
1004 if ( base ) 1004 if ( base )
1005 return QString( base ) + "/"; 1005 return QString( base ) + "/";
1006 1006
1007 return QString( "../" ); 1007 return QString( "../" );
1008} 1008}
1009 1009
1010/*! 1010/*!
1011 Returns the user's current Document directory. There is a trailing "/". 1011 Returns the user's current Document directory. There is a trailing "/".
1012 .. well, it does now,, and there's no trailing '/' 1012 .. well, it does now,, and there's no trailing '/'
1013*/ 1013*/
1014QString QPEApplication::documentDir() 1014QString QPEApplication::documentDir()
1015{ 1015{
1016 const char* base = getenv( "HOME"); 1016 const char* base = getenv( "HOME");
1017 if ( base ) 1017 if ( base )
1018 return QString( base ) + "/Documents"; 1018 return QString( base ) + "/Documents";
1019 1019
1020 return QString( "../Documents" ); 1020 return QString( "../Documents" );
1021} 1021}
1022 1022
1023static int deforient = -1; 1023static int deforient = -1;
1024 1024
1025/*! 1025/*!
1026 \internal 1026 \internal
1027*/ 1027*/
1028int QPEApplication::defaultRotation() 1028int QPEApplication::defaultRotation()
1029{ 1029{
1030 if ( deforient < 0 ) { 1030 if ( deforient < 0 ) {
1031 QString d = getenv( "QWS_DISPLAY" ); 1031 QString d = getenv( "QWS_DISPLAY" );
1032 if ( d.contains( "Rot90" ) ) { 1032 if ( d.contains( "Rot90" ) ) {
1033 deforient = 90; 1033 deforient = 90;
1034 } 1034 }
1035 else if ( d.contains( "Rot180" ) ) { 1035 else if ( d.contains( "Rot180" ) ) {
1036 deforient = 180; 1036 deforient = 180;
1037 } 1037 }
1038 else if ( d.contains( "Rot270" ) ) { 1038 else if ( d.contains( "Rot270" ) ) {
1039 deforient = 270; 1039 deforient = 270;
1040 } 1040 }
1041 else { 1041 else {
1042 deforient = 0; 1042 deforient = 0;
1043 } 1043 }
1044 } 1044 }
1045 return deforient; 1045 return deforient;
1046} 1046}
1047 1047
1048/*! 1048/*!
1049 \internal 1049 \internal
1050*/ 1050*/
1051void QPEApplication::setDefaultRotation( int r ) 1051void QPEApplication::setDefaultRotation( int r )
1052{ 1052{
1053 if ( qApp->type() == GuiServer ) { 1053 if ( qApp->type() == GuiServer ) {
1054 deforient = r; 1054 deforient = r;
1055 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 1055 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
1056 Config config("qpe"); 1056 Config config("qpe");
1057 config.setGroup( "Rotation" ); 1057 config.setGroup( "Rotation" );
1058 config.writeEntry( "Rot", r ); 1058 config.writeEntry( "Rot", r );
1059 } 1059 }
1060 else { 1060 else {
1061#ifndef QT_NO_COP 1061#ifndef QT_NO_COP
1062 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); 1062 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" );
1063 e << r; 1063 e << r;
1064 } 1064 }
1065#endif 1065#endif
1066 1066
1067 } 1067 }
1068} 1068}
1069 1069
1070#include <qgfx_qws.h> 1070#include <qgfx_qws.h>
1071#include <qwindowsystem_qws.h> 1071#include <qwindowsystem_qws.h>
1072#include <qpixmapcache.h> 1072#include <qpixmapcache.h>
1073 1073
1074extern void qws_clearLoadedFonts(); 1074extern void qws_clearLoadedFonts();
1075 1075
1076inline void QPEApplication::setCurrentMode( int x, int y, int depth ) 1076void QPEApplication::setCurrentMode( int x, int y, int depth )
1077{ 1077{
1078 // Reset the caches 1078 // Reset the caches
1079 qws_clearLoadedFonts(); 1079 qws_clearLoadedFonts();
1080 QPixmapCache::clear(); 1080 QPixmapCache::clear();
1081 1081
1082 // Change the screen mode 1082 // Change the screen mode
1083 qt_screen->setMode(x, y, depth); 1083 qt_screen->setMode(x, y, depth);
1084 1084
1085 if ( qApp->type() == GuiServer ) { 1085 if ( qApp->type() == GuiServer ) {
1086 // Reconfigure the GuiServer 1086 // Reconfigure the GuiServer
1087 qwsServer->beginDisplayReconfigure(); 1087 qwsServer->beginDisplayReconfigure();
1088 qwsServer->endDisplayReconfigure(); 1088 qwsServer->endDisplayReconfigure();
1089 1089
1090 // Get all the running apps to reset 1090 // Get all the running apps to reset
1091 QCopEnvelope env( "QPE/System", "reset()" ); 1091 QCopEnvelope env( "QPE/System", "reset()" );
1092 } 1092 }
1093} 1093}
1094 1094
1095inline void QPEApplication::reset() { 1095void QPEApplication::reset() {
1096 // Reconnect to the screen 1096 // Reconnect to the screen
1097 qt_screen->disconnect(); 1097 qt_screen->disconnect();
1098 qt_screen->connect( QString::null ); 1098 qt_screen->connect( QString::null );
1099 1099
1100 // Redraw everything 1100 // Redraw everything
1101 applyStyle(); 1101 applyStyle();
1102} 1102}
1103 1103
1104/*! 1104/*!
1105 \internal 1105 \internal
1106*/ 1106*/
1107void QPEApplication::applyStyle() 1107void QPEApplication::applyStyle()
1108{ 1108{
1109 Config config( "qpe" ); 1109 Config config( "qpe" );
1110 config.setGroup( "Appearance" ); 1110 config.setGroup( "Appearance" );
1111 1111
1112 #if QT_VERSION > 233 1112 #if QT_VERSION > 233
1113 // don't block ourselves ... 1113 // don't block ourselves ...
1114 Opie::force_appearance = 0; 1114 Opie::force_appearance = 0;
1115 1115
1116 static QString appname = Opie::binaryName ( ); 1116 static QString appname = Opie::binaryName ( );
1117 1117
1118 QStringList ex = config. readListEntry ( "NoStyle", ';' ); 1118 QStringList ex = config. readListEntry ( "NoStyle", ';' );
1119 int nostyle = 0; 1119 int nostyle = 0;
1120 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { 1120 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) {
1121 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { 1121 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) {
1122 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); 1122 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 );
1123 break; 1123 break;
1124 } 1124 }
1125 } 1125 }
1126 1126
1127 // Widget style 1127 // Widget style
1128 QString style = config.readEntry( "Style", "FlatStyle" ); 1128 QString style = config.readEntry( "Style", "FlatStyle" );
1129 1129
1130 // don't set a custom style 1130 // don't set a custom style
1131 if ( nostyle & Opie::Force_Style ) 1131 if ( nostyle & Opie::Force_Style )
1132 style = "FlatStyle"; 1132 style = "FlatStyle";
1133 1133
1134 internalSetStyle ( style ); 1134 internalSetStyle ( style );
1135 1135
1136 // Colors - from /etc/colors/Liquid.scheme 1136 // Colors - from /etc/colors/Liquid.scheme
1137 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); 1137 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) );
1138 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); 1138 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) );
1139 QPalette pal( btncolor, bgcolor ); 1139 QPalette pal( btncolor, bgcolor );
1140 QString color = config.readEntry( "Highlight", "#73adef" ); 1140 QString color = config.readEntry( "Highlight", "#73adef" );
1141 pal.setColor( QColorGroup::Highlight, QColor( color ) ); 1141 pal.setColor( QColorGroup::Highlight, QColor( color ) );
1142 color = config.readEntry( "HighlightedText", "#FFFFFF" ); 1142 color = config.readEntry( "HighlightedText", "#FFFFFF" );
1143 pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); 1143 pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
1144 color = config.readEntry( "Text", "#000000" ); 1144 color = config.readEntry( "Text", "#000000" );
1145 pal.setColor( QColorGroup::Text, QColor( color ) ); 1145 pal.setColor( QColorGroup::Text, QColor( color ) );
1146 color = config.readEntry( "ButtonText", "#000000" ); 1146 color = config.readEntry( "ButtonText", "#000000" );
1147 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); 1147 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
1148 color = config.readEntry( "Base", "#FFFFFF" ); 1148 color = config.readEntry( "Base", "#FFFFFF" );
1149 pal.setColor( QColorGroup::Base, QColor( color ) ); 1149 pal.setColor( QColorGroup::Base, QColor( color ) );
1150 1150
1151 pal.setColor( QPalette::Disabled, QColorGroup::Text, 1151 pal.setColor( QPalette::Disabled, QColorGroup::Text,
1152 pal.color( QPalette::Active, QColorGroup::Background ).dark() ); 1152 pal.color( QPalette::Active, QColorGroup::Background ).dark() );
1153 1153
1154 setPalette( pal, TRUE ); 1154 setPalette( pal, TRUE );
1155 1155
1156 // Window Decoration 1156 // Window Decoration
1157 QString dec = config.readEntry( "Decoration", "Flat" ); 1157 QString dec = config.readEntry( "Decoration", "Flat" );
1158 1158
1159 // don't set a custom deco 1159 // don't set a custom deco
1160 if ( nostyle & Opie::Force_Decoration ) 1160 if ( nostyle & Opie::Force_Decoration )
1161 dec = ""; 1161 dec = "";
1162 1162
1163 //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); 1163 //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle);
1164 1164
1165 if ( dec != d->decorationName ) { 1165 if ( dec != d->decorationName ) {
1166 qwsSetDecoration( new QPEDecoration( dec ) ); 1166 qwsSetDecoration( new QPEDecoration( dec ) );
1167 d->decorationName = dec; 1167 d->decorationName = dec;
1168 } 1168 }
1169 1169
1170 // Font 1170 // Font
1171 QString ff = config.readEntry( "FontFamily", font().family() ); 1171 QString ff = config.readEntry( "FontFamily", font().family() );
1172 int fs = config.readNumEntry( "FontSize", font().pointSize() ); 1172 int fs = config.readNumEntry( "FontSize", font().pointSize() );
1173 1173
1174 // don't set a custom font 1174 // don't set a custom font
1175 if ( nostyle & Opie::Force_Font ) { 1175 if ( nostyle & Opie::Force_Font ) {
1176 ff = "Vera"; 1176 ff = "Vera";
1177 fs = 10; 1177 fs = 10;
1178 } 1178 }
1179 1179
1180 setFont ( QFont ( ff, fs ), true ); 1180 setFont ( QFont ( ff, fs ), true );
1181 1181
1182 // revert to global blocking policy ... 1182 // revert to global blocking policy ...
1183 Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; 1183 Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None;
1184 Opie::force_appearance &= ~nostyle; 1184 Opie::force_appearance &= ~nostyle;
1185 #endif 1185 #endif
1186} 1186}
1187 1187
1188void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) 1188void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data )
1189{ 1189{
1190#ifdef Q_WS_QWS 1190#ifdef Q_WS_QWS
1191 QDataStream stream( data, IO_ReadOnly ); 1191 QDataStream stream( data, IO_ReadOnly );
1192 if ( msg == "applyStyle()" ) { 1192 if ( msg == "applyStyle()" ) {
1193 applyStyle(); 1193 applyStyle();
1194 } 1194 }
1195 else if ( msg == "toggleApplicationMenu()" ) { 1195 else if ( msg == "toggleApplicationMenu()" ) {
1196 QWidget *active = activeWindow ( ); 1196 QWidget *active = activeWindow ( );
1197 1197
1198 if ( active ) { 1198 if ( active ) {
1199 QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); 1199 QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( );
1200 bool oldactive = man-> isActive ( ); 1200 bool oldactive = man-> isActive ( );
1201 1201
1202 man-> setActive( !man-> isActive() ); 1202 man-> setActive( !man-> isActive() );
1203 1203
1204 if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu 1204 if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu
1205 QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); 1205 QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" );
1206 } 1206 }
1207 } 1207 }
1208 } 1208 }
1209 else if ( msg == "setDefaultRotation(int)" ) { 1209 else if ( msg == "setDefaultRotation(int)" ) {
1210 if ( type() == GuiServer ) { 1210 if ( type() == GuiServer ) {
1211 int r; 1211 int r;
1212 stream >> r; 1212 stream >> r;
1213 setDefaultRotation( r ); 1213 setDefaultRotation( r );
1214 } 1214 }
1215 } 1215 }
1216 else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> 1216 else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net>
1217 if ( type() == GuiServer ) { 1217 if ( type() == GuiServer ) {
1218 int x, y, depth; 1218 int x, y, depth;
1219 stream >> x; 1219 stream >> x;
1220 stream >> y; 1220 stream >> y;
1221 stream >> depth; 1221 stream >> depth;
1222 setCurrentMode( x, y, depth ); 1222 setCurrentMode( x, y, depth );
1223 } 1223 }
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index 42810e8..69e0058 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -1,209 +1,209 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the 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#ifndef __QPE_APPLICATION_H__ 20#ifndef __QPE_APPLICATION_H__
21#define __QPE_APPLICATION_H__ 21#define __QPE_APPLICATION_H__
22 22
23#include <stdlib.h> // for setenv() 23#include <stdlib.h> // for setenv()
24 24
25#include <qglobal.h> 25#include <qglobal.h>
26#include <qapplication.h> 26#include <qapplication.h>
27#include <qdialog.h> 27#include <qdialog.h>
28#include <qwsdisplay_qws.h> 28#include <qwsdisplay_qws.h>
29#if defined(_WS_QWS_) && !defined(Q_WS_QWS) 29#if defined(_WS_QWS_) && !defined(Q_WS_QWS)
30#define Q_WS_QWS 30#define Q_WS_QWS
31#endif 31#endif
32#include "qpedecoration_qws.h" 32#include "qpedecoration_qws.h"
33#include "timestring.h" 33#include "timestring.h"
34 34
35class QCopChannel; 35class QCopChannel;
36class QPEApplicationData; 36class QPEApplicationData;
37class QWSEvent; 37class QWSEvent;
38class QWSKeyEvent; 38class QWSKeyEvent;
39 39
40 40
41class QPEApplication : public QApplication 41class QPEApplication : public QApplication
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44public: 44public:
45 QPEApplication( int& argc, char **argv, Type=GuiClient ); 45 QPEApplication( int& argc, char **argv, Type=GuiClient );
46 ~QPEApplication(); 46 ~QPEApplication();
47 47
48 static QString qpeDir(); 48 static QString qpeDir();
49 static QString documentDir(); 49 static QString documentDir();
50 void applyStyle(); 50 void applyStyle();
51 void reset(); 51 void reset();
52 static int defaultRotation(); 52 static int defaultRotation();
53 static void setDefaultRotation(int r); 53 static void setDefaultRotation(int r);
54 static void setCurrentRotation(int r); 54 static void setCurrentRotation(int r);
55 static void setCurrentMode(int x, int y, int depth ); 55 static void setCurrentMode(int x, int y, int depth );
56 static void grabKeyboard(); 56 static void grabKeyboard();
57 static void ungrabKeyboard(); 57 static void ungrabKeyboard();
58 58
59 enum StylusMode { 59 enum StylusMode {
60 LeftOnly, 60 LeftOnly,
61 RightOnHold 61 RightOnHold
62 // RightOnHoldLeftDelayed, etc. 62 // RightOnHoldLeftDelayed, etc.
63 }; 63 };
64 static void setStylusOperation( QWidget*, StylusMode ); 64 static void setStylusOperation( QWidget*, StylusMode );
65 static StylusMode stylusOperation( QWidget* ); 65 static StylusMode stylusOperation( QWidget* );
66 66
67 enum InputMethodHint { 67 enum InputMethodHint {
68 Normal, 68 Normal,
69 AlwaysOff, 69 AlwaysOff,
70 AlwaysOn 70 AlwaysOn
71 }; 71 };
72 72
73 enum screenSaverHint { 73 enum screenSaverHint {
74 Disable = 0, 74 Disable = 0,
75 DisableLightOff = 1, 75 DisableLightOff = 1,
76 DisableSuspend = 2, 76 DisableSuspend = 2,
77 Enable = 100 77 Enable = 100
78 }; 78 };
79 79
80 static void setInputMethodHint( QWidget *, InputMethodHint ); 80 static void setInputMethodHint( QWidget *, InputMethodHint );
81 static InputMethodHint inputMethodHint( QWidget * ); 81 static InputMethodHint inputMethodHint( QWidget * );
82 82
83 void showMainWidget( QWidget*, bool nomax=FALSE ); 83 void showMainWidget( QWidget*, bool nomax=FALSE );
84 void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); 84 void showMainDocumentWidget( QWidget*, bool nomax=FALSE );
85 static void showDialog( QDialog*, bool nomax=FALSE ); 85 static void showDialog( QDialog*, bool nomax=FALSE );
86 static int execDialog( QDialog*, bool nomax=FALSE ); 86 static int execDialog( QDialog*, bool nomax=FALSE );
87 /* Merge setTempScreenSaverMode */ 87 /* Merge setTempScreenSaverMode */
88#ifdef QTOPIA_INTERNAL_INITAPP 88#ifdef QTOPIA_INTERNAL_INITAPP
89 void initApp( int argv, char **argv ); 89 void initApp( int argv, char **argv );
90#endif 90#endif
91 91
92 static void setKeepRunning(); 92 static void setKeepRunning();
93 bool keepRunning() const; 93 bool keepRunning() const;
94 94
95 bool keyboardGrabbed() const; 95 bool keyboardGrabbed() const;
96 96
97 int exec(); 97 int exec();
98 98
99signals: 99signals:
100 void clientMoused(); 100 void clientMoused();
101 void timeChanged(); 101 void timeChanged();
102 void clockChanged( bool pm ); 102 void clockChanged( bool pm );
103 void micChanged( bool muted ); 103 void micChanged( bool muted );
104 void volumeChanged( bool muted ); 104 void volumeChanged( bool muted );
105 void appMessage( const QCString& msg, const QByteArray& data); 105 void appMessage( const QCString& msg, const QByteArray& data);
106 void weekChanged( bool startOnMonday ); 106 void weekChanged( bool startOnMonday );
107 void dateFormatChanged( DateFormat ); 107 void dateFormatChanged( DateFormat );
108 void flush(); 108 void flush();
109 void reload(); 109 void reload();
110 /* linkChanged signal */ 110 /* linkChanged signal */
111 111
112private slots: 112private slots:
113 void systemMessage( const QCString &msg, const QByteArray &data ); 113 void systemMessage( const QCString &msg, const QByteArray &data );
114 void pidMessage( const QCString &msg, const QByteArray &data ); 114 void pidMessage( const QCString &msg, const QByteArray &data );
115 void removeSenderFromStylusDict(); 115 void removeSenderFromStylusDict();
116 void hideOrQuit(); 116 void hideOrQuit();
117 117
118private: 118private:
119 inline QWidget *nextWidget( QWidgetList*, QWidget* ); 119 QWidget *nextWidget( QWidgetList*, QWidget* );
120 120
121protected: 121protected:
122 bool qwsEventFilter( QWSEvent * ); 122 bool qwsEventFilter( QWSEvent * );
123 void internalSetStyle( const QString &style ); 123 void internalSetStyle( const QString &style );
124 void prepareForTermination(bool willrestart); 124 void prepareForTermination(bool willrestart);
125 virtual void restart(); 125 virtual void restart();
126 virtual void shutdown(); 126 virtual void shutdown();
127 bool eventFilter( QObject *, QEvent * ); 127 bool eventFilter( QObject *, QEvent * );
128 void timerEvent( QTimerEvent * ); 128 void timerEvent( QTimerEvent * );
129 bool raiseAppropriateWindow(); 129 bool raiseAppropriateWindow();
130 virtual void tryQuit(); 130 virtual void tryQuit();
131#if QT_VERSION > 233 131#if QT_VERSION > 233
132 virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) 132 virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!)
133#endif 133#endif
134private: 134private:
135#ifndef QT_NO_TRANSLATION 135#ifndef QT_NO_TRANSLATION
136 void installTranslation( const QString& baseName ); 136 void installTranslation( const QString& baseName );
137#endif 137#endif
138 void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); 138 void mapToDefaultAction( QWSKeyEvent *ke, int defKey );
139 void processQCopFile(); 139 void processQCopFile();
140 140
141#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 141#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
142 QCopChannel *sysChannel; 142 QCopChannel *sysChannel;
143 QCopChannel *pidChannel; 143 QCopChannel *pidChannel;
144#endif 144#endif
145 QPEApplicationData *d; 145 QPEApplicationData *d;
146 146
147 bool reserved_sh; 147 bool reserved_sh;
148 148
149 149
150 150
151}; 151};
152 152
153inline void QPEApplication::showDialog( QDialog* d, bool nomax ) 153inline void QPEApplication::showDialog( QDialog* d, bool nomax )
154{ 154{
155 QSize sh = d->sizeHint(); 155 QSize sh = d->sizeHint();
156 int w = QMAX(sh.width(),d->width()); 156 int w = QMAX(sh.width(),d->width());
157 int h = QMAX(sh.height(),d->height()); 157 int h = QMAX(sh.height(),d->height());
158 if ( !nomax 158 if ( !nomax
159 && ( w > qApp->desktop()->width()*3/4 159 && ( w > qApp->desktop()->width()*3/4
160 || h > qApp->desktop()->height()*3/4 ) ) 160 || h > qApp->desktop()->height()*3/4 ) )
161 { 161 {
162 d->showMaximized(); 162 d->showMaximized();
163 } else { 163 } else {
164 d->resize(w,h); 164 d->resize(w,h);
165 d->show(); 165 d->show();
166 } 166 }
167} 167}
168 168
169inline int QPEApplication::execDialog( QDialog* d, bool nomax ) 169inline int QPEApplication::execDialog( QDialog* d, bool nomax )
170{ 170{
171 showDialog(d,nomax); 171 showDialog(d,nomax);
172 return d->exec(); 172 return d->exec();
173} 173}
174 174
175enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ 175enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */
176 176
177inline int TransToDeg ( Transformation t ) 177inline int TransToDeg ( Transformation t )
178{ 178{
179 int d = static_cast<int>( t ); 179 int d = static_cast<int>( t );
180 return d * 90; 180 return d * 90;
181} 181}
182 182
183inline Transformation DegToTrans ( int d ) 183inline Transformation DegToTrans ( int d )
184{ 184{
185 Transformation t = static_cast<Transformation>( d / 90 ); 185 Transformation t = static_cast<Transformation>( d / 90 );
186 return t; 186 return t;
187} 187}
188 188
189/* 189/*
190 * Set current rotation of Opie, and rotation for newly started apps. 190 * Set current rotation of Opie, and rotation for newly started apps.
191 * Differs from setDefaultRotation in that 1) it rotates currently running apps, 191 * Differs from setDefaultRotation in that 1) it rotates currently running apps,
192 * and 2) does not set deforient or save orientation to qpe.conf. 192 * and 2) does not set deforient or save orientation to qpe.conf.
193 */ 193 */
194 194
195inline void QPEApplication::setCurrentRotation( int r ) 195inline void QPEApplication::setCurrentRotation( int r )
196{ 196{
197 // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots 197 // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots
198 // for compatibility with the SharpROM use fallback to setDefaultTransformation() 198 // for compatibility with the SharpROM use fallback to setDefaultTransformation()
199#if QT_VERSION > 233 199#if QT_VERSION > 233
200 Transformation e = DegToTrans( r ); 200 Transformation e = DegToTrans( r );
201 ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 201 ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
202 qApp->desktop()->qwsDisplay()->setTransformation( e ); 202 qApp->desktop()->qwsDisplay()->setTransformation( e );
203#else 203#else
204 setDefaultRotation( r ); 204 setDefaultRotation( r );
205#endif 205#endif
206} 206}
207 207
208 208
209#endif 209#endif