Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/dialogs/qdialog.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    6868#   include "qfiledialog.h"
    6969#   include "qfontdialog.h"
    70 #   include "qcolordialog.h"
    7170#   include "qwizard.h"
     71#   include "private/qt_s60_p.h"
    7272#endif
    7373
    7474#if defined(Q_WS_S60)
    75 #include "private/qt_s60_p.h"
     75#include <AknUtils.h>               // AknLayoutUtils
    7676#endif
    7777
     
    259259QDialog::QDialog(QWidget *parent, Qt::WindowFlags f)
    260260    : QWidget(*new QDialogPrivate, parent,
    261               f | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0))
     261              f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0)))
    262262{
    263263#ifdef Q_WS_WINCE
     
    283283    : QWidget(*new QDialogPrivate, parent,
    284284              f
    285               | QFlag(modal ? Qt::WShowModal : 0)
    286               | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0)
     285              | QFlag(modal ? Qt::WShowModal : Qt::WindowType(0))
     286              | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))
    287287        )
    288288{
     
    296296*/
    297297QDialog::QDialog(QDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f)
    298     : QWidget(dd, parent, f | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0))
     298    : QWidget(dd, parent, f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0)))
    299299{
    300300#ifdef Q_WS_WINCE
     
    394394}
    395395
    396 #if defined(Q_WS_WINCE) || defined(Q_WS_S60)
     396#if defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN)
    397397#ifdef Q_WS_WINCE_WM
    398398void QDialogPrivate::_q_doneAction()
     
    414414        result = true;
    415415     }
    416 #else
     416#elif defined(Q_WS_S60)
    417417    if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) {
    418418        if (!testAttribute(Qt::WA_Moved)) {
     
    424424        }
    425425    }
     426    // TODO is Symbian, non-S60 behaviour required?
    426427#endif
    427428    return result;
     
    528529#endif //Q_WS_WINCE_WM
    529530
     531    bool showSystemDialogFullScreen = false;
    530532#ifdef Q_OS_SYMBIAN
    531533    if (qobject_cast<QFileDialog *>(this) || qobject_cast<QFontDialog *>(this) ||
    532         qobject_cast<QColorDialog *>(this) || qobject_cast<QWizard *>(this))
    533         showMaximized();
    534     else
     534        qobject_cast<QWizard *>(this)) {
     535        showSystemDialogFullScreen = true;
     536    }
    535537#endif // Q_OS_SYMBIAN
    536538
    537         show();
     539    if (showSystemDialogFullScreen) {
     540        setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint);
     541        setWindowState(Qt::WindowFullScreen);
     542    }
     543    show();
    538544
    539545#ifdef Q_WS_MAC
     
    642648        w = w->isWindow() ? 0 : w->parentWidget();
    643649    if (w) {
    644         QMenu p(this);
    645         QAction *wt = p.addAction(tr("What's This?"));
    646         if (p.exec(e->globalPos()) == wt) {
     650        QWeakPointer<QMenu> p = new QMenu(this);
     651        QAction *wt = p.data()->addAction(tr("What's This?"));
     652        if (p.data()->exec(e->globalPos()) == wt) {
    647653            QHelpEvent e(QEvent::WhatsThis, w->rect().center(),
    648654                         w->mapToGlobal(w->rect().center()));
    649655            QApplication::sendEvent(w, &e);
    650656        }
     657        delete p.data();
    651658    }
    652659#endif
     
    818825#endif
    819826
    820 #ifdef Q_WS_S60
    821     if (s60AdjustedPosition())
     827#ifdef Q_OS_SYMBIAN
     828    if (symbianAdjustedPosition())
    822829        //dialog has already been positioned
    823830        return;
     
    887894}
    888895
     896#if defined(Q_OS_SYMBIAN)
     897/*! \internal */
     898bool QDialog::symbianAdjustedPosition()
     899{
    889900#if defined(Q_WS_S60)
    890 /*! \internal */
    891 bool QDialog::s60AdjustedPosition()
    892 {
    893901    QPoint p;
    894     const QSize mainAreaSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size();
    895     const int statusPaneHeight = (S60->screenHeightInPixels - mainAreaSize.height())>>1;
    896     const bool doS60Positioning = !(isFullScreen()||isMaximized());
    897     if (doS60Positioning) {
     902    QPoint oldPos = pos();
     903    if (isFullScreen()) {
     904        p.setX(0);
     905        p.setY(0);
     906    } else if (isMaximized()) {
     907        TRect statusPaneRect = TRect();
     908        if (S60->screenHeightInPixels > S60->screenWidthInPixels) {
     909            AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect);
     910        } else {
     911            AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, statusPaneRect);
     912        }
     913
     914        p.setX(0);
     915        p.setY(statusPaneRect.Height());
     916    } else {
    898917        // naive way to deduce screen orientation
    899918        if (S60->screenHeightInPixels > S60->screenWidthInPixels) {
    900919            int cbaHeight;
    901             const CEikButtonGroupContainer* bgContainer = S60->buttonGroupContainer();
    902             if (!bgContainer) {
    903                 cbaHeight = 0;
    904             } else {
    905                 cbaHeight = qt_TSize2QSize(bgContainer->Size()).height();
    906             }
     920            TRect rect;
     921            AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, rect);
     922            cbaHeight = rect.Height();
    907923            p.setY(S60->screenHeightInPixels - height() - cbaHeight);
    908924            p.setX(0);
     
    934950            }
    935951        }
     952    }
     953    if (oldPos != p || p.y() < 0)
    936954        move(p);
    937     }
    938     return doS60Positioning;
     955    return true;
     956#else
     957    // TODO - check positioning requirement for Symbian, non-s60
     958    return false;
     959#endif
    939960}
    940961#endif
     
    11021123    if (minimumSize() != maximumSize()) {
    11031124        // In S60, dialogs are always the width of screen (in portrait, regardless of current layout)
    1104         return QSize(qMax(S60->screenHeightInPixels, S60->screenWidthInPixels), QWidget::sizeHint().height());
     1125        return QSize(qMin(S60->screenHeightInPixels, S60->screenWidthInPixels), QWidget::sizeHint().height());
    11051126    } else {
    11061127        return QWidget::sizeHint();
Note: See TracChangeset for help on using the changeset viewer.