diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-06-28 00:56:47 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-06-28 00:56:47 (GMT) |
commit | 43697c982237f634f89ce661b1b363b8bfa383a7 (patch) | |
tree | 86a69bfbb4b80b2b28380252d7f85c8fde78baad /src | |
parent | 768209aebcbc66fec3a600be0a0f0e58d9f405d8 (diff) | |
parent | 8576e0f3652a8de05a5e59488b2611833944e6d6 (diff) | |
download | Qt-43697c982237f634f89ce661b1b363b8bfa383a7.zip Qt-43697c982237f634f89ce661b1b363b8bfa383a7.tar.gz Qt-43697c982237f634f89ce661b1b363b8bfa383a7.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src')
41 files changed, 960 insertions, 400 deletions
diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 1eb0d78..24cf142 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -45d1c9149ef8940081fa8dd35854d2b95ebaf3cd +2f598e9b7b376d851fe089bc1dc729bcf0393a06 diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 676ed23..8fa3a72 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,37 @@ +2010-05-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add an inlineCapacity template parameter to ListHashSet and use it to shrink the positioned object list hash set. + https://bugs.webkit.org/show_bug.cgi?id=39304 + <rdar://problem/7998366> + + Add an inlineCapacity template parameter to ListHashSet. + + * wtf/ListHashSet.h: + (WTF::::ListHashSet): + (WTF::::operator): + (WTF::::swap): + (WTF::::~ListHashSet): + (WTF::::size): + (WTF::::capacity): + (WTF::::isEmpty): + (WTF::::begin): + (WTF::::end): + (WTF::::find): + (WTF::::contains): + (WTF::::add): + (WTF::::insertBefore): + (WTF::::remove): + (WTF::::clear): + (WTF::::unlinkAndDelete): + (WTF::::appendNode): + (WTF::::insertNodeBefore): + (WTF::::deleteAllNodes): + (WTF::::makeIterator): + (WTF::::makeConstIterator): + (WTF::deleteAllValues): + 2010-06-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h index 54ed36b..09355ad 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h @@ -37,27 +37,27 @@ namespace WTF { // and an append that moves the element to the end even if already present, // but unclear yet if these are needed. - template<typename Value, typename HashFunctions> class ListHashSet; + template<typename Value, size_t inlineCapacity, typename HashFunctions> class ListHashSet; template<typename T> struct IdentityExtractor; - template<typename Value, typename HashFunctions> - void deleteAllValues(const ListHashSet<Value, HashFunctions>&); + template<typename Value, size_t inlineCapacity, typename HashFunctions> + void deleteAllValues(const ListHashSet<Value, inlineCapacity, HashFunctions>&); - template<typename ValueArg, typename HashArg> class ListHashSetIterator; - template<typename ValueArg, typename HashArg> class ListHashSetConstIterator; + template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator; + template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator; - template<typename ValueArg> struct ListHashSetNode; - template<typename ValueArg> struct ListHashSetNodeAllocator; - template<typename ValueArg, typename HashArg> struct ListHashSetNodeHashFunctions; + template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode; + template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator; + template<typename ValueArg, size_t inlineCapacity, typename HashArg> struct ListHashSetNodeHashFunctions; - template<typename ValueArg, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet : public FastAllocBase { + template<typename ValueArg, size_t inlineCapacity = 256, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet : public FastAllocBase { private: - typedef ListHashSetNode<ValueArg> Node; - typedef ListHashSetNodeAllocator<ValueArg> NodeAllocator; + typedef ListHashSetNode<ValueArg, inlineCapacity> Node; + typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator; typedef HashTraits<Node*> NodeTraits; - typedef ListHashSetNodeHashFunctions<ValueArg, HashArg> NodeHash; + typedef ListHashSetNodeHashFunctions<ValueArg, inlineCapacity, HashArg> NodeHash; typedef HashTable<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplType; typedef HashTableIterator<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplTypeIterator; @@ -67,10 +67,10 @@ namespace WTF { public: typedef ValueArg ValueType; - typedef ListHashSetIterator<ValueType, HashArg> iterator; - typedef ListHashSetConstIterator<ValueType, HashArg> const_iterator; + typedef ListHashSetIterator<ValueType, inlineCapacity, HashArg> iterator; + typedef ListHashSetConstIterator<ValueType, inlineCapacity, HashArg> const_iterator; - friend class ListHashSetConstIterator<ValueType, HashArg>; + friend class ListHashSetConstIterator<ValueType, inlineCapacity, HashArg>; ListHashSet(); ListHashSet(const ListHashSet&); @@ -119,9 +119,9 @@ namespace WTF { OwnPtr<NodeAllocator> m_allocator; }; - template<typename ValueArg> struct ListHashSetNodeAllocator { - typedef ListHashSetNode<ValueArg> Node; - typedef ListHashSetNodeAllocator<ValueArg> NodeAllocator; + template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator { + typedef ListHashSetNode<ValueArg, inlineCapacity> Node; + typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator; ListHashSetNodeAllocator() : m_freeList(pool()) @@ -181,15 +181,15 @@ namespace WTF { Node* m_freeList; bool m_isDoneWithInitialFreeList; - static const size_t m_poolSize = 256; + static const size_t m_poolSize = inlineCapacity; union { char pool[sizeof(Node) * m_poolSize]; double forAlignment; } m_pool; }; - template<typename ValueArg> struct ListHashSetNode { - typedef ListHashSetNodeAllocator<ValueArg> NodeAllocator; + template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode { + typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator; ListHashSetNode(ValueArg value) : m_value(value) @@ -220,25 +220,25 @@ namespace WTF { #endif }; - template<typename ValueArg, typename HashArg> struct ListHashSetNodeHashFunctions { - typedef ListHashSetNode<ValueArg> Node; + template<typename ValueArg, size_t inlineCapacity, typename HashArg> struct ListHashSetNodeHashFunctions { + typedef ListHashSetNode<ValueArg, inlineCapacity> Node; static unsigned hash(Node* const& key) { return HashArg::hash(key->m_value); } static bool equal(Node* const& a, Node* const& b) { return HashArg::equal(a->m_value, b->m_value); } static const bool safeToCompareToEmptyOrDeleted = false; }; - template<typename ValueArg, typename HashArg> class ListHashSetIterator { + template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator { private: - typedef ListHashSet<ValueArg, HashArg> ListHashSetType; - typedef ListHashSetIterator<ValueArg, HashArg> iterator; - typedef ListHashSetConstIterator<ValueArg, HashArg> const_iterator; - typedef ListHashSetNode<ValueArg> Node; + typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType; + typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator; + typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator; + typedef ListHashSetNode<ValueArg, inlineCapacity> Node; typedef ValueArg ValueType; typedef ValueType& ReferenceType; typedef ValueType* PointerType; - friend class ListHashSet<ValueArg, HashArg>; + friend class ListHashSet<ValueArg, inlineCapacity, HashArg>; ListHashSetIterator(const ListHashSetType* set, Node* position) : m_iterator(set, position) { } @@ -271,18 +271,18 @@ namespace WTF { const_iterator m_iterator; }; - template<typename ValueArg, typename HashArg> class ListHashSetConstIterator { + template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator { private: - typedef ListHashSet<ValueArg, HashArg> ListHashSetType; - typedef ListHashSetIterator<ValueArg, HashArg> iterator; - typedef ListHashSetConstIterator<ValueArg, HashArg> const_iterator; - typedef ListHashSetNode<ValueArg> Node; + typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType; + typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator; + typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator; + typedef ListHashSetNode<ValueArg, inlineCapacity> Node; typedef ValueArg ValueType; typedef const ValueType& ReferenceType; typedef const ValueType* PointerType; - friend class ListHashSet<ValueArg, HashArg>; - friend class ListHashSetIterator<ValueArg, HashArg>; + friend class ListHashSet<ValueArg, inlineCapacity, HashArg>; + friend class ListHashSetIterator<ValueArg, inlineCapacity, HashArg>; ListHashSetConstIterator(const ListHashSetType* set, Node* position) : m_set(set) @@ -341,11 +341,11 @@ namespace WTF { }; - template<typename ValueType, typename HashFunctions> + template<typename ValueType, size_t inlineCapacity, typename HashFunctions> struct ListHashSetTranslator { private: - typedef ListHashSetNode<ValueType> Node; - typedef ListHashSetNodeAllocator<ValueType> NodeAllocator; + typedef ListHashSetNode<ValueType, inlineCapacity> Node; + typedef ListHashSetNodeAllocator<ValueType, inlineCapacity> NodeAllocator; public: static unsigned hash(const ValueType& key) { return HashFunctions::hash(key); } static bool equal(Node* const& a, const ValueType& b) { return HashFunctions::equal(a->m_value, b); } @@ -355,16 +355,16 @@ namespace WTF { } }; - template<typename T, typename U> - inline ListHashSet<T, U>::ListHashSet() + template<typename T, size_t inlineCapacity, typename U> + inline ListHashSet<T, inlineCapacity, U>::ListHashSet() : m_head(0) , m_tail(0) , m_allocator(new NodeAllocator) { } - template<typename T, typename U> - inline ListHashSet<T, U>::ListHashSet(const ListHashSet& other) + template<typename T, size_t inlineCapacity, typename U> + inline ListHashSet<T, inlineCapacity, U>::ListHashSet(const ListHashSet& other) : m_head(0) , m_tail(0) , m_allocator(new NodeAllocator) @@ -374,16 +374,16 @@ namespace WTF { add(*it); } - template<typename T, typename U> - inline ListHashSet<T, U>& ListHashSet<T, U>::operator=(const ListHashSet& other) + template<typename T, size_t inlineCapacity, typename U> + inline ListHashSet<T, inlineCapacity, U>& ListHashSet<T, inlineCapacity, U>::operator=(const ListHashSet& other) { ListHashSet tmp(other); swap(tmp); return *this; } - template<typename T, typename U> - inline void ListHashSet<T, U>::swap(ListHashSet& other) + template<typename T, size_t inlineCapacity, typename U> + inline void ListHashSet<T, inlineCapacity, U>::swap(ListHashSet& other) { m_impl.swap(other.m_impl); std::swap(m_head, other.m_head); @@ -391,95 +391,95 @@ namespace WTF { m_allocator.swap(other.m_allocator); } - template<typename T, typename U> - inline ListHashSet<T, U>::~ListHashSet() + template<typename T, size_t inlineCapacity, typename U> + inline ListHashSet<T, inlineCapacity, U>::~ListHashSet() { deleteAllNodes(); } - template<typename T, typename U> - inline int ListHashSet<T, U>::size() const + template<typename T, size_t inlineCapacity, typename U> + inline int ListHashSet<T, inlineCapacity, U>::size() const { return m_impl.size(); } - template<typename T, typename U> - inline int ListHashSet<T, U>::capacity() const + template<typename T, size_t inlineCapacity, typename U> + inline int ListHashSet<T, inlineCapacity, U>::capacity() const { return m_impl.capacity(); } - template<typename T, typename U> - inline bool ListHashSet<T, U>::isEmpty() const + template<typename T, size_t inlineCapacity, typename U> + inline bool ListHashSet<T, inlineCapacity, U>::isEmpty() const { return m_impl.isEmpty(); } - template<typename T, typename U> - inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::begin() + template<typename T, size_t inlineCapacity, typename U> + inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::begin() { return makeIterator(m_head); } - template<typename T, typename U> - inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::end() + template<typename T, size_t inlineCapacity, typename U> + inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::end() { return makeIterator(0); } - template<typename T, typename U> - inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::begin() const + template<typename T, size_t inlineCapacity, typename U> + inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::begin() const { return makeConstIterator(m_head); } - template<typename T, typename U> - inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::end() const + template<typename T, size_t inlineCapacity, typename U> + inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::end() const { return makeConstIterator(0); } - template<typename T, typename U> - inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::find(const ValueType& value) + template<typename T, size_t inlineCapacity, typename U> + inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::find(const ValueType& value) { - typedef ListHashSetTranslator<ValueType, HashFunctions> Translator; + typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator; ImplTypeIterator it = m_impl.template find<ValueType, Translator>(value); if (it == m_impl.end()) return end(); return makeIterator(*it); } - template<typename T, typename U> - inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::find(const ValueType& value) const + template<typename T, size_t inlineCapacity, typename U> + inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::find(const ValueType& value) const { - typedef ListHashSetTranslator<ValueType, HashFunctions> Translator; + typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator; ImplTypeConstIterator it = m_impl.template find<ValueType, Translator>(value); if (it == m_impl.end()) return end(); return makeConstIterator(*it); } - template<typename T, typename U> - inline bool ListHashSet<T, U>::contains(const ValueType& value) const + template<typename T, size_t inlineCapacity, typename U> + inline bool ListHashSet<T, inlineCapacity, U>::contains(const ValueType& value) const { - typedef ListHashSetTranslator<ValueType, HashFunctions> Translator; + typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator; return m_impl.template contains<ValueType, Translator>(value); } - template<typename T, typename U> - pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::add(const ValueType &value) + template<typename T, size_t inlineCapacity, typename U> + pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::add(const ValueType &value) { - typedef ListHashSetTranslator<ValueType, HashFunctions> Translator; + typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator; pair<typename ImplType::iterator, bool> result = m_impl.template add<ValueType, NodeAllocator*, Translator>(value, m_allocator.get()); if (result.second) appendNode(*result.first); return std::make_pair(makeIterator(*result.first), result.second); } - template<typename T, typename U> - pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::insertBefore(iterator it, const ValueType& newValue) + template<typename T, size_t inlineCapacity, typename U> + pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::insertBefore(iterator it, const ValueType& newValue) { - typedef ListHashSetTranslator<ValueType, HashFunctions> Translator; + typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator; pair<typename ImplType::iterator, bool> result = m_impl.template add<ValueType, NodeAllocator*, Translator>(newValue, m_allocator.get()); if (result.second) insertNodeBefore(it.node(), *result.first); @@ -487,14 +487,14 @@ namespace WTF { } - template<typename T, typename U> - pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue) + template<typename T, size_t inlineCapacity, typename U> + pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue) { return insertBefore(find(beforeValue), newValue); } - template<typename T, typename U> - inline void ListHashSet<T, U>::remove(iterator it) + template<typename T, size_t inlineCapacity, typename U> + inline void ListHashSet<T, inlineCapacity, U>::remove(iterator it) { if (it == end()) return; @@ -502,14 +502,14 @@ namespace WTF { unlinkAndDelete(it.node()); } - template<typename T, typename U> - inline void ListHashSet<T, U>::remove(const ValueType& value) + template<typename T, size_t inlineCapacity, typename U> + inline void ListHashSet<T, inlineCapacity, U>::remove(const ValueType& value) { remove(find(value)); } - template<typename T, typename U> - inline void ListHashSet<T, U>::clear() + template<typename T, size_t inlineCapacity, typename U> + inline void ListHashSet<T, inlineCapacity, U>::clear() { deleteAllNodes(); m_impl.clear(); @@ -517,8 +517,8 @@ namespace WTF { m_tail = 0; } - template<typename T, typename U> - void ListHashSet<T, U>::unlinkAndDelete(Node* node) + template<typename T, size_t inlineCapacity, typename U> + void ListHashSet<T, inlineCapacity, U>::unlinkAndDelete(Node* node) { if (!node->m_prev) { ASSERT(node == m_head); @@ -539,8 +539,8 @@ namespace WTF { node->destroy(m_allocator.get()); } - template<typename T, typename U> - void ListHashSet<T, U>::appendNode(Node* node) + template<typename T, size_t inlineCapacity, typename U> + void ListHashSet<T, inlineCapacity, U>::appendNode(Node* node) { node->m_prev = m_tail; node->m_next = 0; @@ -556,8 +556,8 @@ namespace WTF { m_tail = node; } - template<typename T, typename U> - void ListHashSet<T, U>::insertNodeBefore(Node* beforeNode, Node* newNode) + template<typename T, size_t inlineCapacity, typename U> + void ListHashSet<T, inlineCapacity, U>::insertNodeBefore(Node* beforeNode, Node* newNode) { if (!beforeNode) return appendNode(newNode); @@ -572,8 +572,8 @@ namespace WTF { m_head = newNode; } - template<typename T, typename U> - void ListHashSet<T, U>::deleteAllNodes() + template<typename T, size_t inlineCapacity, typename U> + void ListHashSet<T, inlineCapacity, U>::deleteAllNodes() { if (!m_head) return; @@ -582,16 +582,16 @@ namespace WTF { node->destroy(m_allocator.get()); } - template<typename T, typename U> - inline ListHashSetIterator<T, U> ListHashSet<T, U>::makeIterator(Node* position) + template<typename T, size_t inlineCapacity, typename U> + inline ListHashSetIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeIterator(Node* position) { - return ListHashSetIterator<T, U>(this, position); + return ListHashSetIterator<T, inlineCapacity, U>(this, position); } - template<typename T, typename U> - inline ListHashSetConstIterator<T, U> ListHashSet<T, U>::makeConstIterator(Node* position) const + template<typename T, size_t inlineCapacity, typename U> + inline ListHashSetConstIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeConstIterator(Node* position) const { - return ListHashSetConstIterator<T, U>(this, position); + return ListHashSetConstIterator<T, inlineCapacity, U>(this, position); } template<bool, typename ValueType, typename HashTableType> @@ -603,10 +603,10 @@ namespace WTF { delete (*it)->m_value; } - template<typename T, typename U> - inline void deleteAllValues(const ListHashSet<T, U>& collection) + template<typename T, size_t inlineCapacity, typename U> + inline void deleteAllValues(const ListHashSet<T, inlineCapacity, U>& collection) { - deleteAllValues<true, typename ListHashSet<T, U>::ValueType>(collection.m_impl); + deleteAllValues<true, typename ListHashSet<T, inlineCapacity, U>::ValueType>(collection.m_impl); } } // namespace WTF diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 1a343eb..924b120 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 45d1c9149ef8940081fa8dd35854d2b95ebaf3cd + 2f598e9b7b376d851fe089bc1dc729bcf0393a06 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index fd259e0..a84f177 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,90 @@ +2010-06-24 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed Symbian build fix. + + The QML WebKit integration needs to be part of QtWebKit.sis + + * WebCore.pro: Deploy qmlwebkitplugin.dll. + +2010-06-23 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Do not render the full frame when there is some elements with fixed positioning + https://bugs.webkit.org/show_bug.cgi?id=33150 + + Do not render the full frame when there is some elements with fixed positioning + https://bugs.webkit.org/show_bug.cgi?id=33150 + + The frame view take into acount the list of fixed object when scrolling + the view. If the number of object is lower than a certain threshold, the pixel + are blitted, and the invalidated area updated. + + * page/FrameView.cpp: + (WebCore::FrameView::addFixedObject): + (WebCore::FrameView::removeFixedObject): + (WebCore::FrameView::scrollContentsFastPath): + * page/FrameView.h: + * platform/ScrollView.cpp: + (WebCore::ScrollView::scrollContents): + (WebCore::ScrollView::scrollContentsFastPath): + * platform/ScrollView.h: + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::repaintRectIncludingDescendants): + * rendering/RenderLayer.h: + * rendering/RenderObject.cpp: + (WebCore::RenderObject::styleWillChange): + +2010-05-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Allocate the m_preloads list hash set dynamically and free it when done. + https://bugs.webkit.org/show_bug.cgi?id=39309 + <rdar://problem/7998495> + + This saves about 6000 bytes on a fully loaded document. + + * loader/DocLoader.cpp: + (WebCore::DocLoader::requestPreload): + (WebCore::DocLoader::clearPreloads): + * loader/DocLoader.h: + +2010-05-18 Anders Carlsson <andersca@apple.com> + + Revert unintended indentation and unnecessary nested name specifier. + + * rendering/RenderBlock.cpp: + (WebCore::clipOutPositionedObjects): + (WebCore::RenderBlock::insertPositionedObject): + +2010-05-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add an inlineCapacity template parameter to ListHashSet and use it to shrink the positioned object list hash set. + https://bugs.webkit.org/show_bug.cgi?id=39304 + <rdar://problem/7998366> + + Set the inlineCapacity for the positionedObjects ListHashSet to 4 instead of 256. Since a RenderBlock usually has + few positioned objects, this saves memory. + + * WebCore.base.exp: + * rendering/RenderBlock.cpp: + (WebCore::clipOutPositionedObjects): + (WebCore::RenderBlock::insertPositionedObject): + * rendering/RenderBlock.h: + (WebCore::RenderBlock::positionedObjects): + +2010-06-22 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed Qt/Symbian build fix. + + Fix "make clean" to not try to execute clean commands for + the extra targets we use to simulate "make install". + + * WebCore.pro: Use no_clean in CONFIG of extra compilers. + 2010-06-21 Balazs Kelemen <kb@inf.u-szeged.hu> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index e0b4905..1162a52 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -25,6 +25,13 @@ symbian: { webkitbackup.sources = ../WebKit/qt/symbian/backup_registration.xml webkitbackup.path = /private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) + contains(QT_CONFIG, declarative) { + declarativeImport.sources = qmlwebkitplugin$${QT_LIBINFIX}.dll + declarativeImport.sources += ../WebKit/qt/declarative/qmldir + declarativeImport.path = c:$$QT_IMPORTS_BASE_DIR/QtWebKit + DEPLOYMENT += declarativeImport + } + DEPLOYMENT += webkitlibs webkitbackup # Need to guarantee that these come before system includes of /epoc32/include @@ -2866,6 +2873,7 @@ HEADERS += $$WEBKIT_API_HEADERS # INSTALLS is not implemented in qmake's s60 generators, copy headers manually inst_headers.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} inst_headers.input = WEBKIT_INSTALL_HEADERS + inst_headers.CONFIG = no_clean !isEmpty(INSTALL_HEADERS): inst_headers.output = $$INSTALL_HEADERS/QtWebKit/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT} else: inst_headers.output = $$[QT_INSTALL_HEADERS]/QtWebKit/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT} @@ -2875,6 +2883,7 @@ HEADERS += $$WEBKIT_API_HEADERS inst_modfile.commands = $$inst_headers.commands inst_modfile.input = moduleFile inst_modfile.output = $$[QMAKE_MKSPECS]/modules + inst_modfile.CONFIG = no_clean QMAKE_EXTRA_COMPILERS += inst_modfile diff --git a/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp b/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp index 0053e7b..4597704 100644 --- a/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp @@ -407,10 +407,14 @@ void DocLoader::requestPreload(CachedResource::Type type, const String& url, con encoding = charset.isEmpty() ? m_doc->frame()->loader()->encoding() : charset; CachedResource* resource = requestResource(type, url, encoding, true); - if (!resource || m_preloads.contains(resource)) + if (!resource || (m_preloads && m_preloads->contains(resource))) return; resource->increasePreloadCount(); - m_preloads.add(resource); + + if (!m_preloads) + m_preloads.set(new ListHashSet<CachedResource*>); + m_preloads->add(resource); + #if PRELOAD_DEBUG printf("PRELOADING %s\n", resource->url().latin1().data()); #endif @@ -421,8 +425,11 @@ void DocLoader::clearPreloads() #if PRELOAD_DEBUG printPreloadStats(); #endif - ListHashSet<CachedResource*>::iterator end = m_preloads.end(); - for (ListHashSet<CachedResource*>::iterator it = m_preloads.begin(); it != end; ++it) { + if (!m_preloads) + return; + + ListHashSet<CachedResource*>::iterator end = m_preloads->end(); + for (ListHashSet<CachedResource*>::iterator it = m_preloads->begin(); it != end; ++it) { CachedResource* res = *it; res->decreasePreloadCount(); if (res->canDelete() && !res->inCache()) diff --git a/src/3rdparty/webkit/WebCore/loader/DocLoader.h b/src/3rdparty/webkit/WebCore/loader/DocLoader.h index 8ec73e1..66e4164 100644 --- a/src/3rdparty/webkit/WebCore/loader/DocLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/DocLoader.h @@ -47,8 +47,7 @@ class ImageLoader; class KURL; // The DocLoader manages the loading of scripts/images/stylesheets for a single document. -class DocLoader : public Noncopyable -{ +class DocLoader : public Noncopyable { friend class Cache; friend class ImageLoader; @@ -117,7 +116,7 @@ private: int m_requestCount; - ListHashSet<CachedResource*> m_preloads; + OwnPtr<ListHashSet<CachedResource*> > m_preloads; struct PendingPreload { CachedResource::Type m_type; String m_url; diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.cpp b/src/3rdparty/webkit/WebCore/page/FrameView.cpp index a53db36..639414b 100644 --- a/src/3rdparty/webkit/WebCore/page/FrameView.cpp +++ b/src/3rdparty/webkit/WebCore/page/FrameView.cpp @@ -884,7 +884,7 @@ bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect { const size_t fixedObjectThreshold = 5; - ListHashSet<RenderBox*>* positionedObjects = 0; + RenderBlock::PositionedObjectsListHashSet* positionedObjects = 0; if (RenderView* root = m_frame->contentRenderer()) positionedObjects = root->positionedObjects(); @@ -896,14 +896,14 @@ bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect // Get the rects of the fixed objects visible in the rectToScroll Vector<IntRect, fixedObjectThreshold> subRectToUpdate; bool updateInvalidatedSubRect = true; - ListHashSet<RenderBox*>::const_iterator end = positionedObjects->end(); - for (ListHashSet<RenderBox*>::const_iterator it = positionedObjects->begin(); it != end; ++it) { + RenderBlock::PositionedObjectsListHashSet::const_iterator end = positionedObjects->end(); + for (RenderBlock::PositionedObjectsListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) { RenderBox* renderBox = *it; if (renderBox->style()->position() != FixedPosition) continue; - IntRect topLevelRect; - IntRect updateRect = renderBox->paintingRootRect(topLevelRect); - updateRect.move(-scrollX(), -scrollY()); + IntRect updateRect = renderBox->layer()->repaintRectIncludingDescendants(); + updateRect = contentsToWindow(updateRect); + updateRect.intersect(rectToScroll); if (!updateRect.isEmpty()) { if (subRectToUpdate.size() >= fixedObjectThreshold) { diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp index a7b8a02..798663e 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp @@ -1982,13 +1982,13 @@ void RenderBlock::paintSelection(PaintInfo& paintInfo, int tx, int ty) } #ifndef BUILDING_ON_TIGER -static void clipOutPositionedObjects(const RenderObject::PaintInfo* paintInfo, int tx, int ty, ListHashSet<RenderBox*>* positionedObjects) +static void clipOutPositionedObjects(const RenderObject::PaintInfo* paintInfo, int tx, int ty, RenderBlock::PositionedObjectsListHashSet* positionedObjects) { if (!positionedObjects) return; - ListHashSet<RenderBox*>::const_iterator end = positionedObjects->end(); - for (ListHashSet<RenderBox*>::const_iterator it = positionedObjects->begin(); it != end; ++it) { + RenderBlock::PositionedObjectsListHashSet::const_iterator end = positionedObjects->end(); + for (RenderBlock::PositionedObjectsListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) { RenderBox* r = *it; paintInfo->context->clipOut(IntRect(tx + r->x(), ty + r->y(), r->width(), r->height())); } @@ -2274,7 +2274,7 @@ void RenderBlock::insertPositionedObject(RenderBox* o) { // Create the list of special objects if we don't aleady have one if (!m_positionedObjects) - m_positionedObjects = new ListHashSet<RenderBox*>; + m_positionedObjects = new PositionedObjectsListHashSet; m_positionedObjects->add(o); } diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h index 184f983..d555d31 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h @@ -74,7 +74,9 @@ public: void insertPositionedObject(RenderBox*); void removePositionedObject(RenderBox*); void removePositionedObjects(RenderBlock*); - ListHashSet<RenderBox*>* positionedObjects() const { return m_positionedObjects; } + + typedef ListHashSet<RenderBox*, 4> PositionedObjectsListHashSet; + PositionedObjectsListHashSet* positionedObjects() const { return m_positionedObjects; } void addPercentHeightDescendant(RenderBox*); static void removePercentHeightDescendant(RenderBox*); @@ -483,9 +485,10 @@ private: void setCollapsedBottomMargin(const MarginInfo&); // End helper functions and structs used by layoutBlockChildren. - typedef ListHashSet<RenderBox*>::const_iterator Iterator; + typedef PositionedObjectsListHashSet::const_iterator Iterator; DeprecatedPtrList<FloatingObject>* m_floatingObjects; - ListHashSet<RenderBox*>* m_positionedObjects; + + PositionedObjectsListHashSet* m_positionedObjects; // An inline can be split with blocks occurring in between the inline content. // When this occurs we need a pointer to our next object. We can basically be diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp index 3314772..a012868 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp @@ -325,6 +325,14 @@ void RenderLayer::updateLayerPositions(UpdateLayerPositionsFlags flags) m_marquee->updateMarqueePosition(); } +IntRect RenderLayer::repaintRectIncludingDescendants() const +{ + IntRect repaintRect = m_repaintRect; + for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) + repaintRect.unite(child->repaintRectIncludingDescendants()); + return repaintRect; +} + void RenderLayer::computeRepaintRects() { RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint(); diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h index 81a66e1..e221f28 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h @@ -394,6 +394,7 @@ public: // Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint. IntRect repaintRect() const { return m_repaintRect; } + IntRect repaintRectIncludingDescendants() const; void computeRepaintRects(); void updateRepaintRectsAfterScroll(bool fixed = false); void setNeedsFullRepaint(bool f = true) { m_needsFullRepaint = f; } diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 0e73680..69a431f 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,47 @@ +2010-06-24 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed Symbian build fix. + + The QML WebKit integration needs to be part of QtWebKit.sis + + * declarative/declarative.pro: Removed non-working deployment. + +2010-06-23 David Boddie <dboddie@trolltech.com> + + Reviewed by Simon Hausmann. + + [Qt] Doc: Fixed documentation errors. + + * docs/qtwebkit-bridge.qdoc: + +2010-06-23 Alessandro Portale <alessandro.portale@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Provide the Webkit Qml plugin with a UID3 on Symbian + + ...otherwise we cannot Symbian sign it. + + * declarative/declarative.pro: + +2010-06-23 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed Qt package build fix. + + When building without build-webkit, set OUTPUT_DIR if necessary, like + in the other .pro files. + + * declarative/declarative.pro: + +2010-06-22 Tasuku Suzuki <tasuku.suzuki@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation with QT_NO_COMBOBOX. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::createSelectPopup): + 2010-06-11 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> Reviewed by nobody, build fix. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 7d1c794..e253161 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -576,7 +576,7 @@ QtAbstractWebPopup* ChromeClientQt::createSelectPopup() #elif !defined(QT_NO_COMBOBOX) return new QtFallbackWebPopup; #else - return result; + return 0; #endif } diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro b/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro index 1371e57..75268f3 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro +++ b/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro @@ -6,6 +6,8 @@ CONFIG += qt plugin win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../.. + QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir copy2build.input = QMLDIRFILE CONFIG(QTDIR_build) { @@ -65,13 +67,6 @@ qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH symbian:{ TARGET.UID3 = 0x20021321 - load(data_caging_paths) - include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - - importFiles.sources = qmlwebkitplugin.dll qmldir - importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH - - DEPLOYMENT = importFiles } INSTALLS += target qmldir diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index ea60792..26e587d 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1452,7 +1452,7 @@ qint64 QIODevicePrivate::peek(char *data, qint64 maxSize) return readBytes; buffer.ungetBlock(data, readBytes); - pos -= readBytes; + *pPos -= readBytes; return readBytes; } @@ -1467,7 +1467,7 @@ QByteArray QIODevicePrivate::peek(qint64 maxSize) return result; buffer.ungetBlock(result.constData(), result.size()); - pos -= result.size(); + *pPos -= result.size(); return result; } diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 80a1093..623e3df 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -815,6 +815,10 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) } } + QDeclarativeCustomParser *cp = 0; + if (isCustomParser) + cp = output->types.at(obj->type).type->customParser(); + // Build all explicit properties specified foreach(Property *prop, obj->properties) { @@ -825,7 +829,9 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) bool canDefer = false; if (isCustomParser) { - if (doesPropertyExist(prop, obj)) { + if (doesPropertyExist(prop, obj) && + (!(cp->flags() & QDeclarativeCustomParser::AcceptsAttachedProperties) || + !isAttachedPropertyName(prop->name))) { int ids = compileState.ids.count(); COMPILE_CHECK(buildProperty(prop, obj, objCtxt)); canDefer = ids == compileState.ids.count(); @@ -876,8 +882,7 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) defaultProperty->release(); // Compile custom parser parts - if (isCustomParser/* && !customProps.isEmpty()*/) { - QDeclarativeCustomParser *cp = output->types.at(obj->type).type->customParser(); + if (isCustomParser && !customProps.isEmpty()) { cp->clearErrors(); cp->compiler = this; cp->object = obj; @@ -1356,7 +1361,7 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl Returns true if (value) property \a prop exists on obj, false otherwise. */ bool QDeclarativeCompiler::doesPropertyExist(QDeclarativeParser::Property *prop, - QDeclarativeParser::Object *obj) + QDeclarativeParser::Object *obj) { if(isAttachedPropertyName(prop->name) || prop->name == "id") return true; @@ -2176,6 +2181,18 @@ int QDeclarativeCompiler::evaluateEnum(const QByteArray& script) const return -1; } +const QMetaObject *QDeclarativeCompiler::resolveType(const QByteArray& name) const +{ + QDeclarativeType *qmltype = 0; + if (!enginePrivate->importDatabase.resolveType(unit->imports, name, &qmltype, + 0, 0, 0, 0)) + return 0; + if (!qmltype) + return 0; + return qmltype->metaObject(); +} + + // Ensures that the dynamic meta specification on obj is valid bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) { @@ -2199,6 +2216,10 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) if (QString::fromUtf8(prop.name).at(0).isUpper()) COMPILE_EXCEPTION(&prop, tr("Property names cannot begin with an upper case letter")); + + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(prop.name)) + COMPILE_EXCEPTION(&prop, tr("Illegal property name")); + propNames.insert(prop.name); } @@ -2208,6 +2229,8 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) COMPILE_EXCEPTION(obj, tr("Duplicate signal name")); if (QString::fromUtf8(name).at(0).isUpper()) COMPILE_EXCEPTION(obj, tr("Signal names cannot begin with an upper case letter")); + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name)) + COMPILE_EXCEPTION(obj, tr("Illegal signal name")); methodNames.insert(name); } for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) { @@ -2216,6 +2239,8 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) COMPILE_EXCEPTION(obj, tr("Duplicate method name")); if (QString::fromUtf8(name).at(0).isUpper()) COMPILE_EXCEPTION(obj, tr("Method names cannot begin with an upper case letter")); + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name)) + COMPILE_EXCEPTION(obj, tr("Illegal method name")); methodNames.insert(name); } diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 908c703..caad376 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -161,6 +161,7 @@ public: static bool isSignalPropertyName(const QByteArray &); int evaluateEnum(const QByteArray& script) const; // for QDeclarativeCustomParser::evaluateEnum + const QMetaObject *resolveType(const QByteArray& name) const; // for QDeclarativeCustomParser::resolveType private: static void reset(QDeclarativeCompiledData *); diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index b4919ff..9d3032c 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -572,7 +572,9 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent) { Q_D(QDeclarativeComponent); QDeclarativeContext* ctxt = creationContext(); - if(!ctxt) + if(!ctxt && d->engine) + ctxt = d->engine->rootContext(); + if (!ctxt) return QScriptValue(QScriptValue::NullValue); QObject* ret = create(ctxt); if (!ret) diff --git a/src/declarative/qml/qdeclarativecustomparser.cpp b/src/declarative/qml/qdeclarativecustomparser.cpp index 472a883..97a6a00 100644 --- a/src/declarative/qml/qdeclarativecustomparser.cpp +++ b/src/declarative/qml/qdeclarativecustomparser.cpp @@ -295,4 +295,14 @@ int QDeclarativeCustomParser::evaluateEnum(const QByteArray& script) const return compiler->evaluateEnum(script); } +/*! + Resolves \a name to a type, or 0 if it is not a type. This can be used + to type-check object nodes. +*/ +const QMetaObject *QDeclarativeCustomParser::resolveType(const QByteArray& name) const +{ + return compiler->resolveType(name); +} + + QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativecustomparser_p.h b/src/declarative/qml/qdeclarativecustomparser_p.h index 0e397c5..509e30a 100644 --- a/src/declarative/qml/qdeclarativecustomparser_p.h +++ b/src/declarative/qml/qdeclarativecustomparser_p.h @@ -113,10 +113,18 @@ private: class Q_DECLARATIVE_EXPORT QDeclarativeCustomParser { public: - QDeclarativeCustomParser() : compiler(0), object(0) {} + enum Flag { + NoFlag = 0x00000000, + AcceptsAttachedProperties = 0x00000001 + }; + Q_DECLARE_FLAGS(Flags, Flag); + + QDeclarativeCustomParser() : compiler(0), object(0), m_flags(NoFlag) {} + QDeclarativeCustomParser(Flags f) : compiler(0), object(0), m_flags(f) {} virtual ~QDeclarativeCustomParser() {} void clearErrors(); + Flags flags() const { return m_flags; } virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &)=0; virtual void setCustomData(QObject *, const QByteArray &)=0; @@ -130,12 +138,16 @@ protected: int evaluateEnum(const QByteArray&) const; + const QMetaObject *resolveType(const QByteArray&) const; + private: QList<QDeclarativeError> exceptions; QDeclarativeCompiler *compiler; QDeclarativeParser::Object *object; + Flags m_flags; friend class QDeclarativeCompiler; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeCustomParser::Flags); #if 0 #define QML_REGISTER_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, CUSTOMTYPE) \ diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 5c4d229..98b4bbf 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1033,6 +1033,17 @@ QDeclarativeContextData *QDeclarativeEnginePrivate::getContext(QScriptContext *c return contextClass->contextFromValue(scopeNode); } +/*! + Returns the QUrl associated with the script \a ctxt for the case that there is + no QDeclarativeContext. +*/ +QUrl QDeclarativeEnginePrivate::getUrl(QScriptContext *ctxt) +{ + QScriptValue scopeNode = QScriptDeclarativeClass::scopeChainValue(ctxt, -3); + Q_ASSERT(scopeNode.isValid()); + Q_ASSERT(QScriptDeclarativeClass::scriptClass(scopeNode) == contextClass); + return contextClass->urlFromValue(scopeNode); +} QString QDeclarativeEnginePrivate::urlToLocalFileOrQrc(const QUrl& url) { @@ -1075,16 +1086,19 @@ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QS static_cast<QDeclarativeScriptEngine*>(engine)->p; QDeclarativeEngine* activeEngine = activeEnginePriv->q_func(); - QDeclarativeContextData* context = activeEnginePriv->getContext(ctxt); - Q_ASSERT(context); - if(ctxt->argumentCount() != 1) { return ctxt->throwError(QLatin1String("Qt.createComponent(): Invalid arguments")); - }else{ + } else { + QString arg = ctxt->argument(0).toString(); if (arg.isEmpty()) return engine->nullValue(); - QUrl url = QUrl(context->resolvedUrl(QUrl(arg))); + QUrl url; + QDeclarativeContextData* context = activeEnginePriv->getContext(ctxt); + if (context) + url = QUrl(context->resolvedUrl(QUrl(arg))); + else + url = activeEnginePriv->getUrl(ctxt).resolved(QUrl(arg)); QDeclarativeComponent *c = new QDeclarativeComponent(activeEngine, url, activeEngine); QDeclarativeComponentPrivate::get(c)->creationContext = context; QDeclarativeData::get(c, true)->setImplicitDestructible(); diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 3269e98..cfa9d73 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -315,6 +315,7 @@ public: static QDeclarativeEnginePrivate *get(QScriptEngine *e) { return static_cast<QDeclarativeScriptEngine*>(e)->p; } static QDeclarativeEngine *get(QDeclarativeEnginePrivate *p) { return p->q_func(); } QDeclarativeContextData *getContext(QScriptContext *); + QUrl getUrl(QScriptContext *); static QString urlToLocalFileOrQrc(const QUrl& url); diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp index f29b3f4..3e22c82 100644 --- a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp @@ -55,6 +55,7 @@ QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engi : QScriptClass(engine) { QString eval = QLatin1String("eval"); + QString version = QLatin1String("version"); QScriptValue globalObject = engine->globalObject(); @@ -68,6 +69,9 @@ QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engi QString name = iter.name(); + if (name == version) + continue; + if (name != eval) m_globalObject.setProperty(iter.scriptName(), iter.value()); newGlobalObject.setProperty(iter.scriptName(), iter.value()); diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index aca01b2..3af892d 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -797,6 +797,26 @@ QScriptDeclarativeClass::Value MetaCallArgument::toValue(QDeclarativeEngine *e) } } +int QDeclarativeObjectMethodScriptClass::enumType(const QMetaObject *meta, const QString &strname) +{ + QByteArray str = strname.toUtf8(); + QByteArray scope; + QByteArray name; + int scopeIdx = str.lastIndexOf("::"); + if (scopeIdx != -1) { + scope = str.left(scopeIdx); + name = str.mid(scopeIdx + 2); + } else { + name = str; + } + for (int i = meta->enumeratorCount() - 1; i >= 0; --i) { + QMetaEnum m = meta->enumerator(i); + if ((m.name() == name) && (scope.isEmpty() || (m.scope() == scope))) + return QVariant::Int; + } + return QVariant::Invalid; +} + QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass::call(Object *o, QScriptContext *ctxt) { MethodData *method = static_cast<MethodData *>(o); @@ -810,7 +830,9 @@ QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass:: // ### Cache for (int ii = 0; ii < argTypeNames.count(); ++ii) { argTypes[ii] = QMetaType::type(argTypeNames.at(ii)); - if (argTypes[ii] == QVariant::Invalid) + if (argTypes[ii] == QVariant::Invalid) + argTypes[ii] = enumType(method->object->metaObject(), argTypeNames.at(ii)); + if (argTypes[ii] == QVariant::Invalid) return Value(ctxt, ctxt->throwError(QString::fromLatin1("Unknown method parameter type: %1").arg(QLatin1String(argTypeNames.at(ii))))); } diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h index 4b27e53..75e384c 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h +++ b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h @@ -80,6 +80,8 @@ protected: virtual Value property(Object *, const Identifier &); private: + int enumType(const QMetaObject *, const QString &); + PersistentIdentifier m_connectId; PersistentIdentifier m_disconnectId; QScriptValue m_connect; diff --git a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp index 2a3417a..764a8db 100644 --- a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp +++ b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp @@ -107,8 +107,7 @@ QDeclarativeTypeNameScriptClass::queryProperty(Object *obj, const Identifier &na return 0; } - } else { - Q_ASSERT(data->type); + } else if (data->type) { QString strName = toString(name); @@ -134,6 +133,7 @@ QDeclarativeTypeNameScriptClass::queryProperty(Object *obj, const Identifier &na if (!object) return 0; return ep->objectClass->queryProperty(object, name, flags, 0); } + } return 0; diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 9ed21a6..deb835d 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -551,9 +551,13 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser QDeclarativeCustomParserNode node = qvariant_cast<QDeclarativeCustomParserNode>(value); - if (node.name() != "ListElement") { - error(node, QDeclarativeListModel::tr("ListElement: cannot contain nested elements")); - return false; + if (node.name() != listElementTypeName) { + const QMetaObject *mo = resolveType(node.name()); + if (mo != &QDeclarativeListElement::staticMetaObject) { + error(node, QDeclarativeListModel::tr("ListElement: cannot contain nested elements")); + return false; + } + listElementTypeName = node.name(); // cache right name for next time } { @@ -650,6 +654,7 @@ QByteArray QDeclarativeListModelParser::compile(const QList<QDeclarativeCustomPa { QList<ListInstruction> instr; QByteArray data; + listElementTypeName = QByteArray(); // unknown for(int ii = 0; ii < customProps.count(); ++ii) { const QDeclarativeCustomParserProperty &prop = customProps.at(ii); diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h index d09062e..6aff9c6 100644 --- a/src/declarative/util/qdeclarativelistmodel_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p.h @@ -135,6 +135,8 @@ private: bool compileProperty(const QDeclarativeCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data); bool definesEmptyList(const QString &); + + QByteArray listElementTypeName; }; diff --git a/src/declarative/util/qdeclarativepropertychanges_p.h b/src/declarative/util/qdeclarativepropertychanges_p.h index c2ed466..bb0f944 100644 --- a/src/declarative/util/qdeclarativepropertychanges_p.h +++ b/src/declarative/util/qdeclarativepropertychanges_p.h @@ -79,6 +79,9 @@ public: class QDeclarativePropertyChangesParser : public QDeclarativeCustomParser { public: + QDeclarativePropertyChangesParser() + : QDeclarativeCustomParser(AcceptsAttachedProperties) {} + void compileList(QList<QPair<QByteArray, QVariant> > &list, const QByteArray &pre, const QDeclarativeCustomParserProperty &prop); virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 2a85fdc..ef719ca 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -3065,6 +3065,11 @@ bool QETWidget::translateMouseEvent(const MSG &msg) break; } } +#ifndef Q_OS_WINCE + static bool trackMouseEventLookup = false; + typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT); + static PtrTrackMouseEvent ptrTrackMouseEvent = 0; +#endif state = translateButtonState(msg.wParam, type, button); // button state const QPoint widgetPos = mapFromGlobal(QPoint(msg.pt.x, msg.pt.y)); QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos); @@ -3129,9 +3134,6 @@ bool QETWidget::translateMouseEvent(const MSG &msg) #ifndef Q_OS_WINCE if (curWin != 0) { - static bool trackMouseEventLookup = false; - typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT); - static PtrTrackMouseEvent ptrTrackMouseEvent = 0; if (!trackMouseEventLookup) { trackMouseEventLookup = true; ptrTrackMouseEvent = (PtrTrackMouseEvent)QLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent"); @@ -3245,6 +3247,21 @@ bool QETWidget::translateMouseEvent(const MSG &msg) qt_button_down = 0; } +#ifndef Q_OS_WINCE + if (type == QEvent::MouseButtonPress + && QApplication::activePopupWidget() != activePopupWidget + && ptrTrackMouseEvent + && curWin) { + // Since curWin is already the window we clicked on, + // we have to setup the mouse tracking here. + TRACKMOUSEEVENT tme; + tme.cbSize = sizeof(TRACKMOUSEEVENT); + tme.dwFlags = 0x00000002; // TME_LEAVE + tme.hwndTrack = curWin; // Track on window receiving msgs + tme.dwHoverTime = (DWORD)-1; // HOVER_DEFAULT + ptrTrackMouseEvent(&tme); + } +#endif if (type == QEvent::MouseButtonPress && QApplication::activePopupWidget() != activePopupWidget && replayPopupMouseEvent) { diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp index 873b8f9..3dc6afc 100644 --- a/src/gui/kernel/qkeymapper_mac.cpp +++ b/src/gui/kernel/qkeymapper_mac.cpp @@ -866,14 +866,27 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e UInt32 macModifiers = 0; GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, 0, sizeof(macModifiers), 0, &macModifiers); +#ifdef QT_MAC_USE_COCOA + // The unicode characters in the range 0xF700-0xF747 are reserved + // by Mac OS X for transient use as keyboard function keys. We + // wont send 'text' for such key events. This is done to match + // behavior on other platforms. + unsigned int *unicodeKey = (unsigned int*)info; + if (*unicodeKey >= 0xf700 && *unicodeKey <= 0xf747) + text = QString(); + bool isAccepted; +#endif handled_event = QKeyMapper::sendKeyEvent(widget, grab, (ekind == kEventRawKeyUp) ? QEvent::KeyRelease : QEvent::KeyPress, qtKey, modifiers, text, ekind == kEventRawKeyRepeat, 0, macScanCode, macVirtualKey, macModifiers #ifdef QT_MAC_USE_COCOA - ,static_cast<bool *>(info) + ,&isAccepted #endif ); +#ifdef QT_MAC_USE_COCOA + *unicodeKey = (unsigned int)isAccepted; +#endif } return handled_event; } diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 8cef03c..3fc27f4 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -682,10 +682,12 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve NSEvent *event = static_cast<NSEvent *>(keyEvent); EventRef key_event = static_cast<EventRef>(const_cast<void *>([event eventRef])); Q_ASSERT(key_event); + unsigned int info = 0; if ([event type] == NSKeyDown) { NSString *characters = [event characters]; unichar value = [characters characterAtIndex:0]; qt_keymapper_private()->updateKeyMap(0, key_event, (void *)&value); + info = value; } // Redirect keys to alien widgets. @@ -701,9 +703,8 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve if (mustUseCocoaKeyEvent()) return qt_dispatchKeyEventWithCocoa(keyEvent, widgetToGetEvent); - bool isAccepted; - bool consumed = qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &isAccepted, true); - return consumed && isAccepted; + bool consumed = qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &info, true); + return consumed && (info != 0); #endif } diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 280712a..a9bb691 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2804,7 +2804,7 @@ void QWidgetPrivate::setSubWindowStacking(bool set) QList<QWidget *> widgets = q->findChildren<QWidget *>(); for (int i=0; i<widgets.size(); ++i) { QWidget *child = widgets.at(i); - if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created)) { + if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) { if (set) [qt_mac_window_for(q) addChildWindow:qt_mac_window_for(child) ordered:NSWindowAbove]; else diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 139139f..e6c36a4 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -413,7 +413,7 @@ struct QtFontFamily bool fixedPitchComputed : 1; #endif #ifdef Q_WS_X11 - bool symbol_checked; + bool symbol_checked : 1; #endif QString name; diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index e08d135..b6e11df 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -53,16 +53,30 @@ QT_BEGIN_NAMESPACE QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine) - : CActive(CActive::EPriorityUserInput), engine(engine), - ipConnectionNotifier(0), iHandleStateNotificationsFromManager(false), - iFirstSync(true), iStoppedByUser(false), iClosedByUser(false), iDeprecatedConnectionId(0), - iError(QNetworkSession::UnknownSessionError), iALREnabled(0), iConnectInBackground(false) +: CActive(CActive::EPriorityUserInput), engine(engine), + iDynamicUnSetdefaultif(0), ipConnectionNotifier(0), + iHandleStateNotificationsFromManager(false), iFirstSync(true), iStoppedByUser(false), + iClosedByUser(false), iError(QNetworkSession::UnknownSessionError), iALREnabled(0), + iConnectInBackground(false), isOpening(false) { CActiveScheduler::Add(this); #ifdef SNAP_FUNCTIONALITY_AVAILABLE iMobility = NULL; #endif + // Try to load "Open C" dll dynamically and + // try to attach to unsetdefaultif function dynamically. + // This is to avoid build breaks with old OpenC versions. + if (iOpenCLibrary.Load(_L("libc")) == KErrNone) { + iDynamicUnSetdefaultif = (TOpenCUnSetdefaultifFunction)iOpenCLibrary.Lookup(597); + } +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - "; + if (iDynamicUnSetdefaultif) + qDebug() << "dynamic unsetdefaultif() is present in PIPS library. "; + else + qDebug() << "dynamic unsetdefaultif() not present in PIPS library. "; +#endif TRAP_IGNORE(iConnectionMonitor.ConnectL()); } @@ -70,6 +84,7 @@ QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine) QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl() { isOpen = false; + isOpening = false; // Cancel Connection Progress Notifications first. // Note: ConnectionNotifier must be destroyed before Canceling RConnection::Start() @@ -77,9 +92,6 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl() delete ipConnectionNotifier; ipConnectionNotifier = NULL; - // Cancel possible RConnection::Start() - Cancel(); - #ifdef SNAP_FUNCTIONALITY_AVAILABLE if (iMobility) { delete iMobility; @@ -87,13 +99,19 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl() } #endif - iConnection.Close(); + // Cancel possible RConnection::Start() + Cancel(); iSocketServ.Close(); // Close global 'Open C' RConnection + // Clears also possible unsetdefaultif() flags. setdefaultif(0); iConnectionMonitor.Close(); + iOpenCLibrary.Close(); +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - destroyed (and setdefaultif(0))"; +#endif } void QNetworkSessionPrivateImpl::configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState) @@ -101,18 +119,12 @@ void QNetworkSessionPrivateImpl::configurationStateChanged(TUint32 accessPointId if (iHandleStateNotificationsFromManager) { #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - " - << "configurationStateChanged from manager for IAP : " << QString::number(accessPointId) - << "configurationStateChanged connMon ID : " << QString::number(connMonId) - << " : to a state: " << newState - << " whereas my current state is: " << state; -#endif - if (connMonId == iDeprecatedConnectionId) { -#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG - qDebug() << "QNS this : " << QString::number((uint)this) << " - " - << "however status update from manager ignored because it related to already closed connection."; + << "configurationStateChanged from manager for IAP : " << QString::number(accessPointId) + << "connMon ID : " << QString::number(connMonId) << " : to a state: " << newState + << "whereas my current state is: " << state; +#else + Q_UNUSED(connMonId); #endif - return; - } this->newState(newState, accessPointId); } } @@ -236,6 +248,14 @@ QNetworkInterface QNetworkSessionPrivateImpl::interface(TUint iapId) const #ifndef QT_NO_NETWORKINTERFACE QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "currentInterface() requested, state: " << state + << "publicConfig validity: " << publicConfig.isValid(); + if (activeInterface.isValid()) + qDebug() << "interface is: " << activeInterface.humanReadableName(); +#endif + if (!publicConfig.isValid() || state != QNetworkSession::Connected) { return QNetworkInterface(); } @@ -292,12 +312,14 @@ void QNetworkSessionPrivateImpl::open() #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "open() called, session state is: " << state << " and isOpen is: " - << isOpen; + << isOpen << isOpening; #endif - if (isOpen || (state == QNetworkSession::Connecting)) { + + if (isOpen || isOpening) return; - } - + + isOpening = true; + // Stop handling IAP state change signals from QNetworkConfigurationManagerPrivate // => RConnection::ProgressNotification will be used for IAP/SNAP monitoring iHandleStateNotificationsFromManager = false; @@ -325,7 +347,6 @@ void QNetworkSessionPrivateImpl::open() // Clear possible previous states iStoppedByUser = false; iClosedByUser = false; - iDeprecatedConnectionId = 0; TInt error = iSocketServ.Connect(); if (error != KErrNone) { @@ -358,44 +379,6 @@ void QNetworkSessionPrivateImpl::open() } if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - // Search through existing connections. - // If there is already connection which matches to given IAP - // try to attach to existing connection. - TBool connected(EFalse); - TConnectionInfoBuf connInfo; - TUint count; - if (iConnection.EnumerateConnections(count) == KErrNone) { - for (TUint i=1; i<=count; i++) { - // Note: GetConnectionInfo expects 1-based index. - if (iConnection.GetConnectionInfo(i, connInfo) == KErrNone) { - SymbianNetworkConfigurationPrivate *symbianConfig = - toSymbianConfig(privateConfiguration(publicConfig)); - - if (connInfo().iIapId == symbianConfig->numericIdentifier()) { - if (iConnection.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) { - activeConfig = publicConfig; -#ifndef QT_NO_NETWORKINTERFACE - activeInterface = interface(symbianConfig->numericIdentifier()); -#endif - connected = ETrue; - startTime = QDateTime::currentDateTime(); - // Use name of the IAP to open global 'Open C' RConnection - QByteArray nameAsByteArray = publicConfig.name().toUtf8(); - ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); - strcpy(ifr.ifr_name, nameAsByteArray.constData()); - error = setdefaultif(&ifr); - isOpen = true; - // Make sure that state will be Connected - newState(QNetworkSession::Connected); - emit quitPendingWaitsForOpened(); - break; - } - } - } - } - } - if (!connected) { SymbianNetworkConfigurationPrivate *symbianConfig = toSymbianConfig(privateConfiguration(publicConfig)); @@ -420,13 +403,20 @@ void QNetworkSessionPrivateImpl::open() if (!IsActive()) { SetActive(); } - newState(QNetworkSession::Connecting); - } + // Avoid flip flop of states if the configuration is already + // active. IsOpen/opened() will indicate when ready. + if (state != QNetworkSession::Connected) { + newState(QNetworkSession::Connecting); + } } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { SymbianNetworkConfigurationPrivate *symbianConfig = toSymbianConfig(privateConfiguration(publicConfig)); #ifdef OCC_FUNCTIONALITY_AVAILABLE + // On Symbian^3 if service network is not reachable, it triggers a UI (aka EasyWLAN) where + // user can create new IAPs. To detect this, we need to store the number of IAPs + // there was before connection was started. + iKnownConfigsBeforeConnectionStart = engine->accessPointConfigurationIdentifiers(); TConnPrefList snapPref; TExtendedConnPref prefs; prefs.SetSnapId(symbianConfig->numericIdentifier()); @@ -441,7 +431,11 @@ void QNetworkSessionPrivateImpl::open() if (!IsActive()) { SetActive(); } - newState(QNetworkSession::Connecting); + // Avoid flip flop of states if the configuration is already + // active. IsOpen/opened() will indicate when ready. + if (state != QNetworkSession::Connected) { + newState(QNetworkSession::Connecting); + } } else if (publicConfig.type() == QNetworkConfiguration::UserChoice) { iKnownConfigsBeforeConnectionStart = engine->accessPointConfigurationIdentifiers(); iConnection.Start(iStatus); @@ -453,6 +447,7 @@ void QNetworkSessionPrivateImpl::open() if (error != KErrNone) { isOpen = false; + isOpening = false; iError = QNetworkSession::UnknownSessionError; emit QNetworkSessionPrivate::error(iError); if (ipConnectionNotifier) { @@ -496,19 +491,19 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals) << "close() called, session state is: " << state << " and isOpen is : " << isOpen; #endif - if (!isOpen) { + + if (!isOpen && state != QNetworkSession::Connecting) { return; } // Mark this session as closed-by-user so that we are able to report // distinguish between stop() and close() state transitions // when reporting. iClosedByUser = true; - isOpen = false; - activeConfig = QNetworkConfiguration(); + isOpening = false; + serviceConfig = QNetworkConfiguration(); - Cancel(); #ifdef SNAP_FUNCTIONALITY_AVAILABLE if (iMobility) { delete iMobility; @@ -522,17 +517,33 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals) iHandleStateNotificationsFromManager = true; } - iConnection.Close(); + Cancel(); // closes iConnection iSocketServ.Close(); - // Close global 'Open C' RConnection - setdefaultif(0); + // Close global 'Open C' RConnection. If OpenC supports, + // close the defaultif for good to avoid difficult timing + // and bouncing issues of network going immediately back up + // because of e.g. select() thread etc. + if (iDynamicUnSetdefaultif) { + iDynamicUnSetdefaultif(); + } else { + setdefaultif(0); + } - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + // If UserChoice, go down immediately. If some other configuration, + // go down immediately if there is no reports expected from the platform; + // in practice Connection Monitor is aware of connections only after + // KFinishedSelection event, and hence reports only after that event, but + // that does not seem to be trusted on all Symbian versions --> safest + // to go down. + if (publicConfig.type() == QNetworkConfiguration::UserChoice || state == QNetworkSession::Connecting) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "going disconnected right away, since either UserChoice or Connecting"; +#endif newState(QNetworkSession::Closing); newState(QNetworkSession::Disconnected); } - if (allowSignals) { emit closed(); } @@ -593,6 +604,7 @@ void QNetworkSessionPrivateImpl::stop() #endif // Since we are open, use RConnection to stop the interface isOpen = false; + isOpening = false; iStoppedByUser = true; newState(QNetworkSession::Closing); if (ipConnectionNotifier) { @@ -602,6 +614,7 @@ void QNetworkSessionPrivateImpl::stop() } iConnection.Stop(RConnection::EStopAuthoritative); isOpen = true; + isOpening = false; close(false); emit closed(); } @@ -611,8 +624,13 @@ void QNetworkSessionPrivateImpl::migrate() { #ifdef SNAP_FUNCTIONALITY_AVAILABLE if (iMobility) { - // Close global 'Open C' RConnection - setdefaultif(0); + // Close global 'Open C' RConnection. If openC supports, use the 'heavy' + // version to block all subsequent requests. + if (iDynamicUnSetdefaultif) { + iDynamicUnSetdefaultif(); + } else { + setdefaultif(0); + } // Start migrating to new IAP iMobility->MigrateToPreferredCarrier(); } @@ -694,8 +712,17 @@ void QNetworkSessionPrivateImpl::PreferredCarrierAvailable(TAccessPointInfo aOld SymbianNetworkConfigurationPrivate *symbianConfig = toSymbianConfig(privateConfiguration(configs[i])); - if (symbianConfig->numericIdentifier() == aNewAPInfo.AccessPoint()) - emit preferredConfigurationChanged(configs[i], aIsSeamless); + if (symbianConfig->numericIdentifier() == aNewAPInfo.AccessPoint()) { + // Any slot connected to the signal might throw an std::exception, + // which must not propagate into Symbian code (this function is a callback + // from platform). We could convert exception to a symbian Leave, but since the + // prototype of this function bans this (no trailing 'L'), we just catch + // and drop. + QT_TRY { + emit preferredConfigurationChanged(configs[i], aIsSeamless); + } + QT_CATCH (std::exception&) {} + } } } else { migrate(); @@ -705,7 +732,10 @@ void QNetworkSessionPrivateImpl::PreferredCarrierAvailable(TAccessPointInfo aOld void QNetworkSessionPrivateImpl::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*/, TBool /*aIsSeamless*/) { if (iALREnabled > 0) { - emit newConfigurationActivated(); + QT_TRY { + emit newConfigurationActivated(); + } + QT_CATCH (std::exception&) {} } else { accept(); } @@ -715,10 +745,11 @@ void QNetworkSessionPrivateImpl::Error(TInt /*aError*/) { #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - " - << "roaming Error() occured"; + << "roaming Error() occured, isOpen is: " << isOpen; #endif if (isOpen) { isOpen = false; + isOpening = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::RoamingError; @@ -727,18 +758,24 @@ void QNetworkSessionPrivateImpl::Error(TInt /*aError*/) if (ipConnectionNotifier) { ipConnectionNotifier->StopNotifications(); } - syncStateWithInterface(); - // In some cases IAP is still in Connected state when - // syncStateWithInterface(); is called - // => Following call makes sure that Session state - // changes immediately to Disconnected. - newState(QNetworkSession::Disconnected); - emit closed(); + QT_TRY { + syncStateWithInterface(); + // In some cases IAP is still in Connected state when + // syncStateWithInterface(); is called + // => Following call makes sure that Session state + // changes immediately to Disconnected. + newState(QNetworkSession::Disconnected); + emit closed(); + } + QT_CATCH (std::exception&) {} } else if (iStoppedByUser) { // If the user of this session has called the stop() and // configuration is based on internet SNAP, this needs to be // done here because platform might roam. - newState(QNetworkSession::Disconnected); + QT_TRY { + newState(QNetworkSession::Disconnected); + } + QT_CATCH (std::exception&) {} } } #endif @@ -870,7 +907,7 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia _LIT(KSetting, "IAP\\Id"); iConnection.GetIntSetting(KSetting, iapId); } - + #ifdef SNAP_FUNCTIONALITY_AVAILABLE if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { // Try to search IAP from the used SNAP using IAP Id @@ -892,8 +929,8 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia // <=> Note: It's possible that in this case reported IAP is // clone of the one of the IAPs of the used SNAP // => If mappingName matches, clone has been found - QNetworkConfiguration pt = QNetworkConfigurationManager() - .configurationFromIdentifier(QString::number(qHash(iapId))); + QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier( + QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId))); SymbianNetworkConfigurationPrivate *symbianConfig = toSymbianConfig(privateConfiguration(pt)); @@ -907,20 +944,58 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia } } } else { +#ifdef OCC_FUNCTIONALITY_AVAILABLE + // On Symbian^3 (only, not earlier or Symbian^4) if the SNAP was not reachable, it triggers + // user choice type of activity (EasyWLAN). As a result, a new IAP may be created, and + // hence if was not found yet. Therefore update configurations and see if there is something new. + // 1. Update knowledge from the databases. + engine->requestUpdate(); + // 2. Check if new configuration was created during connection creation + QList<QString> knownConfigs = engine->accessPointConfigurationIdentifiers(); +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "opened configuration was not known beforehand, looking for new."; +#endif + if (knownConfigs.count() > iKnownConfigsBeforeConnectionStart.count()) { + // Configuration count increased => new configuration was created + // => Search new, created configuration + QString newIapId; + for (int i=0; i < iKnownConfigsBeforeConnectionStart.count(); i++) { + if (knownConfigs[i] != iKnownConfigsBeforeConnectionStart[i]) { + newIapId = knownConfigs[i]; + break; + } + } + if (newIapId.isEmpty()) { + newIapId = knownConfigs[knownConfigs.count()-1]; + } + pt = QNetworkConfigurationManager().configurationFromIdentifier(newIapId); + if (pt.isValid()) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "new configuration was found, name, IAP id: " << pt.name() << pt.identifier(); +#endif + return pt; + } + } +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "configuration was not found, returning invalid."; +#endif +#endif // OCC_FUNCTIONALITY_AVAILABLE // Given IAP Id was not found from known IAPs array return QNetworkConfiguration(); } - // Matching IAP was not found from used SNAP // => IAP from another SNAP is returned // (Note: Returned IAP matches to given IAP Id) return pt; } #endif - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { if (engine) { - QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier(QString::number(qHash(iapId))); + QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier( + QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId))); // Try to found User Selected IAP from known IAPs (accessPointConfigurations) if (pt.isValid()) { return pt; @@ -957,6 +1032,10 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia void QNetworkSessionPrivateImpl::RunL() { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "RConnection::RunL with status code: " << iStatus.Int(); +#endif TInt statusCode = iStatus.Int(); switch (statusCode) { @@ -977,13 +1056,14 @@ void QNetworkSessionPrivateImpl::RunL() if (error != KErrNone) { isOpen = false; + isOpening = false; iError = QNetworkSession::UnknownSessionError; - emit QNetworkSessionPrivate::error(iError); + QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError)); Cancel(); if (ipConnectionNotifier) { ipConnectionNotifier->StopNotifications(); } - syncStateWithInterface(); + QT_TRYCATCH_LEAVING(syncStateWithInterface()); return; } @@ -995,6 +1075,7 @@ void QNetworkSessionPrivateImpl::RunL() #endif isOpen = true; + isOpening = false; activeConfig = newActiveConfig; SymbianNetworkConfigurationPrivate *symbianConfig = @@ -1010,26 +1091,30 @@ void QNetworkSessionPrivateImpl::RunL() startTime = QDateTime::currentDateTime(); - newState(QNetworkSession::Connected); - emit quitPendingWaitsForOpened(); + QT_TRYCATCH_LEAVING({ + newState(QNetworkSession::Connected); + emit quitPendingWaitsForOpened(); + }); } break; case KErrNotFound: // Connection failed isOpen = false; + isOpening = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::InvalidConfigurationError; - emit QNetworkSessionPrivate::error(iError); + QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError)); Cancel(); if (ipConnectionNotifier) { ipConnectionNotifier->StopNotifications(); } - syncStateWithInterface(); + QT_TRYCATCH_LEAVING(syncStateWithInterface()); break; case KErrCancel: // Connection attempt cancelled case KErrAlreadyExists: // Connection already exists default: isOpen = false; + isOpening = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); if (publicConfig.state() == QNetworkConfiguration::Undefined || @@ -1038,12 +1123,12 @@ void QNetworkSessionPrivateImpl::RunL() } else { iError = QNetworkSession::UnknownSessionError; } - emit QNetworkSessionPrivate::error(iError); + QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError)); Cancel(); if (ipConnectionNotifier) { ipConnectionNotifier->StopNotifications(); } - syncStateWithInterface(); + QT_TRYCATCH_LEAVING(syncStateWithInterface()); break; } } @@ -1110,6 +1195,12 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint return false; } + // Make sure that some lagging 'connecting' state-changes do not overwrite + // if we are already connected (may righfully still happen with roaming though). + if (state == QNetworkSession::Connected && newState == QNetworkSession::Connecting) { + return false; + } + bool emitSessionClosed = false; // If we abruptly go down and user hasn't closed the session, we've been aborted. @@ -1123,6 +1214,7 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint // application or session stops connection or when network drops // unexpectedly). isOpen = false; + isOpening = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::SessionAbortedError; @@ -1187,7 +1279,7 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint QNetworkConfiguration config = bestConfigFromSNAP(publicConfig); if ((config.state() == QNetworkConfiguration::Defined) || (config.state() == QNetworkConfiguration::Discovered)) { - + activeConfig = QNetworkConfiguration(); state = newState; #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed E to: " << state; @@ -1208,24 +1300,30 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint } } } +#ifdef OCC_FUNCTIONALITY_AVAILABLE + // If the retVal is not true here, it means that the status update may apply to an IAP outside of + // SNAP (session is based on SNAP but follows IAP outside of it), which may occur on Symbian^3 EasyWlan. + if (retVal == false && activeConfig.d.data() && activeConfig.d.data()->numericId == accessPointId) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed G to: " << state; +#endif + if (newState == QNetworkSession::Disconnected) { + activeConfig = QNetworkConfiguration(); + } + state = newState; + emit q->stateChanged(state); + retVal = true; + } +#endif } } - if (emitSessionClosed) { emit closed(); } if (state == QNetworkSession::Disconnected) { - // The connection has gone down, and processing of status updates must be - // stopped. Depending on platform, there may come 'connecting/connected' states - // considerably later (almost a second). Connection id is an increasing - // number, so this does not affect next _real_ 'conneting/connected' states. - - SymbianNetworkConfigurationPrivate *symbianConfig = - toSymbianConfig(privateConfiguration(publicConfig)); - - iDeprecatedConnectionId = symbianConfig->connectionIdentifier(); + // Just in case clear activeConfiguration. + activeConfig = QNetworkConfiguration(); } - return retVal; } @@ -1250,7 +1348,6 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne case KFinishedSelection: if (aError == KErrNone) { - // The user successfully selected an IAP to be used break; } else @@ -1364,7 +1461,7 @@ void ConnectionProgressNotifier::DoCancel() void ConnectionProgressNotifier::RunL() { if (iStatus == KErrNone) { - iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError); + QT_TRYCATCH_LEAVING(iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError)); SetActive(); iConnection.ProgressNotification(iProgress, iStatus); diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h index b045ff1..0754ace 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.h +++ b/src/plugins/bearer/symbian/qnetworksession_impl.h @@ -73,6 +73,8 @@ QT_BEGIN_NAMESPACE class ConnectionProgressNotifier; class SymbianEngine; +typedef void (*TOpenCUnSetdefaultifFunction)(); + class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive #ifdef SNAP_FUNCTIONALITY_AVAILABLE , public MMobilityProtocolResp @@ -153,6 +155,9 @@ private: // data QDateTime startTime; + RLibrary iOpenCLibrary; + TOpenCUnSetdefaultifFunction iDynamicUnSetdefaultif; + mutable RSocketServ iSocketServ; mutable RConnection iConnection; mutable RConnectionMonitor iConnectionMonitor; @@ -162,7 +167,6 @@ private: // data bool iFirstSync; bool iStoppedByUser; bool iClosedByUser; - TUint32 iDeprecatedConnectionId; #ifdef SNAP_FUNCTIONALITY_AVAILABLE CActiveCommsMobilityApiExt* iMobility; @@ -178,6 +182,8 @@ private: // data TUint32 iOldRoamingIap; TUint32 iNewRoamingIap; + bool isOpening; + friend class ConnectionProgressNotifier; }; diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index ab1ba28..ca444c1 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -46,7 +46,6 @@ #include <cdbcols.h> #include <d32dbms.h> #include <nifvar.h> -#include <QEventLoop> #include <QTimer> #include <QTime> // For randgen seeding #include <QtCore> // For randgen seeding @@ -73,9 +72,6 @@ QT_BEGIN_NAMESPACE -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - static const int KValueThatWillBeAddedToSNAPId = 1000; -#endif static const int KUserChoiceIAPId = 0; SymbianNetworkConfigurationPrivate::SymbianNetworkConfigurationPrivate() @@ -114,8 +110,8 @@ QString SymbianNetworkConfigurationPrivate::bearerName() const } SymbianEngine::SymbianEngine(QObject *parent) -: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iFirstUpdate(true), iInitOk(true), - iIgnoringUpdates(false) +: QBearerEngine(parent), CActive(CActive::EPriorityHigh), iFirstUpdate(true), iInitOk(true), + iUpdatePending(false) { } @@ -135,6 +131,9 @@ void SymbianEngine::initialize() } TRAP_IGNORE(iConnectionMonitor.ConnectL()); +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + TRAP_IGNORE(iConnectionMonitor.SetUintAttribute(EBearerIdAll, 0, KBearerGroupThreshold, 1)); +#endif TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); #ifdef SNAP_FUNCTIONALITY_AVAILABLE @@ -190,6 +189,28 @@ SymbianEngine::~SymbianEngine() delete cleanup; } +void SymbianEngine::delayedConfigurationUpdate() +{ + QMutexLocker locker(&mutex); + + if (iUpdatePending) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug("QNCM delayed configuration update (ECommit or ERecover occurred)."); +#endif + TRAPD(error, updateConfigurationsL()); + if (error == KErrNone) { + updateStatesToSnaps(); + } + iUpdatePending = false; + // Start monitoring again. + if (!IsActive()) { + SetActive(); + // Start waiting for new notification + ipCommsDB->RequestNotification(iStatus); + } + } +} + bool SymbianEngine::hasIdentifier(const QString &id) { QMutexLocker locker(&mutex); @@ -261,7 +282,7 @@ void SymbianEngine::updateConfigurationsL() RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL(connectionMethods[i]); CleanupClosePushL(connectionMethod); TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); - QString ident = QString::number(qHash(iapId)); + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId)); if (accessPointConfigurations.contains(ident)) { knownConfigs.removeOne(ident); } else { @@ -272,7 +293,11 @@ void SymbianEngine::updateConfigurationsL() accessPointConfigurations.insert(ptr->id, ptr); mutex.unlock(); - emit configurationAdded(ptr); + // Emit configuration added. Connected slots may throw execptions + // which propagate here --> must be converted to leaves (standard + // std::exception would cause any TRAP trapping this function to terminate + // program). + QT_TRYCATCH_LEAVING(emit configurationAdded(ptr)); mutex.lock(); } } @@ -288,15 +313,15 @@ void SymbianEngine::updateConfigurationsL() RCmDestination destination; destination = iCmManager.DestinationL(destinations[i]); CleanupClosePushL(destination); - QString ident = QString::number(qHash(destination.Id()+KValueThatWillBeAddedToSNAPId)); //TODO: Check if it's ok to add 1000 SNAP Id to prevent SNAP ids overlapping IAP ids + QString ident = QT_BEARERMGMT_CONFIGURATION_SNAP_PREFIX + + QString::number(qHash(destination.Id())); if (snapConfigurations.contains(ident)) { knownSnapConfigs.removeOne(ident); } else { SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; - CleanupStack::PushL(cpPriv); HBufC *pName = destination.NameLC(); - cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()); + QT_TRYCATCH_LEAVING(cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length())); CleanupStack::PopAndDestroy(pName); pName = NULL; @@ -313,10 +338,8 @@ void SymbianEngine::updateConfigurationsL() snapConfigurations.insert(ident, ptr); mutex.unlock(); - emit configurationAdded(ptr); + QT_TRYCATCH_LEAVING(emit configurationAdded(ptr)); mutex.lock(); - - CleanupStack::Pop(cpPriv); } QNetworkConfigurationPrivatePointer privSNAP = snapConfigurations.value(ident); @@ -325,7 +348,7 @@ void SymbianEngine::updateConfigurationsL() CleanupClosePushL(connectionMethod); TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); - QString iface = QString::number(qHash(iapId)); + QString iface = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId)); // Check that IAP can be found from accessPointConfigurations list QNetworkConfigurationPrivatePointer priv = accessPointConfigurations.value(iface); if (!priv) { @@ -336,7 +359,7 @@ void SymbianEngine::updateConfigurationsL() accessPointConfigurations.insert(ptr->id, ptr); mutex.unlock(); - emit configurationAdded(ptr); + QT_TRYCATCH_LEAVING(emit configurationAdded(ptr)); mutex.lock(); QMutexLocker configLocker(&privSNAP->mutex); @@ -380,7 +403,7 @@ void SymbianEngine::updateConfigurationsL() TInt retVal = pDbTView->GotoFirstRecord(); while (retVal == KErrNone) { pDbTView->ReadUintL(TPtrC(COMMDB_ID), apId); - QString ident = QString::number(qHash(apId)); + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId)); if (accessPointConfigurations.contains(ident)) { knownConfigs.removeOne(ident); } else { @@ -390,7 +413,7 @@ void SymbianEngine::updateConfigurationsL() accessPointConfigurations.insert(ident, ptr); mutex.unlock(); - emit configurationAdded(ptr); + QT_TRYCATCH_LEAVING(emit configurationAdded(ptr)); mutex.lock(); } else { delete cpPriv; @@ -400,7 +423,7 @@ void SymbianEngine::updateConfigurationsL() } CleanupStack::PopAndDestroy(pDbTView); #endif - updateActiveAccessPoints(); + QT_TRYCATCH_LEAVING(updateActiveAccessPoints()); foreach (const QString &oldIface, knownConfigs) { //remove non existing IAP @@ -408,6 +431,7 @@ void SymbianEngine::updateConfigurationsL() mutex.unlock(); emit configurationRemoved(ptr); + QT_TRYCATCH_LEAVING(emit configurationRemoved(ptr)); mutex.lock(); // Remove non existing IAP from SNAPs @@ -431,6 +455,7 @@ void SymbianEngine::updateConfigurationsL() mutex.unlock(); emit configurationRemoved(ptr); + QT_TRYCATCH_LEAVING(emit configurationRemoved(ptr)); mutex.lock(); } @@ -445,14 +470,12 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL( RCmConnectionMethod& connectionMethod) { SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; - CleanupStack::PushL(cpPriv); - TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); - QString ident = QString::number(qHash(iapId)); + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId)); HBufC *pName = connectionMethod.GetStringAttributeL(CMManager::ECmName); CleanupStack::PushL(pName); - cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()); + QT_TRYCATCH_LEAVING(cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length())); CleanupStack::PopAndDestroy(pName); pName = NULL; @@ -500,7 +523,7 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL( if (error == KErrNone && pName) { CleanupStack::PushL(pName); - cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length()); + QT_TRYCATCH_LEAVING(cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length())); CleanupStack::PopAndDestroy(pName); pName = NULL; } @@ -518,8 +541,6 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL( cpPriv->type = QNetworkConfiguration::InternetAccessPoint; cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; cpPriv->roamingSupported = false; - - CleanupStack::Pop(cpPriv); return cpPriv; } #else @@ -550,9 +571,9 @@ void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL( User::Leave(KErrNotFound); } - QString ident = QString::number(qHash(aApId)); + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(aApId)); - apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length()); + QT_TRYCATCH_LEAVING(apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length())); apNetworkConfiguration->isValid = true; apNetworkConfiguration->id = ident; apNetworkConfiguration->numericId = aApId; @@ -617,10 +638,12 @@ QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfigurationL() TCmDefConnValue defaultConnectionValue; iCmManager.ReadDefConnL(defaultConnectionValue); if (defaultConnectionValue.iType == ECmDefConnDestination) { - QString iface = QString::number(qHash(defaultConnectionValue.iId+KValueThatWillBeAddedToSNAPId)); + QString iface = QT_BEARERMGMT_CONFIGURATION_SNAP_PREFIX + + QString::number(qHash(defaultConnectionValue.iId)); ptr = snapConfigurations.value(iface); } else if (defaultConnectionValue.iType == ECmDefConnConnectionMethod) { - QString iface = QString::number(qHash(defaultConnectionValue.iId)); + QString iface = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX + + QString::number(qHash(defaultConnectionValue.iId)); ptr = accessPointConfigurations.value(iface); } #endif @@ -658,8 +681,14 @@ void SymbianEngine::updateActiveAccessPoints() iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); User::WaitForRequest(status); - QString ident = QString::number(qHash(apId)); + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId)); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); +#ifdef OCC_FUNCTIONALITY_AVAILABLE + if (!ptr) { + // If IAP was not found, check if the update was about EasyWLAN + ptr = configurationFromEasyWlan(apId, connectionId); + } +#endif if (ptr) { iConnectionMonitor.GetIntAttribute(connectionId, subConnectionCount, KConnectionStatus, connectionStatus, status); User::WaitForRequest(status); @@ -690,7 +719,7 @@ void SymbianEngine::updateActiveAccessPoints() if (iOnline != online) { iOnline = online; mutex.unlock(); - emit this->onlineStateChanged(iOnline); + emit this->onlineStateChanged(online); mutex.lock(); } } @@ -715,7 +744,8 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn // Set state of returned IAPs to Discovered // if state is not already Active for(TUint i=0; i<iapInfo.iCount; i++) { - QString ident = QString::number(qHash(iapInfo.iIap[i].iIapId)); + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX + + QString::number(qHash(iapInfo.iIap[i].iIapId)); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); if (ptr) { unavailableConfigs.removeOne(ident); @@ -783,6 +813,59 @@ void SymbianEngine::updateStatesToSnaps() } } +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +void SymbianEngine::updateMobileBearerToConfigs(TConnMonBearerInfo bearerInfo) +{ + QHash<QString, QNetworkConfigurationPrivatePointer>::const_iterator i = + accessPointConfigurations.constBegin(); + while (i != accessPointConfigurations.constEnd()) { + QNetworkConfigurationPrivatePointer ptr = i.value(); + + QMutexLocker locker(&ptr->mutex); + + SymbianNetworkConfigurationPrivate *p = toSymbianConfig(ptr); + + if (p->bearer >= SymbianNetworkConfigurationPrivate::Bearer2G && + p->bearer <= SymbianNetworkConfigurationPrivate::BearerHSPA) { + switch (bearerInfo) { + case EBearerInfoCSD: + p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + break; + case EBearerInfoWCDMA: + p->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA; + break; + case EBearerInfoCDMA2000: + p->bearer = SymbianNetworkConfigurationPrivate::BearerCDMA2000; + break; + case EBearerInfoGPRS: + p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + break; + case EBearerInfoHSCSD: + p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + break; + case EBearerInfoEdgeGPRS: + p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + break; + case EBearerInfoWcdmaCSD: + p->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA; + break; + case EBearerInfoHSDPA: + p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + break; + case EBearerInfoHSUPA: + p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + break; + case EBearerInfoHSxPA: + p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + break; + } + } + + ++i; + } +} +#endif + bool SymbianEngine::changeConfigurationStateTo(QNetworkConfigurationPrivatePointer ptr, QNetworkConfiguration::StateFlags newState) { @@ -873,55 +956,30 @@ void SymbianEngine::RunL() { QMutexLocker locker(&mutex); - if (iIgnoringUpdates) { -#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG - qDebug("QNCM CommsDB event handling postponed (postpone-timer running because IAPs/SNAPs were updated very recently)."); -#endif - return; - } - - RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); - - switch (event) { - case RDbNotifier::EUnlock: /** All read locks have been removed. */ - case RDbNotifier::ECommit: /** A transaction has been committed. */ - case RDbNotifier::ERollback: /** A transaction has been rolled back */ - case RDbNotifier::ERecover: /** The database has been recovered */ + if (iStatus != KErrCancel) { + // By default, start relistening notifications. Stop only if interesting event occured. + iWaitingCommsDatabaseNotifications = true; + RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); + switch (event) { + case RDbNotifier::ECommit: /** A transaction has been committed. */ + case RDbNotifier::ERecover: /** The database has been recovered */ #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG - qDebug("QNCM CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int()); + qDebug("QNCM CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int()); #endif - iIgnoringUpdates = true; - // Other events than ECommit get lower priority. In practice with those events, - // we delay_before_updating methods, whereas - // with ECommit we _update_before_delaying the reaction to next event. - // Few important notes: 1) listening to only ECommit does not seem to be adequate, - // but updates will be missed. Hence other events are reacted upon too. - // 2) RDbNotifier records the most significant event, and that will be returned once - // we issue new RequestNotification, and hence updates will not be missed even - // when we are 'not reacting to them' for few seconds. - if (event == RDbNotifier::ECommit) { - TRAPD(error, updateConfigurationsL()); - if (error == KErrNone) { - updateStatesToSnaps(); - } - locker.unlock(); - waitRandomTime(); - locker.relock(); - } else { - locker.unlock(); - waitRandomTime(); - locker.relock(); - TRAPD(error, updateConfigurationsL()); - if (error == KErrNone) { - updateStatesToSnaps(); + // Mark that there is update pending. No need to ask more events, + // as we know we will be updating anyway when the timer expires. + if (!iUpdatePending) { + iUpdatePending = true; + iWaitingCommsDatabaseNotifications = false; + // Update after random time, so that many processes won't + // start updating simultaneously + updateConfigurationsAfterRandomTime(); } + break; + default: + // Do nothing + break; } - iIgnoringUpdates = false; // Wait time done, allow updating again - iWaitingCommsDatabaseNotifications = true; - break; - default: - // Do nothing - break; } if (iWaitingCommsDatabaseNotifications) { @@ -945,6 +1003,20 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) QMutexLocker locker(&mutex); switch (aEvent.EventType()) { +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + case EConnMonBearerInfoChange: + { + CConnMonBearerInfoChange* realEvent; + realEvent = (CConnMonBearerInfoChange*) &aEvent; + TUint connectionId = realEvent->ConnectionId(); + if (connectionId == EBearerIdAll) { + //Network level event + TConnMonBearerInfo bearerInfo = (TConnMonBearerInfo)realEvent->BearerInfo(); + updateMobileBearerToConfigs(bearerInfo); + } + break; + } +#endif case EConnMonConnectionStatusChange: { CConnMonConnectionStatusChange* realEvent; @@ -960,14 +1032,23 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) TRequestStatus status; iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); User::WaitForRequest(status); - QString ident = QString::number(qHash(apId)); + + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId)); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); +#ifdef OCC_FUNCTIONALITY_AVAILABLE + if (!ptr) { + // Check if status was regarding EasyWLAN + ptr = configurationFromEasyWlan(apId, connectionId); + } +#endif if (ptr) { ptr->mutex.lock(); toSymbianConfig(ptr)->connectionId = connectionId; ptr->mutex.unlock(); - emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(), - connectionId, QNetworkSession::Connecting); + QT_TRYCATCH_LEAVING( + emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(), + connectionId, QNetworkSession::Connecting) + ); } } else if (connectionStatus == KLinkLayerOpen) { // Connection has been successfully opened @@ -977,31 +1058,41 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) TRequestStatus status; iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); User::WaitForRequest(status); - QString ident = QString::number(qHash(apId)); + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId)); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); +#ifdef OCC_FUNCTIONALITY_AVAILABLE + if (!ptr) { + // Check for EasyWLAN + ptr = configurationFromEasyWlan(apId, connectionId); + } +#endif if (ptr) { ptr->mutex.lock(); toSymbianConfig(ptr)->connectionId = connectionId; ptr->mutex.unlock(); // Configuration is Active - if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) { - updateStatesToSnaps(); - } - emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(), - connectionId, QNetworkSession::Connected); + QT_TRYCATCH_LEAVING( + if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) { + updateStatesToSnaps(); + } + emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(), + connectionId, QNetworkSession::Connected); - if (!iOnline) { - iOnline = true; - emit this->onlineStateChanged(iOnline); - } + if (!iOnline) { + iOnline = true; + emit this->onlineStateChanged(iOnline); + } + ); } } else if (connectionStatus == KConfigDaemonStartingDeregistration) { TUint connectionId = realEvent->ConnectionId(); QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId); if (ptr) { - emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(), - connectionId, QNetworkSession::Closing); + QT_TRYCATCH_LEAVING( + emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(), + connectionId, QNetworkSession::Closing) + ); } } else if (connectionStatus == KLinkLayerClosed || connectionStatus == KConnectionClosed) { @@ -1011,12 +1102,13 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId); if (ptr) { // Configuration is either Defined or Discovered - if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) { - updateStatesToSnaps(); - } - - emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(), - connectionId, QNetworkSession::Disconnected); + QT_TRYCATCH_LEAVING( + if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) { + updateStatesToSnaps(); + } + emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(), + connectionId, QNetworkSession::Disconnected); + ); } bool online = false; @@ -1030,7 +1122,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) } if (iOnline != online) { iOnline = online; - emit this->onlineStateChanged(iOnline); + QT_TRYCATCH_LEAVING(emit this->onlineStateChanged(iOnline)); } } } @@ -1043,12 +1135,13 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) TConnMonIapInfo iaps = realEvent->IapAvailability(); QList<QString> unDiscoveredConfigs = accessPointConfigurations.keys(); for ( TUint i = 0; i < iaps.Count(); i++ ) { - QString ident = QString::number(qHash(iaps.iIap[i].iIapId)); + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX + + QString::number(qHash(iaps.iIap[i].iIapId)); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); if (ptr) { // Configuration is either Discovered or Active - changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered); + QT_TRYCATCH_LEAVING(changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered)); unDiscoveredConfigs.removeOne(ident); } } @@ -1056,7 +1149,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); if (ptr) { // Configuration is Defined - changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined); + QT_TRYCATCH_LEAVING(changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined)); } } } @@ -1073,8 +1166,14 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) TRequestStatus status; iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); User::WaitForRequest(status); - QString ident = QString::number(qHash(apId)); + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId)); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); +#ifdef OCC_FUNCTIONALITY_AVAILABLE + if (!ptr) { + // If IAP was not found, check if the update was about EasyWLAN + ptr = configurationFromEasyWlan(apId, connectionId); + } +#endif if (ptr) { QMutexLocker configLocker(&ptr->mutex); #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG @@ -1090,6 +1189,43 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent) } } +#ifdef OCC_FUNCTIONALITY_AVAILABLE +// Tries to derive configuration from EasyWLAN. +// First checks if the interface brought up was EasyWLAN, then derives the real SSID, +// and looks up configuration based on that one. +QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromEasyWlan(TUint32 apId, TUint connectionId) +{ + if (apId == iCmManager.EasyWlanIdL()) { + TRequestStatus status; + TBuf<50> easyWlanNetworkName; + iConnectionMonitor.GetStringAttribute( connectionId, 0, KNetworkName, + easyWlanNetworkName, status ); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + QString realSSID = QString::fromUtf16(easyWlanNetworkName.Ptr(), easyWlanNetworkName.Length()); + + // Browser through all items and check their name for match + QHash<QString, QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> >::const_iterator i = + accessPointConfigurations.constBegin(); + while (i != accessPointConfigurations.constEnd()) { + QNetworkConfigurationPrivatePointer ptr = i.value(); + + QMutexLocker configLocker(&ptr->mutex); + + if (ptr->name == realSSID) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNCM EasyWlan uses real SSID: " << realSSID; +#endif + return ptr; + } + ++i; + } + } + } + return QNetworkConfigurationPrivatePointer(); +} +#endif + // Sessions may use this function to report configuration state changes, // because on some Symbian platforms (especially Symbian^3) all state changes are not // reported by the RConnectionMonitor, in particular in relation to stop() call, @@ -1107,7 +1243,8 @@ void SymbianEngine::configurationStateChangeReport(TUint32 accessPointId, QNetwo switch (newState) { case QNetworkSession::Disconnected: { - QString ident = QString::number(qHash(accessPointId)); + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX + + QString::number(qHash(accessPointId)); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); if (ptr) { // Configuration is either Defined or Discovered @@ -1129,15 +1266,13 @@ void SymbianEngine::configurationStateChangeReport(TUint32 accessPointId, QNetwo } // Waits for 2..6 seconds. -void SymbianEngine::waitRandomTime() +void SymbianEngine::updateConfigurationsAfterRandomTime() { - int iTimeToWait = qMax(2000, (qAbs(qrand()) % 7) * 1000); + int iTimeToWait = qMax(1000, (qAbs(qrand()) % 68) * 100); #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug("QNCM waiting random time: %d ms", iTimeToWait); #endif - QEventLoop loop; - QTimer::singleShot(iTimeToWait, &loop, SLOT(quit())); - loop.exec(); + QTimer::singleShot(iTimeToWait, this, SLOT(delayedConfigurationUpdate())); } QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aConnectionId) @@ -1158,7 +1293,7 @@ QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aCon AccessPointsAvailabilityScanner::AccessPointsAvailabilityScanner(SymbianEngine& owner, RConnectionMonitor& connectionMonitor) - : CActive(CActive::EPriorityStandard), iOwner(owner), iConnectionMonitor(connectionMonitor) + : CActive(CActive::EPriorityHigh), iOwner(owner), iConnectionMonitor(connectionMonitor) { CActiveScheduler::Add(this); } @@ -1198,9 +1333,9 @@ void AccessPointsAvailabilityScanner::RunL() if (iStatus.Int() != KErrNone) { iIapBuf().iCount = 0; - iOwner.accessPointScanningReady(false,iIapBuf()); + QT_TRYCATCH_LEAVING(iOwner.accessPointScanningReady(false,iIapBuf())); } else { - iOwner.accessPointScanningReady(true,iIapBuf()); + QT_TRYCATCH_LEAVING(iOwner.accessPointScanningReady(true,iIapBuf())); } } diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index 18fd249..cfddc29 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -55,6 +55,9 @@ // Uncomment and compile QtBearer to gain detailed state tracing // #define QT_BEARERMGMT_SYMBIAN_DEBUG +#define QT_BEARERMGMT_CONFIGURATION_SNAP_PREFIX QLatin1String("S_") +#define QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX QLatin1String("I_") + class CCommsDatabase; class QEventLoop; @@ -159,6 +162,7 @@ Q_SIGNALS: public Q_SLOTS: void updateConfigurations(); + void delayedConfigurationUpdate(); private: void updateStatesToSnaps(); @@ -169,6 +173,7 @@ private: bool changeConfigurationStateAtMaxTo(QNetworkConfigurationPrivatePointer ptr, QNetworkConfiguration::StateFlags newState); #ifdef SNAP_FUNCTIONALITY_AVAILABLE + void updateMobileBearerToConfigs(TConnMonBearerInfo bearerInfo); SymbianNetworkConfigurationPrivate *configFromConnectionMethodL(RCmConnectionMethod& connectionMethod); #else bool readNetworkConfigurationValuesFromCommsDb( @@ -183,7 +188,7 @@ private: void accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo); void startCommsDatabaseNotifications(); void stopCommsDatabaseNotifications(); - void waitRandomTime(); + void updateConfigurationsAfterRandomTime(); QNetworkConfigurationPrivatePointer defaultConfigurationL(); TBool GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) const; @@ -201,6 +206,9 @@ private: // For QNetworkSessionPrivate to indicate about state changes void configurationStateChangeReport(TUint32 accessPointId, QNetworkSession::State newState); +#ifdef OCC_FUNCTIONALITY_AVAILABLE + QNetworkConfigurationPrivatePointer configurationFromEasyWlan(TUint32 apId, TUint connectionId); +#endif private: // Data bool iFirstUpdate; @@ -211,7 +219,7 @@ private: // Data TBool iOnline; TBool iInitOk; TBool iUpdateGoingOn; - TBool iIgnoringUpdates; + TBool iUpdatePending; AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner; diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index a093e4c..4addb84 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -175,13 +175,6 @@ symbian: { particlesImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/particles DEPLOYMENT += folderlistmodelImport gesturesImport particlesImport - - contains(QT_CONFIG, webkit): { - webkitImport.sources = $$QT_BUILD_TREE/imports/QtWebKit/qmlwebkitplugin$${QT_LIBINFIX}.dll - webkitImport.sources += $$QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/declarative/qmldir - webkitImport.path = c:$$QT_IMPORTS_BASE_DIR/QtWebKit - DEPLOYMENT += webkitImport - } } graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems |