From f9fdac19aff44f5c6d868a8e8dfa59c0ab6e3c20 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 13 Apr 2010 10:52:35 +0300 Subject: QS60Style: Single Click UI support for SD 9.2 time-box Final commit for this task. For widgets that use the highlighted list/table graphic, style now supports pressed state for the highlight. Style filters mouse press and release events and sets the highlight graphics to be correct based on mouse events (i.e. touch) it gets. Task-number: QT-2298 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 175 +++++++++++++++++++++++++++------------ src/gui/styles/qs60style_p.h | 27 +++++- src/gui/styles/qs60style_s60.cpp | 21 +++++ 3 files changed, 170 insertions(+), 53 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index f49acc4..28cbc45 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -122,6 +122,8 @@ QPalette *QS60StylePrivate::m_themePalette = 0; qint64 QS60StylePrivate::m_webPaletteKey = 0; +QPointer QS60StylePrivate::m_pressedWidget = 0; + const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameElementsData[] = { {SE_ButtonNormal, QS60StyleEnums::SP_QsnFrButtonTbCenter}, {SE_ButtonPressed, QS60StyleEnums::SP_QsnFrButtonTbCenterPressed}, @@ -138,6 +140,8 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme {SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter}, {SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive}, {SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter}, + {SE_TableItemPressed, QS60StyleEnums::SP_QsnFrGridCenterPressed}, + {SE_ListItemPressed, QS60StyleEnums::SP_QsnFrListPressed}, }; static const int frameElementsCount = @@ -294,6 +298,12 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, case SE_DropArea: drawPart(QS60StyleEnums::SP_QgnGrafOrgBgGrid, painter, rect, flags | SF_PointNorth); break; + case SE_TableItemPressed: + drawFrame(SF_TableItemPressed, painter, rect, flags | SF_PointNorth); + break; + case SE_ListItemPressed: + drawFrame(SF_ListItemPressed, painter, rect, flags | SF_PointNorth); + break; default: break; } @@ -939,6 +949,11 @@ bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush, con backgroundBrush.style() == Qt::NoBrush) ? true : false; } +bool QS60StylePrivate::isWidgetPressed(const QWidget *widget) +{ + return (widget && widget == m_pressedWidget); +} + /*! \class QS60Style \brief The QS60Style class provides a look and feel suitable for applications on S60. @@ -1424,73 +1439,37 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, // draw themed background for table unless background brush has been defined. if (vopt->backgroundBrush == Qt::NoBrush) { if (itemView) { - const QModelIndex index = vopt->index; - //todo: Draw cell background only once - for the first cell. - QStyleOptionViewItemV4 voptAdj2 = voptAdj; - const QModelIndex indexFirst = itemView->model()->index(0, 0); - const QModelIndex indexLast = itemView->model()->index( - itemView->model()->rowCount() - 1, itemView->model()->columnCount() -1); - if (itemView->viewport()) - voptAdj2.rect = QRect( itemView->visualRect(indexFirst).topLeft(), - itemView->visualRect(indexLast).bottomRight()).intersect(itemView->viewport()->rect()); drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget); } } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);} - // draw the focus rect - if (isSelected || hasFocus ) { - QRect highlightRect = option->rect.adjusted(1,1,-1,-1); - QAbstractItemView::SelectionBehavior selectionBehavior = - itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems; - if (selectionBehavior != QAbstractItemView::SelectItems) { - // set highlight rect so that it is continuous from cell to cell, yet sligthly - // smaller than cell rect - int xBeginning = 0, yBeginning = 0, xEnd = 0, yEnd = 0; - if (selectionBehavior == QAbstractItemView::SelectRows) { - yBeginning = 1; yEnd = -1; - if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) - xBeginning = 1; - else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) - xEnd = -1; - } else if (selectionBehavior == QAbstractItemView::SelectColumns) { - xBeginning = 1; xEnd = -1; - if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) - yBeginning = 1; - else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) - yEnd = -1; - } - highlightRect = option->rect.adjusted(xBeginning, yBeginning, xEnd, yEnd); - } - if (vopt->showDecorationSelected && - (vopt->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color())) - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, highlightRect, flags); - else - painter->fillRect(highlightRect, vopt->palette.highlight()); - } - // draw the icon const QIcon::Mode mode = (voptAdj.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled; - const QIcon::State state = voptAdj.state & State_Open ? QIcon::On : QIcon::Off; + const QIcon::State state = (voptAdj.state & State_Open) ? QIcon::On : QIcon::Off; voptAdj.icon.paint(painter, iconRect, voptAdj.decorationAlignment, mode, state); // Draw selection check mark. Show check mark only in multi selection modes. if (itemView) { const bool singleSelection = (itemView->selectionMode() == QAbstractItemView::SingleSelection || - itemView->selectionMode() == QAbstractItemView::NoSelection); + itemView->selectionMode() == QAbstractItemView::NoSelection)|| + (itemView->selectionModel()->selectedIndexes().count() < 2 ); + + const bool selectItemsOnly = (itemView->selectionBehavior() == QAbstractItemView::SelectItems); + const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); QStyleOptionViewItemV4 checkMarkOption(voptAdj); - // Draw selection mark. - if (voptAdj.state & State_Selected && !singleSelection) { + if (selectionRect.isValid()) checkMarkOption.rect = selectionRect; - drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget); - if ( textRect.right() > selectionRect.left() ) + // Draw selection mark. + if (isSelected && !singleSelection && selectItemsOnly) { + proxy()->drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget); + // @todo: this should happen in the rect retrievel i.e. subElementRect() + if (textRect.right() > selectionRect.left()) textRect.setRight(selectionRect.left()); } else if (singleSelection && - voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator && - selectionRect.isValid()) { - checkMarkOption.rect = selectionRect; + voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) { checkMarkOption.state = checkMarkOption.state & ~State_HasFocus; switch (vopt->checkState) { @@ -2037,7 +2016,10 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti if (option->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()) if ((qstyleoption_cast(option) && (qobject_cast(widget) || qobject_cast(widget)))) - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); + QS60StylePrivate::drawSkinElement( + QS60StylePrivate::isWidgetPressed(widget) ? + QS60StylePrivate::SE_ListItemPressed : + QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); else commonStyleDraws = true; } @@ -2257,6 +2239,57 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti break; #ifndef QT_NO_ITEMVIEWS case PE_PanelItemViewItem: + if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast(option)) { + const bool isSelected = (vopt->state & State_Selected); + const bool hasFocus = (vopt->state & State_HasFocus); + const bool isPressed = QS60StylePrivate::isWidgetPressed(widget); + + if (option->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()) { + QRect highlightRect = vopt->rect.adjusted(1,1,-1,-1); + const QAbstractItemView *itemView = qobject_cast(widget); + QAbstractItemView::SelectionBehavior selectionBehavior = + itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems; + // Set the draw area for highlights (focus, select rect or pressed rect) + if (hasFocus || isSelected || isPressed) { + if (selectionBehavior != QAbstractItemView::SelectItems) { + // set highlight rect so that it is continuous from cell to cell, yet sligthly + // smaller than cell rect + int xBeginning = 0, yBeginning = 0, xEnd = 0, yEnd = 0; + if (selectionBehavior == QAbstractItemView::SelectRows) { + yBeginning = 1; yEnd = -1; + if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) + xBeginning = 1; + else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) + xEnd = -1; + } else if (selectionBehavior == QAbstractItemView::SelectColumns) { + xBeginning = 1; xEnd = -1; + if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) + yBeginning = 1; + else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) + yEnd = -1; + } + highlightRect = option->rect.adjusted(xBeginning, yBeginning, xEnd, yEnd); + } + } + bool tableView = false; + if (itemView && qobject_cast(widget)) + tableView = true; + + QS60StylePrivate::SkinElements element; + QRect elementRect = option->rect; + + //draw item is drawn as pressed, if it already has focus. + if (isPressed && (hasFocus || isSelected)) { + element = tableView ? QS60StylePrivate::SE_TableItemPressed : QS60StylePrivate::SE_ListItemPressed; + } else if (hasFocus || (isSelected && selectionBehavior != QAbstractItemView::SelectItems)) { + element = QS60StylePrivate::SE_ListHighlight; + elementRect = highlightRect; + } + QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags); + } else { + QCommonStyle::drawPrimitive(element, option, painter, widget); + } + } break; #endif //QT_NO_ITEMVIEWS @@ -3067,8 +3100,11 @@ void QS60Style::unpolish(QWidget *widget) void QS60Style::polish(QApplication *application) { Q_D(QS60Style); + QCommonStyle::polish(qApp); d->m_originalPalette = application->palette(); d->setThemePalette(application); + if (QS60StylePrivate::isTouchSupported()) + qApp->installEventFilter(this); } /*! @@ -3077,10 +3113,14 @@ void QS60Style::polish(QApplication *application) void QS60Style::unpolish(QApplication *application) { Q_UNUSED(application) + Q_D(QS60Style); + QCommonStyle::unpolish(qApp); const QPalette newPalette = QApplication::style()->standardPalette(); QApplication::setPalette(newPalette); QApplicationPrivate::setSystemPalette(d->m_originalPalette); + if (QS60StylePrivate::isTouchSupported()) + qApp->removeEventFilter(this); } /*! @@ -3227,9 +3267,40 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, */ bool QS60Style::eventFilter(QObject *object, QEvent *event) { + Q_D(QS60Style); + switch(event->type()) { + case QEvent::MouseButtonPress: { + QWidget *w = QApplication::widgetAt(QCursor::pos()); + if (w) { + QWidget *focusW = w->focusProxy(); + if (qobject_cast(focusW) || + qobject_cast(focusW) || + qobject_cast(focusW)) + d->m_pressedWidget = focusW; + else if (qobject_cast(w)|| + qobject_cast(w) || + qobject_cast(w)) + d->m_pressedWidget = w; + + if ( d->m_pressedWidget) + d->m_pressedWidget->update(); + } + break; + } + case QEvent::MouseButtonRelease: { + const QWidget *w = QApplication::widgetAt(QCursor::pos()); + if (w && d->m_pressedWidget) { + d->m_pressedWidget->update(); + d->m_pressedWidget = 0; + } + break; + } + default: + break; + } + #ifdef Q_WS_S60 #ifndef QT_NO_PROGRESSBAR - Q_D(QS60Style); switch(event->type()) { case QEvent::StyleChange: case QEvent::Show: @@ -3250,7 +3321,7 @@ bool QS60Style::eventFilter(QObject *object, QEvent *event) } #endif // QT_NO_PROGRESSBAR #endif // Q_WS_S60 - return QStyle::eventFilter(object, event); + return QCommonStyle::eventFilter(object, event); } /*! diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 6ce4960..9dd3810 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -293,6 +293,24 @@ public: SP_QsnFrButtonSideLInactive, SP_QsnFrButtonSideRInactive, SP_QsnFrButtonCenterInactive, + SP_QsnFrGridCornerTlPressed, // Pressed table item + SP_QsnFrGridCornerTrPressed, + SP_QsnFrGridCornerBlPressed, + SP_QsnFrGridCornerBrPressed, + SP_QsnFrGridSideTPressed, + SP_QsnFrGridSideBPressed, + SP_QsnFrGridSideLPressed, + SP_QsnFrGridSideRPressed, + SP_QsnFrGridCenterPressed, + SP_QsnFrListCornerTlPressed, // Pressed list item + SP_QsnFrListCornerTrPressed, + SP_QsnFrListCornerBlPressed, + SP_QsnFrListCornerBrPressed, + SP_QsnFrListSideTPressed, + SP_QsnFrListSideBPressed, + SP_QsnFrListSideLPressed, + SP_QsnFrListSideRPressed, + SP_QsnFrListPressed, }; enum ColorLists { @@ -424,7 +442,9 @@ public: SE_ScrollBarHandlePressedVertical, SE_ButtonInactive, SE_Editor, - SE_DropArea + SE_DropArea, + SE_TableItemPressed, + SE_ListItemPressed, }; enum SkinFrameElements { @@ -442,6 +462,8 @@ public: SF_ToolBarButtonPressed, SF_PanelBackground, SF_ButtonInactive, + SF_TableItemPressed, + SF_ListItemPressed, }; enum SkinElementFlag { @@ -496,6 +518,7 @@ public: static bool isToolBarBackground(); static bool hasSliderGrooveGraphic(); static bool isSingleClickUi(); + static bool isWidgetPressed(const QWidget *widget); // calculates average color based on button skin graphics (minus borders). QColor colorFromFrameGraphics(SkinFrameElements frame) const; @@ -593,6 +616,8 @@ private: QPointer m_focusFrame; static qint64 m_webPaletteKey; + static QPointer m_pressedWidget; + #ifdef Q_WS_S60 //list of progress bars having animation running QList m_bars; diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 97cf919..74da51e 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -377,6 +377,27 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b8}, /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_X, EAknsMajorSkin, 0x21b9}, + // No pressed down grid in 3.1/3.2 + /* SP_QsnFrGridCornerTlPressed */ {KAknsIIDQsnFrGridCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2681}, /*KAknsIIDQsnFrGridCornerTlPressed*/ + /* SP_QsnFrGridCornerTrPressed */ {KAknsIIDQsnFrGridCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2682}, + /* SP_QsnFrGridCornerBlPressed */ {KAknsIIDQsnFrGridCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2683}, + /* SP_QsnFrGridCornerBrPressed */ {KAknsIIDQsnFrGridCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2684}, + /* SP_QsnFrGridSideTPressed */ {KAknsIIDQsnFrGridSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2685}, + /* SP_QsnFrGridSideBPressed */ {KAknsIIDQsnFrGridSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2686}, + /* SP_QsnFrGridSideLPressed */ {KAknsIIDQsnFrGridSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2687}, + /* SP_QsnFrGridSideRPressed */ {KAknsIIDQsnFrGridSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2688}, + /* SP_QsnFrGridCenterPressed */ {KAknsIIDQsnFrGridCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2689}, + + // No pressed down list in 3.1/3.2 + /* SP_QsnFrListCornerTlPressed */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268b}, /*KAknsIIDQsnFrListCornerTlPressed*/ + /* SP_QsnFrListCornerTrPressed */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268c}, + /* SP_QsnFrListCornerBlPressed */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268d}, + /* SP_QsnFrListCornerBrPressed */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268e}, + /* SP_QsnFrListSideTPressed */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268f}, + /* SP_QsnFrListSideBPressed */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2690}, + /* SP_QsnFrListSideLPressed */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2691}, + /* SP_QsnFrListSideRPressed */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2692}, + /* SP_QsnFrListPressed */ {KAknsIIDQsnFrList, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2693}, }; QPixmap QS60StyleModeSpecifics::skinnedGraphics( -- cgit v0.12 From 920b5381941ca0bed603158cbab958d172623612 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 13 Apr 2010 11:56:51 +0300 Subject: Make qmake possible to build with mingw using qmake.pro Added missing libraries Reviewed-by: Marius Storm-Olsen --- qmake/qmake.pri | 1 + 1 file changed, 1 insertion(+) diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 05debe6..b82ab4d 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -130,6 +130,7 @@ bootstrap { #Qt code } else:win32 { SOURCES += qfsfileengine_win.cpp qfsfileengine_iterator_win.cpp qsettings_win.cpp win32-msvc*:LIBS += ole32.lib advapi32.lib + win32-g++:LIBS += -lole32 -luuid } qnx { -- cgit v0.12 From cbabeb657132b71b6ab5cfee18a7abace56982f3 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 13 Apr 2010 14:17:26 +0300 Subject: Export .flm files always if they are different There are valid cases where Qt .flm files found under /epoc32/tools/makefile_templates/qt/ have newer timestamp than those in Qt repo one is developing against but still need to be overwritten, so always export .flm files when the timestamp is different instead of just when the files to be exported are newer. Task-number: QT-3253 Reviewed-by: TrustMe --- qmake/generators/symbian/symmake_sbsv2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 1014ba2..9f3f5c3 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -75,7 +75,7 @@ void SymbianSbsv2MakefileGenerator::exportFlm() foreach(QFileInfo item, sourceInfos) { QFileInfo destInfo = QFileInfo(destDir.absolutePath() + "/" + item.fileName()); - if (!destInfo.exists() || destInfo.lastModified() < item.lastModified()) { + if (!destInfo.exists() || destInfo.lastModified() != item.lastModified()) { if (destInfo.exists()) QFile::remove(destInfo.absoluteFilePath()); if (QFile::copy(item.absoluteFilePath(), destInfo.absoluteFilePath())) -- cgit v0.12 From 914bc1cb6d29b9fda93be10e73bbcb15465cca8f Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 13 Apr 2010 14:25:21 +0200 Subject: Fix typos, there is no QT_NO_SSL Reviewed-by: thiago Reviewed-by: andreas --- src/network/ssl/qsslsocket_openssl_symbols.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 94cc9d2..8620e00 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -742,7 +742,7 @@ bool q_resolveOpenSslSymbols() bool q_resolveOpenSslSymbols() { -#ifdef QT_NO_SSL +#ifdef QT_NO_OPENSSL return false; #endif return true; -- cgit v0.12 From e090c7ff6c36557e3b0f739308147234978e9d2a Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 13 Apr 2010 15:28:05 +0300 Subject: Not possible to show selected text in virtual keyboard In Sym^3 when virtual keyboard is opened, text selection is not carried over from editor-like widget to the VKB. This is due that new implementation of AVKON FEP manager requires that clients indicate with editor flags that they can handle text selection. Task-number: QT-3277 Reviewed-by: Janne Anttila --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index cc60246..94036d0 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -58,6 +58,11 @@ // MAknEdStateObserver::EAknActivatePenInputRequest #define QT_EAknActivatePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(7) +// EAknEditorFlagSelectionVisible is only valid from 3.2 onwards. +// Sym^3 AVKON FEP manager expects that this flag is used for FEP-aware editors +// that support text selection. +#define QT_EAknEditorFlagSelectionVisible 0x100000 + QT_BEGIN_NAMESPACE QCoeFepInputContext::QCoeFepInputContext(QObject *parent) @@ -75,7 +80,10 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_hasTempPreeditString(false) { m_fepState->SetObjectProvider(this); - m_fepState->SetFlags(EAknEditorFlagDefault); + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) + m_fepState->SetFlags(EAknEditorFlagDefault | QT_EAknEditorFlagSelectionVisible); + else + m_fepState->SetFlags(EAknEditorFlagDefault); m_fepState->SetDefaultInputMode( EAknEditorTextInputMode ); m_fepState->SetPermittedInputModes( EAknEditorAllInputModes ); m_fepState->SetDefaultCase( EAknEditorLowerCase ); @@ -432,7 +440,10 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) m_fepState->SetPermittedCases(flags); ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate); - flags = 0; + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) + flags = QT_EAknEditorFlagSelectionVisible; + else + flags = 0; if (hints & ImhUppercaseOnly && !(hints & ImhLowercaseOnly) || hints & ImhLowercaseOnly && !(hints & ImhUppercaseOnly)) { flags |= EAknEditorFlagFixedCase; -- cgit v0.12 From 058ba4d19b296464f87504bdc2a2076ee1368e57 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 12 Apr 2010 16:55:37 +0200 Subject: Make qsTr work in global scope Search up the call stack to find the first non-empty source URL. Also and add an autotest for the QtScript translator functions since there was none (their presence was checked, but not their behavior...). Task-number: QTBUG-9775 Reviewed-by: Olivier Goffart --- src/script/api/qscriptengine.cpp | 16 +++++++-- tests/auto/qscriptengine/qscriptengine.pro | 1 + tests/auto/qscriptengine/qscriptengine.qrc | 5 +++ tests/auto/qscriptengine/translatable.js | 7 ++++ .../qscriptengine/translations/translatable_la.qm | Bin 0 -> 241 bytes .../qscriptengine/translations/translatable_la.ts | 34 ++++++++++++++++++ tests/auto/qscriptengine/tst_qscriptengine.cpp | 40 +++++++++++++++++++++ 7 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 tests/auto/qscriptengine/qscriptengine.qrc create mode 100644 tests/auto/qscriptengine/translatable.js create mode 100644 tests/auto/qscriptengine/translations/translatable_la.qm create mode 100644 tests/auto/qscriptengine/translations/translatable_la.ts diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 2422108..ccd3e56 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -41,6 +41,7 @@ #include #include +#include "CodeBlock.h" #include "Error.h" #include "JSArray.h" #include "JSLock.h" @@ -699,9 +700,18 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS return JSC::throwError(exec, JSC::GeneralError, "qsTranslate(): third argument (n) must be a number"); #ifndef QT_NO_QOBJECT QString context; - QScriptContext *ctx = QScriptEnginePrivate::contextForFrame(exec); - if (ctx && ctx->parentContext()) - context = QFileInfo(QScriptContextInfo(ctx->parentContext()).fileName()).baseName(); + // The first non-empty source URL in the call stack determines the translation context. + { + JSC::ExecState *frame = exec->removeHostCallFrameFlag(); + while (frame) { + if (frame->codeBlock() && frame->codeBlock()->source() + && !frame->codeBlock()->source()->url().isEmpty()) { + context = QFileInfo(frame->codeBlock()->source()->url()).baseName(); + break; + } + frame = frame->callerFrame()->removeHostCallFrameFlag(); + } + } #endif QString text(args.at(0).toString(exec)); #ifndef QT_NO_QOBJECT diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro index dd058a4..7d0f5d0 100644 --- a/tests/auto/qscriptengine/qscriptengine.pro +++ b/tests/auto/qscriptengine/qscriptengine.pro @@ -1,6 +1,7 @@ load(qttest_p4) QT = core gui script SOURCES += tst_qscriptengine.cpp +RESOURCES += qscriptengine.qrc wince* { DEFINES += SRCDIR=\\\"./\\\" diff --git a/tests/auto/qscriptengine/qscriptengine.qrc b/tests/auto/qscriptengine/qscriptengine.qrc new file mode 100644 index 0000000..b87f985 --- /dev/null +++ b/tests/auto/qscriptengine/qscriptengine.qrc @@ -0,0 +1,5 @@ + + + translations/translatable_la.qm + + diff --git a/tests/auto/qscriptengine/translatable.js b/tests/auto/qscriptengine/translatable.js new file mode 100644 index 0000000..0c948e7 --- /dev/null +++ b/tests/auto/qscriptengine/translatable.js @@ -0,0 +1,7 @@ +qsTr("One"); +qsTranslate("FooContext", "Two"); + +var greeting_strings = [ + QT_TR_NOOP("Hello"), + QT_TRANSLATE_NOOP("FooContext", "Goodbye") +]; diff --git a/tests/auto/qscriptengine/translations/translatable_la.qm b/tests/auto/qscriptengine/translations/translatable_la.qm new file mode 100644 index 0000000..03fcc52 Binary files /dev/null and b/tests/auto/qscriptengine/translations/translatable_la.qm differ diff --git a/tests/auto/qscriptengine/translations/translatable_la.ts b/tests/auto/qscriptengine/translations/translatable_la.ts new file mode 100644 index 0000000..3f631de --- /dev/null +++ b/tests/auto/qscriptengine/translations/translatable_la.ts @@ -0,0 +1,34 @@ + + + + + FooContext + + + Two + To + + + + Goodbye + Farvel + + + + translatable + + + One + En + + + + Hello + Hallo + + + Goodbye + Farvel + + + diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index f556fa1..aa5c85d 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -154,6 +154,7 @@ private slots: void incDecNonObjectProperty(); void installTranslatorFunctions_data(); void installTranslatorFunctions(); + void translateScript(); void functionScopes(); void nativeFunctionScopes(); void evaluateProgram(); @@ -4314,6 +4315,45 @@ void tst_QScriptEngine::installTranslatorFunctions() } } +void tst_QScriptEngine::translateScript() +{ + QScriptEngine engine; + + QTranslator translator; + translator.load(":/translations/translatable_la"); + QCoreApplication::instance()->installTranslator(&translator); + engine.installTranslatorFunctions(); + + QString fileName = QString::fromLatin1("translatable.js"); + // Top-level + QCOMPARE(engine.evaluate("qsTr('One')", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("qsTr('Hello')", fileName).toString(), QString::fromLatin1("Hallo")); + // From function + QCOMPARE(engine.evaluate("(function() { return qsTr('One'); })()", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("(function() { return qsTr('Hello'); })()", fileName).toString(), QString::fromLatin1("Hallo")); + // From eval + QCOMPARE(engine.evaluate("eval('qsTr(\\'One\\')')", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("eval('qsTr(\\'Hello\\')')", fileName).toString(), QString::fromLatin1("Hallo")); + + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Two')", fileName).toString(), QString::fromLatin1("To")); + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Goodbye')", fileName).toString(), QString::fromLatin1("Farvel")); + // From eval + QCOMPARE(engine.evaluate("eval('qsTranslate(\\'FooContext\\', \\'Two\\')')", fileName).toString(), QString::fromLatin1("To")); + QCOMPARE(engine.evaluate("eval('qsTranslate(\\'FooContext\\', \\'Goodbye\\')')", fileName).toString(), QString::fromLatin1("Farvel")); + + // Don't exist in translation + QCOMPARE(engine.evaluate("qsTr('Three')", fileName).toString(), QString::fromLatin1("Three")); + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'So long')", fileName).toString(), QString::fromLatin1("So long")); + QCOMPARE(engine.evaluate("qsTranslate('BarContext', 'Goodbye')", fileName).toString(), QString::fromLatin1("Goodbye")); + + // From C++ + // There is no context, but it shouldn't crash + QCOMPARE(engine.globalObject().property("qsTr").call( + QScriptValue(), QScriptValueList() << "One").toString(), QString::fromLatin1("One")); + + QCoreApplication::instance()->removeTranslator(&translator); +} + void tst_QScriptEngine::functionScopes() { QScriptEngine eng; -- cgit v0.12 From 5a339d4de6bc12408149c51e8de96025fc80e5eb Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 13 Apr 2010 15:41:09 +0200 Subject: Autotest: update location of fluke.gif on test server --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 890983e..038610d 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -4013,7 +4013,7 @@ public slots: } } void startOne() { - QUrl url = "http://" + QtNetworkSettings::serverName() + "/gif/fluke.gif"; + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/fluke.gif"; QNetworkRequest request(url); QNetworkReply *reply = manager.get(request); reply->setParent(this); -- cgit v0.12 From 0678a400ad59b80f1a3e23d38e59685ed90d3210 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 13 Apr 2010 15:51:52 +0200 Subject: Autotest: update path location on the test server --- tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp | 2 +- tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp | 2 +- tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp index 3a3ea79..f86ba63 100644 --- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -641,7 +641,7 @@ void tst_QHttpSocketEngine::downloadBigFile() QByteArray hostName = QtNetworkSettings::serverName().toLatin1(); QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState); - QVERIFY(tmpSocket->write("GET /mediumfile HTTP/1.0\r\n") > 0); + QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0); QVERIFY(tmpSocket->write("Host: ") > 0); QVERIFY(tmpSocket->write(hostName.data()) > 0); QVERIFY(tmpSocket->write("\r\n") > 0); diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp index a679765..8f0cbc3 100644 --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -780,7 +780,7 @@ void tst_QSocks5SocketEngine::downloadBigFile() QByteArray hostName = QtNetworkSettings::serverName().toLatin1(); QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState); - QVERIFY(tmpSocket->write("GET /mediumfile HTTP/1.0\r\n") > 0); + QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0); QVERIFY(tmpSocket->write("HOST: ") > 0); QVERIFY(tmpSocket->write(hostName.data()) > 0); QVERIFY(tmpSocket->write("\r\n") > 0); diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index ef7ff83..c6e4758 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -1116,7 +1116,7 @@ void tst_QTcpSocket::downloadBigFile() QByteArray hostName = QtNetworkSettings::serverName().toLatin1(); QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState); - QVERIFY(tmpSocket->write("GET /mediumfile HTTP/1.0\r\n") > 0); + QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0); QVERIFY(tmpSocket->write("HOST: ") > 0); QVERIFY(tmpSocket->write(hostName.data()) > 0); QVERIFY(tmpSocket->write("\r\n") > 0); -- cgit v0.12 From 34cb9b282b14ba01df7266bdb3649a3e43ddd9f4 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 13 Apr 2010 16:07:45 +0200 Subject: QNAM HTTP: Do not pipeline with WebLogic servers --- src/network/access/qhttpnetworkconnectionchannel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index bc7684a..83b7d4c 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -690,6 +690,8 @@ void QHttpNetworkConnectionChannel::detectPipeliningSupport() && (serverHeaderField = reply->headerField("Server"), !serverHeaderField.contains("Microsoft-IIS/4.")) && (!serverHeaderField.contains("Microsoft-IIS/5.")) && (!serverHeaderField.contains("Netscape-Enterprise/3.")) + // this is adpoted from the knowledge of the Nokia 7.x browser team (DEF143319) + && (!serverHeaderField.contains("WebLogic")) ) { pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningProbablySupported; } else { -- cgit v0.12 From a8094876e3c1194262b13313eee92cff3c0a0021 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 13 Apr 2010 16:46:58 +0200 Subject: tst_qftp: Attempting to reproduce a crash Task-number: QTBUG-7359 --- tests/auto/qftp/tst_qftp.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp index 638c810..2a42d6d 100644 --- a/tests/auto/qftp/tst_qftp.cpp +++ b/tests/auto/qftp/tst_qftp.cpp @@ -123,6 +123,8 @@ private slots: void doneSignal(); void queueMoreCommandsInDoneSlot(); + void qtbug7359Crash(); + protected slots: void stateChanged( int ); void listInfo( const QUrlInfo & ); @@ -2052,6 +2054,30 @@ void tst_QFtp::cdUpSlot(bool error) } } +void tst_QFtp::qtbug7359Crash() +{ + QFtp ftp; + ftp.connectToHost("127.0.0.1"); + + QTime t; + int elapsed; + + t.start(); + while ((elapsed = t.elapsed()) < 200) + QCoreApplication::processEvents(QEventLoop::AllEvents, 200 - elapsed); + + ftp.close(); + t.restart(); + while ((elapsed = t.elapsed()) < 1000) + QCoreApplication::processEvents(QEventLoop::AllEvents, 1000 - elapsed); + + ftp.connectToHost("127.0.0.1"); + + t.restart(); + while ((elapsed = t.elapsed()) < 2000) + QCoreApplication::processEvents(QEventLoop::AllEvents, 2000 - elapsed); +} + QTEST_MAIN(tst_QFtp) #include "tst_qftp.moc" -- cgit v0.12 From acbab8c493760467ce35ae2ef8d4a56f2bf327ae Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Tue, 13 Apr 2010 18:15:12 +0200 Subject: Fix QNX screen initialization Reviewed-by: Harald Fernengel --- src/gui/embedded/qscreenqnx_qws.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/embedded/qscreenqnx_qws.cpp b/src/gui/embedded/qscreenqnx_qws.cpp index 705db7e..a0a697f 100644 --- a/src/gui/embedded/qscreenqnx_qws.cpp +++ b/src/gui/embedded/qscreenqnx_qws.cpp @@ -205,7 +205,7 @@ static bool createMemSurface(QQnxScreenContext * const d, int w, int h) int ret = gf_surface_create(&d->memSurface, d->device, w, h, GF_FORMAT_ARGB8888, 0, GF_SURFACE_CREATE_CPU_FAST_ACCESS | GF_SURFACE_CREATE_CPU_LINEAR_ACCESSIBLE - | GF_SURFACE_PHYS_CONTIG); + | GF_SURFACE_PHYS_CONTIG | GF_SURFACE_CREATE_SHAREABLE); if (ret != GF_ERR_OK) { qWarning("QQnxScreen: gf_surface_create(%dx%d) failed with error code %d", w, h, ret); -- cgit v0.12 From 67f6618f887b3c524f9da58de8136d474881d29f Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Tue, 13 Apr 2010 18:16:02 +0200 Subject: Provide overview for Symbian capabilities. Each individual class which requires special capabilities is documented, but for finding out what to sign with, it's convenient to have it summarized in a single place. 0dcfe6f813d75da55c6183acac9a2cdfe2381594 is a related commit. Task-number: QTBUG-9342 Reviewed-by: Iain --- doc/src/platforms/platform-notes.qdoc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index f513181..131d035 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -502,6 +502,31 @@ For information about mixing exceptions with Symbian leaves, see \l{Exception Safety with Symbian}. + \section1 Required Capabilities + + Distributions of Qt are typically signed with \c{All -TCB}. What your + application needs to be signed with in order to function with Qt depends + on what functionality it uses: + + \table + \header \o Technology + \o Required Symbian Capability + \row \o QtCore + \o \c PowerMgmt if applications are terminated using QProcess. + \row \o QtNetwork + \o NetworkServices + \row \o QtMultiMedia + \o \c UserEnvironment if QAudioInput is used. + \endtable + + Depending on what file paths that are accessed and how AllFiles may be + required. Similarly, if the network is accessed indirectly through + components such as QtXmlPatterns, QtWebkit or QtScript, the capabilities + needs to match accordingly. + + See individual classes' documentation for specifics. If a class does not + mention Symbian capabilities, it requires none. + \section1 Multimedia and Phonon Support Qt provides a backend for Qt's Phonon module, which supports -- cgit v0.12