summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-06-28 11:10:40 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-06-28 11:10:40 (GMT)
commit8f3cbe7e844ee49b1e25544d9b90218b00efa548 (patch)
tree73e501612ef8efdbfce8afbc5d8c6abe109190d3
parent00cb03e2dfbcaca69da980dc79d5b062d4b09028 (diff)
parent5b90f7c27e7e4a95c75421fa42345b3268707794 (diff)
downloadQt-8f3cbe7e844ee49b1e25544d9b90218b00efa548.zip
Qt-8f3cbe7e844ee49b1e25544d9b90218b00efa548.tar.gz
Qt-8f3cbe7e844ee49b1e25544d9b90218b00efa548.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
-rw-r--r--config.tests/mac/corewlan/corewlantest.mm2
-rw-r--r--doc/src/scripting/ecmascript.qdoc50
-rw-r--r--examples/network/bearercloud/bearercloud.cpp2
-rw-r--r--examples/network/bearercloud/main.cpp2
-rw-r--r--examples/network/bearermonitor/bearermonitor.cpp11
-rw-r--r--examples/network/bearermonitor/bearermonitor_240_320.ui2
-rw-r--r--examples/network/bearermonitor/bearermonitor_640_480.ui2
-rw-r--r--examples/network/bearermonitor/bearermonitor_maemo.ui2
-rw-r--r--examples/network/bearermonitor/main.cpp2
-rw-r--r--examples/network/bearermonitor/sessionwidget.ui2
-rw-r--r--examples/network/bearermonitor/sessionwidget_maemo.ui2
-rw-r--r--mkspecs/features/sis_targets.prf6
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp1
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp7
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp1
-rw-r--r--qmake/generators/win32/msvc_vcxproj.cpp1
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp8
-rw-r--r--src/3rdparty/javascriptcore/VERSION4
-rw-r--r--src/3rdparty/webkit/.tag2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/ChangeLog34
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h206
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog87
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.pro9
-rw-r--r--src/3rdparty/webkit/WebCore/loader/DocLoader.cpp15
-rw-r--r--src/3rdparty/webkit/WebCore/loader/DocLoader.h5
-rw-r--r--src/3rdparty/webkit/WebCore/page/FrameView.cpp12
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderBlock.h9
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/RenderLayer.h1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog44
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro10
-rw-r--r--src/corelib/io/qiodevice.cpp4
-rw-r--r--src/corelib/thread/qsemaphore.cpp7
-rw-r--r--src/declarative/qml/qdeclarativecontext.cpp12
-rw-r--r--src/declarative/qml/qdeclarativeexpression.cpp8
-rw-r--r--src/declarative/qml/qdeclarativeglobalscriptclass.cpp39
-rw-r--r--src/declarative/qml/qdeclarativeglobalscriptclass_p.h4
-rw-r--r--src/declarative/qml/qdeclarativeinclude.cpp2
-rw-r--r--src/gui/egl/qegl_x11.cpp5
-rw-r--r--src/gui/kernel/qapplication_win.cpp23
-rw-r--r--src/gui/kernel/qkeymapper_mac.cpp15
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm7
-rw-r--r--src/gui/kernel/qwidget_mac.mm2
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/imports/folderlistmodel/folderlistmodel.pro1
-rw-r--r--src/imports/gestures/gestures.pro1
-rw-r--r--src/imports/particles/particles.pro1
-rw-r--r--src/multimedia/video/qvideoframe.cpp1
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp16
-rw-r--r--src/network/ssl/qsslsocket_p.h2
-rw-r--r--src/opengl/qgl.cpp26
-rw-r--r--src/opengl/qgl.h7
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp329
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.h8
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp361
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h12
-rw-r--r--src/plugins/codecs/cn/qgb18030codec.cpp21
-rw-r--r--src/s60installs/s60installs.pro7
-rw-r--r--src/script/api/qscriptengine.cpp59
-rw-r--r--src/script/api/qscriptengine_p.h25
-rw-r--r--src/script/bridge/bridge.pri2
-rw-r--r--src/script/bridge/qscriptdeclarativeclass.cpp36
-rw-r--r--src/script/bridge/qscriptdeclarativeclass_p.h5
-rw-r--r--src/script/bridge/qscriptstaticscopeobject.cpp157
-rw-r--r--src/script/bridge/qscriptstaticscopeobject_p.h103
-rw-r--r--src/script/script.pri1
-rw-r--r--src/script/utils/qscriptdate.cpp365
-rw-r--r--src/script/utils/qscriptdate_p.h52
-rw-r--r--src/script/utils/utils.pri5
-rw-r--r--src/src.pro4
-rw-r--r--tests/auto/qbearertestcommon.h2
-rw-r--r--tests/auto/qnetworksession/test/tst_qnetworksession.cpp123
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp242
-rw-r--r--tests/auto/qsemaphore/tst_qsemaphore.cpp49
-rw-r--r--tests/auto/qvideoframe/tst_qvideoframe.cpp128
-rw-r--r--tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp52
-rw-r--r--tests/manual/bearerex/bearerex.cpp91
-rw-r--r--tests/manual/bearerex/bearerex.h15
-rw-r--r--tests/manual/bearerex/bearerex.pro6
-rw-r--r--tests/manual/bearerex/datatransferer.cpp220
-rw-r--r--tests/manual/bearerex/datatransferer.h130
-rw-r--r--tests/manual/bearerex/main.cpp2
-rw-r--r--tests/manual/bearerex/sessiondialog.ui168
-rw-r--r--tests/manual/bearerex/xqlistwidget.cpp2
-rw-r--r--tests/manual/bearerex/xqlistwidget.h2
-rw-r--r--tools/assistant/tools/assistant/bookmarkdialog.cpp3
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanager.cpp1
-rw-r--r--tools/assistant/tools/assistant/bookmarkmodel.cpp8
-rw-r--r--tools/assistant/tools/assistant/bookmarkmodel.h1
-rw-r--r--tools/qdoc3/codechunk.h2
-rw-r--r--tools/qdoc3/cppcodeparser.cpp32
-rw-r--r--tools/qdoc3/ditaxmlgenerator.cpp136
-rw-r--r--tools/qdoc3/ditaxmlgenerator.h1
-rw-r--r--tools/qdoc3/htmlgenerator.cpp10
-rw-r--r--tools/qdoc3/node.cpp39
-rw-r--r--tools/qdoc3/node.h155
-rw-r--r--tools/qdoc3/test/qt-html-templates.qdocconf6
100 files changed, 2810 insertions, 1114 deletions
diff --git a/config.tests/mac/corewlan/corewlantest.mm b/config.tests/mac/corewlan/corewlantest.mm
index 3a29d84..ee6f661 100644
--- a/config.tests/mac/corewlan/corewlantest.mm
+++ b/config.tests/mac/corewlan/corewlantest.mm
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/doc/src/scripting/ecmascript.qdoc b/doc/src/scripting/ecmascript.qdoc
index 4497a0b..508bf3b 100644
--- a/doc/src/scripting/ecmascript.qdoc
+++ b/doc/src/scripting/ecmascript.qdoc
@@ -30,8 +30,9 @@
\title ECMAScript Reference
\brief A list of objects, functions and properties supported by QtScript.
- This reference contains a list of objects, functions and
- properties supported by QtScript.
+ This reference contains a list of built-in objects, functions and
+ properties supported by QtScript. For a detailed description, see
+ the \l{ECMA-262} specification.
\tableofcontents
@@ -43,7 +44,6 @@
\o NaN
\o Infinity
\o undefined
- \o Math
\endlist
\section2 Function Properties
@@ -80,10 +80,33 @@
\o URIError
\endlist
+ \section2 Other Properties
+
+ \list
+ \o Math
+ \o JSON
+ \endlist
+
\section1 Object Objects
+ \section2 Object Constructor
+
+ \section3 Function Properties
+
+ \list
+ \o getPrototypeOf(O)
+ \o getOwnPropertyDescriptor(O, P)
+ \o getOwnPropertyNames(O)
+ \o create(O [, Properties])
+ \o defineProperty(O, P, Attributes)
+ \o defineProperties(O, Properties)
+ \o keys(O)
+ \endlist
+
\section2 Object Prototype Object
+ \section3 Function Properties
+
\list
\o toString()
\o toLocaleString()
@@ -124,6 +147,15 @@
\o sort(comparefn)
\o splice(start, deleteCount[, item1 [, item2 [, ...]]])
\o unshift([item1 [, item2 [, ...]]])
+ \o indexOf(searchElement [, fromIndex])
+ \o lastIndexOf(searchElement [, fromIndex])
+ \o every(callbackfn [, thisArg])
+ \o some(callbackfn [, thisArg])
+ \o forEach(callbackfn [, thisArg])
+ \o map(callbackfn [, thisArg])
+ \o filter(callbackfn [, thisArg])
+ \o reduce(callbackfn [, initialValue])
+ \o reduceRight(callbackfn [, initialValue])
\endlist
\section1 String Objects
@@ -151,6 +183,7 @@
\o toLocaleLowerCase()
\o toUpperCase()
\o toLocaleUpperCase()
+ \o trim()
\endlist
\section1 Boolean Objects
@@ -264,6 +297,8 @@
\o setFullYear(year [, month [, date]])
\o setUTCFullYear(year [, month [, date]])
\o toUTCString()
+ \o toISOString()
+ \o toJSON()
\endlist
\section1 RegExp Objects
@@ -295,4 +330,13 @@
\o toString()
\endlist
+ \section1 The JSON Object
+
+ \section2 Function Properties
+
+ \list
+ \o parse(text [, reviver])
+ \o stringify(value [, replacer [, space]])
+ \endlist
+
*/
diff --git a/examples/network/bearercloud/bearercloud.cpp b/examples/network/bearercloud/bearercloud.cpp
index 9e58c73..cc73954 100644
--- a/examples/network/bearercloud/bearercloud.cpp
+++ b/examples/network/bearercloud/bearercloud.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/examples/network/bearercloud/main.cpp b/examples/network/bearercloud/main.cpp
index c0c0023..6665311 100644
--- a/examples/network/bearercloud/main.cpp
+++ b/examples/network/bearercloud/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp
index 4a04b4c..98869ea 100644
--- a/examples/network/bearermonitor/bearermonitor.cpp
+++ b/examples/network/bearermonitor/bearermonitor.cpp
@@ -80,7 +80,7 @@ BearerMonitor::BearerMonitor(QWidget *parent)
break;
}
}
-
+ connect(&manager, SIGNAL(onlineStateChanged(bool)), this ,SLOT(onlineStateChanged(bool)));
connect(&manager, SIGNAL(configurationAdded(const QNetworkConfiguration&)),
this, SLOT(configurationAdded(const QNetworkConfiguration&)));
connect(&manager, SIGNAL(configurationRemoved(const QNetworkConfiguration&)),
@@ -88,7 +88,6 @@ BearerMonitor::BearerMonitor(QWidget *parent)
connect(&manager, SIGNAL(configurationChanged(const QNetworkConfiguration&)),
this, SLOT(configurationChanged(const QNetworkConfiguration)));
connect(&manager, SIGNAL(updateCompleted()), this, SLOT(updateConfigurations()));
- connect(&manager, SIGNAL(onlineStateChanged(bool)), this ,SLOT(onlineStateChanged(bool)));
#ifdef Q_OS_WIN
connect(registerButton, SIGNAL(clicked()), this, SLOT(registerNetwork()));
@@ -111,6 +110,10 @@ BearerMonitor::BearerMonitor(QWidget *parent)
#endif
connect(scanButton, SIGNAL(clicked()),
this, SLOT(performScan()));
+
+ // Just in case update all configurations so that all
+ // configurations are up to date.
+ manager.updateConfigurations();
}
BearerMonitor::~BearerMonitor()
@@ -209,6 +212,10 @@ void BearerMonitor::updateConfigurations()
progressBar->hide();
scanButton->show();
+ // Just in case update online state, on Symbian platform
+ // WLAN scan needs to be triggered initially to have their true state.
+ onlineStateChanged(manager.isOnline());
+
QList<QTreeWidgetItem *> items = treeWidget->findItems(QLatin1String("*"), Qt::MatchWildcard);
QMap<QString, QTreeWidgetItem *> itemMap;
while (!items.isEmpty()) {
diff --git a/examples/network/bearermonitor/bearermonitor_240_320.ui b/examples/network/bearermonitor/bearermonitor_240_320.ui
index ce9c2d1..93cfc5e 100644
--- a/examples/network/bearermonitor/bearermonitor_240_320.ui
+++ b/examples/network/bearermonitor/bearermonitor_240_320.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Form</string>
+ <string>BearerMonitor</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
diff --git a/examples/network/bearermonitor/bearermonitor_640_480.ui b/examples/network/bearermonitor/bearermonitor_640_480.ui
index 941eaa0..52866bc 100644
--- a/examples/network/bearermonitor/bearermonitor_640_480.ui
+++ b/examples/network/bearermonitor/bearermonitor_640_480.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Form</string>
+ <string>BearerMonitor</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
diff --git a/examples/network/bearermonitor/bearermonitor_maemo.ui b/examples/network/bearermonitor/bearermonitor_maemo.ui
index 5f17e7d..a7940c6 100644
--- a/examples/network/bearermonitor/bearermonitor_maemo.ui
+++ b/examples/network/bearermonitor/bearermonitor_maemo.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Form</string>
+ <string>BearerMonitor</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
diff --git a/examples/network/bearermonitor/main.cpp b/examples/network/bearermonitor/main.cpp
index 0bbbb56..1a22c13 100644
--- a/examples/network/bearermonitor/main.cpp
+++ b/examples/network/bearermonitor/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/examples/network/bearermonitor/sessionwidget.ui b/examples/network/bearermonitor/sessionwidget.ui
index 56a2d0e..4199109 100644
--- a/examples/network/bearermonitor/sessionwidget.ui
+++ b/examples/network/bearermonitor/sessionwidget.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Form</string>
+ <string>Session Details</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
diff --git a/examples/network/bearermonitor/sessionwidget_maemo.ui b/examples/network/bearermonitor/sessionwidget_maemo.ui
index 86f915c..ca68246 100644
--- a/examples/network/bearermonitor/sessionwidget_maemo.ui
+++ b/examples/network/bearermonitor/sessionwidget_maemo.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Form</string>
+ <string>Session Details</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
diff --git a/mkspecs/features/sis_targets.prf b/mkspecs/features/sis_targets.prf
index 37b758b..4207e0b 100644
--- a/mkspecs/features/sis_targets.prf
+++ b/mkspecs/features/sis_targets.prf
@@ -170,6 +170,12 @@ equals(GENERATE_SIS_TARGETS, true) {
sis_target.commands =
sis_target.target = sis
QMAKE_EXTRA_TARGETS += sis_target
+
+ symbian-abld {
+ # Create dummy store_build target to avoid errors from .mk callbacks during build
+ store_build_target.target = store_build
+ QMAKE_EXTRA_TARGETS += store_build_target
+ }
}
QMAKE_DISTCLEAN += $${sis_destdir}$${TARGET}.sis
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index bf874b2..75fc910 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -385,7 +385,6 @@ VCXCLCompilerTool::VCXCLCompilerTool()
DisableLanguageExtensions(unset),
EnableFiberSafeOptimizations(unset),
EnablePREfast(unset),
- ExceptionHandling("false"),
ExpandAttributedSource(unset),
FloatingPointExceptions(unset),
ForceConformanceInForLoopScope(unset),
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index e23e119..1e060a0 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -360,11 +360,8 @@ inline XmlOutput::xml_output xformUsePrecompiledHeaderForNET2005(pchOption whatP
inline XmlOutput::xml_output xformExceptionHandlingNET2005(exceptionHandling eh, DotNET compilerVersion)
{
- if (eh == ehDefault) {
- if (compilerVersion >= NET2005)
- return attrE(_ExceptionHandling, ehNone);
- return attrS(_ExceptionHandling, "false");
- }
+ if (eh == ehDefault)
+ return noxml();
if (compilerVersion >= NET2005)
return attrE(_ExceptionHandling, eh);
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 35e4896..8686ae8 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -900,6 +900,7 @@ void VcprojGenerator::initCompilerTool()
conf.compiler.AssemblerListingLocation = placement ;
conf.compiler.ProgramDataBaseFileName = ".\\" ;
conf.compiler.ObjectFile = placement ;
+ conf.compiler.ExceptionHandling = ehNone;
// PCH
if (usePCH) {
conf.compiler.UsePrecompiledHeader = pchUseUsingSpecific;
diff --git a/qmake/generators/win32/msvc_vcxproj.cpp b/qmake/generators/win32/msvc_vcxproj.cpp
index 05c1511..f68a435 100644
--- a/qmake/generators/win32/msvc_vcxproj.cpp
+++ b/qmake/generators/win32/msvc_vcxproj.cpp
@@ -274,6 +274,7 @@ void VcxprojGenerator::initCompilerTool()
conf.compiler.AssemblerListingLocation = placement ;
conf.compiler.ProgramDataBaseFileName = ".\\" ;
conf.compiler.ObjectFileName = placement ;
+ conf.compiler.ExceptionHandling = "false";
// PCH
if (usePCH) {
conf.compiler.PrecompiledHeader = "Use";
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
index eafcc23..24873c8 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
@@ -217,9 +217,7 @@ void Heap::destroy()
NEVER_INLINE CollectorBlock* Heap::allocateBlock()
{
- // Disable the use of vm_map for the Qt build on Darwin, because when compiled on 10.4
- // it crashes on 10.5
-#if OS(DARWIN) && !PLATFORM(QT)
+#if OS(DARWIN)
vm_address_t address = 0;
vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE | VM_TAG_FOR_COLLECTOR_MEMORY, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT);
#elif OS(SYMBIAN)
@@ -315,9 +313,7 @@ NEVER_INLINE void Heap::freeBlock(size_t block)
NEVER_INLINE void Heap::freeBlockPtr(CollectorBlock* block)
{
- // Disable the use of vm_deallocate for the Qt build on Darwin, because when compiled on 10.4
- // it crashes on 10.5
-#if OS(DARWIN) && !PLATFORM(QT)
+#if OS(DARWIN)
vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(block), BLOCK_SIZE);
#elif OS(SYMBIAN)
userChunk->Free(reinterpret_cast<TAny*>(block));
diff --git a/src/3rdparty/javascriptcore/VERSION b/src/3rdparty/javascriptcore/VERSION
index daecc37..4e01d20 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-16062010 branch/tag
+ javascriptcore-snapshot-28062010 branch/tag
and has the sha1 checksum
- 8b2d3443afca194f8ac50a63151dc9d19a150582
+ f483443ccd7d21f2a57a794c4d00a63505d2f5d9
diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag
index 1eb0d78..24cf142 100644
--- a/src/3rdparty/webkit/.tag
+++ b/src/3rdparty/webkit/.tag
@@ -1 +1 @@
-45d1c9149ef8940081fa8dd35854d2b95ebaf3cd
+2f598e9b7b376d851fe089bc1dc729bcf0393a06
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
index 676ed23..8fa3a72 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
@@ -1,3 +1,37 @@
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add an inlineCapacity template parameter to ListHashSet and use it to shrink the positioned object list hash set.
+ https://bugs.webkit.org/show_bug.cgi?id=39304
+ <rdar://problem/7998366>
+
+ Add an inlineCapacity template parameter to ListHashSet.
+
+ * wtf/ListHashSet.h:
+ (WTF::::ListHashSet):
+ (WTF::::operator):
+ (WTF::::swap):
+ (WTF::::~ListHashSet):
+ (WTF::::size):
+ (WTF::::capacity):
+ (WTF::::isEmpty):
+ (WTF::::begin):
+ (WTF::::end):
+ (WTF::::find):
+ (WTF::::contains):
+ (WTF::::add):
+ (WTF::::insertBefore):
+ (WTF::::remove):
+ (WTF::::clear):
+ (WTF::::unlinkAndDelete):
+ (WTF::::appendNode):
+ (WTF::::insertNodeBefore):
+ (WTF::::deleteAllNodes):
+ (WTF::::makeIterator):
+ (WTF::::makeConstIterator):
+ (WTF::deleteAllValues):
+
2010-06-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h
index 54ed36b..09355ad 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h
@@ -37,27 +37,27 @@ namespace WTF {
// and an append that moves the element to the end even if already present,
// but unclear yet if these are needed.
- template<typename Value, typename HashFunctions> class ListHashSet;
+ template<typename Value, size_t inlineCapacity, typename HashFunctions> class ListHashSet;
template<typename T> struct IdentityExtractor;
- template<typename Value, typename HashFunctions>
- void deleteAllValues(const ListHashSet<Value, HashFunctions>&);
+ template<typename Value, size_t inlineCapacity, typename HashFunctions>
+ void deleteAllValues(const ListHashSet<Value, inlineCapacity, HashFunctions>&);
- template<typename ValueArg, typename HashArg> class ListHashSetIterator;
- template<typename ValueArg, typename HashArg> class ListHashSetConstIterator;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator;
- template<typename ValueArg> struct ListHashSetNode;
- template<typename ValueArg> struct ListHashSetNodeAllocator;
- template<typename ValueArg, typename HashArg> struct ListHashSetNodeHashFunctions;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> struct ListHashSetNodeHashFunctions;
- template<typename ValueArg, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet : public FastAllocBase {
+ template<typename ValueArg, size_t inlineCapacity = 256, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet : public FastAllocBase {
private:
- typedef ListHashSetNode<ValueArg> Node;
- typedef ListHashSetNodeAllocator<ValueArg> NodeAllocator;
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+ typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
typedef HashTraits<Node*> NodeTraits;
- typedef ListHashSetNodeHashFunctions<ValueArg, HashArg> NodeHash;
+ typedef ListHashSetNodeHashFunctions<ValueArg, inlineCapacity, HashArg> NodeHash;
typedef HashTable<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplType;
typedef HashTableIterator<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplTypeIterator;
@@ -67,10 +67,10 @@ namespace WTF {
public:
typedef ValueArg ValueType;
- typedef ListHashSetIterator<ValueType, HashArg> iterator;
- typedef ListHashSetConstIterator<ValueType, HashArg> const_iterator;
+ typedef ListHashSetIterator<ValueType, inlineCapacity, HashArg> iterator;
+ typedef ListHashSetConstIterator<ValueType, inlineCapacity, HashArg> const_iterator;
- friend class ListHashSetConstIterator<ValueType, HashArg>;
+ friend class ListHashSetConstIterator<ValueType, inlineCapacity, HashArg>;
ListHashSet();
ListHashSet(const ListHashSet&);
@@ -119,9 +119,9 @@ namespace WTF {
OwnPtr<NodeAllocator> m_allocator;
};
- template<typename ValueArg> struct ListHashSetNodeAllocator {
- typedef ListHashSetNode<ValueArg> Node;
- typedef ListHashSetNodeAllocator<ValueArg> NodeAllocator;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator {
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+ typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
ListHashSetNodeAllocator()
: m_freeList(pool())
@@ -181,15 +181,15 @@ namespace WTF {
Node* m_freeList;
bool m_isDoneWithInitialFreeList;
- static const size_t m_poolSize = 256;
+ static const size_t m_poolSize = inlineCapacity;
union {
char pool[sizeof(Node) * m_poolSize];
double forAlignment;
} m_pool;
};
- template<typename ValueArg> struct ListHashSetNode {
- typedef ListHashSetNodeAllocator<ValueArg> NodeAllocator;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode {
+ typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
ListHashSetNode(ValueArg value)
: m_value(value)
@@ -220,25 +220,25 @@ namespace WTF {
#endif
};
- template<typename ValueArg, typename HashArg> struct ListHashSetNodeHashFunctions {
- typedef ListHashSetNode<ValueArg> Node;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> struct ListHashSetNodeHashFunctions {
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
static unsigned hash(Node* const& key) { return HashArg::hash(key->m_value); }
static bool equal(Node* const& a, Node* const& b) { return HashArg::equal(a->m_value, b->m_value); }
static const bool safeToCompareToEmptyOrDeleted = false;
};
- template<typename ValueArg, typename HashArg> class ListHashSetIterator {
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator {
private:
- typedef ListHashSet<ValueArg, HashArg> ListHashSetType;
- typedef ListHashSetIterator<ValueArg, HashArg> iterator;
- typedef ListHashSetConstIterator<ValueArg, HashArg> const_iterator;
- typedef ListHashSetNode<ValueArg> Node;
+ typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
+ typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator;
+ typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator;
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
typedef ValueArg ValueType;
typedef ValueType& ReferenceType;
typedef ValueType* PointerType;
- friend class ListHashSet<ValueArg, HashArg>;
+ friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
ListHashSetIterator(const ListHashSetType* set, Node* position) : m_iterator(set, position) { }
@@ -271,18 +271,18 @@ namespace WTF {
const_iterator m_iterator;
};
- template<typename ValueArg, typename HashArg> class ListHashSetConstIterator {
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator {
private:
- typedef ListHashSet<ValueArg, HashArg> ListHashSetType;
- typedef ListHashSetIterator<ValueArg, HashArg> iterator;
- typedef ListHashSetConstIterator<ValueArg, HashArg> const_iterator;
- typedef ListHashSetNode<ValueArg> Node;
+ typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
+ typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator;
+ typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator;
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
typedef ValueArg ValueType;
typedef const ValueType& ReferenceType;
typedef const ValueType* PointerType;
- friend class ListHashSet<ValueArg, HashArg>;
- friend class ListHashSetIterator<ValueArg, HashArg>;
+ friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
+ friend class ListHashSetIterator<ValueArg, inlineCapacity, HashArg>;
ListHashSetConstIterator(const ListHashSetType* set, Node* position)
: m_set(set)
@@ -341,11 +341,11 @@ namespace WTF {
};
- template<typename ValueType, typename HashFunctions>
+ template<typename ValueType, size_t inlineCapacity, typename HashFunctions>
struct ListHashSetTranslator {
private:
- typedef ListHashSetNode<ValueType> Node;
- typedef ListHashSetNodeAllocator<ValueType> NodeAllocator;
+ typedef ListHashSetNode<ValueType, inlineCapacity> Node;
+ typedef ListHashSetNodeAllocator<ValueType, inlineCapacity> NodeAllocator;
public:
static unsigned hash(const ValueType& key) { return HashFunctions::hash(key); }
static bool equal(Node* const& a, const ValueType& b) { return HashFunctions::equal(a->m_value, b); }
@@ -355,16 +355,16 @@ namespace WTF {
}
};
- template<typename T, typename U>
- inline ListHashSet<T, U>::ListHashSet()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>::ListHashSet()
: m_head(0)
, m_tail(0)
, m_allocator(new NodeAllocator)
{
}
- template<typename T, typename U>
- inline ListHashSet<T, U>::ListHashSet(const ListHashSet& other)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>::ListHashSet(const ListHashSet& other)
: m_head(0)
, m_tail(0)
, m_allocator(new NodeAllocator)
@@ -374,16 +374,16 @@ namespace WTF {
add(*it);
}
- template<typename T, typename U>
- inline ListHashSet<T, U>& ListHashSet<T, U>::operator=(const ListHashSet& other)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>& ListHashSet<T, inlineCapacity, U>::operator=(const ListHashSet& other)
{
ListHashSet tmp(other);
swap(tmp);
return *this;
}
- template<typename T, typename U>
- inline void ListHashSet<T, U>::swap(ListHashSet& other)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::swap(ListHashSet& other)
{
m_impl.swap(other.m_impl);
std::swap(m_head, other.m_head);
@@ -391,95 +391,95 @@ namespace WTF {
m_allocator.swap(other.m_allocator);
}
- template<typename T, typename U>
- inline ListHashSet<T, U>::~ListHashSet()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>::~ListHashSet()
{
deleteAllNodes();
}
- template<typename T, typename U>
- inline int ListHashSet<T, U>::size() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline int ListHashSet<T, inlineCapacity, U>::size() const
{
return m_impl.size();
}
- template<typename T, typename U>
- inline int ListHashSet<T, U>::capacity() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline int ListHashSet<T, inlineCapacity, U>::capacity() const
{
return m_impl.capacity();
}
- template<typename T, typename U>
- inline bool ListHashSet<T, U>::isEmpty() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline bool ListHashSet<T, inlineCapacity, U>::isEmpty() const
{
return m_impl.isEmpty();
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::begin()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::begin()
{
return makeIterator(m_head);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::end()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::end()
{
return makeIterator(0);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::begin() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::begin() const
{
return makeConstIterator(m_head);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::end() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::end() const
{
return makeConstIterator(0);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::find(const ValueType& value)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::find(const ValueType& value)
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
ImplTypeIterator it = m_impl.template find<ValueType, Translator>(value);
if (it == m_impl.end())
return end();
return makeIterator(*it);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::find(const ValueType& value) const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::find(const ValueType& value) const
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
ImplTypeConstIterator it = m_impl.template find<ValueType, Translator>(value);
if (it == m_impl.end())
return end();
return makeConstIterator(*it);
}
- template<typename T, typename U>
- inline bool ListHashSet<T, U>::contains(const ValueType& value) const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline bool ListHashSet<T, inlineCapacity, U>::contains(const ValueType& value) const
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
return m_impl.template contains<ValueType, Translator>(value);
}
- template<typename T, typename U>
- pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::add(const ValueType &value)
+ template<typename T, size_t inlineCapacity, typename U>
+ pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::add(const ValueType &value)
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
pair<typename ImplType::iterator, bool> result = m_impl.template add<ValueType, NodeAllocator*, Translator>(value, m_allocator.get());
if (result.second)
appendNode(*result.first);
return std::make_pair(makeIterator(*result.first), result.second);
}
- template<typename T, typename U>
- pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::insertBefore(iterator it, const ValueType& newValue)
+ template<typename T, size_t inlineCapacity, typename U>
+ pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::insertBefore(iterator it, const ValueType& newValue)
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
pair<typename ImplType::iterator, bool> result = m_impl.template add<ValueType, NodeAllocator*, Translator>(newValue, m_allocator.get());
if (result.second)
insertNodeBefore(it.node(), *result.first);
@@ -487,14 +487,14 @@ namespace WTF {
}
- template<typename T, typename U>
- pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue)
+ template<typename T, size_t inlineCapacity, typename U>
+ pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue)
{
return insertBefore(find(beforeValue), newValue);
}
- template<typename T, typename U>
- inline void ListHashSet<T, U>::remove(iterator it)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::remove(iterator it)
{
if (it == end())
return;
@@ -502,14 +502,14 @@ namespace WTF {
unlinkAndDelete(it.node());
}
- template<typename T, typename U>
- inline void ListHashSet<T, U>::remove(const ValueType& value)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::remove(const ValueType& value)
{
remove(find(value));
}
- template<typename T, typename U>
- inline void ListHashSet<T, U>::clear()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::clear()
{
deleteAllNodes();
m_impl.clear();
@@ -517,8 +517,8 @@ namespace WTF {
m_tail = 0;
}
- template<typename T, typename U>
- void ListHashSet<T, U>::unlinkAndDelete(Node* node)
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::unlinkAndDelete(Node* node)
{
if (!node->m_prev) {
ASSERT(node == m_head);
@@ -539,8 +539,8 @@ namespace WTF {
node->destroy(m_allocator.get());
}
- template<typename T, typename U>
- void ListHashSet<T, U>::appendNode(Node* node)
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::appendNode(Node* node)
{
node->m_prev = m_tail;
node->m_next = 0;
@@ -556,8 +556,8 @@ namespace WTF {
m_tail = node;
}
- template<typename T, typename U>
- void ListHashSet<T, U>::insertNodeBefore(Node* beforeNode, Node* newNode)
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::insertNodeBefore(Node* beforeNode, Node* newNode)
{
if (!beforeNode)
return appendNode(newNode);
@@ -572,8 +572,8 @@ namespace WTF {
m_head = newNode;
}
- template<typename T, typename U>
- void ListHashSet<T, U>::deleteAllNodes()
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::deleteAllNodes()
{
if (!m_head)
return;
@@ -582,16 +582,16 @@ namespace WTF {
node->destroy(m_allocator.get());
}
- template<typename T, typename U>
- inline ListHashSetIterator<T, U> ListHashSet<T, U>::makeIterator(Node* position)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSetIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeIterator(Node* position)
{
- return ListHashSetIterator<T, U>(this, position);
+ return ListHashSetIterator<T, inlineCapacity, U>(this, position);
}
- template<typename T, typename U>
- inline ListHashSetConstIterator<T, U> ListHashSet<T, U>::makeConstIterator(Node* position) const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSetConstIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeConstIterator(Node* position) const
{
- return ListHashSetConstIterator<T, U>(this, position);
+ return ListHashSetConstIterator<T, inlineCapacity, U>(this, position);
}
template<bool, typename ValueType, typename HashTableType>
@@ -603,10 +603,10 @@ namespace WTF {
delete (*it)->m_value;
}
- template<typename T, typename U>
- inline void deleteAllValues(const ListHashSet<T, U>& collection)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void deleteAllValues(const ListHashSet<T, inlineCapacity, U>& collection)
{
- deleteAllValues<true, typename ListHashSet<T, U>::ValueType>(collection.m_impl);
+ deleteAllValues<true, typename ListHashSet<T, inlineCapacity, U>::ValueType>(collection.m_impl);
}
} // namespace WTF
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index 1a343eb..924b120 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from
and has the sha1 checksum
- 45d1c9149ef8940081fa8dd35854d2b95ebaf3cd
+ 2f598e9b7b376d851fe089bc1dc729bcf0393a06
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index fd259e0..a84f177 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,90 @@
+2010-06-24 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed Symbian build fix.
+
+ The QML WebKit integration needs to be part of QtWebKit.sis
+
+ * WebCore.pro: Deploy qmlwebkitplugin.dll.
+
+2010-06-23 Benjamin Poulain <benjamin.poulain@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Do not render the full frame when there is some elements with fixed positioning
+ https://bugs.webkit.org/show_bug.cgi?id=33150
+
+ Do not render the full frame when there is some elements with fixed positioning
+ https://bugs.webkit.org/show_bug.cgi?id=33150
+
+ The frame view take into acount the list of fixed object when scrolling
+ the view. If the number of object is lower than a certain threshold, the pixel
+ are blitted, and the invalidated area updated.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::addFixedObject):
+ (WebCore::FrameView::removeFixedObject):
+ (WebCore::FrameView::scrollContentsFastPath):
+ * page/FrameView.h:
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::scrollContents):
+ (WebCore::ScrollView::scrollContentsFastPath):
+ * platform/ScrollView.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::repaintRectIncludingDescendants):
+ * rendering/RenderLayer.h:
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::styleWillChange):
+
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Allocate the m_preloads list hash set dynamically and free it when done.
+ https://bugs.webkit.org/show_bug.cgi?id=39309
+ <rdar://problem/7998495>
+
+ This saves about 6000 bytes on a fully loaded document.
+
+ * loader/DocLoader.cpp:
+ (WebCore::DocLoader::requestPreload):
+ (WebCore::DocLoader::clearPreloads):
+ * loader/DocLoader.h:
+
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Revert unintended indentation and unnecessary nested name specifier.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::clipOutPositionedObjects):
+ (WebCore::RenderBlock::insertPositionedObject):
+
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add an inlineCapacity template parameter to ListHashSet and use it to shrink the positioned object list hash set.
+ https://bugs.webkit.org/show_bug.cgi?id=39304
+ <rdar://problem/7998366>
+
+ Set the inlineCapacity for the positionedObjects ListHashSet to 4 instead of 256. Since a RenderBlock usually has
+ few positioned objects, this saves memory.
+
+ * WebCore.base.exp:
+ * rendering/RenderBlock.cpp:
+ (WebCore::clipOutPositionedObjects):
+ (WebCore::RenderBlock::insertPositionedObject):
+ * rendering/RenderBlock.h:
+ (WebCore::RenderBlock::positionedObjects):
+
+2010-06-22 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed Qt/Symbian build fix.
+
+ Fix "make clean" to not try to execute clean commands for
+ the extra targets we use to simulate "make install".
+
+ * WebCore.pro: Use no_clean in CONFIG of extra compilers.
+
2010-06-21 Balazs Kelemen <kb@inf.u-szeged.hu>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro
index e0b4905..1162a52 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.pro
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro
@@ -25,6 +25,13 @@ symbian: {
webkitbackup.sources = ../WebKit/qt/symbian/backup_registration.xml
webkitbackup.path = /private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,)
+ contains(QT_CONFIG, declarative) {
+ declarativeImport.sources = qmlwebkitplugin$${QT_LIBINFIX}.dll
+ declarativeImport.sources += ../WebKit/qt/declarative/qmldir
+ declarativeImport.path = c:$$QT_IMPORTS_BASE_DIR/QtWebKit
+ DEPLOYMENT += declarativeImport
+ }
+
DEPLOYMENT += webkitlibs webkitbackup
# Need to guarantee that these come before system includes of /epoc32/include
@@ -2866,6 +2873,7 @@ HEADERS += $$WEBKIT_API_HEADERS
# INSTALLS is not implemented in qmake's s60 generators, copy headers manually
inst_headers.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT}
inst_headers.input = WEBKIT_INSTALL_HEADERS
+ inst_headers.CONFIG = no_clean
!isEmpty(INSTALL_HEADERS): inst_headers.output = $$INSTALL_HEADERS/QtWebKit/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
else: inst_headers.output = $$[QT_INSTALL_HEADERS]/QtWebKit/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
@@ -2875,6 +2883,7 @@ HEADERS += $$WEBKIT_API_HEADERS
inst_modfile.commands = $$inst_headers.commands
inst_modfile.input = moduleFile
inst_modfile.output = $$[QMAKE_MKSPECS]/modules
+ inst_modfile.CONFIG = no_clean
QMAKE_EXTRA_COMPILERS += inst_modfile
diff --git a/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp b/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp
index 0053e7b..4597704 100644
--- a/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp
@@ -407,10 +407,14 @@ void DocLoader::requestPreload(CachedResource::Type type, const String& url, con
encoding = charset.isEmpty() ? m_doc->frame()->loader()->encoding() : charset;
CachedResource* resource = requestResource(type, url, encoding, true);
- if (!resource || m_preloads.contains(resource))
+ if (!resource || (m_preloads && m_preloads->contains(resource)))
return;
resource->increasePreloadCount();
- m_preloads.add(resource);
+
+ if (!m_preloads)
+ m_preloads.set(new ListHashSet<CachedResource*>);
+ m_preloads->add(resource);
+
#if PRELOAD_DEBUG
printf("PRELOADING %s\n", resource->url().latin1().data());
#endif
@@ -421,8 +425,11 @@ void DocLoader::clearPreloads()
#if PRELOAD_DEBUG
printPreloadStats();
#endif
- ListHashSet<CachedResource*>::iterator end = m_preloads.end();
- for (ListHashSet<CachedResource*>::iterator it = m_preloads.begin(); it != end; ++it) {
+ if (!m_preloads)
+ return;
+
+ ListHashSet<CachedResource*>::iterator end = m_preloads->end();
+ for (ListHashSet<CachedResource*>::iterator it = m_preloads->begin(); it != end; ++it) {
CachedResource* res = *it;
res->decreasePreloadCount();
if (res->canDelete() && !res->inCache())
diff --git a/src/3rdparty/webkit/WebCore/loader/DocLoader.h b/src/3rdparty/webkit/WebCore/loader/DocLoader.h
index 8ec73e1..66e4164 100644
--- a/src/3rdparty/webkit/WebCore/loader/DocLoader.h
+++ b/src/3rdparty/webkit/WebCore/loader/DocLoader.h
@@ -47,8 +47,7 @@ class ImageLoader;
class KURL;
// The DocLoader manages the loading of scripts/images/stylesheets for a single document.
-class DocLoader : public Noncopyable
-{
+class DocLoader : public Noncopyable {
friend class Cache;
friend class ImageLoader;
@@ -117,7 +116,7 @@ private:
int m_requestCount;
- ListHashSet<CachedResource*> m_preloads;
+ OwnPtr<ListHashSet<CachedResource*> > m_preloads;
struct PendingPreload {
CachedResource::Type m_type;
String m_url;
diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.cpp b/src/3rdparty/webkit/WebCore/page/FrameView.cpp
index a53db36..639414b 100644
--- a/src/3rdparty/webkit/WebCore/page/FrameView.cpp
+++ b/src/3rdparty/webkit/WebCore/page/FrameView.cpp
@@ -884,7 +884,7 @@ bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect
{
const size_t fixedObjectThreshold = 5;
- ListHashSet<RenderBox*>* positionedObjects = 0;
+ RenderBlock::PositionedObjectsListHashSet* positionedObjects = 0;
if (RenderView* root = m_frame->contentRenderer())
positionedObjects = root->positionedObjects();
@@ -896,14 +896,14 @@ bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect
// Get the rects of the fixed objects visible in the rectToScroll
Vector<IntRect, fixedObjectThreshold> subRectToUpdate;
bool updateInvalidatedSubRect = true;
- ListHashSet<RenderBox*>::const_iterator end = positionedObjects->end();
- for (ListHashSet<RenderBox*>::const_iterator it = positionedObjects->begin(); it != end; ++it) {
+ RenderBlock::PositionedObjectsListHashSet::const_iterator end = positionedObjects->end();
+ for (RenderBlock::PositionedObjectsListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) {
RenderBox* renderBox = *it;
if (renderBox->style()->position() != FixedPosition)
continue;
- IntRect topLevelRect;
- IntRect updateRect = renderBox->paintingRootRect(topLevelRect);
- updateRect.move(-scrollX(), -scrollY());
+ IntRect updateRect = renderBox->layer()->repaintRectIncludingDescendants();
+ updateRect = contentsToWindow(updateRect);
+
updateRect.intersect(rectToScroll);
if (!updateRect.isEmpty()) {
if (subRectToUpdate.size() >= fixedObjectThreshold) {
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp
index a7b8a02..798663e 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp
@@ -1982,13 +1982,13 @@ void RenderBlock::paintSelection(PaintInfo& paintInfo, int tx, int ty)
}
#ifndef BUILDING_ON_TIGER
-static void clipOutPositionedObjects(const RenderObject::PaintInfo* paintInfo, int tx, int ty, ListHashSet<RenderBox*>* positionedObjects)
+static void clipOutPositionedObjects(const RenderObject::PaintInfo* paintInfo, int tx, int ty, RenderBlock::PositionedObjectsListHashSet* positionedObjects)
{
if (!positionedObjects)
return;
- ListHashSet<RenderBox*>::const_iterator end = positionedObjects->end();
- for (ListHashSet<RenderBox*>::const_iterator it = positionedObjects->begin(); it != end; ++it) {
+ RenderBlock::PositionedObjectsListHashSet::const_iterator end = positionedObjects->end();
+ for (RenderBlock::PositionedObjectsListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) {
RenderBox* r = *it;
paintInfo->context->clipOut(IntRect(tx + r->x(), ty + r->y(), r->width(), r->height()));
}
@@ -2274,7 +2274,7 @@ void RenderBlock::insertPositionedObject(RenderBox* o)
{
// Create the list of special objects if we don't aleady have one
if (!m_positionedObjects)
- m_positionedObjects = new ListHashSet<RenderBox*>;
+ m_positionedObjects = new PositionedObjectsListHashSet;
m_positionedObjects->add(o);
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h
index 184f983..d555d31 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h
@@ -74,7 +74,9 @@ public:
void insertPositionedObject(RenderBox*);
void removePositionedObject(RenderBox*);
void removePositionedObjects(RenderBlock*);
- ListHashSet<RenderBox*>* positionedObjects() const { return m_positionedObjects; }
+
+ typedef ListHashSet<RenderBox*, 4> PositionedObjectsListHashSet;
+ PositionedObjectsListHashSet* positionedObjects() const { return m_positionedObjects; }
void addPercentHeightDescendant(RenderBox*);
static void removePercentHeightDescendant(RenderBox*);
@@ -483,9 +485,10 @@ private:
void setCollapsedBottomMargin(const MarginInfo&);
// End helper functions and structs used by layoutBlockChildren.
- typedef ListHashSet<RenderBox*>::const_iterator Iterator;
+ typedef PositionedObjectsListHashSet::const_iterator Iterator;
DeprecatedPtrList<FloatingObject>* m_floatingObjects;
- ListHashSet<RenderBox*>* m_positionedObjects;
+
+ PositionedObjectsListHashSet* m_positionedObjects;
// An inline can be split with blocks occurring in between the inline content.
// When this occurs we need a pointer to our next object. We can basically be
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp
index 3314772..a012868 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp
@@ -325,6 +325,14 @@ void RenderLayer::updateLayerPositions(UpdateLayerPositionsFlags flags)
m_marquee->updateMarqueePosition();
}
+IntRect RenderLayer::repaintRectIncludingDescendants() const
+{
+ IntRect repaintRect = m_repaintRect;
+ for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
+ repaintRect.unite(child->repaintRectIncludingDescendants());
+ return repaintRect;
+}
+
void RenderLayer::computeRepaintRects()
{
RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint();
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h
index 81a66e1..e221f28 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h
@@ -394,6 +394,7 @@ public:
// Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint.
IntRect repaintRect() const { return m_repaintRect; }
+ IntRect repaintRectIncludingDescendants() const;
void computeRepaintRects();
void updateRepaintRectsAfterScroll(bool fixed = false);
void setNeedsFullRepaint(bool f = true) { m_needsFullRepaint = f; }
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index 0e73680..69a431f 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,47 @@
+2010-06-24 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed Symbian build fix.
+
+ The QML WebKit integration needs to be part of QtWebKit.sis
+
+ * declarative/declarative.pro: Removed non-working deployment.
+
+2010-06-23 David Boddie <dboddie@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Doc: Fixed documentation errors.
+
+ * docs/qtwebkit-bridge.qdoc:
+
+2010-06-23 Alessandro Portale <alessandro.portale@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Provide the Webkit Qml plugin with a UID3 on Symbian
+
+ ...otherwise we cannot Symbian sign it.
+
+ * declarative/declarative.pro:
+
+2010-06-23 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed Qt package build fix.
+
+ When building without build-webkit, set OUTPUT_DIR if necessary, like
+ in the other .pro files.
+
+ * declarative/declarative.pro:
+
+2010-06-22 Tasuku Suzuki <tasuku.suzuki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix compilation with QT_NO_COMBOBOX.
+
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::createSelectPopup):
+
2010-06-11 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by nobody, build fix.
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index 7d1c794..e253161 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -576,7 +576,7 @@ QtAbstractWebPopup* ChromeClientQt::createSelectPopup()
#elif !defined(QT_NO_COMBOBOX)
return new QtFallbackWebPopup;
#else
- return result;
+ return 0;
#endif
}
diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro b/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro
index 122d90a..75268f3 100644
--- a/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro
+++ b/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro
@@ -6,6 +6,8 @@ CONFIG += qt plugin
win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
+isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../..
+
QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir
copy2build.input = QMLDIRFILE
CONFIG(QTDIR_build) {
@@ -64,13 +66,7 @@ qmldir.files += $$PWD/qmldir
qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
symbian:{
- load(data_caging_paths)
- include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
-
- importFiles.sources = qmlwebkitplugin.dll qmldir
- importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
-
- DEPLOYMENT = importFiles
+ TARGET.UID3 = 0x20021321
}
INSTALLS += target qmldir
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index ea60792..26e587d 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1452,7 +1452,7 @@ qint64 QIODevicePrivate::peek(char *data, qint64 maxSize)
return readBytes;
buffer.ungetBlock(data, readBytes);
- pos -= readBytes;
+ *pPos -= readBytes;
return readBytes;
}
@@ -1467,7 +1467,7 @@ QByteArray QIODevicePrivate::peek(qint64 maxSize)
return result;
buffer.ungetBlock(result.constData(), result.size());
- pos -= result.size();
+ *pPos -= result.size();
return result;
}
diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp
index 9dc828d..8e8a88a 100644
--- a/src/corelib/thread/qsemaphore.cpp
+++ b/src/corelib/thread/qsemaphore.cpp
@@ -44,6 +44,8 @@
#ifndef QT_NO_THREAD
#include "qmutex.h"
#include "qwaitcondition.h"
+#include "qelapsedtimer.h"
+#include "qdatetime.h"
QT_BEGIN_NAMESPACE
@@ -218,8 +220,11 @@ bool QSemaphore::tryAcquire(int n, int timeout)
while (n > d->avail)
d->cond.wait(locker.mutex());
} else {
+ QElapsedTimer timer;
+ timer.start();
while (n > d->avail) {
- if (!d->cond.wait(locker.mutex(), timeout))
+ if (timer.hasExpired(timeout)
+ || !d->cond.wait(locker.mutex(), timeout - timer.elapsed()))
return false;
}
}
diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp
index 2221d78..60e9dd3 100644
--- a/src/declarative/qml/qdeclarativecontext.cpp
+++ b/src/declarative/qml/qdeclarativecontext.cpp
@@ -660,10 +660,9 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
scriptContext->pushScope(enginePriv->contextClass->newUrlContext(url));
- scriptContext->pushScope(enginePriv->globalClass->globalObject());
+ scriptContext->pushScope(enginePriv->globalClass->staticGlobalObject());
- QScriptValue scope = scriptEngine->newObject();
- scriptContext->setActivationObject(scope);
+ QScriptValue scope = QScriptDeclarativeClass::newStaticScopeObject(scriptEngine);
scriptContext->pushScope(scope);
scriptEngine->evaluate(code, url, 1);
@@ -686,10 +685,9 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
scriptContext->pushScope(enginePriv->contextClass->newUrlContext(this, 0, url));
- scriptContext->pushScope(enginePriv->globalClass->globalObject());
-
- QScriptValue scope = scriptEngine->newObject();
- scriptContext->setActivationObject(scope);
+ scriptContext->pushScope(enginePriv->globalClass->staticGlobalObject());
+
+ QScriptValue scope = QScriptDeclarativeClass::newStaticScopeObject(scriptEngine);
scriptContext->pushScope(scope);
scriptEngine->evaluate(code, url, 1);
diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp
index b1aecfa..8ae5f2f 100644
--- a/src/declarative/qml/qdeclarativeexpression.cpp
+++ b/src/declarative/qml/qdeclarativeexpression.cpp
@@ -145,7 +145,7 @@ void QDeclarativeExpressionPrivate::init(QDeclarativeContextData *ctxt, void *ex
if (!dd->cachedClosures.at(progIdx)) {
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
scriptContext->pushScope(ep->contextClass->newSharedContext());
- scriptContext->pushScope(ep->globalClass->globalObject());
+ scriptContext->pushScope(ep->globalClass->staticGlobalObject());
dd->cachedClosures[progIdx] = new QScriptValue(scriptEngine->evaluate(data->expression, data->url, data->line));
scriptEngine->popContext();
}
@@ -188,7 +188,7 @@ QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContex
} else {
scriptContext->pushScope(ep->contextClass->newContext(context, object));
}
- scriptContext->pushScope(ep->globalClass->globalObject());
+ scriptContext->pushScope(ep->globalClass->staticGlobalObject());
QScriptValue rv = ep->scriptEngine.evaluate(program, fileName, lineNumber);
ep->scriptEngine.popContext();
return rv;
@@ -206,7 +206,7 @@ QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContex
} else {
scriptContext->pushScope(ep->contextClass->newContext(context, object));
}
- scriptContext->pushScope(ep->globalClass->globalObject());
+ scriptContext->pushScope(ep->globalClass->staticGlobalObject());
QScriptValue rv = ep->scriptEngine.evaluate(program);
ep->scriptEngine.popContext();
return rv;
@@ -369,7 +369,7 @@ QScriptValue QDeclarativeExpressionPrivate::eval(QObject *secondaryScope, bool *
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
data->expressionContext = ep->contextClass->newContext(data->context(), data->me);
scriptContext->pushScope(data->expressionContext);
- scriptContext->pushScope(ep->globalClass->globalObject());
+ scriptContext->pushScope(ep->globalClass->staticGlobalObject());
if (data->expressionRewritten) {
data->expressionFunction = scriptEngine->evaluate(data->expression,
diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
index 6e107fb..39ea101 100644
--- a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
@@ -41,10 +41,13 @@
#include "private/qdeclarativeglobalscriptclass_p.h"
+#include <QtCore/qvector.h>
#include <QtScript/qscriptstring.h>
#include <QtScript/qscriptengine.h>
#include <QtScript/qscriptvalueiterator.h>
+#include <private/qscriptdeclarativeclass_p.h>
+
QT_BEGIN_NAMESPACE
/*
@@ -55,23 +58,31 @@ QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engi
{
QString eval = QLatin1String("eval");
- QScriptValue globalObject = engine->globalObject();
+ QScriptValue originalGlobalObject = engine->globalObject();
- m_globalObject = engine->newObject();
QScriptValue newGlobalObject = engine->newObject();
- QScriptValueIterator iter(globalObject);
-
- while (iter.hasNext()) {
- iter.next();
-
- QString name = iter.name();
-
- if (name != eval)
- m_globalObject.setProperty(iter.scriptName(), iter.value());
- newGlobalObject.setProperty(iter.scriptName(), iter.value());
-
- m_illegalNames.insert(name);
+ {
+ QScriptValueIterator iter(originalGlobalObject);
+ QVector<QString> names;
+ QVector<QScriptValue> values;
+ QVector<QScriptValue::PropertyFlags> flags;
+ while (iter.hasNext()) {
+ iter.next();
+
+ QString name = iter.name();
+
+ if (name != eval) {
+ names.append(name);
+ values.append(iter.value());
+ flags.append(iter.flags() | QScriptValue::Undeletable);
+ }
+ newGlobalObject.setProperty(iter.scriptName(), iter.value());
+
+ m_illegalNames.insert(name);
+ }
+ m_staticGlobalObject = QScriptDeclarativeClass::newStaticScopeObject(
+ engine, names.size(), names.constData(), values.constData(), flags.constData());
}
newGlobalObject.setScriptClass(this);
diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
index 7690edd..414bf02 100644
--- a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
@@ -75,13 +75,13 @@ public:
void explicitSetProperty(const QString &, const QScriptValue &);
- const QScriptValue &globalObject() const { return m_globalObject; }
+ const QScriptValue &staticGlobalObject() const { return m_staticGlobalObject; }
const QSet<QString> &illegalNames() const { return m_illegalNames; }
private:
QSet<QString> m_illegalNames;
- QScriptValue m_globalObject;
+ QScriptValue m_staticGlobalObject;
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp
index c29005a..f26b54f 100644
--- a/src/declarative/qml/qdeclarativeinclude.cpp
+++ b/src/declarative/qml/qdeclarativeinclude.cpp
@@ -240,7 +240,7 @@ QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *e
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(engine);
scriptContext->pushScope(ep->contextClass->newUrlContext(context, 0, urlString));
- scriptContext->pushScope(ep->globalClass->globalObject());
+ scriptContext->pushScope(ep->globalClass->staticGlobalObject());
QScriptValue scope = QScriptDeclarativeClass::scopeChainValue(ctxt, -5);
scriptContext->pushScope(scope);
scriptContext->setActivationObject(scope);
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 969acc4..fea6e8d 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -415,7 +415,10 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg
// At this point, the widget's window should be created and have the correct visual. Now we
// just need to create the EGL surface for it:
- return eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), 0);
+ EGLSurface surf = eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), 0);
+ if (surf == EGL_NO_SURFACE)
+ qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
+ return surf;
}
if (x11PixmapData) {
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 2a85fdc..ef719ca 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -3065,6 +3065,11 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
break;
}
}
+#ifndef Q_OS_WINCE
+ static bool trackMouseEventLookup = false;
+ typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT);
+ static PtrTrackMouseEvent ptrTrackMouseEvent = 0;
+#endif
state = translateButtonState(msg.wParam, type, button); // button state
const QPoint widgetPos = mapFromGlobal(QPoint(msg.pt.x, msg.pt.y));
QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos);
@@ -3129,9 +3134,6 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
#ifndef Q_OS_WINCE
if (curWin != 0) {
- static bool trackMouseEventLookup = false;
- typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT);
- static PtrTrackMouseEvent ptrTrackMouseEvent = 0;
if (!trackMouseEventLookup) {
trackMouseEventLookup = true;
ptrTrackMouseEvent = (PtrTrackMouseEvent)QLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent");
@@ -3245,6 +3247,21 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
qt_button_down = 0;
}
+#ifndef Q_OS_WINCE
+ if (type == QEvent::MouseButtonPress
+ && QApplication::activePopupWidget() != activePopupWidget
+ && ptrTrackMouseEvent
+ && curWin) {
+ // Since curWin is already the window we clicked on,
+ // we have to setup the mouse tracking here.
+ TRACKMOUSEEVENT tme;
+ tme.cbSize = sizeof(TRACKMOUSEEVENT);
+ tme.dwFlags = 0x00000002; // TME_LEAVE
+ tme.hwndTrack = curWin; // Track on window receiving msgs
+ tme.dwHoverTime = (DWORD)-1; // HOVER_DEFAULT
+ ptrTrackMouseEvent(&tme);
+ }
+#endif
if (type == QEvent::MouseButtonPress
&& QApplication::activePopupWidget() != activePopupWidget
&& replayPopupMouseEvent) {
diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp
index 873b8f9..3dc6afc 100644
--- a/src/gui/kernel/qkeymapper_mac.cpp
+++ b/src/gui/kernel/qkeymapper_mac.cpp
@@ -866,14 +866,27 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e
UInt32 macModifiers = 0;
GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, 0,
sizeof(macModifiers), 0, &macModifiers);
+#ifdef QT_MAC_USE_COCOA
+ // The unicode characters in the range 0xF700-0xF747 are reserved
+ // by Mac OS X for transient use as keyboard function keys. We
+ // wont send 'text' for such key events. This is done to match
+ // behavior on other platforms.
+ unsigned int *unicodeKey = (unsigned int*)info;
+ if (*unicodeKey >= 0xf700 && *unicodeKey <= 0xf747)
+ text = QString();
+ bool isAccepted;
+#endif
handled_event = QKeyMapper::sendKeyEvent(widget, grab,
(ekind == kEventRawKeyUp) ? QEvent::KeyRelease : QEvent::KeyPress,
qtKey, modifiers, text, ekind == kEventRawKeyRepeat, 0,
macScanCode, macVirtualKey, macModifiers
#ifdef QT_MAC_USE_COCOA
- ,static_cast<bool *>(info)
+ ,&isAccepted
#endif
);
+#ifdef QT_MAC_USE_COCOA
+ *unicodeKey = (unsigned int)isAccepted;
+#endif
}
return handled_event;
}
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 8cef03c..3fc27f4 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -682,10 +682,12 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve
NSEvent *event = static_cast<NSEvent *>(keyEvent);
EventRef key_event = static_cast<EventRef>(const_cast<void *>([event eventRef]));
Q_ASSERT(key_event);
+ unsigned int info = 0;
if ([event type] == NSKeyDown) {
NSString *characters = [event characters];
unichar value = [characters characterAtIndex:0];
qt_keymapper_private()->updateKeyMap(0, key_event, (void *)&value);
+ info = value;
}
// Redirect keys to alien widgets.
@@ -701,9 +703,8 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve
if (mustUseCocoaKeyEvent())
return qt_dispatchKeyEventWithCocoa(keyEvent, widgetToGetEvent);
- bool isAccepted;
- bool consumed = qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &isAccepted, true);
- return consumed && isAccepted;
+ bool consumed = qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &info, true);
+ return consumed && (info != 0);
#endif
}
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 280712a..a9bb691 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -2804,7 +2804,7 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
QList<QWidget *> widgets = q->findChildren<QWidget *>();
for (int i=0; i<widgets.size(); ++i) {
QWidget *child = widgets.at(i);
- if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created)) {
+ if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) {
if (set)
[qt_mac_window_for(q) addChildWindow:qt_mac_window_for(child) ordered:NSWindowAbove];
else
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 139139f..e6c36a4 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -413,7 +413,7 @@ struct QtFontFamily
bool fixedPitchComputed : 1;
#endif
#ifdef Q_WS_X11
- bool symbol_checked;
+ bool symbol_checked : 1;
#endif
QString name;
diff --git a/src/imports/folderlistmodel/folderlistmodel.pro b/src/imports/folderlistmodel/folderlistmodel.pro
index dced319..49a6baa 100644
--- a/src/imports/folderlistmodel/folderlistmodel.pro
+++ b/src/imports/folderlistmodel/folderlistmodel.pro
@@ -14,6 +14,7 @@ qmldir.files += $$PWD/qmldir
qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
symbian:{
+ TARGET.UID3 = 0x20021320
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
importFiles.sources = qmlfolderlistmodelplugin.dll qmldir
diff --git a/src/imports/gestures/gestures.pro b/src/imports/gestures/gestures.pro
index d6dc758..265bbca 100644
--- a/src/imports/gestures/gestures.pro
+++ b/src/imports/gestures/gestures.pro
@@ -14,6 +14,7 @@ qmldir.files += $$PWD/qmldir
qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
symbian:{
+ TARGET.UID3 = 0x2002131F
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
importFiles.sources = qmlgesturesplugin.dll qmldir
diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro
index 95ec633..91c1b9f 100644
--- a/src/imports/particles/particles.pro
+++ b/src/imports/particles/particles.pro
@@ -18,6 +18,7 @@ qmldir.files += $$PWD/qmldir
qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
symbian:{
+ TARGET.UID3 = 0x2002131E
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
importFiles.sources = qmlparticlesplugin.dll qmldir
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index 2d66d9e..cd38f5e 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -665,6 +665,7 @@ QVideoFrame::PixelFormat QVideoFrame::pixelFormatFromImageFormat(QImage::Format
case QImage::Format_RGB16:
return Format_RGB565;
case QImage::Format_ARGB8565_Premultiplied:
+ return Format_ARGB8565_Premultiplied;
case QImage::Format_RGB666:
case QImage::Format_ARGB6666_Premultiplied:
return Format_Invalid;
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 36a0cc7..9bd93a2 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -574,17 +574,17 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
}
}
#elif defined(Q_OS_AIX)
- systemCerts.append(QSslCertificate::fromPath("/var/ssl/certs/*.pem", QSsl::Pem, QRegExp::Wildcard));
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/var/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard));
#elif defined(Q_OS_SOLARIS)
- systemCerts.append(QSslCertificate::fromPath("/usr/local/ssl/certs/*.pem", QSsl::Pem, QRegExp::Wildcard));
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard));
#elif defined(Q_OS_HPUX)
- systemCerts.append(QSslCertificate::fromPath("/opt/openssl/certs/*.pem", QSsl::Pem, QRegExp::Wildcard));
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/opt/openssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard));
#elif defined(Q_OS_LINUX)
- systemCerts.append(QSslCertificate::fromPath("/etc/ssl/certs/*.pem", QSsl::Pem, QRegExp::Wildcard)); // (K)ubuntu, OpenSUSE, Mandriva, ...
- systemCerts.append(QSslCertificate::fromPath("/etc/pki/tls/certs/ca-bundle.crt", QSsl::Pem)); // Fedora
- systemCerts.append(QSslCertificate::fromPath("/usr/lib/ssl/certs/*.pem", QSsl::Pem, QRegExp::Wildcard)); // Gentoo, Mandrake
- systemCerts.append(QSslCertificate::fromPath("/usr/share/ssl/*.pem", QSsl::Pem, QRegExp::Wildcard)); // Centos, Redhat, SuSE
- systemCerts.append(QSslCertificate::fromPath("/usr/local/ssl/*.pem", QSsl::Pem, QRegExp::Wildcard)); // Normal OpenSSL Tarball
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // (K)ubuntu, OpenSUSE, Mandriva, ...
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/pki/tls/certs/ca-bundle.crt"), QSsl::Pem)); // Fedora
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/lib/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // Gentoo, Mandrake
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/share/ssl/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // Centos, Redhat, SuSE
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/ssl/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // Normal OpenSSL Tarball
#endif
return systemCerts;
}
diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h
index 42ae98f..d3c3858 100644
--- a/src/network/ssl/qsslsocket_p.h
+++ b/src/network/ssl/qsslsocket_p.h
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
typedef OSStatus (*PtrSecTrustSettingsCopyCertificates)(int, CFArrayRef*);
typedef OSStatus (*PtrSecTrustCopyAnchorCertificates)(CFArrayRef*);
#elif defined(Q_OS_WIN)
-#include <Wincrypt.h>
+#include <wincrypt.h>
#ifndef HCRYPTPROV_LEGACY
#define HCRYPTPROV_LEGACY HCRYPTPROV
#endif
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index b4c85ac..9effb34 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1521,6 +1521,32 @@ bool operator==(const QGLFormat& a, const QGLFormat& b)
&& a.d->profile == b.d->profile);
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QGLFormat &f)
+{
+ const QGLFormatPrivate * const d = f.d;
+
+ dbg.nospace() << "QGLFormat("
+ << "options " << d->opts
+ << ", plane " << d->pln
+ << ", depthBufferSize " << d->depthSize
+ << ", accumBufferSize " << d->accumSize
+ << ", stencilBufferSize " << d->stencilSize
+ << ", redBufferSize " << d->redSize
+ << ", greenBufferSize " << d->greenSize
+ << ", blueBufferSize " << d->blueSize
+ << ", alphaBufferSize " << d->alphaSize
+ << ", samples " << d->numSamples
+ << ", swapInterval " << d->swapInterval
+ << ", majorVersion " << d->majorVersion
+ << ", minorVersion " << d->minorVersion
+ << ", profile " << d->profile
+ << ')';
+
+ return dbg.space();
+}
+#endif
+
/*!
Returns false if all the options of the two QGLFormat objects
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index f0b36f7..f85cad5 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -281,6 +281,9 @@ private:
friend Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&);
friend Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&);
+#ifndef QT_NO_DEBUG_STREAM
+ friend Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QGLFormat &);
+#endif
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFormat::OpenGLVersionFlags)
@@ -288,6 +291,10 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFormat::OpenGLVersionFlags)
Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&);
Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&);
+#ifndef QT_NO_DEBUG_STREAM
+Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QGLFormat &);
+#endif
+
class Q_OPENGL_EXPORT QGLContext
{
Q_DECLARE_PRIVATE(QGLContext)
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index e08d135..b6e11df 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -53,16 +53,30 @@
QT_BEGIN_NAMESPACE
QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine)
- : CActive(CActive::EPriorityUserInput), engine(engine),
- ipConnectionNotifier(0), iHandleStateNotificationsFromManager(false),
- iFirstSync(true), iStoppedByUser(false), iClosedByUser(false), iDeprecatedConnectionId(0),
- iError(QNetworkSession::UnknownSessionError), iALREnabled(0), iConnectInBackground(false)
+: CActive(CActive::EPriorityUserInput), engine(engine),
+ iDynamicUnSetdefaultif(0), ipConnectionNotifier(0),
+ iHandleStateNotificationsFromManager(false), iFirstSync(true), iStoppedByUser(false),
+ iClosedByUser(false), iError(QNetworkSession::UnknownSessionError), iALREnabled(0),
+ iConnectInBackground(false), isOpening(false)
{
CActiveScheduler::Add(this);
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
iMobility = NULL;
#endif
+ // Try to load "Open C" dll dynamically and
+ // try to attach to unsetdefaultif function dynamically.
+ // This is to avoid build breaks with old OpenC versions.
+ if (iOpenCLibrary.Load(_L("libc")) == KErrNone) {
+ iDynamicUnSetdefaultif = (TOpenCUnSetdefaultifFunction)iOpenCLibrary.Lookup(597);
+ }
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - ";
+ if (iDynamicUnSetdefaultif)
+ qDebug() << "dynamic unsetdefaultif() is present in PIPS library. ";
+ else
+ qDebug() << "dynamic unsetdefaultif() not present in PIPS library. ";
+#endif
TRAP_IGNORE(iConnectionMonitor.ConnectL());
}
@@ -70,6 +84,7 @@ QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine)
QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
{
isOpen = false;
+ isOpening = false;
// Cancel Connection Progress Notifications first.
// Note: ConnectionNotifier must be destroyed before Canceling RConnection::Start()
@@ -77,9 +92,6 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
delete ipConnectionNotifier;
ipConnectionNotifier = NULL;
- // Cancel possible RConnection::Start()
- Cancel();
-
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (iMobility) {
delete iMobility;
@@ -87,13 +99,19 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
}
#endif
- iConnection.Close();
+ // Cancel possible RConnection::Start()
+ Cancel();
iSocketServ.Close();
// Close global 'Open C' RConnection
+ // Clears also possible unsetdefaultif() flags.
setdefaultif(0);
iConnectionMonitor.Close();
+ iOpenCLibrary.Close();
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - destroyed (and setdefaultif(0))";
+#endif
}
void QNetworkSessionPrivateImpl::configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState)
@@ -101,18 +119,12 @@ void QNetworkSessionPrivateImpl::configurationStateChanged(TUint32 accessPointId
if (iHandleStateNotificationsFromManager) {
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
qDebug() << "QNS this : " << QString::number((uint)this) << " - "
- << "configurationStateChanged from manager for IAP : " << QString::number(accessPointId)
- << "configurationStateChanged connMon ID : " << QString::number(connMonId)
- << " : to a state: " << newState
- << " whereas my current state is: " << state;
-#endif
- if (connMonId == iDeprecatedConnectionId) {
-#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
- qDebug() << "QNS this : " << QString::number((uint)this) << " - "
- << "however status update from manager ignored because it related to already closed connection.";
+ << "configurationStateChanged from manager for IAP : " << QString::number(accessPointId)
+ << "connMon ID : " << QString::number(connMonId) << " : to a state: " << newState
+ << "whereas my current state is: " << state;
+#else
+ Q_UNUSED(connMonId);
#endif
- return;
- }
this->newState(newState, accessPointId);
}
}
@@ -236,6 +248,14 @@ QNetworkInterface QNetworkSessionPrivateImpl::interface(TUint iapId) const
#ifndef QT_NO_NETWORKINTERFACE
QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const
{
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "currentInterface() requested, state: " << state
+ << "publicConfig validity: " << publicConfig.isValid();
+ if (activeInterface.isValid())
+ qDebug() << "interface is: " << activeInterface.humanReadableName();
+#endif
+
if (!publicConfig.isValid() || state != QNetworkSession::Connected) {
return QNetworkInterface();
}
@@ -292,12 +312,14 @@ void QNetworkSessionPrivateImpl::open()
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
qDebug() << "QNS this : " << QString::number((uint)this) << " - "
<< "open() called, session state is: " << state << " and isOpen is: "
- << isOpen;
+ << isOpen << isOpening;
#endif
- if (isOpen || (state == QNetworkSession::Connecting)) {
+
+ if (isOpen || isOpening)
return;
- }
-
+
+ isOpening = true;
+
// Stop handling IAP state change signals from QNetworkConfigurationManagerPrivate
// => RConnection::ProgressNotification will be used for IAP/SNAP monitoring
iHandleStateNotificationsFromManager = false;
@@ -325,7 +347,6 @@ void QNetworkSessionPrivateImpl::open()
// Clear possible previous states
iStoppedByUser = false;
iClosedByUser = false;
- iDeprecatedConnectionId = 0;
TInt error = iSocketServ.Connect();
if (error != KErrNone) {
@@ -358,44 +379,6 @@ void QNetworkSessionPrivateImpl::open()
}
if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
- // Search through existing connections.
- // If there is already connection which matches to given IAP
- // try to attach to existing connection.
- TBool connected(EFalse);
- TConnectionInfoBuf connInfo;
- TUint count;
- if (iConnection.EnumerateConnections(count) == KErrNone) {
- for (TUint i=1; i<=count; i++) {
- // Note: GetConnectionInfo expects 1-based index.
- if (iConnection.GetConnectionInfo(i, connInfo) == KErrNone) {
- SymbianNetworkConfigurationPrivate *symbianConfig =
- toSymbianConfig(privateConfiguration(publicConfig));
-
- if (connInfo().iIapId == symbianConfig->numericIdentifier()) {
- if (iConnection.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) {
- activeConfig = publicConfig;
-#ifndef QT_NO_NETWORKINTERFACE
- activeInterface = interface(symbianConfig->numericIdentifier());
-#endif
- connected = ETrue;
- startTime = QDateTime::currentDateTime();
- // Use name of the IAP to open global 'Open C' RConnection
- QByteArray nameAsByteArray = publicConfig.name().toUtf8();
- ifreq ifr;
- memset(&ifr, 0, sizeof(struct ifreq));
- strcpy(ifr.ifr_name, nameAsByteArray.constData());
- error = setdefaultif(&ifr);
- isOpen = true;
- // Make sure that state will be Connected
- newState(QNetworkSession::Connected);
- emit quitPendingWaitsForOpened();
- break;
- }
- }
- }
- }
- }
- if (!connected) {
SymbianNetworkConfigurationPrivate *symbianConfig =
toSymbianConfig(privateConfiguration(publicConfig));
@@ -420,13 +403,20 @@ void QNetworkSessionPrivateImpl::open()
if (!IsActive()) {
SetActive();
}
- newState(QNetworkSession::Connecting);
- }
+ // Avoid flip flop of states if the configuration is already
+ // active. IsOpen/opened() will indicate when ready.
+ if (state != QNetworkSession::Connected) {
+ newState(QNetworkSession::Connecting);
+ }
} else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
SymbianNetworkConfigurationPrivate *symbianConfig =
toSymbianConfig(privateConfiguration(publicConfig));
#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ // On Symbian^3 if service network is not reachable, it triggers a UI (aka EasyWLAN) where
+ // user can create new IAPs. To detect this, we need to store the number of IAPs
+ // there was before connection was started.
+ iKnownConfigsBeforeConnectionStart = engine->accessPointConfigurationIdentifiers();
TConnPrefList snapPref;
TExtendedConnPref prefs;
prefs.SetSnapId(symbianConfig->numericIdentifier());
@@ -441,7 +431,11 @@ void QNetworkSessionPrivateImpl::open()
if (!IsActive()) {
SetActive();
}
- newState(QNetworkSession::Connecting);
+ // Avoid flip flop of states if the configuration is already
+ // active. IsOpen/opened() will indicate when ready.
+ if (state != QNetworkSession::Connected) {
+ newState(QNetworkSession::Connecting);
+ }
} else if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
iKnownConfigsBeforeConnectionStart = engine->accessPointConfigurationIdentifiers();
iConnection.Start(iStatus);
@@ -453,6 +447,7 @@ void QNetworkSessionPrivateImpl::open()
if (error != KErrNone) {
isOpen = false;
+ isOpening = false;
iError = QNetworkSession::UnknownSessionError;
emit QNetworkSessionPrivate::error(iError);
if (ipConnectionNotifier) {
@@ -496,19 +491,19 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
<< "close() called, session state is: " << state << " and isOpen is : "
<< isOpen;
#endif
- if (!isOpen) {
+
+ if (!isOpen && state != QNetworkSession::Connecting) {
return;
}
// Mark this session as closed-by-user so that we are able to report
// distinguish between stop() and close() state transitions
// when reporting.
iClosedByUser = true;
-
isOpen = false;
- activeConfig = QNetworkConfiguration();
+ isOpening = false;
+
serviceConfig = QNetworkConfiguration();
- Cancel();
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (iMobility) {
delete iMobility;
@@ -522,17 +517,33 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
iHandleStateNotificationsFromManager = true;
}
- iConnection.Close();
+ Cancel(); // closes iConnection
iSocketServ.Close();
- // Close global 'Open C' RConnection
- setdefaultif(0);
+ // Close global 'Open C' RConnection. If OpenC supports,
+ // close the defaultif for good to avoid difficult timing
+ // and bouncing issues of network going immediately back up
+ // because of e.g. select() thread etc.
+ if (iDynamicUnSetdefaultif) {
+ iDynamicUnSetdefaultif();
+ } else {
+ setdefaultif(0);
+ }
- if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
+ // If UserChoice, go down immediately. If some other configuration,
+ // go down immediately if there is no reports expected from the platform;
+ // in practice Connection Monitor is aware of connections only after
+ // KFinishedSelection event, and hence reports only after that event, but
+ // that does not seem to be trusted on all Symbian versions --> safest
+ // to go down.
+ if (publicConfig.type() == QNetworkConfiguration::UserChoice || state == QNetworkSession::Connecting) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "going disconnected right away, since either UserChoice or Connecting";
+#endif
newState(QNetworkSession::Closing);
newState(QNetworkSession::Disconnected);
}
-
if (allowSignals) {
emit closed();
}
@@ -593,6 +604,7 @@ void QNetworkSessionPrivateImpl::stop()
#endif
// Since we are open, use RConnection to stop the interface
isOpen = false;
+ isOpening = false;
iStoppedByUser = true;
newState(QNetworkSession::Closing);
if (ipConnectionNotifier) {
@@ -602,6 +614,7 @@ void QNetworkSessionPrivateImpl::stop()
}
iConnection.Stop(RConnection::EStopAuthoritative);
isOpen = true;
+ isOpening = false;
close(false);
emit closed();
}
@@ -611,8 +624,13 @@ void QNetworkSessionPrivateImpl::migrate()
{
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (iMobility) {
- // Close global 'Open C' RConnection
- setdefaultif(0);
+ // Close global 'Open C' RConnection. If openC supports, use the 'heavy'
+ // version to block all subsequent requests.
+ if (iDynamicUnSetdefaultif) {
+ iDynamicUnSetdefaultif();
+ } else {
+ setdefaultif(0);
+ }
// Start migrating to new IAP
iMobility->MigrateToPreferredCarrier();
}
@@ -694,8 +712,17 @@ void QNetworkSessionPrivateImpl::PreferredCarrierAvailable(TAccessPointInfo aOld
SymbianNetworkConfigurationPrivate *symbianConfig =
toSymbianConfig(privateConfiguration(configs[i]));
- if (symbianConfig->numericIdentifier() == aNewAPInfo.AccessPoint())
- emit preferredConfigurationChanged(configs[i], aIsSeamless);
+ if (symbianConfig->numericIdentifier() == aNewAPInfo.AccessPoint()) {
+ // Any slot connected to the signal might throw an std::exception,
+ // which must not propagate into Symbian code (this function is a callback
+ // from platform). We could convert exception to a symbian Leave, but since the
+ // prototype of this function bans this (no trailing 'L'), we just catch
+ // and drop.
+ QT_TRY {
+ emit preferredConfigurationChanged(configs[i], aIsSeamless);
+ }
+ QT_CATCH (std::exception&) {}
+ }
}
} else {
migrate();
@@ -705,7 +732,10 @@ void QNetworkSessionPrivateImpl::PreferredCarrierAvailable(TAccessPointInfo aOld
void QNetworkSessionPrivateImpl::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*/, TBool /*aIsSeamless*/)
{
if (iALREnabled > 0) {
- emit newConfigurationActivated();
+ QT_TRY {
+ emit newConfigurationActivated();
+ }
+ QT_CATCH (std::exception&) {}
} else {
accept();
}
@@ -715,10 +745,11 @@ void QNetworkSessionPrivateImpl::Error(TInt /*aError*/)
{
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
qDebug() << "QNS this : " << QString::number((uint)this) << " - "
- << "roaming Error() occured";
+ << "roaming Error() occured, isOpen is: " << isOpen;
#endif
if (isOpen) {
isOpen = false;
+ isOpening = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::RoamingError;
@@ -727,18 +758,24 @@ void QNetworkSessionPrivateImpl::Error(TInt /*aError*/)
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- syncStateWithInterface();
- // In some cases IAP is still in Connected state when
- // syncStateWithInterface(); is called
- // => Following call makes sure that Session state
- // changes immediately to Disconnected.
- newState(QNetworkSession::Disconnected);
- emit closed();
+ QT_TRY {
+ syncStateWithInterface();
+ // In some cases IAP is still in Connected state when
+ // syncStateWithInterface(); is called
+ // => Following call makes sure that Session state
+ // changes immediately to Disconnected.
+ newState(QNetworkSession::Disconnected);
+ emit closed();
+ }
+ QT_CATCH (std::exception&) {}
} else if (iStoppedByUser) {
// If the user of this session has called the stop() and
// configuration is based on internet SNAP, this needs to be
// done here because platform might roam.
- newState(QNetworkSession::Disconnected);
+ QT_TRY {
+ newState(QNetworkSession::Disconnected);
+ }
+ QT_CATCH (std::exception&) {}
}
}
#endif
@@ -870,7 +907,7 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
_LIT(KSetting, "IAP\\Id");
iConnection.GetIntSetting(KSetting, iapId);
}
-
+
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
// Try to search IAP from the used SNAP using IAP Id
@@ -892,8 +929,8 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
// <=> Note: It's possible that in this case reported IAP is
// clone of the one of the IAPs of the used SNAP
// => If mappingName matches, clone has been found
- QNetworkConfiguration pt = QNetworkConfigurationManager()
- .configurationFromIdentifier(QString::number(qHash(iapId)));
+ QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier(
+ QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId)));
SymbianNetworkConfigurationPrivate *symbianConfig =
toSymbianConfig(privateConfiguration(pt));
@@ -907,20 +944,58 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
}
}
} else {
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ // On Symbian^3 (only, not earlier or Symbian^4) if the SNAP was not reachable, it triggers
+ // user choice type of activity (EasyWLAN). As a result, a new IAP may be created, and
+ // hence if was not found yet. Therefore update configurations and see if there is something new.
+ // 1. Update knowledge from the databases.
+ engine->requestUpdate();
+ // 2. Check if new configuration was created during connection creation
+ QList<QString> knownConfigs = engine->accessPointConfigurationIdentifiers();
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "opened configuration was not known beforehand, looking for new.";
+#endif
+ if (knownConfigs.count() > iKnownConfigsBeforeConnectionStart.count()) {
+ // Configuration count increased => new configuration was created
+ // => Search new, created configuration
+ QString newIapId;
+ for (int i=0; i < iKnownConfigsBeforeConnectionStart.count(); i++) {
+ if (knownConfigs[i] != iKnownConfigsBeforeConnectionStart[i]) {
+ newIapId = knownConfigs[i];
+ break;
+ }
+ }
+ if (newIapId.isEmpty()) {
+ newIapId = knownConfigs[knownConfigs.count()-1];
+ }
+ pt = QNetworkConfigurationManager().configurationFromIdentifier(newIapId);
+ if (pt.isValid()) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "new configuration was found, name, IAP id: " << pt.name() << pt.identifier();
+#endif
+ return pt;
+ }
+ }
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "configuration was not found, returning invalid.";
+#endif
+#endif // OCC_FUNCTIONALITY_AVAILABLE
// Given IAP Id was not found from known IAPs array
return QNetworkConfiguration();
}
-
// Matching IAP was not found from used SNAP
// => IAP from another SNAP is returned
// (Note: Returned IAP matches to given IAP Id)
return pt;
}
#endif
-
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
if (engine) {
- QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier(QString::number(qHash(iapId)));
+ QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier(
+ QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId)));
// Try to found User Selected IAP from known IAPs (accessPointConfigurations)
if (pt.isValid()) {
return pt;
@@ -957,6 +1032,10 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
void QNetworkSessionPrivateImpl::RunL()
{
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "RConnection::RunL with status code: " << iStatus.Int();
+#endif
TInt statusCode = iStatus.Int();
switch (statusCode) {
@@ -977,13 +1056,14 @@ void QNetworkSessionPrivateImpl::RunL()
if (error != KErrNone) {
isOpen = false;
+ isOpening = false;
iError = QNetworkSession::UnknownSessionError;
- emit QNetworkSessionPrivate::error(iError);
+ QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError));
Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- syncStateWithInterface();
+ QT_TRYCATCH_LEAVING(syncStateWithInterface());
return;
}
@@ -995,6 +1075,7 @@ void QNetworkSessionPrivateImpl::RunL()
#endif
isOpen = true;
+ isOpening = false;
activeConfig = newActiveConfig;
SymbianNetworkConfigurationPrivate *symbianConfig =
@@ -1010,26 +1091,30 @@ void QNetworkSessionPrivateImpl::RunL()
startTime = QDateTime::currentDateTime();
- newState(QNetworkSession::Connected);
- emit quitPendingWaitsForOpened();
+ QT_TRYCATCH_LEAVING({
+ newState(QNetworkSession::Connected);
+ emit quitPendingWaitsForOpened();
+ });
}
break;
case KErrNotFound: // Connection failed
isOpen = false;
+ isOpening = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::InvalidConfigurationError;
- emit QNetworkSessionPrivate::error(iError);
+ QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError));
Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- syncStateWithInterface();
+ QT_TRYCATCH_LEAVING(syncStateWithInterface());
break;
case KErrCancel: // Connection attempt cancelled
case KErrAlreadyExists: // Connection already exists
default:
isOpen = false;
+ isOpening = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
if (publicConfig.state() == QNetworkConfiguration::Undefined ||
@@ -1038,12 +1123,12 @@ void QNetworkSessionPrivateImpl::RunL()
} else {
iError = QNetworkSession::UnknownSessionError;
}
- emit QNetworkSessionPrivate::error(iError);
+ QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError));
Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- syncStateWithInterface();
+ QT_TRYCATCH_LEAVING(syncStateWithInterface());
break;
}
}
@@ -1110,6 +1195,12 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
return false;
}
+ // Make sure that some lagging 'connecting' state-changes do not overwrite
+ // if we are already connected (may righfully still happen with roaming though).
+ if (state == QNetworkSession::Connected && newState == QNetworkSession::Connecting) {
+ return false;
+ }
+
bool emitSessionClosed = false;
// If we abruptly go down and user hasn't closed the session, we've been aborted.
@@ -1123,6 +1214,7 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
// application or session stops connection or when network drops
// unexpectedly).
isOpen = false;
+ isOpening = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::SessionAbortedError;
@@ -1187,7 +1279,7 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
QNetworkConfiguration config = bestConfigFromSNAP(publicConfig);
if ((config.state() == QNetworkConfiguration::Defined) ||
(config.state() == QNetworkConfiguration::Discovered)) {
-
+ activeConfig = QNetworkConfiguration();
state = newState;
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed E to: " << state;
@@ -1208,24 +1300,30 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
}
}
}
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ // If the retVal is not true here, it means that the status update may apply to an IAP outside of
+ // SNAP (session is based on SNAP but follows IAP outside of it), which may occur on Symbian^3 EasyWlan.
+ if (retVal == false && activeConfig.d.data() && activeConfig.d.data()->numericId == accessPointId) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed G to: " << state;
+#endif
+ if (newState == QNetworkSession::Disconnected) {
+ activeConfig = QNetworkConfiguration();
+ }
+ state = newState;
+ emit q->stateChanged(state);
+ retVal = true;
+ }
+#endif
}
}
-
if (emitSessionClosed) {
emit closed();
}
if (state == QNetworkSession::Disconnected) {
- // The connection has gone down, and processing of status updates must be
- // stopped. Depending on platform, there may come 'connecting/connected' states
- // considerably later (almost a second). Connection id is an increasing
- // number, so this does not affect next _real_ 'conneting/connected' states.
-
- SymbianNetworkConfigurationPrivate *symbianConfig =
- toSymbianConfig(privateConfiguration(publicConfig));
-
- iDeprecatedConnectionId = symbianConfig->connectionIdentifier();
+ // Just in case clear activeConfiguration.
+ activeConfig = QNetworkConfiguration();
}
-
return retVal;
}
@@ -1250,7 +1348,6 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne
case KFinishedSelection:
if (aError == KErrNone)
{
- // The user successfully selected an IAP to be used
break;
}
else
@@ -1364,7 +1461,7 @@ void ConnectionProgressNotifier::DoCancel()
void ConnectionProgressNotifier::RunL()
{
if (iStatus == KErrNone) {
- iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError);
+ QT_TRYCATCH_LEAVING(iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError));
SetActive();
iConnection.ProgressNotification(iProgress, iStatus);
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h
index b045ff1..0754ace 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.h
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.h
@@ -73,6 +73,8 @@ QT_BEGIN_NAMESPACE
class ConnectionProgressNotifier;
class SymbianEngine;
+typedef void (*TOpenCUnSetdefaultifFunction)();
+
class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
, public MMobilityProtocolResp
@@ -153,6 +155,9 @@ private: // data
QDateTime startTime;
+ RLibrary iOpenCLibrary;
+ TOpenCUnSetdefaultifFunction iDynamicUnSetdefaultif;
+
mutable RSocketServ iSocketServ;
mutable RConnection iConnection;
mutable RConnectionMonitor iConnectionMonitor;
@@ -162,7 +167,6 @@ private: // data
bool iFirstSync;
bool iStoppedByUser;
bool iClosedByUser;
- TUint32 iDeprecatedConnectionId;
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
CActiveCommsMobilityApiExt* iMobility;
@@ -178,6 +182,8 @@ private: // data
TUint32 iOldRoamingIap;
TUint32 iNewRoamingIap;
+ bool isOpening;
+
friend class ConnectionProgressNotifier;
};
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index ab1ba28..ca444c1 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -46,7 +46,6 @@
#include <cdbcols.h>
#include <d32dbms.h>
#include <nifvar.h>
-#include <QEventLoop>
#include <QTimer>
#include <QTime> // For randgen seeding
#include <QtCore> // For randgen seeding
@@ -73,9 +72,6 @@
QT_BEGIN_NAMESPACE
-#ifdef SNAP_FUNCTIONALITY_AVAILABLE
- static const int KValueThatWillBeAddedToSNAPId = 1000;
-#endif
static const int KUserChoiceIAPId = 0;
SymbianNetworkConfigurationPrivate::SymbianNetworkConfigurationPrivate()
@@ -114,8 +110,8 @@ QString SymbianNetworkConfigurationPrivate::bearerName() const
}
SymbianEngine::SymbianEngine(QObject *parent)
-: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iFirstUpdate(true), iInitOk(true),
- iIgnoringUpdates(false)
+: QBearerEngine(parent), CActive(CActive::EPriorityHigh), iFirstUpdate(true), iInitOk(true),
+ iUpdatePending(false)
{
}
@@ -135,6 +131,9 @@ void SymbianEngine::initialize()
}
TRAP_IGNORE(iConnectionMonitor.ConnectL());
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+ TRAP_IGNORE(iConnectionMonitor.SetUintAttribute(EBearerIdAll, 0, KBearerGroupThreshold, 1));
+#endif
TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this));
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
@@ -190,6 +189,28 @@ SymbianEngine::~SymbianEngine()
delete cleanup;
}
+void SymbianEngine::delayedConfigurationUpdate()
+{
+ QMutexLocker locker(&mutex);
+
+ if (iUpdatePending) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug("QNCM delayed configuration update (ECommit or ERecover occurred).");
+#endif
+ TRAPD(error, updateConfigurationsL());
+ if (error == KErrNone) {
+ updateStatesToSnaps();
+ }
+ iUpdatePending = false;
+ // Start monitoring again.
+ if (!IsActive()) {
+ SetActive();
+ // Start waiting for new notification
+ ipCommsDB->RequestNotification(iStatus);
+ }
+ }
+}
+
bool SymbianEngine::hasIdentifier(const QString &id)
{
QMutexLocker locker(&mutex);
@@ -261,7 +282,7 @@ void SymbianEngine::updateConfigurationsL()
RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL(connectionMethods[i]);
CleanupClosePushL(connectionMethod);
TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId);
- QString ident = QString::number(qHash(iapId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId));
if (accessPointConfigurations.contains(ident)) {
knownConfigs.removeOne(ident);
} else {
@@ -272,7 +293,11 @@ void SymbianEngine::updateConfigurationsL()
accessPointConfigurations.insert(ptr->id, ptr);
mutex.unlock();
- emit configurationAdded(ptr);
+ // Emit configuration added. Connected slots may throw execptions
+ // which propagate here --> must be converted to leaves (standard
+ // std::exception would cause any TRAP trapping this function to terminate
+ // program).
+ QT_TRYCATCH_LEAVING(emit configurationAdded(ptr));
mutex.lock();
}
}
@@ -288,15 +313,15 @@ void SymbianEngine::updateConfigurationsL()
RCmDestination destination;
destination = iCmManager.DestinationL(destinations[i]);
CleanupClosePushL(destination);
- QString ident = QString::number(qHash(destination.Id()+KValueThatWillBeAddedToSNAPId)); //TODO: Check if it's ok to add 1000 SNAP Id to prevent SNAP ids overlapping IAP ids
+ QString ident = QT_BEARERMGMT_CONFIGURATION_SNAP_PREFIX +
+ QString::number(qHash(destination.Id()));
if (snapConfigurations.contains(ident)) {
knownSnapConfigs.removeOne(ident);
} else {
SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate;
- CleanupStack::PushL(cpPriv);
HBufC *pName = destination.NameLC();
- cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length());
+ QT_TRYCATCH_LEAVING(cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()));
CleanupStack::PopAndDestroy(pName);
pName = NULL;
@@ -313,10 +338,8 @@ void SymbianEngine::updateConfigurationsL()
snapConfigurations.insert(ident, ptr);
mutex.unlock();
- emit configurationAdded(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationAdded(ptr));
mutex.lock();
-
- CleanupStack::Pop(cpPriv);
}
QNetworkConfigurationPrivatePointer privSNAP = snapConfigurations.value(ident);
@@ -325,7 +348,7 @@ void SymbianEngine::updateConfigurationsL()
CleanupClosePushL(connectionMethod);
TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId);
- QString iface = QString::number(qHash(iapId));
+ QString iface = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId));
// Check that IAP can be found from accessPointConfigurations list
QNetworkConfigurationPrivatePointer priv = accessPointConfigurations.value(iface);
if (!priv) {
@@ -336,7 +359,7 @@ void SymbianEngine::updateConfigurationsL()
accessPointConfigurations.insert(ptr->id, ptr);
mutex.unlock();
- emit configurationAdded(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationAdded(ptr));
mutex.lock();
QMutexLocker configLocker(&privSNAP->mutex);
@@ -380,7 +403,7 @@ void SymbianEngine::updateConfigurationsL()
TInt retVal = pDbTView->GotoFirstRecord();
while (retVal == KErrNone) {
pDbTView->ReadUintL(TPtrC(COMMDB_ID), apId);
- QString ident = QString::number(qHash(apId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
if (accessPointConfigurations.contains(ident)) {
knownConfigs.removeOne(ident);
} else {
@@ -390,7 +413,7 @@ void SymbianEngine::updateConfigurationsL()
accessPointConfigurations.insert(ident, ptr);
mutex.unlock();
- emit configurationAdded(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationAdded(ptr));
mutex.lock();
} else {
delete cpPriv;
@@ -400,7 +423,7 @@ void SymbianEngine::updateConfigurationsL()
}
CleanupStack::PopAndDestroy(pDbTView);
#endif
- updateActiveAccessPoints();
+ QT_TRYCATCH_LEAVING(updateActiveAccessPoints());
foreach (const QString &oldIface, knownConfigs) {
//remove non existing IAP
@@ -408,6 +431,7 @@ void SymbianEngine::updateConfigurationsL()
mutex.unlock();
emit configurationRemoved(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationRemoved(ptr));
mutex.lock();
// Remove non existing IAP from SNAPs
@@ -431,6 +455,7 @@ void SymbianEngine::updateConfigurationsL()
mutex.unlock();
emit configurationRemoved(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationRemoved(ptr));
mutex.lock();
}
@@ -445,14 +470,12 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
RCmConnectionMethod& connectionMethod)
{
SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate;
- CleanupStack::PushL(cpPriv);
-
TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId);
- QString ident = QString::number(qHash(iapId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId));
HBufC *pName = connectionMethod.GetStringAttributeL(CMManager::ECmName);
CleanupStack::PushL(pName);
- cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length());
+ QT_TRYCATCH_LEAVING(cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()));
CleanupStack::PopAndDestroy(pName);
pName = NULL;
@@ -500,7 +523,7 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
if (error == KErrNone && pName) {
CleanupStack::PushL(pName);
- cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length());
+ QT_TRYCATCH_LEAVING(cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length()));
CleanupStack::PopAndDestroy(pName);
pName = NULL;
}
@@ -518,8 +541,6 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
cpPriv->purpose = QNetworkConfiguration::UnknownPurpose;
cpPriv->roamingSupported = false;
-
- CleanupStack::Pop(cpPriv);
return cpPriv;
}
#else
@@ -550,9 +571,9 @@ void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL(
User::Leave(KErrNotFound);
}
- QString ident = QString::number(qHash(aApId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(aApId));
- apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length());
+ QT_TRYCATCH_LEAVING(apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length()));
apNetworkConfiguration->isValid = true;
apNetworkConfiguration->id = ident;
apNetworkConfiguration->numericId = aApId;
@@ -617,10 +638,12 @@ QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfigurationL()
TCmDefConnValue defaultConnectionValue;
iCmManager.ReadDefConnL(defaultConnectionValue);
if (defaultConnectionValue.iType == ECmDefConnDestination) {
- QString iface = QString::number(qHash(defaultConnectionValue.iId+KValueThatWillBeAddedToSNAPId));
+ QString iface = QT_BEARERMGMT_CONFIGURATION_SNAP_PREFIX +
+ QString::number(qHash(defaultConnectionValue.iId));
ptr = snapConfigurations.value(iface);
} else if (defaultConnectionValue.iType == ECmDefConnConnectionMethod) {
- QString iface = QString::number(qHash(defaultConnectionValue.iId));
+ QString iface = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX +
+ QString::number(qHash(defaultConnectionValue.iId));
ptr = accessPointConfigurations.value(iface);
}
#endif
@@ -658,8 +681,14 @@ void SymbianEngine::updateActiveAccessPoints()
iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount);
iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
User::WaitForRequest(status);
- QString ident = QString::number(qHash(apId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ if (!ptr) {
+ // If IAP was not found, check if the update was about EasyWLAN
+ ptr = configurationFromEasyWlan(apId, connectionId);
+ }
+#endif
if (ptr) {
iConnectionMonitor.GetIntAttribute(connectionId, subConnectionCount, KConnectionStatus, connectionStatus, status);
User::WaitForRequest(status);
@@ -690,7 +719,7 @@ void SymbianEngine::updateActiveAccessPoints()
if (iOnline != online) {
iOnline = online;
mutex.unlock();
- emit this->onlineStateChanged(iOnline);
+ emit this->onlineStateChanged(online);
mutex.lock();
}
}
@@ -715,7 +744,8 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn
// Set state of returned IAPs to Discovered
// if state is not already Active
for(TUint i=0; i<iapInfo.iCount; i++) {
- QString ident = QString::number(qHash(iapInfo.iIap[i].iIapId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX +
+ QString::number(qHash(iapInfo.iIap[i].iIapId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
if (ptr) {
unavailableConfigs.removeOne(ident);
@@ -783,6 +813,59 @@ void SymbianEngine::updateStatesToSnaps()
}
}
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+void SymbianEngine::updateMobileBearerToConfigs(TConnMonBearerInfo bearerInfo)
+{
+ QHash<QString, QNetworkConfigurationPrivatePointer>::const_iterator i =
+ accessPointConfigurations.constBegin();
+ while (i != accessPointConfigurations.constEnd()) {
+ QNetworkConfigurationPrivatePointer ptr = i.value();
+
+ QMutexLocker locker(&ptr->mutex);
+
+ SymbianNetworkConfigurationPrivate *p = toSymbianConfig(ptr);
+
+ if (p->bearer >= SymbianNetworkConfigurationPrivate::Bearer2G &&
+ p->bearer <= SymbianNetworkConfigurationPrivate::BearerHSPA) {
+ switch (bearerInfo) {
+ case EBearerInfoCSD:
+ p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G;
+ break;
+ case EBearerInfoWCDMA:
+ p->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA;
+ break;
+ case EBearerInfoCDMA2000:
+ p->bearer = SymbianNetworkConfigurationPrivate::BearerCDMA2000;
+ break;
+ case EBearerInfoGPRS:
+ p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G;
+ break;
+ case EBearerInfoHSCSD:
+ p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G;
+ break;
+ case EBearerInfoEdgeGPRS:
+ p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G;
+ break;
+ case EBearerInfoWcdmaCSD:
+ p->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA;
+ break;
+ case EBearerInfoHSDPA:
+ p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA;
+ break;
+ case EBearerInfoHSUPA:
+ p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA;
+ break;
+ case EBearerInfoHSxPA:
+ p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA;
+ break;
+ }
+ }
+
+ ++i;
+ }
+}
+#endif
+
bool SymbianEngine::changeConfigurationStateTo(QNetworkConfigurationPrivatePointer ptr,
QNetworkConfiguration::StateFlags newState)
{
@@ -873,55 +956,30 @@ void SymbianEngine::RunL()
{
QMutexLocker locker(&mutex);
- if (iIgnoringUpdates) {
-#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
- qDebug("QNCM CommsDB event handling postponed (postpone-timer running because IAPs/SNAPs were updated very recently).");
-#endif
- return;
- }
-
- RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int());
-
- switch (event) {
- case RDbNotifier::EUnlock: /** All read locks have been removed. */
- case RDbNotifier::ECommit: /** A transaction has been committed. */
- case RDbNotifier::ERollback: /** A transaction has been rolled back */
- case RDbNotifier::ERecover: /** The database has been recovered */
+ if (iStatus != KErrCancel) {
+ // By default, start relistening notifications. Stop only if interesting event occured.
+ iWaitingCommsDatabaseNotifications = true;
+ RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int());
+ switch (event) {
+ case RDbNotifier::ECommit: /** A transaction has been committed. */
+ case RDbNotifier::ERecover: /** The database has been recovered */
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
- qDebug("QNCM CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int());
+ qDebug("QNCM CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int());
#endif
- iIgnoringUpdates = true;
- // Other events than ECommit get lower priority. In practice with those events,
- // we delay_before_updating methods, whereas
- // with ECommit we _update_before_delaying the reaction to next event.
- // Few important notes: 1) listening to only ECommit does not seem to be adequate,
- // but updates will be missed. Hence other events are reacted upon too.
- // 2) RDbNotifier records the most significant event, and that will be returned once
- // we issue new RequestNotification, and hence updates will not be missed even
- // when we are 'not reacting to them' for few seconds.
- if (event == RDbNotifier::ECommit) {
- TRAPD(error, updateConfigurationsL());
- if (error == KErrNone) {
- updateStatesToSnaps();
- }
- locker.unlock();
- waitRandomTime();
- locker.relock();
- } else {
- locker.unlock();
- waitRandomTime();
- locker.relock();
- TRAPD(error, updateConfigurationsL());
- if (error == KErrNone) {
- updateStatesToSnaps();
+ // Mark that there is update pending. No need to ask more events,
+ // as we know we will be updating anyway when the timer expires.
+ if (!iUpdatePending) {
+ iUpdatePending = true;
+ iWaitingCommsDatabaseNotifications = false;
+ // Update after random time, so that many processes won't
+ // start updating simultaneously
+ updateConfigurationsAfterRandomTime();
}
+ break;
+ default:
+ // Do nothing
+ break;
}
- iIgnoringUpdates = false; // Wait time done, allow updating again
- iWaitingCommsDatabaseNotifications = true;
- break;
- default:
- // Do nothing
- break;
}
if (iWaitingCommsDatabaseNotifications) {
@@ -945,6 +1003,20 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
QMutexLocker locker(&mutex);
switch (aEvent.EventType()) {
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+ case EConnMonBearerInfoChange:
+ {
+ CConnMonBearerInfoChange* realEvent;
+ realEvent = (CConnMonBearerInfoChange*) &aEvent;
+ TUint connectionId = realEvent->ConnectionId();
+ if (connectionId == EBearerIdAll) {
+ //Network level event
+ TConnMonBearerInfo bearerInfo = (TConnMonBearerInfo)realEvent->BearerInfo();
+ updateMobileBearerToConfigs(bearerInfo);
+ }
+ break;
+ }
+#endif
case EConnMonConnectionStatusChange:
{
CConnMonConnectionStatusChange* realEvent;
@@ -960,14 +1032,23 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
TRequestStatus status;
iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
User::WaitForRequest(status);
- QString ident = QString::number(qHash(apId));
+
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ if (!ptr) {
+ // Check if status was regarding EasyWLAN
+ ptr = configurationFromEasyWlan(apId, connectionId);
+ }
+#endif
if (ptr) {
ptr->mutex.lock();
toSymbianConfig(ptr)->connectionId = connectionId;
ptr->mutex.unlock();
- emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
- connectionId, QNetworkSession::Connecting);
+ QT_TRYCATCH_LEAVING(
+ emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
+ connectionId, QNetworkSession::Connecting)
+ );
}
} else if (connectionStatus == KLinkLayerOpen) {
// Connection has been successfully opened
@@ -977,31 +1058,41 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
TRequestStatus status;
iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
User::WaitForRequest(status);
- QString ident = QString::number(qHash(apId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ if (!ptr) {
+ // Check for EasyWLAN
+ ptr = configurationFromEasyWlan(apId, connectionId);
+ }
+#endif
if (ptr) {
ptr->mutex.lock();
toSymbianConfig(ptr)->connectionId = connectionId;
ptr->mutex.unlock();
// Configuration is Active
- if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) {
- updateStatesToSnaps();
- }
- emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
- connectionId, QNetworkSession::Connected);
+ QT_TRYCATCH_LEAVING(
+ if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) {
+ updateStatesToSnaps();
+ }
+ emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
+ connectionId, QNetworkSession::Connected);
- if (!iOnline) {
- iOnline = true;
- emit this->onlineStateChanged(iOnline);
- }
+ if (!iOnline) {
+ iOnline = true;
+ emit this->onlineStateChanged(iOnline);
+ }
+ );
}
} else if (connectionStatus == KConfigDaemonStartingDeregistration) {
TUint connectionId = realEvent->ConnectionId();
QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId);
if (ptr) {
- emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
- connectionId, QNetworkSession::Closing);
+ QT_TRYCATCH_LEAVING(
+ emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
+ connectionId, QNetworkSession::Closing)
+ );
}
} else if (connectionStatus == KLinkLayerClosed ||
connectionStatus == KConnectionClosed) {
@@ -1011,12 +1102,13 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId);
if (ptr) {
// Configuration is either Defined or Discovered
- if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) {
- updateStatesToSnaps();
- }
-
- emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
- connectionId, QNetworkSession::Disconnected);
+ QT_TRYCATCH_LEAVING(
+ if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) {
+ updateStatesToSnaps();
+ }
+ emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
+ connectionId, QNetworkSession::Disconnected);
+ );
}
bool online = false;
@@ -1030,7 +1122,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
}
if (iOnline != online) {
iOnline = online;
- emit this->onlineStateChanged(iOnline);
+ QT_TRYCATCH_LEAVING(emit this->onlineStateChanged(iOnline));
}
}
}
@@ -1043,12 +1135,13 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
TConnMonIapInfo iaps = realEvent->IapAvailability();
QList<QString> unDiscoveredConfigs = accessPointConfigurations.keys();
for ( TUint i = 0; i < iaps.Count(); i++ ) {
- QString ident = QString::number(qHash(iaps.iIap[i].iIapId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX +
+ QString::number(qHash(iaps.iIap[i].iIapId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
if (ptr) {
// Configuration is either Discovered or Active
- changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered);
+ QT_TRYCATCH_LEAVING(changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered));
unDiscoveredConfigs.removeOne(ident);
}
}
@@ -1056,7 +1149,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface);
if (ptr) {
// Configuration is Defined
- changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined);
+ QT_TRYCATCH_LEAVING(changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined));
}
}
}
@@ -1073,8 +1166,14 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
TRequestStatus status;
iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
User::WaitForRequest(status);
- QString ident = QString::number(qHash(apId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ if (!ptr) {
+ // If IAP was not found, check if the update was about EasyWLAN
+ ptr = configurationFromEasyWlan(apId, connectionId);
+ }
+#endif
if (ptr) {
QMutexLocker configLocker(&ptr->mutex);
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
@@ -1090,6 +1189,43 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
}
}
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+// Tries to derive configuration from EasyWLAN.
+// First checks if the interface brought up was EasyWLAN, then derives the real SSID,
+// and looks up configuration based on that one.
+QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromEasyWlan(TUint32 apId, TUint connectionId)
+{
+ if (apId == iCmManager.EasyWlanIdL()) {
+ TRequestStatus status;
+ TBuf<50> easyWlanNetworkName;
+ iConnectionMonitor.GetStringAttribute( connectionId, 0, KNetworkName,
+ easyWlanNetworkName, status );
+ User::WaitForRequest(status);
+ if (status.Int() == KErrNone) {
+ QString realSSID = QString::fromUtf16(easyWlanNetworkName.Ptr(), easyWlanNetworkName.Length());
+
+ // Browser through all items and check their name for match
+ QHash<QString, QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> >::const_iterator i =
+ accessPointConfigurations.constBegin();
+ while (i != accessPointConfigurations.constEnd()) {
+ QNetworkConfigurationPrivatePointer ptr = i.value();
+
+ QMutexLocker configLocker(&ptr->mutex);
+
+ if (ptr->name == realSSID) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNCM EasyWlan uses real SSID: " << realSSID;
+#endif
+ return ptr;
+ }
+ ++i;
+ }
+ }
+ }
+ return QNetworkConfigurationPrivatePointer();
+}
+#endif
+
// Sessions may use this function to report configuration state changes,
// because on some Symbian platforms (especially Symbian^3) all state changes are not
// reported by the RConnectionMonitor, in particular in relation to stop() call,
@@ -1107,7 +1243,8 @@ void SymbianEngine::configurationStateChangeReport(TUint32 accessPointId, QNetwo
switch (newState) {
case QNetworkSession::Disconnected:
{
- QString ident = QString::number(qHash(accessPointId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX +
+ QString::number(qHash(accessPointId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
if (ptr) {
// Configuration is either Defined or Discovered
@@ -1129,15 +1266,13 @@ void SymbianEngine::configurationStateChangeReport(TUint32 accessPointId, QNetwo
}
// Waits for 2..6 seconds.
-void SymbianEngine::waitRandomTime()
+void SymbianEngine::updateConfigurationsAfterRandomTime()
{
- int iTimeToWait = qMax(2000, (qAbs(qrand()) % 7) * 1000);
+ int iTimeToWait = qMax(1000, (qAbs(qrand()) % 68) * 100);
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
qDebug("QNCM waiting random time: %d ms", iTimeToWait);
#endif
- QEventLoop loop;
- QTimer::singleShot(iTimeToWait, &loop, SLOT(quit()));
- loop.exec();
+ QTimer::singleShot(iTimeToWait, this, SLOT(delayedConfigurationUpdate()));
}
QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aConnectionId)
@@ -1158,7 +1293,7 @@ QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aCon
AccessPointsAvailabilityScanner::AccessPointsAvailabilityScanner(SymbianEngine& owner,
RConnectionMonitor& connectionMonitor)
- : CActive(CActive::EPriorityStandard), iOwner(owner), iConnectionMonitor(connectionMonitor)
+ : CActive(CActive::EPriorityHigh), iOwner(owner), iConnectionMonitor(connectionMonitor)
{
CActiveScheduler::Add(this);
}
@@ -1198,9 +1333,9 @@ void AccessPointsAvailabilityScanner::RunL()
if (iStatus.Int() != KErrNone) {
iIapBuf().iCount = 0;
- iOwner.accessPointScanningReady(false,iIapBuf());
+ QT_TRYCATCH_LEAVING(iOwner.accessPointScanningReady(false,iIapBuf()));
} else {
- iOwner.accessPointScanningReady(true,iIapBuf());
+ QT_TRYCATCH_LEAVING(iOwner.accessPointScanningReady(true,iIapBuf()));
}
}
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index 18fd249..cfddc29 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -55,6 +55,9 @@
// Uncomment and compile QtBearer to gain detailed state tracing
// #define QT_BEARERMGMT_SYMBIAN_DEBUG
+#define QT_BEARERMGMT_CONFIGURATION_SNAP_PREFIX QLatin1String("S_")
+#define QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX QLatin1String("I_")
+
class CCommsDatabase;
class QEventLoop;
@@ -159,6 +162,7 @@ Q_SIGNALS:
public Q_SLOTS:
void updateConfigurations();
+ void delayedConfigurationUpdate();
private:
void updateStatesToSnaps();
@@ -169,6 +173,7 @@ private:
bool changeConfigurationStateAtMaxTo(QNetworkConfigurationPrivatePointer ptr,
QNetworkConfiguration::StateFlags newState);
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+ void updateMobileBearerToConfigs(TConnMonBearerInfo bearerInfo);
SymbianNetworkConfigurationPrivate *configFromConnectionMethodL(RCmConnectionMethod& connectionMethod);
#else
bool readNetworkConfigurationValuesFromCommsDb(
@@ -183,7 +188,7 @@ private:
void accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo);
void startCommsDatabaseNotifications();
void stopCommsDatabaseNotifications();
- void waitRandomTime();
+ void updateConfigurationsAfterRandomTime();
QNetworkConfigurationPrivatePointer defaultConfigurationL();
TBool GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) const;
@@ -201,6 +206,9 @@ private:
// For QNetworkSessionPrivate to indicate about state changes
void configurationStateChangeReport(TUint32 accessPointId,
QNetworkSession::State newState);
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ QNetworkConfigurationPrivatePointer configurationFromEasyWlan(TUint32 apId, TUint connectionId);
+#endif
private: // Data
bool iFirstUpdate;
@@ -211,7 +219,7 @@ private: // Data
TBool iOnline;
TBool iInitOk;
TBool iUpdateGoingOn;
- TBool iIgnoringUpdates;
+ TBool iUpdatePending;
AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner;
diff --git a/src/plugins/codecs/cn/qgb18030codec.cpp b/src/plugins/codecs/cn/qgb18030codec.cpp
index 3f2eec7..e10c8b1 100644
--- a/src/plugins/codecs/cn/qgb18030codec.cpp
+++ b/src/plugins/codecs/cn/qgb18030codec.cpp
@@ -319,7 +319,7 @@ QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *
{
uchar buf[2];
int nbuf = 0;
- QChar replacement = QChar::ReplacementCharacter;
+ ushort replacement = QChar::ReplacementCharacter;
if (state) {
if (state->flags & ConvertInvalidToNull)
replacement = QChar::Null;
@@ -330,6 +330,9 @@ QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *
int invalid = 0;
QString result;
+ result.resize(len);
+ int unicodeLen = 0;
+ ushort *const resultData = reinterpret_cast<ushort*>(result.data());
//qDebug("QGbkDecoder::toUnicode(const char* chars = \"%s\", int len = %d)", chars, len);
for (int i=0; i<len; i++) {
@@ -338,14 +341,16 @@ QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *
case 0:
if (ch < 0x80) {
// ASCII
- result += QLatin1Char(ch);
+ resultData[unicodeLen] = ch;
+ ++unicodeLen;
} else if (Is1stByte(ch)) {
// GBK 1st byte?
buf[0] = ch;
nbuf = 1;
} else {
// Invalid
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
}
break;
@@ -356,21 +361,25 @@ QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *
int clen = 2;
uint u = qt_Gb18030ToUnicode(buf, clen);
if (clen == 2) {
- result += qValidChar(u);
+ resultData[unicodeLen] = qValidChar(static_cast<ushort>(u));
+ ++unicodeLen;
} else {
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
}
nbuf = 0;
} else {
// Error
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
nbuf = 0;
}
break;
}
}
+ result.resize(unicodeLen);
if (state) {
state->remainingChars = nbuf;
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index a093e4c..4addb84 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -175,13 +175,6 @@ symbian: {
particlesImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/particles
DEPLOYMENT += folderlistmodelImport gesturesImport particlesImport
-
- contains(QT_CONFIG, webkit): {
- webkitImport.sources = $$QT_BUILD_TREE/imports/QtWebKit/qmlwebkitplugin$${QT_LIBINFIX}.dll
- webkitImport.sources += $$QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/declarative/qmldir
- webkitImport.path = c:$$QT_IMPORTS_BASE_DIR/QtWebKit
- DEPLOYMENT += webkitImport
- }
}
graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index e2999c1..7bccffe 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -64,6 +64,7 @@
#include "bridge/qscriptqobject_p.h"
#include "bridge/qscriptglobalobject_p.h"
#include "bridge/qscriptactivationobject_p.h"
+#include "bridge/qscriptstaticscopeobject_p.h"
#ifndef QT_NO_QOBJECT
#include <QtCore/qcoreapplication.h>
@@ -437,6 +438,53 @@ qsreal ToNumber(const QString &value)
#endif
+static const qsreal MsPerSecond = 1000.0;
+
+static inline int MsFromTime(qsreal t)
+{
+ int r = int(::fmod(t, MsPerSecond));
+ return (r >= 0) ? r : r + int(MsPerSecond);
+}
+
+/*!
+ \internal
+ Converts a JS date value (milliseconds) to a QDateTime (local time).
+*/
+QDateTime MsToDateTime(JSC::ExecState *exec, qsreal t)
+{
+ if (qIsNaN(t))
+ return QDateTime();
+ JSC::GregorianDateTime tm;
+ JSC::msToGregorianDateTime(exec, t, /*output UTC=*/true, tm);
+ int ms = MsFromTime(t);
+ QDateTime convertedUTC = QDateTime(QDate(tm.year + 1900, tm.month + 1, tm.monthDay),
+ QTime(tm.hour, tm.minute, tm.second, ms), Qt::UTC);
+ return convertedUTC.toLocalTime();
+}
+
+/*!
+ \internal
+ Converts a QDateTime to a JS date value (milliseconds).
+*/
+qsreal DateTimeToMs(JSC::ExecState *exec, const QDateTime &dt)
+{
+ if (!dt.isValid())
+ return qSNaN();
+ QDateTime utc = dt.toUTC();
+ QDate date = utc.date();
+ QTime time = utc.time();
+ JSC::GregorianDateTime tm;
+ tm.year = date.year() - 1900;
+ tm.month = date.month() - 1;
+ tm.monthDay = date.day();
+ tm.weekDay = date.dayOfWeek();
+ tm.yearDay = date.dayOfYear();
+ tm.hour = time.hour();
+ tm.minute = time.minute();
+ tm.second = time.second();
+ return JSC::gregorianDateTimeToMS(exec, tm, time.msec(), /*inputIsUTC=*/true);
+}
+
void GlobalClientData::mark(JSC::MarkStack& markStack)
{
engine->mark(markStack);
@@ -905,6 +953,7 @@ QScriptEnginePrivate::QScriptEnginePrivate()
JSC::ExecState* exec = globalObject->globalExec();
scriptObjectStructure = QScriptObject::createStructure(globalObject->objectPrototype());
+ staticScopeObjectStructure = QScriptStaticScopeObject::createStructure(JSC::jsNull());
qobjectPrototype = new (exec) QScript::QObjectPrototype(exec, QScript::QObjectPrototype::createStructure(globalObject->objectPrototype()), globalObject->prototypeFunctionStructure());
qobjectWrapperObjectStructure = QScriptObject::createStructure(qobjectPrototype);
@@ -1770,15 +1819,7 @@ void QScriptEnginePrivate::setProperty(JSC::ExecState *exec, JSC::JSValue object
} else if (flags != QScriptValue::KeepExistingFlags) {
if (thisObject->hasOwnProperty(exec, id))
thisObject->deleteProperty(exec, id); // ### hmmm - can't we just update the attributes?
- unsigned attribs = 0;
- if (flags & QScriptValue::ReadOnly)
- attribs |= JSC::ReadOnly;
- if (flags & QScriptValue::SkipInEnumeration)
- attribs |= JSC::DontEnum;
- if (flags & QScriptValue::Undeletable)
- attribs |= JSC::DontDelete;
- attribs |= flags & QScriptValue::UserRange;
- thisObject->putWithAttributes(exec, id, value, attribs);
+ thisObject->putWithAttributes(exec, id, value, propertyFlagsToJSCAttributes(flags));
} else {
JSC::PutPropertySlot slot;
thisObject->put(exec, id, value, slot);
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index 56366e2..c71465d 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -50,7 +50,6 @@
#include "bridge/qscriptobject_p.h"
#include "bridge/qscriptqobject_p.h"
#include "bridge/qscriptvariant_p.h"
-#include "utils/qscriptdate_p.h"
#include "DateConstructor.h"
#include "DateInstance.h"
@@ -119,6 +118,9 @@ namespace QScript
inline QString ToString(qsreal);
#endif
+ QDateTime MsToDateTime(JSC::ExecState *, qsreal);
+ qsreal DateTimeToMs(JSC::ExecState *, const QDateTime &);
+
//some conversion helper functions
inline QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec);
bool isFunction(JSC::JSValue value);
@@ -205,6 +207,7 @@ public:
inline QScriptValue scriptValueFromJSCValue(JSC::JSValue value);
inline JSC::JSValue scriptValueToJSCValue(const QScriptValue &value);
+ static inline unsigned propertyFlagsToJSCAttributes(const QScriptValue::PropertyFlags &flags);
static inline JSC::JSValue jscValueFromVariant(JSC::ExecState*, const QVariant &value);
static QVariant jscValueToVariant(JSC::ExecState*, JSC::JSValue value, int targetType);
@@ -346,6 +349,7 @@ public:
JSC::ExecState *currentFrame;
WTF::RefPtr<JSC::Structure> scriptObjectStructure;
+ WTF::RefPtr<JSC::Structure> staticScopeObjectStructure;
QScript::QObjectPrototype *qobjectPrototype;
WTF::RefPtr<JSC::Structure> qobjectWrapperObjectStructure;
@@ -639,6 +643,19 @@ inline JSC::JSValue QScriptEnginePrivate::scriptValueToJSCValue(const QScriptVal
return vv->jscValue;
}
+inline unsigned QScriptEnginePrivate::propertyFlagsToJSCAttributes(const QScriptValue::PropertyFlags &flags)
+{
+ unsigned attribs = 0;
+ if (flags & QScriptValue::ReadOnly)
+ attribs |= JSC::ReadOnly;
+ if (flags & QScriptValue::SkipInEnumeration)
+ attribs |= JSC::DontEnum;
+ if (flags & QScriptValue::Undeletable)
+ attribs |= JSC::DontDelete;
+ attribs |= flags & QScriptValue::UserRange;
+ return attribs;
+}
+
inline QScriptValuePrivate::~QScriptValuePrivate()
{
if (engine)
@@ -846,7 +863,7 @@ inline JSC::JSValue QScriptEnginePrivate::newDate(JSC::ExecState *exec, qsreal v
inline JSC::JSValue QScriptEnginePrivate::newDate(JSC::ExecState *exec, const QDateTime &value)
{
- return newDate(exec, QScript::FromDateTime(value));
+ return newDate(exec, QScript::DateTimeToMs(exec, value));
}
inline JSC::JSValue QScriptEnginePrivate::newObject()
@@ -979,12 +996,12 @@ inline JSC::UString QScriptEnginePrivate::toString(JSC::ExecState *exec, JSC::JS
return str;
}
-inline QDateTime QScriptEnginePrivate::toDateTime(JSC::ExecState *, JSC::JSValue value)
+inline QDateTime QScriptEnginePrivate::toDateTime(JSC::ExecState *exec, JSC::JSValue value)
{
if (!isDate(value))
return QDateTime();
qsreal t = static_cast<JSC::DateInstance*>(JSC::asObject(value))->internalNumber();
- return QScript::ToDateTime(t, Qt::LocalTime);
+ return QScript::MsToDateTime(exec, t);
}
inline QObject *QScriptEnginePrivate::toQObject(JSC::ExecState *exec, JSC::JSValue value)
diff --git a/src/script/bridge/bridge.pri b/src/script/bridge/bridge.pri
index 09e2dfb..ab0a322 100644
--- a/src/script/bridge/bridge.pri
+++ b/src/script/bridge/bridge.pri
@@ -6,6 +6,7 @@ SOURCES += \
$$PWD/qscriptqobject.cpp \
$$PWD/qscriptglobalobject.cpp \
$$PWD/qscriptactivationobject.cpp \
+ $$PWD/qscriptstaticscopeobject.cpp \
$$PWD/qscriptdeclarativeobject.cpp \
$$PWD/qscriptdeclarativeclass.cpp
@@ -17,5 +18,6 @@ HEADERS += \
$$PWD/qscriptqobject_p.h \
$$PWD/qscriptglobalobject_p.h \
$$PWD/qscriptactivationobject_p.h \
+ $$PWD/qscriptstaticscopeobject_p.h \
$$PWD/qscriptdeclarativeobject_p.h \
$$PWD/qscriptdeclarativeclass_p.h
diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp
index 1093448..8080b9f 100644
--- a/src/script/bridge/qscriptdeclarativeclass.cpp
+++ b/src/script/bridge/qscriptdeclarativeclass.cpp
@@ -24,6 +24,7 @@
#include "qscriptdeclarativeclass_p.h"
#include "qscriptdeclarativeobject_p.h"
#include "qscriptobject_p.h"
+#include "qscriptstaticscopeobject_p.h"
#include <QtScript/qscriptstring.h>
#include <QtScript/qscriptengine.h>
#include <QtScript/qscriptengineagent.h>
@@ -549,4 +550,39 @@ QScriptContext *QScriptDeclarativeClass::context() const
return d_ptr->context;
}
+/*!
+ Creates a scope object with a fixed set of undeletable properties.
+*/
+QScriptValue QScriptDeclarativeClass::newStaticScopeObject(
+ QScriptEngine *engine, int propertyCount, const QString *names,
+ const QScriptValue *values, const QScriptValue::PropertyFlags *flags)
+{
+ QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(engine);
+ QScript::APIShim shim(eng_p);
+ JSC::ExecState *exec = eng_p->currentFrame;
+ QScriptStaticScopeObject::PropertyInfo *props = new QScriptStaticScopeObject::PropertyInfo[propertyCount];
+ for (int i = 0; i < propertyCount; ++i) {
+ unsigned attribs = QScriptEnginePrivate::propertyFlagsToJSCAttributes(flags[i]);
+ Q_ASSERT_X(attribs & JSC::DontDelete, Q_FUNC_INFO, "All properties must be undeletable");
+ JSC::Identifier id = JSC::Identifier(exec, names[i]);
+ JSC::JSValue jsval = eng_p->scriptValueToJSCValue(values[i]);
+ props[i] = QScriptStaticScopeObject::PropertyInfo(id, jsval, attribs);
+ }
+ QScriptValue result = eng_p->scriptValueFromJSCValue(new (exec)QScriptStaticScopeObject(eng_p->staticScopeObjectStructure,
+ propertyCount, props));
+ delete[] props;
+ return result;
+}
+
+/*!
+ Creates a static scope object that's initially empty, but to which new
+ properties can be added.
+*/
+QScriptValue QScriptDeclarativeClass::newStaticScopeObject(QScriptEngine *engine)
+{
+ QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(engine);
+ QScript::APIShim shim(eng_p);
+ return eng_p->scriptValueFromJSCValue(new (eng_p->currentFrame)QScriptStaticScopeObject(eng_p->staticScopeObjectStructure));
+}
+
QT_END_NAMESPACE
diff --git a/src/script/bridge/qscriptdeclarativeclass_p.h b/src/script/bridge/qscriptdeclarativeclass_p.h
index 714a67c..420b133 100644
--- a/src/script/bridge/qscriptdeclarativeclass_p.h
+++ b/src/script/bridge/qscriptdeclarativeclass_p.h
@@ -92,6 +92,11 @@ public:
static QScriptValue scopeChainValue(QScriptContext *, int index);
static QScriptContext *pushCleanContext(QScriptEngine *);
+ static QScriptValue newStaticScopeObject(
+ QScriptEngine *, int propertyCount, const QString *names,
+ const QScriptValue *values, const QScriptValue::PropertyFlags *flags);
+ static QScriptValue newStaticScopeObject(QScriptEngine *);
+
class Q_SCRIPT_EXPORT PersistentIdentifier
{
public:
diff --git a/src/script/bridge/qscriptstaticscopeobject.cpp b/src/script/bridge/qscriptstaticscopeobject.cpp
new file mode 100644
index 0000000..44548a4
--- /dev/null
+++ b/src/script/bridge/qscriptstaticscopeobject.cpp
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL-ONLY$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "config.h"
+#include "qscriptstaticscopeobject_p.h"
+
+namespace JSC
+{
+ ASSERT_CLASS_FITS_IN_CELL(QT_PREPEND_NAMESPACE(QScriptStaticScopeObject));
+}
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QScriptStaticScopeObject
+ \internal
+
+ Represents a static scope object.
+
+ This class allows the VM to determine at JS script compile time whether
+ the object has a given property or not. If the object has the property,
+ a fast, index-based read/write operation will be used. If the object
+ doesn't have the property, the compiler knows it can safely skip this
+ object when dynamically resolving the property. Either way, this can
+ greatly improve performance.
+
+ \sa QScriptContext::pushScope()
+*/
+
+const JSC::ClassInfo QScriptStaticScopeObject::info = { "QScriptStaticScopeObject", 0, 0, 0 };
+
+/*!
+ Creates a static scope object with a fixed set of undeletable properties.
+
+ It's not possible to add new properties to the object after construction.
+*/
+QScriptStaticScopeObject::QScriptStaticScopeObject(WTF::NonNullPassRefPtr<JSC::Structure> structure,
+ int propertyCount, const PropertyInfo* props)
+ : JSC::JSVariableObject(structure, new Data(/*canGrow=*/false))
+{
+ int index = growRegisterArray(propertyCount);
+ for (int i = 0; i < propertyCount; ++i, --index) {
+ const PropertyInfo& prop = props[i];
+ JSC::SymbolTableEntry entry(index, prop.attributes);
+ symbolTable().add(prop.identifier.ustring().rep(), entry);
+ registerAt(index) = prop.value;
+ }
+}
+
+/*!
+ Creates an empty static scope object.
+
+ Properties can be added to the object after construction, either by
+ calling QScriptValue::setProperty(), or by pushing the object on the
+ scope chain; variable declarations ("var" statements) and function
+ declarations in JavaScript will create properties on the scope object.
+
+ Note that once the scope object has been used in a closure and the
+ resulting function has been compiled, it's no longer safe to add
+ properties to the scope object (because the VM will bypass this
+ object the next time the function is executed).
+*/
+QScriptStaticScopeObject::QScriptStaticScopeObject(WTF::NonNullPassRefPtr<JSC::Structure> structure)
+ : JSC::JSVariableObject(structure, new Data(/*canGrow=*/true))
+{
+}
+
+QScriptStaticScopeObject::~QScriptStaticScopeObject()
+{
+ delete d;
+}
+
+bool QScriptStaticScopeObject::getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot& slot)
+{
+ return symbolTableGet(propertyName, slot);
+}
+
+bool QScriptStaticScopeObject::getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor& descriptor)
+{
+ return symbolTableGet(propertyName, descriptor);
+}
+
+void QScriptStaticScopeObject::putWithAttributes(JSC::ExecState* exec, const JSC::Identifier &propertyName, JSC::JSValue value, unsigned attributes)
+{
+ if (symbolTablePutWithAttributes(propertyName, value, attributes))
+ return;
+ Q_ASSERT(d_ptr()->canGrow);
+ addSymbolTableProperty(propertyName, value, attributes);
+}
+
+void QScriptStaticScopeObject::put(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSValue value, JSC::PutPropertySlot&)
+{
+ if (symbolTablePut(propertyName, value))
+ return;
+ Q_ASSERT(d_ptr()->canGrow);
+ addSymbolTableProperty(propertyName, value, /*attributes=*/0);
+}
+
+bool QScriptStaticScopeObject::deleteProperty(JSC::ExecState*, const JSC::Identifier&)
+{
+ return false;
+}
+
+void QScriptStaticScopeObject::markChildren(JSC::MarkStack& markStack)
+{
+ JSC::Register* registerArray = d_ptr()->registerArray.get();
+ if (!registerArray)
+ return;
+ markStack.appendValues(reinterpret_cast<JSC::JSValue*>(registerArray), d_ptr()->registerArraySize);
+}
+
+void QScriptStaticScopeObject::addSymbolTableProperty(const JSC::Identifier& name, JSC::JSValue value, unsigned attributes)
+{
+ int index = growRegisterArray(1);
+ JSC::SymbolTableEntry newEntry(index, attributes | JSC::DontDelete);
+ symbolTable().add(name.ustring().rep(), newEntry);
+ registerAt(index) = value;
+}
+
+/*!
+ Grows the register array by \a count elements, and returns the offset of
+ the newly added elements (note that the register file grows downwards,
+ starting at index -1).
+*/
+int QScriptStaticScopeObject::growRegisterArray(int count)
+{
+ size_t oldSize = d_ptr()->registerArraySize;
+ size_t newSize = oldSize + count;
+ JSC::Register* registerArray = new JSC::Register[newSize];
+ if (d_ptr()->registerArray)
+ memcpy(registerArray + count, d_ptr()->registerArray.get(), oldSize * sizeof(JSC::Register));
+ setRegisters(registerArray + newSize, registerArray);
+ d_ptr()->registerArraySize = newSize;
+ return -oldSize - 1;
+}
+
+QT_END_NAMESPACE
diff --git a/src/script/bridge/qscriptstaticscopeobject_p.h b/src/script/bridge/qscriptstaticscopeobject_p.h
new file mode 100644
index 0000000..0a0e7ef
--- /dev/null
+++ b/src/script/bridge/qscriptstaticscopeobject_p.h
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL-ONLY$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSCRIPTSTATICSCOPEOBJECT_P_H
+#define QSCRIPTSTATICSCOPEOBJECT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobjectdefs.h>
+
+#include "JSVariableObject.h"
+
+QT_BEGIN_NAMESPACE
+
+class QScriptStaticScopeObject : public JSC::JSVariableObject {
+public:
+ struct PropertyInfo {
+ PropertyInfo(const JSC::Identifier& i, JSC::JSValue v, unsigned a)
+ : identifier(i), value(v), attributes(a)
+ { }
+ PropertyInfo() {}
+
+ JSC::Identifier identifier;
+ JSC::JSValue value;
+ unsigned attributes;
+ };
+
+ QScriptStaticScopeObject(WTF::NonNullPassRefPtr<JSC::Structure> structure,
+ int propertyCount, const PropertyInfo*);
+ QScriptStaticScopeObject(WTF::NonNullPassRefPtr<JSC::Structure> structure);
+ virtual ~QScriptStaticScopeObject();
+
+ virtual bool isDynamicScope() const { return false; }
+
+ virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
+
+ virtual void putWithAttributes(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue value, unsigned attributes);
+ virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue value, JSC::PutPropertySlot&);
+
+ virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier& propertyName);
+
+ virtual void markChildren(JSC::MarkStack&);
+
+ virtual const JSC::ClassInfo* classInfo() const { return &info; }
+ static const JSC::ClassInfo info;
+
+ static WTF::PassRefPtr<JSC::Structure> createStructure(JSC::JSValue proto) {
+ return JSC::Structure::create(proto, JSC::TypeInfo(JSC::ObjectType, StructureFlags));
+ }
+
+protected:
+ static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::NeedsThisConversion | JSC::OverridesMarkChildren | JSC::OverridesGetPropertyNames | JSC::JSVariableObject::StructureFlags;
+
+ struct Data : public JSVariableObjectData {
+ Data(bool canGrow_)
+ : JSVariableObjectData(&symbolTable, /*registers=*/0),
+ canGrow(canGrow_), registerArraySize(0)
+ { }
+ bool canGrow;
+ int registerArraySize;
+ JSC::SymbolTable symbolTable;
+ };
+
+ Data* d_ptr() const { return static_cast<Data*>(JSVariableObject::d); }
+
+private:
+ void addSymbolTableProperty(const JSC::Identifier&, JSC::JSValue, unsigned attributes);
+ int growRegisterArray(int);
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/script/script.pri b/src/script/script.pri
index 2ee1a82..9cd71d3 100644
--- a/src/script/script.pri
+++ b/src/script/script.pri
@@ -1,4 +1,3 @@
include($$PWD/api/api.pri)
include($$PWD/bridge/bridge.pri)
include($$PWD/parser/parser.pri)
-include($$PWD/utils/utils.pri)
diff --git a/src/script/utils/qscriptdate.cpp b/src/script/utils/qscriptdate.cpp
deleted file mode 100644
index 5980256..0000000
--- a/src/script/utils/qscriptdate.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtScript module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL-ONLY$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscriptdate_p.h"
-
-#include <QtCore/qnumeric.h>
-#include <QtCore/qstringlist.h>
-
-#include <math.h>
-
-#ifndef Q_WS_WIN
-# include <time.h>
-# include <sys/time.h>
-#else
-# include <windows.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-namespace QScript {
-
-qsreal ToInteger(qsreal n);
-
-static const qsreal HoursPerDay = 24.0;
-static const qsreal MinutesPerHour = 60.0;
-static const qsreal SecondsPerMinute = 60.0;
-static const qsreal msPerSecond = 1000.0;
-static const qsreal msPerMinute = 60000.0;
-static const qsreal msPerHour = 3600000.0;
-static const qsreal msPerDay = 86400000.0;
-
-static qsreal LocalTZA = 0.0; // initialized at startup
-
-static inline qsreal TimeWithinDay(qsreal t)
-{
- qsreal r = ::fmod(t, msPerDay);
- return (r >= 0) ? r : r + msPerDay;
-}
-
-static inline int HourFromTime(qsreal t)
-{
- int r = int(::fmod(::floor(t / msPerHour), HoursPerDay));
- return (r >= 0) ? r : r + int(HoursPerDay);
-}
-
-static inline int MinFromTime(qsreal t)
-{
- int r = int(::fmod(::floor(t / msPerMinute), MinutesPerHour));
- return (r >= 0) ? r : r + int(MinutesPerHour);
-}
-
-static inline int SecFromTime(qsreal t)
-{
- int r = int(::fmod(::floor(t / msPerSecond), SecondsPerMinute));
- return (r >= 0) ? r : r + int(SecondsPerMinute);
-}
-
-static inline int msFromTime(qsreal t)
-{
- int r = int(::fmod(t, msPerSecond));
- return (r >= 0) ? r : r + int(msPerSecond);
-}
-
-static inline qsreal Day(qsreal t)
-{
- return ::floor(t / msPerDay);
-}
-
-static inline qsreal DaysInYear(qsreal y)
-{
- if (::fmod(y, 4))
- return 365;
-
- else if (::fmod(y, 100))
- return 366;
-
- else if (::fmod(y, 400))
- return 365;
-
- return 366;
-}
-
-static inline qsreal DayFromYear(qsreal y)
-{
- return 365 * (y - 1970)
- + ::floor((y - 1969) / 4)
- - ::floor((y - 1901) / 100)
- + ::floor((y - 1601) / 400);
-}
-
-static inline qsreal TimeFromYear(qsreal y)
-{
- return msPerDay * DayFromYear(y);
-}
-
-static inline qsreal YearFromTime(qsreal t)
-{
- int y = 1970;
- y += (int) ::floor(t / (msPerDay * 365.2425));
-
- qsreal t2 = TimeFromYear(y);
- return (t2 > t) ? y - 1 : ((t2 + msPerDay * DaysInYear(y)) <= t) ? y + 1 : y;
-}
-
-static inline bool InLeapYear(qsreal t)
-{
- qsreal x = DaysInYear(YearFromTime(t));
- if (x == 365)
- return 0;
-
- Q_ASSERT (x == 366);
- return 1;
-}
-
-static inline qsreal DayWithinYear(qsreal t)
-{
- return Day(t) - DayFromYear(YearFromTime(t));
-}
-
-static inline qsreal MonthFromTime(qsreal t)
-{
- qsreal d = DayWithinYear(t);
- qsreal l = InLeapYear(t);
-
- if (d < 31.0)
- return 0;
-
- else if (d < 59.0 + l)
- return 1;
-
- else if (d < 90.0 + l)
- return 2;
-
- else if (d < 120.0 + l)
- return 3;
-
- else if (d < 151.0 + l)
- return 4;
-
- else if (d < 181.0 + l)
- return 5;
-
- else if (d < 212.0 + l)
- return 6;
-
- else if (d < 243.0 + l)
- return 7;
-
- else if (d < 273.0 + l)
- return 8;
-
- else if (d < 304.0 + l)
- return 9;
-
- else if (d < 334.0 + l)
- return 10;
-
- else if (d < 365.0 + l)
- return 11;
-
- return qSNaN(); // ### assert?
-}
-
-static inline qsreal DateFromTime(qsreal t)
-{
- int m = (int) ToInteger(MonthFromTime(t));
- qsreal d = DayWithinYear(t);
- qsreal l = InLeapYear(t);
-
- switch (m) {
- case 0: return d + 1.0;
- case 1: return d - 30.0;
- case 2: return d - 58.0 - l;
- case 3: return d - 89.0 - l;
- case 4: return d - 119.0 - l;
- case 5: return d - 150.0 - l;
- case 6: return d - 180.0 - l;
- case 7: return d - 211.0 - l;
- case 8: return d - 242.0 - l;
- case 9: return d - 272.0 - l;
- case 10: return d - 303.0 - l;
- case 11: return d - 333.0 - l;
- }
-
- return qSNaN(); // ### assert
-}
-
-static inline qsreal WeekDay(qsreal t)
-{
- qsreal r = ::fmod (Day(t) + 4.0, 7.0);
- return (r >= 0) ? r : r + 7.0;
-}
-
-
-static inline qsreal MakeTime(qsreal hour, qsreal min, qsreal sec, qsreal ms)
-{
- return ((hour * MinutesPerHour + min) * SecondsPerMinute + sec) * msPerSecond + ms;
-}
-
-static inline qsreal DayFromMonth(qsreal month, qsreal leap)
-{
- switch ((int) month) {
- case 0: return 0;
- case 1: return 31.0;
- case 2: return 59.0 + leap;
- case 3: return 90.0 + leap;
- case 4: return 120.0 + leap;
- case 5: return 151.0 + leap;
- case 6: return 181.0 + leap;
- case 7: return 212.0 + leap;
- case 8: return 243.0 + leap;
- case 9: return 273.0 + leap;
- case 10: return 304.0 + leap;
- case 11: return 334.0 + leap;
- }
-
- return qSNaN(); // ### assert?
-}
-
-static qsreal MakeDay(qsreal year, qsreal month, qsreal day)
-{
- year += ::floor(month / 12.0);
-
- month = ::fmod(month, 12.0);
- if (month < 0)
- month += 12.0;
-
- qsreal t = TimeFromYear(year);
- qsreal leap = InLeapYear(t);
-
- day += ::floor(t / msPerDay);
- day += DayFromMonth(month, leap);
-
- return day - 1;
-}
-
-static inline qsreal MakeDate(qsreal day, qsreal time)
-{
- return day * msPerDay + time;
-}
-
-static inline qsreal DaylightSavingTA(double t)
-{
-#ifndef Q_WS_WIN
- long int tt = (long int)(t / msPerSecond);
- struct tm *tmtm = localtime((const time_t*)&tt);
- if (! tmtm)
- return 0;
- return (tmtm->tm_isdst > 0) ? msPerHour : 0;
-#else
- Q_UNUSED(t);
- /// ### implement me
- return 0;
-#endif
-}
-
-static inline qsreal LocalTime(qsreal t)
-{
- return t + LocalTZA + DaylightSavingTA(t);
-}
-
-static inline qsreal UTC(qsreal t)
-{
- return t - LocalTZA - DaylightSavingTA(t - LocalTZA);
-}
-
-static inline qsreal TimeClip(qsreal t)
-{
- if (! qIsFinite(t) || fabs(t) > 8.64e15)
- return qSNaN();
- return ToInteger(t);
-}
-
-static qsreal getLocalTZA()
-{
-#ifndef Q_WS_WIN
- struct tm* t;
- time_t curr;
- time(&curr);
- t = localtime(&curr);
- time_t locl = mktime(t);
- t = gmtime(&curr);
- time_t globl = mktime(t);
- return double(locl - globl) * 1000.0;
-#else
- TIME_ZONE_INFORMATION tzInfo;
- GetTimeZoneInformation(&tzInfo);
- return -tzInfo.Bias * 60.0 * 1000.0;
-#endif
-}
-
-/*!
- \internal
-
- Converts the QDateTime \a dt to an ECMA Date value (in UTC form).
-*/
-qsreal FromDateTime(const QDateTime &dt)
-{
- if (!dt.isValid())
- return qSNaN();
- if (!LocalTZA) // ### move
- LocalTZA = getLocalTZA();
- QDate date = dt.date();
- QTime taim = dt.time();
- int year = date.year();
- int month = date.month() - 1;
- int day = date.day();
- int hours = taim.hour();
- int mins = taim.minute();
- int secs = taim.second();
- int ms = taim.msec();
- double t = MakeDate(MakeDay(year, month, day),
- MakeTime(hours, mins, secs, ms));
- if (dt.timeSpec() == Qt::LocalTime)
- t = UTC(t);
- return TimeClip(t);
-}
-
-/*!
- \internal
-
- Converts the ECMA Date value \tt (in UTC form) to QDateTime
- according to \a spec.
-*/
-QDateTime ToDateTime(qsreal t, Qt::TimeSpec spec)
-{
- if (qIsNaN(t))
- return QDateTime();
- if (!LocalTZA) // ### move
- LocalTZA = getLocalTZA();
- if (spec == Qt::LocalTime)
- t = LocalTime(t);
- int year = int(YearFromTime(t));
- int month = int(MonthFromTime(t) + 1);
- int day = int(DateFromTime(t));
- int hours = HourFromTime(t);
- int mins = MinFromTime(t);
- int secs = SecFromTime(t);
- int ms = msFromTime(t);
- return QDateTime(QDate(year, month, day), QTime(hours, mins, secs, ms), spec);
-}
-
-} // namespace QScript
-
-QT_END_NAMESPACE
diff --git a/src/script/utils/qscriptdate_p.h b/src/script/utils/qscriptdate_p.h
deleted file mode 100644
index b9c9fd4..0000000
--- a/src/script/utils/qscriptdate_p.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtScript module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL-ONLY$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCRIPTDATE_P_H
-#define QSCRIPTDATE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qdatetime.h>
-
-QT_BEGIN_NAMESPACE
-
-typedef double qsreal;
-
-namespace QScript
-{
- qsreal FromDateTime(const QDateTime &dt);
- QDateTime ToDateTime(qsreal t, Qt::TimeSpec spec);
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/script/utils/utils.pri b/src/script/utils/utils.pri
deleted file mode 100644
index d8302d5..0000000
--- a/src/script/utils/utils.pri
+++ /dev/null
@@ -1,5 +0,0 @@
-SOURCES += \
- $$PWD/qscriptdate.cpp
-
-HEADERS += \
- $$PWD/qscriptdate_p.h
diff --git a/src/src.pro b/src/src.pro
index 0d7404d..0573c2d 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -18,13 +18,13 @@ contains(QT_CONFIG, xmlpatterns): SRC_SUBDIRS += src_xmlpatterns
contains(QT_CONFIG, phonon): SRC_SUBDIRS += src_phonon
contains(QT_CONFIG, multimedia): SRC_SUBDIRS += src_multimedia
contains(QT_CONFIG, svg): SRC_SUBDIRS += src_svg
+contains(QT_CONFIG, script): SRC_SUBDIRS += src_script
+contains(QT_CONFIG, declarative): SRC_SUBDIRS += src_declarative
contains(QT_CONFIG, webkit) {
exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): SRC_SUBDIRS += src_javascriptcore
SRC_SUBDIRS += src_webkit
}
-contains(QT_CONFIG, script): SRC_SUBDIRS += src_script
!contains(QT_CONFIG, no-gui):contains(QT_CONFIG, scripttools): SRC_SUBDIRS += src_scripttools
-contains(QT_CONFIG, declarative): SRC_SUBDIRS += src_declarative
SRC_SUBDIRS += src_plugins
contains(QT_CONFIG, declarative): SRC_SUBDIRS += src_imports
contains(QT_CONFIG, declarative):contains(QT_CONFIG, webkit): SRC_SUBDIRS += src_webkit_declarative
diff --git a/tests/auto/qbearertestcommon.h b/tests/auto/qbearertestcommon.h
index c9df249..138c444 100644
--- a/tests/auto/qbearertestcommon.h
+++ b/tests/auto/qbearertestcommon.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp
index e4f2486..24f6e52 100644
--- a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp
+++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp
@@ -75,17 +75,20 @@ private slots:
void robustnessBombing();
+ void sessionClosing_data();
+ void sessionClosing();
+
void outOfProcessSession();
void invalidSession();
void repeatedOpenClose_data();
void repeatedOpenClose();
-
- void roamingErrorCodes();
-
+
void sessionStop_data();
void sessionStop();
+ void roamingErrorCodes();
+
void sessionProperties_data();
void sessionProperties();
@@ -131,6 +134,7 @@ void tst_QNetworkSession::initTestCase()
// If you wish to skip tests, set value as false. This is often very convinient because tests are so lengthy.
// Better way still would be to make this readable from a file.
testsToRun["robustnessBombing"] = true;
+ testsToRun["sessionClosing"] = true;
testsToRun["outOfProcessSession"] = true;
testsToRun["invalidSession"] = true;
testsToRun["repeatedOpenClose"] = true;
@@ -265,6 +269,53 @@ void tst_QNetworkSession::robustnessBombing()
testSession.reject();
}
+void tst_QNetworkSession::sessionClosing_data() {
+ QTest::addColumn<QString>("bearerType");
+ QTest::addColumn<QNetworkConfiguration::Type>("configurationType");
+
+ QTest::newRow("WLAN_IAP") << "WLAN" << QNetworkConfiguration::InternetAccessPoint;
+ QTest::newRow("Cellular_IAP") << "cellular" << QNetworkConfiguration::InternetAccessPoint;
+ QTest::newRow("SNAP") << "bearer_type_not_relevant_with_SNAPs" << QNetworkConfiguration::ServiceNetwork;
+}
+
+// Testcase for closing the session at unexpected times
+void tst_QNetworkSession::sessionClosing()
+{
+ if (!testsToRun["sessionClosing"]) {
+ QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll);
+ }
+ QFETCH(QString, bearerType);
+ QFETCH(QNetworkConfiguration::Type, configurationType);
+
+ // Update configurations so that WLANs are discovered too.
+ updateConfigurations();
+
+ // First check that opening once succeeds and determine if test is doable
+ QNetworkConfiguration config = suitableConfiguration(bearerType, configurationType);
+ if (!config.isValid()) {
+ QSKIP("No suitable configurations, skipping this round of repeated open-close test.", SkipSingle);
+ }
+ qDebug() << "Using following configuration to bomb with close(): " << config.name();
+ QNetworkSession session(config);
+ if (!openSession(&session) ||
+ !closeSession(&session)) {
+ QSKIP("Unable to open/close session, skipping this round of close() bombing.", SkipSingle);
+ }
+
+ qDebug() << "Closing without issuing open()";
+ session.close();
+
+ for (int i = 0; i < 25; i++) {
+ qDebug() << "Opening and then waiting: " << i * 100 << " ms before closing.";
+ session.open();
+ QTest::qWait(i*100);
+ session.close();
+ // Sooner or later session must end in Disconnected state,
+ // no matter what the phase was.
+ QTRY_VERIFY(session.state() == QNetworkSession::Disconnected);
+ QTest::qWait(200); // Give platform a breathe, otherwise we'll be catching other errors
+ }
+}
void tst_QNetworkSession::invalidSession()
{
@@ -629,7 +680,7 @@ void tst_QNetworkSession::sessionStop()
QVERIFY(openSession(&innocentSession));
qDebug("Waiting for %d ms after open to make sure all platform indications are propagated", configWaitdelayInMs);
QTest::qWait(configWaitdelayInMs);
- qDebug("----------4.2 Calling closedSession.stop()");
+ qDebug("----------4.2 Calling closedSession.stop()");
closedSession.stop();
qDebug("Waiting for %d ms to get all configurationChange signals from platform..", configWaitdelayInMs);
QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals
@@ -1037,21 +1088,28 @@ void tst_QNetworkSession::sessionOpenCloseStop()
if (configuration.type() == QNetworkConfiguration::ServiceNetwork) {
bool roamedSuccessfully = false;
- QCOMPARE(stateChangedSpy2.count(), 4);
+ QNetworkSession::State state;
+ if (stateChangedSpy2.count() == 4) {
+ state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(0).at(0));
+ QVERIFY(state == QNetworkSession::Connecting);
- QNetworkSession::State state =
- qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(0).at(0));
- QVERIFY(state == QNetworkSession::Connecting);
+ state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(1).at(0));
+ QVERIFY(state == QNetworkSession::Connected);
- state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(1).at(0));
- QVERIFY(state == QNetworkSession::Connected);
+ state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(2).at(0));
+ QVERIFY(state == QNetworkSession::Closing);
- state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(2).at(0));
- QVERIFY(state == QNetworkSession::Closing);
+ state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(3).at(0));
+ QVERIFY(state == QNetworkSession::Disconnected);
+ } else if (stateChangedSpy2.count() == 2) {
+ state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(0).at(0));
+ QVERIFY(state == QNetworkSession::Closing);
- state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(3).at(0));
- QVERIFY(state == QNetworkSession::Disconnected);
-
+ state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(1).at(0));
+ QVERIFY(state == QNetworkSession::Disconnected);
+ } else {
+ QFAIL("Unexpected amount of state changes when roaming.");
+ }
QTRY_VERIFY(session.state() == QNetworkSession::Roaming ||
session.state() == QNetworkSession::Connected ||
@@ -1060,30 +1118,44 @@ void tst_QNetworkSession::sessionOpenCloseStop()
QTRY_VERIFY(stateChangedSpy.count() > 0);
state = qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(stateChangedSpy.count() - 1).at(0));
+ for (int i = 0; i < stateChangedSpy.count(); i++) {
+ QNetworkSession::State state_temp =
+ qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(i).at(0));
+ // Extra debug because a fragile point in testcase because statuses vary.
+ qDebug() << "------- Statechange spy at: " << i << " is " << state_temp;
+ }
+
if (state == QNetworkSession::Roaming) {
QTRY_VERIFY(session.state() == QNetworkSession::Connected);
QTRY_VERIFY(session2.state() == QNetworkSession::Connected);
roamedSuccessfully = true;
+ } else if (state == QNetworkSession::Closing) {
+ QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected);
+ QTRY_VERIFY(session.state() == QNetworkSession::Connected);
+ roamedSuccessfully = true;
} else if (state == QNetworkSession::Disconnected) {
QTRY_VERIFY(!errorSpy.isEmpty());
QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected);
} else if (state == QNetworkSession::Connected) {
QTRY_VERIFY(errorSpy.isEmpty());
+
if (stateChangedSpy.count() > 1) {
state = qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(stateChangedSpy.count() - 2).at(0));
QVERIFY(state == QNetworkSession::Roaming);
}
roamedSuccessfully = true;
- }
+ }
if (roamedSuccessfully) {
+ // Verify that you can open session based on the disconnected configuration
QString configId = session.sessionProperty("ActiveConfiguration").toString();
- QNetworkConfiguration config = manager.configurationFromIdentifier(configId);
+ QNetworkConfiguration config = manager.configurationFromIdentifier(configId);
QNetworkSession session3(config);
QSignalSpy errorSpy3(&session3, SIGNAL(error(QNetworkSession::SessionError)));
QSignalSpy sessionOpenedSpy3(&session3, SIGNAL(opened()));
session3.open();
- session3.waitForOpened();
+ session3.waitForOpened();
+ QTest::qWait(1000); // Wait awhile to get all signals from platform
if (session.isOpen())
QVERIFY(!sessionOpenedSpy3.isEmpty() || !errorSpy3.isEmpty());
session.stop();
@@ -1102,9 +1174,18 @@ void tst_QNetworkSession::sessionOpenCloseStop()
QVERIFY(state == QNetworkSession::Closing);
state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(1).at(0));
QVERIFY(state == QNetworkSession::Disconnected);
- } else { // Assume .count() == 1
- QCOMPARE(stateChangedSpy2.count(), 1);
- QNetworkSession::State state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(0).at(0));
+ } else {
+ QVERIFY(stateChangedSpy2.count() >= 1);
+
+ for (int i = 0; i < stateChangedSpy2.count(); i++) {
+ QNetworkSession::State state_temp =
+ qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(i).at(0));
+ // Extra debug because a fragile point in testcase.
+ qDebug() << "+++++ Statechange spy at: " << i << " is " << state_temp;
+ }
+
+ QNetworkSession::State state =
+ qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(stateChangedSpy2.count() - 1).at(0));
// Symbian version dependant.
QVERIFY(state == QNetworkSession::Disconnected);
}
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 5e59950..6885adf 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -51,6 +51,8 @@
#include <QtCore/qnumeric.h>
#include <stdlib.h>
+#include <QtScript/private/qscriptdeclarativeclass_p.h>
+
Q_DECLARE_METATYPE(QList<int>)
Q_DECLARE_METATYPE(QObjectList)
Q_DECLARE_METATYPE(QScriptProgram)
@@ -169,6 +171,8 @@ private slots:
void qRegExpInport_data();
void qRegExpInport();
void reentrency();
+ void newFixedStaticScopeObject();
+ void newGrowingStaticScopeObject();
};
tst_QScriptEngine::tst_QScriptEngine()
@@ -4955,5 +4959,243 @@ void tst_QScriptEngine::reentrency()
QCOMPARE(eng.evaluate("foo() + hello").toInt32(), 5+6+9);
}
+void tst_QScriptEngine::newFixedStaticScopeObject()
+{
+ QScriptEngine eng;
+ static const int propertyCount = 4;
+ QString names[] = { "foo", "bar", "baz", "Math" };
+ QScriptValue values[] = { 123, "ciao", true, false };
+ QScriptValue::PropertyFlags flags[] = { QScriptValue::Undeletable,
+ QScriptValue::ReadOnly | QScriptValue::Undeletable,
+ QScriptValue::SkipInEnumeration | QScriptValue::Undeletable,
+ QScriptValue::Undeletable };
+ QScriptValue scope = QScriptDeclarativeClass::newStaticScopeObject(&eng, propertyCount, names, values, flags);
+
+ // Query property.
+ for (int i = 0; i < propertyCount; ++i) {
+ for (int x = 0; x < 2; ++x) {
+ if (x) {
+ // Properties can't be deleted.
+ scope.setProperty(names[i], QScriptValue());
+ }
+ QVERIFY(scope.property(names[i]).equals(values[i]));
+ QCOMPARE(scope.propertyFlags(names[i]), flags[i]);
+ }
+ }
+
+ // Property that doesn't exist.
+ QVERIFY(!scope.property("noSuchProperty").isValid());
+ QCOMPARE(scope.propertyFlags("noSuchProperty"), QScriptValue::PropertyFlags());
+
+ // Write to writable property.
+ {
+ QScriptValue oldValue = scope.property("foo");
+ QVERIFY(oldValue.isNumber());
+ QScriptValue newValue = oldValue.toNumber() * 2;
+ scope.setProperty("foo", newValue);
+ QVERIFY(scope.property("foo").equals(newValue));
+ scope.setProperty("foo", oldValue);
+ QVERIFY(scope.property("foo").equals(oldValue));
+ }
+
+ // Write to read-only property.
+ scope.setProperty("bar", 456);
+ QVERIFY(scope.property("bar").equals("ciao"));
+
+ // Iterate.
+ {
+ QScriptValueIterator it(scope);
+ QSet<QString> iteratedNames;
+ while (it.hasNext()) {
+ it.next();
+ iteratedNames.insert(it.name());
+ }
+ for (int i = 0; i < propertyCount; ++i)
+ QVERIFY(iteratedNames.contains(names[i]));
+ }
+
+ // Push it on the scope chain of a new context.
+ QScriptContext *ctx = eng.pushContext();
+ ctx->pushScope(scope);
+ QCOMPARE(ctx->scopeChain().size(), 3); // Global Object, native activation, custom scope
+ QVERIFY(ctx->activationObject().equals(scope));
+
+ // Read property from JS.
+ for (int i = 0; i < propertyCount; ++i) {
+ for (int x = 0; x < 2; ++x) {
+ if (x) {
+ // Property can't be deleted from JS.
+ QScriptValue ret = eng.evaluate(QString::fromLatin1("delete %0").arg(names[i]));
+ QVERIFY(ret.equals(false));
+ }
+ QVERIFY(eng.evaluate(names[i]).equals(values[i]));
+ }
+ }
+
+ // Property that doesn't exist.
+ QVERIFY(eng.evaluate("noSuchProperty").equals("ReferenceError: Can't find variable: noSuchProperty"));
+
+ // Write property from JS.
+ {
+ QScriptValue oldValue = eng.evaluate("foo");
+ QVERIFY(oldValue.isNumber());
+ QScriptValue newValue = oldValue.toNumber() * 2;
+ QVERIFY(eng.evaluate("foo = foo * 2; foo").equals(newValue));
+ scope.setProperty("foo", oldValue);
+ QVERIFY(eng.evaluate("foo").equals(oldValue));
+ }
+
+ // Write to read-only property.
+ QVERIFY(eng.evaluate("bar = 456; bar").equals("ciao"));
+
+ // Create a closure and return properties from there.
+ {
+ QScriptValue props = eng.evaluate("(function() { var baz = 'shadow'; return [foo, bar, baz, Math, Array]; })()");
+ QVERIFY(props.isArray());
+ // "foo" and "bar" come from scope object.
+ QVERIFY(props.property(0).equals(scope.property("foo")));
+ QVERIFY(props.property(1).equals(scope.property("bar")));
+ // "baz" shadows property in scope object.
+ QVERIFY(props.property(2).equals("shadow"));
+ // "Math" comes from scope object, and shadows Global Object's "Math".
+ QVERIFY(props.property(3).equals(scope.property("Math")));
+ QVERIFY(!props.property(3).equals(eng.globalObject().property("Math")));
+ // "Array" comes from Global Object.
+ QVERIFY(props.property(4).equals(eng.globalObject().property("Array")));
+ }
+
+ // As with normal JS, assigning to an undefined variable will create
+ // the property on the Global Object, not the inner scope.
+ QVERIFY(!eng.globalObject().property("newProperty").isValid());
+ QVERIFY(eng.evaluate("(function() { newProperty = 789; })()").isUndefined());
+ QVERIFY(!scope.property("newProperty").isValid());
+ QVERIFY(eng.globalObject().property("newProperty").isNumber());
+
+ // Nested static scope.
+ {
+ static const int propertyCount2 = 2;
+ QString names2[] = { "foo", "hum" };
+ QScriptValue values2[] = { 321, "hello" };
+ QScriptValue::PropertyFlags flags2[] = { QScriptValue::Undeletable,
+ QScriptValue::ReadOnly | QScriptValue::Undeletable };
+ QScriptValue scope2 = QScriptDeclarativeClass::newStaticScopeObject(&eng, propertyCount2, names2, values2, flags2);
+ ctx->pushScope(scope2);
+
+ // "foo" shadows scope.foo.
+ QVERIFY(eng.evaluate("foo").equals(scope2.property("foo")));
+ QVERIFY(!eng.evaluate("foo").equals(scope.property("foo")));
+ // "hum" comes from scope2.
+ QVERIFY(eng.evaluate("hum").equals(scope2.property("hum")));
+ // "Array" comes from Global Object.
+ QVERIFY(eng.evaluate("Array").equals(eng.globalObject().property("Array")));
+
+ ctx->popScope();
+ }
+
+ QScriptValue fun = eng.evaluate("(function() { return foo; })");
+ QVERIFY(fun.isFunction());
+ eng.popContext();
+ // Function's scope chain persists after popContext().
+ QVERIFY(fun.call().equals(scope.property("foo")));
+}
+
+void tst_QScriptEngine::newGrowingStaticScopeObject()
+{
+ QScriptEngine eng;
+ QScriptValue scope = QScriptDeclarativeClass::newStaticScopeObject(&eng);
+
+ // Initially empty.
+ QVERIFY(!QScriptValueIterator(scope).hasNext());
+ QVERIFY(!scope.property("foo").isValid());
+
+ // Add a static property.
+ scope.setProperty("foo", 123);
+ QVERIFY(scope.property("foo").equals(123));
+ QCOMPARE(scope.propertyFlags("foo"), QScriptValue::Undeletable);
+
+ // Modify existing property.
+ scope.setProperty("foo", 456);
+ QVERIFY(scope.property("foo").equals(456));
+
+ // Add a read-only property.
+ scope.setProperty("bar", "ciao", QScriptValue::ReadOnly);
+ QVERIFY(scope.property("bar").equals("ciao"));
+ QCOMPARE(scope.propertyFlags("bar"), QScriptValue::ReadOnly | QScriptValue::Undeletable);
+
+ // Attempt to modify read-only property.
+ scope.setProperty("bar", "hello");
+ QVERIFY(scope.property("bar").equals("ciao"));
+
+ // Properties can't be deleted.
+ scope.setProperty("foo", QScriptValue());
+ QVERIFY(scope.property("foo").equals(456));
+ scope.setProperty("bar", QScriptValue());
+ QVERIFY(scope.property("bar").equals("ciao"));
+
+ // Iterate.
+ {
+ QScriptValueIterator it(scope);
+ QSet<QString> iteratedNames;
+ while (it.hasNext()) {
+ it.next();
+ iteratedNames.insert(it.name());
+ }
+ QCOMPARE(iteratedNames.size(), 2);
+ QVERIFY(iteratedNames.contains("foo"));
+ QVERIFY(iteratedNames.contains("bar"));
+ }
+
+ // Push it on the scope chain of a new context.
+ QScriptContext *ctx = eng.pushContext();
+ ctx->pushScope(scope);
+ QCOMPARE(ctx->scopeChain().size(), 3); // Global Object, native activation, custom scope
+ QVERIFY(ctx->activationObject().equals(scope));
+
+ // Read property from JS.
+ QVERIFY(eng.evaluate("foo").equals(scope.property("foo")));
+ QVERIFY(eng.evaluate("bar").equals(scope.property("bar")));
+
+ // Write property from JS.
+ {
+ QScriptValue oldValue = eng.evaluate("foo");
+ QVERIFY(oldValue.isNumber());
+ QScriptValue newValue = oldValue.toNumber() * 2;
+ QVERIFY(eng.evaluate("foo = foo * 2; foo").equals(newValue));
+ scope.setProperty("foo", oldValue);
+ QVERIFY(eng.evaluate("foo").equals(oldValue));
+ }
+
+ // Write to read-only property.
+ QVERIFY(eng.evaluate("bar = 456; bar").equals("ciao"));
+
+ // Shadow property.
+ QVERIFY(eng.evaluate("Math").equals(eng.globalObject().property("Math")));
+ scope.setProperty("Math", "fake Math");
+ QVERIFY(eng.evaluate("Math").equals(scope.property("Math")));
+
+ // Variable declarations will create properties on the scope.
+ eng.evaluate("var baz = 456");
+ QVERIFY(scope.property("baz").equals(456));
+
+ // Function declarations will create properties on the scope.
+ eng.evaluate("function fun() { return baz; }");
+ QVERIFY(scope.property("fun").isFunction());
+ QVERIFY(scope.property("fun").call().equals(scope.property("baz")));
+
+ // Demonstrate the limitation of a growable static scope: Once a function that
+ // uses the scope has been compiled, it won't pick up properties that are added
+ // to the scope later.
+ {
+ QScriptValue fun = eng.evaluate("(function() { return futureProperty; })");
+ QVERIFY(fun.isFunction());
+ QCOMPARE(fun.call().toString(), QString::fromLatin1("ReferenceError: Can't find variable: futureProperty"));
+ scope.setProperty("futureProperty", "added after the function was compiled");
+ // If scope were dynamic, this would return the new property.
+ QCOMPARE(fun.call().toString(), QString::fromLatin1("ReferenceError: Can't find variable: futureProperty"));
+ }
+
+ eng.popContext();
+}
+
QTEST_MAIN(tst_QScriptEngine)
#include "tst_qscriptengine.moc"
diff --git a/tests/auto/qsemaphore/tst_qsemaphore.cpp b/tests/auto/qsemaphore/tst_qsemaphore.cpp
index ace33dc..7cede30 100644
--- a/tests/auto/qsemaphore/tst_qsemaphore.cpp
+++ b/tests/auto/qsemaphore/tst_qsemaphore.cpp
@@ -63,6 +63,7 @@ private slots:
void tryAcquire();
void tryAcquireWithTimeout_data();
void tryAcquireWithTimeout();
+ void tryAcquireWithTimeoutStarvation();
void release();
void available();
void producerConsumer();
@@ -232,8 +233,8 @@ void tst_QSemaphore::tryAcquireWithTimeout_data()
{
QTest::addColumn<int>("timeout");
- QTest::newRow("") << 1000;
- QTest::newRow("") << 10000;
+ QTest::newRow("1s") << 1000;
+ QTest::newRow("10s") << 10000;
}
void tst_QSemaphore::tryAcquireWithTimeout()
@@ -316,6 +317,50 @@ void tst_QSemaphore::tryAcquireWithTimeout()
QCOMPARE(semaphore.available(), 0);
}
+void tst_QSemaphore::tryAcquireWithTimeoutStarvation()
+{
+ class Thread : public QThread
+ {
+ public:
+ QSemaphore startup;
+ QSemaphore *semaphore;
+ int amountToConsume, timeout;
+
+ void run()
+ {
+ startup.release();
+ forever {
+ if (!semaphore->tryAcquire(amountToConsume, timeout))
+ break;
+ semaphore->release(amountToConsume);
+ }
+ }
+ };
+
+ QSemaphore semaphore;
+ semaphore.release(1);
+
+ Thread consumer;
+ consumer.semaphore = &semaphore;
+ consumer.amountToConsume = 1;
+ consumer.timeout = 1000;
+
+ // start the thread and wait for it to start consuming
+ consumer.start();
+ consumer.startup.acquire();
+
+ // try to consume more than the thread we started is, and provide a longer
+ // timeout... we should timeout, not wait indefinitely
+ QVERIFY(!semaphore.tryAcquire(consumer.amountToConsume * 2, consumer.timeout * 2));
+
+ // the consumer should still be running
+ QVERIFY(consumer.isRunning() && !consumer.isFinished());
+
+ // acquire, and wait for smallConsumer to timeout
+ semaphore.acquire();
+ QVERIFY(consumer.wait());
+}
+
void tst_QSemaphore::release()
{ DEPENDS_ON("acquire"); }
diff --git a/tests/auto/qvideoframe/tst_qvideoframe.cpp b/tests/auto/qvideoframe/tst_qvideoframe.cpp
index 944bb59..3176af0 100644
--- a/tests/auto/qvideoframe/tst_qvideoframe.cpp
+++ b/tests/auto/qvideoframe/tst_qvideoframe.cpp
@@ -79,6 +79,8 @@ private slots:
void mapImage_data();
void mapImage();
void imageDetach();
+ void formatConversion_data();
+ void formatConversion();
};
Q_DECLARE_METATYPE(QImage::Format)
@@ -658,6 +660,132 @@ void tst_QVideoFrame::imageDetach()
QCOMPARE(image.pixel(4, 4), red);
}
+void tst_QVideoFrame::formatConversion_data()
+{
+ QTest::addColumn<QImage::Format>("imageFormat");
+ QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
+
+ QTest::newRow("QImage::Format_RGB32 | QVideoFrame::Format_RGB32")
+ << QImage::Format_RGB32
+ << QVideoFrame::Format_RGB32;
+ QTest::newRow("QImage::Format_ARGB32 | QVideoFrame::Format_ARGB32")
+ << QImage::Format_ARGB32
+ << QVideoFrame::Format_ARGB32;
+ QTest::newRow("QImage::Format_ARGB32_Premultiplied | QVideoFrame::Format_ARGB32_Premultiplied")
+ << QImage::Format_ARGB32_Premultiplied
+ << QVideoFrame::Format_ARGB32_Premultiplied;
+ QTest::newRow("QImage::Format_RGB16 | QVideoFrame::Format_RGB565")
+ << QImage::Format_RGB16
+ << QVideoFrame::Format_RGB565;
+ QTest::newRow("QImage::Format_ARGB8565_Premultiplied | QVideoFrame::Format_ARGB8565_Premultiplied")
+ << QImage::Format_ARGB8565_Premultiplied
+ << QVideoFrame::Format_ARGB8565_Premultiplied;
+ QTest::newRow("QImage::Format_RGB555 | QVideoFrame::Format_RGB555")
+ << QImage::Format_RGB555
+ << QVideoFrame::Format_RGB555;
+ QTest::newRow("QImage::Format_RGB888 | QVideoFrame::Format_RGB24")
+ << QImage::Format_RGB888
+ << QVideoFrame::Format_RGB24;
+
+ QTest::newRow("QImage::Format_MonoLSB")
+ << QImage::Format_MonoLSB
+ << QVideoFrame::Format_Invalid;
+ QTest::newRow("QImage::Format_Indexed8")
+ << QImage::Format_Indexed8
+ << QVideoFrame::Format_Invalid;
+ QTest::newRow("QImage::Format_ARGB6666_Premultiplied")
+ << QImage::Format_ARGB6666_Premultiplied
+ << QVideoFrame::Format_Invalid;
+ QTest::newRow("QImage::Format_ARGB8555_Premultiplied")
+ << QImage::Format_ARGB8555_Premultiplied
+ << QVideoFrame::Format_Invalid;
+ QTest::newRow("QImage::Format_RGB666")
+ << QImage::Format_RGB666
+ << QVideoFrame::Format_Invalid;
+ QTest::newRow("QImage::Format_RGB444")
+ << QImage::Format_RGB444
+ << QVideoFrame::Format_Invalid;
+ QTest::newRow("QImage::Format_ARGB4444_Premultiplied")
+ << QImage::Format_ARGB4444_Premultiplied
+ << QVideoFrame::Format_Invalid;
+
+ QTest::newRow("QVideoFrame::Format_BGRA32")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_BGRA32;
+ QTest::newRow("QVideoFrame::Format_BGRA32_Premultiplied")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_BGRA32_Premultiplied;
+ QTest::newRow("QVideoFrame::Format_BGR32")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_BGR32;
+ QTest::newRow("QVideoFrame::Format_BGR24")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_BGR24;
+ QTest::newRow("QVideoFrame::Format_BGR565")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_BGR565;
+ QTest::newRow("QVideoFrame::Format_BGR555")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_BGR555;
+ QTest::newRow("QVideoFrame::Format_BGRA5658_Premultiplied")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_BGRA5658_Premultiplied;
+ QTest::newRow("QVideoFrame::Format_AYUV444")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_AYUV444;
+ QTest::newRow("QVideoFrame::Format_AYUV444_Premultiplied")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_AYUV444_Premultiplied;
+ QTest::newRow("QVideoFrame::Format_YUV444")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_YUV420P;
+ QTest::newRow("QVideoFrame::Format_YV12")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_YV12;
+ QTest::newRow("QVideoFrame::Format_UYVY")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_UYVY;
+ QTest::newRow("QVideoFrame::Format_YUYV")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_YUYV;
+ QTest::newRow("QVideoFrame::Format_NV12")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_NV12;
+ QTest::newRow("QVideoFrame::Format_NV21")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_NV21;
+ QTest::newRow("QVideoFrame::Format_IMC1")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_IMC1;
+ QTest::newRow("QVideoFrame::Format_IMC2")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_IMC2;
+ QTest::newRow("QVideoFrame::Format_IMC3")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_IMC3;
+ QTest::newRow("QVideoFrame::Format_IMC4")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_IMC4;
+ QTest::newRow("QVideoFrame::Format_Y8")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_Y8;
+ QTest::newRow("QVideoFrame::Format_Y16")
+ << QImage::Format_Invalid
+ << QVideoFrame::Format_Y16;
+}
+
+void tst_QVideoFrame::formatConversion()
+{
+ QFETCH(QImage::Format, imageFormat);
+ QFETCH(QVideoFrame::PixelFormat, pixelFormat);
+
+ QCOMPARE(QVideoFrame::pixelFormatFromImageFormat(imageFormat) == pixelFormat,
+ imageFormat != QImage::Format_Invalid);
+
+ QCOMPARE(QVideoFrame::imageFormatFromPixelFormat(pixelFormat) == imageFormat,
+ pixelFormat != QVideoFrame::Format_Invalid);
+}
+
QTEST_MAIN(tst_QVideoFrame)
#include "tst_qvideoframe.moc"
diff --git a/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp
index 35e2f28..4610046 100644
--- a/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp
@@ -42,6 +42,8 @@
#include <qtest.h>
#include <QtScript>
+#include <QtScript/private/qscriptdeclarativeclass_p.h>
+
//TESTED_FILES=
class tst_QScriptEngine : public QObject
@@ -74,6 +76,8 @@ private slots:
void nativeCall();
void translation_data();
void translation();
+ void readScopeProperty_data();
+ void readScopeProperty();
};
tst_QScriptEngine::tst_QScriptEngine()
@@ -288,5 +292,53 @@ void tst_QScriptEngine::translation()
}
}
+void tst_QScriptEngine::readScopeProperty_data()
+{
+ QTest::addColumn<bool>("staticScope");
+ QTest::addColumn<bool>("nestedScope");
+ QTest::newRow("single dynamic scope") << false << false;
+ QTest::newRow("single static scope") << true << false;
+ QTest::newRow("double dynamic scope") << false << true;
+ QTest::newRow("double static scope") << true << true;
+}
+
+void tst_QScriptEngine::readScopeProperty()
+{
+ QFETCH(bool, staticScope);
+ QFETCH(bool, nestedScope);
+
+ QScriptEngine engine;
+ QScriptContext *ctx = engine.pushContext();
+
+ QScriptValue scope;
+ if (staticScope)
+ scope = QScriptDeclarativeClass::newStaticScopeObject(&engine);
+ else
+ scope = engine.newObject();
+ scope.setProperty("foo", 123);
+ ctx->pushScope(scope);
+
+ if (nestedScope) {
+ QScriptValue scope2;
+ if (staticScope)
+ scope2 = QScriptDeclarativeClass::newStaticScopeObject(&engine);
+ else
+ scope2 = engine.newObject();
+ scope2.setProperty("bar", 456); // ensure a miss in inner scope
+ ctx->pushScope(scope2);
+ }
+
+ QScriptValue fun = engine.evaluate("(function() {\n"
+ " for (var i = 0; i < 10000; ++i) {\n"
+ " foo; foo; foo; foo; foo; foo; foo; foo;\n"
+ " }\n"
+ "})");
+ engine.popContext();
+ QVERIFY(fun.isFunction());
+ QBENCHMARK {
+ fun.call();
+ }
+}
+
QTEST_MAIN(tst_QScriptEngine)
#include "tst_qscriptengine.moc"
diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp
index bf60dd1..6f280db 100644
--- a/tests/manual/bearerex/bearerex.cpp
+++ b/tests/manual/bearerex/bearerex.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -40,6 +40,7 @@
****************************************************************************/
#include "bearerex.h"
+#include "datatransferer.h"
#include <QtNetwork>
@@ -261,8 +262,8 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration,
QListWidget* eventListWidget,
int index,
BearerEx * parent)
- : QWidget(parent), m_http(0), m_eventListWidget(eventListWidget),
- m_index(index), m_httpRequestOngoing(false), m_alrEnabled (false)
+ : QWidget(parent), m_dataTransferer(0), m_eventListWidget(eventListWidget),
+ m_index(index), m_alrEnabled (false)
{
setupUi(this);
@@ -300,41 +301,46 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration,
SessionTab::~SessionTab()
{
- // Need to be nulled, because modal dialogs may return after destruction of this object and
- // use already released resources.
- delete m_NetworkSession;
- m_NetworkSession = NULL;
- delete m_http;
- m_http = NULL;
+ delete m_NetworkSession; m_NetworkSession = 0;
+ delete m_dataTransferer; m_dataTransferer = 0;
}
-void SessionTab::on_createQHttpButton_clicked()
+void SessionTab::on_createQNetworkAccessManagerButton_clicked()
{
- if (m_httpRequestOngoing) {
- return;
+ if (m_dataTransferer) {
+ disconnect(m_dataTransferer, 0, 0, 0);
+ delete m_dataTransferer;
+ m_dataTransferer = 0;
}
-
- if (m_http) {
- disconnect(m_http, 0, 0, 0);
- delete m_http;
+ // Create new object according to current selection
+ QString type(comboBox->currentText());
+ if (type == "QNAM") {
+ m_dataTransferer = new DataTransfererQNam(this);
+ } else if (type == "QTcpSocket") {
+ m_dataTransferer = new DataTransfererQTcp(this);
+ } else if (type == "QHttp") {
+ m_dataTransferer = new DataTransfererQHttp(this);
+ } else {
+ qDebug("BearerEx Warning, unknown data transfer object requested, not creating anything.");
+ return;
}
- m_http = new QHttp(this);
- createQHttpButton->setText("Recreate QHttp");
- connect(m_http, SIGNAL(done(bool)), this, SLOT(done(bool)));
+ createQNetworkAccessManagerButton->setText("Recreate");
+ connect(m_dataTransferer, SIGNAL(finished(quint32, qint64, QString)), this, SLOT(finished(quint32, qint64, QString)));
}
void SessionTab::on_sendRequestButton_clicked()
{
- if (m_http) {
- QString urlstring("http://www.google.com");
- QUrl url(urlstring);
- m_http->setHost(url.host(), QHttp::ConnectionModeHttp, url.port() == -1 ? 0 : url.port());
- m_http->get(urlstring);
- m_httpRequestOngoing = true;
+ if (m_dataTransferer) {
+ if (!m_dataTransferer->transferData()) {
+ QMessageBox msgBox;
+ msgBox.setStandardButtons(QMessageBox::Close);
+ msgBox.setText("Data transfer not started. \nVery likely data transfer ongoing.");
+ msgBox.exec();
+ }
} else {
QMessageBox msgBox;
msgBox.setStandardButtons(QMessageBox::Close);
- msgBox.setText("QHttp not created.\nCreate QHttp First.");
+ msgBox.setText("Data object not created.\nCreate data object first.");
msgBox.exec();
}
}
@@ -419,7 +425,7 @@ void SessionTab::opened()
listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Opened"));
m_eventListWidget->addItem(listItem);
- QVariant identifier = m_NetworkSession->property("ActiveConfiguration");
+ QVariant identifier = m_NetworkSession->sessionProperty("ActiveConfiguration");
if (!identifier.isNull()) {
QString configId = identifier.toString();
QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId);
@@ -429,7 +435,7 @@ void SessionTab::opened()
}
if (m_NetworkSession->configuration().type() == QNetworkConfiguration::UserChoice) {
- QVariant identifier = m_NetworkSession->property("UserChoiceConfiguration");
+ QVariant identifier = m_NetworkSession->sessionProperty("UserChoiceConfiguration");
if (!identifier.isNull()) {
QString configId = identifier.toString();
QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId);
@@ -480,6 +486,18 @@ QString SessionTab::stateString(QNetworkSession::State state)
return stateString;
}
+void SessionTab::on_dataObjectChanged(const QString &newObjectType)
+{
+ qDebug() << "BearerEx SessionTab dataObjectChanged to: " << newObjectType;
+ if (m_dataTransferer) {
+ disconnect(m_dataTransferer, 0, 0, 0);
+ delete m_dataTransferer; m_dataTransferer = 0;
+ qDebug() << "BearerEx SessionTab, previous data object deleted.";
+ }
+ createQNetworkAccessManagerButton->setText("Create");
+}
+
+
void SessionTab::stateChanged(QNetworkSession::State state)
{
newState(state);
@@ -491,7 +509,7 @@ void SessionTab::stateChanged(QNetworkSession::State state)
void SessionTab::newState(QNetworkSession::State state)
{
- QVariant identifier = m_NetworkSession->property("ActiveConfiguration");
+ QVariant identifier = m_NetworkSession->sessionProperty("ActiveConfiguration");
if (state == QNetworkSession::Connected && !identifier.isNull()) {
QString configId = identifier.toString();
QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId);
@@ -542,18 +560,15 @@ void SessionTab::error(QNetworkSession::SessionError error)
msgBox.exec();
}
-void SessionTab::done(bool error)
+void SessionTab::finished(quint32 errorCode, qint64 dataReceived, QString errorType)
{
- m_httpRequestOngoing = false;
-
QMessageBox msgBox;
msgBox.setStandardButtons(QMessageBox::Close);
- if (error) {
- msgBox.setText("HTTP request failed.");
- } else {
- QString result(m_http->readAll());
- msgBox.setText(QString("HTTP request finished successfully.\nReceived ")+QString::number(result.length())+QString(" bytes."));
- }
+ msgBox.setText(QString("Data transfer completed. \nError code: ") +
+ QString::number(int(errorCode)) +
+ "\nError type: " + errorType +
+ "\nBytes received: " +
+ QString::number(dataReceived));
msgBox.exec();
// Check if the networksession still exists - it may have gone after returning from
// the modal dialog (in the case that app has been closed, and deleting QHttp will
diff --git a/tests/manual/bearerex/bearerex.h b/tests/manual/bearerex/bearerex.h
index 6bcb3e5..b81d486 100644
--- a/tests/manual/bearerex/bearerex.h
+++ b/tests/manual/bearerex/bearerex.h
@@ -55,13 +55,16 @@
#endif
#include "qnetworkconfigmanager.h"
#include "qnetworksession.h"
+#include "datatransferer.h"
#include "xqlistwidget.h"
QT_BEGIN_NAMESPACE
-class QHttp;
+class QNetworkAccessManager;
+class QNetworkReply;
QT_END_NAMESPACE
class SessionTab;
+class DataTransferer;
QT_USE_NAMESPACE
@@ -113,14 +116,15 @@ public:
QString stateString(QNetworkSession::State state);
private Q_SLOTS:
- void on_createQHttpButton_clicked();
+ void on_createQNetworkAccessManagerButton_clicked();
void on_sendRequestButton_clicked();
void on_openSessionButton_clicked();
void on_closeSessionButton_clicked();
void on_stopConnectionButton_clicked();
void on_deleteSessionButton_clicked();
+ void on_dataObjectChanged(const QString& newObjectType);
void on_alrButton_clicked();
- void done(bool error);
+ void finished(quint32 errorCode, qint64 dataReceived, QString errorType);
void newConfigurationActivated();
void preferredConfigurationChanged(const QNetworkConfiguration& config, bool isSeamless);
@@ -131,13 +135,14 @@ private Q_SLOTS:
void error(QNetworkSession::SessionError error);
private: //data
- QHttp* m_http;
+ // QNetworkAccessManager* m_networkAccessManager;
+ DataTransferer* m_dataTransferer;
QNetworkSession* m_NetworkSession;
QNetworkConfigurationManager* m_ConfigManager;
QListWidget* m_eventListWidget;
QNetworkConfiguration m_config;
int m_index;
- bool m_httpRequestOngoing;
+ bool m_dataTransferOngoing;
bool m_alrEnabled;
};
diff --git a/tests/manual/bearerex/bearerex.pro b/tests/manual/bearerex/bearerex.pro
index 7b21183..df39c85 100644
--- a/tests/manual/bearerex/bearerex.pro
+++ b/tests/manual/bearerex/bearerex.pro
@@ -17,10 +17,12 @@ maemo5|maemo6 {
# Example headers and sources
HEADERS += bearerex.h \
- xqlistwidget.h
+ xqlistwidget.h \
+ datatransferer.h
SOURCES += bearerex.cpp \
main.cpp \
- xqlistwidget.cpp
+ xqlistwidget.cpp \
+ datatransferer.cpp
symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData
diff --git a/tests/manual/bearerex/datatransferer.cpp b/tests/manual/bearerex/datatransferer.cpp
new file mode 100644
index 0000000..c3c13a8
--- /dev/null
+++ b/tests/manual/bearerex/datatransferer.cpp
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDebug>
+#include <QUrl>
+#include <QByteArray>
+#include <QDataStream>
+#include "datatransferer.h"
+
+DataTransferer::DataTransferer(QObject *parent) :
+ QObject(parent), m_dataTransferOngoing(false)
+{
+}
+
+bool DataTransferer::dataTransferOngoing()
+{
+ return m_dataTransferOngoing;
+}
+
+
+
+// -------- Based on QTcp
+
+DataTransfererQTcp::DataTransfererQTcp(QObject* parent)
+: DataTransferer(parent)
+{
+ qDebug("BearerEx DataTransferer QTcp created.");
+
+ connect(&m_qsocket, SIGNAL(readyRead()), this, SLOT(readyRead()));
+ connect(&m_qsocket, SIGNAL(connected()), this, SLOT(connected()));
+ connect(&m_qsocket, SIGNAL(error(QAbstractSocket::SocketError)),
+ this, SLOT(error(QAbstractSocket::SocketError)));
+}
+
+DataTransfererQTcp::~DataTransfererQTcp()
+{
+ qDebug("BearerEx DataTransferer QTcp destroyed.");
+ m_qsocket.abort();
+}
+
+bool DataTransfererQTcp::transferData()
+{
+ if (m_dataTransferOngoing) {
+ return false;
+ }
+ qDebug("BearerEx datatransfer for QTcp requested.");
+ // Connect to host
+ QUrl url("http://www.google.com.au");
+ m_qsocket.connectToHost(url.host(), url.port(80));
+
+ // m_qsocket.connectToHost("http://www.google.com", 80);
+ // Wait for connected() signal.
+ m_dataTransferOngoing = true;
+ return true;
+}
+
+void DataTransfererQTcp::connected()
+{
+ qDebug("BearerEx DataTransfererQtcp connected, requesting data.");
+ // Establish HTTP request
+ //QByteArray request("GET / HTTP/1.1 \nHost: www.google.com\n\n");
+ QByteArray request("GET / HTTP/1.1\n\n");
+
+ // QByteArray request("GET /index.html HTTP/1.1 \n Host: www.google.com \n\n");
+ qint64 dataWritten = m_qsocket.write(request);
+ m_qsocket.flush();
+
+ qDebug() << "BearerEx DataTransferQTcp wrote " << dataWritten << " bytes";
+ // Start waiting for readyRead() of error()
+}
+
+void DataTransfererQTcp::readyRead()
+{
+ qDebug() << "BearerEx DataTransfererQTcp readyRead() with ";
+ qint64 bytesAvailable = m_qsocket.bytesAvailable();
+ qDebug() << bytesAvailable << " bytes available.";
+
+ // QDataStream in(&m_qsocket);
+ QByteArray array = m_qsocket.readAll();
+ QString data = QString::fromAscii(array);
+
+ // in >> data;
+
+ qDebug() << "BearerEx DataTransferQTcp data received: " << data;
+ m_dataTransferOngoing = false;
+ // m_qsocket.error() returns uninitialized value in case no error has occured,
+ // so emit '0'
+ emit finished(0, bytesAvailable, "QAbstractSocket::SocketError");
+}
+
+void DataTransfererQTcp::error(QAbstractSocket::SocketError socketError)
+{
+ qDebug("BearerEx DataTransfererQTcp error(), aborting socket.");
+ m_qsocket.abort();
+ m_dataTransferOngoing = false;
+ emit finished(socketError, 0, "QAbstractSocket::SocketError");
+}
+
+// -------- Based on QHttp
+
+DataTransfererQHttp::DataTransfererQHttp(QObject* parent)
+: DataTransferer(parent)
+{
+ connect(&m_qhttp, SIGNAL(done(bool)), this, SLOT(done(bool)));
+ qDebug("BearerEx DataTransferer QHttp created.");
+}
+
+DataTransfererQHttp::~DataTransfererQHttp()
+{
+ qDebug("BearerEx DataTransferer QHttp destroyed.");
+}
+
+bool DataTransfererQHttp::transferData()
+{
+ qDebug("BearerEx datatransfer for QHttp requested.");
+ if (m_dataTransferOngoing) {
+ return false;
+ }
+ QString urlstring("http://www.google.com");
+ QUrl url(urlstring);
+ m_qhttp.setHost(url.host(), QHttp::ConnectionModeHttp, url.port() == -1 ? 0 : url.port());
+ m_qhttp.get(urlstring);
+ m_dataTransferOngoing = true;
+ return true;
+}
+
+void DataTransfererQHttp::done(bool /*error*/ )
+{
+ qDebug("BearerEx DatatransfererQHttp reply was finished (error code is type QHttp::Error).");
+ qint64 dataReceived = 0;
+ quint32 errorCode = m_qhttp.error();
+ if (m_qhttp.error() == QHttp::NoError) {
+ QString result(m_qhttp.readAll());
+ dataReceived = result.length();
+ }
+ m_dataTransferOngoing = false;
+ emit finished(errorCode, dataReceived, "QHttp::Error");
+}
+
+// -------- Based on QNetworkAccessManager
+
+DataTransfererQNam::DataTransfererQNam(QObject* parent)
+: DataTransferer(parent)
+{
+ connect(&m_qnam, SIGNAL(finished(QNetworkReply*)),
+ this, SLOT(replyFinished(QNetworkReply*)));
+ qDebug("BearerEx DataTransferer QNam created.");
+}
+
+DataTransfererQNam::~DataTransfererQNam()
+{
+ qDebug("BearerEx DataTransferer QNam destroyed.");
+}
+
+bool DataTransfererQNam::transferData()
+{
+ qDebug("BearerEx datatransfer for QNam requested.");
+ if (m_dataTransferOngoing) {
+ return false;
+ }
+ m_qnam.get(QNetworkRequest(QUrl("http://www.google.com")));
+ m_dataTransferOngoing = true;
+ return true;
+}
+
+void DataTransfererQNam::replyFinished(QNetworkReply *reply)
+{
+ qDebug("BearerEx DatatransfererQNam reply was finished (error code is type QNetworkReply::NetworkError).");
+ qint64 dataReceived = 0;
+ quint32 errorCode = (quint32)reply->error();
+
+ if (reply->error() == QNetworkReply::NoError) {
+ QString result(reply->readAll());
+ dataReceived = result.length();
+ }
+ m_dataTransferOngoing = false;
+ emit finished(errorCode, dataReceived, "QNetworkReply::NetworkError");
+ reply->deleteLater();
+}
+
+
+
diff --git a/tests/manual/bearerex/datatransferer.h b/tests/manual/bearerex/datatransferer.h
new file mode 100644
index 0000000..f2159b7
--- /dev/null
+++ b/tests/manual/bearerex/datatransferer.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DATATRANSFERER_H
+#define DATATRANSFERER_H
+
+#include <QObject>
+#include <QString>
+#include <QNetworkReply>
+#include <QNetworkAccessManager>
+#include <QTcpSocket>
+#include <QHttp>
+#include <QDebug>
+
+// Interface-class for data transferring object
+
+class DataTransferer : public QObject
+{
+ Q_OBJECT
+public:
+ explicit DataTransferer(QObject *parent = 0);
+ virtual ~DataTransferer() {
+ if (m_dataTransferOngoing) {
+ qDebug("BearerEx Warning: dataobjects transfer was ongoing when destroyed.");
+ }
+ }
+ virtual bool transferData() = 0;
+ bool dataTransferOngoing();
+
+signals:
+ void finished(quint32 errorCode, qint64 dataReceived, QString errorType);
+
+public slots:
+
+protected:
+ bool m_dataTransferOngoing;
+};
+
+
+// Specializations/concrete classes
+
+class DataTransfererQTcp : public DataTransferer
+{
+ Q_OBJECT
+public:
+ DataTransfererQTcp(QObject* parent = 0);
+ ~DataTransfererQTcp();
+
+ virtual bool transferData();
+
+public slots:
+ void readyRead();
+ void error(QAbstractSocket::SocketError socketError);
+ void connected();
+
+private:
+ QTcpSocket m_qsocket;
+};
+
+class DataTransfererQNam : public DataTransferer
+{
+ Q_OBJECT
+public:
+ DataTransfererQNam(QObject* parent = 0);
+ ~DataTransfererQNam();
+
+ virtual bool transferData();
+
+public slots:
+ void replyFinished(QNetworkReply* reply);
+
+private:
+ QNetworkAccessManager m_qnam;
+};
+
+class DataTransfererQHttp : public DataTransferer
+{
+ Q_OBJECT
+public:
+ DataTransfererQHttp(QObject* parent = 0);
+ ~DataTransfererQHttp();
+
+ virtual bool transferData();
+
+public slots:
+ void done(bool error);
+
+private:
+ QHttp m_qhttp;
+};
+
+#endif // DATATRANSFERER_H
diff --git a/tests/manual/bearerex/main.cpp b/tests/manual/bearerex/main.cpp
index 20b167e..704321a 100644
--- a/tests/manual/bearerex/main.cpp
+++ b/tests/manual/bearerex/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/tests/manual/bearerex/sessiondialog.ui b/tests/manual/bearerex/sessiondialog.ui
index fcf2136..c50af70 100644
--- a/tests/manual/bearerex/sessiondialog.ui
+++ b/tests/manual/bearerex/sessiondialog.ui
@@ -1,78 +1,87 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>SessionTab</class>
- <widget class="QWidget" name="SessionTab" >
- <layout class="QVBoxLayout" name="verticalLayout" >
+ <widget class="QWidget" name="SessionTab">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>192</width>
+ <height>262</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <layout class="QFormLayout" name="formLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="snapLabel" >
- <property name="text" >
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="snapLabel">
+ <property name="text">
<string>SNAP</string>
</property>
</widget>
</item>
- <item row="0" column="1" >
- <widget class="QLineEdit" name="snapLineEdit" >
- <property name="readOnly" >
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="snapLineEdit">
+ <property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
- <item row="1" column="0" >
- <widget class="QLabel" name="iapLabel" >
- <property name="text" >
+ <item row="1" column="0">
+ <widget class="QLabel" name="iapLabel">
+ <property name="text">
<string>IAP</string>
</property>
</widget>
</item>
- <item row="1" column="1" >
- <widget class="QLineEdit" name="iapLineEdit" >
- <property name="enabled" >
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="iapLineEdit">
+ <property name="enabled">
<bool>true</bool>
</property>
- <property name="readOnly" >
+ <property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
- <item row="2" column="0" >
- <widget class="QLabel" name="bearerLabel" >
- <property name="text" >
+ <item row="2" column="0">
+ <widget class="QLabel" name="bearerLabel">
+ <property name="text">
<string>Bearer</string>
</property>
</widget>
</item>
- <item row="2" column="1" >
- <widget class="QLineEdit" name="bearerLineEdit" >
- <property name="readOnly" >
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="bearerLineEdit">
+ <property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
- <item row="3" column="0" >
- <widget class="QLabel" name="sentRecDataLabel" >
- <property name="text" >
+ <item row="3" column="0">
+ <widget class="QLabel" name="sentRecDataLabel">
+ <property name="text">
<string>Sent/Rec.</string>
</property>
</widget>
</item>
- <item row="3" column="1" >
- <widget class="QLineEdit" name="sentRecDataLineEdit" >
- <property name="readOnly" >
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="sentRecDataLineEdit">
+ <property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
- <item row="4" column="0" >
- <widget class="QLabel" name="stateLabel" >
- <property name="text" >
+ <item row="4" column="0">
+ <widget class="QLabel" name="stateLabel">
+ <property name="text">
<string>State</string>
</property>
</widget>
</item>
- <item row="4" column="1" >
- <widget class="QLineEdit" name="stateLineEdit" >
- <property name="readOnly" >
+ <item row="4" column="1">
+ <widget class="QLineEdit" name="stateLineEdit">
+ <property name="readOnly">
<bool>true</bool>
</property>
</widget>
@@ -80,52 +89,71 @@
</layout>
</item>
<item>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <widget class="QPushButton" name="openSessionButton" >
- <property name="text" >
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="openSessionButton">
+ <property name="text">
<string>Open Session</string>
</property>
</widget>
</item>
- <item row="0" column="1" >
- <widget class="QPushButton" name="closeSessionButton" >
- <property name="text" >
+ <item row="0" column="1">
+ <widget class="QPushButton" name="closeSessionButton">
+ <property name="text">
<string>Close Session</string>
</property>
</widget>
</item>
- <item row="1" column="0" >
- <widget class="QPushButton" name="stopConnectionButton" >
- <property name="text" >
+ <item row="1" column="0">
+ <widget class="QPushButton" name="stopConnectionButton">
+ <property name="text">
<string>Stop Conn.</string>
</property>
</widget>
</item>
- <item row="2" column="0" >
- <widget class="QPushButton" name="createQHttpButton" >
- <property name="text" >
- <string>Create QHttp</string>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="alrButton">
+ <property name="text">
+ <string>Enable ALR</string>
</property>
</widget>
</item>
- <item row="2" column="1" >
- <widget class="QPushButton" name="sendRequestButton" >
- <property name="text" >
+ <item row="3" column="0">
+ <widget class="QPushButton" name="sendRequestButton">
+ <property name="text">
<string>Send Test Req.</string>
</property>
</widget>
</item>
- <item row="3" column="0" >
- <widget class="QPushButton" name="alrButton" >
- <property name="text" >
- <string>Enable ALR</string>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="createQNetworkAccessManagerButton">
+ <property name="text">
+ <string>Create</string>
</property>
</widget>
</item>
- <item row="3" column="1" >
- <widget class="QPushButton" name="deleteSessionButton" >
- <property name="text" >
+ <item row="2" column="0">
+ <widget class="QComboBox" name="comboBox">
+ <item>
+ <property name="text">
+ <string>QNAM</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>QTcpSocket</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>QHttp</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QPushButton" name="deleteSessionButton">
+ <property name="text">
<string>Delete Session</string>
</property>
</widget>
@@ -135,5 +163,25 @@
</layout>
</widget>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>comboBox</sender>
+ <signal>currentIndexChanged(QString)</signal>
+ <receiver>SessionTab</receiver>
+ <slot>on_dataObjectChanged(QString)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>40</x>
+ <y>211</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>10</x>
+ <y>258</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+ <slots>
+ <slot>on_dataObjectChanged(QString)</slot>
+ </slots>
</ui>
diff --git a/tests/manual/bearerex/xqlistwidget.cpp b/tests/manual/bearerex/xqlistwidget.cpp
index 8104779..e4b12f2 100644
--- a/tests/manual/bearerex/xqlistwidget.cpp
+++ b/tests/manual/bearerex/xqlistwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/tests/manual/bearerex/xqlistwidget.h b/tests/manual/bearerex/xqlistwidget.h
index 0649c2b..7c12138 100644
--- a/tests/manual/bearerex/xqlistwidget.h
+++ b/tests/manual/bearerex/xqlistwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/tools/assistant/tools/assistant/bookmarkdialog.cpp b/tools/assistant/tools/assistant/bookmarkdialog.cpp
index 8b195c1..d9e9a53 100644
--- a/tools/assistant/tools/assistant/bookmarkdialog.cpp
+++ b/tools/assistant/tools/assistant/bookmarkdialog.cpp
@@ -160,8 +160,7 @@ void BookmarkDialog::accepted()
QModelIndex index = ui.treeView->currentIndex();
if (index.isValid()) {
index = bookmarkModel->addItem(bookmarkTreeModel->mapToSource(index));
- if (BookmarkItem *item = bookmarkModel->itemFromIndex(index))
- item->setData(DataVector() << m_title << m_url << false);
+ bookmarkModel->setData(index, DataVector() << m_title << m_url << false);
} else
rejected();
diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp
index 4bc7027..23632b1 100644
--- a/tools/assistant/tools/assistant/bookmarkmanager.cpp
+++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp
@@ -240,6 +240,7 @@ bool BookmarkManager::eventFilter(QObject *object, QEvent *event)
case Qt::Key_Delete: {
removeItem(bookmarkTreeView->currentIndex());
+ return true;
} break;
case Qt::Key_Up: { // needs event filter on widget
diff --git a/tools/assistant/tools/assistant/bookmarkmodel.cpp b/tools/assistant/tools/assistant/bookmarkmodel.cpp
index e446ff0..4c30b42 100644
--- a/tools/assistant/tools/assistant/bookmarkmodel.cpp
+++ b/tools/assistant/tools/assistant/bookmarkmodel.cpp
@@ -261,6 +261,14 @@ BookmarkModel::data(const QModelIndex &index, int role) const
return QVariant();
}
+void BookmarkModel::setData(const QModelIndex &index, const DataVector &data)
+{
+ if (BookmarkItem *item = itemFromIndex(index)) {
+ item->setData(data);
+ emit dataChanged(index, index);
+ }
+}
+
bool
BookmarkModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
diff --git a/tools/assistant/tools/assistant/bookmarkmodel.h b/tools/assistant/tools/assistant/bookmarkmodel.h
index 6469258..f74baea 100644
--- a/tools/assistant/tools/assistant/bookmarkmodel.h
+++ b/tools/assistant/tools/assistant/bookmarkmodel.h
@@ -79,6 +79,7 @@ public:
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant data(const QModelIndex &index, int role) const;
+ void setData(const QModelIndex &index, const QVector<QVariant> &data);
bool setData(const QModelIndex &index, const QVariant &value, int role);
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
diff --git a/tools/qdoc3/codechunk.h b/tools/qdoc3/codechunk.h
index e78873c..a0c554e 100644
--- a/tools/qdoc3/codechunk.h
+++ b/tools/qdoc3/codechunk.h
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
/*
The CodeChunk class represents a tiny piece of C++ code.
- The class provides convertion between a list of lexemes and a string. It adds
+ The class provides conversion between a list of lexemes and a string. It adds
spaces at the right place for consistent style. The tiny pieces of code it
represents are data types, enum values, and default parameter values.
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index caee30b..e4870e3 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -1855,16 +1855,40 @@ bool CppCodeParser::matchProperty(InnerNode *parent)
else if (key == "WRITE") {
tre->addPropertyFunction(property, value, PropertyNode::Setter);
property->setWritable(true);
- } else if (key == "STORED")
+ }
+ else if (key == "STORED")
property->setStored(value.toLower() == "true");
- else if (key == "DESIGNABLE")
- property->setDesignable(value.toLower() == "true");
+ else if (key == "DESIGNABLE") {
+ QString v = value.toLower();
+ if (v == "true")
+ property->setDesignable(true);
+ else if (v == "false")
+ property->setDesignable(false);
+ else {
+ property->setDesignable(false);
+ property->setRuntimeDesFunc(value);
+ }
+ }
else if (key == "RESET")
tre->addPropertyFunction(property, value, PropertyNode::Resetter);
else if (key == "NOTIFY") {
tre->addPropertyFunction(property, value, PropertyNode::Notifier);
}
-
+ else if (key == "SCRIPTABLE") {
+ QString v = value.toLower();
+ if (v == "true")
+ property->setScriptable(true);
+ else if (v == "false")
+ property->setScriptable(false);
+ else {
+ property->setScriptable(false);
+ property->setRuntimeScrFunc(value);
+ }
+ }
+ else if (key == "COSTANT")
+ property->setConstant();
+ else if (key == "FINAL")
+ property->setFinal();
}
match(Tok_RightParen);
return true;
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
index be734ac..d48a578 100644
--- a/tools/qdoc3/ditaxmlgenerator.cpp
+++ b/tools/qdoc3/ditaxmlgenerator.cpp
@@ -1,3 +1,4 @@
+
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
@@ -4573,7 +4574,8 @@ void DitaXmlGenerator::writeLocation(const Node* n)
s2 = CXXTYPEDEFDECLARATIONFILE;
s3 = CXXTYPEDEFDECLARATIONFILELINE;
}
- else if (n->type() == Node::Property) {
+ else if ((n->type() == Node::Property) ||
+ (n->type() == Node::Variable)) {
s1 = CXXVARIABLEAPIITEMLOCATION;
s2 = CXXVARIABLEDECLARATIONFILE;
s3 = CXXVARIABLEDECLARATIONFILELINE;
@@ -4716,6 +4718,8 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marke
writer.writeStartElement(CXXFUNCTIONPARAMETER);
writer.writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE);
writer.writeCharacters((*p).leftType());
+ if (!(*p).rightType().isEmpty())
+ writer.writeCharacters((*p).rightType());
writer.writeEndElement(); // <cxxFunctionParameterDeclaredType>
writer.writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME);
writer.writeCharacters((*p).name());
@@ -4888,12 +4892,6 @@ void DitaXmlGenerator::writeTypedefs(const Section& s,
}
}
-void DitaXmlGenerator::writeDataMembers(const Section& s,
- const ClassNode* cn,
- CodeMarker* marker)
-{
-}
-
void DitaXmlGenerator::writeProperties(const Section& s,
const ClassNode* cn,
CodeMarker* marker)
@@ -4914,9 +4912,9 @@ void DitaXmlGenerator::writeProperties(const Section& s,
writer.writeAttribute("value",pn->accessString());
writer.writeEndElement(); // <cxxVariableAccessSpecifier>
- if (!pn->dataType().isEmpty()) {
+ if (!pn->qualifiedDataType().isEmpty()) {
writer.writeStartElement(CXXVARIABLEDECLAREDTYPE);
- writer.writeCharacters(pn->dataType());
+ writer.writeCharacters(pn->qualifiedDataType());
writer.writeEndElement(); // <cxxVariableDeclaredType>
}
QString fq = fullQualification(pn);
@@ -4925,11 +4923,49 @@ void DitaXmlGenerator::writeProperties(const Section& s,
writer.writeCharacters(fq);
writer.writeEndElement(); // <cxxVariableScopedName>
}
+
+ writer.writeStartElement(CXXVARIABLEPROTOTYPE);
+ writer.writeCharacters("Q_PROPERTY(");
+ writer.writeCharacters(pn->qualifiedDataType());
+ writer.writeCharacters(" ");
+ writer.writeCharacters(pn->name());
+ writerFunctions("READ",pn->getters());
+ writerFunctions("WRITE",pn->setters());
+ writerFunctions("RESET",pn->resetters());
+ writerFunctions("NOTIFY",pn->notifiers());
+ if (pn->isDesignable() != pn->designableDefault()) {
+ writer.writeCharacters(" DESIGNABLE ");
+ if (!pn->runtimeDesignabilityFunction().isEmpty())
+ writer.writeCharacters(pn->runtimeDesignabilityFunction());
+ else
+ writer.writeCharacters(pn->isDesignable() ? "true" : "false");
+ }
+ if (pn->isScriptable() != pn->scriptableDefault()) {
+ writer.writeCharacters(" SCRIPTABLE ");
+ if (!pn->runtimeScriptabilityFunction().isEmpty())
+ writer.writeCharacters(pn->runtimeScriptabilityFunction());
+ else
+ writer.writeCharacters(pn->isScriptable() ? "true" : "false");
+ }
+ if (pn->isWritable() != pn->writableDefault()) {
+ writer.writeCharacters(" STORED ");
+ writer.writeCharacters(pn->isStored() ? "true" : "false");
+ }
+ if (pn->isUser() != pn->userDefault()) {
+ writer.writeCharacters(" USER ");
+ writer.writeCharacters(pn->isUser() ? "true" : "false");
+ }
+ if (pn->isConstant())
+ writer.writeCharacters(" CONSTANT");
+ if (pn->isFinal())
+ writer.writeCharacters(" FINAL");
+ writer.writeCharacters(")");
+ writer.writeEndElement(); // <cxxVariablePrototype>
+
writer.writeStartElement(CXXVARIABLENAMELOOKUP);
writer.writeCharacters(pn->parent()->name() + "::" + pn->name());
writer.writeEndElement(); // <cxxVariableNameLookup>
-
if (pn->overriddenFrom() != 0) {
PropertyNode* opn = (PropertyNode*)pn->overriddenFrom();
writer.writeStartElement(CXXVARIABLEREIMPLEMENTED);
@@ -4954,4 +4990,84 @@ void DitaXmlGenerator::writeProperties(const Section& s,
}
}
+void DitaXmlGenerator::writeDataMembers(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker)
+{
+ NodeList::ConstIterator m = s.members.begin();
+ while (m != s.members.end()) {
+ if ((*m)->type() == Node::Variable) {
+ const VariableNode* vn = static_cast<const VariableNode*>(*m);
+ writer.writeStartElement(CXXVARIABLE);
+ writer.writeAttribute("id",vn->guid());
+ writer.writeStartElement(APINAME);
+ writer.writeCharacters(vn->name());
+ writer.writeEndElement(); // </apiName>
+ generateBrief(vn,marker);
+ writer.writeStartElement(CXXVARIABLEDETAIL);
+ writer.writeStartElement(CXXVARIABLEDEFINITION);
+ writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER);
+ writer.writeAttribute("value",vn->accessString());
+ writer.writeEndElement(); // <cxxVariableAccessSpecifier>
+
+ if (vn->isStatic()) {
+ writer.writeStartElement(CXXVARIABLESTORAGECLASSSPECIFIERSTATIC);
+ writer.writeAttribute("name","static");
+ writer.writeAttribute("value","static");
+ writer.writeEndElement(); // <cxxVariableStorageClassSpecifierStatic>
+ }
+
+ writer.writeStartElement(CXXVARIABLEDECLAREDTYPE);
+ writer.writeCharacters(vn->leftType());
+ if (!vn->rightType().isEmpty())
+ writer.writeCharacters(vn->rightType());
+ writer.writeEndElement(); // <cxxVariableDeclaredType>
+
+ QString fq = fullQualification(vn);
+ if (!fq.isEmpty()) {
+ writer.writeStartElement(CXXVARIABLESCOPEDNAME);
+ writer.writeCharacters(fq);
+ writer.writeEndElement(); // <cxxVariableScopedName>
+ }
+
+ writer.writeStartElement(CXXVARIABLEPROTOTYPE);
+ writer.writeCharacters(vn->leftType() + " ");
+ //writer.writeCharacters(vn->parent()->name() + "::" + vn->name());
+ writer.writeCharacters(vn->name());
+ if (!vn->rightType().isEmpty())
+ writer.writeCharacters(vn->rightType());
+ writer.writeEndElement(); // <cxxVariablePrototype>
+
+ writer.writeStartElement(CXXVARIABLENAMELOOKUP);
+ writer.writeCharacters(vn->parent()->name() + "::" + vn->name());
+ writer.writeEndElement(); // <cxxVariableNameLookup>
+
+ writeLocation(vn);
+ writer.writeEndElement(); // <cxxVariableDefinition>
+ writer.writeStartElement(APIDESC);
+
+ if (!vn->doc().isEmpty()) {
+ generateBody(vn, marker);
+ }
+
+ writer.writeEndElement(); // </apiDesc>
+ writer.writeEndElement(); // </cxxVariableDetail>
+ writer.writeEndElement(); // </cxxVariable>
+ }
+ ++m;
+ }
+}
+
+void DitaXmlGenerator::writerFunctions(const QString& tag, const NodeList& nlist)
+{
+ NodeList::const_iterator n = nlist.begin();
+ while (n != nlist.end()) {
+ writer.writeCharacters(" ");
+ writer.writeCharacters(tag);
+ writer.writeCharacters(" ");
+ writer.writeCharacters((*n)->name());
+ ++n;
+ }
+}
+
QT_END_NAMESPACE
diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h
index 8c7e439..26788d7 100644
--- a/tools/qdoc3/ditaxmlgenerator.h
+++ b/tools/qdoc3/ditaxmlgenerator.h
@@ -133,6 +133,7 @@ class DitaXmlGenerator : public PageGenerator
void writeProperties(const Section& s,
const ClassNode* cn,
CodeMarker* marker);
+ void writerFunctions(const QString& tag, const NodeList& nlist);
private:
enum SubTitleSize { SmallSubTitle, LargeSubTitle };
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 339c390..b93db4f 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -1891,6 +1891,16 @@ void HtmlGenerator::generateFooter(const Node *node)
else
{
out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n";
+ out() << " <!-- <script type=\"text/javascript\">\n";
+ out() << " var _gaq = _gaq || [];\n";
+ out() << " _gaq.push(['_setAccount', 'UA-4457116-5']);\n";
+ out() << " _gaq.push(['_trackPageview']);\n";
+ out() << " (function() {\n";
+ out() << " var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n";
+ out() << " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n";
+ out() << " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n";
+ out() << " })();\n";
+ out() << " </script> -->\n";
out() << "</body>\n";
}
out() << "</html>\n";
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 43cb0a0..b077074 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -1295,21 +1295,39 @@ void FunctionNode::debug() const
/*!
\class PropertyNode
+
+ This class describes one instance of using the Q_PROPERTY macro.
*/
/*!
+ The constructor sets the \a parent and the \a name, but
+ everything else is set to default values.
*/
PropertyNode::PropertyNode(InnerNode *parent, const QString& name)
: LeafNode(Property, parent, name),
sto(Trool_Default),
des(Trool_Default),
+ scr(Trool_Default),
+ wri(Trool_Default),
+ usr(Trool_Default),
+ cst(false),
+ fnl(false),
overrides(0)
{
+ // nothing.
}
/*!
+ Sets this property's \e {overridden from} property to
+ \a baseProperty, which indicates that this property
+ overrides \a baseProperty. To begin with, all the values
+ in this property are set to the corresponding values in
+ \a baseProperty.
+
+ We probably should ensure that the constant and final
+ attributes are not being overridden improperly.
*/
-void PropertyNode::setOverriddenFrom(const PropertyNode *baseProperty)
+void PropertyNode::setOverriddenFrom(const PropertyNode* baseProperty)
{
for (int i = 0; i < NumFunctionRoles; ++i) {
if (funcs[i].isEmpty())
@@ -1319,6 +1337,12 @@ void PropertyNode::setOverriddenFrom(const PropertyNode *baseProperty)
sto = baseProperty->sto;
if (des == Trool_Default)
des = baseProperty->des;
+ if (scr == Trool_Default)
+ scr = baseProperty->scr;
+ if (wri == Trool_Default)
+ wri = baseProperty->wri;
+ if (usr == Trool_Default)
+ usr = baseProperty->usr;
overrides = baseProperty;
}
@@ -1344,7 +1368,9 @@ QString PropertyNode::qualifiedDataType() const
}
}
-/*!
+/*! Converts the \a boolean value to an enum representation
+ of the boolean type, which includes an enum value for the
+ \e {default value} of the item, i.e. true, false, or default.
*/
PropertyNode::Trool PropertyNode::toTrool(bool boolean)
{
@@ -1352,6 +1378,15 @@ PropertyNode::Trool PropertyNode::toTrool(bool boolean)
}
/*!
+ Converts the enum \a troolean back to a boolean value.
+ If \a troolean is neither the true enum value nor the
+ false enum value, the boolean value returned is
+ \a defaultValue.
+
+ Note that runtimeDesignabilityFunction() should be called
+ first. If that function returns the name of a function, it
+ means the function must be called at runtime to determine
+ whether the property is Designable.
*/
bool PropertyNode::fromTrool(Trool troolean, bool defaultValue)
{
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index 3baf6f2..e9f2d74 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -153,7 +153,7 @@ class Node
void setStatus(Status status) { sta = status; }
void setThreadSafeness(ThreadSafeness safeness) { saf = safeness; }
void setSince(const QString &since) { sinc = since; }
- void setRelates(InnerNode *pseudoParent);
+ void setRelates(InnerNode* pseudoParent);
void setModuleName(const QString &module) { mod = module; }
void setLink(LinkType linkType, const QString &link, const QString &desc);
void setUrl(const QString &url);
@@ -167,8 +167,8 @@ class Node
virtual bool isQmlNode() const { return false; }
Type type() const { return typ; }
virtual SubType subType() const { return NoSubType; }
- InnerNode *parent() const { return par; }
- InnerNode *relates() const { return rel; }
+ InnerNode* parent() const { return par; }
+ InnerNode* relates() const { return rel; }
const QString& name() const { return nam; }
QMap<LinkType, QPair<QString,QString> > links() const { return linkMap; }
QString moduleName() const;
@@ -195,7 +195,7 @@ class Node
QString ditaXmlHref();
protected:
- Node(Type type, InnerNode *parent, const QString& name);
+ Node(Type type, InnerNode* parent, const QString& name);
private:
@@ -212,8 +212,8 @@ class Node
PageType pageTyp : 4;
Status sta : 3;
#endif
- InnerNode *par;
- InnerNode *rel;
+ InnerNode* par;
+ InnerNode* rel;
QString nam;
Location loc;
Doc d;
@@ -228,35 +228,35 @@ class Node
class FunctionNode;
class EnumNode;
-typedef QList<Node *> NodeList;
+typedef QList<Node*> NodeList;
class InnerNode : public Node
{
public:
virtual ~InnerNode();
- Node *findNode(const QString& name);
- Node *findNode(const QString& name, Type type);
- FunctionNode *findFunctionNode(const QString& name);
- FunctionNode *findFunctionNode(const FunctionNode *clone);
+ Node* findNode(const QString& name);
+ Node* findNode(const QString& name, Type type);
+ FunctionNode* findFunctionNode(const QString& name);
+ FunctionNode* findFunctionNode(const FunctionNode* clone);
void addInclude(const QString &include);
void setIncludes(const QStringList &includes);
- void setOverload(const FunctionNode *func, bool overlode);
+ void setOverload(const FunctionNode* func, bool overlode);
void normalizeOverloads();
void makeUndocumentedChildrenInternal();
void deleteChildren();
void removeFromRelated();
virtual bool isInnerNode() const;
- const Node *findNode(const QString& name) const;
- const Node *findNode(const QString& name, Type type) const;
- const FunctionNode *findFunctionNode(const QString& name) const;
- const FunctionNode *findFunctionNode(const FunctionNode *clone) const;
- const EnumNode *findEnumNodeForValue(const QString &enumValue) const;
+ const Node* findNode(const QString& name) const;
+ const Node* findNode(const QString& name, Type type) const;
+ const FunctionNode* findFunctionNode(const QString& name) const;
+ const FunctionNode* findFunctionNode(const FunctionNode* clone) const;
+ const EnumNode* findEnumNodeForValue(const QString &enumValue) const;
const NodeList & childNodes() const { return children; }
const NodeList & relatedNodes() const { return related; }
int count() const { return children.size(); }
- int overloadNumber(const FunctionNode *func) const;
+ int overloadNumber(const FunctionNode* func) const;
int numOverloads(const QString& funcName) const;
NodeList overloads(const QString &funcName) const;
const QStringList& includes() const { return inc; }
@@ -269,23 +269,23 @@ class InnerNode : public Node
virtual void setAbstract(bool ) { }
protected:
- InnerNode(Type type, InnerNode *parent, const QString& name);
+ InnerNode(Type type, InnerNode* parent, const QString& name);
private:
friend class Node;
- static bool isSameSignature(const FunctionNode *f1, const FunctionNode *f2);
- void addChild(Node *child);
- void removeChild(Node *child);
- void removeRelated(Node *pseudoChild);
+ static bool isSameSignature(const FunctionNode* f1, const FunctionNode* f2);
+ void addChild(Node* child);
+ void removeChild(Node* child);
+ void removeRelated(Node* pseudoChild);
QStringList pageKeywds;
QStringList inc;
NodeList children;
NodeList enumChildren;
NodeList related;
- QMap<QString, Node *> childMap;
- QMap<QString, Node *> primaryFunctionMap;
+ QMap<QString, Node*> childMap;
+ QMap<QString, Node*> primaryFunctionMap;
QMap<QString, NodeList> secondaryFunctionMap;
};
@@ -304,7 +304,7 @@ class LeafNode : public Node
class NamespaceNode : public InnerNode
{
public:
- NamespaceNode(InnerNode *parent, const QString& name);
+ NamespaceNode(InnerNode* parent, const QString& name);
virtual ~NamespaceNode() { }
};
@@ -329,11 +329,11 @@ struct RelatedClass
class ClassNode : public InnerNode
{
public:
- ClassNode(InnerNode *parent, const QString& name);
+ ClassNode(InnerNode* parent, const QString& name);
virtual ~ClassNode() { }
void addBaseClass(Access access,
- ClassNode *node,
+ ClassNode* node,
const QString &dataTypeWithTemplateArgs = "");
void fixBaseClasses();
@@ -363,12 +363,12 @@ class FakeNode : public InnerNode
{
public:
- FakeNode(InnerNode *parent, const QString& name, SubType subType);
+ FakeNode(InnerNode* parent, const QString& name, SubType subType);
virtual ~FakeNode() { }
void setTitle(const QString &title) { tle = title; }
void setSubTitle(const QString &subTitle) { stle = subTitle; }
- void addGroupMember(Node *node) { gr.append(node); }
+ void addGroupMember(Node* node) { gr.append(node); }
SubType subType() const { return sub; }
virtual QString title() const;
@@ -388,7 +388,7 @@ class FakeNode : public InnerNode
class QmlClassNode : public FakeNode
{
public:
- QmlClassNode(InnerNode *parent,
+ QmlClassNode(InnerNode* parent,
const QString& name,
const ClassNode* cn);
virtual ~QmlClassNode();
@@ -411,7 +411,7 @@ class QmlClassNode : public FakeNode
class QmlBasicTypeNode : public FakeNode
{
public:
- QmlBasicTypeNode(InnerNode *parent,
+ QmlBasicTypeNode(InnerNode* parent,
const QString& name);
virtual ~QmlBasicTypeNode() { }
virtual bool isQmlNode() const { return true; }
@@ -498,41 +498,41 @@ class TypedefNode;
class EnumNode : public LeafNode
{
public:
- EnumNode(InnerNode *parent, const QString& name);
+ EnumNode(InnerNode* parent, const QString& name);
virtual ~EnumNode() { }
void addItem(const EnumItem& item);
- void setFlagsType(TypedefNode *typedeff);
+ void setFlagsType(TypedefNode* typedeff);
bool hasItem(const QString &name) const { return names.contains(name); }
const QList<EnumItem>& items() const { return itms; }
Access itemAccess(const QString& name) const;
- const TypedefNode *flagsType() const { return ft; }
+ const TypedefNode* flagsType() const { return ft; }
QString itemValue(const QString &name) const;
private:
QList<EnumItem> itms;
QSet<QString> names;
- const TypedefNode *ft;
+ const TypedefNode* ft;
};
class TypedefNode : public LeafNode
{
public:
- TypedefNode(InnerNode *parent, const QString& name);
+ TypedefNode(InnerNode* parent, const QString& name);
virtual ~TypedefNode() { }
- const EnumNode *associatedEnum() const { return ae; }
+ const EnumNode* associatedEnum() const { return ae; }
private:
- void setAssociatedEnum(const EnumNode *enume);
+ void setAssociatedEnum(const EnumNode* enume);
friend class EnumNode;
- const EnumNode *ae;
+ const EnumNode* ae;
};
-inline void EnumNode::setFlagsType(TypedefNode *typedeff)
+inline void EnumNode::setFlagsType(TypedefNode* typedeff)
{
ft = typedeff;
typedeff->setAssociatedEnum(this);
@@ -584,8 +584,8 @@ class FunctionNode : public LeafNode
Native };
enum Virtualness { NonVirtual, ImpureVirtual, PureVirtual };
- FunctionNode(InnerNode *parent, const QString &name);
- FunctionNode(Type type, InnerNode *parent, const QString &name, bool attached);
+ FunctionNode(InnerNode* parent, const QString &name);
+ FunctionNode(Type type, InnerNode* parent, const QString &name, bool attached);
virtual ~FunctionNode() { }
void setReturnType(const QString& returnType) { rt = returnType; }
@@ -598,8 +598,8 @@ class FunctionNode : public LeafNode
void setReimp(bool r);
void addParameter(const Parameter& parameter);
inline void setParameters(const QList<Parameter>& parameters);
- void borrowParameterNames(const FunctionNode *source);
- void setReimplementedFrom(FunctionNode *from);
+ void borrowParameterNames(const FunctionNode* source);
+ void setReimplementedFrom(FunctionNode* from);
const QString& returnType() const { return rt; }
Metaness metaness() const { return met; }
@@ -616,9 +616,9 @@ class FunctionNode : public LeafNode
int numOverloads() const;
const QList<Parameter>& parameters() const { return params; }
QStringList parameterNames() const;
- const FunctionNode *reimplementedFrom() const { return rf; }
- const QList<FunctionNode *> &reimplementedBy() const { return rb; }
- const PropertyNode *associatedProperty() const { return ap; }
+ const FunctionNode* reimplementedFrom() const { return rf; }
+ const QList<FunctionNode*> &reimplementedBy() const { return rb; }
+ const PropertyNode* associatedProperty() const { return ap; }
const QStringList& parentPath() const { return pp; }
QStringList reconstructParams(bool values = false) const;
@@ -632,7 +632,7 @@ class FunctionNode : public LeafNode
void debug() const;
private:
- void setAssociatedProperty(PropertyNode *property);
+ void setAssociatedProperty(PropertyNode* property);
friend class InnerNode;
friend class PropertyNode;
@@ -652,9 +652,9 @@ class FunctionNode : public LeafNode
bool reimp: 1;
bool att: 1;
QList<Parameter> params;
- const FunctionNode *rf;
- const PropertyNode *ap;
- QList<FunctionNode *> rb;
+ const FunctionNode* rf;
+ const PropertyNode* ap;
+ QList<FunctionNode*> rb;
};
class PropertyNode : public LeafNode
@@ -663,16 +663,22 @@ class PropertyNode : public LeafNode
enum FunctionRole { Getter, Setter, Resetter, Notifier };
enum { NumFunctionRoles = Notifier + 1 };
- PropertyNode(InnerNode *parent, const QString& name);
+ PropertyNode(InnerNode* parent, const QString& name);
virtual ~PropertyNode() { }
void setDataType(const QString& dataType) { dt = dataType; }
- void addFunction(FunctionNode *function, FunctionRole role);
- void addSignal(FunctionNode *function, FunctionRole role);
+ void addFunction(FunctionNode* function, FunctionRole role);
+ void addSignal(FunctionNode* function, FunctionRole role);
void setStored(bool stored) { sto = toTrool(stored); }
void setDesignable(bool designable) { des = toTrool(designable); }
+ void setScriptable(bool scriptable) { scr = toTrool(scriptable); }
void setWritable(bool writable) { wri = toTrool(writable); }
- void setOverriddenFrom(const PropertyNode *baseProperty);
+ void setUser(bool user) { usr = toTrool(user); }
+ void setOverriddenFrom(const PropertyNode* baseProperty);
+ void setRuntimeDesFunc(const QString& rdf) { runtimeDesFunc = rdf; }
+ void setRuntimeScrFunc(const QString& scrf) { runtimeScrFunc = scrf; }
+ void setConstant() { cst = true; }
+ void setFinal() { fnl = true; }
const QString &dataType() const { return dt; }
QString qualifiedDataType() const;
@@ -684,8 +690,20 @@ class PropertyNode : public LeafNode
NodeList notifiers() const { return functions(Notifier); }
bool isStored() const { return fromTrool(sto, storedDefault()); }
bool isDesignable() const { return fromTrool(des, designableDefault()); }
+ bool isScriptable() const { return fromTrool(scr, scriptableDefault()); }
+ const QString& runtimeDesignabilityFunction() const { return runtimeDesFunc; }
+ const QString& runtimeScriptabilityFunction() const { return runtimeScrFunc; }
bool isWritable() const { return fromTrool(wri, writableDefault()); }
- const PropertyNode *overriddenFrom() const { return overrides; }
+ bool isUser() const { return fromTrool(usr, userDefault()); }
+ bool isConstant() const { return cst; }
+ bool isFinal() const { return fnl; }
+ const PropertyNode* overriddenFrom() const { return overrides; }
+
+ bool storedDefault() const { return true; }
+ bool userDefault() const { return false; }
+ bool designableDefault() const { return !setters().isEmpty(); }
+ bool scriptableDefault() const { return true; }
+ bool writableDefault() const { return !setters().isEmpty(); }
private:
enum Trool { Trool_True, Trool_False, Trool_Default };
@@ -693,16 +711,18 @@ class PropertyNode : public LeafNode
static Trool toTrool(bool boolean);
static bool fromTrool(Trool troolean, bool defaultValue);
- bool storedDefault() const { return true; }
- bool designableDefault() const { return !setters().isEmpty(); }
- bool writableDefault() const { return !setters().isEmpty(); }
-
QString dt;
+ QString runtimeDesFunc;
+ QString runtimeScrFunc;
NodeList funcs[NumFunctionRoles];
Trool sto;
Trool des;
+ Trool scr;
Trool wri;
- const PropertyNode *overrides;
+ Trool usr;
+ bool cst;
+ bool fnl;
+ const PropertyNode* overrides;
};
inline void FunctionNode::setParameters(const QList<Parameter> &parameters)
@@ -710,13 +730,13 @@ inline void FunctionNode::setParameters(const QList<Parameter> &parameters)
params = parameters;
}
-inline void PropertyNode::addFunction(FunctionNode *function, FunctionRole role)
+inline void PropertyNode::addFunction(FunctionNode* function, FunctionRole role)
{
funcs[(int)role].append(function);
function->setAssociatedProperty(this);
}
-inline void PropertyNode::addSignal(FunctionNode *function, FunctionRole role)
+inline void PropertyNode::addSignal(FunctionNode* function, FunctionRole role)
{
funcs[(int)role].append(function);
}
@@ -732,7 +752,7 @@ inline NodeList PropertyNode::functions() const
class VariableNode : public LeafNode
{
public:
- VariableNode(InnerNode *parent, const QString &name);
+ VariableNode(InnerNode* parent, const QString &name);
virtual ~VariableNode() { }
void setLeftType(const QString &leftType) { lt = leftType; }
@@ -750,15 +770,16 @@ class VariableNode : public LeafNode
bool sta;
};
-inline VariableNode::VariableNode(InnerNode *parent, const QString &name)
+inline VariableNode::VariableNode(InnerNode* parent, const QString &name)
: LeafNode(Variable, parent, name), sta(false)
{
+ // nothing.
}
class TargetNode : public LeafNode
{
public:
- TargetNode(InnerNode *parent, const QString& name);
+ TargetNode(InnerNode* parent, const QString& name);
virtual ~TargetNode() { }
virtual bool isInnerNode() const;
diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf
index 1fb000b..b82e337 100644
--- a/tools/qdoc3/test/qt-html-templates.qdocconf
+++ b/tools/qdoc3/test/qt-html-templates.qdocconf
@@ -11,7 +11,7 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \
" <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \
" <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \
" <fieldset>\n" \
- " <input type=\"text\" value=\"\" id=\"pageType\" name=\"searchstring\">\n" \
+ " <input type=\"text\" value=\"\" id=\"pageType2\" name=\"searchstring\">\n" \
" </fieldset>\n" \
" </form></div>\n" \
" <div id=\"nav-topright\">\n" \
@@ -160,7 +160,9 @@ HTML.footer = " <!-- /div -->\n" \
" <div id=\"feedbackBox\">\n" \
" <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \
" <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \
- " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit you feedback...</textarea></p>\n" \
+ " <p>Thank you for giving your feedback. <div class=\"note\">Make sure it is related the page. For more general bugs and \n" \
+ " requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a></div></p>\n" \
+ " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\"></textarea></p>\n" \
" <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \
" </form>\n" \
" </div>\n" \