summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJustin McPherson <justin.mcpherson@nokia.com>2010-04-22 23:54:51 (GMT)
committerJustin McPherson <justin.mcpherson@nokia.com>2010-04-22 23:54:51 (GMT)
commit478e914638f2131d1547c4e2dc4659723657194d (patch)
treec9f63e6bd79dce411ae059b1bb65a66db6584264 /src
parent6b30ee9d2219308605e0d1b15ea1c74dc5cb67fe (diff)
parent4894e6dd57c31e0196c6fdae4d1b2fb16b9f1b16 (diff)
downloadQt-478e914638f2131d1547c4e2dc4659723657194d.zip
Qt-478e914638f2131d1547c4e2dc4659723657194d.tar.gz
Qt-478e914638f2131d1547c4e2dc4659723657194d.tar.bz2
Merge branch '4.7' of ../../qt/4.7 into 4.7
Conflicts: demos/multimedia/player/player.pro
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/clucene/src/CLucene/util/bufferedstream.h2
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog26
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/VMTags.h39
-rw-r--r--src/3rdparty/javascriptcore/VERSION4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h1
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h8
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h2
-rw-r--r--src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h5
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/StringImpl.h1
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextStream.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/platform/text/TextStream.h2
-rw-r--r--src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/svg/SVGAnimatedPropertySynchronizer.h6
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathValue.cpp5
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathValue.h13
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.ui10
-rw-r--r--src/corelib/animation/qabstractanimation.cpp77
-rw-r--r--src/corelib/animation/qabstractanimation_p.h11
-rw-r--r--src/corelib/io/qdatastream.cpp7
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp5
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp8
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp20
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian_p.h3
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp53
-rw-r--r--src/corelib/kernel/qobject_p.h28
-rw-r--r--src/corelib/thread/qmutex.h18
-rw-r--r--src/corelib/tools/qdatetime.cpp9
-rw-r--r--src/gui/dialogs/qdialog.cpp14
-rw-r--r--src/gui/dialogs/qdialog.h2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp3
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp12
-rw-r--r--src/gui/image/qicon.cpp19
-rw-r--r--src/gui/image/qicon.h2
-rw-r--r--src/gui/image/qiconengine.cpp20
-rw-r--r--src/gui/image/qiconengine.h5
-rw-r--r--src/gui/image/qiconloader.cpp6
-rw-r--r--src/gui/kernel/qapplication_win.cpp25
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac.mm7
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h11
-rw-r--r--src/gui/kernel/qwidget.cpp6
-rw-r--r--src/gui/painting/qdrawhelper.cpp21
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp2
-rw-r--r--src/gui/painting/qpaintengineex.cpp3
-rw-r--r--src/gui/painting/qpainterpath.cpp2
-rw-r--r--src/gui/styles/qcommonstyle.cpp2
-rw-r--r--src/gui/styles/qmacstyle_mac.mm16
-rw-r--r--src/gui/text/qtextodfwriter.cpp12
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp1
-rw-r--r--src/gui/widgets/qmenu_mac.mm19
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp2
-rw-r--r--src/network/kernel/qhostinfo.cpp22
-rw-r--r--src/network/kernel/qhostinfo_p.h3
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp6
-rw-r--r--src/opengl/qglextensions.cpp11
-rw-r--r--src/opengl/qpixmapdata_x11gl_egl.cpp19
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h41
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm671
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp5
-rw-r--r--src/plugins/bearer/generic/qgenericengine.h1
-rw-r--r--src/plugins/bearer/icd/qicdengine.cpp8
-rw-r--r--src/plugins/bearer/icd/qicdengine.h2
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.cpp7
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.h1
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp6
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h3
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp7
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h1
-rw-r--r--src/script/api/qscriptengine.cpp4
-rw-r--r--src/script/bridge/qscriptqobject.cpp9
-rw-r--r--src/script/bridge/qscriptvariant.cpp6
-rw-r--r--src/src.pro2
-rw-r--r--src/svg/qsvghandler.cpp9
75 files changed, 898 insertions, 537 deletions
diff --git a/src/3rdparty/clucene/src/CLucene/util/bufferedstream.h b/src/3rdparty/clucene/src/CLucene/util/bufferedstream.h
index b73ad98..d905955 100644
--- a/src/3rdparty/clucene/src/CLucene/util/bufferedstream.h
+++ b/src/3rdparty/clucene/src/CLucene/util/bufferedstream.h
@@ -46,7 +46,7 @@ protected:
/**
* This function must be implemented by the subclasses.
* It should write a maximum of @p space characters at the buffer
- * position pointed to by @p start. If no more data is avaiable due to
+ * position pointed to by @p start. If no more data is available due to
* end of file, -1 should be returned. If an error occurs, the status
* should be set to Error, an error message should be set and the function
* must return -1.
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog
index 4f6e565..11572b0 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog
@@ -1,3 +1,29 @@
+2010-04-14 Kent Hansen <kent.hansen@nokia.com>
+
+ Reviewed by Maciej Stachowiak.
+
+ Mac OS X: Use deployment target to determine whether memory tagging should be enabled
+ https://bugs.webkit.org/show_bug.cgi?id=34888
+
+ When building on (Snow) Leopard but targeting Tiger
+ (TARGETING_TIGER defined, BUILDING_ON_TIGER not defined),
+ WebKit would crash on Tiger because the tags passed to mmap
+ caused those function calls to fail.
+
+ Conversely, when building on Tiger but targeting Leopard
+ (BUILDING_ON_TIGER defined, TARGETING_LEOPARD defined), WebKit
+ would crash on Leopard because the tags passed to vm_map and
+ vm_allocate caused those function calls to fail.
+
+ Solution: Use TARGETING_TIGER rather than BUILDING_ON_TIGER to
+ govern the tag definitions. Use the same tags for vm_map and
+ vm_allocate regardless of target, since they work on
+ both. Fall back to the mmap tags that work on Tiger (that is,
+ "no tags") if targeting Tiger, since those tags also work on
+ Leopard.
+
+ * wtf/VMTags.h:
+
2010-03-29 Patrick Gansterer <paroga@paroga.com>
Reviewed by Darin Adler.
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/VMTags.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/VMTags.h
index 34e2494..75bec11 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/VMTags.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/VMTags.h
@@ -30,25 +30,48 @@
// On Mac OS X, the VM subsystem allows tagging memory requested from mmap and vm_map
// in order to aid tools that inspect system memory use.
-#if OS(DARWIN) && !defined(BUILDING_ON_TIGER)
+#if OS(DARWIN)
#include <mach/vm_statistics.h>
+#if !defined(TARGETING_TIGER)
+
#if defined(VM_MEMORY_TCMALLOC)
#define VM_TAG_FOR_TCMALLOC_MEMORY VM_MAKE_TAG(VM_MEMORY_TCMALLOC)
#else
#define VM_TAG_FOR_TCMALLOC_MEMORY VM_MAKE_TAG(53)
#endif // defined(VM_MEMORY_TCMALLOC)
-#if defined(VM_MEMORY_JAVASCRIPT_CORE) && defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE) && defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR) && defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
-#define VM_TAG_FOR_COLLECTOR_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_CORE)
-#define VM_TAG_FOR_REGISTERFILE_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+#if defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
#else
-#define VM_TAG_FOR_COLLECTOR_MEMORY VM_MAKE_TAG(63)
#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY VM_MAKE_TAG(64)
+#endif // defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
+
+#if defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+#define VM_TAG_FOR_REGISTERFILE_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+#else
#define VM_TAG_FOR_REGISTERFILE_MEMORY VM_MAKE_TAG(65)
-#endif // defined(VM_MEMORY_JAVASCRIPT_CORE) && defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE) && defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR) && defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
+#endif // defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+
+#else // !defined(TARGETING_TIGER)
+
+// mmap on Tiger fails with tags that work on Leopard, so fall
+// back to Tiger-compatible tags (that also work on Leopard)
+// when targeting Tiger.
+#define VM_TAG_FOR_TCMALLOC_MEMORY -1
+#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY -1
+#define VM_TAG_FOR_REGISTERFILE_MEMORY -1
+
+#endif // !defined(TARGETING_TIGER)
+
+// Tags for vm_map and vm_allocate work on both Tiger and Leopard.
+
+#if defined(VM_MEMORY_JAVASCRIPT_CORE)
+#define VM_TAG_FOR_COLLECTOR_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_CORE)
+#else
+#define VM_TAG_FOR_COLLECTOR_MEMORY VM_MAKE_TAG(63)
+#endif // defined(VM_MEMORY_JAVASCRIPT_CORE)
#if defined(VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS)
#define VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY VM_MAKE_TAG(VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS)
@@ -56,7 +79,7 @@
#define VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY VM_MAKE_TAG(69)
#endif // defined(VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS)
-#else // OS(DARWIN) && !defined(BUILDING_ON_TIGER)
+#else // OS(DARWIN)
#define VM_TAG_FOR_TCMALLOC_MEMORY -1
#define VM_TAG_FOR_COLLECTOR_MEMORY -1
@@ -64,6 +87,6 @@
#define VM_TAG_FOR_REGISTERFILE_MEMORY -1
#define VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY -1
-#endif // OS(DARWIN) && !defined(BUILDING_ON_TIGER)
+#endif // OS(DARWIN)
#endif // VMTags_h
diff --git a/src/3rdparty/javascriptcore/VERSION b/src/3rdparty/javascriptcore/VERSION
index 2b885a7..9a02027 100644
--- a/src/3rdparty/javascriptcore/VERSION
+++ b/src/3rdparty/javascriptcore/VERSION
@@ -4,8 +4,8 @@ This is a snapshot of JavaScriptCore from
The commit imported was from the
- javascriptcore-snapshot-07042010 branch/tag
+ javascriptcore-snapshot-20042010 branch/tag
and has the sha1 checksum
- 475f8c67522d8b3f3163dc3a6b24d6083fd0ac19
+ c589321ffdda5e93cf77e2cf2cf43afe3e996f6e
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp
index 6f23c7d..dab7f51 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp
@@ -168,14 +168,14 @@ inline void Structure::transitionTableAdd(const StructureTransitionTableHash::Ke
if (!specificValue) {
TransitionTable::iterator find = transitionTable()->find(key);
if (find == transitionTable()->end())
- transitionTable()->add(key, Transition(structure, 0));
+ transitionTable()->add(key, Transition(structure, (Structure*)0));
else
find->second.first = structure;
} else {
// If we're adding a transition to a specific value, then there cannot be
// an existing transition
ASSERT(!transitionTable()->contains(key));
- transitionTable()->add(key, Transition(0, structure));
+ transitionTable()->add(key, Transition((Structure*)0, structure));
}
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h b/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h
index 4dccb25..065443a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h
@@ -58,7 +58,6 @@ protected:
};
using Noncopyable::operator new;
- void* operator new(size_t, void* inPlace) { return inPlace; }
// For SmallStringStorage, which allocates an array and uses an in-place new.
UStringOrRopeImpl() { }
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h
index 09094d1..4631055 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h
@@ -88,9 +88,9 @@ namespace WTF {
// must have the following function members:
// static unsigned hash(const T&);
// static bool equal(const ValueType&, const T&);
- template<typename T, typename HashTranslator> iterator find(const T&);
- template<typename T, typename HashTranslator> const_iterator find(const T&) const;
- template<typename T, typename HashTranslator> bool contains(const T&) const;
+ template<typename TYPE, typename HashTranslator> iterator find(const TYPE&);
+ template<typename TYPE, typename HashTranslator> const_iterator find(const TYPE&) const;
+ template<typename TYPE, typename HashTranslator> bool contains(const TYPE&) const;
// An alternate version of add() that finds the object by hashing and comparing
// with some other type, to avoid the cost of type conversion if the object is already
@@ -98,7 +98,7 @@ namespace WTF {
// static unsigned hash(const T&);
// static bool equal(const ValueType&, const T&);
// static translate(ValueType&, const T&, unsigned hashCode);
- template<typename T, typename HashTranslator> pair<iterator, bool> add(const T&, const MappedType&);
+ template<typename TYPE, typename HashTranslator> pair<iterator, bool> add(const TYPE&, const MappedType&);
void checkConsistency() const;
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h
index a0c7466..49d6ec3 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h
@@ -122,8 +122,10 @@ inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); }
#endif
#if COMPILER(MSVC)
-
+// The 64bit version of abs() is already defined in stdlib.h which comes with VC10
+#if COMPILER(MSVC9)
inline long long abs(long long num) { return _abs64(num); }
+#endif
inline bool isinf(double num) { return !_finite(num) && !_isnan(num); }
inline bool isnan(double num) { return !!_isnan(num); }
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
index fa78b45..2a5a48f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
@@ -63,6 +63,8 @@
#define WTF_COMPILER_MSVC 1
#if _MSC_VER < 1400
#define WTF_COMPILER_MSVC7 1
+#elif _MSC_VER < 1600
+#define WTF_COMPILER_MSVC9 1
#endif
#endif
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h
index 8eb55c1..2ad437b 100644
--- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h
+++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMGlobalObject.h
@@ -70,6 +70,9 @@ namespace WebCore {
virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
static const JSC::ClassInfo s_info;
+ private:
+ static void destroyJSDOMGlobalObjectData(void*);
+
protected:
struct JSDOMGlobalObjectData : public JSC::JSGlobalObject::JSGlobalObjectData {
JSDOMGlobalObjectData(DOMWrapperWorld* world, Destructor destructor = destroyJSDOMGlobalObjectData)
@@ -89,8 +92,6 @@ namespace WebCore {
};
private:
- static void destroyJSDOMGlobalObjectData(void*);
-
JSDOMGlobalObjectData* d() const { return static_cast<JSDOMGlobalObjectData*>(JSC::JSVariableObject::d); }
};
diff --git a/src/3rdparty/webkit/WebCore/platform/text/StringImpl.h b/src/3rdparty/webkit/WebCore/platform/text/StringImpl.h
index 81cd149..9a62cba 100644
--- a/src/3rdparty/webkit/WebCore/platform/text/StringImpl.h
+++ b/src/3rdparty/webkit/WebCore/platform/text/StringImpl.h
@@ -249,7 +249,6 @@ public:
private:
using Noncopyable::operator new;
- void* operator new(size_t, void* inPlace) { ASSERT(inPlace); return inPlace; }
static PassRefPtr<StringImpl> createStrippingNullCharactersSlowCase(const UChar*, unsigned length);
diff --git a/src/3rdparty/webkit/WebCore/platform/text/TextStream.cpp b/src/3rdparty/webkit/WebCore/platform/text/TextStream.cpp
index baaa8b9..ab73891 100644
--- a/src/3rdparty/webkit/WebCore/platform/text/TextStream.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/text/TextStream.cpp
@@ -108,7 +108,7 @@ String TextStream::release()
return String::adopt(m_text);
}
-#if OS(WINDOWS) && PLATFORM(X86_64) && COMPILER(MSVC)
+#if OS(WINDOWS) && CPU(X86_64) && COMPILER(MSVC)
TextStream& TextStream::operator<<(__int64 i)
{
char buffer[printBufferSize];
diff --git a/src/3rdparty/webkit/WebCore/platform/text/TextStream.h b/src/3rdparty/webkit/WebCore/platform/text/TextStream.h
index dfaa048..1225505 100644
--- a/src/3rdparty/webkit/WebCore/platform/text/TextStream.h
+++ b/src/3rdparty/webkit/WebCore/platform/text/TextStream.h
@@ -45,7 +45,7 @@ public:
TextStream& operator<<(const char*);
TextStream& operator<<(void*);
TextStream& operator<<(const String&);
-#if OS(WINDOWS) && PLATFORM(X86_64) && COMPILER(MSVC)
+#if OS(WINDOWS) && CPU(X86_64) && COMPILER(MSVC)
TextStream& operator<<(unsigned __int64);
TextStream& operator<<(__int64);
#endif
diff --git a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp
index 01e425f..9d869ab 100644
--- a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp
+++ b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp
@@ -140,7 +140,7 @@ static BYTE* endPaint;
typedef HDC (WINAPI *PtrBeginPaint)(HWND, PAINTSTRUCT*);
typedef BOOL (WINAPI *PtrEndPaint)(HWND, const PAINTSTRUCT*);
-#if OS(WINDOWS) && PLATFORM(X86_64) && COMPILER(MSVC)
+#if OS(WINDOWS) && CPU(X86_64) && COMPILER(MSVC)
extern "C" HDC __stdcall _HBeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint);
extern "C" BOOL __stdcall _HEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint);
#endif
@@ -978,7 +978,7 @@ bool PluginView::platformStart()
// Calling SetWindowLongPtrA here makes the window proc ASCII, which is required by at least
// the Shockwave Director plug-in.
-#if OS(WINDOWS) && PLATFORM(X86_64) && COMPILER(MSVC)
+#if OS(WINDOWS) && CPU(X86_64) && COMPILER(MSVC)
::SetWindowLongPtrA(platformPluginWidget(), GWLP_WNDPROC, (LONG_PTR)DefWindowProcA);
#elif OS(WINCE)
::SetWindowLong(platformPluginWidget(), GWL_WNDPROC, (LONG)DefWindowProc);
diff --git a/src/3rdparty/webkit/WebCore/svg/SVGAnimatedPropertySynchronizer.h b/src/3rdparty/webkit/WebCore/svg/SVGAnimatedPropertySynchronizer.h
index ddd0493..695b71e 100644
--- a/src/3rdparty/webkit/WebCore/svg/SVGAnimatedPropertySynchronizer.h
+++ b/src/3rdparty/webkit/WebCore/svg/SVGAnimatedPropertySynchronizer.h
@@ -41,13 +41,15 @@ struct GetOwnerElementForType<OwnerType, true> : public Noncopyable {
template<typename OwnerType>
struct GetOwnerElementForType<OwnerType, false> : public Noncopyable {
- static SVGElement* ownerElement(OwnerType* type)
+ static SVGElement* ownerElement(OwnerType* type);
+};
+template<typename OwnerType>
+SVGElement* GetOwnerElementForType<OwnerType, false>::ownerElement(OwnerType* type)
{
SVGElement* context = type->contextElement();
ASSERT(context);
return context;
}
-};
// IsDerivedFromSVGElement implementation
template<typename OwnerType>
diff --git a/src/3rdparty/webkit/WebCore/xml/XPathValue.cpp b/src/3rdparty/webkit/WebCore/xml/XPathValue.cpp
index 29e211e..f5acb38 100644
--- a/src/3rdparty/webkit/WebCore/xml/XPathValue.cpp
+++ b/src/3rdparty/webkit/WebCore/xml/XPathValue.cpp
@@ -68,7 +68,12 @@ NodeSet& Value::modifiableNodeSet()
return m_data->m_nodeSet;
}
+#if COMPILER(WINSCW)
+// FIXME --nl-- Symbian WINSCW compiler complains with 'ambiguous access to overloaded function' (double, unsigned long, unsigned int)
+unsigned int Value::toBoolean() const
+#else
bool Value::toBoolean() const
+#endif
{
switch (m_type) {
case NodeSetValue:
diff --git a/src/3rdparty/webkit/WebCore/xml/XPathValue.h b/src/3rdparty/webkit/WebCore/xml/XPathValue.h
index a0cd24d..bd44c91 100644
--- a/src/3rdparty/webkit/WebCore/xml/XPathValue.h
+++ b/src/3rdparty/webkit/WebCore/xml/XPathValue.h
@@ -66,8 +66,11 @@ namespace WebCore {
Value(Node* value) : m_type(NodeSetValue), m_bool(false), m_number(0), m_data(ValueData::create()) { m_data->m_nodeSet.append(value); }
// This is needed to safely implement constructing from bool - with normal function overloading, any pointer type would match.
+#if COMPILER(WINSCW)
+ Value(bool);
+#else
template<typename T> Value(T);
-
+#endif
static const struct AdoptTag {} adopt;
Value(NodeSet& value, const AdoptTag&) : m_type(NodeSetValue), m_bool(false), m_number(0), m_data(ValueData::create()) { value.swap(m_data->m_nodeSet); }
@@ -80,7 +83,12 @@ namespace WebCore {
const NodeSet& toNodeSet() const;
NodeSet& modifiableNodeSet();
+#if COMPILER(WINSCW)
+ // FIXME --nl-- Symbian WINSCW compiler complains with 'ambiguous access to overloaded function' (double, unsigned long, unsigned int)
+ unsigned int toBoolean() const;
+#else
bool toBoolean() const;
+#endif
double toNumber() const;
String toString() const;
@@ -90,8 +98,9 @@ namespace WebCore {
double m_number;
RefPtr<ValueData> m_data;
};
-
+#if !COMPILER(WINSCW)
template<>
+#endif
inline Value::Value(bool value)
: m_type(BooleanValue)
, m_bool(value)
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.ui b/src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.ui
index 4f2b3b8..ae5e0b5 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.ui
+++ b/src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Widget</string>
+ <string notr="true">Widget</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@@ -28,7 +28,7 @@
<item>
<widget class="QLabel" name="lbl1">
<property name="text">
- <string/>
+ <string notr="true"/>
</property>
</widget>
</item>
@@ -47,21 +47,21 @@
</size>
</property>
<property name="text">
- <string>Image from Qt to HTML</string>
+ <string notr="true">Image from Qt to HTML</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl3">
<property name="text">
- <string>Pixmap from Qt to HTML</string>
+ <string notr="true">Pixmap from Qt to HTML</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl4">
<property name="text">
- <string/>
+ <string notr="true"/>
</property>
</widget>
</item>
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 82b3003..01570ad 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -173,11 +173,12 @@ QUnifiedTimer::QUnifiedTimer() :
time.invalidate();
}
-QUnifiedTimer *QUnifiedTimer::instance()
+
+QUnifiedTimer *QUnifiedTimer::instance(bool create)
{
QUnifiedTimer *inst;
#ifndef QT_NO_THREAD
- if (!unifiedTimer()->hasLocalData()) {
+ if (create && !unifiedTimer()->hasLocalData()) {
inst = new QUnifiedTimer;
unifiedTimer()->setLocalData(inst);
} else {
@@ -190,10 +191,16 @@ QUnifiedTimer *QUnifiedTimer::instance()
return inst;
}
+QUnifiedTimer *QUnifiedTimer::instance()
+{
+ return instance(true);
+}
+
void QUnifiedTimer::ensureTimerUpdate()
{
- if (isPauseTimerActive)
- updateAnimationsTime();
+ QUnifiedTimer *inst = QUnifiedTimer::instance(false);
+ if (inst && inst->isPauseTimerActive)
+ inst->updateAnimationsTime();
}
void QUnifiedTimer::updateAnimationsTime()
@@ -219,6 +226,13 @@ void QUnifiedTimer::updateAnimationsTime()
}
}
+void QUnifiedTimer::updateAnimationTimer()
+{
+ QUnifiedTimer *inst = QUnifiedTimer::instance(false);
+ if (inst)
+ inst->restartAnimationTimer();
+}
+
void QUnifiedTimer::restartAnimationTimer()
{
if (runningLeafAnimations == 0 && !runningPauseAnimations.isEmpty()) {
@@ -269,34 +283,41 @@ void QUnifiedTimer::timerEvent(QTimerEvent *event)
void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation, bool isTopLevel)
{
- registerRunningAnimation(animation);
+ QUnifiedTimer *inst = instance(true); //we create the instance if needed
+ inst->registerRunningAnimation(animation);
if (isTopLevel) {
Q_ASSERT(!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer);
QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = true;
- animationsToStart << animation;
- if (!startStopAnimationTimer.isActive())
- startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this);
+ inst->animationsToStart << animation;
+ if (!inst->startStopAnimationTimer.isActive())
+ inst->startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, inst);
}
}
void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation)
{
- unregisterRunningAnimation(animation);
+ QUnifiedTimer *inst = QUnifiedTimer::instance(false);
+ if (inst) {
+ //at this point the unified timer should have been created
+ //but it might also have been already destroyed in case the application is shutting down
- if (!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer)
- return;
+ inst->unregisterRunningAnimation(animation);
- int idx = animations.indexOf(animation);
- if (idx != -1) {
- animations.removeAt(idx);
- // this is needed if we unregister an animation while its running
- if (idx <= currentAnimationIdx)
- --currentAnimationIdx;
+ if (!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer)
+ return;
- if (animations.isEmpty() && !startStopAnimationTimer.isActive())
- startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this);
- } else {
- animationsToStart.removeOne(animation);
+ int idx = inst->animations.indexOf(animation);
+ if (idx != -1) {
+ inst->animations.removeAt(idx);
+ // this is needed if we unregister an animation while its running
+ if (idx <= inst->currentAnimationIdx)
+ --inst->currentAnimationIdx;
+
+ if (inst->animations.isEmpty() && !inst->startStopAnimationTimer.isActive())
+ inst->startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, inst);
+ } else {
+ inst->animationsToStart.removeOne(animation);
+ }
}
QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = false;
}
@@ -371,11 +392,11 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
bool isTopLevel = !group || group->state() == QAbstractAnimation::Stopped;
if (oldState == QAbstractAnimation::Running) {
if (newState == QAbstractAnimation::Paused && hasRegisteredTimer)
- QUnifiedTimer::instance()->ensureTimerUpdate();
+ QUnifiedTimer::ensureTimerUpdate();
//the animation, is not running any more
- QUnifiedTimer::instance()->unregisterAnimation(q);
+ QUnifiedTimer::unregisterAnimation(q);
} else if (newState == QAbstractAnimation::Running) {
- QUnifiedTimer::instance()->registerAnimation(q, isTopLevel);
+ QUnifiedTimer::registerAnimation(q, isTopLevel);
}
q->updateState(newState, oldState);
@@ -397,7 +418,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
if (oldState == QAbstractAnimation::Stopped) {
if (isTopLevel) {
// currentTime needs to be updated if pauseTimer is active
- QUnifiedTimer::instance()->ensureTimerUpdate();
+ QUnifiedTimer::ensureTimerUpdate();
q->setCurrentTime(totalCurrentTime);
}
}
@@ -456,7 +477,7 @@ QAbstractAnimation::~QAbstractAnimation()
d->state = Stopped;
emit stateChanged(oldState, d->state);
if (oldState == QAbstractAnimation::Running)
- QUnifiedTimer::instance()->unregisterAnimation(this);
+ QUnifiedTimer::unregisterAnimation(this);
}
}
@@ -555,14 +576,14 @@ void QAbstractAnimation::setDirection(Direction direction)
// the commands order below is important: first we need to setCurrentTime with the old direction,
// then update the direction on this and all children and finally restart the pauseTimer if needed
if (d->hasRegisteredTimer)
- QUnifiedTimer::instance()->ensureTimerUpdate();
+ QUnifiedTimer::ensureTimerUpdate();
d->direction = direction;
updateDirection(direction);
if (d->hasRegisteredTimer)
// needed to update the timer interval in case of a pause animation
- QUnifiedTimer::instance()->restartAnimationTimer();
+ QUnifiedTimer::updateAnimationTimer();
emit directionChanged(direction);
}
diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h
index 2282cdb..fcfe824 100644
--- a/src/corelib/animation/qabstractanimation_p.h
+++ b/src/corelib/animation/qabstractanimation_p.h
@@ -124,9 +124,10 @@ private:
public:
//XXX this is needed by dui
static Q_CORE_EXPORT QUnifiedTimer *instance();
+ static QUnifiedTimer *instance(bool create);
- void registerAnimation(QAbstractAnimation *animation, bool isTopLevel);
- void unregisterAnimation(QAbstractAnimation *animation);
+ static void registerAnimation(QAbstractAnimation *animation, bool isTopLevel);
+ static void unregisterAnimation(QAbstractAnimation *animation);
//defines the timing interval. Default is DEFAULT_TIMER_INTERVAL
void setTimingInterval(int interval)
@@ -151,13 +152,13 @@ public:
this is used for updating the currentTime of all animations in case the pause
timer is active or, otherwise, only of the animation passed as parameter.
*/
- void ensureTimerUpdate();
+ static void ensureTimerUpdate();
/*
this will evaluate the need of restarting the pause timer in case there is still
some pause animations running.
*/
- void restartAnimationTimer();
+ static void updateAnimationTimer();
protected:
void timerEvent(QTimerEvent *);
@@ -187,6 +188,8 @@ private:
void registerRunningAnimation(QAbstractAnimation *animation);
void unregisterRunningAnimation(QAbstractAnimation *animation);
+ void restartAnimationTimer();
+
void updateAnimationsTime();
int closestPauseAnimationTimeToFinish();
};
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index 2731ae1..3a9d284 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -1144,16 +1144,17 @@ QDataStream &QDataStream::operator<<(double f)
CHECK_STREAM_PRECOND(*this)
#ifndef Q_DOUBLE_FORMAT
- if (!noswap) {
+ if (noswap) {
+ dev->write((char *)&f, sizeof(double));
+ } else {
union {
double val1;
quint64 val2;
} x;
x.val1 = f;
x.val2 = qbswap(x.val2);
- f = x.val1;
+ dev->write((char *)&x.val2, sizeof(double));
}
- dev->write((char *)&f, sizeof(double));
#else
union {
double val1;
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index 00af3fd..18c3c9f 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -426,6 +426,11 @@ QFileSystemWatcher::QFileSystemWatcher(const QStringList &paths, QObject *parent
/*!
Destroys the file system watcher.
+
+ \note To avoid deadlocks on shutdown, all instances of QFileSystemWatcher
+ need to be destroyed before QCoreApplication. Note that passing
+ QCoreApplication::instance() as the parent object when creating
+ QFileSystemWatcher is not sufficient.
*/
QFileSystemWatcher::~QFileSystemWatcher()
{
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index eeca07e..ec49f1a 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -542,11 +542,13 @@ qint64 QFSFileEnginePrivate::nativeSize() const
if (errorCode == ERROR_ACCESS_DENIED || errorCode == ERROR_SHARING_VIOLATION) {
QByteArray path = nativeFilePath;
// path for the FindFirstFile should not end with a trailing slash
- while (path.endsWith('\\'))
- path.chop(1);
+ while (!path.isEmpty() && reinterpret_cast<const wchar_t *>(
+ path.constData() + path.length())[-1] == '\\')
+ path.chop(2);
// FindFirstFile can not handle drives
- if (!path.endsWith(':')) {
+ if (!path.isEmpty() && reinterpret_cast<const wchar_t *>(
+ path.constData() + path.length())[-1] != ':') {
WIN32_FIND_DATA findData;
HANDLE hFind = ::FindFirstFile((const wchar_t*)path.constData(),
&findData);
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index 8c96057..3b86e89 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -638,6 +638,7 @@ void QSocketActiveObject::deleteLater()
QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent)
: QAbstractEventDispatcher(parent),
+ m_selectThread(0),
m_activeScheduler(0),
m_wakeUpAO(0),
m_completeDeferredAOs(0),
@@ -665,11 +666,19 @@ void QEventDispatcherSymbian::startingUp()
wakeUp();
}
+QSelectThread& QEventDispatcherSymbian::selectThread() {
+ if (!m_selectThread)
+ m_selectThread = new QSelectThread;
+ return *m_selectThread;
+}
+
void QEventDispatcherSymbian::closingDown()
{
- if (m_selectThread.isRunning()) {
- m_selectThread.stop();
+ if (m_selectThread && m_selectThread->isRunning()) {
+ m_selectThread->stop();
}
+ delete m_selectThread;
+ m_selectThread = 0;
delete m_completeDeferredAOs;
delete m_wakeUpAO;
@@ -941,12 +950,13 @@ void QEventDispatcherSymbian::registerSocketNotifier ( QSocketNotifier * notifie
{
QSocketActiveObject *socketAO = q_check_ptr(new QSocketActiveObject(this, notifier));
m_notifiers.insert(notifier, socketAO);
- m_selectThread.requestSocketEvents(notifier, &socketAO->iStatus);
+ selectThread().requestSocketEvents(notifier, &socketAO->iStatus);
}
void QEventDispatcherSymbian::unregisterSocketNotifier ( QSocketNotifier * notifier )
{
- m_selectThread.cancelSocketEvents(notifier);
+ if (m_selectThread)
+ m_selectThread->cancelSocketEvents(notifier);
if (m_notifiers.contains(notifier)) {
QSocketActiveObject *sockObj = *m_notifiers.find(notifier);
m_deferredSocketEvents.removeAll(sockObj);
@@ -957,7 +967,7 @@ void QEventDispatcherSymbian::unregisterSocketNotifier ( QSocketNotifier * notif
void QEventDispatcherSymbian::reactivateSocketNotifier(QSocketNotifier *notifier)
{
- m_selectThread.requestSocketEvents(notifier, &m_notifiers[notifier]->iStatus);
+ selectThread().requestSocketEvents(notifier, &m_notifiers[notifier]->iStatus);
}
void QEventDispatcherSymbian::registerTimer ( int timerId, int interval, QObject * object )
diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h
index 1ab31cc..5281199 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian_p.h
+++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h
@@ -259,8 +259,9 @@ private:
bool sendPostedEvents();
bool sendDeferredSocketEvents();
+ QSelectThread& selectThread();
private:
- QSelectThread m_selectThread;
+ QSelectThread *m_selectThread;
CQtActiveScheduler *m_activeScheduler;
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 2633a7c..135ec303 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -595,7 +595,7 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
} else {
ok = t->fastTimerId = qtimeSetEvent(t->interval, 1, qt_fast_timer_proc, (DWORD_PTR)t,
TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS);
- if (ok == 0) { // fall back to normal timer if no more multimedia timers avaiable
+ if (ok == 0) { // fall back to normal timer if no more multimedia timers available
ok = SetTimer(internalHwnd, t->timerId, (uint) t->interval, 0);
}
}
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index c13d829..6a6db51 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -101,7 +101,7 @@ static QBasicAtomicInt objectCount = Q_BASIC_ATOMIC_INITIALIZER(0);
/** \internal
* mutex to be locked when accessing the connectionlists or the senders list
*/
-static QMutex *signalSlotLock(const QObject *o)
+static inline QMutex *signalSlotLock(const QObject *o)
{
if (!signalSlotMutexes) {
QMutexPool *mp = new QMutexPool;
@@ -393,27 +393,6 @@ void QObjectPrivate::cleanConnectionLists()
}
}
-QObjectPrivate::Sender *QObjectPrivate::setCurrentSender(QObject *receiver,
- Sender *sender)
-{
- Sender *previousSender = receiver->d_func()->currentSender;
- receiver->d_func()->currentSender = sender;
- return previousSender;
-}
-
-void QObjectPrivate::resetCurrentSender(QObject *receiver,
- Sender *currentSender,
- Sender *previousSender)
-{
- // ref is set to zero when this object is deleted during the metacall
- if (currentSender->ref == 1)
- receiver->d_func()->currentSender = previousSender;
- // if we've recursed, we need to tell the caller about the objects deletion
- if (previousSender)
- previousSender->ref = currentSender->ref;
-}
-
-
typedef QMultiHash<QObject *, QObject **> GuardHash;
Q_GLOBAL_STATIC(GuardHash, guardHash)
Q_GLOBAL_STATIC(QMutex, guardHashLock)
@@ -880,19 +859,14 @@ QObject::~QObject()
if (d->declarativeData)
QAbstractDeclarativeData::destroyed(d->declarativeData, this);
- {
- QMutex *signalSlotMutex = 0;
- QT_TRY {
- signalSlotMutex = signalSlotLock(this);
- } QT_CATCH(const std::bad_alloc &) {
- // out of memory - swallow to prevent a crash
- }
- QMutexLocker locker(signalSlotMutex);
+ // set ref to zero to indicate that this object has been deleted
+ if (d->currentSender != 0)
+ d->currentSender->ref = 0;
+ d->currentSender = 0;
- // set ref to zero to indicate that this object has been deleted
- if (d->currentSender != 0)
- d->currentSender->ref = 0;
- d->currentSender = 0;
+ if (d->connectionLists || d->senders) {
+ QMutex *signalSlotMutex = signalSlotLock(this);
+ QMutexLocker locker(signalSlotMutex);
// disconnect all receivers
if (d->connectionLists) {
@@ -910,7 +884,7 @@ QObject::~QObject()
}
QMutex *m = signalSlotLock(c->receiver);
- bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m);
+ bool needToUnlock = QOrderedMutexLocker::relock(signalSlotMutex, m);
if (c->receiver) {
*c->prev = c->next;
@@ -938,7 +912,7 @@ QObject::~QObject()
QObject *sender = node->sender;
QMutex *m = signalSlotLock(sender);
node->prev = &node;
- bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m);
+ bool needToUnlock = QOrderedMutexLocker::relock(signalSlotMutex, m);
//the node has maybe been removed while the mutex was unlocked in relock?
if (!node || node->sender != sender) {
m->unlock();
@@ -972,7 +946,8 @@ QObject::~QObject()
qt_removeObject(this);
- QCoreApplication::removePostedEvents(this);
+ if (d->postedEvents)
+ QCoreApplication::removePostedEvents(this, 0);
if (d->parent) // remove it from parent object
d->setParent_helper(0);
@@ -3231,9 +3206,9 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
argv ? argv : empty_argv);
}
- QMutexLocker locker(signalSlotLock(sender));
QThreadData *currentThreadData = QThreadData::current();
+ QMutexLocker locker(signalSlotLock(sender));
QObjectConnectionListVector *connectionLists = sender->d_func()->connectionLists;
if (!connectionLists) {
locker.unlock();
@@ -3329,7 +3304,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
if (connectionLists->orphaned) {
if (!connectionLists->inUse)
delete connectionLists;
- } else {
+ } else if (connectionLists->dirty) {
sender->d_func()->cleanConnectionLists();
}
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index 341b3e9..4800e6a 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -156,9 +156,9 @@ public:
void removePendingChildInsertedEvents(QObject *child);
#endif
- static Sender *setCurrentSender(QObject *receiver,
+ static inline Sender *setCurrentSender(QObject *receiver,
Sender *sender);
- static void resetCurrentSender(QObject *receiver,
+ static inline void resetCurrentSender(QObject *receiver,
Sender *currentSender,
Sender *previousSender);
static int *setDeleteWatch(QObjectPrivate *d, int *newWatch);
@@ -215,9 +215,29 @@ public:
inline bool QObjectPrivate::isSignalConnected(uint signal_index) const
{
return signal_index >= sizeof(connectedSignals) * 8
+ || (connectedSignals[signal_index >> 5] & (1 << (signal_index & 0x1f))
|| qt_signal_spy_callback_set.signal_begin_callback
- || qt_signal_spy_callback_set.signal_end_callback
- || (connectedSignals[signal_index >> 5] & (1 << (signal_index & 0x1f)));
+ || qt_signal_spy_callback_set.signal_end_callback);
+}
+
+inline QObjectPrivate::Sender *QObjectPrivate::setCurrentSender(QObject *receiver,
+ Sender *sender)
+{
+ Sender *previousSender = receiver->d_func()->currentSender;
+ receiver->d_func()->currentSender = sender;
+ return previousSender;
+}
+
+inline void QObjectPrivate::resetCurrentSender(QObject *receiver,
+ Sender *currentSender,
+ Sender *previousSender)
+{
+ // ref is set to zero when this object is deleted during the metacall
+ if (currentSender->ref == 1)
+ receiver->d_func()->currentSender = previousSender;
+ // if we've recursed, we need to tell the caller about the objects deletion
+ if (previousSender)
+ previousSender->ref = currentSender->ref;
}
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h
index 677412e..509f300 100644
--- a/src/corelib/thread/qmutex.h
+++ b/src/corelib/thread/qmutex.h
@@ -95,21 +95,23 @@ class Q_CORE_EXPORT QMutexLocker
{
public:
inline explicit QMutexLocker(QMutex *m)
- : val(reinterpret_cast<quintptr>(m))
{
- Q_ASSERT_X((val & quintptr(1u)) == quintptr(0),
+ Q_ASSERT_X((reinterpret_cast<quintptr>(m) & quintptr(1u)) == quintptr(0),
"QMutexLocker", "QMutex pointer is misaligned");
- relock();
+ if (m) {
+ m->lock();
+ val = reinterpret_cast<quintptr>(m) | quintptr(1u);
+ } else {
+ val = 0;
+ }
}
inline ~QMutexLocker() { unlock(); }
inline void unlock()
{
- if (val) {
- if ((val & quintptr(1u)) == quintptr(1u)) {
- val &= ~quintptr(1u);
- mutex()->unlock();
- }
+ if ((val & quintptr(1u)) == quintptr(1u)) {
+ val &= ~quintptr(1u);
+ mutex()->unlock();
}
}
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index c12095f..9afcd80 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -88,7 +88,8 @@ enum {
SECS_PER_HOUR = 3600,
MSECS_PER_HOUR = 3600000,
SECS_PER_MIN = 60,
- MSECS_PER_MIN = 60000
+ MSECS_PER_MIN = 60000,
+ JULIAN_DAY_FOR_EPOCH = 2440588 // result of julianDayFromGregorianDate(1970, 1, 1)
};
static inline QDate fixedDate(int y, int m, int d)
@@ -2321,8 +2322,8 @@ void QDateTime::setTimeSpec(Qt::TimeSpec spec)
qint64 toMSecsSinceEpoch_helper(qint64 jd, int msecs)
{
- int days = jd - julianDayFromGregorianDate(1970, 1, 1);
- qint64 retval = (qlonglong(days) * MSECS_PER_DAY) + msecs;
+ qint64 days = jd - JULIAN_DAY_FOR_EPOCH;
+ qint64 retval = (days * MSECS_PER_DAY) + msecs;
return retval;
}
@@ -4017,7 +4018,7 @@ static void localToUtc(QDate &date, QTime &time, int isdst)
localTM.tm_year = fakeDate.year() - 1900;
localTM.tm_isdst = (int)isdst;
#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
- time_t secsSince1Jan1970UTC = toMSecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time));
+ time_t secsSince1Jan1970UTC = (toMSecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time)) / 1000);
#else
#if defined(Q_OS_WIN)
_tzset();
diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp
index a6bd78a..e4f45ba 100644
--- a/src/gui/dialogs/qdialog.cpp
+++ b/src/gui/dialogs/qdialog.cpp
@@ -393,7 +393,6 @@ void QDialogPrivate::resetModalitySetByOpen()
resetModalityTo = -1;
}
-#if defined(Q_WS_WINCE) || defined(Q_WS_S60)
#ifdef Q_WS_WINCE_WM
void QDialogPrivate::_q_doneAction()
{
@@ -408,12 +407,12 @@ void QDialogPrivate::_q_doneAction()
bool QDialog::event(QEvent *e)
{
bool result = QWidget::event(e);
-#ifdef Q_WS_WINCE
+#if defined(Q_WS_WINCE)
if (e->type() == QEvent::OkRequest) {
accept();
result = true;
- }
-#else
+ } else
+#elif defined(Q_WS_S60)
if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) {
if (!testAttribute(Qt::WA_Moved)) {
Qt::WindowStates state = windowState();
@@ -422,11 +421,14 @@ bool QDialog::event(QEvent *e)
if (state != windowState())
setWindowState(state);
}
- }
+ } else
#endif
+ if (e->type() == QEvent::Move) {
+ setAttribute(Qt::WA_Moved, true); // as explicit as the user wants it to be
+ }
+
return result;
}
-#endif
/*!
Returns the modal dialog's result code, \c Accepted or \c Rejected.
diff --git a/src/gui/dialogs/qdialog.h b/src/gui/dialogs/qdialog.h
index 777256a..7ab0cb6 100644
--- a/src/gui/dialogs/qdialog.h
+++ b/src/gui/dialogs/qdialog.h
@@ -107,9 +107,7 @@ public Q_SLOTS:
protected:
QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = 0);
-#if defined(Q_WS_WINCE) || defined(Q_WS_S60)
bool event(QEvent *e);
-#endif
void keyPressEvent(QKeyEvent *);
void closeEvent(QCloseEvent *);
void showEvent(QShowEvent *);
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 9759b39..20ea262 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -10086,6 +10086,9 @@ bool QGraphicsTextItem::sceneEvent(QEvent *event)
#endif //QT_NO_IM
}
break;
+ case QEvent::ShortcutOverride:
+ dd->sendControlEvent(event);
+ return true;
default:
break;
}
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index a767987..114de85 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -733,11 +733,13 @@ void QGraphicsViewPrivate::_q_unsetViewportCursor()
}
// Restore the original viewport cursor.
- hasStoredOriginalCursor = false;
- if (dragMode == QGraphicsView::ScrollHandDrag)
- viewport->setCursor(Qt::OpenHandCursor);
- else
- viewport->setCursor(originalCursor);
+ if (hasStoredOriginalCursor) {
+ hasStoredOriginalCursor = false;
+ if (dragMode == QGraphicsView::ScrollHandDrag)
+ viewport->setCursor(Qt::OpenHandCursor);
+ else
+ viewport->setCursor(originalCursor);
+ }
}
#endif
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index fad51f4..bc52e99 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -879,6 +879,25 @@ QList<QSize> QIcon::availableSizes(Mode mode, State state) const
}
/*!
+ \since 4.7
+
+ Returns the name used to create the icon, if available.
+
+ Depending on the way the icon was created, it may have an associated
+ name. This is the case for icons created with fromTheme() or icons
+ using a QIconEngine which supports the QIconEngineV2::IconNameHook.
+
+ \sa fromTheme(), QIconEngine
+*/
+QString QIcon::name() const
+{
+ if (!d || !d->engine || d->engine_version < 2)
+ return QString();
+ QIconEngineV2 *engine = static_cast<QIconEngineV2*>(d->engine);
+ return engine->iconName();
+}
+
+/*!
\since 4.6
Sets the search paths for icon themes to \a paths.
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index 2812703..faef07b 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -81,6 +81,8 @@ public:
QSize actualSize(const QSize &size, Mode mode = Normal, State state = Off) const;
+ QString name() const;
+
void paint(QPainter *painter, const QRect &rect, Qt::Alignment alignment = Qt::AlignCenter, Mode mode = Normal, State state = Off) const;
inline void paint(QPainter *painter, int x, int y, int w, int h, Qt::Alignment alignment = Qt::AlignCenter, Mode mode = Normal, State state = Off) const
{ paint(painter, QRect(x, y, w, h), alignment, mode, state); }
diff --git a/src/gui/image/qiconengine.cpp b/src/gui/image/qiconengine.cpp
index 4c7c728..050d48d 100644
--- a/src/gui/image/qiconengine.cpp
+++ b/src/gui/image/qiconengine.cpp
@@ -183,6 +183,10 @@ void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QI
that should be filled with icon sizes. Engines that work in terms
of a scalable, vectorial format normally return an empty list.
+ \value IconNameHook Allows to query the name used to create the
+ icon, for example when instantiating an icon using
+ QIcon::fromTheme().
+
\sa virtual_hook()
*/
@@ -301,4 +305,20 @@ QList<QSize> QIconEngineV2::availableSizes(QIcon::Mode mode, QIcon::State state)
return arg.sizes;
}
+/*!
+ \since 4.7
+
+ Returns the name used to create the engine, if available.
+
+ \note This is a helper method and the actual work is done by
+ virtual_hook() method, hence this method depends on icon engine support
+ and may not work with all icon engines.
+ */
+QString QIconEngineV2::iconName()
+{
+ QString name;
+ virtual_hook(QIconEngineV2::IconNameHook, reinterpret_cast<void*>(&name));
+ return name;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qiconengine.h b/src/gui/image/qiconengine.h
index 1f9266b..6d8b6ad 100644
--- a/src/gui/image/qiconengine.h
+++ b/src/gui/image/qiconengine.h
@@ -80,7 +80,7 @@ public:
virtual void virtual_hook(int id, void *data);
public:
- enum IconEngineHook { AvailableSizesHook = 1 };
+ enum IconEngineHook { AvailableSizesHook = 1, IconNameHook };
struct AvailableSizesArgument
{
@@ -92,6 +92,9 @@ public:
// ### Qt 5: make this function const and virtual.
QList<QSize> availableSizes(QIcon::Mode mode = QIcon::Normal,
QIcon::State state = QIcon::Off);
+
+ // ### Qt 5: make this function const and virtual.
+ QString iconName();
};
QT_END_NAMESPACE
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 72ec2e8..a515ef8 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -554,6 +554,12 @@ void QIconLoaderEngine::virtual_hook(int id, void *data)
}
}
break;
+ case QIconEngineV2::IconNameHook:
+ {
+ QString &name = *reinterpret_cast<QString*>(data);
+ name = m_iconName;
+ }
+ break;
default:
QIconEngineV2::virtual_hook(id, data);
}
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 1d8eb4c..fb2837e 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -79,6 +79,7 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
#include "qlayout.h"
#include "qtooltip.h"
#include "qt_windows.h"
+#include "qscrollbar.h"
#if defined(QT_NON_COMMERCIAL)
#include "qnc_win.h"
#endif
@@ -701,6 +702,21 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
QApplication::setPalette(menu, "QMenuBar");
}
+static void qt_set_windows_updateScrollBar(QWidget *widget)
+{
+ QList<QObject*> children = widget->children();
+ for (int i = 0; i < children.size(); ++i) {
+ QObject *o = children.at(i);
+ if(!o->isWidgetType())
+ continue;
+ if (QWidget *w = static_cast<QWidget *>(o))
+ qt_set_windows_updateScrollBar(w);
+ }
+ if (qobject_cast<QScrollBar*>(widget))
+ widget->updateGeometry();
+}
+
+
/*****************************************************************************
qt_init() - initializes Qt for Windows
*****************************************************************************/
@@ -1930,6 +1946,15 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
}
}
}
+ else if (msg.wParam == SPI_SETNONCLIENTMETRICS) {
+ widget = (QETWidget*)QWidget::find(hwnd);
+ if (widget && !widget->parentWidget()) {
+ qt_set_windows_updateScrollBar(widget);
+ QEvent e(QEvent::LayoutRequest);
+ QApplication::sendEvent(widget, &e);
+ }
+ }
+
break;
case WM_PAINT: // paint event
diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm
index b58fd7c..8d65aa1 100644
--- a/src/gui/kernel/qcocoamenuloader_mac.mm
+++ b/src/gui/kernel/qcocoamenuloader_mac.mm
@@ -53,6 +53,12 @@
QT_FORWARD_DECLARE_CLASS(QCFString)
QT_FORWARD_DECLARE_CLASS(QString)
+#ifndef QT_NO_TRANSLATION
+ QT_BEGIN_NAMESPACE
+ extern QString qt_mac_applicationmenu_string(int type);
+ QT_END_NAMESPACE
+#endif
+
QT_USE_NAMESPACE
@implementation QT_MANGLE_NAMESPACE(QCocoaMenuLoader)
@@ -226,7 +232,6 @@ QT_USE_NAMESPACE
- (void)qtTranslateApplicationMenu
{
#ifndef QT_NO_TRANSLATION
- extern QString qt_mac_applicationmenu_string(int type);
[servicesItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(0))];
[hideItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(1).arg(qAppName()))];
[hideAllOthersItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(2))];
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
index ec00915..e94d247 100644
--- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -101,6 +101,17 @@ QT_END_NAMESPACE
return !(isPopup || isToolTip || isTool);
}
+- (void)becomeMainWindow
+{
+ [super becomeMainWindow];
+ // Cocoa sometimes tell a hidden window to become the
+ // main window (and as such, show it). This can e.g
+ // happend when the application gets activated. If
+ // this is the case, we tell it to hide again:
+ if (![self isVisible])
+ [self orderOut:self];
+}
+
- (void)toggleToolbarShown:(id)sender
{
macSendToolbarChangeEvent([self QT_MANGLE_NAMESPACE(qt_qwidget)]);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 10fa4b9..046bc7f 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -7307,9 +7307,9 @@ void QWidgetPrivate::show_helper()
setVisible(false).
- \note If you are working with QDialog or its subclasses and you invoke
- the show() function after this function, the dialog will be displayed in
- its original position.
+ \note Since Qt 4.7, when calling hide() and then show() on QDialog
+ derived widgets will show on the previous (as in "Where the user moved it to")
+ position.
\sa hideEvent(), isHidden(), show(), setVisible(), isVisible(), close()
*/
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index b440fce..bfa1136 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -674,6 +674,11 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
int image_width = data->texture.width;
int image_height = data->texture.height;
+ int image_x1 = data->texture.x1;
+ int image_y1 = data->texture.y1;
+ int image_x2 = data->texture.x2;
+ int image_y2 = data->texture.y2;
+
const qreal cx = x + 0.5;
const qreal cy = y + 0.5;
@@ -708,17 +713,17 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
y2 = y1 + 1;
y2 %= image_height;
} else {
- if (x1 < 0) {
- x2 = x1 = 0;
- } else if (x1 >= image_width - 1) {
- x2 = x1 = image_width - 1;
+ if (x1 < image_x1) {
+ x2 = x1 = image_x1;
+ } else if (x1 >= image_x2 - 1) {
+ x2 = x1 = image_x2 - 1;
} else {
x2 = x1 + 1;
}
- if (y1 < 0) {
- y2 = y1 = 0;
- } else if (y1 >= image_height - 1) {
- y2 = y1 = image_height - 1;
+ if (y1 < image_y1) {
+ y2 = y1 = image_y1;
+ } else if (y1 >= image_y2 - 1) {
+ y2 = y1 = image_y2 - 1;
} else {
y2 = y1 + 1;
}
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 8f14583..9148ac2 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2552,7 +2552,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
int sr_t = qFloor(sr.top());
int sr_b = qCeil(sr.bottom()) - 1;
- if (!s->flags.antialiased && sr_l == sr_r && sr_t == sr_b) {
+ if (s->matrix.type() <= QTransform::TxScale && !s->flags.antialiased && sr_l == sr_r && sr_t == sr_b) {
// as fillRect will apply the aliased coordinate delta we need to
// subtract it here as we don't use it for image drawing
QTransform old = s->matrix;
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 9366513..a78cafb 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -974,6 +974,9 @@ void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, con
void QPaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount,
const QPixmap &pixmap, QPainter::PixmapFragmentHints /*hints*/)
{
+ if (pixmap.isNull())
+ return;
+
qreal oldOpacity = state()->opacity;
QTransform oldTransform = state()->matrix;
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index f78de34..965b84c 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -1914,7 +1914,7 @@ static bool qt_painterpath_check_crossing(const QPainterPath *path, const QRectF
case QPainterPath::MoveToElement:
if (i > 0
- && qFuzzyCompare(last_pt.x(), last_start.y())
+ && qFuzzyCompare(last_pt.x(), last_start.x())
&& qFuzzyCompare(last_pt.y(), last_start.y())
&& qt_painterpath_isect_line_rect(last_pt.x(), last_pt.y(),
last_start.x(), last_start.y(), rect))
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index b0e2d37..8036728 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -981,7 +981,7 @@ void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewIt
qreal y = position.y() + line.y() + line.ascent();
p->save();
p->setFont(option->font);
- p->drawText(int(x), int(y), elidedText);
+ p->drawText(QPointF(x, y), elidedText);
p->restore();
break;
}
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 074dd89..f5b0b0c 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -2143,7 +2143,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
if (qstyleoption_cast<const QStyleOptionComboBox *>(opt) != 0)
ret = 0;
else
- ret = QWindowsStyle::pixelMetric(metric, opt, widget);
+ ret = 1;
break;
case PM_MaximumDragDistance:
ret = -1;
@@ -3099,14 +3099,16 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
HIRect hirect = qt_hirectForQRect(opt->rect);
HIThemeDrawButton(&hirect, &bi, cg, kHIThemeOrientationNormal, 0);
break; }
+
case PE_Frame: {
QPen oldPen = p->pen();
- QPen newPen;
- newPen.setBrush(opt->palette.dark());
- p->setPen(newPen);
+ p->setPen(opt->palette.base().color().darker(140));
p->drawRect(opt->rect.adjusted(0, 0, -1, -1));
+ p->setPen(opt->palette.base().color().darker(180));
+ p->drawLine(opt->rect.topLeft(), opt->rect.topRight());
p->setPen(oldPen);
break; }
+
case PE_FrameLineEdit:
if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
if (frame->state & State_Sunken) {
@@ -3279,10 +3281,14 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (header->orientation == Qt::Horizontal){
switch (header->position) {
case QStyleOptionHeader::Beginning:
+ ir.adjust(-1, -1, 0, 0);
break;
case QStyleOptionHeader::Middle:
+ ir.adjust(-1, -1, 0, 0);
+ break;
+ case QStyleOptionHeader::OnlyOneSection:
case QStyleOptionHeader::End:
- ir.adjust(-1, 0, 0, 0);
+ ir.adjust(-1, -1, 1, 0);
break;
default:
break;
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index d369bff0..7992de5 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -493,10 +493,10 @@ void QTextOdfWriter::writeBlockFormat(QXmlStreamWriter &writer, QTextBlockFormat
format.nonBreakableLines() ? QString::fromLatin1("true") : QString::fromLatin1("false"));
if (format.hasProperty(QTextFormat::TabPositions)) {
QList<QTextOption::Tab> tabs = format.tabPositions();
- writer.writeStartElement(styleNS, QString::fromLatin1("style-tab-stops"));
+ writer.writeStartElement(styleNS, QString::fromLatin1("tab-stops"));
QList<QTextOption::Tab>::Iterator iterator = tabs.begin();
while(iterator != tabs.end()) {
- writer.writeEmptyElement(styleNS, QString::fromLatin1("style-tab-stop"));
+ writer.writeEmptyElement(styleNS, QString::fromLatin1("tab-stop"));
writer.writeAttribute(styleNS, QString::fromLatin1("position"), pixelToPoint(iterator->position) );
QString type;
switch(iterator->type) {
@@ -511,7 +511,7 @@ void QTextOdfWriter::writeBlockFormat(QXmlStreamWriter &writer, QTextBlockFormat
++iterator;
}
- writer.writeEndElement(); // style-tab-stops
+ writer.writeEndElement(); // tab-stops
}
writer.writeEndElement(); // paragraph-properties
@@ -698,11 +698,11 @@ void QTextOdfWriter::writeTableCellFormat(QXmlStreamWriter &writer, QTextTableCe
if (padding > 0)
writer.writeAttribute(foNS, QString::fromLatin1("padding-top"), pixelToPoint(padding));
if (format.bottomPadding() > 0)
- writer.writeAttribute(foNS, QString::fromLatin1("padding-top"), pixelToPoint(format.bottomPadding()));
+ writer.writeAttribute(foNS, QString::fromLatin1("padding-bottom"), pixelToPoint(format.bottomPadding()));
if (format.leftPadding() > 0)
- writer.writeAttribute(foNS, QString::fromLatin1("padding-top"), pixelToPoint(format.leftPadding()));
+ writer.writeAttribute(foNS, QString::fromLatin1("padding-left"), pixelToPoint(format.leftPadding()));
if (format.rightPadding() > 0)
- writer.writeAttribute(foNS, QString::fromLatin1("padding-top"), pixelToPoint(format.rightPadding()));
+ writer.writeAttribute(foNS, QString::fromLatin1("padding-right"), pixelToPoint(format.rightPadding()));
}
if (format.hasProperty(QTextFormat::TextVerticalAlignment)) {
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index 73ec53e..8cffebd 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -983,6 +983,7 @@ bool QAbstractScrollArea::event(QEvent *e)
case QEvent::StyleChange:
case QEvent::LayoutDirectionChange:
case QEvent::ApplicationLayoutDirectionChange:
+ case QEvent::LayoutRequest:
d->layoutChildren();
// fall through
default:
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 6a0eb53..7645c23 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -665,6 +665,7 @@ void qt_mac_set_modal_state_helper_recursive(OSMenuRef menu, OSMenuRef merge, bo
}
}
#else
+ bool modalWindowOnScreen = qApp->activeModalWidget() != 0;
for (NSMenuItem *item in [menu itemArray]) {
OSMenuRef submenu = [item submenu];
if (submenu != merge) {
@@ -674,10 +675,20 @@ void qt_mac_set_modal_state_helper_recursive(OSMenuRef menu, OSMenuRef merge, bo
// The item should follow what the QAction has.
if ([item tag]) {
QAction *action = reinterpret_cast<QAction *>([item tag]);
- syncNSMenuItemEnabled(item, action->isEnabled());
- } else {
- syncNSMenuItemEnabled(item, YES);
- }
+ syncNSMenuItemEnabled(item, action->isEnabled());
+ } else {
+ syncNSMenuItemEnabled(item, YES);
+ }
+ // We sneak in some extra code here to handle a menu problem:
+ // If there is no window on screen, we cannot set 'nil' as
+ // menu item target, because then cocoa will disable the item
+ // (guess it assumes that there will be no first responder to
+ // catch the trigger anyway?) OTOH, If we have a modal window,
+ // then setting the menu loader as target will make cocoa not
+ // deliver the trigger because the loader is then seen as modally
+ // shaddowed). So either way there are shortcomings. Instead, we
+ // decide the target as late as possible:
+ [item setTarget:modalWindowOnScreen ? nil : getMenuLoader()];
} else {
syncNSMenuItemEnabled(item, NO);
}
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp
index a651dd1..a7bd2d5 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.cpp
+++ b/src/network/bearer/qnetworkconfigmanager_p.cpp
@@ -381,7 +381,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations()
connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)),
this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer)));
- QMetaObject::invokeMethod(engine, "requestUpdate");
+ QMetaObject::invokeMethod(engine, "initialize");
}
}
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index baf69e7..7e006e0 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -488,9 +488,23 @@ QHostInfoLookupManager::~QHostInfoLookupManager()
wasDeleted = true;
// don't qDeleteAll currentLookups, the QThreadPool has ownership
- qDeleteAll(postponedLookups);
- qDeleteAll(scheduledLookups);
- qDeleteAll(finishedLookups);
+ clear();
+}
+
+void QHostInfoLookupManager::clear()
+{
+ {
+ QMutexLocker locker(&mutex);
+ qDeleteAll(postponedLookups);
+ qDeleteAll(scheduledLookups);
+ qDeleteAll(finishedLookups);
+ postponedLookups.clear();
+ scheduledLookups.clear();
+ finishedLookups.clear();
+ }
+
+ threadPool.waitForDone();
+ cache.clear();
}
void QHostInfoLookupManager::work()
@@ -636,7 +650,7 @@ void qt_qhostinfo_clear_cache()
{
QHostInfoLookupManager* manager = theHostInfoLookupManager();
if (manager) {
- manager->cache.clear();
+ manager->clear();
}
}
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index 4fc74e9..e11766b 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -116,7 +116,7 @@ public:
// These functions are outside of the QHostInfo class and strictly internal.
// Do NOT use them outside of QAbstractSocket.
QHostInfo Q_NETWORK_EXPORT qt_qhostinfo_lookup(const QString &name, QObject *receiver, const char *member, bool *valid, int *id);
-void Q_NETWORK_EXPORT qt_qhostinfo_clear_cache();
+void Q_AUTOTEST_EXPORT qt_qhostinfo_clear_cache();
void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache(bool e);
class QHostInfoCache
@@ -161,6 +161,7 @@ public:
QHostInfoLookupManager();
~QHostInfoLookupManager();
+ void clear();
void work();
// called from QHostInfo
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index c89d34f..955a129 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -573,9 +573,9 @@ void QGL2PaintEngineExPrivate::resetGLState()
glStencilMask(0xff);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glStencilFunc(GL_ALWAYS, 0, 0xff);
- glDisableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
- glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
- glDisableVertexAttribArray(QT_OPACITY_ATTR);
+ ctx->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false);
+ ctx->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false);
+ ctx->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
#ifndef QT_OPENGL_ES_2
glColor4f(1.0f, 1.0f, 1.0f, 1.0f); // color may have been changed by glVertexAttrib()
#endif
diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp
index ef3c4cd..8e2bbd4 100644
--- a/src/opengl/qglextensions.cpp
+++ b/src/opengl/qglextensions.cpp
@@ -235,11 +235,6 @@ bool qt_resolve_eglimage_gl_extensions(QGLContext *ctx)
bool qt_resolve_glsl_extensions(QGLContext *ctx)
{
- // Geometry shaders are optional...
- glProgramParameteriEXT = (_glProgramParameteriEXT) ctx->getProcAddress(QLatin1String("glProgramParameteriEXT"));
- glFramebufferTextureEXT = (_glFramebufferTextureEXT) ctx->getProcAddress(QLatin1String("glFramebufferTextureEXT"));
- glFramebufferTextureLayerEXT = (_glFramebufferTextureLayerEXT) ctx->getProcAddress(QLatin1String("glFramebufferTextureLayerEXT"));
- glFramebufferTextureFaceEXT = (_glFramebufferTextureFaceEXT) ctx->getProcAddress(QLatin1String("glFramebufferTextureFaceEXT"));
#if defined(QT_OPENGL_ES_2)
// The GLSL shader functions are always present in OpenGL/ES 2.0.
@@ -254,6 +249,12 @@ bool qt_resolve_glsl_extensions(QGLContext *ctx)
if (glCreateShader)
return true;
+ // Geometry shaders are optional...
+ glProgramParameteriEXT = (_glProgramParameteriEXT) ctx->getProcAddress(QLatin1String("glProgramParameteriEXT"));
+ glFramebufferTextureEXT = (_glFramebufferTextureEXT) ctx->getProcAddress(QLatin1String("glFramebufferTextureEXT"));
+ glFramebufferTextureLayerEXT = (_glFramebufferTextureLayerEXT) ctx->getProcAddress(QLatin1String("glFramebufferTextureLayerEXT"));
+ glFramebufferTextureFaceEXT = (_glFramebufferTextureFaceEXT) ctx->getProcAddress(QLatin1String("glFramebufferTextureFaceEXT"));
+
glCreateShader = (_glCreateShader) ctx->getProcAddress(QLatin1String("glCreateShader"));
if (glCreateShader) {
glShaderSource = (_glShaderSource) ctx->getProcAddress(QLatin1String("glShaderSource"));
diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp
index 3ab385a..4d726b6 100644
--- a/src/opengl/qpixmapdata_x11gl_egl.cpp
+++ b/src/opengl/qpixmapdata_x11gl_egl.cpp
@@ -66,7 +66,8 @@ QT_BEGIN_NAMESPACE
// different contexts:
Q_GLOBAL_STATIC(QEglContext, qt_x11gl_rgbContext);
-Q_GLOBAL_STATIC(QEglContext, qt_x11gl_argbContext)
+Q_GLOBAL_STATIC(QEglContext, qt_x11gl_argbContext);
+Q_GLOBAL_STATIC_WITH_ARGS(QGLContext, qt_x11gl_fake_shared_context, (QX11GLPixmapData::glFormat()));
QEglContext* QX11GLPixmapData::rgbContext = 0;
QEglContext* QX11GLPixmapData::argbContext = 0;
@@ -112,7 +113,13 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
if (!argbContext) {
argbContext = qt_x11gl_argbContext();
argbContext->setConfig(argbConfig);
- argbContext->createContext();
+ bool success = argbContext->createContext(rgbContext);
+ if (!success) {
+ qWarning("QX11GLPixmapData - RGB & ARGB contexts aren't shared");
+ success = argbContext->createContext();
+ if (!success)
+ argbContext = rgbContext; // Might work, worth a shot at least.
+ }
}
if (!argbContext->isValid())
@@ -258,6 +265,14 @@ QPaintEngine* QX11GLPixmapData::paintEngine() const
ctx = new QGLContext(glFormat());
Q_ASSERT(ctx->d_func()->eglContext == 0);
ctx->d_func()->eglContext = hasAlphaChannel() ? argbContext : rgbContext;
+
+ // While we use a seperate QGLContext for each pixmap, the underlying QEglContext is
+ // the same. So we must use a "fake" QGLContext and fool the texture cache into thinking
+ // each pixmap's QGLContext is sharing with this central one. The only place this is
+ // going to fail is where we the underlying EGL RGB and ARGB contexts aren't sharing.
+ ctx->d_func()->sharing = true;
+ QGLContextGroup::addShare(ctx, qt_x11gl_fake_shared_context());
+
// Update the glFormat for the QGLContext:
qt_glformat_from_eglconfig(ctx->d_func()->glFormat, ctx->d_func()->eglContext->config());
}
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 5c69299..3c24c54 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -47,15 +47,18 @@
#include <QMap>
#include <QTimer>
#include <SystemConfiguration/SystemConfiguration.h>
+#include <QThread>
#ifndef QT_NO_BEARERMANAGEMENT
QT_BEGIN_NAMESPACE
class QNetworkConfigurationPrivate;
+class QScanThread;
class QCoreWlanEngine : public QBearerEngineImpl
{
+ friend class QScanThread;
Q_OBJECT
public:
@@ -70,6 +73,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
@@ -84,27 +88,52 @@ public:
private Q_SLOTS:
void doRequestUpdate();
+ void networksChanged();
private:
bool isWifiReady(const QString &dev);
- QMap<QString, QString> configurationInterface;
- QStringList scanForSsids(const QString &interfaceName);
-
- bool isKnownSsid(const QString &ssid);
QList<QNetworkConfigurationPrivate *> foundConfigurations;
SCDynamicStoreRef storeSession;
CFRunLoopSourceRef runloopSource;
bool hasWifi;
+ bool scanning;
+ QScanThread *scanThread;
protected:
- QMap<QString, QMap<QString,QString> > userProfiles;
-
void startNetworkChangeLoop();
+
+};
+
+class QScanThread : public QThread
+{
+ Q_OBJECT
+
+public:
+ QScanThread(QObject *parent = 0);
+ ~QScanThread();
+
+ void quit();
+ QList<QNetworkConfigurationPrivate *> getConfigurations();
+ QString interfaceName;
+ QMap<QString, QString> configurationInterface;
void getUserConfigurations();
QString getNetworkNameFromSsid(const QString &ssid);
QString getSsidFromNetworkName(const QString &name);
+ bool isKnownSsid(const QString &ssid);
+ QMap<QString, QMap<QString,QString> > userProfiles;
+
+signals:
+ void networksChanged();
+
+protected:
+ void run();
+
+private:
+ QList<QNetworkConfigurationPrivate *> fetchedConfigurations;
+ QMutex mutex;
QStringList foundNetwork(const QString &id, const QString &ssid, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose);
+
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 268126a..3206833 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -67,10 +67,6 @@
#include <private/qt_cocoa_helpers_mac_p.h>
#include "private/qcore_mac_p.h"
-#ifndef QT_NO_BEARERMANAGEMENT
-
-QT_BEGIN_NAMESPACE
-
@interface QNSListener : NSObject
{
NSNotificationCenter *center;
@@ -96,7 +92,6 @@ QT_BEGIN_NAMESPACE
QMacCocoaAutoReleasePool pool;
center = [NSNotificationCenter defaultCenter];
currentInterface = [CWInterface interfaceWithName:nil];
-// [center addObserver:self selector:@selector(notificationHandler:) name:kCWLinkDidChangeNotification object:nil];
[center addObserver:self selector:@selector(notificationHandler:) name:kCWPowerDidChangeNotification object:nil];
[locker unlock];
return self;
@@ -130,6 +125,8 @@ QT_BEGIN_NAMESPACE
QNSListener *listener = 0;
+QT_BEGIN_NAMESPACE
+
void networkChangeCallback(SCDynamicStoreRef/* store*/, CFArrayRef changedKeys, void *info)
{
for ( long i = 0; i < CFArrayGetCount(changedKeys); i++) {
@@ -143,20 +140,279 @@ void networkChangeCallback(SCDynamicStoreRef/* store*/, CFArrayRef changedKeys,
return;
}
-QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
-: QBearerEngineImpl(parent)
+
+QScanThread::QScanThread(QObject *parent)
+ :QThread(parent)
{
- startNetworkChangeLoop();
+}
+
+QScanThread::~QScanThread()
+{
+}
+
+void QScanThread::quit()
+{
+ wait();
+}
+
+void QScanThread::run()
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ QStringList found;
+ mutex.lock();
+ CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)];
+ mutex.unlock();
+
+ if([currentInterface power]) {
+ NSError *err = nil;
+ NSDictionary *parametersDict = [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithBool:YES], kCWScanKeyMerge,
+ [NSNumber numberWithInteger:100], kCWScanKeyRestTime, nil];
+
+ NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err];
+ CWNetwork *apNetwork;
+
+ if (!err) {
+
+ for(uint row=0; row < [apArray count]; row++ ) {
+ apNetwork = [apArray objectAtIndex:row];
+
+ const QString networkSsid = qt_mac_NSStringToQString([apNetwork ssid]);
+ const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
+ found.append(id);
+
+ QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
+ bool known = isKnownSsid(networkSsid);
+ if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
+ if( networkSsid == qt_mac_NSStringToQString( [currentInterface ssid])) {
+ state = QNetworkConfiguration::Active;
+ }
+ }
+ if(state == QNetworkConfiguration::Undefined) {
+ if(known) {
+ state = QNetworkConfiguration::Discovered;
+ } else {
+ state = QNetworkConfiguration::Undefined;
+ }
+ }
+ QNetworkConfiguration::Purpose purpose = QNetworkConfiguration::UnknownPurpose;
+ if([[apNetwork securityMode] intValue] == kCWSecurityModeOpen) {
+ purpose = QNetworkConfiguration::PublicPurpose;
+ } else {
+ purpose = QNetworkConfiguration::PrivatePurpose;
+ }
+
+ found.append(foundNetwork(id, networkSsid, state, interfaceName, purpose));
+
+ } //end row
+// [parametersDict release];
+
+ } //end error
+ } // endwifi power
+ // add known configurations that are not around.
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+
+ QString networkName = i.key();
+ const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkName));
+
+ if(!found.contains(id)) {
+ QString networkSsid = getSsidFromNetworkName(networkName);
+ const QString ssidId = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
+ QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
+ QString interfaceName;
+ QMapIterator<QString, QString> ij(i.value());
+ while (ij.hasNext()) {
+ ij.next();
+ interfaceName = ij.value();
+ }
+
+ if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
+ if( networkSsid == qt_mac_NSStringToQString([currentInterface ssid])) {
+ state = QNetworkConfiguration::Active;
+ }
+ }
+ if(state == QNetworkConfiguration::Undefined) {
+ if( userProfiles.contains(networkName)
+ && found.contains(ssidId)) {
+ state = QNetworkConfiguration::Discovered;
+ }
+ }
+
+ if(state == QNetworkConfiguration::Undefined) {
+ state = QNetworkConfiguration::Defined;
+ }
+
+ found.append(foundNetwork(id, networkName, state, interfaceName, QNetworkConfiguration::UnknownPurpose));
+ }
+ }
+ emit networksChanged();
+ [pool release];
+}
+
+QStringList QScanThread::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose)
+{
+ QStringList found;
+ QMutexLocker locker(&mutex);
+ QNetworkConfigurationPrivate *ptr = new QNetworkConfigurationPrivate;
+
+ ptr->name = name;
+ ptr->isValid = true;
+ ptr->id = id;
+ ptr->state = state;
+ ptr->type = QNetworkConfiguration::InternetAccessPoint;
+ ptr->bearer = QLatin1String("WLAN");
+ ptr->purpose = purpose;
+
+ fetchedConfigurations.append( ptr);
+ configurationInterface.insert(ptr->id, interfaceName);
+
+ locker.unlock();
+ locker.relock();
+ found.append(id);
+ return found;
+}
+
+QList<QNetworkConfigurationPrivate *> QScanThread::getConfigurations()
+{
+ QMutexLocker locker(&mutex);
+
+ QList<QNetworkConfigurationPrivate *> foundConfigurations = fetchedConfigurations;
+ fetchedConfigurations.clear();
+
+ return foundConfigurations;
+}
+
+void QScanThread::getUserConfigurations()
+{
+ QMutexLocker locker(&mutex);
QMacCocoaAutoReleasePool pool;
- if([[CWInterface supportedInterfaces] count] > 0 && !listener) {
- listener = [[QNSListener alloc] init];
- listener.engine = this;
- hasWifi = true;
- } else {
- hasWifi = false;
+ userProfiles.clear();
+
+ NSArray *wifiInterfaces = [CWInterface supportedInterfaces];
+ for(uint row=0; row < [wifiInterfaces count]; row++ ) {
+
+ CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]];
+ NSString *nsInterfaceName = [wifiInterface name];
+// add user configured system networks
+ SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil);
+ NSDictionary * airportPlist = (NSDictionary *)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", nsInterfaceName]);
+ CFRelease(dynRef);
+
+ NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"];
+
+ NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"];
+ for(NSString *ssidkey in thisSsidarray) {
+ QString thisSsid = qt_mac_NSStringToQString(ssidkey);
+ if(!userProfiles.contains(thisSsid)) {
+ QMap <QString,QString> map;
+ map.insert(thisSsid, qt_mac_NSStringToQString(nsInterfaceName));
+ userProfiles.insert(thisSsid, map);
+ }
+ }
+ CFRelease(airportPlist);
+
+ // 802.1X user profiles
+ QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist";
+ NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile:qt_mac_QStringToNSString(userProfilePath)] autorelease];
+ NSString *profileStr= @"Profiles";
+ NSString *nameStr = @"UserDefinedName";
+ NSString *networkSsidStr = @"Wireless Network";
+ for (id profileKey in eapDict) {
+ if ([profileStr isEqualToString:profileKey]) {
+ NSDictionary *itemDict = [eapDict objectForKey:profileKey];
+ for (id itemKey in itemDict) {
+
+ NSInteger dictSize = [itemKey count];
+ id objects[dictSize];
+ id keys[dictSize];
+
+ [itemKey getObjects:objects andKeys:keys];
+ QString networkName;
+ QString ssid;
+ for(int i = 0; i < dictSize; i++) {
+ if([nameStr isEqualToString:keys[i]]) {
+ networkName = qt_mac_NSStringToQString(objects[i]);
+ }
+ if([networkSsidStr isEqualToString:keys[i]]) {
+ ssid = qt_mac_NSStringToQString(objects[i]);
+ }
+ if(!userProfiles.contains(networkName)
+ && !ssid.isEmpty()) {
+ QMap<QString,QString> map;
+ map.insert(ssid, qt_mac_NSStringToQString(nsInterfaceName));
+ userProfiles.insert(networkName, map);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+QString QScanThread::getSsidFromNetworkName(const QString &name)
+{
+ QMutexLocker locker(&mutex);
+
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QMap<QString,QString> map = i.value();
+ QMapIterator<QString, QString> ij(i.value());
+ while (ij.hasNext()) {
+ ij.next();
+ const QString networkNameHash = QString::number(qHash(QLatin1String("corewlan:") +i.key()));
+ if(name == i.key() || name == networkNameHash) {
+ return ij.key();
+ }
+ }
+ }
+ return QString();
+}
+
+QString QScanThread::getNetworkNameFromSsid(const QString &ssid)
+{
+ QMutexLocker locker(&mutex);
+
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QMap<QString,QString> map = i.value();
+ QMapIterator<QString, QString> ij(i.value());
+ while (ij.hasNext()) {
+ ij.next();
+ if(ij.key() == ssid) {
+ return i.key();
+ }
+ }
}
- QMetaObject::invokeMethod(this, "requestUpdate", Qt::QueuedConnection);
+ return QString();
+}
+
+bool QScanThread::isKnownSsid(const QString &ssid)
+{
+ QMutexLocker locker(&mutex);
+
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QMap<QString,QString> map = i.value();
+ if(map.keys().contains(ssid)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
+: QBearerEngineImpl(parent), scanThread(0)
+{
+ scanThread = new QScanThread(this);
+ connect(scanThread, SIGNAL(networksChanged()),
+ this, SLOT(networksChanged()));
}
QCoreWlanEngine::~QCoreWlanEngine()
@@ -167,18 +423,35 @@ QCoreWlanEngine::~QCoreWlanEngine()
[listener release];
}
+void QCoreWlanEngine::initialize()
+{
+ QMutexLocker locker(&mutex);
+
+ if([[CWInterface supportedInterfaces] count] > 0 && !listener) {
+ listener = [[QNSListener alloc] init];
+ listener.engine = this;
+ hasWifi = true;
+ } else {
+ hasWifi = false;
+ }
+ storeSession = NULL;
+
+ startNetworkChangeLoop();
+}
+
+
QString QCoreWlanEngine::getInterfaceFromId(const QString &id)
{
QMutexLocker locker(&mutex);
- return configurationInterface.value(id);
+ return scanThread->configurationInterface.value(id);
}
bool QCoreWlanEngine::hasIdentifier(const QString &id)
{
QMutexLocker locker(&mutex);
- return configurationInterface.contains(id);
+ return scanThread->configurationInterface.contains(id);
}
void QCoreWlanEngine::connectToId(const QString &id)
@@ -195,13 +468,14 @@ void QCoreWlanEngine::connectToId(const QString &id)
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
QString wantedSsid;
- bool using8021X = false;
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- const QString idHash = QString::number(qHash(QLatin1String("corewlan:") + getNetworkNameFromSsid(ptr->name)));
+ const QString idHash = QString::number(qHash(QLatin1String("corewlan:") + ptr->name));
+ const QString idHash2 = QString::number(qHash(QLatin1String("corewlan:") + scanThread->getNetworkNameFromSsid(ptr->name)));
- if (idHash != id) {
+ bool using8021X = false;
+ if (idHash2 != id) {
NSArray *array = [CW8021XProfile allUser8021XProfiles];
for (NSUInteger i = 0; i < [array count]; ++i) {
@@ -210,7 +484,7 @@ void QCoreWlanEngine::connectToId(const QString &id)
const QString ssidHash = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] ssid])));
if (id == networkNameHashCheck || id == ssidHash) {
- const QString thisName = getSsidFromNetworkName(id);
+ const QString thisName = scanThread->getSsidFromNetworkName(id);
if (thisName.isEmpty())
wantedSsid = id;
else
@@ -225,24 +499,25 @@ void QCoreWlanEngine::connectToId(const QString &id)
if (!using8021X) {
QString wantedNetwork;
- QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ QMapIterator<QString, QMap<QString,QString> > i(scanThread->userProfiles);
while (i.hasNext()) {
i.next();
wantedNetwork = i.key();
const QString networkNameHash = QString::number(qHash(QLatin1String("corewlan:") + wantedNetwork));
if (id == networkNameHash) {
- wantedSsid = getSsidFromNetworkName(wantedNetwork);
+ wantedSsid = scanThread->getSsidFromNetworkName(wantedNetwork);
break;
}
}
}
NSDictionary *scanParameters = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], kCWScanKeyMerge,
+ [NSNumber numberWithInt:kCWScanTypeFast], kCWScanKeyScanType,
[NSNumber numberWithInteger:100], kCWScanKeyRestTime,
qt_mac_QStringToNSString(wantedSsid), kCWScanKeySSID,
nil];
- NSArray *scanArray = [NSArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:scanParameters error:&err]];
+ NSArray *scanArray = [wifiInterface scanForNetworksWithParameters:scanParameters error:&err];
if(!err) {
for(uint row=0; row < [scanArray count]; row++ ) {
@@ -349,7 +624,7 @@ void QCoreWlanEngine::disconnectFromId(const QString &id)
void QCoreWlanEngine::requestUpdate()
{
- getUserConfigurations();
+ scanThread->getUserConfigurations();
doRequestUpdate();
}
@@ -359,228 +634,12 @@ void QCoreWlanEngine::doRequestUpdate()
QMacCocoaAutoReleasePool pool;
- QStringList previous = accessPointConfigurations.keys();
-
NSArray *wifiInterfaces = [CWInterface supportedInterfaces];
for (uint row = 0; row < [wifiInterfaces count]; ++row) {
- foreach (const QString &interface,
- scanForSsids(qt_mac_NSStringToQString([wifiInterfaces objectAtIndex:row]))) {
- previous.removeAll(interface);
- }
+ scanThread->interfaceName = qt_mac_NSStringToQString([wifiInterfaces objectAtIndex:row]);
+ scanThread->start();
}
-
- while (!previous.isEmpty()) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(previous.takeFirst());
-
- configurationInterface.remove(ptr->id);
-
- locker.unlock();
- emit configurationRemoved(ptr);
- locker.relock();
- }
-
locker.unlock();
- emit updateCompleted();
-}
-
-QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name)
-{
- QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
- while (i.hasNext()) {
- i.next();
- QMap<QString,QString> map = i.value();
- QMapIterator<QString, QString> ij(i.value());
- while (ij.hasNext()) {
- ij.next();
- const QString networkNameHash = QString::number(qHash(QLatin1String("corewlan:") + i.key()));
- if (name == i.key() || name == networkNameHash) {
- return ij.key();
- }
- }
- }
- return QString();
-}
-
-QString QCoreWlanEngine::getNetworkNameFromSsid(const QString &ssid)
-{
- QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
- while (i.hasNext()) {
- i.next();
- QMap<QString,QString> map = i.value();
- QMapIterator<QString, QString> ij(i.value());
- while (ij.hasNext()) {
- ij.next();
- if(ij.key() == ssid) {
- return i.key();
- }
- }
- }
- return QString();
-}
-
-QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
-{
- QMutexLocker locker(&mutex);
-
- QStringList found;
-
- if(!hasWifi) {
- return found;
- }
- QMacCocoaAutoReleasePool pool;
-
- CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)];
- QStringList addedConfigs;
-
- if([currentInterface power]) {
- NSError *err = nil;
- NSDictionary *parametersDict = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithBool:YES], kCWScanKeyMerge,
- [NSNumber numberWithInt:kCWScanTypeFast], kCWScanKeyScanType, // get the networks in the scan cache
- [NSNumber numberWithInteger:100], kCWScanKeyRestTime, nil];
- NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err];
- CWNetwork *apNetwork;
- if (!err) {
-
- for(uint row=0; row < [apArray count]; row++ ) {
- apNetwork = [apArray objectAtIndex:row];
-
- const QString networkSsid = qt_mac_NSStringToQString([apNetwork ssid]);
-
- const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
- found.append(id);
-
- QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
- bool known = isKnownSsid(networkSsid);
- if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
- if( networkSsid == qt_mac_NSStringToQString( [currentInterface ssid])) {
- state = QNetworkConfiguration::Active;
- }
- }
- if(state == QNetworkConfiguration::Undefined) {
- if(known) {
- state = QNetworkConfiguration::Discovered;
- } else {
- state = QNetworkConfiguration::Undefined;
- }
- }
- QNetworkConfiguration::Purpose purpose = QNetworkConfiguration::UnknownPurpose;
- if([[apNetwork securityMode] intValue] == kCWSecurityModeOpen) {
- purpose = QNetworkConfiguration::PublicPurpose;
- } else {
- purpose = QNetworkConfiguration::PrivatePurpose;
- }
-
- found.append(foundNetwork(id, networkSsid, state, interfaceName, purpose));
-
- } //end row
- } //end error
- } // endwifi power
-
- // add known configurations that are not around.
- QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
- while (i.hasNext()) {
- i.next();
-
- QString networkName = i.key();
- const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkName));
-
- if(!found.contains(id)) {
- QString networkSsid = getSsidFromNetworkName(networkName);
- const QString ssidId = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
- QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
- QString interfaceName;
- QMapIterator<QString, QString> ij(i.value());
- while (ij.hasNext()) {
- ij.next();
- interfaceName = ij.value();
- }
-
- if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
- if( networkSsid == qt_mac_NSStringToQString([currentInterface ssid])) {
- state = QNetworkConfiguration::Active;
- }
- }
- if(state == QNetworkConfiguration::Undefined) {
- if( userProfiles.contains(networkName)
- && found.contains(ssidId)) {
- state = QNetworkConfiguration::Discovered;
- }
- }
-
- if(state == QNetworkConfiguration::Undefined) {
- state = QNetworkConfiguration::Defined;
- }
-
- found.append(foundNetwork(id, networkName, state, interfaceName, QNetworkConfiguration::UnknownPurpose));
- }
- }
- return found;
-}
-
-QStringList QCoreWlanEngine::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose)
-{
- QStringList found;
- QMutexLocker locker(&mutex);
- if (accessPointConfigurations.contains(id)) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- bool changed = false;
-
- ptr->mutex.lock();
-
- if (!ptr->isValid) {
- ptr->isValid = true;
- changed = true;
- }
-
- if (ptr->name != name) {
- ptr->name = name;
- changed = true;
- }
-
- if (ptr->id != id) {
- ptr->id = id;
- changed = true;
- }
-
- if (ptr->state != state) {
- ptr->state = state;
- changed = true;
- }
-
- if (ptr->purpose != purpose) {
- ptr->purpose = purpose;
- changed = true;
- }
- ptr->mutex.unlock();
-
- if (changed) {
- locker.unlock();
- emit configurationChanged(ptr);
- locker.relock();
- }
- found.append(id);
- } else {
- QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
-
- ptr->name = name;
- ptr->isValid = true;
- ptr->id = id;
- ptr->state = state;
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->bearer = QLatin1String("WLAN");
- ptr->purpose = purpose;
-
- accessPointConfigurations.insert(ptr->id, ptr);
- configurationInterface.insert(ptr->id, interfaceName);
-
- locker.unlock();
- emit configurationAdded(ptr);
- locker.relock();
- found.append(id);
- }
- return found;
}
bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
@@ -596,20 +655,6 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
return false;
}
-bool QCoreWlanEngine::isKnownSsid(const QString &ssid)
-{
- QMutexLocker locker(&mutex);
-
- QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
- while (i.hasNext()) {
- i.next();
- QMap<QString,QString> map = i.value();
- if(map.keys().contains(ssid)) {
- return true;
- }
- }
- return false;
-}
QNetworkSession::State QCoreWlanEngine::sessionStateForId(const QString &id)
{
@@ -644,7 +689,6 @@ QNetworkConfigurationManager::Capabilities QCoreWlanEngine::capabilities() const
void QCoreWlanEngine::startNetworkChangeLoop()
{
- storeSession = NULL;
SCDynamicStoreContext dynStoreContext = { 0, this/*(void *)storeSession*/, NULL, NULL, NULL };
storeSession = SCDynamicStoreCreate(NULL,
@@ -711,74 +755,73 @@ bool QCoreWlanEngine::requiresPolling() const
return true;
}
-void QCoreWlanEngine::getUserConfigurations()
+void QCoreWlanEngine::networksChanged()
{
- QMacCocoaAutoReleasePool pool;
- userProfiles.clear();
+ QMutexLocker locker(&mutex);
- NSArray *wifiInterfaces = [CWInterface supportedInterfaces];
- for(uint row=0; row < [wifiInterfaces count]; row++ ) {
+ QStringList previous = accessPointConfigurations.keys();
- CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]];
- NSString *nsInterfaceName = [wifiInterface name];
-// add user configured system networks
- SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil);
- NSDictionary *airportPlist = (NSDictionary *)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", nsInterfaceName] autorelease]);
- CFRelease(dynRef);
+ QList<QNetworkConfigurationPrivate *> foundConfigurations = scanThread->getConfigurations();
+ while (!foundConfigurations.isEmpty()) {
+ QNetworkConfigurationPrivate *cpPriv = foundConfigurations.takeFirst();
- NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"];
+ previous.removeAll(cpPriv->id);
- NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"];
- for(NSString *ssidkey in thisSsidarray) {
- QString thisSsid = qt_mac_NSStringToQString(ssidkey);
- if(!userProfiles.contains(thisSsid)) {
- QMap <QString,QString> map;
- map.insert(thisSsid, qt_mac_NSStringToQString(nsInterfaceName));
- userProfiles.insert(thisSsid, map);
+ if (accessPointConfigurations.contains(cpPriv->id)) {
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(cpPriv->id);
+
+ bool changed = false;
+
+ ptr->mutex.lock();
+
+ if (ptr->isValid != cpPriv->isValid) {
+ ptr->isValid = cpPriv->isValid;
+ changed = true;
}
- }
- CFRelease(airportPlist);
- // 802.1X user profiles
- QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist";
- NSDictionary* eapDict = [[NSDictionary alloc] initWithContentsOfFile:qt_mac_QStringToNSString(userProfilePath)];
- NSString *profileStr= @"Profiles";
- NSString *nameStr = @"UserDefinedName";
- NSString *networkSsidStr = @"Wireless Network";
- for (id profileKey in eapDict) {
- if ([profileStr isEqualToString:profileKey]) {
- NSDictionary *itemDict = [eapDict objectForKey:profileKey];
- for (id itemKey in itemDict) {
+ if (ptr->name != cpPriv->name) {
+ ptr->name = cpPriv->name;
+ changed = true;
+ }
- NSInteger dictSize = [itemKey count];
- id objects[dictSize];
- id keys[dictSize];
+ if (ptr->state != cpPriv->state) {
+ ptr->state = cpPriv->state;
+ changed = true;
+ }
- [itemKey getObjects:objects andKeys:keys];
- QString networkName;
- QString ssid;
- for(int i = 0; i < dictSize; i++) {
- if([nameStr isEqualToString:keys[i]]) {
- networkName = qt_mac_NSStringToQString(objects[i]);
- }
- if([networkSsidStr isEqualToString:keys[i]]) {
- ssid = qt_mac_NSStringToQString(objects[i]);
- }
- if(!userProfiles.contains(networkName)
- && !ssid.isEmpty()) {
- QMap<QString,QString> map;
- map.insert(ssid, qt_mac_NSStringToQString(nsInterfaceName));
- userProfiles.insert(networkName, map);
- }
- }
- }
- [itemDict release];
+ ptr->mutex.unlock();
+
+ if (changed) {
+ locker.unlock();
+ emit configurationChanged(ptr);
+ locker.relock();
}
+
+ delete cpPriv;
+ } else {
+ QNetworkConfigurationPrivatePointer ptr(cpPriv);
+
+ accessPointConfigurations.insert(ptr->id, ptr);
+
+ locker.unlock();
+ emit configurationAdded(ptr);
+ locker.relock();
}
- [eapDict release];
}
+
+ while (!previous.isEmpty()) {
+ QNetworkConfigurationPrivatePointer ptr =
+ accessPointConfigurations.take(previous.takeFirst());
+
+ locker.unlock();
+ emit configurationRemoved(ptr);
+ locker.relock();
+ }
+
+ locker.unlock();
+ emit updateCompleted();
+
}
-QT_END_NAMESPACE
-#endif // QT_NO_BEARERMANAGEMENT
+QT_END_NAMESPACE
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index 41ff3e0..652fe4a 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -177,6 +177,11 @@ void QGenericEngine::disconnectFromId(const QString &id)
emit connectionError(id, OperationNotSupported);
}
+void QGenericEngine::initialize()
+{
+ doRequestUpdate();
+}
+
void QGenericEngine::requestUpdate()
{
doRequestUpdate();
diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h
index 82d22af..cdbbc9d 100644
--- a/src/plugins/bearer/generic/qgenericengine.h
+++ b/src/plugins/bearer/generic/qgenericengine.h
@@ -70,6 +70,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp
index fc9b469..9d1bfab 100644
--- a/src/plugins/bearer/icd/qicdengine.cpp
+++ b/src/plugins/bearer/icd/qicdengine.cpp
@@ -225,8 +225,6 @@ QIcdEngine::QIcdEngine(QObject *parent)
: QBearerEngine(parent), iapMonitor(new IapMonitor), m_dbusInterface(0),
firstUpdate(true), m_scanGoingOn(false)
{
- QMetaObject::invokeMethod(this, "doRequestUpdate", Qt::QueuedConnection);
- init();
}
QIcdEngine::~QIcdEngine()
@@ -243,8 +241,10 @@ QNetworkConfigurationManager::Capabilities QIcdEngine::capabilities() const
QNetworkConfigurationManager::NetworkSessionRequired;
}
-void QIcdEngine::init()
+void QIcdEngine::initialize()
{
+ QMutexLocker locker(&mutex);
+
// Setup DBus Interface for ICD
m_dbusInterface = new QDBusInterface(ICD_DBUS_API_INTERFACE,
ICD_DBUS_API_PATH,
@@ -272,6 +272,8 @@ void QIcdEngine::init()
QNetworkConfigurationPrivatePointer ptr(cpPriv);
userChoiceConfigurations.insert(cpPriv->id, ptr);
+
+ doRequestUpdate();
}
static inline QString network_attrs_to_security(uint network_attrs)
diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h
index 841874f..2f9f8ed 100644
--- a/src/plugins/bearer/icd/qicdengine.h
+++ b/src/plugins/bearer/icd/qicdengine.h
@@ -91,6 +91,7 @@ public:
bool hasIdentifier(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkConfigurationManager::Capabilities capabilities() const;
@@ -123,7 +124,6 @@ public:
emit configurationChanged(ptr);
}
- void init();
void cleanup();
void addConfiguration(QString &iap_id);
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
index e796df3..9b6ffa0 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
@@ -100,8 +100,6 @@ QNativeWifiEngine::QNativeWifiEngine(QObject *parent)
if (result != ERROR_SUCCESS)
qDebug("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result);
#endif
-
- scanComplete();
}
QNativeWifiEngine::~QNativeWifiEngine()
@@ -472,6 +470,11 @@ void QNativeWifiEngine::disconnectFromId(const QString &id)
}
}
+void QNativeWifiEngine::initialize()
+{
+ scanComplete();
+}
+
void QNativeWifiEngine::requestUpdate()
{
QMutexLocker locker(&mutex);
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h
index 77764e4..3b21985 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.h
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h
@@ -80,6 +80,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 13b2252..3ebc356 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -93,16 +93,16 @@ QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent)
userSettings->setConnections();
connect(userSettings, SIGNAL(newConnection(QDBusObjectPath)),
this, SLOT(newConnection(QDBusObjectPath)));
-
- QMetaObject::invokeMethod(this, "init", Qt::QueuedConnection);
}
QNetworkManagerEngine::~QNetworkManagerEngine()
{
}
-void QNetworkManagerEngine::init()
+void QNetworkManagerEngine::initialize()
{
+ QMutexLocker locker(&mutex);
+
// Get current list of access points.
foreach (const QDBusObjectPath &devicePath, interface->getDevices())
deviceAdded(devicePath);
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
index 7f8badb..8e95a2c 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
@@ -73,8 +73,6 @@ public:
QNetworkManagerEngine(QObject *parent = 0);
~QNetworkManagerEngine();
- Q_INVOKABLE void init();
-
bool networkManagerAvailable() const;
QString getInterfaceFromId(const QString &id);
@@ -85,6 +83,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index c629d02..8e9675e 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -137,7 +137,12 @@ SymbianEngine::SymbianEngine(QObject *parent)
return;
}
#endif
-
+}
+
+void SymbianEngine::initialize()
+{
+ QMutexLocker locker(&mutex);
+
SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate;
cpPriv->name = "UserChoice";
cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown;
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index dfd12bd..afb37de 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -110,6 +110,7 @@ public:
bool hasIdentifier(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkConfigurationManager::Capabilities capabilities() const;
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 0b8a2e4..03d535c 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -796,7 +796,7 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS
JSC::UString context;
// The first non-empty source URL in the call stack determines the translation context.
{
- JSC::ExecState *frame = exec->removeHostCallFrameFlag();
+ JSC::ExecState *frame = exec->callerFrame()->removeHostCallFrameFlag();
while (frame) {
if (frame->codeBlock() && frame->codeBlock()->source()
&& !frame->codeBlock()->source()->url().isEmpty()) {
@@ -3404,7 +3404,7 @@ void QScriptEngine::installTranslatorFunctions(const QScriptValue &object)
// unsigned attribs = JSC::DontEnum;
JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 5, JSC::Identifier(exec, "qsTranslate"), QScript::functionQsTranslate));
JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 2, JSC::Identifier(exec, "QT_TRANSLATE_NOOP"), QScript::functionQsTranslateNoOp));
- JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::PrototypeFunction(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec, "qsTr"), QScript::functionQsTr));
+ JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec, "qsTr"), QScript::functionQsTr));
JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "QT_TR_NOOP"), QScript::functionQsTrNoOp));
glob->stringPrototype()->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "arg"), QScript::stringProtoFuncArg));
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 0477454..5e4f097 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -35,6 +35,7 @@
#include "Error.h"
#include "PrototypeFunction.h"
+#include "NativeFunctionWrapper.h"
#include "PropertyNameArray.h"
#include "JSFunction.h"
#include "JSString.h"
@@ -1753,9 +1754,9 @@ QObjectPrototype::QObjectPrototype(JSC::ExecState* exec, WTF::PassRefPtr<JSC::St
| QScriptEngine::ExcludeSuperClassProperties
| QScriptEngine::ExcludeChildObjects));
- putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/0, exec->propertyNames().toString, qobjectProtoFuncToString), JSC::DontEnum);
- putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/1, JSC::Identifier(exec, "findChild"), qobjectProtoFuncFindChild), JSC::DontEnum);
- putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/1, JSC::Identifier(exec, "findChildren"), qobjectProtoFuncFindChildren), JSC::DontEnum);
+ putDirectFunction(exec, new (exec) JSC::NativeFunctionWrapper(exec, prototypeFunctionStructure, /*length=*/0, exec->propertyNames().toString, qobjectProtoFuncToString), JSC::DontEnum);
+ putDirectFunction(exec, new (exec) JSC::NativeFunctionWrapper(exec, prototypeFunctionStructure, /*length=*/1, JSC::Identifier(exec, "findChild"), qobjectProtoFuncFindChild), JSC::DontEnum);
+ putDirectFunction(exec, new (exec) JSC::NativeFunctionWrapper(exec, prototypeFunctionStructure, /*length=*/1, JSC::Identifier(exec, "findChildren"), qobjectProtoFuncFindChildren), JSC::DontEnum);
this->structure()->setHasGetterSetterProperties(true);
}
@@ -2015,7 +2016,7 @@ QMetaObjectPrototype::QMetaObjectPrototype(
JSC::Structure* prototypeFunctionStructure)
: QMetaObjectWrapperObject(exec, StaticQtMetaObject::get(), /*ctor=*/JSC::JSValue(), structure)
{
- putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/0, JSC::Identifier(exec, "className"), qmetaobjectProtoFuncClassName), JSC::DontEnum);
+ putDirectFunction(exec, new (exec) JSC::NativeFunctionWrapper(exec, prototypeFunctionStructure, /*length=*/0, JSC::Identifier(exec, "className"), qmetaobjectProtoFuncClassName), JSC::DontEnum);
}
static const uint qt_meta_data_QObjectConnectionManager[] = {
diff --git a/src/script/bridge/qscriptvariant.cpp b/src/script/bridge/qscriptvariant.cpp
index b2dd3b0..93459a8 100644
--- a/src/script/bridge/qscriptvariant.cpp
+++ b/src/script/bridge/qscriptvariant.cpp
@@ -29,6 +29,8 @@
#include "Error.h"
#include "PrototypeFunction.h"
+#include "JSFunction.h"
+#include "NativeFunctionWrapper.h"
#include "JSString.h"
namespace JSC
@@ -139,8 +141,8 @@ QVariantPrototype::QVariantPrototype(JSC::ExecState* exec, WTF::PassRefPtr<JSC::
{
setDelegate(new QVariantDelegate(QVariant()));
- putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, variantProtoFuncToString), JSC::DontEnum);
- putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, variantProtoFuncValueOf), JSC::DontEnum);
+ putDirectFunction(exec, new (exec) JSC::NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, variantProtoFuncToString), JSC::DontEnum);
+ putDirectFunction(exec, new (exec) JSC::NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, variantProtoFuncValueOf), JSC::DontEnum);
}
diff --git a/src/src.pro b/src/src.pro
index e8a3e98..9c4831c 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -5,12 +5,12 @@ unset(SRC_SUBDIRS)
win32:SRC_SUBDIRS += src_winmain
symbian:SRC_SUBDIRS += src_s60main
SRC_SUBDIRS += src_corelib src_xml src_network src_sql src_testlib
-win32:SRC_SUBDIRS += src_activeqt
!symbian:contains(QT_CONFIG, dbus):SRC_SUBDIRS += src_dbus
!contains(QT_CONFIG, no-gui): SRC_SUBDIRS += src_gui
!wince*:!symbian:!vxworks:contains(QT_CONFIG, qt3support): SRC_SUBDIRS += src_qt3support
!wince*:!symbian-abld:!symbian-sbsv2:include(tools/tools.pro)
+win32:SRC_SUBDIRS += src_activeqt
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2): SRC_SUBDIRS += src_opengl
contains(QT_CONFIG, openvg): SRC_SUBDIRS += src_openvg
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 038aeb4..b6e771f 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -3525,7 +3525,11 @@ void QSvgHandler::parse()
// namespaceUri is empty. The only possible strategy at
// this point is to do what everyone else seems to do and
// ignore the reported namespaceUri completely.
- startElement(xml->name().toString(), xml->attributes());
+ if (!startElement(xml->name().toString(), xml->attributes())) {
+ delete m_doc;
+ m_doc = 0;
+ return;
+ }
break;
case QXmlStreamReader::EndElement:
endElement(xml->name());
@@ -3570,6 +3574,9 @@ bool QSvgHandler::startElement(const QString &localName,
m_whitespaceMode.push(QSvgText::Default);
}
+ if (!m_doc && localName != QLatin1String("svg"))
+ return false;
+
if (FactoryMethod method = findGroupFactory(localName)) {
//group
node = method(m_doc ? m_nodes.top() : 0, attributes, this);