src/gui/dialogs/qdialog.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    65 #elif defined(Q_WS_X11)
    65 #elif defined(Q_WS_X11)
    66 #  include "../kernel/qt_x11_p.h"
    66 #  include "../kernel/qt_x11_p.h"
    67 #elif defined(Q_OS_SYMBIAN)
    67 #elif defined(Q_OS_SYMBIAN)
    68 #   include "qfiledialog.h"
    68 #   include "qfiledialog.h"
    69 #   include "qfontdialog.h"
    69 #   include "qfontdialog.h"
    70 #   include "qcolordialog.h"
       
    71 #   include "qwizard.h"
    70 #   include "qwizard.h"
       
    71 #   include "private/qt_s60_p.h"
    72 #endif
    72 #endif
    73 
    73 
    74 #if defined(Q_WS_S60)
    74 #if defined(Q_WS_S60)
    75 #include "private/qt_s60_p.h"
    75 #include <AknUtils.h>               // AknLayoutUtils
    76 #endif
    76 #endif
    77 
    77 
    78 #ifndef SPI_GETSNAPTODEFBUTTON
    78 #ifndef SPI_GETSNAPTODEFBUTTON
    79 #   define SPI_GETSNAPTODEFBUTTON  95
    79 #   define SPI_GETSNAPTODEFBUTTON  95
    80 #endif
    80 #endif
   391 #endif
   391 #endif
   392     }
   392     }
   393     resetModalityTo = -1;
   393     resetModalityTo = -1;
   394 }
   394 }
   395 
   395 
   396 #if defined(Q_WS_WINCE) || defined(Q_WS_S60)
   396 #if defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN)
   397 #ifdef Q_WS_WINCE_WM
   397 #ifdef Q_WS_WINCE_WM
   398 void QDialogPrivate::_q_doneAction()
   398 void QDialogPrivate::_q_doneAction()
   399 {
   399 {
   400     //Done...
   400     //Done...
   401     QApplication::postEvent(q_func(), new QEvent(QEvent::OkRequest));
   401     QApplication::postEvent(q_func(), new QEvent(QEvent::OkRequest));
   411 #ifdef Q_WS_WINCE
   411 #ifdef Q_WS_WINCE
   412     if (e->type() == QEvent::OkRequest) {
   412     if (e->type() == QEvent::OkRequest) {
   413         accept();
   413         accept();
   414         result = true;
   414         result = true;
   415      }
   415      }
   416 #else
   416 #elif defined(Q_WS_S60)
   417     if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) {
   417     if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) {
   418         if (!testAttribute(Qt::WA_Moved)) {
   418         if (!testAttribute(Qt::WA_Moved)) {
   419             Qt::WindowStates state = windowState();
   419             Qt::WindowStates state = windowState();
   420             adjustPosition(parentWidget());
   420             adjustPosition(parentWidget());
   421             setAttribute(Qt::WA_Moved, false); // not really an explicit position
   421             setAttribute(Qt::WA_Moved, false); // not really an explicit position
   422             if (state != windowState())
   422             if (state != windowState())
   423                 setWindowState(state);
   423                 setWindowState(state);
   424         }
   424         }
   425     }
   425     }
       
   426     // TODO is Symbian, non-S60 behaviour required?
   426 #endif
   427 #endif
   427     return result;
   428     return result;
   428 }
   429 }
   429 #endif
   430 #endif
   430 
   431 
   525         connect(doneAction, SIGNAL(triggered()), this, SLOT(_q_doneAction()));
   526         connect(doneAction, SIGNAL(triggered()), this, SLOT(_q_doneAction()));
   526     }
   527     }
   527 #endif //QT_NO_MENUBAR
   528 #endif //QT_NO_MENUBAR
   528 #endif //Q_WS_WINCE_WM
   529 #endif //Q_WS_WINCE_WM
   529 
   530 
       
   531     bool showSystemDialogFullScreen = false;
   530 #ifdef Q_OS_SYMBIAN
   532 #ifdef Q_OS_SYMBIAN
   531     if (qobject_cast<QFileDialog *>(this) || qobject_cast<QFontDialog *>(this) ||
   533     if (qobject_cast<QFileDialog *>(this) || qobject_cast<QFontDialog *>(this) ||
   532         qobject_cast<QColorDialog *>(this) || qobject_cast<QWizard *>(this))
   534         qobject_cast<QWizard *>(this)) {
   533         showMaximized();
   535         showSystemDialogFullScreen = true;
   534     else
   536     }
   535 #endif // Q_OS_SYMBIAN
   537 #endif // Q_OS_SYMBIAN
   536 
   538 
   537         show();
   539     if (showSystemDialogFullScreen) {
       
   540         setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint);
       
   541         setWindowState(Qt::WindowFullScreen);
       
   542     }
       
   543     show();
   538 
   544 
   539 #ifdef Q_WS_MAC
   545 #ifdef Q_WS_MAC
   540     d->mac_nativeDialogModalHelp();
   546     d->mac_nativeDialogModalHelp();
   541 #endif
   547 #endif
   542 
   548 
   816     // if the WM advertises that it will place the windows properly for us, let it do it :)
   822     // if the WM advertises that it will place the windows properly for us, let it do it :)
   817     if (X11->isSupportedByWM(ATOM(_NET_WM_FULL_PLACEMENT)))
   823     if (X11->isSupportedByWM(ATOM(_NET_WM_FULL_PLACEMENT)))
   818         return;
   824         return;
   819 #endif
   825 #endif
   820 
   826 
   821 #ifdef Q_WS_S60
   827 #ifdef Q_OS_SYMBIAN
   822     if (s60AdjustedPosition())
   828     if (symbianAdjustedPosition())
   823         //dialog has already been positioned
   829         //dialog has already been positioned
   824         return;
   830         return;
   825 #endif
   831 #endif
   826 
   832 
   827     QPoint p(0, 0);
   833     QPoint p(0, 0);
   885         p.setY(desk.y());
   891         p.setY(desk.y());
   886 
   892 
   887     move(p);
   893     move(p);
   888 }
   894 }
   889 
   895 
       
   896 #if defined(Q_OS_SYMBIAN)
       
   897 /*! \internal */
       
   898 bool QDialog::symbianAdjustedPosition()
       
   899 {
   890 #if defined(Q_WS_S60)
   900 #if defined(Q_WS_S60)
   891 /*! \internal */
       
   892 bool QDialog::s60AdjustedPosition()
       
   893 {
       
   894     QPoint p;
   901     QPoint p;
   895     const QSize mainAreaSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size();
       
   896     const int statusPaneHeight = (S60->screenHeightInPixels - mainAreaSize.height())>>1;
       
   897     const bool doS60Positioning = !(isFullScreen()||isMaximized());
   902     const bool doS60Positioning = !(isFullScreen()||isMaximized());
   898     if (doS60Positioning) {
   903     if (doS60Positioning) {
   899         // naive way to deduce screen orientation
   904         // naive way to deduce screen orientation
   900         if (S60->screenHeightInPixels > S60->screenWidthInPixels) {
   905         if (S60->screenHeightInPixels > S60->screenWidthInPixels) {
   901             int cbaHeight;
   906             int cbaHeight;
   935             }
   940             }
   936         }
   941         }
   937         move(p);
   942         move(p);
   938     }
   943     }
   939     return doS60Positioning;
   944     return doS60Positioning;
       
   945 #else
       
   946     // TODO - check positioning requirement for Symbian, non-s60
       
   947     return false;
       
   948 #endif
   940 }
   949 }
   941 #endif
   950 #endif
   942 
   951 
   943 /*!
   952 /*!
   944     \obsolete
   953     \obsolete