summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
Unidiff
Diffstat (limited to 'library/qpeapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index f84bc0e..1534b0b 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -61,64 +61,65 @@
61#include <qmotifstyle.h> 61#include <qmotifstyle.h>
62#include <qmotifplusstyle.h> 62#include <qmotifplusstyle.h>
63#include "lightstyle.h" 63#include "lightstyle.h"
64#endif 64#endif
65#include "global.h" 65#include "global.h"
66#include "resource.h" 66#include "resource.h"
67#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 67#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
68#include "qutfcodec.h" 68#include "qutfcodec.h"
69#endif 69#endif
70#include "config.h" 70#include "config.h"
71#include "network.h" 71#include "network.h"
72#include "fontmanager.h" 72#include "fontmanager.h"
73#include "fontdatabase.h" 73#include "fontdatabase.h"
74 74
75#include "power.h" 75#include "power.h"
76#include "alarmserver.h" 76#include "alarmserver.h"
77#include "applnk.h" 77#include "applnk.h"
78#include "qpemenubar.h" 78#include "qpemenubar.h"
79 79
80#include <unistd.h> 80#include <unistd.h>
81#include <sys/file.h> 81#include <sys/file.h>
82#include <sys/ioctl.h> 82#include <sys/ioctl.h>
83#include <sys/soundcard.h> 83#include <sys/soundcard.h>
84 84
85// for setBacklight() 85// for setBacklight()
86#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 86#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
87#include <linux/fb.h> 87#include <linux/fb.h>
88#include <sys/types.h> 88#include <sys/types.h>
89#include <sys/stat.h> 89#include <sys/stat.h>
90#endif 90#endif
91#include <stdlib.h> 91#include <stdlib.h>
92 92
93#include <dlfcn.h> // for Liquid HACK
93 94
94class QPEApplicationData { 95class QPEApplicationData {
95public: 96public:
96 QPEApplicationData() : presstimer(0), presswidget(0), rightpressed(FALSE), 97 QPEApplicationData() : presstimer(0), presswidget(0), rightpressed(FALSE),
97 kbgrabber(0), kbregrab(FALSE), notbusysent(FALSE), preloaded(FALSE), 98 kbgrabber(0), kbregrab(FALSE), notbusysent(FALSE), preloaded(FALSE),
98 forceshow(FALSE), nomaximize(FALSE), qpe_main_widget(0), 99 forceshow(FALSE), nomaximize(FALSE), qpe_main_widget(0),
99 keep_running(TRUE) 100 keep_running(TRUE)
100 { 101 {
101 qcopq.setAutoDelete(TRUE); 102 qcopq.setAutoDelete(TRUE);
102 } 103 }
103 104
104 int presstimer; 105 int presstimer;
105 QWidget* presswidget; 106 QWidget* presswidget;
106 QPoint presspos; 107 QPoint presspos;
107 bool rightpressed; 108 bool rightpressed;
108 int kbgrabber; 109 int kbgrabber;
109 bool kbregrab; 110 bool kbregrab;
110 bool notbusysent; 111 bool notbusysent;
111 QString appName; 112 QString appName;
112 struct QCopRec { 113 struct QCopRec {
113 QCopRec(const QCString &ch, const QCString &msg, 114 QCopRec(const QCString &ch, const QCString &msg,
114 const QByteArray &d) : 115 const QByteArray &d) :
115 channel(ch), message(msg), data(d) { } 116 channel(ch), message(msg), data(d) { }
116 117
117 QCString channel; 118 QCString channel;
118 QCString message; 119 QCString message;
119 QByteArray data; 120 QByteArray data;
120 }; 121 };
121 bool preloaded; 122 bool preloaded;
122 bool forceshow; 123 bool forceshow;
123 bool nomaximize; 124 bool nomaximize;
124 QWidget* qpe_main_widget; 125 QWidget* qpe_main_widget;
@@ -1285,64 +1286,85 @@ bool QPEApplication::keepRunning() const
1285void QPEApplication::internalSetStyle( const QString &style ) 1286void QPEApplication::internalSetStyle( const QString &style )
1286{ 1287{
1287#if QT_VERSION >= 300 1288#if QT_VERSION >= 300
1288 if ( style == "QPE" ) { 1289 if ( style == "QPE" ) {
1289 setStyle( new QPEStyle ); 1290 setStyle( new QPEStyle );
1290 } else { 1291 } else {
1291 QStyle *s = QStyleFactory::create(style); 1292 QStyle *s = QStyleFactory::create(style);
1292 if ( s ) setStyle(s); 1293 if ( s ) setStyle(s);
1293 } 1294 }
1294#else 1295#else
1295 if ( style == "Windows" ) { 1296 if ( style == "Windows" ) {
1296 setStyle( new QWindowsStyle ); 1297 setStyle( new QWindowsStyle );
1297 } else if ( style == "QPE" ) { 1298 } else if ( style == "QPE" ) {
1298 setStyle( new QPEStyle ); 1299 setStyle( new QPEStyle );
1299 } else if ( style == "Light" ) { 1300 } else if ( style == "Light" ) {
1300 setStyle( new LightStyle ); 1301 setStyle( new LightStyle );
1301 } 1302 }
1302#ifndef QT_NO_STYLE_PLATINUM 1303#ifndef QT_NO_STYLE_PLATINUM
1303 else if ( style == "Platinum" ) { 1304 else if ( style == "Platinum" ) {
1304 setStyle( new QPlatinumStyle ); 1305 setStyle( new QPlatinumStyle );
1305 } 1306 }
1306#endif 1307#endif
1307#ifndef QT_NO_STYLE_MOTIF 1308#ifndef QT_NO_STYLE_MOTIF
1308 else if ( style == "Motif" ) { 1309 else if ( style == "Motif" ) {
1309 setStyle( new QMotifStyle ); 1310 setStyle( new QMotifStyle );
1310 } 1311 }
1311#endif 1312#endif
1312#ifndef QT_NO_STYLE_MOTIFPLUS 1313#ifndef QT_NO_STYLE_MOTIFPLUS
1313 else if ( style == "MotifPlus" ) { 1314 else if ( style == "MotifPlus" ) {
1314 setStyle( new QMotifPlusStyle ); 1315 setStyle( new QMotifPlusStyle );
1315 } 1316 }
1316#endif 1317#endif
1318
1319 // HACK for Qt2 only
1320 else if ( style == "Liquid" ) {
1321 static void *lib = 0;
1322 QStyle *sty = 0;
1323
1324
1325 if ( !lib ) {
1326 QString path = QPEApplication::qpeDir() + "/plugins/styles/" + "libliquid.so";
1327 lib = ::dlopen ( path. local8Bit ( ), RTLD_NOW | RTLD_GLOBAL );
1328 }
1329 if ( lib ) {
1330 void *sym = ::dlsym ( lib, "allocate" );
1331
1332 if ( sym )
1333 sty = ((QStyle * (*) ( )) sym ) ( );
1334 }
1335 if ( sty )
1336 setStyle ( sty );
1337 }
1338 // HACK for Qt2 only
1317#endif 1339#endif
1318} 1340}
1319 1341
1320/*! 1342/*!
1321 \internal 1343 \internal
1322*/ 1344*/
1323void QPEApplication::prepareForTermination(bool willrestart) 1345void QPEApplication::prepareForTermination(bool willrestart)
1324{ 1346{
1325 if ( willrestart ) { 1347 if ( willrestart ) {
1326 // Draw a big wait icon, the image can be altered in later revisions 1348 // Draw a big wait icon, the image can be altered in later revisions
1327// QWidget *d = QApplication::desktop(); 1349// QWidget *d = QApplication::desktop();
1328 QImage img = Resource::loadImage( "launcher/new_wait" ); 1350 QImage img = Resource::loadImage( "launcher/new_wait" );
1329 QPixmap pix; 1351 QPixmap pix;
1330 pix.convertFromImage(img.smoothScale(1*img.width(), 1*img.height())); 1352 pix.convertFromImage(img.smoothScale(1*img.width(), 1*img.height()));
1331 QLabel *lblWait = new QLabel(0, "wait hack!", QWidget::WStyle_Customize | 1353 QLabel *lblWait = new QLabel(0, "wait hack!", QWidget::WStyle_Customize |
1332 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); 1354 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool );
1333 lblWait->setPixmap( pix ); 1355 lblWait->setPixmap( pix );
1334 lblWait->setAlignment( QWidget::AlignCenter ); 1356 lblWait->setAlignment( QWidget::AlignCenter );
1335 lblWait->show(); 1357 lblWait->show();
1336 lblWait->showMaximized(); 1358 lblWait->showMaximized();
1337 } 1359 }
1338#ifndef SINGLE_APP 1360#ifndef SINGLE_APP
1339 { QCopEnvelope envelope("QPE/System", "forceQuit()"); } 1361 { QCopEnvelope envelope("QPE/System", "forceQuit()"); }
1340 processEvents(); // ensure the message goes out. 1362 processEvents(); // ensure the message goes out.
1341 sleep(1); // You have 1 second to comply. 1363 sleep(1); // You have 1 second to comply.
1342#endif 1364#endif
1343} 1365}
1344 1366
1345/*! 1367/*!
1346 \internal 1368 \internal
1347*/ 1369*/
1348void QPEApplication::shutdown() 1370void QPEApplication::shutdown()