summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-04-25 11:17:38 (UTC)
committer llornkcor <llornkcor>2004-04-25 11:17:38 (UTC)
commit84466242f91283378aec1b1ecda0bb27eb4f6097 (patch) (unidiff)
tree55fd40bfa6dbfbd3cccdb9de51551d7861603b0c
parentab09b0ec3c7fb83d6438af1e4f9cebedaeab71df (diff)
downloadopie-84466242f91283378aec1b1ecda0bb27eb4f6097.zip
opie-84466242f91283378aec1b1ecda0bb27eb4f6097.tar.gz
opie-84466242f91283378aec1b1ecda0bb27eb4f6097.tar.bz2
remove commented
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index c875ff2..86dbe85 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -856,461 +856,454 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t )
856 a++; 856 a++;
857 d->preloaded = TRUE; 857 d->preloaded = TRUE;
858 argc -= 1; 858 argc -= 1;
859 } 859 }
860 else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { 860 else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) {
861 argv[ a ] = argv[ a + 1 ]; 861 argv[ a ] = argv[ a + 1 ];
862 a++; 862 a++;
863 d->preloaded = TRUE; 863 d->preloaded = TRUE;
864 d->forceshow = TRUE; 864 d->forceshow = TRUE;
865 argc -= 1; 865 argc -= 1;
866 } 866 }
867 } 867 }
868 868
869 /* overide stored arguments */ 869 /* overide stored arguments */
870 setArgs( argc, argv ); 870 setArgs( argc, argv );
871 871
872#endif 872#endif
873#else 873#else
874 initApp( argc, argv ); 874 initApp( argc, argv );
875#endif 875#endif
876 // qwsSetDecoration( new QPEDecoration() ); 876 // qwsSetDecoration( new QPEDecoration() );
877 877
878#ifndef QT_NO_TRANSLATION 878#ifndef QT_NO_TRANSLATION
879 879
880 d->langs = Global::languageList(); 880 d->langs = Global::languageList();
881 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { 881 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) {
882 QString lang = *it; 882 QString lang = *it;
883 883
884 installTranslation( lang + "/libopie.qm"); 884 installTranslation( lang + "/libopie.qm");
885 installTranslation( lang + "/libqpe.qm" ); 885 installTranslation( lang + "/libqpe.qm" );
886 installTranslation( lang + "/" + d->appName + ".qm" ); 886 installTranslation( lang + "/" + d->appName + ".qm" );
887 887
888 888
889 //###language/font hack; should look it up somewhere 889 //###language/font hack; should look it up somewhere
890#ifdef QWS 890#ifdef QWS
891 891
892 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 892 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
893 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 893 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
894 setFont( fn ); 894 setFont( fn );
895 } 895 }
896#endif 896#endif
897 } 897 }
898#endif 898#endif
899 899
900 applyStyle(); 900 applyStyle();
901 901
902 if ( type() == GuiServer ) { 902 if ( type() == GuiServer ) {
903 setVolume(); 903 setVolume();
904 } 904 }
905 905
906 installEventFilter( this ); 906 installEventFilter( this );
907 907
908 QPEMenuToolFocusManager::initialize(); 908 QPEMenuToolFocusManager::initialize();
909 909
910#ifdef QT_NO_QWS_CURSOR 910#ifdef QT_NO_QWS_CURSOR
911 // if we have no cursor, probably don't want tooltips 911 // if we have no cursor, probably don't want tooltips
912 QToolTip::setEnabled( FALSE ); 912 QToolTip::setEnabled( FALSE );
913#endif 913#endif
914} 914}
915 915
916 916
917#ifdef QTOPIA_INTERNAL_INITAPP 917#ifdef QTOPIA_INTERNAL_INITAPP
918void QPEApplication::initApp( int argc, char **argv ) 918void QPEApplication::initApp( int argc, char **argv )
919{ 919{
920 delete pidChannel; 920 delete pidChannel;
921 d->keep_running = TRUE; 921 d->keep_running = TRUE;
922 d->preloaded = FALSE; 922 d->preloaded = FALSE;
923 d->forceshow = FALSE; 923 d->forceshow = FALSE;
924 924
925 QCString channel = QCString(argv[0]); 925 QCString channel = QCString(argv[0]);
926 926
927 channel.replace(QRegExp(".*/"),""); 927 channel.replace(QRegExp(".*/"),"");
928 d->appName = channel; 928 d->appName = channel;
929 929
930 #if QT_VERSION > 235 930 #if QT_VERSION > 235
931 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 931 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6
932 #endif 932 #endif
933 933
934 channel = "QPE/Application/" + channel; 934 channel = "QPE/Application/" + channel;
935 pidChannel = new QCopChannel( channel, this); 935 pidChannel = new QCopChannel( channel, this);
936 connect( pidChannel, SIGNAL(received(const QCString&,const QByteArray&)), 936 connect( pidChannel, SIGNAL(received(const QCString&,const QByteArray&)),
937 this, SLOT(pidMessage(const QCString&,const QByteArray&))); 937 this, SLOT(pidMessage(const QCString&,const QByteArray&)));
938 938
939 939
940 940
941 processQCopFile(); 941 processQCopFile();
942 d->keep_running = d->qcopq.isEmpty(); 942 d->keep_running = d->qcopq.isEmpty();
943 943
944 for (int a=0; a<argc; a++) { 944 for (int a=0; a<argc; a++) {
945 if ( qstrcmp(argv[a],"-preload")==0 ) { 945 if ( qstrcmp(argv[a],"-preload")==0 ) {
946 argv[a] = argv[a+1]; 946 argv[a] = argv[a+1];
947 a++; 947 a++;
948 d->preloaded = TRUE; 948 d->preloaded = TRUE;
949 argc-=1; 949 argc-=1;
950 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { 950 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) {
951 argv[a] = argv[a+1]; 951 argv[a] = argv[a+1];
952 a++; 952 a++;
953 d->preloaded = TRUE; 953 d->preloaded = TRUE;
954 d->forceshow = TRUE; 954 d->forceshow = TRUE;
955 argc-=1; 955 argc-=1;
956 } 956 }
957 } 957 }
958 958
959 /* overide stored arguments */ 959 /* overide stored arguments */
960 setArgs(argc, argv); 960 setArgs(argc, argv);
961 961
962 /* install translation here */ 962 /* install translation here */
963 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) 963 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it )
964 installTranslation( (*it) + "/" + d->appName + ".qm" ); 964 installTranslation( (*it) + "/" + d->appName + ".qm" );
965} 965}
966#endif 966#endif
967 967
968 968
969static QPtrDict<void>* inputMethodDict = 0; 969static QPtrDict<void>* inputMethodDict = 0;
970static void createInputMethodDict() 970static void createInputMethodDict()
971{ 971{
972 if ( !inputMethodDict ) 972 if ( !inputMethodDict )
973 inputMethodDict = new QPtrDict<void>; 973 inputMethodDict = new QPtrDict<void>;
974} 974}
975 975
976/*! 976/*!
977 Returns the currently set hint to the system as to whether 977 Returns the currently set hint to the system as to whether
978 widget \a w has any use for text input methods. 978 widget \a w has any use for text input methods.
979 979
980 980
981 \sa setInputMethodHint() InputMethodHint 981 \sa setInputMethodHint() InputMethodHint
982*/ 982*/
983QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) 983QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w )
984{ 984{
985 if ( inputMethodDict && w ) 985 if ( inputMethodDict && w )
986 return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); 986 return ( InputMethodHint ) ( int ) inputMethodDict->find( w );
987 return Normal; 987 return Normal;
988} 988}
989 989
990/*! 990/*!
991 \enum QPEApplication::InputMethodHint 991 \enum QPEApplication::InputMethodHint
992 992
993 \value Normal the application sometimes needs text input (the default). 993 \value Normal the application sometimes needs text input (the default).
994 \value AlwaysOff the application never needs text input. 994 \value AlwaysOff the application never needs text input.
995 \value AlwaysOn the application always needs text input. 995 \value AlwaysOn the application always needs text input.
996*/ 996*/
997 997
998/*! 998/*!
999 Hints to the system that widget \a w has use for text input methods 999 Hints to the system that widget \a w has use for text input methods
1000 as specified by \a mode. 1000 as specified by \a mode.
1001 1001
1002 \sa inputMethodHint() InputMethodHint 1002 \sa inputMethodHint() InputMethodHint
1003*/ 1003*/
1004void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) 1004void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode )
1005{ 1005{
1006 createInputMethodDict(); 1006 createInputMethodDict();
1007 if ( mode == Normal ) { 1007 if ( mode == Normal ) {
1008 inputMethodDict->remove 1008 inputMethodDict->remove
1009 ( w ); 1009 ( w );
1010 } 1010 }
1011 else { 1011 else {
1012 inputMethodDict->insert( w, ( void* ) mode ); 1012 inputMethodDict->insert( w, ( void* ) mode );
1013 } 1013 }
1014} 1014}
1015 1015
1016class HackDialog : public QDialog 1016class HackDialog : public QDialog
1017{ 1017{
1018public: 1018public:
1019 void acceptIt() 1019 void acceptIt()
1020 { 1020 {
1021 accept(); 1021 accept();
1022 } 1022 }
1023 void rejectIt() 1023 void rejectIt()
1024 { 1024 {
1025 reject(); 1025 reject();
1026 } 1026 }
1027}; 1027};
1028 1028
1029 1029
1030void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) 1030void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key )
1031{ 1031{
1032 // specialised actions for certain widgets. May want to 1032 // specialised actions for certain widgets. May want to
1033 // add more stuff here. 1033 // add more stuff here.
1034 if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) 1034 if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" )
1035 && activePopupWidget() ->parentWidget() 1035 && activePopupWidget() ->parentWidget()
1036 && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) 1036 && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) )
1037 key = Qt::Key_Return; 1037 key = Qt::Key_Return;
1038 1038
1039 if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) 1039 if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) )
1040 key = Qt::Key_Return; 1040 key = Qt::Key_Return;
1041 1041
1042#ifdef QWS 1042#ifdef QWS
1043 1043
1044 ke->simpleData.keycode = key; 1044 ke->simpleData.keycode = key;
1045#endif 1045#endif
1046} 1046}
1047 1047
1048// class HackWidget : public QWidget
1049// {
1050// public:
1051 // bool needsOk()
1052 // {
1053 // return ( getWState() & WState_Reserved1 );
1054 // }
1055// };
1056 1048
1057/*! 1049/*!
1058 \internal 1050 \internal
1059*/ 1051*/
1060 1052
1061#ifdef QWS 1053#ifdef QWS
1062bool QPEApplication::qwsEventFilter( QWSEvent * e ) 1054bool QPEApplication::qwsEventFilter( QWSEvent * e )
1063{ 1055{
1064 if ( !d->notbusysent && e->type == QWSEvent::Focus ) { 1056 if ( !d->notbusysent && e->type == QWSEvent::Focus ) {
1065 if ( qApp->type() != QApplication::GuiServer ) { 1057 if ( qApp->type() != QApplication::GuiServer ) {
1066 QCopEnvelope e( "QPE/System", "notBusy(QString)" ); 1058 QCopEnvelope e( "QPE/System", "notBusy(QString)" );
1067 e << d->appName; 1059 e << d->appName;
1068 } 1060 }
1069 d->notbusysent = TRUE; 1061 d->notbusysent = TRUE;
1070 } 1062 }
1071 if ( type() == GuiServer ) { 1063 if ( type() == GuiServer ) {
1072 switch ( e->type ) { 1064 switch ( e->type ) {
1073 case QWSEvent::Mouse: 1065 case QWSEvent::Mouse:
1074 if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) 1066 if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) )
1075 emit clientMoused(); 1067 emit clientMoused();
1076 break; 1068 break;
1077 default: 1069 default:
1078 break; 1070 break;
1079 } 1071 }
1080 } 1072 }
1081 if ( e->type == QWSEvent::Key ) { 1073 if ( e->type == QWSEvent::Key ) {
1082 QWSKeyEvent *ke = ( QWSKeyEvent * ) e; 1074 QWSKeyEvent *ke = ( QWSKeyEvent * ) e;
1083 if ( ke->simpleData.keycode == Qt::Key_F33 ) { 1075 if ( ke->simpleData.keycode == Qt::Key_F33 ) {
1084 // Use special "OK" key to press "OK" on top level widgets 1076 // Use special "OK" key to press "OK" on top level widgets
1085 QWidget * active = activeWindow(); 1077 QWidget * active = activeWindow();
1086 QWidget *popup = 0; 1078 QWidget *popup = 0;
1087 if ( active && active->isPopup() ) { 1079 if ( active && active->isPopup() ) {
1088 popup = active; 1080 popup = active;
1089 active = active->parentWidget(); 1081 active = active->parentWidget();
1090 } 1082 }
1091 if ( active && ( int ) active->winId() == ke->simpleData.window && 1083 if ( active && ( int ) active->winId() == ke->simpleData.window &&
1092 !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { 1084 !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) {
1093 if ( ke->simpleData.is_press ) { 1085 if ( ke->simpleData.is_press ) {
1094 if ( popup ) 1086 if ( popup )
1095 popup->close(); 1087 popup->close();
1096 if ( active->inherits( "QDialog" ) ) { 1088 if ( active->inherits( "QDialog" ) ) {
1097 HackDialog * d = ( HackDialog * ) active; 1089 HackDialog * d = ( HackDialog * ) active;
1098 d->acceptIt(); 1090 d->acceptIt();
1099 return TRUE; 1091 return TRUE;
1100 } 1092 }
1101 else if ( ( ( HackWidget * ) active ) ->needsOk() ) { 1093 else if ( ( ( HackWidget * ) active ) ->needsOk() ) {
1102 QSignal s; 1094 QSignal s;
1103 s.connect( active, SLOT( accept() ) ); 1095 s.connect( active, SLOT( accept() ) );
1104 s.activate(); 1096 s.activate();
1105 } 1097 }
1106 else { 1098 else {
1107 // do the same as with the select key: Map to the default action of the widget: 1099 // do the same as with the select key: Map to the default action of the widget:
1108 mapToDefaultAction( ke, Qt::Key_Return ); 1100 mapToDefaultAction( ke, Qt::Key_Return );
1109 } 1101 }
1110 } 1102 }
1111 } 1103 }
1112 } 1104 }
1113 else if ( ke->simpleData.keycode == Qt::Key_F30 ) { 1105 else if ( ke->simpleData.keycode == Qt::Key_F30 ) {
1114 // Use special "select" key to do whatever default action a widget has 1106 // Use special "select" key to do whatever default action a widget has
1115 mapToDefaultAction( ke, Qt::Key_Space ); 1107 mapToDefaultAction( ke, Qt::Key_Space );
1116 } 1108 }
1117 else if ( ke->simpleData.keycode == Qt::Key_Escape && 1109 else if ( ke->simpleData.keycode == Qt::Key_Escape &&
1118 ke->simpleData.is_press ) { 1110 ke->simpleData.is_press ) {
1119 // Escape key closes app if focus on toplevel 1111 // Escape key closes app if focus on toplevel
1120 QWidget * active = activeWindow(); 1112 QWidget * active = activeWindow();
1121 if ( active && active->testWFlags( WType_TopLevel ) && 1113 if ( active && active->testWFlags( WType_TopLevel ) &&
1122 ( int ) active->winId() == ke->simpleData.window && 1114 ( int ) active->winId() == ke->simpleData.window &&
1123 !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { 1115 !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) {
1124 if ( active->inherits( "QDialog" ) ) { 1116 if ( active->inherits( "QDialog" ) ) {
1117 qDebug("dialog hack");
1125 HackDialog * d = ( HackDialog * ) active; 1118 HackDialog * d = ( HackDialog * ) active;
1126 d->rejectIt(); 1119 d->rejectIt();
1127 return TRUE; 1120 return TRUE;
1128 } 1121 }
1129 } 1122 }
1130 } 1123 }
1131 else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { 1124 else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) {
1132 // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) 1125 // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... ))
1133 // but we cannot access libopie function within libqpe :( 1126 // but we cannot access libopie function within libqpe :(
1134 1127
1135 QWidget * active = activeWindow ( ); 1128 QWidget * active = activeWindow ( );
1136 if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { 1129 if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) {
1137 if ( d-> kbgrabbed ) { // we grabbed the keyboard 1130 if ( d-> kbgrabbed ) { // we grabbed the keyboard
1138 QChar ch ( ke-> simpleData.unicode ); 1131 QChar ch ( ke-> simpleData.unicode );
1139 QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, 1132 QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease,
1140 ke-> simpleData.keycode, 1133 ke-> simpleData.keycode,
1141 ch. latin1 ( ), 1134 ch. latin1 ( ),
1142 ke-> simpleData.modifiers, 1135 ke-> simpleData.modifiers,
1143 QString ( ch ), 1136 QString ( ch ),
1144 ke-> simpleData.is_auto_repeat, 1 ); 1137 ke-> simpleData.is_auto_repeat, 1 );
1145 1138
1146 QObject *which = QWidget::keyboardGrabber ( ); 1139 QObject *which = QWidget::keyboardGrabber ( );
1147 if ( !which ) 1140 if ( !which )
1148 which = QApplication::focusWidget ( ); 1141 which = QApplication::focusWidget ( );
1149 if ( !which ) 1142 if ( !which )
1150 which = QApplication::activeWindow ( ); 1143 which = QApplication::activeWindow ( );
1151 if ( !which ) 1144 if ( !which )
1152 which = qApp; 1145 which = qApp;
1153 1146
1154 QApplication::sendEvent ( which, &qke ); 1147 QApplication::sendEvent ( which, &qke );
1155 } 1148 }
1156 else { // we didn't grab the keyboard, so send the event to the launcher 1149 else { // we didn't grab the keyboard, so send the event to the launcher
1157 QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); 1150 QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" );
1158 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); 1151 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat );
1159 } 1152 }
1160 } 1153 }
1161 return true; 1154 return true;
1162 } 1155 }
1163 } 1156 }
1164 if ( e->type == QWSEvent::Focus ) { 1157 if ( e->type == QWSEvent::Focus ) {
1165 QWSFocusEvent * fe = ( QWSFocusEvent* ) e; 1158 QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
1166 if ( !fe->simpleData.get_focus ) { 1159 if ( !fe->simpleData.get_focus ) {
1167 QWidget * active = activeWindow(); 1160 QWidget * active = activeWindow();
1168 while ( active && active->isPopup() ) { 1161 while ( active && active->isPopup() ) {
1169 active->close(); 1162 active->close();
1170 active = activeWindow(); 1163 active = activeWindow();
1171 } 1164 }
1172 } 1165 }
1173 else { 1166 else {
1174 // make sure our modal widget is ALWAYS on top 1167 // make sure our modal widget is ALWAYS on top
1175 QWidget *topm = activeModalWidget(); 1168 QWidget *topm = activeModalWidget();
1176 if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) { 1169 if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) {
1177 topm->raise(); 1170 topm->raise();
1178 } 1171 }
1179 } 1172 }
1180 if ( fe->simpleData.get_focus && inputMethodDict ) { 1173 if ( fe->simpleData.get_focus && inputMethodDict ) {
1181 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); 1174 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) );
1182 if ( m == AlwaysOff ) 1175 if ( m == AlwaysOff )
1183 Global::hideInputMethod(); 1176 Global::hideInputMethod();
1184 if ( m == AlwaysOn ) 1177 if ( m == AlwaysOn )
1185 Global::showInputMethod(); 1178 Global::showInputMethod();
1186 } 1179 }
1187 } 1180 }
1188 1181
1189 1182
1190 return QApplication::qwsEventFilter( e ); 1183 return QApplication::qwsEventFilter( e );
1191} 1184}
1192#endif 1185#endif
1193 1186
1194/*! 1187/*!
1195 Destroys the QPEApplication. 1188 Destroys the QPEApplication.
1196*/ 1189*/
1197QPEApplication::~QPEApplication() 1190QPEApplication::~QPEApplication()
1198{ 1191{
1199 ungrabKeyboard(); 1192 ungrabKeyboard();
1200#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 1193#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
1201 // Need to delete QCopChannels early, since the display will 1194 // Need to delete QCopChannels early, since the display will
1202 // be gone by the time we get to ~QObject(). 1195 // be gone by the time we get to ~QObject().
1203 delete sysChannel; 1196 delete sysChannel;
1204 delete pidChannel; 1197 delete pidChannel;
1205#endif 1198#endif
1206 1199
1207 delete d; 1200 delete d;
1208} 1201}
1209 1202
1210/*! 1203/*!
1211 Returns <tt>$OPIEDIR/</tt>. 1204 Returns <tt>$OPIEDIR/</tt>.
1212*/ 1205*/
1213QString QPEApplication::qpeDir() 1206QString QPEApplication::qpeDir()
1214{ 1207{
1215 const char * base = getenv( "OPIEDIR" ); 1208 const char * base = getenv( "OPIEDIR" );
1216 if ( base ) 1209 if ( base )
1217 return QString( base ) + "/"; 1210 return QString( base ) + "/";
1218 1211
1219 return QString( "../" ); 1212 return QString( "../" );
1220} 1213}
1221 1214
1222/*! 1215/*!
1223 Returns the user's current Document directory. There is a trailing "/". 1216 Returns the user's current Document directory. There is a trailing "/".
1224 .. well, it does now,, and there's no trailing '/' 1217 .. well, it does now,, and there's no trailing '/'
1225*/ 1218*/
1226QString QPEApplication::documentDir() 1219QString QPEApplication::documentDir()
1227{ 1220{
1228 const char* base = getenv( "HOME"); 1221 const char* base = getenv( "HOME");
1229 if ( base ) 1222 if ( base )
1230 return QString( base ) + "/Documents"; 1223 return QString( base ) + "/Documents";
1231 1224
1232 return QString( "../Documents" ); 1225 return QString( "../Documents" );
1233} 1226}
1234 1227
1235static int deforient = -1; 1228static int deforient = -1;
1236 1229
1237/*! 1230/*!
1238 \internal 1231 \internal
1239*/ 1232*/
1240int QPEApplication::defaultRotation() 1233int QPEApplication::defaultRotation()
1241{ 1234{
1242 if ( deforient < 0 ) { 1235 if ( deforient < 0 ) {
1243 QString d = getenv( "QWS_DISPLAY" ); 1236 QString d = getenv( "QWS_DISPLAY" );
1244 if ( d.contains( "Rot90" ) ) { 1237 if ( d.contains( "Rot90" ) ) {
1245 deforient = 90; 1238 deforient = 90;
1246 } 1239 }
1247 else if ( d.contains( "Rot180" ) ) { 1240 else if ( d.contains( "Rot180" ) ) {
1248 deforient = 180; 1241 deforient = 180;
1249 } 1242 }
1250 else if ( d.contains( "Rot270" ) ) { 1243 else if ( d.contains( "Rot270" ) ) {
1251 deforient = 270; 1244 deforient = 270;
1252 } 1245 }
1253 else { 1246 else {
1254 deforient = 0; 1247 deforient = 0;
1255 } 1248 }
1256 } 1249 }
1257 return deforient; 1250 return deforient;
1258} 1251}
1259 1252
1260/*! 1253/*!
1261 \internal 1254 \internal
1262*/ 1255*/
1263void QPEApplication::setDefaultRotation( int r ) 1256void QPEApplication::setDefaultRotation( int r )
1264{ 1257{
1265 if ( qApp->type() == GuiServer ) { 1258 if ( qApp->type() == GuiServer ) {
1266 deforient = r; 1259 deforient = r;
1267 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 1260 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
1268 Config config("qpe"); 1261 Config config("qpe");
1269 config.setGroup( "Rotation" ); 1262 config.setGroup( "Rotation" );
1270 config.writeEntry( "Rot", r ); 1263 config.writeEntry( "Rot", r );
1271 } 1264 }
1272 else { 1265 else {
1273#ifndef QT_NO_COP 1266#ifndef QT_NO_COP
1274 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); 1267 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" );
1275 e << r; 1268 e << r;
1276 } 1269 }
1277#endif 1270#endif
1278 1271
1279 } 1272 }
1280} 1273}
1281 1274
1282#include <qgfx_qws.h> 1275#include <qgfx_qws.h>
1283#include <qwindowsystem_qws.h> 1276#include <qwindowsystem_qws.h>
1284 1277
1285extern void qws_clearLoadedFonts(); 1278extern void qws_clearLoadedFonts();
1286 1279
1287void QPEApplication::setCurrentMode( int x, int y, int depth ) 1280void QPEApplication::setCurrentMode( int x, int y, int depth )
1288{ 1281{
1289 // Reset the caches 1282 // Reset the caches
1290 qws_clearLoadedFonts(); 1283 qws_clearLoadedFonts();
1291 QPixmapCache::clear(); 1284 QPixmapCache::clear();
1292 1285
1293 // Change the screen mode 1286 // Change the screen mode
1294 qt_screen->setMode(x, y, depth); 1287 qt_screen->setMode(x, y, depth);
1295 1288
1296 if ( qApp->type() == GuiServer ) { 1289 if ( qApp->type() == GuiServer ) {
1297 // Reconfigure the GuiServer 1290 // Reconfigure the GuiServer
1298 qwsServer->beginDisplayReconfigure(); 1291 qwsServer->beginDisplayReconfigure();
1299 qwsServer->endDisplayReconfigure(); 1292 qwsServer->endDisplayReconfigure();
1300 1293
1301 // Get all the running apps to reset 1294 // Get all the running apps to reset
1302 QCopEnvelope env( "QPE/System", "reset()" ); 1295 QCopEnvelope env( "QPE/System", "reset()" );
1303 } 1296 }
1304} 1297}
1305 1298
1306void QPEApplication::reset() { 1299void QPEApplication::reset() {
1307 // Reconnect to the screen 1300 // Reconnect to the screen
1308 qt_screen->disconnect(); 1301 qt_screen->disconnect();
1309 qt_screen->connect( QString::null ); 1302 qt_screen->connect( QString::null );
1310 1303
1311 // Redraw everything 1304 // Redraw everything
1312 applyStyle(); 1305 applyStyle();
1313} 1306}
1314 1307
1315/*! 1308/*!
1316 \internal 1309 \internal