summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp60
1 files changed, 1 insertions, 59 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index e1edd4c..df313ce 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -227,5 +227,5 @@ public:
227 } 227 }
228 } else { 228 } else {
229 qpe_show_dialog((QDialog*)mw,nomaximize); 229 QPEApplication::showDialog((QDialog*)mw,nomaximize);
230 } 230 }
231 } else { 231 } else {
@@ -250,62 +250,4 @@ public:
250 } 250 }
251 251
252static void qpe_show_dialog( QDialog* d, bool nomax )
253{
254 QSize sh = d->sizeHint();
255 int w = QMAX(sh.width(),d->width());
256 int h = QMAX(sh.height(),d->height());
257
258 if ( d->parentWidget() && !d->parentWidget()->topLevelWidget()->isMaximized() )
259 nomax = TRUE;
260
261#ifndef Q_WS_QWS
262 QSize s(qApp->desktop()->width(), qApp->desktop()->height() );
263#else
264 QSize s(qt_maxWindowRect.width(), qt_maxWindowRect.height() );
265#endif
266
267 int maxX = s.width() - (d->frameGeometry().width() - d->geometry().width());
268 int maxY = s.height() - (d->frameGeometry().height() - d->geometry().height());
269
270 if ( (w >= maxX && h >= maxY) || ( (!nomax) && ( w > s.width()*3/4 || h > s.height()*3/4 ) ) ) {
271 d->showMaximized();
272 } else {
273 // try centering the dialog around its parent
274 QPoint p(0,0);
275 if ( d->parentWidget() ) {
276 QPoint pp = d->parentWidget()->mapToGlobal( QPoint(0,0) );
277 p = QPoint( pp.x() + d->parentWidget()->width()/2,
278 pp.y() + d->parentWidget()->height()/ 2 );
279 } else {
280 p = QPoint( maxX/2, maxY/2 );
281 }
282
283 p = QPoint( p.x() - w/2, p.y() - h/2 );
284// qDebug("p(x,y) is %d %d", p.x(), p.y() );
285
286 if ( w >= maxX ) {
287 if ( p.y() < 0 )
288 p.setY(0);
289 if ( p.y() + h > maxY )
290 p.setY( maxY - h);
291
292 d->resize(maxX, h);
293 d->move(0, p.y() );
294 } else if ( h >= maxY ) {
295 if ( p.x() < 0 )
296 p.setX(0);
297 if ( p.x() + w > maxX )
298 p.setX( maxX - w);
299
300 d->resize(w, maxY);
301 d->move(p.x(),0);
302 } else {
303 d->resize(w, h);
304 }
305
306 d->show();
307 }
308}
309
310 static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) 252 static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s)
311 { 253 {