diff options
Diffstat (limited to 'src')
65 files changed, 1393 insertions, 358 deletions
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 221c020..c304876 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - a54fd11a3abcd6d9c858e8162e85fd1f3aa21db1 + 69dd29fbeb12d076741dce70ac6bc155101ccd6f diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index fd5606b..18d119a 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,76 @@ +2010-02-01 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Use the fallback style on Maemo 5 + + https://bugs.webkit.org/show_bug.cgi?id=34376 + + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::RenderThemeQt): + (WebCore::RenderThemeQt::fallbackStyle): + (WebCore::RenderThemeQt::qStyle): + (WebCore::RenderThemeQt::setPaletteFromPageClientIfExists): + * platform/qt/RenderThemeQt.h: + +2010-01-29 Oswald Buddenhagen <oswald.buddenhagen@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Speed up the WebCore::String -> QString conversion + + Use QString(const QChar *, int len) constructor instead of QString::fromUtf16 to + avoid BOM checks and byteswapping. + + * bridge/qt/qt_class.cpp: + (JSC::Bindings::QtClass::fieldNamed): + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + +2010-01-14 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Enable scrolling optimization for pages with embedded widgets + + https://bugs.webkit.org/show_bug.cgi?id=33373 + + Added a basic manual test for scrolling of embedded QWidgets. + + * manual-tests/qt/qtplugin-scrolling.html: Added. + * platform/ScrollView.cpp: + (WebCore::ScrollView::scrollContents): + (WebCore::ScrollView::setParent): + * platform/ScrollView.h: + * platform/qt/ScrollViewQt.cpp: + (WebCore::ScrollView::platformInit): + (WebCore::ScrollView::platformAddChild): + (WebCore::ScrollView::platformRemoveChild): + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::updatePluginWidget): + (WebCore::PluginView::invalidateRect): + +2010-01-29 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Turn off websocket support by default for Qt 4.6.x + https://bugs.webkit.org/show_bug.cgi?id=34284 + + * WebCore.pro: + +2010-01-26 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Simon Hausmann. + + [Qt] JavaScript prompt is currently broken. + https://bugs.webkit.org/show_bug.cgi?id=30914 + + Remove the manual test case in favor of an automated + test case in WebKit/qt/tests/qwebpage. + + * manual-tests/qt/java-script-prompt.html: Removed. + 2010-01-25 Janne Koskinen <janne.p.koskinen@digia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index bf4d6f9..7b0366d 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -6,6 +6,7 @@ symbian: { TARGET.EPOCALLOWDLLDATA=1 TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 // Min 128kB, Max 32MB TARGET.CAPABILITY = All -Tcb + TARGET.UID3 = 0x200267C2 webkitlibs.sources = QtWebKit.dll webkitlibs.path = /sys/bin @@ -23,7 +24,6 @@ symbian: { DEPLOYMENT += webkitlibs webkitbackup - TARGET.UID3 = 0x200267C2 # RO text (code) section in qtwebkit.dll exceeds allocated space for gcce udeb target. # Move RW-section base address to start from 0xE00000 instead of the toolchain default 0x400000. MMP_RULES += "LINKEROPTION armcc --rw-base 0xE00000" @@ -186,7 +186,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) { } # Web Socket support. -!contains(DEFINES, ENABLE_WEB_SOCKETS=.): DEFINES += ENABLE_WEB_SOCKETS=1 +!contains(DEFINES, ENABLE_WEB_SOCKETS=.): DEFINES += ENABLE_WEB_SOCKETS=0 # XSLT support with QtXmlPatterns !contains(DEFINES, ENABLE_XSLT=.) { diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.cpp index c39b3af..09a1544 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.cpp @@ -127,7 +127,7 @@ Field* QtClass::fieldNamed(const Identifier& identifier, Instance* instance) con QObject* obj = qtinst->getObject(); UString ustring = identifier.ustring(); - QString objName(QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size())); + QString objName((const QChar*)ustring.rep()->data(), ustring.size()); QByteArray ba = objName.toAscii(); // First check for a cached field diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp index 6887325..ee7aa1a 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp @@ -305,7 +305,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type return QString(); } else { UString ustring = value.toString(exec); - ret = QVariant(QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size())); + ret = QVariant(QString((const QChar*)ustring.rep()->data(), ustring.size())); if (type == String) dist = 0; else @@ -329,7 +329,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type QVariant v = convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects); if (objdist >= 0) { UString ustring = (*it).ustring(); - QString id = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); + QString id = QString((const QChar*)ustring.rep()->data(), ustring.size()); result.insert(id, v); } } @@ -404,7 +404,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); UString ustring = val.toString(exec); - QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); + QString qstring = QString((const QChar*)ustring.rep()->data(), ustring.size()); result.append(qstring); } @@ -418,7 +418,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = array->get(exec, i); UString ustring = val.toString(exec); - QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); + QString qstring = QString((const QChar*)ustring.rep()->data(), ustring.size()); result.append(qstring); } @@ -427,7 +427,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type } else { // Make a single length array UString ustring = value.toString(exec); - QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); + QString qstring = QString((const QChar*)ustring.rep()->data(), ustring.size()); QStringList result; result.append(qstring); ret = QVariant(result); @@ -443,7 +443,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type dist = 0; } else { UString ustring = value.toString(exec); - ret = QVariant(QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()).toLatin1()); + ret = QVariant(QString((const QChar*)ustring.rep()->data(), ustring.size()).toLatin1()); if (type == String) dist = 5; else @@ -485,7 +485,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type } } else if (type == String) { UString ustring = value.toString(exec); - QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); + QString qstring = QString((const QChar*)ustring.rep()->data(), ustring.size()); if (hint == QMetaType::QDateTime) { QDateTime dt = QDateTime::fromString(qstring, Qt::ISODate); @@ -534,7 +534,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type */ // Attempt to convert.. a bit risky UString ustring = value.toString(exec); - QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); + QString qstring = QString((const QChar*)ustring.rep()->data(), ustring.size()); // this is of the form '/xxxxxx/i' int firstSlash = qstring.indexOf(QLatin1Char('/')); @@ -554,7 +554,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type } } else if (type == String) { UString ustring = value.toString(exec); - QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); + QString qstring = QString((const QChar*)ustring.rep()->data(), ustring.size()); QRegExp re(qstring); if (re.isValid()) { diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp index 12edc42..d270e37 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp @@ -216,7 +216,6 @@ #include "JSWebKitCSSTransformValue.h" #include "JSWebKitPoint.h" #include "JSWebKitTransitionEvent.h" -#include "JSWebSocket.h" #include "JSWheelEvent.h" #include "JSWorker.h" #include "JSXMLHttpRequest.h" @@ -247,7 +246,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSDOMWindow); /* Hash table */ -static const HashTableValue JSDOMWindowTableValues[297] = +static const HashTableValue JSDOMWindowTableValues[296] = { { "screen", DontDelete|ReadOnly, (intptr_t)jsDOMWindowScreen, (intptr_t)0 }, { "history", DontDelete|ReadOnly, (intptr_t)jsDOMWindowHistory, (intptr_t)0 }, @@ -540,7 +539,6 @@ static const HashTableValue JSDOMWindowTableValues[297] = { "MessageChannel", DontDelete, (intptr_t)jsDOMWindowMessageChannelConstructor, (intptr_t)setJSDOMWindowMessageChannelConstructor }, { "Worker", DontDelete, (intptr_t)jsDOMWindowWorkerConstructor, (intptr_t)setJSDOMWindowWorkerConstructor }, { "SharedWorker", DontDelete, (intptr_t)jsDOMWindowSharedWorkerConstructor, (intptr_t)setJSDOMWindowSharedWorkerConstructor }, - { "WebSocket", DontDelete, (intptr_t)jsDOMWindowWebSocketConstructor, (intptr_t)setJSDOMWindowWebSocketConstructor }, { "Plugin", DontDelete, (intptr_t)jsDOMWindowPluginConstructor, (intptr_t)setJSDOMWindowPluginConstructor }, { "PluginArray", DontDelete, (intptr_t)jsDOMWindowPluginArrayConstructor, (intptr_t)setJSDOMWindowPluginArrayConstructor }, { "MimeType", DontDelete, (intptr_t)jsDOMWindowMimeTypeConstructor, (intptr_t)setJSDOMWindowMimeTypeConstructor }, @@ -588,7 +586,7 @@ static JSC_CONST_HASHTABLE HashTable JSDOMWindowTable = #if ENABLE(PERFECT_HASH_SIZE) { 65535, JSDOMWindowTableValues, 0 }; #else - { 1068, 1023, JSDOMWindowTableValues, 0 }; + { 1067, 1023, JSDOMWindowTableValues, 0 }; #endif /* Hash table for prototype */ @@ -3275,14 +3273,6 @@ JSValue jsDOMWindowSharedWorkerConstructor(ExecState* exec, const Identifier&, c return castedThis->sharedWorker(exec); } -JSValue jsDOMWindowWebSocketConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) -{ - JSDOMWindow* castedThis = static_cast<JSDOMWindow*>(asObject(slot.slotBase())); - if (!castedThis->allowsAccessFrom(exec)) - return jsUndefined(); - return castedThis->webSocket(exec); -} - JSValue jsDOMWindowPluginConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) { JSDOMWindow* castedThis = static_cast<JSDOMWindow*>(asObject(slot.slotBase())); @@ -5678,14 +5668,6 @@ void setJSDOMWindowSharedWorkerConstructor(ExecState* exec, JSObject* thisObject static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "SharedWorker"), value); } -void setJSDOMWindowWebSocketConstructor(ExecState* exec, JSObject* thisObject, JSValue value) -{ - if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec)) - return; - // Shadowing a built-in constructor - static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "WebSocket"), value); -} - void setJSDOMWindowPluginConstructor(ExecState* exec, JSObject* thisObject, JSValue value) { if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec)) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h index afc8106..5a087e7 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h @@ -82,7 +82,6 @@ public: JSC::JSValue messageChannel(JSC::ExecState*) const; JSC::JSValue worker(JSC::ExecState*) const; JSC::JSValue sharedWorker(JSC::ExecState*) const; - JSC::JSValue webSocket(JSC::ExecState*) const; JSC::JSValue audio(JSC::ExecState*) const; // Custom functions @@ -679,8 +678,6 @@ JSC::JSValue jsDOMWindowWorkerConstructor(JSC::ExecState*, const JSC::Identifier void setJSDOMWindowWorkerConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowSharedWorkerConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); void setJSDOMWindowSharedWorkerConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); -JSC::JSValue jsDOMWindowWebSocketConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); -void setJSDOMWindowWebSocketConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowPluginConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); void setJSDOMWindowPluginConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowPluginArrayConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp b/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp index ee8726a..e67daf9 100644 --- a/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp +++ b/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp @@ -507,7 +507,7 @@ void ScrollView::scrollContents(const IntSize& scrollDelta) hostWindow()->repaint(panScrollIconDirtyRect, true); } - if (canBlitOnScroll() && !rootPreventsBlitting()) { // The main frame can just blit the WebView window + if (canBlitOnScroll()) { // The main frame can just blit the WebView window // FIXME: Find a way to blit subframes without blitting overlapping content hostWindow()->scroll(-scrollDelta, scrollViewRect, clipRect); } else { @@ -597,14 +597,6 @@ void ScrollView::setParent(ScrollView* parentView) if (m_scrollbarsAvoidingResizer && parent()) parent()->adjustScrollbarsAvoidingResizerCount(-m_scrollbarsAvoidingResizer); -#if PLATFORM(QT) - if (m_widgetsPreventingBlitting && parent()) - parent()->adjustWidgetsPreventingBlittingCount(-m_widgetsPreventingBlitting); - - if (m_widgetsPreventingBlitting && parentView) - parentView->adjustWidgetsPreventingBlittingCount(m_widgetsPreventingBlitting); -#endif - Widget::setParent(parentView); if (m_scrollbarsAvoidingResizer && parent()) diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollView.h b/src/3rdparty/webkit/WebCore/platform/ScrollView.h index 1950a54..5dacff5 100644 --- a/src/3rdparty/webkit/WebCore/platform/ScrollView.h +++ b/src/3rdparty/webkit/WebCore/platform/ScrollView.h @@ -305,16 +305,6 @@ private: NSScrollView<WebCoreFrameScrollView>* scrollView() const; #endif -#if PLATFORM(QT) -public: - void adjustWidgetsPreventingBlittingCount(int delta); -private: - bool rootPreventsBlitting() const { return root()->m_widgetsPreventingBlitting > 0; } - unsigned m_widgetsPreventingBlitting; -#else - bool rootPreventsBlitting() const { return false; } -#endif - #if PLATFORM(GTK) public: void setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.cpp b/src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.cpp index f7ebbc7..48bca19 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.cpp @@ -36,7 +36,9 @@ QWebPopup::QWebPopup(PopupMenuClient* client) { Q_ASSERT(m_client); +#if !defined(Q_WS_S60) && !defined(Q_WS_MAEMO_5) setFont(m_client->menuStyle().font().font()); +#endif connect(this, SIGNAL(activated(int)), SLOT(activeChanged(int)), Qt::QueuedConnection); } @@ -44,9 +46,16 @@ QWebPopup::QWebPopup(PopupMenuClient* client) void QWebPopup::exec() { + // QCursor::pos() is not a great idea for a touch screen, but we don't need the coordinates + // as comboboxes with Qt on Maemo 5 come up in their full width on the screen. + // On the other platforms it's okay to use QCursor::pos(). +#if defined(Q_WS_MAEMO_5) + showPopup(); +#else QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(this, &event); +#endif } void QWebPopup::showPopup() diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp index 501a28b..6a1eee8 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp @@ -125,7 +125,6 @@ PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page) RenderThemeQt::RenderThemeQt(Page* page) : RenderTheme() , m_page(page) - , m_fallbackStyle(0) { QPushButton button; button.setAttribute(Qt::WA_MacSmallSize); @@ -135,6 +134,8 @@ RenderThemeQt::RenderThemeQt(Page* page) #ifdef Q_WS_MAC m_buttonFontPixelSize = fontInfo.pixelSize(); #endif + + m_fallbackStyle = QStyleFactory::create(QLatin1String("windows")); } RenderThemeQt::~RenderThemeQt() @@ -143,19 +144,17 @@ RenderThemeQt::~RenderThemeQt() } // for some widget painting, we need to fallback to Windows style -QStyle* RenderThemeQt::fallbackStyle() +QStyle* RenderThemeQt::fallbackStyle() const { - if (!m_fallbackStyle) - m_fallbackStyle = QStyleFactory::create(QLatin1String("windows")); - - if (!m_fallbackStyle) - m_fallbackStyle = QApplication::style(); - - return m_fallbackStyle; + return (m_fallbackStyle) ? m_fallbackStyle : QApplication::style(); } QStyle* RenderThemeQt::qStyle() const { +#ifdef Q_WS_MAEMO_5 + return fallbackStyle(); +#endif + if (m_page) { ChromeClientQt* client = static_cast<ChromeClientQt*>(m_page->chrome()->client()); @@ -758,6 +757,10 @@ ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con if (result == RadioPart || result == CheckboxPart) option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off); +#ifdef Q_WS_MAEMO_5 + static QPalette lightGrayPalette(Qt::lightGray); + option.palette = lightGrayPalette; +#else // If the owner widget has a custom palette, use it Page* page = o->document()->page(); if (page) { @@ -766,6 +769,7 @@ ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con if (pageClient) option.palette = pageClient->palette(); } +#endif return result; } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h index 617c875..19337ac 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h @@ -138,7 +138,7 @@ private: void setPopupPadding(RenderStyle*) const; QStyle* qStyle() const; - QStyle* fallbackStyle(); + QStyle* fallbackStyle() const; Page* m_page; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ScrollViewQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/ScrollViewQt.cpp index ccbd751..17ad253 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ScrollViewQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/ScrollViewQt.cpp @@ -36,32 +36,19 @@ namespace WebCore { void ScrollView::platformInit() { - m_widgetsPreventingBlitting = 0; } void ScrollView::platformDestroy() { } -// Windowed plugins are using native windows and are thus preventing -// us from doing any kind of scrolling optimization. - -void ScrollView::adjustWidgetsPreventingBlittingCount(int delta) -{ - m_widgetsPreventingBlitting += delta; - if (parent()) - parent()->adjustWidgetsPreventingBlittingCount(delta); -} - void ScrollView::platformAddChild(Widget*) { - adjustWidgetsPreventingBlittingCount(1); } void ScrollView::platformRemoveChild(Widget* child) { child->hide(); - adjustWidgetsPreventingBlittingCount(-1); } } diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp index e61736b..476ab8a 100644 --- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp @@ -126,6 +126,10 @@ void PluginView::updatePluginWidget() // scroll, we need to move/resize immediately. if (!m_windowRect.intersects(frameView->frameRect())) setNPWindowIfNeeded(); + + // Make sure we get repainted afterwards. This is necessary for downward + // scrolling to move the plugin widget properly. + invalidate(); } void PluginView::setFocus() @@ -657,7 +661,8 @@ NPError PluginView::getValue(NPNVariable variable, void* value) void PluginView::invalidateRect(const IntRect& rect) { if (m_isWindowed) { - platformWidget()->update(rect); + if (platformWidget()) + platformWidget()->update(rect); return; } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index 1d4b46f..79538ff 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -57,6 +57,106 @@ void QWebViewPrivate::_q_pageDestroyed() view->setPage(0); } +#ifdef Q_WS_MAEMO_5 +#include "qabstractkineticscroller.h" + +class QWebViewKineticScroller : public QAbstractKineticScroller { +public: + QWebViewKineticScroller() : QAbstractKineticScroller() {} + // remember the frame where the button was pressed + bool eventFilter(QObject* o, QEvent* ev) + { + switch (ev->type()) { + case QEvent::MouseButtonPress: { + QWebFrame* hitFrame = scrollingFrameAt(static_cast<QMouseEvent*>(ev)->pos()); + if (hitFrame) + m_frame = hitFrame; + break; + } + default: + break; + } + return QAbstractKineticScroller::eventFilter(o, ev); + } + +protected: + QWebFrame* currentFrame() const + { + if (!m_frame.isNull()) + return m_frame.data(); + + QWebView* view = static_cast<QWebView*>(widget()); + QWebFrame* frame = view->page()->mainFrame(); + return frame; + } + + // Returns the innermost frame at the given position that can scroll. + QWebFrame* scrollingFrameAt(const QPoint& pos) const + { + QWebView* view = static_cast<QWebView*>(widget()); + QWebFrame* mainFrame = view->page()->mainFrame(); + QWebFrame* hitFrame = mainFrame->hitTestContent(pos).frame(); + QSize range = hitFrame->contentsSize() - hitFrame->geometry().size(); + + while (hitFrame && range.width() <= 1 && range.height() <= 1) + hitFrame = hitFrame->parentFrame(); + + return hitFrame; + } + + void attachToWidget() + { + QWebView* view = static_cast<QWebView*>(widget()); + QWebFrame* mainFrame = view->page()->mainFrame(); + m_oldHorizontalScrollBarPolicy = mainFrame->scrollBarPolicy(Qt::Horizontal); + m_oldVerticalScrollBarPolicy = mainFrame->scrollBarPolicy(Qt::Vertical); + mainFrame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); + mainFrame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); + view->installEventFilter(this); + } + + void removeFromWidget() + { + QWebView* view = static_cast<QWebView*>(widget()); + view->removeEventFilter(this); + QWebFrame* mainFrame = view->page()->mainFrame(); + mainFrame->setScrollBarPolicy(Qt::Vertical, m_oldVerticalScrollBarPolicy); + mainFrame->setScrollBarPolicy(Qt::Horizontal, m_oldHorizontalScrollBarPolicy); + } + + QRect positionRange() const + { + QRect r; + QWebFrame* frame = currentFrame(); + r.setSize(frame->contentsSize() - frame->geometry().size()); + return r; + } + + QPoint position() const + { + QWebFrame* frame = currentFrame(); + return frame->scrollPosition(); + } + + QSize viewportSize() const + { + return static_cast<QWebView*>(widget())->page()->viewportSize(); + } + + void setPosition(const QPoint& point, const QPoint& /* overShootDelta */) + { + QWebFrame* frame = currentFrame(); + frame->setScrollPosition(point); + } + + QPointer<QWebFrame> m_frame; + Qt::ScrollBarPolicy m_oldVerticalScrollBarPolicy; + Qt::ScrollBarPolicy m_oldHorizontalScrollBarPolicy; +}; + +#endif // Q_WS_MAEMO_5 + + /*! \class QWebView \since 4.4 @@ -153,6 +253,10 @@ QWebView::QWebView(QWidget *parent) setAttribute(Qt::WA_InputMethodEnabled); #endif +#if defined(Q_WS_MAEMO_5) + QAbstractKineticScroller* scroller = new QWebViewKineticScroller(); + scroller->setWidget(this); +#endif setAcceptDrops(true); setMouseTracking(true); diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 09acd47..1026ac5 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,98 @@ +2010-01-28 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Do not set the combobox font on Maemo5 and S60; use the + default instead. + + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopup::populate): + +2010-01-28 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Support kinetic scrolling on Maemo 5 + + https://bugs.webkit.org/show_bug.cgi?id=34267 + + Patch by Ralf Engels <ralf.engels@nokia.com> and + Robert Griebl <rgriebl@trolltech.com> + + * Api/qwebview.cpp: + (QWebViewKineticScroller::QWebViewKineticScroller): + (QWebViewKineticScroller::eventFilter): + (QWebViewKineticScroller::currentFrame): + (QWebViewKineticScroller::scrollingFrameAt): + (QWebViewKineticScroller::attachToWidget): + (QWebViewKineticScroller::removeFromWidget): + (QWebViewKineticScroller::positionRange): + (QWebViewKineticScroller::position): + (QWebViewKineticScroller::viewportSize): + (QWebViewKineticScroller::setPosition): + (QWebView::QWebView): + +2010-01-29 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann + + Disable auto-uppercase and predictive text on Maemo5, just like the + build-in MicroB Browser. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + +2010-01-28 Trond Kjernåsen <trond@trolltech.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix for endless print loop when printing web pages + + * Api/qwebframe.cpp: + (QWebFrame::print): + +2010-01-26 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Show comboboxes on Maemo 5 + https://bugs.webkit.org/show_bug.cgi?id=34088 + + Don't try to show the combobox by simulating a mouse event from QCursor::pos() to + get the combobox position right. The position on Maemo 5 is independent from the mouse + and there's no QCursor::pos(). + + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopup::show): + +2010-01-26 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Simon Hausmann. + + [Qt] JavaScript prompt is currently broken + https://bugs.webkit.org/show_bug.cgi?id=30914 + + In r52152 a patch was landed to convert a null QString + to an empty WebCore::String in case the prompt was accepted + but the default implementation returned the null QString. + + The patch tried to avoid assign to result twice and + was not checking the QString if it is null but the default + value. This lead to always returning an empty string on + successful prompts. Fix it by checking the variable 'x' + for isNull. + + The manual test case used didn't cover the case of non + empty input, replace it with an automatic test case that + should cover all cases. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::runJavaScriptPrompt): Fix the bug. + * tests/qwebpage/tst_qwebpage.cpp: Add automatic test case + (JSPromptPage::JSPromptPage): + (JSPromptPage::javaScriptPrompt): + (tst_QWebPage::testJSPrompt): + 2010-01-25 Janne Koskinen <janne.p.koskinen@digia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index c5d2792..0c5df4a 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -281,7 +281,7 @@ bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const // Fix up a quirk in the QInputDialog class. If no input happened the string should be empty // but it is null. See https://bugs.webkit.org/show_bug.cgi?id=30914. - if (rc && result.isNull()) + if (rc && x.isNull()) result = String(""); else result = x; diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 34241f0..2d1a1eb 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -615,7 +615,12 @@ void EditorClientQt::setInputMethodState(bool active) } } webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField); -#endif +#ifdef Q_WS_MAEMO_5 + // Maemo 5 MicroB Browser disables auto-uppercase and predictive text, thus, so do we. + webPageClient->setInputMethodHint(Qt::ImhNoAutoUppercase, true); + webPageClient->setInputMethodHint(Qt::ImhNoPredictiveText, true); +#endif // Q_WS_MAEMO_5 +#endif // QT_VERSION check webPageClient->setInputMethodEnabled(active); } emit m_page->microFocusChanged(); diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index ee1969d..0e04acc 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1,6 +1,7 @@ /* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> + Copyright (C) 2010 Holger Hans Peter Freyther This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -154,6 +155,7 @@ private slots: void screenshot(); void originatingObjectInNetworkRequests(); + void testJSPrompt(); private: QWebView* m_view; @@ -1781,5 +1783,72 @@ void tst_QWebPage::originatingObjectInNetworkRequests() #endif } +/** + * Test fixups for https://bugs.webkit.org/show_bug.cgi?id=30914 + * + * From JS we test the following conditions. + * + * OK + QString() => SUCCESS, empty string (but not null) + * OK + "text" => SUCCESS, "text" + * CANCEL + QString() => CANCEL, null string + * CANCEL + "text" => CANCEL, null string + */ +class JSPromptPage : public QWebPage { + Q_OBJECT +public: + JSPromptPage() + {} + + bool javaScriptPrompt(QWebFrame* frame, const QString& msg, const QString& defaultValue, QString* result) + { + if (msg == QLatin1String("test1")) { + *result = QString(); + return true; + } else if (msg == QLatin1String("test2")) { + *result = QLatin1String("text"); + return true; + } else if (msg == QLatin1String("test3")) { + *result = QString(); + return false; + } else if (msg == QLatin1String("test4")) { + *result = QLatin1String("text"); + return false; + } + + qFatal("Unknown msg."); + return QWebPage::javaScriptPrompt(frame, msg, defaultValue, result); + } +}; + +void tst_QWebPage::testJSPrompt() +{ + JSPromptPage page; + bool res; + + // OK + QString() + res = page.mainFrame()->evaluateJavaScript( + "var retval = prompt('test1');" + "retval=='' && retval.length == 0;").toBool(); + QVERIFY(res); + + // OK + "text" + res = page.mainFrame()->evaluateJavaScript( + "var retval = prompt('test2');" + "retval=='text' && retval.length == 4;").toBool(); + QVERIFY(res); + + // Cancel + QString() + res = page.mainFrame()->evaluateJavaScript( + "var retval = prompt('test3');" + "retval===null;").toBool(); + QVERIFY(res); + + // Cancel + "text" + res = page.mainFrame()->evaluateJavaScript( + "var retval = prompt('test4');" + "retval===null;").toBool(); + QVERIFY(res); +} + QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 38e1886..177bee4 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -497,6 +497,9 @@ public: WA_WState_AcceptedTouchBeginEvent = 122, WA_TouchPadAcceptSingleTouchEvents = 123, + WA_MergeSoftkeys = 124, + WA_MergeSoftkeysRecursively = 125, + // Add new attributes before this line WA_AttributeCount }; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 871dd5c..6627c76 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -524,11 +524,11 @@ receiver are in the same thread. Same as QueuedConnection, if the emitter and receiver are in different threads. - \value DirectConnection + \value DirectConnection The slot is invoked immediately, when the signal is emitted. - \value QueuedConnection + \value QueuedConnection The slot is invoked when control returns to the event loop of the receiver's thread. The slot is executed in the receiver's thread. @@ -1243,6 +1243,17 @@ \value WA_TouchPadAcceptSingleTouchEvents Allows touchpad single touch events to be sent to the widget. + \value WA_MergeSoftkeys Allows widget to merge softkeys with parent widget, + i.e. widget can set only one softkeys and request softkey implementation + to take rest of the softkeys from the parent. Note parents are traversed until + WA_MergeSoftkeys is not set. See also Qt::WA_MergeSoftkeysRecursively + This attribute currently has effect only on Symbian platforms + + \value WA_MergeSoftkeysRecursively Allows widget to merge softkeys recursively + with all parents. If this attribute is set, the widget parents are traversed until + window boundary (widget without parent or dialog) is found. + This attribute currently has effect only on Symbian platforms + \omitvalue WA_SetLayoutDirection \omitvalue WA_InputMethodTransparent \omitvalue WA_WState_CompressKeys diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 1c68716..bc68599 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -83,7 +83,7 @@ public: if(stream->message_output) { QT_TRY { qt_message_output(stream->type, stream->buffer.toLocal8Bit().data()); - } QT_CATCH(std::bad_alloc) { /* We're out of memory - give up. */ } + } QT_CATCH(std::bad_alloc&) { /* We're out of memory - give up. */ } } delete stream; } diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 722d6d3..9179485 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -98,7 +98,7 @@ static inline QByteArray openModeToFopenMode(QIODevice::OpenMode flags, const QS if (!fileName.isEmpty() && QT_STAT(QFile::encodeName(fileName), &statBuf) == 0 && (statBuf.st_mode & S_IFMT) == S_IFREG) { - mode += "+"; + mode += '+'; } else { mode = "wb+"; } diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp index ddced73..75cde51 100644 --- a/src/corelib/io/qprocess_symbian.cpp +++ b/src/corelib/io/qprocess_symbian.cpp @@ -919,34 +919,41 @@ bool QProcessPrivate::waitForFinished(int msecs) Q_Q(QProcess); QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished(%d)", msecs); - TRequestStatus timerStatus = 0; - TRequestStatus logonStatus = 0; + TRequestStatus timerStatus = KErrNone; + TRequestStatus logonStatus = KErrNone; bool timeoutOccurred = false; // Logon to process to observe its death if (qt_rprocess_running(symbianProcess)) { symbianProcess->Logon(logonStatus); - // Create timer - RTimer timer; - timer.CreateLocal(); - TTimeIntervalMicroSeconds32 interval(msecs*1000); - timer.After(timerStatus, interval); + if (msecs < 0) { + // If timeout is negative, there is no timeout + QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Waiting (just logon)..."); + User::WaitForRequest(logonStatus); + QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed"); + } else { + // Create timer + RTimer timer; + timer.CreateLocal(); + TTimeIntervalMicroSeconds32 interval(msecs*1000); + timer.After(timerStatus, interval); - QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Waiting..."); - User::WaitForRequest(logonStatus, timerStatus); - QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed"); + QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Waiting (logon + timer)..."); + User::WaitForRequest(logonStatus, timerStatus); + QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed"); - if (timerStatus == KErrNone) - timeoutOccurred = true; + if (timerStatus == KErrNone) + timeoutOccurred = true; - timer.Cancel(); - timer.Close(); + timer.Cancel(); + timer.Close(); - symbianProcess->LogonCancel(logonStatus); + symbianProcess->LogonCancel(logonStatus); - // Eat cancel request completion so that it won't mess up main thread scheduling later - User::WaitForRequest(logonStatus, timerStatus); + // Eat cancel request completion so that it won't mess up main thread scheduling later + User::WaitForRequest(logonStatus, timerStatus); + } } else { QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished(), qt_rprocess_running returned false"); } diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 005dedc..e3137f0 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2267,6 +2267,10 @@ QStringList QCoreApplication::libraryPaths() \a paths. All existing paths will be deleted and the path list will consist of the paths given in \a paths. + In Symbian this function is only useful for setting paths for + finding Qt extension plugin stubs, since the OS can only + load libraries from the \c{/sys/bin} directory. + \sa libraryPaths(), addLibraryPath(), removeLibraryPath(), QLibrary */ void QCoreApplication::setLibraryPaths(const QStringList &paths) @@ -2290,6 +2294,10 @@ void QCoreApplication::setLibraryPaths(const QStringList &paths) is \c INSTALL/plugins, where \c INSTALL is the directory where Qt was installed. + In Symbian this function is only useful for adding paths for + finding Qt extension plugin stubs, since the OS can only + load libraries from the \c{/sys/bin} directory. + \sa removeLibraryPath(), libraryPaths(), setLibraryPaths() */ void QCoreApplication::addLibraryPath(const QString &path) diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 7112043..f2c2384 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -539,6 +539,7 @@ bool QLibraryPrivate::loadPlugin() \row \i AIX \i \c .a \row \i HP-UX \i \c .sl, \c .so (HP-UXi) \row \i Mac OS X \i \c .dylib, \c .bundle, \c .so + \row \i Symbian \i \c .dll \endtable Trailing versioning numbers on Unix are ignored. diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index b276f0a..37d5b87 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -40,7 +40,9 @@ ****************************************************************************/ //#define WINVER 0x0500 +#if _WIN32_WINNT < 0x0400 #define _WIN32_WINNT 0x0400 +#endif #include "qthread.h" diff --git a/src/gui/dialogs/qprintdialog.h b/src/gui/dialogs/qprintdialog.h index 390a4a0..ecd50c1 100644 --- a/src/gui/dialogs/qprintdialog.h +++ b/src/gui/dialogs/qprintdialog.h @@ -97,9 +97,9 @@ public: void done(int result); #if defined (Q_OS_UNIX) && defined (QT3_SUPPORT) - void setPrinter(QPrinter *, bool = false); - QPrinter *printer() const; - void addButton(QPushButton *button); + QT3_SUPPORT void setPrinter(QPrinter *, bool = false); + QT3_SUPPORT QPrinter *printer() const; + QT3_SUPPORT void addButton(QPushButton *button); #endif void setOption(PrintDialogOption option, bool on = true); diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp index 360ed14..fcc61e5 100644 --- a/src/gui/itemviews/qfileiconprovider.cpp +++ b/src/gui/itemviews/qfileiconprovider.cpp @@ -65,6 +65,7 @@ #ifndef SHGFI_ADDOVERLAYS # define SHGFI_ADDOVERLAYS 0x000000020 +# define SHGFI_OVERLAYINDEX 0x000000040 #endif QT_BEGIN_NAMESPACE @@ -248,7 +249,7 @@ QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const //Get the small icon #ifndef Q_OS_WINCE val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, - sizeof(SHFILEINFO), SHGFI_ICON|SHGFI_SMALLICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS); + sizeof(SHFILEINFO), SHGFI_ICON|SHGFI_SMALLICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX); #else val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_SYSICONINDEX); @@ -287,7 +288,7 @@ QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const //Get the big icon #ifndef Q_OS_WINCE val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, - sizeof(SHFILEINFO), SHGFI_ICON|SHGFI_LARGEICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS); + sizeof(SHFILEINFO), SHGFI_ICON|SHGFI_LARGEICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX); #else val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, sizeof(SHFILEINFO), SHGFI_LARGEICON|SHGFI_SYSICONINDEX); diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index f2bd288..0993b86 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -7,7 +7,7 @@ PRECOMPILED_HEADER = kernel/qt_gui_pch.h KERNEL_P= kernel HEADERS += \ kernel/qaction.h \ - kernel/qaction_p.h \ + kernel/qaction_p.h \ kernel/qactiongroup.h \ kernel/qapplication.h \ kernel/qapplication_p.h \ @@ -37,8 +37,8 @@ HEADERS += \ kernel/qstackedlayout.h \ kernel/qtooltip.h \ kernel/qwhatsthis.h \ - kernel/qwidget.h \ - kernel/qwidget_p.h \ + kernel/qwidget.h \ + kernel/qwidget_p.h \ kernel/qwidgetaction.h \ kernel/qwidgetaction_p.h \ kernel/qwindowdefs.h \ @@ -49,6 +49,7 @@ HEADERS += \ kernel/qgesturerecognizer.h \ kernel/qgesturemanager_p.h \ kernel/qsoftkeymanager_p.h \ + kernel/qsoftkeymanager_common_p.h \ kernel/qguiplatformplugin_p.h SOURCES += \ @@ -84,14 +85,14 @@ SOURCES += \ kernel/qgesturerecognizer.cpp \ kernel/qgesturemanager.cpp \ kernel/qsoftkeymanager.cpp \ - kernel/qdesktopwidget.cpp \ + kernel/qdesktopwidget.cpp \ kernel/qguiplatformplugin.cpp win32 { DEFINES += QT_NO_DIRECTDRAW - HEADERS += \ - kernel/qwinnativepangesturerecognizer_win_p.h + HEADERS += \ + kernel/qwinnativepangesturerecognizer_win_p.h SOURCES += \ kernel/qapplication_win.cpp \ @@ -103,30 +104,34 @@ win32 { kernel/qsound_win.cpp \ kernel/qwidget_win.cpp \ kernel/qole_win.cpp \ - kernel/qkeymapper_win.cpp \ - kernel/qwinnativepangesturerecognizer_win.cpp + kernel/qkeymapper_win.cpp \ + kernel/qwinnativepangesturerecognizer_win.cpp - !contains(DEFINES, QT_NO_DIRECTDRAW):LIBS += ddraw.lib + !contains(DEFINES, QT_NO_DIRECTDRAW):LIBS += ddraw.lib } symbian { - SOURCES += \ - kernel/qapplication_s60.cpp \ - kernel/qeventdispatcher_s60.cpp \ - kernel/qwidget_s60.cpp \ - kernel/qcursor_s60.cpp \ - kernel/qdesktopwidget_s60.cpp \ - kernel/qkeymapper_s60.cpp\ - kernel/qclipboard_s60.cpp\ - kernel/qdnd_s60.cpp \ - kernel/qsound_s60.cpp + SOURCES += \ + kernel/qapplication_s60.cpp \ + kernel/qeventdispatcher_s60.cpp \ + kernel/qwidget_s60.cpp \ + kernel/qcursor_s60.cpp \ + kernel/qdesktopwidget_s60.cpp \ + kernel/qkeymapper_s60.cpp\ + kernel/qclipboard_s60.cpp\ + kernel/qdnd_s60.cpp \ + kernel/qsound_s60.cpp \ + kernel/qsoftkeymanager_s60.cpp - HEADERS += \ - kernel/qt_s60_p.h \ - kernel/qeventdispatcher_s60_p.h - LIBS += -lbafl -lestor + HEADERS += \ + kernel/qt_s60_p.h \ + kernel/qeventdispatcher_s60_p.h \ + kernel/qsoftkeymanager_s60_p.h + + LIBS += -lbafl -lestor - INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += ../3rdparty/s60 } diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index f61d2fe..d255604 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -644,6 +644,8 @@ extern "C" { - (void)mouseEntered:(NSEvent *)event { + if (qwidgetprivate->data.in_destructor) + return; QEvent enterEvent(QEvent::Enter); NSPoint windowPoint = [event locationInWindow]; NSPoint globalPoint = [[event window] convertBaseToScreen:windowPoint]; diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 354f90b..6d108b0 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -41,34 +41,18 @@ #include "qapplication.h" #include "qevent.h" -#ifdef Q_WS_S60 -#include "qstyle.h" -#include "private/qt_s60_p.h" -#endif +#include "qbitmap.h" #include "private/qsoftkeymanager_p.h" #include "private/qobject_p.h" - -#ifndef QT_NO_SOFTKEYMANAGER -QT_BEGIN_NAMESPACE +#include "private/qsoftkeymanager_common_p.h" #ifdef Q_WS_S60 -static const int s60CommandStart = 6000; +#include "private/qsoftkeymanager_s60_p.h" #endif -class QSoftKeyManagerPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QSoftKeyManager) - -public: - static void updateSoftKeys_sys(const QList<QAction*> &softKeys); - -private: - QHash<QAction*, Qt::Key> keyedActions; - static QSoftKeyManager *self; - static QWidget *softKeySource; -}; +#ifndef QT_NO_SOFTKEYMANAGER +QT_BEGIN_NAMESPACE -QWidget *QSoftKeyManagerPrivate::softKeySource = 0; QSoftKeyManager *QSoftKeyManagerPrivate::self = 0; const char *QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey) @@ -105,7 +89,12 @@ QSoftKeyManager *QSoftKeyManager::instance() return QSoftKeyManagerPrivate::self; } -QSoftKeyManager::QSoftKeyManager() : QObject(*(new QSoftKeyManagerPrivate), 0) +QSoftKeyManager::QSoftKeyManager() : +#ifdef Q_WS_S60 + QObject(*(new QSoftKeyManagerPrivateS60), 0) +#else + QObject(*(new QSoftKeyManagerPrivate), 0) +#endif { } @@ -115,10 +104,11 @@ QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *act QAction *action = new QAction(QSoftKeyManager::tr(text), actionWidget); QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey; switch (standardKey) { + case MenuSoftKey: // FALL-THROUGH + action->setProperty(MENU_ACTION_PROPERTY, QVariant(true)); // TODO: can be refactored away to use _q_action_menubar case OkSoftKey: case SelectSoftKey: case DoneSoftKey: - case MenuSoftKey: softKeyRole = QAction::PositiveSoftKey; break; case CancelSoftKey: @@ -147,7 +137,7 @@ QAction *QSoftKeyManager::createKeyedAction(StandardSoftKey standardKey, Qt::Key #endif //QT_NO_ACTION } -void QSoftKeyManager::cleanupHash(QObject* obj) +void QSoftKeyManager::cleanupHash(QObject *obj) { Q_D(QSoftKeyManager); QAction *action = qobject_cast<QAction*>(obj); @@ -175,137 +165,78 @@ void QSoftKeyManager::updateSoftKeys() QApplication::postEvent(QSoftKeyManager::instance(), event); } -bool QSoftKeyManager::event(QEvent *e) +bool QSoftKeyManager::appendSoftkeys(const QWidget &source, int level) { -#ifndef QT_NO_ACTION - if (e->type() == QEvent::UpdateSoftKeys) { - QList<QAction*> softKeys; - QWidget *source = QApplication::focusWidget(); - do { - if (source) { - QList<QAction*> actions = source->actions(); - for (int i = 0; i < actions.count(); ++i) { - if (actions.at(i)->softKeyRole() != QAction::NoSoftKey) - softKeys.append(actions.at(i)); - } - - QWidget *parent = source->parentWidget(); - if (parent && softKeys.isEmpty() && !source->isWindow()) - source = parent; - else - break; - } else { - source = QApplication::activeWindow(); - } - } while (source); - - QSoftKeyManagerPrivate::softKeySource = source; - QSoftKeyManagerPrivate::updateSoftKeys_sys(softKeys); - return true; + Q_D(QSoftKeyManager); + bool ret = false; + QList<QAction*> actions = source.actions(); + for (int i = 0; i < actions.count(); ++i) { + if (actions.at(i)->softKeyRole() != QAction::NoSoftKey) { + d->requestedSoftKeyActions.insert(level, actions.at(i)); + ret = true; + } } -#endif //QT_NO_ACTION - return false; + return ret; } -#ifdef Q_WS_S60 -void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys) +QWidget *QSoftKeyManager::softkeySource(QWidget *previousSource, bool& recursiveMerging) { - // lets not update softkeys if s60 native dialog or menu is shown - if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) - || CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) - return; - - CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer(); - nativeContainer->DrawableWindow()->SetOrdinalPosition(0); - nativeContainer->DrawableWindow()->SetPointerCapturePriority(1); //keep softkeys available in modal dialog - nativeContainer->DrawableWindow()->SetFaded(EFalse, RWindowTreeNode::EFadeIncludeChildren); - - int position = -1; - bool needsExitButton = true; - QT_TRAP_THROWING( - //Using -1 instead of EAknSoftkeyEmpty to avoid flickering. - nativeContainer->SetCommandL(0, -1, KNullDesC); - nativeContainer->SetCommandL(2, -1, KNullDesC); - ); - - for (int index = 0; index < softkeys.count(); index++) { - const QAction* softKeyAction = softkeys.at(index); - switch (softKeyAction->softKeyRole()) { - // Positive Actions on the LSK - case QAction::PositiveSoftKey: - position = 0; - break; - case QAction::SelectSoftKey: - position = 0; - break; - // Negative Actions on the RSK - case QAction::NegativeSoftKey: - needsExitButton = false; - position = 2; - break; - default: - break; - } - - int command = (softKeyAction->objectName().contains(QLatin1String("_q_menuSoftKeyAction"))) - ? EAknSoftkeyOptions - : s60CommandStart + index; - - // _q_menuSoftKeyAction action is set to "invisible" and all invisible actions are by default - // disabled. However we never want to dim options softkey, even it is set to "invisible" - bool dimmed = (command == EAknSoftkeyOptions) ? false : !softKeyAction->isEnabled(); - - if (position != -1) { - const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut); - QString iconText = softKeyAction->iconText(); - TPtrC text = qt_QString2TPtrC( underlineShortCut ? softKeyAction->text() : iconText); - QT_TRAP_THROWING( - nativeContainer->SetCommandL(position, command, text); - nativeContainer->DimCommand(command, dimmed); - ); - } + Q_D(QSoftKeyManager); + QWidget *source = NULL; + if (!previousSource) { + // Initial source is primarily focuswidget and secondarily activeWindow + source = QApplication::focusWidget(); + if (!source) + source = QApplication::activeWindow(); + } else { + // Softkey merging is based on four criterias + // 1. Implicit merging is used whenever focus widget does not specify any softkeys + bool implicitMerging = d->requestedSoftKeyActions.isEmpty(); + // 2. Explicit merging with parent is used whenever WA_MergeSoftkeys widget attribute is set + bool explicitMerging = previousSource->testAttribute(Qt::WA_MergeSoftkeys); + // 3. Explicit merging with all parents + recursiveMerging |= previousSource->testAttribute(Qt::WA_MergeSoftkeysRecursively); + // 4. Implicit and explicit merging always stops at window boundary + bool merging = (implicitMerging || explicitMerging || recursiveMerging) && !previousSource->isWindow(); + + source = merging ? previousSource->parentWidget() : NULL; } - - const Qt::WindowType sourceWindowType = QSoftKeyManagerPrivate::softKeySource - ? QSoftKeyManagerPrivate::softKeySource->window()->windowType() - : Qt::Widget; - - if (needsExitButton && sourceWindowType != Qt::Dialog && sourceWindowType != Qt::Popup) - QT_TRAP_THROWING( - nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QSoftKeyManager::tr("Exit")))); - - nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation + return source; } -bool QSoftKeyManager::handleCommand(int command) +bool QSoftKeyManager::handleUpdateSoftKeys() { - if (command >= s60CommandStart && QSoftKeyManagerPrivate::softKeySource) { - int index = command - s60CommandStart; - const QList<QAction*>& softKeys = QSoftKeyManagerPrivate::softKeySource->actions(); - for (int i = 0, j = 0; i < softKeys.count(); ++i) { - QAction *action = softKeys.at(i); - if (action->softKeyRole() != QAction::NoSoftKey) { - if (j == index) { - QWidget *parent = action->parentWidget(); - if (parent && parent->isEnabled()) { - action->activate(QAction::Trigger); - return true; - } - } - j++; - } + Q_D(QSoftKeyManager); + int level = 0; + d->requestedSoftKeyActions.clear(); + bool recursiveMerging = false; + QWidget *source = softkeySource(NULL, recursiveMerging); + do { + if (source) { + bool added = appendSoftkeys(*source, level); + source = softkeySource(source, recursiveMerging); + level = added ? ++level : level; } - } + } while (source); - return false; + d->updateSoftKeys_sys(); + return true; } -#else - -void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &) +bool QSoftKeyManager::event(QEvent *e) { +#ifndef QT_NO_ACTION + if (e->type() == QEvent::UpdateSoftKeys) + return handleUpdateSoftKeys(); +#endif //QT_NO_ACTION + return false; } +#ifdef Q_WS_S60 +bool QSoftKeyManager::handleCommand(int command) +{ + return static_cast<QSoftKeyManagerPrivateS60*>(QSoftKeyManager::instance()->d_func())->handleCommand(command); +} #endif QT_END_NAMESPACE diff --git a/src/gui/kernel/qsoftkeymanager_common_p.h b/src/gui/kernel/qsoftkeymanager_common_p.h new file mode 100644 index 0000000..460d0dc --- /dev/null +++ b/src/gui/kernel/qsoftkeymanager_common_p.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSOFTKEYMANAGER_COMMON_P_H +#define QSOFTKEYMANAGER_COMMON_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_HEADER + +#ifndef QT_NO_SOFTKEYMANAGER + +QT_BEGIN_NAMESPACE + +class QSoftKeyManagerPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QSoftKeyManager) + +public: + virtual void updateSoftKeys_sys() {}; + +protected: + static QSoftKeyManager *self; + QHash<QAction*, Qt::Key> keyedActions; + QMultiHash<int, QAction*> requestedSoftKeyActions; + +}; + +QT_END_NAMESPACE + +#endif //QT_NO_SOFTKEYMANAGER + +QT_END_HEADER + +#endif // QSOFTKEYMANAGER_COMMON_P_H
\ No newline at end of file diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/gui/kernel/qsoftkeymanager_p.h index c901a29..ce902fe 100644 --- a/src/gui/kernel/qsoftkeymanager_p.h +++ b/src/gui/kernel/qsoftkeymanager_p.h @@ -63,6 +63,8 @@ QT_BEGIN_NAMESPACE class QSoftKeyManagerPrivate; +const char MENU_ACTION_PROPERTY[] = "_q_menuaction"; + class Q_AUTOTEST_EXPORT QSoftKeyManager : public QObject { Q_OBJECT @@ -79,26 +81,30 @@ public: }; static void updateSoftKeys(); - static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget); - static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget); - #ifdef Q_WS_S60 static bool handleCommand(int); #endif -private: - QSoftKeyManager(); - static QSoftKeyManager *instance(); - static const char *standardSoftKeyText(StandardSoftKey standardKey); + static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget); + static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget); protected: bool event(QEvent *e); - Q_DISABLE_COPY(QSoftKeyManager) +private: + QSoftKeyManager(); + static QSoftKeyManager *instance(); + static const char *standardSoftKeyText(StandardSoftKey standardKey); + bool appendSoftkeys(const QWidget &source, int level); + QWidget *softkeySource(QWidget *previousSource, bool& recursiveMerging); + bool handleUpdateSoftKeys(); private Q_SLOTS: void cleanupHash(QObject* obj); void sendKeyEvent(); + +private: + Q_DISABLE_COPY(QSoftKeyManager) }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp new file mode 100644 index 0000000..67ed8b0 --- /dev/null +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -0,0 +1,366 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qapplication.h" +#include "qevent.h" +#include "qbitmap.h" +#include "qstyle.h" +#include "qmenubar.h" +#include "private/qt_s60_p.h" +#include "private/qmenu_p.h" +#include "private/qsoftkeymanager_p.h" +#include "private/qsoftkeymanager_s60_p.h" +#include "private/qobject_p.h" +//#include <eiksoftkeyimage.h> +#include <eikcmbut.h> + +#ifndef QT_NO_SOFTKEYMANAGER +QT_BEGIN_NAMESPACE + +const int S60_COMMAND_START = 6000; +const int LSK_POSITION = 0; +const int MSK_POSITION = 3; +const int RSK_POSITION = 2; + +QSoftKeyManagerPrivateS60::QSoftKeyManagerPrivateS60() +{ + cachedCbaIconSize[0] = QSize(0,0); + cachedCbaIconSize[1] = QSize(0,0); + skipNextUpdate = false; +} + +bool QSoftKeyManagerPrivateS60::skipCbaUpdate() +{ + // lets not update softkeys if + // 1. We don't have application panes, i.e. cba + // 2. S60 native dialog or menu is shown + if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) || + CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || skipNextUpdate) { + skipNextUpdate = false; + return true; + } + return false; +} + +void QSoftKeyManagerPrivateS60::ensureCbaVisibilityAndResponsiviness(CEikButtonGroupContainer &cba) +{ + RDrawableWindow *cbaWindow = cba.DrawableWindow(); + Q_ASSERT_X(cbaWindow, Q_FUNC_INFO, "Native CBA does not have window!"); + // Make sure CBA is visible, i.e. CBA window is on top + cbaWindow->SetOrdinalPosition(0); + // Qt shares same CBA instance between top-level widgets, + // make sure we are not faded by underlying window. + cbaWindow->SetFaded(EFalse, RWindowTreeNode::EFadeIncludeChildren); + // Modal dialogs capture pointer events, but shared cba instance + // shall stay responsive. Raise pointer capture priority to keep + // softkeys responsive in modal dialogs + cbaWindow->SetPointerCapturePriority(1); +} + +void QSoftKeyManagerPrivateS60::clearSoftkeys(CEikButtonGroupContainer &cba) +{ + QT_TRAP_THROWING( + //Using -1 instead of EAknSoftkeyEmpty to avoid flickering. + cba.SetCommandL(0, -1, KNullDesC); + // TODO: Should we clear also middle SK? + cba.SetCommandL(2, -1, KNullDesC); + ); + realSoftKeyActions.clear(); +} + +QString QSoftKeyManagerPrivateS60::softkeyText(QAction &softkeyAction) +{ + // In S60 softkeys and menu items do not support key accelerators (i.e. + // CTRL+X). Therefore, removing the accelerator characters from both softkey + // and menu item texts. + const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut); + QString iconText = softkeyAction.iconText(); + return underlineShortCut ? softkeyAction.text() : iconText; +} + +QAction *QSoftKeyManagerPrivateS60::highestPrioritySoftkey(QAction::SoftKeyRole role) +{ + QAction *ret = NULL; + // Priority look up is two level + // 1. First widget with softkeys always has highest priority + for (int level = 0; !ret; level++) { + // 2. Highest priority action within widget + QList<QAction*> actions = requestedSoftKeyActions.values(level); + if (actions.isEmpty()) + break; + qSort(actions.begin(), actions.end(), QSoftKeyManagerPrivateS60::actionPriorityMoreThan); + foreach (QAction *action, actions) { + if (action->softKeyRole() == role) { + ret = action; + break; + } + } + } + return ret; +} + +bool QSoftKeyManagerPrivateS60::actionPriorityMoreThan(const QAction *firstItem, const QAction *secondItem) +{ + return firstItem->priority() > secondItem->priority(); +} + +void QSoftKeyManagerPrivateS60::setNativeSoftkey(CEikButtonGroupContainer &cba, + TInt position, TInt command, const TDesC &text) +{ + // Calling SetCommandL causes CBA redraw + QT_TRAP_THROWING(cba.SetCommandL(position, command, text)); +} + +bool QSoftKeyManagerPrivateS60::isOrientationLandscape() +{ + // Hard to believe that there is no public API in S60 to + // get current orientation. This workaround works with currently supported resolutions + return S60->screenHeightInPixels < S60->screenWidthInPixels; +} + +QSize QSoftKeyManagerPrivateS60::cbaIconSize(CEikButtonGroupContainer *cba, int position) +{ + Q_UNUSED(cba); + Q_UNUSED(position); + + // Will be implemented when EikSoftkeyImage usage license wise is OK +/* + const int index = isOrientationLandscape() ? 0 : 1; + if(cachedCbaIconSize[index].isNull()) { + // Only way I figured out to get CBA icon size without RnD SDK, was + // Only way I figured out to get CBA icon size without RnD SDK, was + // to set some dummy icon to CBA first and then ask CBA button CCoeControl::Size() + // The returned value is cached to avoid unnecessary icon setting every time. + const bool left = (position == LSK_POSITION); + if(position == LSK_POSITION || position == RSK_POSITION) { + CEikImage* tmpImage = NULL; + QT_TRAP_THROWING(tmpImage = new (ELeave) CEikImage); + EikSoftkeyImage::SetImage(cba, *tmpImage, left); // Takes myimage ownership + int command = S60_COMMAND_START + position; + setNativeSoftkey(*cba, position, command, KNullDesC()); + cachedCbaIconSize[index] = qt_TSize2QSize(cba->ControlOrNull(command)->Size()); + EikSoftkeyImage::SetLabel(cba, left); + } + } + + return cachedCbaIconSize[index]; +*/ + return QSize(); +} + +bool QSoftKeyManagerPrivateS60::setSoftkeyImage(CEikButtonGroupContainer *cba, + QAction &action, int position) +{ + bool ret = false; + Q_UNUSED(cba); + Q_UNUSED(action); + Q_UNUSED(position); + + // Will be implemented when EikSoftkeyImage usage license wise is OK + /* + const bool left = (position == LSK_POSITION); + if(position == LSK_POSITION || position == RSK_POSITION) { + QIcon icon = action.icon(); + if (!icon.isNull()) { + QPixmap pm = icon.pixmap(cbaIconSize(cba, position)); + pm = pm.scaled(cbaIconSize(cba, position)); + QBitmap mask = pm.mask(); + if (mask.isNull()) { + mask = QBitmap(pm.size()); + mask.fill(Qt::color1); + } + + CFbsBitmap* nBitmap = pm.toSymbianCFbsBitmap(); + CFbsBitmap* nMask = mask.toSymbianCFbsBitmap(); + + CEikImage* myimage = new (ELeave) CEikImage; + myimage->SetPicture( nBitmap, nMask ); // nBitmap and nMask ownership transfered + + EikSoftkeyImage::SetImage(cba, *myimage, left); // Takes myimage ownership + ret = true; + } else { + // Restore softkey to text based + EikSoftkeyImage::SetLabel(cba, left); + } + } + */ + return ret; +} + +bool QSoftKeyManagerPrivateS60::setSoftkey(CEikButtonGroupContainer &cba, + QAction::SoftKeyRole role, int position) +{ + QAction *action = highestPrioritySoftkey(role); + if (action) { + setSoftkeyImage(&cba, *action, position); + QString text = softkeyText(*action); + TPtrC nativeText = qt_QString2TPtrC(text); + int command = S60_COMMAND_START + position; + setNativeSoftkey(cba, position, command, nativeText); + cba.DimCommand(command, !action->isEnabled()); + realSoftKeyActions.insert(command, action); + return true; + } + return false; +} + +bool QSoftKeyManagerPrivateS60::setLeftSoftkey(CEikButtonGroupContainer &cba) +{ + return setSoftkey(cba, QAction::PositiveSoftKey, LSK_POSITION); +} + +bool QSoftKeyManagerPrivateS60::setMiddleSoftkey(CEikButtonGroupContainer &cba) +{ + // Note: In order to get MSK working, application has to have EAknEnableMSK flag set + // Currently it is not possible very easily) + // For more information see: http://wiki.forum.nokia.com/index.php/Middle_softkey_usage + return setSoftkey(cba, QAction::SelectSoftKey, MSK_POSITION); +} + +bool QSoftKeyManagerPrivateS60::setRightSoftkey(CEikButtonGroupContainer &cba) +{ + if (!setSoftkey(cba, QAction::NegativeSoftKey, RSK_POSITION)) { + Qt::WindowType windowType = Qt::Window; + QAction *action = requestedSoftKeyActions.value(0); + if (action) { + QWidget *actionParent = action->parentWidget(); + Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); + + QWidget *actionWindow = actionParent->window(); + Q_ASSERT_X(actionWindow, Q_FUNC_INFO, "Softkey action does not have window!"); + windowType = actionWindow->windowType(); + } + + if (windowType != Qt::Dialog && windowType != Qt::Popup) { + QString text(QSoftKeyManager::tr("Exit")); + TPtrC nativeText = qt_QString2TPtrC(text); + setNativeSoftkey(cba, RSK_POSITION, EAknSoftkeyExit, nativeText); + return true; + } + } + return false; +} + +void QSoftKeyManagerPrivateS60::setSoftkeys(CEikButtonGroupContainer &cba) +{ + int requestedSoftkeyCount = requestedSoftKeyActions.count(); + const int maxSoftkeyCount = 2; // TODO: differs based on orientation ans S60 versions (some have MSK) + if (requestedSoftkeyCount > maxSoftkeyCount) { + // We have more softkeys than available slots + // Put highest priority negative action to RSK and Options menu with rest of softkey actions to LSK + // TODO: Build menu + setLeftSoftkey(cba); + if(AknLayoutUtils::MSKEnabled()) + setMiddleSoftkey(cba); + setRightSoftkey(cba); + } else { + // We have less softkeys than available slots + // Put softkeys to request slots based on role + setLeftSoftkey(cba); + if(AknLayoutUtils::MSKEnabled()) + setMiddleSoftkey(cba); + setRightSoftkey(cba); + } +} + +void QSoftKeyManagerPrivateS60::updateSoftKeys_sys() +{ + //bool status = CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog(); + if (skipCbaUpdate()) + return; + + CEikButtonGroupContainer *nativeContainer = S60->buttonGroupContainer(); + Q_ASSERT_X(nativeContainer, Q_FUNC_INFO, "Native CBA does not exist!"); + ensureCbaVisibilityAndResponsiviness(*nativeContainer); + clearSoftkeys(*nativeContainer); + setSoftkeys(*nativeContainer); + + nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation +} + +bool QSoftKeyManagerPrivateS60::handleCommand(int command) +{ + QAction *action = realSoftKeyActions.value(command); + if (action) { + QVariant property = action->property(MENU_ACTION_PROPERTY); + if (property.isValid() && property.toBool()) { + QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL()); + } else if (action->menu()) { + // TODO: This is hack, in order to use exising QMenuBar implementation for Symbian + // menubar needs to have widget to which it is associated. Since we want to associate + // menubar to action (which is inherited from QObejct), we create and associate QWidget + // to action and pass that for QMenuBar. This associates the menubar to action, and we + // can have own menubar for each action. + QWidget *actionContainer = action->property("_q_action_widget").value<QWidget*>(); + if(!actionContainer) { + actionContainer = new QWidget(action->parentWidget()); + QMenuBar *menuBar = new QMenuBar(actionContainer); + foreach(QAction *menuAction, action->menu()->actions()) { + QMenu *menu = menuAction->menu(); + if(menu) + menuBar->addMenu(action->menu()); + else + menuBar->addAction(menuAction); + } + QVariant v; + v.setValue(actionContainer); + action->setProperty("_q_action_widget", v); + } + qt_symbian_next_menu_from_action(actionContainer); + QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL()); + // TODO: hack remove, it can happen that IsDisplayingMenuOrDialog return false + // in updateSoftKeys_sys, and we will override menu CBA with our own + skipNextUpdate = true; + } else { + Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey); + QWidget *actionParent = action->parentWidget(); + Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); + if (actionParent->isEnabled()) { + action->activate(QAction::Trigger); + return true; + } + } + } + return false; +} + +QT_END_NAMESPACE +#endif //QT_NO_SOFTKEYMANAGER diff --git a/src/gui/kernel/qsoftkeymanager_s60_p.h b/src/gui/kernel/qsoftkeymanager_s60_p.h new file mode 100644 index 0000000..46e3596 --- /dev/null +++ b/src/gui/kernel/qsoftkeymanager_s60_p.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSOFTKEYMANAGER_S60_P_H +#define QSOFTKEYMANAGER_S60_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qobject_p.h" +#include "private/qsoftkeymanager_common_p.h" + +QT_BEGIN_HEADER + +#ifndef QT_NO_SOFTKEYMANAGER + +QT_BEGIN_NAMESPACE + +class CEikButtonGroupContainer; +class QAction; + +class QSoftKeyManagerPrivateS60 : public QSoftKeyManagerPrivate +{ + Q_DECLARE_PUBLIC(QSoftKeyManager) + +public: + QSoftKeyManagerPrivateS60(); + +public: + void updateSoftKeys_sys(); + bool handleCommand(int command); + +private: + bool skipCbaUpdate(); + void ensureCbaVisibilityAndResponsiviness(CEikButtonGroupContainer &cba); + void clearSoftkeys(CEikButtonGroupContainer &cba); + QString softkeyText(QAction &softkeyAction); + QAction *highestPrioritySoftkey(QAction::SoftKeyRole role); + static bool actionPriorityMoreThan(const QAction* item1, const QAction* item2); + void setNativeSoftkey(CEikButtonGroupContainer &cba, TInt position, TInt command, const TDesC& text); + bool isOrientationLandscape(); + QSize cbaIconSize(CEikButtonGroupContainer *cba, int position); + bool setSoftkeyImage(CEikButtonGroupContainer *cba, QAction &action, int position); + bool setSoftkey(CEikButtonGroupContainer &cba, QAction::SoftKeyRole role, int position); + bool setLeftSoftkey(CEikButtonGroupContainer &cba); + bool setMiddleSoftkey(CEikButtonGroupContainer &cba); + bool setRightSoftkey(CEikButtonGroupContainer &cba); + void setSoftkeys(CEikButtonGroupContainer &cba); + +private: + QHash<int, QAction*> realSoftKeyActions; + QSize cachedCbaIconSize[2]; + bool skipNextUpdate; +}; + + +QT_END_NAMESPACE + +#endif //QT_NO_SOFTKEYMANAGER + +QT_END_HEADER + +#endif // QSOFTKEYMANAGER_S60_P_H diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 1163055..735ca7a 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -128,6 +128,7 @@ public: static inline RWindowGroup& windowGroup(); static inline CWsScreenDevice* screenDevice(); static inline CCoeAppUi* appUi(); + static inline CEikMenuBar* menuBar(); #ifdef Q_WS_S60 static inline CEikStatusPane* statusPane(); static inline CCoeControl* statusPaneSubPane(TInt aPaneId); @@ -270,6 +271,11 @@ inline CCoeAppUi* QS60Data::appUi() return CCoeEnv::Static()-> AppUi(); } +inline CEikMenuBar* QS60Data::menuBar() +{ + return CEikonEnv::Static()->AppUiFactory()->MenuBar(); +} + #ifdef Q_WS_S60 inline CEikStatusPane* QS60Data::statusPane() { diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index ebfab21..78c1562 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3510,6 +3510,8 @@ void QWidgetPrivate::hide_sys() if (!QWidget::mouseGrabber()){ QWidget *enterWidget = QApplication::widgetAt(QCursor::pos()); + if (enterWidget && enterWidget->data->in_destructor) + enterWidget = 0; QApplicationPrivate::dispatchEnterLeave(enterWidget, qt_mouseover); qt_mouseover = enterWidget; } diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 3f2322e..bc56ed0 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3081,6 +3081,8 @@ void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti) QVarLengthArray<glyph_t> glyphs; QTransform matrix = s->matrix; matrix.translate(p.x(), p.y()); + if (matrix.type() == QTransform::TxScale) + fe->setFontScale(matrix.m11()); ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); const QFixed aliasDelta = QFixed::fromReal(aliasedCoordinateDelta); @@ -3097,6 +3099,9 @@ void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti) alphaPenBlt(glyphBitmapBytes, glyphBitmapSize.iWidth, 8, x, y, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight); } + if (matrix.type() == QTransform::TxScale) + fe->setFontScale(1.0); + return; } #endif // Q_OS_SYMBIAN && QT_NO_FREETYPE @@ -3269,7 +3274,9 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte } #elif defined (Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // Q_WS_WIN || Q_WS_MAC - if (s->matrix.type() <= QTransform::TxTranslate) { + if (s->matrix.type() <= QTransform::TxTranslate + || (s->matrix.type() == QTransform::TxScale + && (qFuzzyCompare(s->matrix.m11(), s->matrix.m22())))) { drawGlyphsS60(p, ti); return; } diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index f4af579..aab16cb 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -2411,7 +2411,12 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW ret = 0; break; case PM_ToolBarFrameWidth: - ret = 0; + ret = 1; + if (widget) { + if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(widget->parent())) + if (mainWindow->unifiedTitleAndToolBarOnMac()) + ret = 0; + } break; default: ret = QWindowsStyle::pixelMetric(metric, opt, widget); @@ -4341,8 +4346,6 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, rect.setY(0); rect.setHeight(widget->height()); } - if (opt->direction == Qt::RightToLeft) - rect.adjust(15, 0, -20, 0); } break; case SE_ProgressBarGroove: @@ -5717,12 +5720,16 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, break; case CT_ToolButton: if (widget && qobject_cast<const QToolBar *>(widget->parentWidget())) { - sz.rwidth() += 4; - if (sz.height() <= 32) { - // Workaround strange HIToolBar bug when getting constraints. - sz.rheight() += 1; + if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(widget->parent())) { + if (mainWindow->unifiedTitleAndToolBarOnMac()) { + sz.rwidth() += 4; + if (sz.height() <= 32) { + // Workaround strange HIToolBar bug when getting constraints. + sz.rheight() += 1; + } + return sz; + } } - return sz; } sz.rwidth() += 10; sz.rheight() += 10; diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index a40a84c..fc435e8 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -92,10 +92,10 @@ static const qreal goldenRatio = 1.618; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,15,"QVGA Landscape"}, -{320,240,1,15,"QVGA Portrait"}, -{360,640,1,15,"NHD Landscape"}, -{640,360,1,15,"NHD Portrait"}, +{240,320,1,16,"QVGA Landscape"}, +{320,240,1,16,"QVGA Portrait"}, +{360,640,1,16,"NHD Landscape"}, +{640,360,1,16,"NHD Portrait"}, {352,800,1,12,"E90 Landscape"} // *** End of generated data *** }; @@ -104,10 +104,10 @@ const int QS60StylePrivate::m_numberOfLayouts = const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** -{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, -{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, -{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, +{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, +{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, +{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, +{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1} // *** End of generated data *** }; diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 4625667..9dd4af7 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -129,26 +129,62 @@ static inline unsigned int getChar(const QChar *str, int &i, const int len) return uc; } +CFont *QFontEngineS60::fontWithSize(qreal size) const +{ + CFont *result = 0; + TFontSpec fontSpec(qt_QString2TPtrC(QFontEngine::fontDef.family), TInt(size)); + fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); + fontSpec.iFontStyle.SetPosture(QFontEngine::fontDef.style == QFont::StyleNormal?EPostureUpright:EPostureItalic); + fontSpec.iFontStyle.SetStrokeWeight(QFontEngine::fontDef.weight > QFont::Normal?EStrokeWeightBold:EStrokeWeightNormal); + const TInt errorCode = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(result, fontSpec); + Q_ASSERT(result && (errorCode == 0)); + return result; +} + +void QFontEngineS60::setFontScale(qreal scale) +{ + if (qFuzzyCompare(scale, qreal(1))) { + if (!m_originalFont) + m_originalFont = fontWithSize(m_originalFontSizeInPixels); + m_activeFont = m_originalFont; + } else { + const qreal scaledFontSizeInPixels = m_originalFontSizeInPixels * scale; + if (!m_scaledFont || + (TInt(scaledFontSizeInPixels) != TInt(m_scaledFontSizeInPixels))) { + releaseFont(m_scaledFont); + m_scaledFontSizeInPixels = scaledFontSizeInPixels; + m_scaledFont = fontWithSize(m_scaledFontSizeInPixels); + } + m_activeFont = m_scaledFont; + } +} + +void QFontEngineS60::releaseFont(CFont *&font) +{ + if (font) { + S60->screenDevice()->ReleaseFont(font); + font = 0; + } +} + QFontEngineS60::QFontEngineS60(const QFontDef &request, const QFontEngineS60Extensions *extensions) : m_extensions(extensions) + , m_originalFont(0) + , m_originalFontSizeInPixels((request.pixelSize >= 0)? + request.pixelSize:pointsToPixels(request.pointSize)) + , m_scaledFont(0) + , m_scaledFontSizeInPixels(0) + , m_activeFont(0) { QFontEngine::fontDef = request; - m_fontSizeInPixels = (request.pixelSize >= 0)? - request.pixelSize:pointsToPixels(request.pointSize); - - TFontSpec fontSpec(qt_QString2TPtrC(request.family), m_fontSizeInPixels); - fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); - fontSpec.iFontStyle.SetPosture(request.style == QFont::StyleNormal?EPostureUpright:EPostureItalic); - fontSpec.iFontStyle.SetStrokeWeight(request.weight > QFont::Normal?EStrokeWeightBold:EStrokeWeightNormal); - const TInt errorCode = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(m_font, fontSpec); - Q_ASSERT(errorCode == 0); - + setFontScale(1.0); cache_cost = sizeof(QFontEngineS60); } QFontEngineS60::~QFontEngineS60() { - S60->screenDevice()->ReleaseFont(m_font); + releaseFont(m_originalFont); + releaseFont(m_scaledFont); } bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const @@ -251,12 +287,12 @@ glyph_metrics_t QFontEngineS60::boundingBox(glyph_t glyph) QFixed QFontEngineS60::ascent() const { - return m_font->FontMaxAscent(); + return m_originalFont->FontMaxAscent(); } QFixed QFontEngineS60::descent() const { - return m_font->FontMaxDescent(); + return m_originalFont->FontMaxDescent(); } QFixed QFontEngineS60::leading() const @@ -266,7 +302,7 @@ QFixed QFontEngineS60::leading() const qreal QFontEngineS60::maxCharWidth() const { - return m_font->MaxCharWidthInPixels(); + return m_originalFont->MaxCharWidthInPixels(); } const char *QFontEngineS60::name() const @@ -302,11 +338,11 @@ void QFontEngineS60::getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metri const TUint specialCode = (TUint)glyph | 0x80000000; const CFont::TCharacterDataAvailability availability = - m_font->GetCharacterData(specialCode, metrics, bitmap, bitmapSize); + m_activeFont->GetCharacterData(specialCode, metrics, bitmap, bitmapSize); const glyph_t fallbackGlyph = '?'; if (availability != CFont::EAllCharacterData) { const CFont::TCharacterDataAvailability fallbackAvailability = - m_font->GetCharacterData(fallbackGlyph, metrics, bitmap, bitmapSize); + m_activeFont->GetCharacterData(fallbackGlyph, metrics, bitmap, bitmapSize); Q_ASSERT(fallbackAvailability == CFont::EAllCharacterData); } } diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h index 4748497..78f8a9a 100644 --- a/src/gui/text/qfontengine_s60_p.h +++ b/src/gui/text/qfontengine_s60_p.h @@ -117,15 +117,21 @@ public: Type type() const; void getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metrics, const TUint8*& bitmap, TSize& bitmapSize) const; + void setFontScale(qreal scale); private: friend class QFontPrivate; QFixed glyphAdvance(HB_Glyph glyph) const; + CFont *fontWithSize(qreal size) const; + static void releaseFont(CFont *&font); - CFont* m_font; const QFontEngineS60Extensions *m_extensions; - qreal m_fontSizeInPixels; + CFont* m_originalFont; + const qreal m_originalFontSizeInPixels; + CFont* m_scaledFont; + qreal m_scaledFontSizeInPixels; + CFont* m_activeFont; }; class QFontEngineMultiS60 : public QFontEngineMulti diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 1622191..269cd12 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -119,8 +119,6 @@ void QMainWindowPrivate::init() q->setAttribute(Qt::WA_Hover); #ifdef QT_SOFTKEYS_ENABLED menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, q); - menuBarAction->setObjectName(QLatin1String("_q_menuSoftKeyAction")); - menuBarAction->setVisible(false); #endif } diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index b7272f7..aaed6b1 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -71,6 +71,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_MENU #ifdef Q_WS_S60 +void qt_symbian_next_menu_from_action(QWidget* actionContainer); void qt_symbian_show_toplevel(CEikMenuPane* menuPane); void qt_symbian_show_submenu(CEikMenuPane* menuPane, int id); #endif // Q_WS_S60 @@ -87,7 +88,7 @@ QT_BEGIN_NAMESPACE typedef void NSMenuItem; # endif //__OBJC__ struct QMacMenuAction { - QMacMenuAction() + QMacMenuAction() #ifndef QT_MAC_USE_COCOA : command(0) #else @@ -124,7 +125,7 @@ typedef QList<QMenuMergeItem> QMenuMergeList; #ifdef Q_WS_WINCE struct QWceMenuAction { - uint command; + uint command; QPointer<QAction> action; HMENU menuHandle; QWceMenuAction() : menuHandle(0), command(0) {} @@ -340,7 +341,7 @@ public: QList<QWceMenuAction*> actionItems; HMENU menuHandle; QWceMenuPrivate(); - ~QWceMenuPrivate(); + ~QWceMenuPrivate(); void addAction(QAction *, QWceMenuAction* =0); void addAction(QWceMenuAction *, QWceMenuAction* =0); void syncAction(QWceMenuAction *); diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 28b27d4..eae97a6 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -81,6 +81,7 @@ static QList<QMenuBar*> nativeMenuBars; static uint qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; static QPointer<QWidget> widgetWithContextMenu; static QList<QAction*> contextMenuActionList; +static QWidget* actionMenu = NULL; static int contexMenuCommand=0; bool menuExists() @@ -224,8 +225,26 @@ static void rebuildMenu() } #ifdef Q_WS_S60 +void qt_symbian_next_menu_from_action(QWidget *actionContainer) +{ + actionMenu = actionContainer; +} + void qt_symbian_show_toplevel( CEikMenuPane* menuPane) { + if (actionMenu) { + QMenuBarPrivate *mb = 0; + mb = menubars()->value(actionMenu); + qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; + deleteAll( &symbianMenus ); + Q_ASSERT(mb); + mb->symbian_menubar->rebuild(); + for (int i = 0; i < symbianMenus.count(); ++i) + QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData)); + actionMenu = NULL; + return; + } + if (!menuExists()) return; rebuildMenu(); @@ -271,10 +290,16 @@ int QMenuBarPrivate::symbianCommands(int command) void QMenuBarPrivate::symbianCreateMenuBar(QWidget *parent) { Q_Q(QMenuBar); - if (parent && parent->isWindow()){ - menubars()->insert(q->window(), this); - symbian_menubar = new QSymbianMenuBarPrivate(this); - nativeMenuBars.append(q); + if (parent) { + if(parent->isWindow()) { + menubars()->insert(q->window(), this); + symbian_menubar = new QSymbianMenuBarPrivate(this); + nativeMenuBars.append(q); + } else { + menubars()->insert(q->parentWidget(), this); + symbian_menubar = new QSymbianMenuBarPrivate(this); + nativeMenuBars.append(q); + } } } @@ -284,6 +309,7 @@ void QMenuBarPrivate::symbianDestroyMenuBar() int index = nativeMenuBars.indexOf(q); nativeMenuBars.removeAt(index); menubars()->remove(q->window(), this); + menubars()->remove(q->parentWidget(), this); rebuildMenu(); if (symbian_menubar) delete symbian_menubar; diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 0e14385..9caadb7 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -667,7 +667,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti \i Application Menu | About <application name> \i The application name is fetched from the \c {Info.plist} file (see note below). If this entry is not found no About item - will appear in the Application Menu. + will appear in the Application Menu. \row \i config, options, setup, settings or preferences \i Application Menu | Preferences \i If this entry is not found the Settings item will be disabled diff --git a/src/gui/widgets/qprintpreviewwidget.cpp b/src/gui/widgets/qprintpreviewwidget.cpp index 747a227..45b15ef 100644 --- a/src/gui/widgets/qprintpreviewwidget.cpp +++ b/src/gui/widgets/qprintpreviewwidget.cpp @@ -151,7 +151,11 @@ class GraphicsView : public QGraphicsView public: GraphicsView(QWidget* parent = 0) : QGraphicsView(parent) - {} + { +#ifdef Q_WS_MAC + setFrameStyle(QFrame::NoFrame); +#endif + } signals: void resized(); diff --git a/src/network/access/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp index c2cc69c..669f9cf 100644 --- a/src/network/access/qhttpnetworkheader.cpp +++ b/src/network/access/qhttpnetworkheader.cpp @@ -80,7 +80,7 @@ QByteArray QHttpNetworkHeaderPrivate::headerField(const QByteArray &name, const QByteArray result; bool first = true; - foreach (QByteArray value, allValues) { + foreach (const QByteArray &value, allValues) { if (!first) result += ", "; first = false; diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 58123b2..61a95fe 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -753,7 +753,7 @@ void QNetworkAccessHttpBackend::replyHeaderChanged() QByteArray value = rawHeader(it->first); if (!value.isEmpty()) { if (qstricmp(it->first.constData(), "set-cookie") == 0) - value += "\n"; + value += '\n'; else value += ", "; } diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 6dcd05d..a2bef67 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -649,7 +649,7 @@ static QVariant parseCookieHeader(const QByteArray &raw) { QList<QNetworkCookie> result; QList<QByteArray> cookieList = raw.split(';'); - foreach (QByteArray cookie, cookieList) { + foreach (const QByteArray &cookie, cookieList) { QList<QNetworkCookie> parsed = QNetworkCookie::parseCookies(cookie.trimmed()); if (parsed.count() != 1) return QVariant(); // invalid Cookie: header diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 193a043..e4023c8 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -270,7 +270,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header, break; case Ntlm: // #### extract from header - realm = QString(); + realm.clear(); break; case DigestMd5: { realm = QString::fromLatin1(options.value("realm")); @@ -281,7 +281,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header, break; } default: - realm = QString(); + realm.clear(); challenge = QByteArray(); phase = Invalid; } diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index 367e3c4..1115c63 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -541,7 +541,7 @@ QList<QNetworkInterface> QNetworkInterface::allInterfaces() { QList<QSharedDataPointer<QNetworkInterfacePrivate> > privs = manager()->allInterfaces(); QList<QNetworkInterface> result; - foreach (QSharedDataPointer<QNetworkInterfacePrivate> p, privs) { + foreach (const QSharedDataPointer<QNetworkInterfacePrivate> &p, privs) { QNetworkInterface item; item.d = p; result << item; @@ -560,7 +560,7 @@ QList<QHostAddress> QNetworkInterface::allAddresses() { QList<QSharedDataPointer<QNetworkInterfacePrivate> > privs = manager()->allInterfaces(); QList<QHostAddress> result; - foreach (const QSharedDataPointer<QNetworkInterfacePrivate> p, privs) { + foreach (const QSharedDataPointer<QNetworkInterfacePrivate> &p, privs) { foreach (const QNetworkAddressEntry &entry, p->addressEntries) result += entry.ip(); } diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp index ede3c89..ef7fc02 100644 --- a/src/network/socket/qlocalserver.cpp +++ b/src/network/socket/qlocalserver.cpp @@ -122,9 +122,9 @@ void QLocalServer::close() qDeleteAll(d->pendingConnections); d->pendingConnections.clear(); d->closeServer(); - d->serverName = QString(); - d->fullServerName = QString(); - d->errorString = QString(); + d->serverName.clear(); + d->fullServerName.clear(); + d->errorString.clear(); d->error = QAbstractSocket::UnknownSocketError; } @@ -226,8 +226,8 @@ bool QLocalServer::listen(const QString &name) } if (!d->listen(name)) { - d->serverName = QString(); - d->fullServerName = QString(); + d->serverName.clear(); + d->fullServerName.clear(); return false; } diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp index 9f574d4..5b5e84f 100644 --- a/src/network/socket/qlocalsocket_tcp.cpp +++ b/src/network/socket/qlocalsocket_tcp.cpp @@ -102,8 +102,8 @@ void QLocalSocketPrivate::_q_stateChanged(QAbstractSocket::SocketState newState) switch(newState) { case QAbstractSocket::UnconnectedState: state = QLocalSocket::UnconnectedState; - serverName = QString(); - fullServerName = QString(); + serverName.clear(); + fullServerName.clear(); break; case QAbstractSocket::ConnectingState: state = QLocalSocket::ConnectingState; @@ -218,7 +218,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode) || state() == ConnectingState) return; - d->errorString = QString(); + d->errorString.clear(); d->state = ConnectingState; emit stateChanged(d->state); @@ -333,8 +333,8 @@ void QLocalSocket::close() { Q_D(QLocalSocket); d->tcpSocket->close(); - d->serverName = QString(); - d->fullServerName = QString(); + d->serverName.clear(); + d->fullServerName.clear(); QIODevice::close(); } diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 73c2465..1ca11d8 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -109,8 +109,8 @@ void QLocalSocketPrivate::_q_stateChanged(QAbstractSocket::SocketState newState) switch(newState) { case QAbstractSocket::UnconnectedState: state = QLocalSocket::UnconnectedState; - serverName = QString(); - fullServerName = QString(); + serverName.clear(); + fullServerName.clear(); break; case QAbstractSocket::ConnectingState: state = QLocalSocket::ConnectingState; @@ -225,7 +225,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode) || state() == ConnectingState) return; - d->errorString = QString(); + d->errorString.clear(); d->unixSocket.setSocketState(QAbstractSocket::ConnectingState); d->state = ConnectingState; emit stateChanged(d->state); @@ -341,7 +341,7 @@ void QLocalSocketPrivate::_q_connectToSocket() errorOccurred(QLocalSocket::UnknownSocketError, function); } connectingSocket = -1; - connectingName = QString(); + connectingName.clear(); connectingOpenMode = 0; } @@ -438,10 +438,10 @@ void QLocalSocket::close() if (d->connectingSocket != -1) ::close(d->connectingSocket); d->connectingSocket = -1; - d->connectingName = QString(); + d->connectingName.clear(); d->connectingOpenMode = 0; - d->serverName = QString(); - d->fullServerName = QString(); + d->serverName.clear(); + d->fullServerName.clear(); QIODevice::close(); } diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 9a9b1b5..fd647e2 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -634,11 +634,11 @@ QByteArray QSslCertificatePrivate::QByteArray_from_X509(X509 *x509, QSsl::Encodi QByteArray tmp; for (int i = 0; i <= array.size() - 64; i += 64) { tmp += QByteArray::fromRawData(array.data() + i, 64); - tmp += "\n"; + tmp += '\n'; } if (int remainder = array.size() % 64) { tmp += QByteArray::fromRawData(array.data() + array.size() - remainder, remainder); - tmp += "\n"; + tmp += '\n'; } return BEGINCERTSTRING "\n" + tmp + ENDCERTSTRING "\n"; diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 6947aa7..9623570 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1109,7 +1109,7 @@ void QSslSocket::setCiphers(const QString &ciphers) { Q_D(QSslSocket); d->configuration.ciphers.clear(); - foreach (QString cipherName, ciphers.split(QLatin1String(":"),QString::SkipEmptyParts)) { + foreach (const QString &cipherName, ciphers.split(QLatin1String(":"),QString::SkipEmptyParts)) { for (int i = 0; i < 3; ++i) { // ### Crude QSslCipher cipher(cipherName, QSsl::SslProtocol(i)); diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 892d330..ce2aee1 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -818,7 +818,7 @@ bool QSslSocketBackendPrivate::startHandshake() QRegExp regexp(commonName, Qt::CaseInsensitive, QRegExp::Wildcard); if (!regexp.exactMatch(peerName)) { bool matched = false; - foreach (QString altName, configuration.peerCertificate + foreach (const QString &altName, configuration.peerCertificate .alternateSubjectNames().values(QSsl::DnsEntry)) { regexp.setPattern(altName); if (regexp.exactMatch(peerName)) { diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index cc0e5a1..3087b77 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -46,11 +46,13 @@ #include "qvgimagepool_p.h" #ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE +#include <private/qt_s60_p.h> +#include <fbs.h> #include <graphics/sgimage.h> typedef EGLImageKHR (*pfnEglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, EGLint*); typedef EGLBoolean (*pfnEglDestroyImageKHR)(EGLDisplay, EGLImageKHR); typedef VGImage (*pfnVgCreateEGLImageTargetKHR)(VGeglImageKHR); -#endif +#endif // QT_SYMBIAN_SUPPORTS_SGIMAGE QT_BEGIN_NAMESPACE @@ -425,6 +427,34 @@ Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap) } #if defined(Q_OS_SYMBIAN) + +static CFbsBitmap* createBlitCopy(CFbsBitmap* bitmap) +{ + CFbsBitmap *copy = q_check_ptr(new CFbsBitmap); + if(!copy) + return 0; + + if (copy->Create(bitmap->SizeInPixels(), bitmap->DisplayMode()) != KErrNone) { + delete copy; + copy = 0; + + return 0; + } + + CFbsBitmapDevice* bitmapDevice = 0; + CFbsBitGc *bitmapGc = 0; + QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(copy)); + QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL()); + bitmapGc->Activate(bitmapDevice); + + bitmapGc->BitBlt(TPoint(), bitmap); + + delete bitmapGc; + delete bitmapDevice; + + return copy; +} + void QVGPixmapData::cleanup() { is_null = w = h = 0; @@ -510,7 +540,49 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) eglDestroyImageKHR(context->display(), eglImage); SgDriver::Close(); } else if (type == QPixmapData::FbsBitmap) { + CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap); + + bool deleteSourceBitmap = false; + +#ifdef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE + + // Rasterize extended bitmaps + + TUid extendedBitmapType = bitmap->ExtendedBitmapType(); + if (extendedBitmapType != KNullUid) { + bitmap = createBlitCopy(bitmap); + deleteSourceBitmap = true; + } +#endif + + if (bitmap->IsCompressedInRAM()) { + bitmap = createBlitCopy(bitmap); + deleteSourceBitmap = true; + } + + TDisplayMode displayMode = bitmap->DisplayMode(); + QImage::Format format = qt_TDisplayMode2Format(displayMode); + + TSize size = bitmap->SizeInPixels(); + + bitmap->BeginDataAccess(); + uchar *bytes = (uchar*)bitmap->DataAddress(); + QImage img = QImage(bytes, size.iWidth, size.iHeight, format); + img = img.copy(); + bitmap->EndDataAccess(); + + if(displayMode == EGray2) { + //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid + //So invert mono bitmaps so that masks work correctly. + img.invertPixels(); + } else if(displayMode == EColor16M) { + img = img.rgbSwapped(); // EColor16M is BGR + } + + fromImage(img, Qt::AutoColor); + if(deleteSourceBitmap) + delete bitmap; } #else Q_UNUSED(pixmap); @@ -593,7 +665,25 @@ void* QVGPixmapData::toNativeType(NativeType type) SgDriver::Close(); return reinterpret_cast<void*>(sgImage); } else if (type == QPixmapData::FbsBitmap) { - return 0; + CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); + + if (bitmap) { + if (bitmap->Create(TSize(source.width(), source.height()), + EColor16MAP) == KErrNone) { + const uchar *sptr = qt_vg_imageBits(source); + bitmap->BeginDataAccess(); + + uchar *dptr = (uchar*)bitmap->DataAddress(); + Mem::Copy(dptr, sptr, source.byteCount()); + + bitmap->EndDataAccess(); + } else { + delete bitmap; + bitmap = 0; + } + } + + return reinterpret_cast<void*>(bitmap); } #else Q_UNUSED(type); diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index da65230..155e3e7 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -5527,7 +5527,7 @@ EXPORTS ?invalidateChildrenSceneTransform@QGraphicsItemPrivate@@QAEXXZ @ 5526 NONAME ; void QGraphicsItemPrivate::invalidateChildrenSceneTransform(void) ?invalidateDepthRecursively@QGraphicsItemPrivate@@QAEXXZ @ 5527 NONAME ; void QGraphicsItemPrivate::invalidateDepthRecursively(void) ?invalidateFilter@QSortFilterProxyModel@@IAEXXZ @ 5528 NONAME ; void QSortFilterProxyModel::invalidateFilter(void) - ?invalidateGraphicsEffectsRecursively@QGraphicsItemPrivate@@QAEXXZ @ 5529 NONAME ; void QGraphicsItemPrivate::invalidateGraphicsEffectsRecursively(void) + ?invalidateGraphicsEffectsRecursively@QGraphicsItemPrivate@@QAEXXZ @ 5529 NONAME ABSENT ; void QGraphicsItemPrivate::invalidateGraphicsEffectsRecursively(void) ?invalidateGraphicsEffectsRecursively@QWidgetPrivate@@QAEXXZ @ 5530 NONAME ; void QWidgetPrivate::invalidateGraphicsEffectsRecursively(void) ?invalidateScene@QGraphicsView@@QAEXABVQRectF@@V?$QFlags@W4SceneLayer@QGraphicsScene@@@@@Z @ 5531 NONAME ; void QGraphicsView::invalidateScene(class QRectF const &, class QFlags<enum QGraphicsScene::SceneLayer>) ?invalidateSizeCache@QWidgetItemV2@@AAEXXZ @ 5532 NONAME ; void QWidgetItemV2::invalidateSizeCache(void) @@ -9555,7 +9555,7 @@ EXPORTS ?setParent@QWidget@@QAEXPAV1@@Z @ 9554 NONAME ; void QWidget::setParent(class QWidget *) ?setParent@QWidget@@QAEXPAV1@V?$QFlags@W4WindowType@Qt@@@@@Z @ 9555 NONAME ; void QWidget::setParent(class QWidget *, class QFlags<enum Qt::WindowType>) ?setParentItem@QGraphicsItem@@QAEXPAV1@@Z @ 9556 NONAME ; void QGraphicsItem::setParentItem(class QGraphicsItem *) - ?setParentItemHelper@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 9557 NONAME ; void QGraphicsItemPrivate::setParentItemHelper(class QGraphicsItem *) + ?setParentItemHelper@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 9557 NONAME ABSENT ; void QGraphicsItemPrivate::setParentItemHelper(class QGraphicsItem *) ?setParentLayoutItem@QGraphicsLayoutItem@@QAEXPAV1@@Z @ 9558 NONAME ; void QGraphicsLayoutItem::setParentLayoutItem(class QGraphicsLayoutItem *) ?setParent_sys@QWidgetPrivate@@QAEXPAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z @ 9559 NONAME ; void QWidgetPrivate::setParent_sys(class QWidget *, class QFlags<enum Qt::WindowType>) ?setPasswordCharacter@QLineControl@@QAEXABVQChar@@@Z @ 9560 NONAME ; void QLineControl::setPasswordCharacter(class QChar const &) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 05f620c..a9a69aa 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -4671,7 +4671,7 @@ EXPORTS _ZN20QGraphicsItemPrivate18setTransformHelperERK10QTransform @ 4670 NONAME _ZN20QGraphicsItemPrivate18subFocusItemChangeEv @ 4671 NONAME _ZN20QGraphicsItemPrivate18updateAncestorFlagEN13QGraphicsItem16GraphicsItemFlagENS_12AncestorFlagEbb @ 4672 NONAME - _ZN20QGraphicsItemPrivate19setParentItemHelperEP13QGraphicsItem @ 4673 NONAME + _ZN20QGraphicsItemPrivate19setParentItemHelperEP13QGraphicsItem @ 4673 NONAME ABSENT _ZN20QGraphicsItemPrivate20removeExtraItemCacheEv @ 4674 NONAME _ZN20QGraphicsItemPrivate23appendGraphicsTransformEP18QGraphicsTransform @ 4675 NONAME _ZN20QGraphicsItemPrivate25movableAncestorIsSelectedEPK13QGraphicsItem @ 4676 NONAME @@ -11639,7 +11639,7 @@ EXPORTS _ZN19QGraphicsBlurEffect4drawEP8QPainter @ 11638 NONAME _ZN19QKeyEventTransition15setModifierMaskE6QFlagsIN2Qt16KeyboardModifierEE @ 11639 NONAME _ZN20QGraphicsItemPrivate18siblingOrderChangeEv @ 11640 NONAME - _ZN20QGraphicsItemPrivate36invalidateGraphicsEffectsRecursivelyEv @ 11641 NONAME + _ZN20QGraphicsItemPrivate36invalidateGraphicsEffectsRecursivelyEv @ 11641 NONAME ABSENT _ZN21QMouseEventTransition14setHitTestPathERK12QPainterPath @ 11642 NONAME _ZN21QMouseEventTransition15setModifierMaskE6QFlagsIN2Qt16KeyboardModifierEE @ 11643 NONAME _ZN22QGraphicsOpacityEffect4drawEP8QPainter @ 11644 NONAME diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index aaecf6c..5318693 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -114,6 +114,10 @@ symbian: { graphicssystems_plugins.sources += qvggraphicssystem.dll } + contains(QT_CONFIG, multimedia) { + qtlibraries.sources += QtMultimedia.dll + } + BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" BLD_INF_RULES.prj_exports += "qtdemoapps.iby $$CORE_APP_LAYER_IBY_EXPORT_PATH(qtdemoapps.iby)" } diff --git a/src/s60installs/sqlite3.sis b/src/s60installs/sqlite3.sis Binary files differindex 1785365..11e069e 100644 --- a/src/s60installs/sqlite3.sis +++ b/src/s60installs/sqlite3.sis diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index e41cd55..1f6e58f 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -544,6 +544,8 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file) const QString filename = nodes.at(nodes.size()-1); RCCFileInfo *s = new RCCFileInfo(file); s->m_parent = parent; + if (parent->m_children.contains(filename)) + qWarning("potential duplicate alias detected: '%s'", qPrintable(filename)); parent->m_children.insertMulti(filename, s); return true; } |