summaryrefslogtreecommitdiff
path: root/library
Unidiff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 533d7bd..e92b4dd 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -1126,201 +1126,206 @@ void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
1126void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) 1126void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize )
1127{ 1127{
1128 d->show(mw,nomaximize ); 1128 d->show(mw,nomaximize );
1129} 1129}
1130 1130
1131/*! 1131/*!
1132 Sets widget \a mw as the mainWidget() and shows it. For small windows, 1132 Sets widget \a mw as the mainWidget() and shows it. For small windows,
1133 consider passing TRUE for \a nomaximize rather than the default FALSE. 1133 consider passing TRUE for \a nomaximize rather than the default FALSE.
1134 1134
1135 This calls designates the application as 1135 This calls designates the application as
1136 a \link docwidget.html document-oriented\endlink application. 1136 a \link docwidget.html document-oriented\endlink application.
1137 1137
1138 The \a mw widget \e must have this slot: setDocument(const QString&). 1138 The \a mw widget \e must have this slot: setDocument(const QString&).
1139 1139
1140 \sa showMainWidget() 1140 \sa showMainWidget()
1141*/ 1141*/
1142void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) 1142void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize )
1143{ 1143{
1144 if ( mw && argc() == 2 ) 1144 if ( mw && argc() == 2 )
1145 Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); 1145 Global::setDocument( mw, QString::fromUtf8(argv()[1]) );
1146 1146
1147 d->show(mw, nomaximize ); 1147 d->show(mw, nomaximize );
1148} 1148}
1149 1149
1150 1150
1151/*! 1151/*!
1152 If an application is started via a \link qcop.html QCop\endlink 1152 If an application is started via a \link qcop.html QCop\endlink
1153 message, the application will process the \link qcop.html 1153 message, the application will process the \link qcop.html
1154 QCop\endlink message and then quit. If the application calls this 1154 QCop\endlink message and then quit. If the application calls this
1155 function while processing a \link qcop.html QCop\endlink message, 1155 function while processing a \link qcop.html QCop\endlink message,
1156 after processing its outstanding \link qcop.html QCop\endlink 1156 after processing its outstanding \link qcop.html QCop\endlink
1157 messages the application will start 'properly' and show itself. 1157 messages the application will start 'properly' and show itself.
1158 1158
1159 \sa keepRunning() 1159 \sa keepRunning()
1160*/ 1160*/
1161void QPEApplication::setKeepRunning() 1161void QPEApplication::setKeepRunning()
1162{ 1162{
1163 if ( qApp && qApp->inherits( "QPEApplication" ) ) { 1163 if ( qApp && qApp->inherits( "QPEApplication" ) ) {
1164 QPEApplication * qpeApp = ( QPEApplication* ) qApp; 1164 QPEApplication * qpeApp = ( QPEApplication* ) qApp;
1165 qpeApp->d->keep_running = TRUE; 1165 qpeApp->d->keep_running = TRUE;
1166 } 1166 }
1167} 1167}
1168 1168
1169/*! 1169/*!
1170 Returns TRUE if the application will quit after processing the 1170 Returns TRUE if the application will quit after processing the
1171 current list of qcop messages; otherwise returns FALSE. 1171 current list of qcop messages; otherwise returns FALSE.
1172 1172
1173 \sa setKeepRunning() 1173 \sa setKeepRunning()
1174*/ 1174*/
1175bool QPEApplication::keepRunning() const 1175bool QPEApplication::keepRunning() const
1176{ 1176{
1177 return d->keep_running; 1177 return d->keep_running;
1178} 1178}
1179 1179
1180/*! 1180/*!
1181 \internal 1181 \internal
1182*/ 1182*/
1183void QPEApplication::internalSetStyle( const QString &style ) 1183void QPEApplication::internalSetStyle( const QString &style )
1184{ 1184{
1185#if QT_VERSION >= 300 1185#if QT_VERSION >= 300
1186 if ( style == "QPE" ) { 1186 if ( style == "QPE" ) {
1187 setStyle( new QPEStyle ); 1187 setStyle( new QPEStyle );
1188 } 1188 }
1189 else { 1189 else {
1190 QStyle *s = QStyleFactory::create( style ); 1190 QStyle *s = QStyleFactory::create( style );
1191 if ( s ) 1191 if ( s )
1192 setStyle( s ); 1192 setStyle( s );
1193 } 1193 }
1194#else 1194#else
1195 if ( style == "Windows" ) { 1195 if ( style == "Windows" ) {
1196 setStyle( new QWindowsStyle ); 1196 setStyle( new QWindowsStyle );
1197 } 1197 }
1198 else if ( style == "QPE" ) { 1198 else if ( style == "QPE" ) {
1199 setStyle( new QPEStyle ); 1199 setStyle( new QPEStyle );
1200 } 1200 }
1201 else if ( style == "Light" ) { 1201 else if ( style == "Light" ) {
1202 setStyle( new LightStyle ); 1202 setStyle( new LightStyle );
1203 } 1203 }
1204#ifndef QT_NO_STYLE_PLATINUM 1204#ifndef QT_NO_STYLE_PLATINUM
1205 else if ( style == "Platinum" ) { 1205 else if ( style == "Platinum" ) {
1206 setStyle( new QPlatinumStyle ); 1206 setStyle( new QPlatinumStyle );
1207 } 1207 }
1208#endif 1208#endif
1209#ifndef QT_NO_STYLE_MOTIF 1209#ifndef QT_NO_STYLE_MOTIF
1210 else if ( style == "Motif" ) { 1210 else if ( style == "Motif" ) {
1211 setStyle( new QMotifStyle ); 1211 setStyle( new QMotifStyle );
1212 } 1212 }
1213#endif 1213#endif
1214#ifndef QT_NO_STYLE_MOTIFPLUS 1214#ifndef QT_NO_STYLE_MOTIFPLUS
1215 else if ( style == "MotifPlus" ) { 1215 else if ( style == "MotifPlus" ) {
1216 setStyle( new QMotifPlusStyle ); 1216 setStyle( new QMotifPlusStyle );
1217 } 1217 }
1218#endif 1218#endif
1219 1219
1220 else { 1220 else {
1221 QStyle *sty = 0; 1221 QStyle *sty = 0;
1222 QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/lib" + style. lower ( ) + ".so"; 1222 QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/";
1223
1224 if ( style. find ( ".so" ) > 0 )
1225 path += style;
1226 else
1227 path = path + "lib" + style. lower ( ) + ".so"; // compatibility
1223 1228
1224 static QLibrary *lastlib = 0; 1229 static QLibrary *lastlib = 0;
1225 static StyleInterface *lastiface = 0; 1230 static StyleInterface *lastiface = 0;
1226 1231
1227 QLibrary *lib = new QLibrary ( path ); 1232 QLibrary *lib = new QLibrary ( path );
1228 StyleInterface *iface = 0; 1233 StyleInterface *iface = 0;
1229 1234
1230 if ( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) 1235 if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface )
1231 sty = iface-> create ( ); 1236 sty = iface-> create ( );
1232 1237
1233 if ( sty ) { 1238 if ( sty ) {
1234 setStyle ( sty ); 1239 setStyle ( sty );
1235 1240
1236 if ( lastiface ) 1241 if ( lastiface )
1237 lastiface-> release ( ); 1242 lastiface-> release ( );
1238 lastiface = iface; 1243 lastiface = iface;
1239 1244
1240 if ( lastlib ) { 1245 if ( lastlib ) {
1241 lastlib-> unload ( ); 1246 lastlib-> unload ( );
1242 delete lastlib; 1247 delete lastlib;
1243 } 1248 }
1244 lastlib = lib; 1249 lastlib = lib;
1245 } 1250 }
1246 else { 1251 else {
1247 if ( iface ) 1252 if ( iface )
1248 iface-> release ( ); 1253 iface-> release ( );
1249 delete lib; 1254 delete lib;
1250 1255
1251 setStyle ( new QPEStyle ( )); 1256 setStyle ( new QPEStyle ( ));
1252 } 1257 }
1253 } 1258 }
1254#endif 1259#endif
1255} 1260}
1256 1261
1257/*! 1262/*!
1258 \internal 1263 \internal
1259*/ 1264*/
1260void QPEApplication::prepareForTermination( bool willrestart ) 1265void QPEApplication::prepareForTermination( bool willrestart )
1261{ 1266{
1262 if ( willrestart ) { 1267 if ( willrestart ) {
1263 // Draw a big wait icon, the image can be altered in later revisions 1268 // Draw a big wait icon, the image can be altered in later revisions
1264 // QWidget *d = QApplication::desktop(); 1269 // QWidget *d = QApplication::desktop();
1265 QImage img = Resource::loadImage( "launcher/new_wait" ); 1270 QImage img = Resource::loadImage( "launcher/new_wait" );
1266 QPixmap pix; 1271 QPixmap pix;
1267 pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); 1272 pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) );
1268 QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | 1273 QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize |
1269 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); 1274 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool );
1270 lblWait->setPixmap( pix ); 1275 lblWait->setPixmap( pix );
1271 lblWait->setAlignment( QWidget::AlignCenter ); 1276 lblWait->setAlignment( QWidget::AlignCenter );
1272 lblWait->show(); 1277 lblWait->show();
1273 lblWait->showMaximized(); 1278 lblWait->showMaximized();
1274 } 1279 }
1275#ifndef SINGLE_APP 1280#ifndef SINGLE_APP
1276 { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); 1281 { QCopEnvelope envelope( "QPE/System", "forceQuit()" );
1277 } 1282 }
1278 processEvents(); // ensure the message goes out. 1283 processEvents(); // ensure the message goes out.
1279 sleep( 1 ); // You have 1 second to comply. 1284 sleep( 1 ); // You have 1 second to comply.
1280#endif 1285#endif
1281} 1286}
1282 1287
1283/*! 1288/*!
1284 \internal 1289 \internal
1285*/ 1290*/
1286void QPEApplication::shutdown() 1291void QPEApplication::shutdown()
1287{ 1292{
1288 // Implement in server's QPEApplication subclass 1293 // Implement in server's QPEApplication subclass
1289} 1294}
1290 1295
1291/*! 1296/*!
1292 \internal 1297 \internal
1293*/ 1298*/
1294void QPEApplication::restart() 1299void QPEApplication::restart()
1295{ 1300{
1296 // Implement in server's QPEApplication subclass 1301 // Implement in server's QPEApplication subclass
1297} 1302}
1298 1303
1299static QPtrDict<void>* stylusDict = 0; 1304static QPtrDict<void>* stylusDict = 0;
1300static void createDict() 1305static void createDict()
1301{ 1306{
1302 if ( !stylusDict ) 1307 if ( !stylusDict )
1303 stylusDict = new QPtrDict<void>; 1308 stylusDict = new QPtrDict<void>;
1304} 1309}
1305 1310
1306/*! 1311/*!
1307 Returns the current StylusMode for widget \a w. 1312 Returns the current StylusMode for widget \a w.
1308 1313
1309 \sa setStylusOperation() StylusMode 1314 \sa setStylusOperation() StylusMode
1310*/ 1315*/
1311QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) 1316QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w )
1312{ 1317{
1313 if ( stylusDict ) 1318 if ( stylusDict )
1314 return ( StylusMode ) ( int ) stylusDict->find( w ); 1319 return ( StylusMode ) ( int ) stylusDict->find( w );
1315 return LeftOnly; 1320 return LeftOnly;
1316} 1321}
1317 1322
1318/*! 1323/*!
1319 \enum QPEApplication::StylusMode 1324 \enum QPEApplication::StylusMode
1320 1325
1321 \value LeftOnly the stylus only generates LeftButton 1326 \value LeftOnly the stylus only generates LeftButton
1322 events (the default). 1327 events (the default).
1323 \value RightOnHold the stylus generates RightButton events 1328 \value RightOnHold the stylus generates RightButton events
1324 if the user uses the press-and-hold gesture. 1329 if the user uses the press-and-hold gesture.
1325 1330
1326 \sa setStylusOperation() stylusOperation() 1331 \sa setStylusOperation() stylusOperation()