summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
Unidiff
Diffstat (limited to 'library/qpeapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index df313ce..3efba20 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -27,128 +27,129 @@
27#include <qqueue.h> 27#include <qqueue.h>
28#ifdef Q_WS_QWS 28#ifdef Q_WS_QWS
29#ifndef QT_NO_COP 29#ifndef QT_NO_COP
30#if QT_VERSION <= 231 30#if QT_VERSION <= 231
31#define private public 31#define private public
32#define sendLocally processEvent 32#define sendLocally processEvent
33#include "qcopenvelope_qws.h" 33#include "qcopenvelope_qws.h"
34#undef private 34#undef private
35#else 35#else
36#include "qcopenvelope_qws.h" 36#include "qcopenvelope_qws.h"
37#endif 37#endif
38#endif 38#endif
39#include <qwindowsystem_qws.h> 39#include <qwindowsystem_qws.h>
40#endif 40#endif
41#include <qtextstream.h> 41#include <qtextstream.h>
42#include <qpalette.h> 42#include <qpalette.h>
43#include <qbuffer.h> 43#include <qbuffer.h>
44#include <qptrdict.h> 44#include <qptrdict.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qdir.h> 46#include <qdir.h>
47#include <qlabel.h> 47#include <qlabel.h>
48#include <qdialog.h> 48#include <qdialog.h>
49#include <qdragobject.h> 49#include <qdragobject.h>
50#include <qtextcodec.h> 50#include <qtextcodec.h>
51#include <qevent.h> 51#include <qevent.h>
52#include <qtooltip.h> 52#include <qtooltip.h>
53#include <qsignal.h> 53#include <qsignal.h>
54#include <qmainwindow.h> 54#include <qmainwindow.h>
55#include <qwidgetlist.h> 55#include <qwidgetlist.h>
56#include <qpixmapcache.h> 56#include <qpixmapcache.h>
57 57
58#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 58#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
59#define QTOPIA_INTERNAL_INITAPP 59#define QTOPIA_INTERNAL_INITAPP
60#include "qpeapplication.h" 60#include "qpeapplication.h"
61#include "qpestyle.h" 61#include "qpestyle.h"
62#include "styleinterface.h" 62#include "styleinterface.h"
63#if QT_VERSION >= 300 63#if QT_VERSION >= 300
64#include <qstylefactory.h> 64#include <qstylefactory.h>
65#else 65#else
66#include <qplatinumstyle.h> 66#include <qplatinumstyle.h>
67#include <qwindowsstyle.h> 67#include <qwindowsstyle.h>
68#include <qmotifstyle.h> 68#include <qmotifstyle.h>
69#include <qmotifplusstyle.h> 69#include <qmotifplusstyle.h>
70#include "lightstyle.h" 70#include "lightstyle.h"
71 71
72#include <qpe/qlibrary.h> 72#include <qpe/qlibrary.h>
73#endif 73#endif
74#include "global.h" 74#include "global.h"
75#include "resource.h" 75#include "resource.h"
76#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 76#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
77#include "qutfcodec.h" 77#include "qutfcodec.h"
78#endif 78#endif
79#include "config.h" 79#include "config.h"
80#include "network.h" 80#include "network.h"
81#ifdef QWS 81#ifdef QWS
82#include "fontmanager.h" 82#include "fontmanager.h"
83#include "fontdatabase.h" 83#include "fontdatabase.h"
84#endif 84#endif
85 85
86#include "alarmserver.h" 86#include "alarmserver.h"
87#include "applnk.h" 87#include "applnk.h"
88#include "qpemenubar.h" 88#include "qpemenubar.h"
89#include "textcodecinterface.h" 89#include "textcodecinterface.h"
90#include "imagecodecinterface.h" 90#include "imagecodecinterface.h"
91#include <qtopia/qpeglobal.h>
91 92
92#include <unistd.h> 93#include <unistd.h>
93#include <sys/file.h> 94#include <sys/file.h>
94#include <sys/ioctl.h> 95#include <sys/ioctl.h>
95#ifndef QT_NO_SOUND 96#ifndef QT_NO_SOUND
96#include <sys/soundcard.h> 97#include <sys/soundcard.h>
97#endif 98#endif
98#include "qt_override_p.h" 99#include "qt_override_p.h"
99 100
100#include <backend/rohfeedback.h> 101#include <backend/rohfeedback.h>
101 102
102 103
103static bool useBigPixmaps = 0; 104static bool useBigPixmaps = 0;
104 105
105class HackWidget : public QWidget 106class HackWidget : public QWidget
106{ 107{
107public: 108public:
108 bool needsOk() 109 bool needsOk()
109 { return (getWState() & WState_Reserved1 ); } 110 { return (getWState() & WState_Reserved1 ); }
110 111
111 QRect normalGeometry() 112 QRect normalGeometry()
112 { return topData()->normalGeometry; }; 113 { return topData()->normalGeometry; };
113}; 114};
114 115
115class QPEApplicationData 116class QPEApplicationData
116{ 117{
117public: 118public:
118 QPEApplicationData ( ) : 119 QPEApplicationData ( ) :
119 presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), 120 presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ),
120 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), 121 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ),
121 keep_running( true ), qcopQok( false ), 122 keep_running( true ), qcopQok( false ),
122 fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), 123 fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ),
123 bigIconSize( 32 ), qpe_main_widget( 0 ) 124 bigIconSize( 32 ), qpe_main_widget( 0 )
124 { 125 {
125 Config cfg( "qpe" ); 126 Config cfg( "qpe" );
126 cfg.setGroup( "Appearance" ); 127 cfg.setGroup( "Appearance" );
127 useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); 128 useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false );
128 fontFamily = cfg.readEntry( "FontFamily", "Vera" ); 129 fontFamily = cfg.readEntry( "FontFamily", "Vera" );
129 fontSize = cfg.readNumEntry( "FontSize", 10 ); 130 fontSize = cfg.readNumEntry( "FontSize", 10 );
130 smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); 131 smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 );
131 bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); 132 bigIconSize = cfg.readNumEntry( "BigIconSize", 32 );
132#ifdef OPIE_WITHROHFEEDBACK 133#ifdef OPIE_WITHROHFEEDBACK
133 RoH = 0; 134 RoH = 0;
134#endif 135#endif
135 } 136 }
136 137
137 int presstimer; 138 int presstimer;
138 QWidget* presswidget; 139 QWidget* presswidget;
139 QPoint presspos; 140 QPoint presspos;
140#ifdef OPIE_WITHROHFEEDBACK 141#ifdef OPIE_WITHROHFEEDBACK
141 Opie::Internal::RoHFeedback *RoH; 142 Opie::Internal::RoHFeedback *RoH;
142#endif 143#endif
143 144
144 bool rightpressed : 1; 145 bool rightpressed : 1;
145 bool kbgrabbed : 1; 146 bool kbgrabbed : 1;
146 bool notbusysent : 1; 147 bool notbusysent : 1;
147 bool preloaded : 1; 148 bool preloaded : 1;
148 bool forceshow : 1; 149 bool forceshow : 1;
149 bool nomaximize : 1; 150 bool nomaximize : 1;
150 bool keep_running : 1; 151 bool keep_running : 1;
151 bool qcopQok : 1; 152 bool qcopQok : 1;
152 153
153 QCString fontFamily; 154 QCString fontFamily;
154 int fontSize; 155 int fontSize;
@@ -1233,134 +1234,129 @@ int QPEApplication::defaultRotation()
1233 1234
1234/*! 1235/*!
1235 \internal 1236 \internal
1236*/ 1237*/
1237void QPEApplication::setDefaultRotation( int r ) 1238void QPEApplication::setDefaultRotation( int r )
1238{ 1239{
1239 if ( qApp->type() == GuiServer ) { 1240 if ( qApp->type() == GuiServer ) {
1240 deforient = r; 1241 deforient = r;
1241 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 1242 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
1242 Config config("qpe"); 1243 Config config("qpe");
1243 config.setGroup( "Rotation" ); 1244 config.setGroup( "Rotation" );
1244 config.writeEntry( "Rot", r ); 1245 config.writeEntry( "Rot", r );
1245 } 1246 }
1246 else { 1247 else {
1247#ifndef QT_NO_COP 1248#ifndef QT_NO_COP
1248 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); 1249 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" );
1249 e << r; 1250 e << r;
1250 } 1251 }
1251#endif 1252#endif
1252 1253
1253 } 1254 }
1254} 1255}
1255 1256
1256#include <qgfx_qws.h> 1257#include <qgfx_qws.h>
1257#include <qwindowsystem_qws.h> 1258#include <qwindowsystem_qws.h>
1258 1259
1259#if QT_VERSION > 236 1260#if QT_VERSION > 236
1260extern void qws_clearLoadedFonts(); 1261extern void qws_clearLoadedFonts();
1261#endif 1262#endif
1262 1263
1263void QPEApplication::setCurrentMode( int x, int y, int depth ) 1264void QPEApplication::setCurrentMode( int x, int y, int depth )
1264{ 1265{
1265 // Reset the caches 1266 // Reset the caches
1266#if QT_VERSION > 236 1267#if QT_VERSION > 236
1267 qws_clearLoadedFonts(); 1268 qws_clearLoadedFonts();
1268#endif 1269#endif
1269 QPixmapCache::clear(); 1270 QPixmapCache::clear();
1270 1271
1271 // Change the screen mode 1272 // Change the screen mode
1272 qt_screen->setMode(x, y, depth); 1273 qt_screen->setMode(x, y, depth);
1273 1274
1274 if ( qApp->type() == GuiServer ) { 1275 if ( qApp->type() == GuiServer ) {
1275#if QT_VERSION > 236 1276#if QT_VERSION > 236
1276 // Reconfigure the GuiServer 1277 // Reconfigure the GuiServer
1277 qwsServer->beginDisplayReconfigure(); 1278 qwsServer->beginDisplayReconfigure();
1278 qwsServer->endDisplayReconfigure(); 1279 qwsServer->endDisplayReconfigure();
1279#endif 1280#endif
1280 // Get all the running apps to reset 1281 // Get all the running apps to reset
1281 QCopEnvelope env( "QPE/System", "reset()" ); 1282 QCopEnvelope env( "QPE/System", "reset()" );
1282 } 1283 }
1283} 1284}
1284 1285
1285void QPEApplication::reset() { 1286void QPEApplication::reset() {
1286 // Reconnect to the screen 1287 // Reconnect to the screen
1287 qt_screen->disconnect(); 1288 qt_screen->disconnect();
1288 qt_screen->connect( QString::null ); 1289 qt_screen->connect( QString::null );
1289 1290
1290 // Redraw everything 1291 // Redraw everything
1291 applyStyle(); 1292 applyStyle();
1292} 1293}
1293 1294
1294#if (QT_VERSION < 238) && defined Q_OS_MACX 1295#if (QT_VERSION < 238) && defined Q_OS_MACX
1295bool qt_left_hand_scrollbars = false; 1296bool qt_left_hand_scrollbars = false;
1296#else 1297#else
1297#ifdef Q_OS_MACX 1298extern bool qt_left_hand_scrollbars QPE_WEAK_SYMBOL;
1298#define WEAK_SYMBOL __attribute__((weak_import))
1299#else
1300#define WEAK_SYMBOL __attribute__((weak))
1301#endif
1302extern bool qt_left_hand_scrollbars WEAK_SYMBOL;
1303#endif 1299#endif
1304 1300
1305/*! 1301/*!
1306 \internal 1302 \internal
1307*/ 1303*/
1308void QPEApplication::applyStyle() 1304void QPEApplication::applyStyle()
1309{ 1305{
1310 Config config( "qpe" ); 1306 Config config( "qpe" );
1311 config.setGroup( "Appearance" ); 1307 config.setGroup( "Appearance" );
1312 1308
1313#if QT_VERSION > 233 1309#if QT_VERSION > 233
1314#if !defined(OPIE_NO_OVERRIDE_QT) 1310#if !defined(OPIE_NO_OVERRIDE_QT)
1315 // don't block ourselves ... 1311 // don't block ourselves ...
1316 Opie::force_appearance = 0; 1312 Opie::force_appearance = 0;
1317 1313
1318 static QString appname = Opie::binaryName ( ); 1314 static QString appname = Opie::binaryName ( );
1319 1315
1320 QStringList ex = config. readListEntry ( "NoStyle", ';' ); 1316 QStringList ex = config. readListEntry ( "NoStyle", ';' );
1321 int nostyle = 0; 1317 int nostyle = 0;
1322 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { 1318 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) {
1323 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { 1319 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) {
1324 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); 1320 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 );
1325 break; 1321 break;
1326 } 1322 }
1327 } 1323 }
1328#else 1324#else
1329 int nostyle = 0; 1325 int nostyle = 0;
1330#endif 1326#endif
1331 1327
1332 // Widget style 1328 // Widget style
1333 QString style = config.readEntry( "Style", "FlatStyle" ); 1329 QString style = config.readEntry( "Style", "FlatStyle" );
1334 1330
1335 // don't set a custom style 1331 // don't set a custom style
1336 if ( nostyle & Opie::Force_Style ) 1332 if ( nostyle & Opie::Force_Style )
1337 style = "FlatStyle"; 1333 style = "FlatStyle";
1338 1334
1339 internalSetStyle ( style ); 1335 internalSetStyle ( style );
1340 1336
1341 // Colors - from /etc/colors/Liquid.scheme 1337 // Colors - from /etc/colors/Liquid.scheme
1342 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); 1338 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) );
1343 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); 1339 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) );
1344 QPalette pal( btncolor, bgcolor ); 1340 QPalette pal( btncolor, bgcolor );
1345 QString color = config.readEntry( "Highlight", "#73adef" ); 1341 QString color = config.readEntry( "Highlight", "#73adef" );
1346 pal.setColor( QColorGroup::Highlight, QColor( color ) ); 1342 pal.setColor( QColorGroup::Highlight, QColor( color ) );
1347 color = config.readEntry( "HighlightedText", "#FFFFFF" ); 1343 color = config.readEntry( "HighlightedText", "#FFFFFF" );
1348 pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); 1344 pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
1349 color = config.readEntry( "Text", "#000000" ); 1345 color = config.readEntry( "Text", "#000000" );
1350 pal.setColor( QColorGroup::Text, QColor( color ) ); 1346 pal.setColor( QColorGroup::Text, QColor( color ) );
1351 color = config.readEntry( "ButtonText", "#000000" ); 1347 color = config.readEntry( "ButtonText", "#000000" );
1352 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); 1348 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
1353 color = config.readEntry( "Base", "#FFFFFF" ); 1349 color = config.readEntry( "Base", "#FFFFFF" );
1354 pal.setColor( QColorGroup::Base, QColor( color ) ); 1350 pal.setColor( QColorGroup::Base, QColor( color ) );
1355 1351
1356 pal.setColor( QPalette::Disabled, QColorGroup::Text, 1352 pal.setColor( QPalette::Disabled, QColorGroup::Text,
1357 pal.color( QPalette::Active, QColorGroup::Background ).dark() ); 1353 pal.color( QPalette::Active, QColorGroup::Background ).dark() );
1358 1354
1359 setPalette( pal, TRUE ); 1355 setPalette( pal, TRUE );
1360 1356
1361 1357
1362 // Set the ScrollBar on the 'right' side but only if the weak symbol is present 1358 // Set the ScrollBar on the 'right' side but only if the weak symbol is present
1363 if (&qt_left_hand_scrollbars ) 1359 if (&qt_left_hand_scrollbars )
1364 qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false ); 1360 qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false );
1365 1361
1366 // Window Decoration 1362 // Window Decoration