summaryrefslogtreecommitdiff
path: root/library
Unidiff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 86aa53d..4d0b0ea 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -53,140 +53,145 @@
53 53
54#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 54#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
55#define QTOPIA_INTERNAL_INITAPP 55#define QTOPIA_INTERNAL_INITAPP
56#include "qpeapplication.h" 56#include "qpeapplication.h"
57#include "qpestyle.h" 57#include "qpestyle.h"
58#include "styleinterface.h" 58#include "styleinterface.h"
59#if QT_VERSION >= 300 59#if QT_VERSION >= 300
60#include <qstylefactory.h> 60#include <qstylefactory.h>
61#else 61#else
62#include <qplatinumstyle.h> 62#include <qplatinumstyle.h>
63#include <qwindowsstyle.h> 63#include <qwindowsstyle.h>
64#include <qmotifstyle.h> 64#include <qmotifstyle.h>
65#include <qmotifplusstyle.h> 65#include <qmotifplusstyle.h>
66#include "lightstyle.h" 66#include "lightstyle.h"
67 67
68#include <qpe/qlibrary.h> 68#include <qpe/qlibrary.h>
69#endif 69#endif
70#include "global.h" 70#include "global.h"
71#include "resource.h" 71#include "resource.h"
72#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 72#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
73#include "qutfcodec.h" 73#include "qutfcodec.h"
74#endif 74#endif
75#include "config.h" 75#include "config.h"
76#include "network.h" 76#include "network.h"
77#ifdef QWS 77#ifdef QWS
78#include "fontmanager.h" 78#include "fontmanager.h"
79#endif 79#endif
80 80
81#include "alarmserver.h" 81#include "alarmserver.h"
82#include "applnk.h" 82#include "applnk.h"
83#include "qpemenubar.h" 83#include "qpemenubar.h"
84#include "textcodecinterface.h" 84#include "textcodecinterface.h"
85#include "imagecodecinterface.h" 85#include "imagecodecinterface.h"
86 86
87#include <unistd.h> 87#include <unistd.h>
88#include <sys/file.h> 88#include <sys/file.h>
89#include <sys/ioctl.h> 89#include <sys/ioctl.h>
90#include <sys/soundcard.h> 90#include <sys/soundcard.h>
91 91
92#include "qt_override_p.h" 92#include "qt_override_p.h"
93 93
94 94
95class QPEApplicationData 95class QPEApplicationData
96{ 96{
97public: 97public:
98 QPEApplicationData ( ) 98 QPEApplicationData ( )
99 : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), 99 : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ),
100 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), 100 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ),
101 keep_running( true ), qpe_main_widget( 0 ) 101 keep_running( true ), qpe_main_widget( 0 ), qcopQok( false )
102 102
103 { 103 {
104 qcopq.setAutoDelete( TRUE ); 104 qcopq.setAutoDelete( TRUE );
105 } 105 }
106 106
107 int presstimer; 107 int presstimer;
108 QWidget* presswidget; 108 QWidget* presswidget;
109 QPoint presspos; 109 QPoint presspos;
110 110
111 bool rightpressed : 1; 111 bool rightpressed : 1;
112 bool kbgrabbed : 1; 112 bool kbgrabbed : 1;
113 bool notbusysent : 1; 113 bool notbusysent : 1;
114 bool preloaded : 1; 114 bool preloaded : 1;
115 bool forceshow : 1; 115 bool forceshow : 1;
116 bool nomaximize : 1; 116 bool nomaximize : 1;
117 bool qcopQok : 1;
117 bool keep_running : 1; 118 bool keep_running : 1;
118 119
120
119 QStringList langs; 121 QStringList langs;
120 QString appName; 122 QString appName;
121 struct QCopRec 123 struct QCopRec
122 { 124 {
123 QCopRec( const QCString &ch, const QCString &msg, 125 QCopRec( const QCString &ch, const QCString &msg,
124 const QByteArray &d ) : 126 const QByteArray &d ) :
125 channel( ch ), message( msg ), data( d ) 127 channel( ch ), message( msg ), data( d )
126 { } 128 { }
127 129
128 QCString channel; 130 QCString channel;
129 QCString message; 131 QCString message;
130 QByteArray data; 132 QByteArray data;
131 }; 133 };
132 QWidget* qpe_main_widget; 134 QWidget* qpe_main_widget;
133 QGuardedPtr<QWidget> lastraised; 135 QGuardedPtr<QWidget> lastraised;
134 QList<QCopRec> qcopq; 136 QList<QCopRec> qcopq;
135 QString styleName; 137 QString styleName;
136 QString decorationName; 138 QString decorationName;
137 139
138 void enqueueQCop( const QCString &ch, const QCString &msg, 140 void enqueueQCop( const QCString &ch, const QCString &msg,
139 const QByteArray &data ) 141 const QByteArray &data )
140 { 142 {
141 qcopq.append( new QCopRec( ch, msg, data ) ); 143 qcopq.append( new QCopRec( ch, msg, data ) );
142 } 144 }
143 void sendQCopQ() 145 void sendQCopQ()
144 { 146 {
147 if (!qcopQok )
148 return;
149
145 QCopRec * r; 150 QCopRec * r;
146#ifndef QT_NO_COP 151#ifndef QT_NO_COP
147 152
148 for ( QListIterator<QCopRec> it( qcopq ); ( r = it.current() ); ++it ) 153 for ( QListIterator<QCopRec> it( qcopq ); ( r = it.current() ); ++it )
149 QCopChannel::sendLocally( r->channel, r->message, r->data ); 154 QCopChannel::sendLocally( r->channel, r->message, r->data );
150#endif 155#endif
151 156
152 qcopq.clear(); 157 qcopq.clear();
153 } 158 }
154 static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null ) 159 static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null )
155 { 160 {
156 161
157 // ugly hack, remove that later after finding a sane solution 162 // ugly hack, remove that later after finding a sane solution
158 // Addendum: Only Sharp currently has models with high resolution but (physically) small displays, 163 // Addendum: Only Sharp currently has models with high resolution but (physically) small displays,
159 // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has 164 // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has
160 // a (physically) large enough display to use the small icons 165 // a (physically) large enough display to use the small icons
161#ifndef QT_QWS_SIMPAD 166#ifndef QT_QWS_SIMPAD
162 if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { 167 if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) {
163 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); 168 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true );
164 } 169 }
165#endif 170#endif
166 171
167 if ( mw->layout() && mw->inherits("QDialog") ) { 172 if ( mw->layout() && mw->inherits("QDialog") ) {
168 QPEApplication::showDialog((QDialog*)mw, nomaximize); 173 QPEApplication::showDialog((QDialog*)mw, nomaximize);
169 } 174 }
170 else { 175 else {
171#ifdef Q_WS_QWS 176#ifdef Q_WS_QWS
172 if ( !nomaximize ) 177 if ( !nomaximize )
173 mw->showMaximized(); 178 mw->showMaximized();
174 else 179 else
175#endif 180#endif
176 181
177 mw->show(); 182 mw->show();
178 } 183 }
179 } 184 }
180 static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) 185 static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ )
181 { 186 {
182 /* 187 /*
183 // This works but disable it for now until it is safe to apply 188 // This works but disable it for now until it is safe to apply
184 // What is does is scan the .desktop files of all the apps for 189 // What is does is scan the .desktop files of all the apps for
185 // the applnk that has the corresponding argv[0] as this program 190 // the applnk that has the corresponding argv[0] as this program
186 // then it uses the name stored in the .desktop file as the caption 191 // then it uses the name stored in the .desktop file as the caption
187 // for the main widget. This saves duplicating translations for 192 // for the main widget. This saves duplicating translations for
188 // the app name in the program and in the .desktop files. 193 // the app name in the program and in the .desktop files.
189 194
190 AppLnkSet apps( appsPath ); 195 AppLnkSet apps( appsPath );
191 196
192 QList<AppLnk> appsList = apps.children(); 197 QList<AppLnk> appsList = apps.children();
@@ -1848,96 +1853,97 @@ void QPEApplication::timerEvent( QTimerEvent *e )
1848 } 1853 }
1849} 1854}
1850 1855
1851void QPEApplication::removeSenderFromStylusDict() 1856void QPEApplication::removeSenderFromStylusDict()
1852{ 1857{
1853 stylusDict->remove 1858 stylusDict->remove
1854 ( ( void* ) sender() ); 1859 ( ( void* ) sender() );
1855 if ( d->presswidget == sender() ) 1860 if ( d->presswidget == sender() )
1856 d->presswidget = 0; 1861 d->presswidget = 0;
1857} 1862}
1858 1863
1859/*! 1864/*!
1860 \internal 1865 \internal
1861*/ 1866*/
1862bool QPEApplication::keyboardGrabbed() const 1867bool QPEApplication::keyboardGrabbed() const
1863{ 1868{
1864 return d->kbgrabbed; 1869 return d->kbgrabbed;
1865} 1870}
1866 1871
1867 1872
1868/*! 1873/*!
1869 Reverses the effect of grabKeyboard(). This is called automatically 1874 Reverses the effect of grabKeyboard(). This is called automatically
1870 on program exit. 1875 on program exit.
1871*/ 1876*/
1872void QPEApplication::ungrabKeyboard() 1877void QPEApplication::ungrabKeyboard()
1873{ 1878{
1874 ((QPEApplication *) qApp )-> d-> kbgrabbed = false; 1879 ((QPEApplication *) qApp )-> d-> kbgrabbed = false;
1875} 1880}
1876 1881
1877/*! 1882/*!
1878 Grabs the physical keyboard keys, e.g. the application's launching 1883 Grabs the physical keyboard keys, e.g. the application's launching
1879 keys. Instead of launching applications when these keys are pressed 1884 keys. Instead of launching applications when these keys are pressed
1880 the signals emitted are sent to this application instead. Some games 1885 the signals emitted are sent to this application instead. Some games
1881 programs take over the launch keys in this way to make interaction 1886 programs take over the launch keys in this way to make interaction
1882 easier. 1887 easier.
1883 1888
1884 \sa ungrabKeyboard() 1889 \sa ungrabKeyboard()
1885*/ 1890*/
1886void QPEApplication::grabKeyboard() 1891void QPEApplication::grabKeyboard()
1887{ 1892{
1888 ((QPEApplication *) qApp )-> d-> kbgrabbed = true; 1893 ((QPEApplication *) qApp )-> d-> kbgrabbed = true;
1889} 1894}
1890 1895
1891/*! 1896/*!
1892 \reimp 1897 \reimp
1893*/ 1898*/
1894int QPEApplication::exec() 1899int QPEApplication::exec()
1895{ 1900{
1901 d->qcopQok = true;
1896#ifndef QT_NO_COP 1902#ifndef QT_NO_COP
1897 d->sendQCopQ(); 1903 d->sendQCopQ();
1898#endif 1904#endif
1899 1905
1900 if ( d->keep_running ) 1906 if ( d->keep_running )
1901 //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) 1907 //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() )
1902 return QApplication::exec(); 1908 return QApplication::exec();
1903 1909
1904#ifndef QT_NO_COP 1910#ifndef QT_NO_COP
1905 1911
1906 { 1912 {
1907 QCopEnvelope e( "QPE/System", "closing(QString)" ); 1913 QCopEnvelope e( "QPE/System", "closing(QString)" );
1908 e << d->appName; 1914 e << d->appName;
1909 } 1915 }
1910#endif 1916#endif
1911 processEvents(); 1917 processEvents();
1912 return 0; 1918 return 0;
1913} 1919}
1914 1920
1915/*! 1921/*!
1916 \internal 1922 \internal
1917 External request for application to quit. Quits if possible without 1923 External request for application to quit. Quits if possible without
1918 loosing state. 1924 loosing state.
1919*/ 1925*/
1920void QPEApplication::tryQuit() 1926void QPEApplication::tryQuit()
1921{ 1927{
1922 if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) 1928 if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 )
1923 return ; // Inside modal loop or konsole. Too hard to save state. 1929 return ; // Inside modal loop or konsole. Too hard to save state.
1924#ifndef QT_NO_COP 1930#ifndef QT_NO_COP
1925 1931
1926 { 1932 {
1927 QCopEnvelope e( "QPE/System", "closing(QString)" ); 1933 QCopEnvelope e( "QPE/System", "closing(QString)" );
1928 e << d->appName; 1934 e << d->appName;
1929 } 1935 }
1930#endif 1936#endif
1931 processEvents(); 1937 processEvents();
1932 1938
1933 quit(); 1939 quit();
1934} 1940}
1935 1941
1936/*! 1942/*!
1937 \internal 1943 \internal
1938*/ 1944*/
1939void QPEApplication::installTranslation( const QString& baseName ) { 1945void QPEApplication::installTranslation( const QString& baseName ) {
1940 QTranslator* trans = new QTranslator(this); 1946 QTranslator* trans = new QTranslator(this);
1941 QString tfn = qpeDir() + "/i18n/"+baseName; 1947 QString tfn = qpeDir() + "/i18n/"+baseName;
1942 if ( trans->load( tfn ) ) 1948 if ( trans->load( tfn ) )
1943 installTranslator( trans ); 1949 installTranslator( trans );