summaryrefslogtreecommitdiff
path: root/library
Unidiff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 90cd5f1..ae1632e 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -166,45 +166,49 @@ public:
166 // event loop can come around again before getting 166 // event loop can come around again before getting
167 // back from sendLocally 167 // back from sendLocally
168#ifndef QT_NO_COP 168#ifndef QT_NO_COP
169 QCopChannel::sendLocally( r->channel, r->message, r->data ); 169 QCopChannel::sendLocally( r->channel, r->message, r->data );
170#endif 170#endif
171 171
172 delete r; 172 delete r;
173 } 173 }
174 } 174 }
175 175
176 static void show_mx(QWidget* mw, bool nomaximize, QString &strName/* = QString::null */) 176 static void show_mx(QWidget* mw, bool nomaximize, QString &strName/* = QString::null */)
177 { 177 {
178 if ( mw->isVisible() ) {
179 mw->raise();
180 } else {
181 QPoint p; 178 QPoint p;
182 QSize s; 179 QSize s;
180 bool max;
181 if ( mw->isVisible() ) {
182 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
183 mw->resize(s);
184 mw->move(p);
185 }
186 mw->raise();
187 } else {
183 188
184 if ( mw->layout() && mw->inherits("QDialog") ) { 189 if ( mw->layout() && mw->inherits("QDialog") ) {
185 bool max;
186 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { 190 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
187 mw->resize(s); 191 mw->resize(s);
188 mw->move(p); 192 mw->move(p);
189 193
190 if ( max && !nomaximize ) 194 if ( max && !nomaximize ) {
191 mw->showMaximized(); 195 mw->showMaximized();
192 else 196 } else {
193 mw->show(); 197 mw->show();
198 }
194 } else { 199 } else {
195 qpe_show_dialog((QDialog*)mw,nomaximize); 200 qpe_show_dialog((QDialog*)mw,nomaximize);
196 } 201 }
197 } else { 202 } else {
198 bool max;
199 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { 203 if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
200 mw->resize(s); 204 mw->resize(s);
201 mw->move(p); 205 mw->move(p);
202 } else { //no stored rectangle, make an estimation 206 } else { //no stored rectangle, make an estimation
203 int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2; 207 int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2;
204 int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2; 208 int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2;
205 mw->move( QMAX(x,0), QMAX(y,0) ); 209 mw->move( QMAX(x,0), QMAX(y,0) );
206#ifdef Q_WS_QWS 210#ifdef Q_WS_QWS
207 if ( !nomaximize ) 211 if ( !nomaximize )
208 mw->showMaximized(); 212 mw->showMaximized();
209#endif 213#endif
210 } 214 }
@@ -293,25 +297,25 @@ static void qpe_show_dialog( QDialog* d, bool nomax )
293 d->move(p.x(),0); 297 d->move(p.x(),0);
294 } else { 298 } else {
295 d->resize(w, h); 299 d->resize(w, h);
296 } 300 }
297 301
298 d->show(); 302 d->show();
299 } 303 }
300} 304}
301 305
302 static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) 306 static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s)
303 { 307 {
304 maximized = TRUE; 308 maximized = TRUE;
305 309 qDebug("read_widget_rect");
306 // 350 is the trigger in qwsdefaultdecoration for providing a resize button 310 // 350 is the trigger in qwsdefaultdecoration for providing a resize button
307 if ( qApp->desktop()->width() <= 350 ) 311 if ( qApp->desktop()->width() <= 350 )
308 return FALSE; 312 return FALSE;
309 313
310 Config cfg( "qpe" ); 314 Config cfg( "qpe" );
311 cfg.setGroup("ApplicationPositions"); 315 cfg.setGroup("ApplicationPositions");
312 QString str = cfg.readEntry( app, QString::null ); 316 QString str = cfg.readEntry( app, QString::null );
313 QStringList l = QStringList::split(",", str); 317 QStringList l = QStringList::split(",", str);
314 318
315 if ( l.count() == 5) { 319 if ( l.count() == 5) {
316 p.setX( l[0].toInt() ); 320 p.setX( l[0].toInt() );
317 p.setY( l[1].toInt() ); 321 p.setY( l[1].toInt() );
@@ -365,25 +369,25 @@ static void qpe_show_dialog( QDialog* d, bool nomax )
365 p.setX( maxX - wWidth ); 369 p.setX( maxX - wWidth );
366 if ( p.y() + wHeight > maxY ) 370 if ( p.y() + wHeight > maxY )
367 p.setY( maxY - wHeight ); 371 p.setY( maxY - wHeight );
368 372
369 return TRUE; 373 return TRUE;
370 } 374 }
371 375
372 static void store_widget_rect(QWidget *w, QString &app) 376 static void store_widget_rect(QWidget *w, QString &app)
373 { 377 {
374 // 350 is the trigger in qwsdefaultdecoration for providing a resize button 378 // 350 is the trigger in qwsdefaultdecoration for providing a resize button
375 if ( qApp->desktop()->width() <= 350 ) 379 if ( qApp->desktop()->width() <= 350 )
376 return; 380 return;
377 381 qDebug("store_widget_rect");
378 // we use these to map the offset of geometry and pos. ( we can only use normalGeometry to 382 // we use these to map the offset of geometry and pos. ( we can only use normalGeometry to
379 // get the non-maximized version, so we have to do it the hard way ) 383 // get the non-maximized version, so we have to do it the hard way )
380 int offsetX = w->x() - w->geometry().left(); 384 int offsetX = w->x() - w->geometry().left();
381 int offsetY = w->y() - w->geometry().top(); 385 int offsetY = w->y() - w->geometry().top();
382 386
383 QRect r; 387 QRect r;
384 if ( w->isMaximized() ) 388 if ( w->isMaximized() )
385 r = ( (HackWidget *) w)->normalGeometry(); 389 r = ( (HackWidget *) w)->normalGeometry();
386 else 390 else
387 r = w->geometry(); 391 r = w->geometry();
388 392
389 // Stores the window placement as pos(), size() (due to the offset mapping) 393 // Stores the window placement as pos(), size() (due to the offset mapping)