-rw-r--r-- | library/qpeapplication.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index ae1632e..5ce3011 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -277,65 +277,64 @@ static void qpe_show_dialog( QDialog* d, bool nomax ) | |||
277 | } | 277 | } |
278 | 278 | ||
279 | p = QPoint( p.x() - w/2, p.y() - h/2 ); | 279 | p = QPoint( p.x() - w/2, p.y() - h/2 ); |
280 | //qDebug("p(x,y) is %d %d", p.x(), p.y() ); | 280 | //qDebug("p(x,y) is %d %d", p.x(), p.y() ); |
281 | 281 | ||
282 | if ( w >= maxX ) { | 282 | if ( w >= maxX ) { |
283 | if ( p.y() < 0 ) | 283 | if ( p.y() < 0 ) |
284 | p.setY(0); | 284 | p.setY(0); |
285 | if ( p.y() + h > maxY ) | 285 | if ( p.y() + h > maxY ) |
286 | p.setY( maxY - h); | 286 | p.setY( maxY - h); |
287 | 287 | ||
288 | d->resize(maxX, h); | 288 | d->resize(maxX, h); |
289 | d->move(0, p.y() ); | 289 | d->move(0, p.y() ); |
290 | } else if ( h >= maxY ) { | 290 | } else if ( h >= maxY ) { |
291 | if ( p.x() < 0 ) | 291 | if ( p.x() < 0 ) |
292 | p.setX(0); | 292 | p.setX(0); |
293 | if ( p.x() + w > maxX ) | 293 | if ( p.x() + w > maxX ) |
294 | p.setX( maxX - w); | 294 | p.setX( maxX - w); |
295 | 295 | ||
296 | d->resize(w, maxY); | 296 | d->resize(w, maxY); |
297 | d->move(p.x(),0); | 297 | d->move(p.x(),0); |
298 | } else { | 298 | } else { |
299 | d->resize(w, h); | 299 | d->resize(w, h); |
300 | } | 300 | } |
301 | 301 | ||
302 | d->show(); | 302 | d->show(); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | 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) |
307 | { | 307 | { |
308 | maximized = TRUE; | 308 | maximized = TRUE; |
309 | qDebug("read_widget_rect"); | ||
310 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button | 309 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button |
311 | if ( qApp->desktop()->width() <= 350 ) | 310 | if ( qApp->desktop()->width() <= 350 ) |
312 | return FALSE; | 311 | return FALSE; |
313 | 312 | ||
314 | Config cfg( "qpe" ); | 313 | Config cfg( "qpe" ); |
315 | cfg.setGroup("ApplicationPositions"); | 314 | cfg.setGroup("ApplicationPositions"); |
316 | QString str = cfg.readEntry( app, QString::null ); | 315 | QString str = cfg.readEntry( app, QString::null ); |
317 | QStringList l = QStringList::split(",", str); | 316 | QStringList l = QStringList::split(",", str); |
318 | 317 | ||
319 | if ( l.count() == 5) { | 318 | if ( l.count() == 5) { |
320 | p.setX( l[0].toInt() ); | 319 | p.setX( l[0].toInt() ); |
321 | p.setY( l[1].toInt() ); | 320 | p.setY( l[1].toInt() ); |
322 | 321 | ||
323 | s.setWidth( l[2].toInt() ); | 322 | s.setWidth( l[2].toInt() ); |
324 | s.setHeight( l[3].toInt() ); | 323 | s.setHeight( l[3].toInt() ); |
325 | 324 | ||
326 | maximized = l[4].toInt(); | 325 | maximized = l[4].toInt(); |
327 | 326 | ||
328 | return TRUE; | 327 | return TRUE; |
329 | } | 328 | } |
330 | 329 | ||
331 | return FALSE; | 330 | return FALSE; |
332 | } | 331 | } |
333 | 332 | ||
334 | 333 | ||
335 | static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s) | 334 | static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s) |
336 | { | 335 | { |
337 | #ifndef Q_WS_QWS | 336 | #ifndef Q_WS_QWS |
338 | QRect qt_maxWindowRect = qApp->desktop()->geometry(); | 337 | QRect qt_maxWindowRect = qApp->desktop()->geometry(); |
339 | #endif | 338 | #endif |
340 | int maxX = qt_maxWindowRect.width(); | 339 | int maxX = qt_maxWindowRect.width(); |
341 | int maxY = qt_maxWindowRect.height(); | 340 | int maxY = qt_maxWindowRect.height(); |
@@ -349,65 +348,64 @@ static void qpe_show_dialog( QDialog* d, bool nomax ) | |||
349 | if ( wWidth > maxX ) { | 348 | if ( wWidth > maxX ) { |
350 | s.setWidth( maxX - (w->frameGeometry().width() - w->geometry().width() ) ); | 349 | s.setWidth( maxX - (w->frameGeometry().width() - w->geometry().width() ) ); |
351 | wWidth = maxX; | 350 | wWidth = maxX; |
352 | } | 351 | } |
353 | 352 | ||
354 | if ( wHeight > maxY ) { | 353 | if ( wHeight > maxY ) { |
355 | s.setHeight( maxY - (w->frameGeometry().height() - w->geometry().height() ) ); | 354 | s.setHeight( maxY - (w->frameGeometry().height() - w->geometry().height() ) ); |
356 | wHeight = maxY; | 355 | wHeight = maxY; |
357 | } | 356 | } |
358 | 357 | ||
359 | // any smaller than this and the maximize/close/help buttons will be overlapping | 358 | // any smaller than this and the maximize/close/help buttons will be overlapping |
360 | if ( wWidth < 80 || wHeight < 60 ) | 359 | if ( wWidth < 80 || wHeight < 60 ) |
361 | return FALSE; | 360 | return FALSE; |
362 | 361 | ||
363 | if ( p.x() < 0 ) | 362 | if ( p.x() < 0 ) |
364 | p.setX(0); | 363 | p.setX(0); |
365 | if ( p.y() < 0 ) | 364 | if ( p.y() < 0 ) |
366 | p.setY(0); | 365 | p.setY(0); |
367 | 366 | ||
368 | if ( p.x() + wWidth > maxX ) | 367 | if ( p.x() + wWidth > maxX ) |
369 | p.setX( maxX - wWidth ); | 368 | p.setX( maxX - wWidth ); |
370 | if ( p.y() + wHeight > maxY ) | 369 | if ( p.y() + wHeight > maxY ) |
371 | p.setY( maxY - wHeight ); | 370 | p.setY( maxY - wHeight ); |
372 | 371 | ||
373 | return TRUE; | 372 | return TRUE; |
374 | } | 373 | } |
375 | 374 | ||
376 | static void store_widget_rect(QWidget *w, QString &app) | 375 | static void store_widget_rect(QWidget *w, QString &app) |
377 | { | 376 | { |
378 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button | 377 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button |
379 | if ( qApp->desktop()->width() <= 350 ) | 378 | if ( qApp->desktop()->width() <= 350 ) |
380 | return; | 379 | return; |
381 | qDebug("store_widget_rect"); | ||
382 | // we use these to map the offset of geometry and pos. ( we can only use normalGeometry to | 380 | // we use these to map the offset of geometry and pos. ( we can only use normalGeometry to |
383 | // get the non-maximized version, so we have to do it the hard way ) | 381 | // get the non-maximized version, so we have to do it the hard way ) |
384 | int offsetX = w->x() - w->geometry().left(); | 382 | int offsetX = w->x() - w->geometry().left(); |
385 | int offsetY = w->y() - w->geometry().top(); | 383 | int offsetY = w->y() - w->geometry().top(); |
386 | 384 | ||
387 | QRect r; | 385 | QRect r; |
388 | if ( w->isMaximized() ) | 386 | if ( w->isMaximized() ) |
389 | r = ( (HackWidget *) w)->normalGeometry(); | 387 | r = ( (HackWidget *) w)->normalGeometry(); |
390 | else | 388 | else |
391 | r = w->geometry(); | 389 | r = w->geometry(); |
392 | 390 | ||
393 | // Stores the window placement as pos(), size() (due to the offset mapping) | 391 | // Stores the window placement as pos(), size() (due to the offset mapping) |
394 | Config cfg( "qpe" ); | 392 | Config cfg( "qpe" ); |
395 | cfg.setGroup("ApplicationPositions"); | 393 | cfg.setGroup("ApplicationPositions"); |
396 | QString s; | 394 | QString s; |
397 | s.sprintf("%d,%d,%d,%d,%d", r.left() + offsetX, r.top() + offsetY, r.width(), r.height(), w->isMaximized() ); | 395 | s.sprintf("%d,%d,%d,%d,%d", r.left() + offsetX, r.top() + offsetY, r.width(), r.height(), w->isMaximized() ); |
398 | cfg.writeEntry( app, s ); | 396 | cfg.writeEntry( app, s ); |
399 | } | 397 | } |
400 | 398 | ||
401 | static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) | 399 | static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) |
402 | { | 400 | { |
403 | /* | 401 | /* |
404 | // This works but disable it for now until it is safe to apply | 402 | // This works but disable it for now until it is safe to apply |
405 | // What is does is scan the .desktop files of all the apps for | 403 | // What is does is scan the .desktop files of all the apps for |
406 | // the applnk that has the corresponding argv[0] as this program | 404 | // the applnk that has the corresponding argv[0] as this program |
407 | // then it uses the name stored in the .desktop file as the caption | 405 | // then it uses the name stored in the .desktop file as the caption |
408 | // for the main widget. This saves duplicating translations for | 406 | // for the main widget. This saves duplicating translations for |
409 | // the app name in the program and in the .desktop files. | 407 | // the app name in the program and in the .desktop files. |
410 | 408 | ||
411 | AppLnkSet apps( appsPath ); | 409 | AppLnkSet apps( appsPath ); |
412 | 410 | ||
413 | QList<AppLnk> appsList = apps.children(); | 411 | QList<AppLnk> appsList = apps.children(); |