diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-11-24 09:19:07 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-11-24 09:19:07 (GMT) |
commit | 0e7c7f75b404c26b420cb174f062eda02846641f (patch) | |
tree | 111d1e8480d96de6554e58c7c2a3a0695ddbcc73 | |
parent | 67b3edc50ad6e574f777d9accebe0750fbe3ddf7 (diff) | |
parent | a4ce1a327ae3658394a2acd8a3769f3bbba50863 (diff) | |
download | Qt-0e7c7f75b404c26b420cb174f062eda02846641f.zip Qt-0e7c7f75b404c26b420cb174f062eda02846641f.tar.gz Qt-0e7c7f75b404c26b420cb174f062eda02846641f.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-symbian-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-symbian-staging:
Fix Linux-Symbian parallel cross-compilation configure step
Symbian: don't merge native clipboard, overwrite.
Surviving out of memory in Qt Quick app
Export QtGui functions required by QtMultimediaKit backend
fix bearer crash
Fix alignment of non-wrapped richtext QML Text elements.
-rw-r--r-- | config.profiles/symbian/qtconfig.flm | 97 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 13 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 27 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian_p.h | 4 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetext.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativecomponent.cpp | 102 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 4 | ||||
-rw-r--r-- | src/declarative/qml/qpodvector_p.h | 4 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_p.h | 2 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 193 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 96 | ||||
-rw-r--r-- | src/gui/kernel/qclipboard_s60.cpp | 3 | ||||
-rw-r--r-- | src/gui/painting/painting.pri | 6 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystemex_symbian.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystemhelper_symbian.cpp | 141 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystemhelper_symbian.h | 82 | ||||
-rw-r--r-- | src/plugins/bearer/symbian/qnetworksession_impl.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qclipboard/tst_qclipboard.cpp | 64 |
18 files changed, 599 insertions, 245 deletions
diff --git a/config.profiles/symbian/qtconfig.flm b/config.profiles/symbian/qtconfig.flm index 2689d03..07c2349 100644 --- a/config.profiles/symbian/qtconfig.flm +++ b/config.profiles/symbian/qtconfig.flm @@ -10,52 +10,76 @@ QT_ROOT:= ../.. TARGETDIR:=$(EPOCROOT)/$(INSTALLPATH) MKSPECDIR:=$(EPOCROOT)/$(INSTALLPATH)/qt -SOURCEDIR:=$(EXTENSION_ROOT)/$(QT_ROOT)/bin +TOOLSBINDIR:=$(EXTENSION_ROOT)/$(QT_ROOT)/bin TOOLSSRCDIR:=$(EXTENSION_ROOT)/$(QT_ROOT)/src/tools LANGUAGETOOLDIR:=$(EXTENSION_ROOT)/$(QT_ROOT)/tools/linguist CONFIGURE_APP:=configure$(DOTEXE) +BOOTSTRAP_LIB:=$(TOOLSSRCDIR)/bootstrap/libbootstrap.a $(call makepath,$(TARGETDIR)) +WHATTARGETS:= +CLEANTARGETS:= + ifneq ($(filter linux,$(HOSTPLATFORM)),) PLATFORM:=$(PLATFORM.LINUX) else PLATFORM:=$(PLATFORM.WIN32) endif -TARGET_TOOLS:=$(TARGETDIR)/qmake$(DOTEXE) $(TARGETDIR)/moc$(DOTEXE) $(TARGETDIR)/rcc$(DOTEXE) $(TARGETDIR)/uic$(DOTEXE) $(TARGETDIR)/lrelease$(DOTEXE) -QT_TOOLS:= $(TOOLSSRCDIR)/uic $(TOOLSSRCDIR)/moc $(TOOLSSRCDIR)/rcc $(LANGUAGETOOLDIR)/lrelease -SOURCE_TOOLS:=$(SOURCEDIR)/qmake$(DOTEXE) $(SOURCEDIR)/moc$(DOTEXE) $(SOURCEDIR)/rcc$(DOTEXE) $(SOURCEDIR)/uic$(DOTEXE) $(SOURCEDIR)/lrelease$(DOTEXE) +QT_TOOLS:=uic moc rcc -define QtConfiguration -ifneq ($(filter linux,$(HOSTPLATFORM)),) -$(TARGET_TOOLS): $(QT_TOOLS) -else -$(TARGET_TOOLS): $(SOURCEDIR)/qmake$(DOTEXE) -endif +# Build every tool with it's own target +define qt_tool + +TARGET:: $(TARGETDIR)/$1$(DOTEXE) + +WHATTARGETS:=$$(WHATTARGETS) $(TARGETDIR)/$1$(DOTEXE) $(TOOLSBINDIR)/$1$(DOTEXE) +CLEANTARGETS:=$$(CLEANTARGETS) $(TARGETDIR)/$1$(DOTEXE) $(TOOLSBINDIR)/$1$(DOTEXE) + +$(TARGETDIR)/$1$(DOTEXE): $(TOOLSBINDIR)/$1$(DOTEXE) $(call startrule,qtconf_deploy) \ - $(GNUCP) $(SOURCEDIR)/$$(notdir $$@) $$@ \ + $(GNUCP) $$^ $$@ \ $(call endrule,qtconf_deploy) ifneq ($(filter linux,$(HOSTPLATFORM)),) -$(QT_TOOLS): $(TOOLSSRCDIR)/bootstrap +# On linux, the tools are built separately +$(TOOLSBINDIR)/$1$(DOTEXE): $(BOOTSTRAP_LIB) $(call startrule,qtconf_tools_build) \ - cd $$@; \ - $(GNUMAKE38); \ - cd .. \ + cd $(TOOLSSRCDIR)/$1 && $(GNUMAKE38) \ $(call endrule,qtconf_tools_build) +else +# On windows, the tools are built by configure.exe (building of qmake) +$(TOOLSBINDIR)/$1$(DOTEXE): $(TARGETDIR)/qmake$(DOTEXE) +endif + +endef -$(TOOLSSRCDIR)/bootstrap:$(SOURCEDIR)/qmake$(DOTEXE) +define qt_bootstrap +$(BOOTSTRAP_LIB): $(TOOLSBINDIR)/qmake$(DOTEXE) $(call startrule,qtconf_bootstrap_build) \ - cd $(TOOLSSRCDIR)/bootstrap; \ - $(GNUMAKE38); \ - cd .. \ + cd $(TOOLSSRCDIR)/bootstrap && $(GNUMAKE38) && $(GNUTOUCH) $$@ \ $(call endrule,qtconf_bootstrap_build) -endif +CLEANTARGETS:=$$(CLEANTARGETS) $(BOOTSTRAP_LIB) +endef + + +define qt_qmake -$(SOURCEDIR)/qmake$(DOTEXE): $(EXTENSION_ROOT)/$(QT_ROOT)/$(CONFIGURE_APP) +TARGET:: $(TARGETDIR)/qmake$(DOTEXE) + +WHATTARGETS:=$$(WHATTARGETS) $(TARGETDIR)/qmake$(DOTEXE) $(TOOLSBINDIR)/qmake$(DOTEXE) +CLEANTARGETS:=$$(CLEANTARGETS) $(TARGETDIR)/qmake$(DOTEXE) $(TOOLSBINDIR)/qmake$(DOTEXE) + +$(TARGETDIR)/qmake$(DOTEXE): $(TOOLSBINDIR)/qmake$(DOTEXE) + $(call startrule,qmake_deploy) \ + $(GNUCP) $$^ $$@ \ + $(call endrule,qmake_deploy) + +$(TOOLSBINDIR)/qmake$(DOTEXE): $(EXTENSION_ROOT)/$(QT_ROOT)/$(CONFIGURE_APP) $(call startrule,qtconf) \ + $(GNUCHMOD) a+x $(EXTENSION_ROOT)/$(QT_ROOT)/$(CONFIGURE_APP) $(EXTENSION_ROOT)/$(QT_ROOT)/config.tests/unix/* && \ cd $(EXTENSION_ROOT)/$(QT_ROOT) && unset INCLUDE && unset LIB && $(EXTENSION_ROOT)/$(QT_ROOT)/$(CONFIGURE_APP) -platform $(PLATFORM) -xplatform $(XPLATFORM) $(OPTIONS) \ $(call endrule,qtconf) $(call startrule,headerexport) \ @@ -91,25 +115,30 @@ WHAT:: ); \ echo "$(call whatLogClose)" \ $(call endrawoutput) -endef + +endef + # Here a variable named "done_<sanitised $SISFILE>" gets created GUARD:=done_$(call sanitise,$(TARGETDIR)/qmake$(DOTEXE)) # If variable "done_..." not set, set it to 1, so that -# UREL and UDEB do not execute makesis twice on the same target +# UREL and UDEB do not execute makesis twice on the same target ifeq ($($(GUARD)),) $(GUARD):=1 + +$(eval $(qt_qmake)) + +# Bootstrap is needed only on Linux ifneq ($(filter linux,$(HOSTPLATFORM)),) -EXPORT:: $(QT_TOOLS) $(TARGET_TOOLS) -else -EXPORT:: $(TARGET_TOOLS) -endif -$(eval $(call QtConfiguration)) -ifeq ($(OSTYPE),unix) -$(eval $(call whatmacro,$(QT_TOOLS) $(TARGET_TOOLS))) -$(eval $(call GenerateStandardCleanTarget,$(QT_TOOLS) $(TARGET_TOOLS) $(SOURCE_TOOLS),$(TARGETDIR))) -else -$(eval $(call whatmacro,$(TARGET_TOOLS))) -$(eval $(call GenerateStandardCleanTarget,$(TARGET_TOOLS) $(SOURCE_TOOLS),$(TARGETDIR))) +$(eval $(qt_bootstrap)) endif + +$(eval $(foreach TOOL,$(QT_TOOLS),$(call qt_tool,$(TOOL)))) + +TOOLSSRCDIR:=$(LANGUAGETOOLDIR) +$(eval $(call qt_tool,lrelease)) + +$(eval $(call whatmacro,$(WHATTARGETS))) +$(eval $(call GenerateStandardCleanTarget,$(CLEANTARGETS),$(TARGETDIR))) + endif diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 84d68e5..3675fc7 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2207,16 +2207,13 @@ void qt_message_output(QtMsgType msgType, const char *buf) OutputDebugString(reinterpret_cast<const wchar_t *> (fstr.utf16())); #elif defined(Q_OS_SYMBIAN) // RDebug::Print has a cap of 256 characters so break it up - _LIT(format, "[Qt Message] %S"); - const int maxBlockSize = 256 - ((const TDesC &)format).Length(); + char format[] = "[Qt Message] %S"; + const int maxBlockSize = 256 - sizeof(format); const TPtrC8 ptr(reinterpret_cast<const TUint8*>(buf)); - HBufC* hbuffer = HBufC::New(qMin(maxBlockSize, ptr.Length())); - Q_CHECK_PTR(hbuffer); - for (int i = 0; i < ptr.Length(); i += hbuffer->Length()) { - hbuffer->Des().Copy(ptr.Mid(i, qMin(maxBlockSize, ptr.Length()-i))); - RDebug::Print(format, hbuffer); + for (int i = 0; i < ptr.Length(); i += maxBlockSize) { + TPtrC8 part(ptr.Mid(i, qMin(maxBlockSize, ptr.Length()-i))); + RDebug::Printf(format, &part); } - delete hbuffer; #else fprintf(stderr, "%s\n", buf); fflush(stderr); diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index ea466f5..da6f021 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -749,7 +749,7 @@ public: ObjectRun, ObjectDelayed }; - static RunResult RunMarkedIfReady(TInt &runPriority, TInt minimumPriority); + static RunResult RunMarkedIfReady(TInt &runPriority, TInt minimumPriority, QEventDispatcherSymbian *dispatcher); static bool UseRRActiveScheduler(); private: @@ -808,7 +808,7 @@ void QtRRActiveScheduler::MarkReadyToRun() } } -QtRRActiveScheduler::RunResult QtRRActiveScheduler::RunMarkedIfReady(TInt &runPriority, TInt minimumPriority) +QtRRActiveScheduler::RunResult QtRRActiveScheduler::RunMarkedIfReady(TInt &runPriority, TInt minimumPriority, QEventDispatcherSymbian *dispatcher) { RunResult result = NothingFound; TInt error=KErrNone; @@ -824,12 +824,12 @@ QtRRActiveScheduler::RunResult QtRRActiveScheduler::RunMarkedIfReady(TInt &runPr runPriority = active->Priority(); dataAccess->iStatus.iFlags&=~TRequestStatusAccess::ERequestActiveFlags; int vptr = *(int*)active; // vptr can be used to identify type when debugging leaves - TRAP(error, active->RunL()); + TRAP(error, QT_TRYCATCH_ERROR(error, active->RunL())); if (error!=KErrNone) error=active->RunError(error); if (error) { qWarning("Active object (ptr=0x%08x, vptr=0x%08x) leave: %i\n", active, vptr, error); - pS->Error(error); + dispatcher->activeObjectError(error); } return ObjectRun; } @@ -966,13 +966,15 @@ QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent) m_wakeUpDone(0), m_iterationCount(0), m_insideTimerEvent(false), - m_noSocketEvents(false) + m_noSocketEvents(false), + m_oomErrorCount(0) { #ifdef QT_SYMBIAN_PRIORITY_DROP m_delay = baseDelay; m_avgEventTime = 0; idleDetectorThread(); #endif + m_oomErrorTimer.start(); } QEventDispatcherSymbian::~QEventDispatcherSymbian() @@ -1098,7 +1100,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla // Standard or above priority AOs are scheduled round robin. // Lower priority AOs can only run if nothing higher priority has run. int runPriority = minPriority; - handledSymbianEvent = QtRRActiveScheduler::RunMarkedIfReady(runPriority, minPriority); + handledSymbianEvent = QtRRActiveScheduler::RunMarkedIfReady(runPriority, minPriority, this); minPriority = qMin(runPriority, int(CActive::EPriorityStandard)); } else { TInt error; @@ -1396,6 +1398,19 @@ QList<QEventDispatcherSymbian::TimerInfo> QEventDispatcherSymbian::registeredTim return list; } +void QEventDispatcherSymbian::activeObjectError(int error) +{ + if (error == KErrNoMemory) { + // limit the number of reported out of memory errors, as the disappearance of the warning + // dialog can trigger further OOM errors causing a loop. + if (m_oomErrorTimer.restart() > 60000) // 1 minute + m_oomErrorCount = 0; + if (m_oomErrorCount++ >= 5) + return; + } + CActiveScheduler::Current()->Error(error); +} + /* * This active scheduler class implements a simple report and continue policy, for Symbian OS leaves * or exceptions from Qt that fall back to the scheduler. diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 01f5ab1..869fe31 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -264,6 +264,8 @@ public: static void RequestComplete(TRequestStatus *&status, TInt reason); static void RequestComplete(RThread &threadHandle, TRequestStatus *&status, TInt reason); + void activeObjectError(int error); + private: bool sendPostedEvents(); bool sendDeferredSocketEvents(); @@ -294,6 +296,8 @@ private: int m_delay; int m_avgEventTime; QElapsedTimer m_lastIdleRequestTimer; + int m_oomErrorCount; + QElapsedTimer m_oomErrorTimer; }; #ifdef QT_DEBUG diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 20e4eef..684dc5a 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -289,7 +289,7 @@ void QDeclarativeTextPrivate::updateSize() doc->setTextWidth(-1); naturalWidth = doc->idealWidth(); } - if (wrapMode != QDeclarativeText::NoWrap && q->widthValid()) + if (q->widthValid()) doc->setTextWidth(q->width()); else doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index f423f50..0d892a2 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -936,50 +936,37 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state) { if (state->completePending) { - - for (int ii = 0; ii < state->bindValues.count(); ++ii) { - QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bv = - state->bindValues.at(ii); - for (int jj = 0; jj < bv.count; ++jj) { - if(bv.at(jj)) { - // XXX akennedy - bv.at(jj)->m_mePtr = 0; - bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | - QDeclarativePropertyPrivate::DontRemoveBinding); + QT_TRY { + for (int ii = 0; ii < state->bindValues.count(); ++ii) { + QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bv = + state->bindValues.at(ii); + for (int jj = 0; jj < bv.count; ++jj) { + if(bv.at(jj)) { + // XXX akennedy + bv.at(jj)->m_mePtr = 0; + bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | + QDeclarativePropertyPrivate::DontRemoveBinding); + } } + QDeclarativeEnginePrivate::clear(bv); } - QDeclarativeEnginePrivate::clear(bv); - } - for (int ii = 0; ii < state->parserStatus.count(); ++ii) { - QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> ps = - state->parserStatus.at(ii); + for (int ii = 0; ii < state->parserStatus.count(); ++ii) { + QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> ps = + state->parserStatus.at(ii); - for (int jj = ps.count - 1; jj >= 0; --jj) { - QDeclarativeParserStatus *status = ps.at(jj); - if (status && status->d) { - status->d = 0; - status->componentComplete(); + for (int jj = ps.count - 1; jj >= 0; --jj) { + QDeclarativeParserStatus *status = ps.at(jj); + if (status && status->d) { + status->d = 0; + status->componentComplete(); + } } + QDeclarativeEnginePrivate::clear(ps); } - QDeclarativeEnginePrivate::clear(ps); - } - - for (int ii = 0; ii < state->finalizedParserStatus.count(); ++ii) { - QPair<QDeclarativeGuard<QObject>, int> status = state->finalizedParserStatus.at(ii); - QObject *obj = status.first; - if (obj) { - void *args[] = { 0 }; - QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, - status.second, args); - } - } - //componentComplete() can register additional finalization objects - //that are then never handled. Handle them manually here. - if (1 == enginePriv->inProgressCreations) { - for (int ii = 0; ii < enginePriv->finalizedParserStatus.count(); ++ii) { - QPair<QDeclarativeGuard<QObject>, int> status = enginePriv->finalizedParserStatus.at(ii); + for (int ii = 0; ii < state->finalizedParserStatus.count(); ++ii) { + QPair<QDeclarativeGuard<QObject>, int> status = state->finalizedParserStatus.at(ii); QObject *obj = status.first; if (obj) { void *args[] = { 0 }; @@ -987,17 +974,38 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri status.second, args); } } - enginePriv->finalizedParserStatus.clear(); - } - while (state->componentAttached) { - QDeclarativeComponentAttached *a = state->componentAttached; - a->rem(); - QDeclarativeData *d = QDeclarativeData::get(a->parent()); - Q_ASSERT(d); - Q_ASSERT(d->context); - a->add(&d->context->componentAttached); - emit a->completed(); + //componentComplete() can register additional finalization objects + //that are then never handled. Handle them manually here. + if (1 == enginePriv->inProgressCreations) { + for (int ii = 0; ii < enginePriv->finalizedParserStatus.count(); ++ii) { + QPair<QDeclarativeGuard<QObject>, int> status = enginePriv->finalizedParserStatus.at(ii); + QObject *obj = status.first; + if (obj) { + void *args[] = { 0 }; + QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, + status.second, args); + } + } + enginePriv->finalizedParserStatus.clear(); + } + + while (state->componentAttached) { + QDeclarativeComponentAttached *a = state->componentAttached; + a->rem(); + QDeclarativeData *d = QDeclarativeData::get(a->parent()); + Q_ASSERT(d); + Q_ASSERT(d->context); + a->add(&d->context->componentAttached); + emit a->completed(); + } + } QT_CATCH(const std::exception&) { + state->bindValues.clear(); + state->parserStatus.clear(); + state->finalizedParserStatus.clear(); + state->completePending = false; + enginePriv->inProgressCreations--; + QT_RETHROW; } state->bindValues.clear(); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 1417b78..89a9809 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1202,8 +1202,8 @@ void QDeclarativeData::setBindingBit(QObject *obj, int bit) int arraySize = (props + 31) / 32; int oldArraySize = bindingBitsSize / 32; - bindingBits = (quint32 *)realloc(bindingBits, - arraySize * sizeof(quint32)); + bindingBits = (quint32 *)q_check_ptr(realloc(bindingBits, + arraySize * sizeof(quint32))); memset(bindingBits + oldArraySize, 0x00, diff --git a/src/declarative/qml/qpodvector_p.h b/src/declarative/qml/qpodvector_p.h index 7b50463..a055d17 100644 --- a/src/declarative/qml/qpodvector_p.h +++ b/src/declarative/qml/qpodvector_p.h @@ -89,7 +89,7 @@ public: void insert(int idx, const T &v) { if (m_count == m_capacity) { m_capacity += Increment; - m_data = (T *)realloc(m_data, m_capacity * sizeof(T)); + m_data = (T *)q_check_ptr(realloc(m_data, m_capacity * sizeof(T))); } int moveCount = m_count - idx; if (moveCount) @@ -101,7 +101,7 @@ public: void reserve(int count) { if (count >= m_capacity) { m_capacity = (count + (Increment-1)) & (0xFFFFFFFF - Increment + 1); - m_data = (T *)realloc(m_data, m_capacity * sizeof(T)); + m_data = (T *)q_check_ptr(realloc(m_data, m_capacity * sizeof(T))); } } diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 90d47f9..b17d9c7 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -162,6 +162,8 @@ private: void enableSymbianCcpuSupport(); void changeCBA(bool showCopyAndOrPaste); void copyOrCutTextToClipboard(const char *operation); + void getScreenCoordinatesForFepX(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent, + TInt aDocumentPosition) const; //From MEikCcpuEditor interface public: diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index ed7411f..44e0df0 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -1465,40 +1465,49 @@ void QCoeFepInputContext::CancelFepInlineEdit() m_pendingTransactionCancel = true; - QList<QInputMethodEvent::Attribute> attributes; - QInputMethodEvent event(QLatin1String(""), attributes); - event.setCommitString(QLatin1String(""), 0, 0); - m_preeditString.clear(); - m_inlinePosition = 0; - sendEvent(event); - - // Sync with native side editor state. Native side can then do various operations - // based on editor state, such as removing 'exact word bubble'. - if (!m_pendingInputCapabilitiesChanged) - ReportAknEdStateEvent(MAknEdStateObserver::EAknSyncEdwinState); + QT_TRY { + QList<QInputMethodEvent::Attribute> attributes; + QInputMethodEvent event(QLatin1String(""), attributes); + event.setCommitString(QLatin1String(""), 0, 0); + m_preeditString.clear(); + m_inlinePosition = 0; + sendEvent(event); + + // Sync with native side editor state. Native side can then do various operations + // based on editor state, such as removing 'exact word bubble'. + if (!m_pendingInputCapabilitiesChanged) + ReportAknEdStateEvent(MAknEdStateObserver::EAknSyncEdwinState); + } QT_CATCH(const std::exception&) { + m_preeditString.clear(); + m_inlinePosition = 0; + } m_pendingTransactionCancel = false; } TInt QCoeFepInputContext::DocumentLengthForFep() const { - QWidget *w = focusWidget(); - if (!w) - return 0; + QT_TRY { + QWidget *w = focusWidget(); + if (!w) + return 0; - QVariant variant = w->inputMethodQuery(Qt::ImSurroundingText); + QVariant variant = w->inputMethodQuery(Qt::ImSurroundingText); - int size = variant.value<QString>().size() + m_preeditString.size(); + int size = variant.value<QString>().size() + m_preeditString.size(); - // To fix an issue with backspaces not being generated if document size is zero, - // fake document length to be at least one always, except when dealing with - // hidden text widgets, where this faking would generate extra asterisk. Since the - // primary use of hidden text widgets is password fields, they are unlikely to - // support multiple lines anyway. - if (size == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText)) - size = 1; + // To fix an issue with backspaces not being generated if document size is zero, + // fake document length to be at least one always, except when dealing with + // hidden text widgets, where this faking would generate extra asterisk. Since the + // primary use of hidden text widgets is password fields, they are unlikely to + // support multiple lines anyway. + if (size == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText)) + size = 1; - return size; + return size; + } QT_CATCH(const std::exception&) { + return 0; + } } TInt QCoeFepInputContext::DocumentMaximumLengthForFep() const @@ -1540,42 +1549,46 @@ void QCoeFepInputContext::SetCursorSelectionForFepL(const TCursorSelection& aCur void QCoeFepInputContext::GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const { - QWidget *w = focusWidget(); - if (!w) { - aCursorSelection.SetSelection(0,0); - return; - } + QT_TRY { + QWidget *w = focusWidget(); + if (!w) { + aCursorSelection.SetSelection(0,0); + return; + } - int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + m_preeditString.size(); - int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt() + m_preeditString.size(); + int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt() + m_preeditString.size(); + int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt() + m_preeditString.size(); - // If the position is stored, use that value, so that word replacement from proposed word - // lists are added to the correct position. - if (m_cachedCursorAndAnchorPosition != -1) { - cursor = m_cachedCursorAndAnchorPosition; - anchor = m_cachedCursorAndAnchorPosition; - } - QString text = w->inputMethodQuery(Qt::ImSurroundingText).value<QString>(); - int combinedSize = text.size() + m_preeditString.size(); - if (combinedSize < anchor || combinedSize < cursor) { - // ### TODO! FIXME! QTBUG-5050 - // This is a hack to prevent crashing in 4.6 with QLineEdits that use input masks. - // The root problem is that cursor position is relative to displayed text instead of the - // actual text we get. - // - // To properly fix this we would need to know the displayText of QLineEdits instead - // of just the text, which on itself should be a trivial change. The difficulties start - // when we need to commit the changes back to the QLineEdit, which would have to be somehow - // able to handle displayText, too. - // - // Until properly fixed, the cursor and anchor positions will not reflect correct positions - // for masked QLineEdits, unless all the masked positions are filled in order so that - // cursor position relative to the displayed text matches position relative to actual text. - aCursorSelection.iAnchorPos = combinedSize; - aCursorSelection.iCursorPos = combinedSize; - } else { - aCursorSelection.iAnchorPos = anchor; - aCursorSelection.iCursorPos = cursor; + // If the position is stored, use that value, so that word replacement from proposed word + // lists are added to the correct position. + if (m_cachedCursorAndAnchorPosition != -1) { + cursor = m_cachedCursorAndAnchorPosition; + anchor = m_cachedCursorAndAnchorPosition; + } + QString text = w->inputMethodQuery(Qt::ImSurroundingText).value<QString>(); + int combinedSize = text.size() + m_preeditString.size(); + if (combinedSize < anchor || combinedSize < cursor) { + // ### TODO! FIXME! QTBUG-5050 + // This is a hack to prevent crashing in 4.6 with QLineEdits that use input masks. + // The root problem is that cursor position is relative to displayed text instead of the + // actual text we get. + // + // To properly fix this we would need to know the displayText of QLineEdits instead + // of just the text, which on itself should be a trivial change. The difficulties start + // when we need to commit the changes back to the QLineEdit, which would have to be somehow + // able to handle displayText, too. + // + // Until properly fixed, the cursor and anchor positions will not reflect correct positions + // for masked QLineEdits, unless all the masked positions are filled in order so that + // cursor position relative to the displayed text matches position relative to actual text. + aCursorSelection.iAnchorPos = combinedSize; + aCursorSelection.iCursorPos = combinedSize; + } else { + aCursorSelection.iAnchorPos = anchor; + aCursorSelection.iCursorPos = cursor; + } + } QT_CATCH(const std::exception&) { + aCursorSelection.SetSelection(0,0); } } @@ -1618,6 +1631,12 @@ void QCoeFepInputContext::GetFormatForFep(TCharFormat& aFormat, TInt /* aDocumen } void QCoeFepInputContext::GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine, TInt& aHeight, + TInt& aAscent, TInt aDocumentPosition) const +{ + QT_TRYCATCH_LEAVING(getScreenCoordinatesForFepX(aLeftSideOfBaseLine, aHeight, aAscent, aDocumentPosition)); +} + +void QCoeFepInputContext::getScreenCoordinatesForFepX(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent, TInt /* aDocumentPosition */) const { QWidget *w = focusWidget(); @@ -1774,36 +1793,40 @@ TBool QCoeFepInputContext::CcpuIsFocused() const TBool QCoeFepInputContext::CcpuCanCut() const { - bool retval = false; - if (m_inDestruction) - return retval; - QWidget *w = focusWidget(); - QObject *focusObject = 0; - if (!w) { - w = m_lastFocusedEditor; - focusObject = m_lastFocusedObject; - } else { - w = getQWidgetFromQGraphicsView(w, &focusObject); - } - if (w) { - QRect microFocus = w->inputMethodQuery(Qt::ImMicroFocus).toRect(); - if (microFocus.isNull()) { - // For some reason, the editor does not have microfocus. Most probably, - // it is due to using native fullscreen editing mode with QML apps. - // Try accessing "selectedText" directly. - QObject *invokeTarget = w; - if (focusObject) - invokeTarget = focusObject; - - QString selectedText = invokeTarget->property("selectedText").toString(); - retval = !selectedText.isNull(); + QT_TRY { + bool retval = false; + if (m_inDestruction) + return retval; + QWidget *w = focusWidget(); + QObject *focusObject = 0; + if (!w) { + w = m_lastFocusedEditor; + focusObject = m_lastFocusedObject; } else { - int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); - int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt(); - retval = cursor != anchor; + w = getQWidgetFromQGraphicsView(w, &focusObject); } + if (w) { + QRect microFocus = w->inputMethodQuery(Qt::ImMicroFocus).toRect(); + if (microFocus.isNull()) { + // For some reason, the editor does not have microfocus. Most probably, + // it is due to using native fullscreen editing mode with QML apps. + // Try accessing "selectedText" directly. + QObject *invokeTarget = w; + if (focusObject) + invokeTarget = focusObject; + + QString selectedText = invokeTarget->property("selectedText").toString(); + retval = !selectedText.isNull(); + } else { + int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); + int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt(); + retval = cursor != anchor; + } + } + return retval; + } QT_CATCH(const std::exception&) { + return EFalse; } - return retval; } void QCoeFepInputContext::CcpuCutL() diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index fe239f5..bb84491 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1534,53 +1534,57 @@ bool QSymbianControl::hasFocusedAndVisibleChild(QWidget *parentWidget) void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) { - if (m_ignoreFocusChanged || (qwidget->windowType() & Qt::WindowType_Mask) == Qt::Desktop) - return; + QT_TRY { + if (m_ignoreFocusChanged || (qwidget->windowType() & Qt::WindowType_Mask) == Qt::Desktop) + return; #ifdef Q_WS_S60 - if (S60->splitViewLastWidget) - return; + if (S60->splitViewLastWidget) + return; #endif - // Popups never get focused, but still receive the FocusChanged when they are hidden. - if (QApplicationPrivate::popupWidgets != 0 - || (qwidget->windowType() & Qt::Popup) == Qt::Popup) - return; - - if (IsFocused() && IsVisible()) { - if (m_symbianPopupIsOpen) { - QWidget *fw = QApplication::focusWidget(); - if (fw) { - QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); - QCoreApplication::sendEvent(fw, &event); - } - m_symbianPopupIsOpen = false; - } + // Popups never get focused, but still receive the FocusChanged when they are hidden. + if (QApplicationPrivate::popupWidgets != 0 + || (qwidget->windowType() & Qt::Popup) == Qt::Popup) + return; - QApplication::setActiveWindow(qwidget->window()); - qwidget->d_func()->setWindowIcon_sys(true); - qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); -#ifdef Q_WS_S60 - if (qwidget->isWindow()) - S60->setRecursiveDecorationsVisibility(qwidget, qwidget->windowState()); -#endif - } else { - QWidget *parentWindow = qwidget->window(); - if (QApplication::activeWindow() == parentWindow && !hasFocusedAndVisibleChild(parentWindow)) { - if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { + if (IsFocused() && IsVisible()) { + if (m_symbianPopupIsOpen) { QWidget *fw = QApplication::focusWidget(); if (fw) { - QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); + QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason); QCoreApplication::sendEvent(fw, &event); } - m_symbianPopupIsOpen = true; - return; + m_symbianPopupIsOpen = false; } - QApplication::setActiveWindow(0); + QApplication::setActiveWindow(qwidget->window()); + qwidget->d_func()->setWindowIcon_sys(true); + qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); +#ifdef Q_WS_S60 + if (qwidget->isWindow()) + S60->setRecursiveDecorationsVisibility(qwidget, qwidget->windowState()); +#endif + } else { + QWidget *parentWindow = qwidget->window(); + if (QApplication::activeWindow() == parentWindow && !hasFocusedAndVisibleChild(parentWindow)) { + if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { + QWidget *fw = QApplication::focusWidget(); + if (fw) { + QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); + QCoreApplication::sendEvent(fw, &event); + } + m_symbianPopupIsOpen = true; + return; + } + + QApplication::setActiveWindow(0); + } } + // else { We don't touch the active window unless we were explicitly activated or deactivated } + } QT_CATCH(const std::exception&) { + // ignore errors } - // else { We don't touch the active window unless we were explicitly activated or deactivated } } void QSymbianControl::handleClientAreaChange() @@ -2377,19 +2381,25 @@ int QApplication::symbianProcessEvent(const QSymbianEvent *event) QScopedLoopLevelCounter counter(d->threadData); - if (d->eventDispatcher->filterEvent(const_cast<QSymbianEvent *>(event))) - return 1; + QT_TRY { + if (d->eventDispatcher->filterEvent(const_cast<QSymbianEvent *>(event))) + return 1; + + QWidget *w = qApp ? qApp->focusWidget() : 0; + if (w) { + QInputContext *ic = w->inputContext(); + if (ic && ic->symbianFilterEvent(w, event)) + return 1; + } - QWidget *w = qApp ? qApp->focusWidget() : 0; - if (w) { - QInputContext *ic = w->inputContext(); - if (ic && ic->symbianFilterEvent(w, event)) + if (symbianEventFilter(event)) return 1; + } QT_CATCH(const std::exception& ex) { + // don't allow an exception to stop exit command handling + if (event->type() != QSymbianEvent::CommandEvent || event->command() != EEikCmdExit) + QT_RETHROW; } - if (symbianEventFilter(event)) - return 1; - switch (event->type()) { case QSymbianEvent::WindowServerEvent: return d->symbianProcessWsEvent(event); diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp index f5314bd..dc812fb 100644 --- a/src/gui/kernel/qclipboard_s60.cpp +++ b/src/gui/kernel/qclipboard_s60.cpp @@ -187,6 +187,7 @@ void readSymbianStoreLX(QMimeData* aData, CClipboard* clipboard) QString string = qt_TDesC2QString(buf); CleanupStack::PopAndDestroy(text); + aData->clear(); aData->setText(string); } @@ -196,6 +197,8 @@ void readFromStreamLX(QMimeData* aData,RReadStream& aStream) // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. TCardinality mimeTypeCount; aStream >> mimeTypeCount; + if (mimeTypeCount > 0) + aData->clear(); for (int i = 0; i< mimeTypeCount;i++) { // mime type diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 27b1bf2..d4f904b 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -200,10 +200,12 @@ symbian { SOURCES += \ painting/qpaintengine_raster_symbian.cpp \ painting/qregion_s60.cpp \ - painting/qcolormap_s60.cpp + painting/qcolormap_s60.cpp \ + painting/qgraphicssystemhelper_symbian.cpp HEADERS += \ - painting/qpaintengine_raster_symbian_p.h + painting/qpaintengine_raster_symbian_p.h \ + painting/qgraphicssystemhelper_symbian.h } x11|embedded|qpa { diff --git a/src/gui/painting/qgraphicssystemex_symbian.cpp b/src/gui/painting/qgraphicssystemex_symbian.cpp index 5a182ff..5bfd5a8 100644 --- a/src/gui/painting/qgraphicssystemex_symbian.cpp +++ b/src/gui/painting/qgraphicssystemex_symbian.cpp @@ -74,7 +74,7 @@ bool QSymbianGraphicsSystemEx::hasBCM2727() #if 1 // Hacky but fast ~0ms. const char* vendor = eglQueryString(display, EGL_VENDOR); - if (strstr(vendor, "Broadcom")) { + if (vendor && strstr(vendor, "Broadcom")) { const TUid KIvePropertyCat = {0x2726beef}; enum TIvePropertyChipType { EVCBCM2727B1 = 0x00000000, diff --git a/src/gui/painting/qgraphicssystemhelper_symbian.cpp b/src/gui/painting/qgraphicssystemhelper_symbian.cpp new file mode 100644 index 0000000..eb70247 --- /dev/null +++ b/src/gui/painting/qgraphicssystemhelper_symbian.cpp @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystemhelper_symbian.h" +#include "qt_s60_p.h" +#include "qwidget_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \enum QSymbianGraphicsSystemHelper::NativePaintMode + + This enum controls the way in which QWidget paints content from the Qt + backing store into the corresponding native window surface. + + \value NativePaintModeDefault Default painting behaviour. + \value NativePaintModeZeroFill Ignore contents of backing store, and + fill the window surface region with zeroes. + \value NativePaintModeWriteAlpha By default, alpha values are only copied + from the backing store into the window surface if the top-level widget + has the Qt::WA_TranslucentBackground attribute. If this mode is set, + alpha values are copied regardless of the value of that attribute. + \value NativePaintModeDisable Do not paint anything into the native window + surface. + */ + +/*! + \class QSymbianGraphicsSystemHelper + \ingroup painting + + \brief QSymbianGraphicsSystemHelper defines functions required by + QtMultimediaKit in order to enable video rendering. + + This class is not intended for use by applications. +*/ + +/*! + Specify whether native focus change events should be ignored by the widget. +*/ + +void QSymbianGraphicsSystemHelper::setIgnoreFocusChanged(QWidget *widget, bool value) +{ + static_cast<QSymbianControl *>(widget->winId())->setIgnoreFocusChanged(value); +} + +/*! + Set the native paint mode to the specified \a mode. +*/ + +void QSymbianGraphicsSystemHelper::setNativePaintMode(QWidget *widget, NativePaintMode mode) +{ + QWidgetPrivate *widgetPrivate = qt_widget_private(widget->window()); + widgetPrivate->createExtra(); + QWExtra::NativePaintMode widgetMode = QWExtra::Default; + switch (mode) { + case NativePaintModeDefault: + break; + case NativePaintModeZeroFill: + widgetMode = QWExtra::ZeroFill; + break; + case NativePaintModeWriteAlpha: + widgetMode = QWExtra::BlitWriteAlpha; + break; + case NativePaintModeDisable: + widgetMode = QWExtra::Disable; + break; + } + widgetPrivate->extraData()->nativePaintMode = widgetMode; +} + +/*! + Set the native paint mode to the specified \a mode. +*/ + +void QSymbianGraphicsSystemHelper::setNativePaintMode(WId wid, NativePaintMode mode) +{ + QWidget *window = static_cast<QSymbianControl *>(wid)->widget()->window(); + setNativePaintMode(window, mode); +} + +/*! + Specify whether the widget should receive receive native paint events. + + If enabled, the QWidget::beginNativePaintEvent slot is called before + content from the backing store is written into the native window + surface, and QWidget::endNativePaintEvent is called once writing to + the native window surface is complete. + + This function is intended for use by QWidget clients such as video + widgets, which wish to use Direct Screen Access to write into the + native window surface. Such clients should stop their DSA session on + receipt of QWidget::beginNativePaintEvent, and re-start it on receipt of + QWidget::endNativePaintEvent. +*/ + +void QSymbianGraphicsSystemHelper::setReceiveNativePaintEvents(QWidget *widget, bool value) +{ + QWidgetPrivate *widgetPrivate = qt_widget_private(widget); + widgetPrivate->createExtra(); + widgetPrivate->extraData()->receiveNativePaintEvents = value; +} + +QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystemhelper_symbian.h b/src/gui/painting/qgraphicssystemhelper_symbian.h new file mode 100644 index 0000000..b74144e --- /dev/null +++ b/src/gui/painting/qgraphicssystemhelper_symbian.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSYMBIANGRAPHICSSYSTEMHELPER_H +#define QSYMBIANGRAPHICSSYSTEMHELPER_H + +#include <QtCore/qglobal.h> + +#ifndef Q_OS_SYMBIAN +#error "This header file can only be included when building for Symbian" +#endif + +#include <QtGui/qwindowdefs.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWidget; + +class Q_GUI_EXPORT QSymbianGraphicsSystemHelper +{ +public: + enum NativePaintMode { + NativePaintModeDefault, + NativePaintModeZeroFill, + NativePaintModeWriteAlpha, + NativePaintModeDisable + }; + + static void setIgnoreFocusChanged(QWidget *widget, bool value); + static void setNativePaintMode(QWidget *widget, NativePaintMode mode); + static void setNativePaintMode(WId wid, NativePaintMode mode); + static void setReceiveNativePaintEvents(QWidget *widget, bool value); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSYMBIANGRAPHICSSYSTEMHELPER_H + diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index a7dad2b..f5f71cf 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -97,7 +97,6 @@ void QNetworkSessionPrivateImpl::closeHandles() QSymbianSocketManager::instance().setDefaultConnection(0); - iConnectionMonitor.Close(); #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - handles closed"; @@ -111,6 +110,7 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl() isOpening = false; closeHandles(); + iConnectionMonitor.Close(); #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - destroyed"; diff --git a/tests/auto/qclipboard/tst_qclipboard.cpp b/tests/auto/qclipboard/tst_qclipboard.cpp index 94981cf..ea470e7 100644 --- a/tests/auto/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/qclipboard/tst_qclipboard.cpp @@ -73,6 +73,7 @@ private slots: #ifdef Q_OS_SYMBIAN void pasteCopySymbian(); void copyPasteSymbian(); + void copyCopyPasteSymbian(); #endif private: @@ -347,17 +348,17 @@ void tst_QClipboard::clearBeforeSetText() QCOMPARE(QApplication::clipboard()->text(), text); } +#ifdef Q_OS_SYMBIAN /* Test that text copied from qt application can be pasted with symbian clipboard */ -#ifdef Q_OS_SYMBIAN // ### This test case only makes sense in symbian void tst_QClipboard::pasteCopySymbian() { if (!nativeClipboardWorking()) QSKIP("Native clipboard not working in this setup", SkipAll); - const QString string("Test string symbian."); + const QString string("Test string qt->symbian."); QApplication::clipboard()->setText(string); const TInt KPlainTextBegin = 0; @@ -381,19 +382,9 @@ void tst_QClipboard::pasteCopySymbian() QCOMPARE(string, storeString); } -#endif -/* - Test that text copied to symbian clipboard - can be pasted to qt clipboard -*/ -#ifdef Q_OS_SYMBIAN -// ### This test case only makes sense in symbian -void tst_QClipboard::copyPasteSymbian() +static void nativeCopyHelper(const QString &string) { - if (!nativeClipboardWorking()) - QSKIP("Native clipboard not working in this setup", SkipAll); - const QString string("Test string symbian."); const TInt KPlainTextBegin = 0; RFs fs = qt_s60GetRFs(); @@ -412,8 +403,55 @@ void tst_QClipboard::copyPasteSymbian() (cb->StreamDictionary()).AssignL(KClipboardUidTypePlainText, symbianStId); cb->CommitL(); CleanupStack::PopAndDestroy(2, cb); +} + +/* + Test that text copied to symbian clipboard + can be pasted to qt clipboard +*/ +// ### This test case only makes sense in symbian +void tst_QClipboard::copyPasteSymbian() +{ + if (!nativeClipboardWorking()) + QSKIP("Native clipboard not working in this setup", SkipAll); + const QString string("Test string symbian->qt."); + + nativeCopyHelper(string); + + QCOMPARE(QApplication::clipboard()->text(), string); +} + +/* + Test that text copied to symbian clipboard + can be pasted to qt clipboard, even if Qt + clipboard already had copied formatted text +*/ +// ### This test case only makes sense in symbian +void tst_QClipboard::copyCopyPasteSymbian() +{ + if (!nativeClipboardWorking()) + QSKIP("Native clipboard not working in this setup", SkipAll); + + //first copy some mime data with text/html and text/plain representations + QMimeData *mimeData = new QMimeData; + const QString preCopy(QLatin1String("qt_symbian")); + mimeData->setText(preCopy); + mimeData->setHtml(preCopy); + QApplication::clipboard()->setMimeData(mimeData); + + //check both representations are pastable + QCOMPARE(QApplication::clipboard()->mimeData()->html(), preCopy); + QCOMPARE(QApplication::clipboard()->mimeData()->text(), preCopy); + + //native copy some plain text + const QString string("symbian_qt"); + nativeCopyHelper(string); + //check text/plain is pastable QCOMPARE(QApplication::clipboard()->text(), string); + QCOMPARE(QApplication::clipboard()->mimeData()->text(), string); + //check text/html is cleared + QVERIFY(QApplication::clipboard()->mimeData()->html().isEmpty()); } #endif |