00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <qtopia/qpeapplication.h>
00033
00034 #ifdef Q_WS_QWS
00035 extern Q_EXPORT QRect qt_maxWindowRect;
00036 #endif
00037
00038 void QPEApplication::showDialog( QDialog* d, bool nomax )
00039 {
00040 showWidget( d, nomax );
00041 }
00042
00043 int QPEApplication::execDialog( QDialog* d, bool nomax )
00044 {
00045 showDialog( d, nomax );
00046 return d->exec();
00047 }
00048
00049 void QPEApplication::showWidget( QWidget* wg, bool nomax ) {
00050 if ( wg->isVisible() ) {
00051 wg->show();
00052 return;
00053 }
00054
00055 #ifdef OPIE_NO_WINDOWED
00056 Q_UNUSED( nomax )
00057 if ( TRUE ) {
00058 #else
00059 if ( !nomax
00060 && ( qApp->desktop()->width() <= 320 ) ){
00061 #endif
00062 wg->showMaximized();
00063 } else {
00064 #ifdef Q_WS_QWS
00065 QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() );
00066 #else
00067 QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() );
00068 #endif
00069
00070 QSize sh = wg->sizeHint();
00071 int w = QMAX( sh.width(), wg->width() );
00072 int h = QMAX( sh.height(), wg->height() );
00073
00074 w = QMIN( w, ( desk.width() - ( wg->frameGeometry().width() - wg->geometry().width() ) - 25 ) );
00075 h = QMIN( h, ( desk.height() - ( wg->frameGeometry().height() - wg->geometry().height() ) - 25 ) );
00076 wg->resize( w, h );
00077 wg->show();
00078 }
00079 }