summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-06-28 00:56:47 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-06-28 00:56:47 (GMT)
commit43697c982237f634f89ce661b1b363b8bfa383a7 (patch)
tree86a69bfbb4b80b2b28380252d7f85c8fde78baad
parent768209aebcbc66fec3a600be0a0f0e58d9f405d8 (diff)
parent8576e0f3652a8de05a5e59488b2611833944e6d6 (diff)
downloadQt-43697c982237f634f89ce661b1b363b8bfa383a7.zip
Qt-43697c982237f634f89ce661b1b363b8bfa383a7.tar.gz
Qt-43697c982237f634f89ce661b1b363b8bfa383a7.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
-rw-r--r--config.tests/mac/corewlan/corewlantest.mm2
-rw-r--r--demos/qtdemo/menumanager.cpp6
-rw-r--r--demos/qtdemo/qmlShell.qml4
-rw-r--r--examples/declarative/cppextensions/cppextensions.qmlproject2
-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--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.pro9
-rw-r--r--src/corelib/io/qiodevice.cpp4
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp33
-rw-r--r--src/declarative/qml/qdeclarativecompiler_p.h1
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp4
-rw-r--r--src/declarative/qml/qdeclarativecustomparser.cpp10
-rw-r--r--src/declarative/qml/qdeclarativecustomparser_p.h14
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp24
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h1
-rw-r--r--src/declarative/qml/qdeclarativeglobalscriptclass.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp24
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass_p.h2
-rw-r--r--src/declarative/qml/qdeclarativetypenamescriptclass.cpp4
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp11
-rw-r--r--src/declarative/util/qdeclarativelistmodel_p.h2
-rw-r--r--src/declarative/util/qdeclarativepropertychanges_p.h3
-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/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/s60installs/s60installs.pro7
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.js1
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml8
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11606.qml12
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml4
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp28
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp1
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp12
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js4
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp1
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments.qml2
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments_cb.pngbin528 -> 496 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments_cc.pngbin549 -> 556 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments_ct.pngbin564 -> 533 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments_lb.pngbin522 -> 496 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments_lc.pngbin541 -> 535 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments_lt.pngbin558 -> 514 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments_rb.pngbin530 -> 505 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments_rc.pngbin550 -> 559 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments_rt.pngbin564 -> 539 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp9
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/alignments.qml2
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/alignments_cb.pngbin528 -> 496 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/alignments_cc.pngbin549 -> 556 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/alignments_ct.pngbin564 -> 533 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/alignments_lb.pngbin522 -> 496 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/alignments_lc.pngbin541 -> 535 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/alignments_lt.pngbin558 -> 514 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/alignments_rb.pngbin530 -> 505 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/alignments_rc.pngbin550 -> 559 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/alignments_rt.pngbin564 -> 539 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp9
-rw-r--r--tests/auto/qbearertestcommon.h2
-rw-r--r--tests/auto/qnetworksession/test/tst_qnetworksession.cpp123
-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/qml/deviceorientation_maemo5.cpp (renamed from tools/qml/deviceorientation_maemo.cpp)2
-rw-r--r--tools/qml/loggerwidget.cpp25
-rw-r--r--tools/qml/loggerwidget.h12
-rw-r--r--tools/qml/main.cpp2
-rw-r--r--tools/qml/proxysettings.cpp5
-rw-r--r--tools/qml/proxysettings.h4
-rw-r--r--tools/qml/proxysettings_maemo5.ui177
-rw-r--r--tools/qml/qml.pri10
-rw-r--r--tools/qml/qml.pro3
-rw-r--r--tools/qml/qmlruntime.cpp475
-rw-r--r--tools/qml/qmlruntime.h22
-rw-r--r--tools/qml/recopts_maemo5.ui254
-rw-r--r--tools/qml/texteditautoresizer_maemo5.h113
114 files changed, 2621 insertions, 758 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/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp
index a2ceb0e..15561ab 100644
--- a/demos/qtdemo/menumanager.cpp
+++ b/demos/qtdemo/menumanager.cpp
@@ -369,10 +369,10 @@ void MenuManager::launchQmlExample(const QString &name)
dir = QDir(QLibraryInfo::location(QLibraryInfo::DemosPath));
else
dir = QDir(QLibraryInfo::location(QLibraryInfo::ExamplesPath));
- QFile file(dir.path() + "/" + dirName + "/" + fileName + "/" + fileName.split('/').last() + ".qml");
+ QFile file(dir.path() + "/" + dirName + "/" + fileName + "/" + "main.qml");
if(!file.exists()){
- //try main.qml as well
- file.setFileName(dir.path() + "/" + dirName + "/" + fileName + "/" + "main.qml");
+ //try dirname.qml as well
+ file.setFileName(dir.path() + "/" + dirName + "/" + fileName + "/" + fileName.split('/').last() + ".qml");
if(!file.exists()){
exampleError(QProcess::UnknownError);
return;
diff --git a/demos/qtdemo/qmlShell.qml b/demos/qtdemo/qmlShell.qml
index 5c5f96c..e15d33c 100644
--- a/demos/qtdemo/qmlShell.qml
+++ b/demos/qtdemo/qmlShell.qml
@@ -99,6 +99,7 @@ Item {
}
MouseArea{
anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: loader.focus=true;/* and don't propogate to the 'exit' area*/
}
@@ -130,7 +131,7 @@ Item {
textFormat: Text.RichText
//Note that if loader is Error, it is because the file was found but there was an error creating the component
//This means either we have a bug in our demos, or the required modules (which ship with Qt) did not deploy correctly
- text: "The example has failed to load.<br />If you installed Qt's QML modules this is a bug!<br />"
+ text: "The example has failed to load.<br />If you installed all Qt's C++ and QML modules then this is a bug!<br />"
+ 'Report it at <a href="http://bugreports.qt.nokia.com">http://bugreports.qt.nokia.com</a>';
onLinkActivated: Qt.openUrlExternally(link);
}
@@ -145,6 +146,7 @@ Item {
z: 8
enabled: main.show
hoverEnabled: main.show //To steal focus from the buttons
+ acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
anchors.fill: parent
onClicked: main.show=false;
}
diff --git a/examples/declarative/cppextensions/cppextensions.qmlproject b/examples/declarative/cppextensions/cppextensions.qmlproject
index d4909f8..6b36284 100644
--- a/examples/declarative/cppextensions/cppextensions.qmlproject
+++ b/examples/declarative/cppextensions/cppextensions.qmlproject
@@ -12,5 +12,5 @@ Project {
directory: "."
}
/* List of plugin directories passed to QML runtime */
- // importPaths: [ " ../exampleplugin " ]
+ importPaths: [ "plugins" ]
}
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/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag
index 1eb0d78..24cf142 100644
--- a/src/3rdparty/webkit/.tag
+++ b/src/3rdparty/webkit/.tag
@@ -1 +1 @@
-45d1c9149ef8940081fa8dd35854d2b95ebaf3cd
+2f598e9b7b376d851fe089bc1dc729bcf0393a06
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
index 676ed23..8fa3a72 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
@@ -1,3 +1,37 @@
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add an inlineCapacity template parameter to ListHashSet and use it to shrink the positioned object list hash set.
+ https://bugs.webkit.org/show_bug.cgi?id=39304
+ <rdar://problem/7998366>
+
+ Add an inlineCapacity template parameter to ListHashSet.
+
+ * wtf/ListHashSet.h:
+ (WTF::::ListHashSet):
+ (WTF::::operator):
+ (WTF::::swap):
+ (WTF::::~ListHashSet):
+ (WTF::::size):
+ (WTF::::capacity):
+ (WTF::::isEmpty):
+ (WTF::::begin):
+ (WTF::::end):
+ (WTF::::find):
+ (WTF::::contains):
+ (WTF::::add):
+ (WTF::::insertBefore):
+ (WTF::::remove):
+ (WTF::::clear):
+ (WTF::::unlinkAndDelete):
+ (WTF::::appendNode):
+ (WTF::::insertNodeBefore):
+ (WTF::::deleteAllNodes):
+ (WTF::::makeIterator):
+ (WTF::::makeConstIterator):
+ (WTF::deleteAllValues):
+
2010-06-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h
index 54ed36b..09355ad 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h
@@ -37,27 +37,27 @@ namespace WTF {
// and an append that moves the element to the end even if already present,
// but unclear yet if these are needed.
- template<typename Value, typename HashFunctions> class ListHashSet;
+ template<typename Value, size_t inlineCapacity, typename HashFunctions> class ListHashSet;
template<typename T> struct IdentityExtractor;
- template<typename Value, typename HashFunctions>
- void deleteAllValues(const ListHashSet<Value, HashFunctions>&);
+ template<typename Value, size_t inlineCapacity, typename HashFunctions>
+ void deleteAllValues(const ListHashSet<Value, inlineCapacity, HashFunctions>&);
- template<typename ValueArg, typename HashArg> class ListHashSetIterator;
- template<typename ValueArg, typename HashArg> class ListHashSetConstIterator;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator;
- template<typename ValueArg> struct ListHashSetNode;
- template<typename ValueArg> struct ListHashSetNodeAllocator;
- template<typename ValueArg, typename HashArg> struct ListHashSetNodeHashFunctions;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> struct ListHashSetNodeHashFunctions;
- template<typename ValueArg, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet : public FastAllocBase {
+ template<typename ValueArg, size_t inlineCapacity = 256, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet : public FastAllocBase {
private:
- typedef ListHashSetNode<ValueArg> Node;
- typedef ListHashSetNodeAllocator<ValueArg> NodeAllocator;
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+ typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
typedef HashTraits<Node*> NodeTraits;
- typedef ListHashSetNodeHashFunctions<ValueArg, HashArg> NodeHash;
+ typedef ListHashSetNodeHashFunctions<ValueArg, inlineCapacity, HashArg> NodeHash;
typedef HashTable<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplType;
typedef HashTableIterator<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplTypeIterator;
@@ -67,10 +67,10 @@ namespace WTF {
public:
typedef ValueArg ValueType;
- typedef ListHashSetIterator<ValueType, HashArg> iterator;
- typedef ListHashSetConstIterator<ValueType, HashArg> const_iterator;
+ typedef ListHashSetIterator<ValueType, inlineCapacity, HashArg> iterator;
+ typedef ListHashSetConstIterator<ValueType, inlineCapacity, HashArg> const_iterator;
- friend class ListHashSetConstIterator<ValueType, HashArg>;
+ friend class ListHashSetConstIterator<ValueType, inlineCapacity, HashArg>;
ListHashSet();
ListHashSet(const ListHashSet&);
@@ -119,9 +119,9 @@ namespace WTF {
OwnPtr<NodeAllocator> m_allocator;
};
- template<typename ValueArg> struct ListHashSetNodeAllocator {
- typedef ListHashSetNode<ValueArg> Node;
- typedef ListHashSetNodeAllocator<ValueArg> NodeAllocator;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator {
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+ typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
ListHashSetNodeAllocator()
: m_freeList(pool())
@@ -181,15 +181,15 @@ namespace WTF {
Node* m_freeList;
bool m_isDoneWithInitialFreeList;
- static const size_t m_poolSize = 256;
+ static const size_t m_poolSize = inlineCapacity;
union {
char pool[sizeof(Node) * m_poolSize];
double forAlignment;
} m_pool;
};
- template<typename ValueArg> struct ListHashSetNode {
- typedef ListHashSetNodeAllocator<ValueArg> NodeAllocator;
+ template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode {
+ typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
ListHashSetNode(ValueArg value)
: m_value(value)
@@ -220,25 +220,25 @@ namespace WTF {
#endif
};
- template<typename ValueArg, typename HashArg> struct ListHashSetNodeHashFunctions {
- typedef ListHashSetNode<ValueArg> Node;
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> struct ListHashSetNodeHashFunctions {
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
static unsigned hash(Node* const& key) { return HashArg::hash(key->m_value); }
static bool equal(Node* const& a, Node* const& b) { return HashArg::equal(a->m_value, b->m_value); }
static const bool safeToCompareToEmptyOrDeleted = false;
};
- template<typename ValueArg, typename HashArg> class ListHashSetIterator {
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator {
private:
- typedef ListHashSet<ValueArg, HashArg> ListHashSetType;
- typedef ListHashSetIterator<ValueArg, HashArg> iterator;
- typedef ListHashSetConstIterator<ValueArg, HashArg> const_iterator;
- typedef ListHashSetNode<ValueArg> Node;
+ typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
+ typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator;
+ typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator;
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
typedef ValueArg ValueType;
typedef ValueType& ReferenceType;
typedef ValueType* PointerType;
- friend class ListHashSet<ValueArg, HashArg>;
+ friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
ListHashSetIterator(const ListHashSetType* set, Node* position) : m_iterator(set, position) { }
@@ -271,18 +271,18 @@ namespace WTF {
const_iterator m_iterator;
};
- template<typename ValueArg, typename HashArg> class ListHashSetConstIterator {
+ template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator {
private:
- typedef ListHashSet<ValueArg, HashArg> ListHashSetType;
- typedef ListHashSetIterator<ValueArg, HashArg> iterator;
- typedef ListHashSetConstIterator<ValueArg, HashArg> const_iterator;
- typedef ListHashSetNode<ValueArg> Node;
+ typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
+ typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator;
+ typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator;
+ typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
typedef ValueArg ValueType;
typedef const ValueType& ReferenceType;
typedef const ValueType* PointerType;
- friend class ListHashSet<ValueArg, HashArg>;
- friend class ListHashSetIterator<ValueArg, HashArg>;
+ friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
+ friend class ListHashSetIterator<ValueArg, inlineCapacity, HashArg>;
ListHashSetConstIterator(const ListHashSetType* set, Node* position)
: m_set(set)
@@ -341,11 +341,11 @@ namespace WTF {
};
- template<typename ValueType, typename HashFunctions>
+ template<typename ValueType, size_t inlineCapacity, typename HashFunctions>
struct ListHashSetTranslator {
private:
- typedef ListHashSetNode<ValueType> Node;
- typedef ListHashSetNodeAllocator<ValueType> NodeAllocator;
+ typedef ListHashSetNode<ValueType, inlineCapacity> Node;
+ typedef ListHashSetNodeAllocator<ValueType, inlineCapacity> NodeAllocator;
public:
static unsigned hash(const ValueType& key) { return HashFunctions::hash(key); }
static bool equal(Node* const& a, const ValueType& b) { return HashFunctions::equal(a->m_value, b); }
@@ -355,16 +355,16 @@ namespace WTF {
}
};
- template<typename T, typename U>
- inline ListHashSet<T, U>::ListHashSet()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>::ListHashSet()
: m_head(0)
, m_tail(0)
, m_allocator(new NodeAllocator)
{
}
- template<typename T, typename U>
- inline ListHashSet<T, U>::ListHashSet(const ListHashSet& other)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>::ListHashSet(const ListHashSet& other)
: m_head(0)
, m_tail(0)
, m_allocator(new NodeAllocator)
@@ -374,16 +374,16 @@ namespace WTF {
add(*it);
}
- template<typename T, typename U>
- inline ListHashSet<T, U>& ListHashSet<T, U>::operator=(const ListHashSet& other)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>& ListHashSet<T, inlineCapacity, U>::operator=(const ListHashSet& other)
{
ListHashSet tmp(other);
swap(tmp);
return *this;
}
- template<typename T, typename U>
- inline void ListHashSet<T, U>::swap(ListHashSet& other)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::swap(ListHashSet& other)
{
m_impl.swap(other.m_impl);
std::swap(m_head, other.m_head);
@@ -391,95 +391,95 @@ namespace WTF {
m_allocator.swap(other.m_allocator);
}
- template<typename T, typename U>
- inline ListHashSet<T, U>::~ListHashSet()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSet<T, inlineCapacity, U>::~ListHashSet()
{
deleteAllNodes();
}
- template<typename T, typename U>
- inline int ListHashSet<T, U>::size() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline int ListHashSet<T, inlineCapacity, U>::size() const
{
return m_impl.size();
}
- template<typename T, typename U>
- inline int ListHashSet<T, U>::capacity() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline int ListHashSet<T, inlineCapacity, U>::capacity() const
{
return m_impl.capacity();
}
- template<typename T, typename U>
- inline bool ListHashSet<T, U>::isEmpty() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline bool ListHashSet<T, inlineCapacity, U>::isEmpty() const
{
return m_impl.isEmpty();
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::begin()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::begin()
{
return makeIterator(m_head);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::end()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::end()
{
return makeIterator(0);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::begin() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::begin() const
{
return makeConstIterator(m_head);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::end() const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::end() const
{
return makeConstIterator(0);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::find(const ValueType& value)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::find(const ValueType& value)
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
ImplTypeIterator it = m_impl.template find<ValueType, Translator>(value);
if (it == m_impl.end())
return end();
return makeIterator(*it);
}
- template<typename T, typename U>
- inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::find(const ValueType& value) const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::find(const ValueType& value) const
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
ImplTypeConstIterator it = m_impl.template find<ValueType, Translator>(value);
if (it == m_impl.end())
return end();
return makeConstIterator(*it);
}
- template<typename T, typename U>
- inline bool ListHashSet<T, U>::contains(const ValueType& value) const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline bool ListHashSet<T, inlineCapacity, U>::contains(const ValueType& value) const
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
return m_impl.template contains<ValueType, Translator>(value);
}
- template<typename T, typename U>
- pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::add(const ValueType &value)
+ template<typename T, size_t inlineCapacity, typename U>
+ pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::add(const ValueType &value)
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
pair<typename ImplType::iterator, bool> result = m_impl.template add<ValueType, NodeAllocator*, Translator>(value, m_allocator.get());
if (result.second)
appendNode(*result.first);
return std::make_pair(makeIterator(*result.first), result.second);
}
- template<typename T, typename U>
- pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::insertBefore(iterator it, const ValueType& newValue)
+ template<typename T, size_t inlineCapacity, typename U>
+ pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::insertBefore(iterator it, const ValueType& newValue)
{
- typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ typedef ListHashSetTranslator<ValueType, inlineCapacity, HashFunctions> Translator;
pair<typename ImplType::iterator, bool> result = m_impl.template add<ValueType, NodeAllocator*, Translator>(newValue, m_allocator.get());
if (result.second)
insertNodeBefore(it.node(), *result.first);
@@ -487,14 +487,14 @@ namespace WTF {
}
- template<typename T, typename U>
- pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue)
+ template<typename T, size_t inlineCapacity, typename U>
+ pair<typename ListHashSet<T, inlineCapacity, U>::iterator, bool> ListHashSet<T, inlineCapacity, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue)
{
return insertBefore(find(beforeValue), newValue);
}
- template<typename T, typename U>
- inline void ListHashSet<T, U>::remove(iterator it)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::remove(iterator it)
{
if (it == end())
return;
@@ -502,14 +502,14 @@ namespace WTF {
unlinkAndDelete(it.node());
}
- template<typename T, typename U>
- inline void ListHashSet<T, U>::remove(const ValueType& value)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::remove(const ValueType& value)
{
remove(find(value));
}
- template<typename T, typename U>
- inline void ListHashSet<T, U>::clear()
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void ListHashSet<T, inlineCapacity, U>::clear()
{
deleteAllNodes();
m_impl.clear();
@@ -517,8 +517,8 @@ namespace WTF {
m_tail = 0;
}
- template<typename T, typename U>
- void ListHashSet<T, U>::unlinkAndDelete(Node* node)
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::unlinkAndDelete(Node* node)
{
if (!node->m_prev) {
ASSERT(node == m_head);
@@ -539,8 +539,8 @@ namespace WTF {
node->destroy(m_allocator.get());
}
- template<typename T, typename U>
- void ListHashSet<T, U>::appendNode(Node* node)
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::appendNode(Node* node)
{
node->m_prev = m_tail;
node->m_next = 0;
@@ -556,8 +556,8 @@ namespace WTF {
m_tail = node;
}
- template<typename T, typename U>
- void ListHashSet<T, U>::insertNodeBefore(Node* beforeNode, Node* newNode)
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::insertNodeBefore(Node* beforeNode, Node* newNode)
{
if (!beforeNode)
return appendNode(newNode);
@@ -572,8 +572,8 @@ namespace WTF {
m_head = newNode;
}
- template<typename T, typename U>
- void ListHashSet<T, U>::deleteAllNodes()
+ template<typename T, size_t inlineCapacity, typename U>
+ void ListHashSet<T, inlineCapacity, U>::deleteAllNodes()
{
if (!m_head)
return;
@@ -582,16 +582,16 @@ namespace WTF {
node->destroy(m_allocator.get());
}
- template<typename T, typename U>
- inline ListHashSetIterator<T, U> ListHashSet<T, U>::makeIterator(Node* position)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSetIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeIterator(Node* position)
{
- return ListHashSetIterator<T, U>(this, position);
+ return ListHashSetIterator<T, inlineCapacity, U>(this, position);
}
- template<typename T, typename U>
- inline ListHashSetConstIterator<T, U> ListHashSet<T, U>::makeConstIterator(Node* position) const
+ template<typename T, size_t inlineCapacity, typename U>
+ inline ListHashSetConstIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeConstIterator(Node* position) const
{
- return ListHashSetConstIterator<T, U>(this, position);
+ return ListHashSetConstIterator<T, inlineCapacity, U>(this, position);
}
template<bool, typename ValueType, typename HashTableType>
@@ -603,10 +603,10 @@ namespace WTF {
delete (*it)->m_value;
}
- template<typename T, typename U>
- inline void deleteAllValues(const ListHashSet<T, U>& collection)
+ template<typename T, size_t inlineCapacity, typename U>
+ inline void deleteAllValues(const ListHashSet<T, inlineCapacity, U>& collection)
{
- deleteAllValues<true, typename ListHashSet<T, U>::ValueType>(collection.m_impl);
+ deleteAllValues<true, typename ListHashSet<T, inlineCapacity, U>::ValueType>(collection.m_impl);
}
} // namespace WTF
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index 1a343eb..924b120 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from
and has the sha1 checksum
- 45d1c9149ef8940081fa8dd35854d2b95ebaf3cd
+ 2f598e9b7b376d851fe089bc1dc729bcf0393a06
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index fd259e0..a84f177 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,90 @@
+2010-06-24 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed Symbian build fix.
+
+ The QML WebKit integration needs to be part of QtWebKit.sis
+
+ * WebCore.pro: Deploy qmlwebkitplugin.dll.
+
+2010-06-23 Benjamin Poulain <benjamin.poulain@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Do not render the full frame when there is some elements with fixed positioning
+ https://bugs.webkit.org/show_bug.cgi?id=33150
+
+ Do not render the full frame when there is some elements with fixed positioning
+ https://bugs.webkit.org/show_bug.cgi?id=33150
+
+ The frame view take into acount the list of fixed object when scrolling
+ the view. If the number of object is lower than a certain threshold, the pixel
+ are blitted, and the invalidated area updated.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::addFixedObject):
+ (WebCore::FrameView::removeFixedObject):
+ (WebCore::FrameView::scrollContentsFastPath):
+ * page/FrameView.h:
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::scrollContents):
+ (WebCore::ScrollView::scrollContentsFastPath):
+ * platform/ScrollView.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::repaintRectIncludingDescendants):
+ * rendering/RenderLayer.h:
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::styleWillChange):
+
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Allocate the m_preloads list hash set dynamically and free it when done.
+ https://bugs.webkit.org/show_bug.cgi?id=39309
+ <rdar://problem/7998495>
+
+ This saves about 6000 bytes on a fully loaded document.
+
+ * loader/DocLoader.cpp:
+ (WebCore::DocLoader::requestPreload):
+ (WebCore::DocLoader::clearPreloads):
+ * loader/DocLoader.h:
+
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Revert unintended indentation and unnecessary nested name specifier.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::clipOutPositionedObjects):
+ (WebCore::RenderBlock::insertPositionedObject):
+
+2010-05-18 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add an inlineCapacity template parameter to ListHashSet and use it to shrink the positioned object list hash set.
+ https://bugs.webkit.org/show_bug.cgi?id=39304
+ <rdar://problem/7998366>
+
+ Set the inlineCapacity for the positionedObjects ListHashSet to 4 instead of 256. Since a RenderBlock usually has
+ few positioned objects, this saves memory.
+
+ * WebCore.base.exp:
+ * rendering/RenderBlock.cpp:
+ (WebCore::clipOutPositionedObjects):
+ (WebCore::RenderBlock::insertPositionedObject):
+ * rendering/RenderBlock.h:
+ (WebCore::RenderBlock::positionedObjects):
+
+2010-06-22 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed Qt/Symbian build fix.
+
+ Fix "make clean" to not try to execute clean commands for
+ the extra targets we use to simulate "make install".
+
+ * WebCore.pro: Use no_clean in CONFIG of extra compilers.
+
2010-06-21 Balazs Kelemen <kb@inf.u-szeged.hu>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro
index e0b4905..1162a52 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.pro
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro
@@ -25,6 +25,13 @@ symbian: {
webkitbackup.sources = ../WebKit/qt/symbian/backup_registration.xml
webkitbackup.path = /private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,)
+ contains(QT_CONFIG, declarative) {
+ declarativeImport.sources = qmlwebkitplugin$${QT_LIBINFIX}.dll
+ declarativeImport.sources += ../WebKit/qt/declarative/qmldir
+ declarativeImport.path = c:$$QT_IMPORTS_BASE_DIR/QtWebKit
+ DEPLOYMENT += declarativeImport
+ }
+
DEPLOYMENT += webkitlibs webkitbackup
# Need to guarantee that these come before system includes of /epoc32/include
@@ -2866,6 +2873,7 @@ HEADERS += $$WEBKIT_API_HEADERS
# INSTALLS is not implemented in qmake's s60 generators, copy headers manually
inst_headers.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT}
inst_headers.input = WEBKIT_INSTALL_HEADERS
+ inst_headers.CONFIG = no_clean
!isEmpty(INSTALL_HEADERS): inst_headers.output = $$INSTALL_HEADERS/QtWebKit/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
else: inst_headers.output = $$[QT_INSTALL_HEADERS]/QtWebKit/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
@@ -2875,6 +2883,7 @@ HEADERS += $$WEBKIT_API_HEADERS
inst_modfile.commands = $$inst_headers.commands
inst_modfile.input = moduleFile
inst_modfile.output = $$[QMAKE_MKSPECS]/modules
+ inst_modfile.CONFIG = no_clean
QMAKE_EXTRA_COMPILERS += inst_modfile
diff --git a/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp b/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp
index 0053e7b..4597704 100644
--- a/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp
@@ -407,10 +407,14 @@ void DocLoader::requestPreload(CachedResource::Type type, const String& url, con
encoding = charset.isEmpty() ? m_doc->frame()->loader()->encoding() : charset;
CachedResource* resource = requestResource(type, url, encoding, true);
- if (!resource || m_preloads.contains(resource))
+ if (!resource || (m_preloads && m_preloads->contains(resource)))
return;
resource->increasePreloadCount();
- m_preloads.add(resource);
+
+ if (!m_preloads)
+ m_preloads.set(new ListHashSet<CachedResource*>);
+ m_preloads->add(resource);
+
#if PRELOAD_DEBUG
printf("PRELOADING %s\n", resource->url().latin1().data());
#endif
@@ -421,8 +425,11 @@ void DocLoader::clearPreloads()
#if PRELOAD_DEBUG
printPreloadStats();
#endif
- ListHashSet<CachedResource*>::iterator end = m_preloads.end();
- for (ListHashSet<CachedResource*>::iterator it = m_preloads.begin(); it != end; ++it) {
+ if (!m_preloads)
+ return;
+
+ ListHashSet<CachedResource*>::iterator end = m_preloads->end();
+ for (ListHashSet<CachedResource*>::iterator it = m_preloads->begin(); it != end; ++it) {
CachedResource* res = *it;
res->decreasePreloadCount();
if (res->canDelete() && !res->inCache())
diff --git a/src/3rdparty/webkit/WebCore/loader/DocLoader.h b/src/3rdparty/webkit/WebCore/loader/DocLoader.h
index 8ec73e1..66e4164 100644
--- a/src/3rdparty/webkit/WebCore/loader/DocLoader.h
+++ b/src/3rdparty/webkit/WebCore/loader/DocLoader.h
@@ -47,8 +47,7 @@ class ImageLoader;
class KURL;
// The DocLoader manages the loading of scripts/images/stylesheets for a single document.
-class DocLoader : public Noncopyable
-{
+class DocLoader : public Noncopyable {
friend class Cache;
friend class ImageLoader;
@@ -117,7 +116,7 @@ private:
int m_requestCount;
- ListHashSet<CachedResource*> m_preloads;
+ OwnPtr<ListHashSet<CachedResource*> > m_preloads;
struct PendingPreload {
CachedResource::Type m_type;
String m_url;
diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.cpp b/src/3rdparty/webkit/WebCore/page/FrameView.cpp
index a53db36..639414b 100644
--- a/src/3rdparty/webkit/WebCore/page/FrameView.cpp
+++ b/src/3rdparty/webkit/WebCore/page/FrameView.cpp
@@ -884,7 +884,7 @@ bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect
{
const size_t fixedObjectThreshold = 5;
- ListHashSet<RenderBox*>* positionedObjects = 0;
+ RenderBlock::PositionedObjectsListHashSet* positionedObjects = 0;
if (RenderView* root = m_frame->contentRenderer())
positionedObjects = root->positionedObjects();
@@ -896,14 +896,14 @@ bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect
// Get the rects of the fixed objects visible in the rectToScroll
Vector<IntRect, fixedObjectThreshold> subRectToUpdate;
bool updateInvalidatedSubRect = true;
- ListHashSet<RenderBox*>::const_iterator end = positionedObjects->end();
- for (ListHashSet<RenderBox*>::const_iterator it = positionedObjects->begin(); it != end; ++it) {
+ RenderBlock::PositionedObjectsListHashSet::const_iterator end = positionedObjects->end();
+ for (RenderBlock::PositionedObjectsListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) {
RenderBox* renderBox = *it;
if (renderBox->style()->position() != FixedPosition)
continue;
- IntRect topLevelRect;
- IntRect updateRect = renderBox->paintingRootRect(topLevelRect);
- updateRect.move(-scrollX(), -scrollY());
+ IntRect updateRect = renderBox->layer()->repaintRectIncludingDescendants();
+ updateRect = contentsToWindow(updateRect);
+
updateRect.intersect(rectToScroll);
if (!updateRect.isEmpty()) {
if (subRectToUpdate.size() >= fixedObjectThreshold) {
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp
index a7b8a02..798663e 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.cpp
@@ -1982,13 +1982,13 @@ void RenderBlock::paintSelection(PaintInfo& paintInfo, int tx, int ty)
}
#ifndef BUILDING_ON_TIGER
-static void clipOutPositionedObjects(const RenderObject::PaintInfo* paintInfo, int tx, int ty, ListHashSet<RenderBox*>* positionedObjects)
+static void clipOutPositionedObjects(const RenderObject::PaintInfo* paintInfo, int tx, int ty, RenderBlock::PositionedObjectsListHashSet* positionedObjects)
{
if (!positionedObjects)
return;
- ListHashSet<RenderBox*>::const_iterator end = positionedObjects->end();
- for (ListHashSet<RenderBox*>::const_iterator it = positionedObjects->begin(); it != end; ++it) {
+ RenderBlock::PositionedObjectsListHashSet::const_iterator end = positionedObjects->end();
+ for (RenderBlock::PositionedObjectsListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) {
RenderBox* r = *it;
paintInfo->context->clipOut(IntRect(tx + r->x(), ty + r->y(), r->width(), r->height()));
}
@@ -2274,7 +2274,7 @@ void RenderBlock::insertPositionedObject(RenderBox* o)
{
// Create the list of special objects if we don't aleady have one
if (!m_positionedObjects)
- m_positionedObjects = new ListHashSet<RenderBox*>;
+ m_positionedObjects = new PositionedObjectsListHashSet;
m_positionedObjects->add(o);
}
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h
index 184f983..d555d31 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderBlock.h
@@ -74,7 +74,9 @@ public:
void insertPositionedObject(RenderBox*);
void removePositionedObject(RenderBox*);
void removePositionedObjects(RenderBlock*);
- ListHashSet<RenderBox*>* positionedObjects() const { return m_positionedObjects; }
+
+ typedef ListHashSet<RenderBox*, 4> PositionedObjectsListHashSet;
+ PositionedObjectsListHashSet* positionedObjects() const { return m_positionedObjects; }
void addPercentHeightDescendant(RenderBox*);
static void removePercentHeightDescendant(RenderBox*);
@@ -483,9 +485,10 @@ private:
void setCollapsedBottomMargin(const MarginInfo&);
// End helper functions and structs used by layoutBlockChildren.
- typedef ListHashSet<RenderBox*>::const_iterator Iterator;
+ typedef PositionedObjectsListHashSet::const_iterator Iterator;
DeprecatedPtrList<FloatingObject>* m_floatingObjects;
- ListHashSet<RenderBox*>* m_positionedObjects;
+
+ PositionedObjectsListHashSet* m_positionedObjects;
// An inline can be split with blocks occurring in between the inline content.
// When this occurs we need a pointer to our next object. We can basically be
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp
index 3314772..a012868 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp
@@ -325,6 +325,14 @@ void RenderLayer::updateLayerPositions(UpdateLayerPositionsFlags flags)
m_marquee->updateMarqueePosition();
}
+IntRect RenderLayer::repaintRectIncludingDescendants() const
+{
+ IntRect repaintRect = m_repaintRect;
+ for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
+ repaintRect.unite(child->repaintRectIncludingDescendants());
+ return repaintRect;
+}
+
void RenderLayer::computeRepaintRects()
{
RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint();
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h
index 81a66e1..e221f28 100644
--- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h
+++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h
@@ -394,6 +394,7 @@ public:
// Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint.
IntRect repaintRect() const { return m_repaintRect; }
+ IntRect repaintRectIncludingDescendants() const;
void computeRepaintRects();
void updateRepaintRectsAfterScroll(bool fixed = false);
void setNeedsFullRepaint(bool f = true) { m_needsFullRepaint = f; }
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index 0e73680..69a431f 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,47 @@
+2010-06-24 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed Symbian build fix.
+
+ The QML WebKit integration needs to be part of QtWebKit.sis
+
+ * declarative/declarative.pro: Removed non-working deployment.
+
+2010-06-23 David Boddie <dboddie@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Doc: Fixed documentation errors.
+
+ * docs/qtwebkit-bridge.qdoc:
+
+2010-06-23 Alessandro Portale <alessandro.portale@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Provide the Webkit Qml plugin with a UID3 on Symbian
+
+ ...otherwise we cannot Symbian sign it.
+
+ * declarative/declarative.pro:
+
+2010-06-23 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed Qt package build fix.
+
+ When building without build-webkit, set OUTPUT_DIR if necessary, like
+ in the other .pro files.
+
+ * declarative/declarative.pro:
+
+2010-06-22 Tasuku Suzuki <tasuku.suzuki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix compilation with QT_NO_COMBOBOX.
+
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::createSelectPopup):
+
2010-06-11 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by nobody, build fix.
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index 7d1c794..e253161 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -576,7 +576,7 @@ QtAbstractWebPopup* ChromeClientQt::createSelectPopup()
#elif !defined(QT_NO_COMBOBOX)
return new QtFallbackWebPopup;
#else
- return result;
+ return 0;
#endif
}
diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro b/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro
index 1371e57..75268f3 100644
--- a/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro
+++ b/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro
@@ -6,6 +6,8 @@ CONFIG += qt plugin
win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
+isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../..
+
QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir
copy2build.input = QMLDIRFILE
CONFIG(QTDIR_build) {
@@ -65,13 +67,6 @@ qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
symbian:{
TARGET.UID3 = 0x20021321
- load(data_caging_paths)
- include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
-
- importFiles.sources = qmlwebkitplugin.dll qmldir
- importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
-
- DEPLOYMENT = importFiles
}
INSTALLS += target qmldir
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index ea60792..26e587d 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1452,7 +1452,7 @@ qint64 QIODevicePrivate::peek(char *data, qint64 maxSize)
return readBytes;
buffer.ungetBlock(data, readBytes);
- pos -= readBytes;
+ *pPos -= readBytes;
return readBytes;
}
@@ -1467,7 +1467,7 @@ QByteArray QIODevicePrivate::peek(qint64 maxSize)
return result;
buffer.ungetBlock(result.constData(), result.size());
- pos -= result.size();
+ *pPos -= result.size();
return result;
}
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 80a1093..623e3df 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -815,6 +815,10 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt)
}
}
+ QDeclarativeCustomParser *cp = 0;
+ if (isCustomParser)
+ cp = output->types.at(obj->type).type->customParser();
+
// Build all explicit properties specified
foreach(Property *prop, obj->properties) {
@@ -825,7 +829,9 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt)
bool canDefer = false;
if (isCustomParser) {
- if (doesPropertyExist(prop, obj)) {
+ if (doesPropertyExist(prop, obj) &&
+ (!(cp->flags() & QDeclarativeCustomParser::AcceptsAttachedProperties) ||
+ !isAttachedPropertyName(prop->name))) {
int ids = compileState.ids.count();
COMPILE_CHECK(buildProperty(prop, obj, objCtxt));
canDefer = ids == compileState.ids.count();
@@ -876,8 +882,7 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt)
defaultProperty->release();
// Compile custom parser parts
- if (isCustomParser/* && !customProps.isEmpty()*/) {
- QDeclarativeCustomParser *cp = output->types.at(obj->type).type->customParser();
+ if (isCustomParser && !customProps.isEmpty()) {
cp->clearErrors();
cp->compiler = this;
cp->object = obj;
@@ -1356,7 +1361,7 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl
Returns true if (value) property \a prop exists on obj, false otherwise.
*/
bool QDeclarativeCompiler::doesPropertyExist(QDeclarativeParser::Property *prop,
- QDeclarativeParser::Object *obj)
+ QDeclarativeParser::Object *obj)
{
if(isAttachedPropertyName(prop->name) || prop->name == "id")
return true;
@@ -2176,6 +2181,18 @@ int QDeclarativeCompiler::evaluateEnum(const QByteArray& script) const
return -1;
}
+const QMetaObject *QDeclarativeCompiler::resolveType(const QByteArray& name) const
+{
+ QDeclarativeType *qmltype = 0;
+ if (!enginePrivate->importDatabase.resolveType(unit->imports, name, &qmltype,
+ 0, 0, 0, 0))
+ return 0;
+ if (!qmltype)
+ return 0;
+ return qmltype->metaObject();
+}
+
+
// Ensures that the dynamic meta specification on obj is valid
bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj)
{
@@ -2199,6 +2216,10 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj)
if (QString::fromUtf8(prop.name).at(0).isUpper())
COMPILE_EXCEPTION(&prop, tr("Property names cannot begin with an upper case letter"));
+
+ if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(prop.name))
+ COMPILE_EXCEPTION(&prop, tr("Illegal property name"));
+
propNames.insert(prop.name);
}
@@ -2208,6 +2229,8 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj)
COMPILE_EXCEPTION(obj, tr("Duplicate signal name"));
if (QString::fromUtf8(name).at(0).isUpper())
COMPILE_EXCEPTION(obj, tr("Signal names cannot begin with an upper case letter"));
+ if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name))
+ COMPILE_EXCEPTION(obj, tr("Illegal signal name"));
methodNames.insert(name);
}
for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) {
@@ -2216,6 +2239,8 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj)
COMPILE_EXCEPTION(obj, tr("Duplicate method name"));
if (QString::fromUtf8(name).at(0).isUpper())
COMPILE_EXCEPTION(obj, tr("Method names cannot begin with an upper case letter"));
+ if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name))
+ COMPILE_EXCEPTION(obj, tr("Illegal method name"));
methodNames.insert(name);
}
diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h
index 908c703..caad376 100644
--- a/src/declarative/qml/qdeclarativecompiler_p.h
+++ b/src/declarative/qml/qdeclarativecompiler_p.h
@@ -161,6 +161,7 @@ public:
static bool isSignalPropertyName(const QByteArray &);
int evaluateEnum(const QByteArray& script) const; // for QDeclarativeCustomParser::evaluateEnum
+ const QMetaObject *resolveType(const QByteArray& name) const; // for QDeclarativeCustomParser::resolveType
private:
static void reset(QDeclarativeCompiledData *);
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index b4919ff..9d3032c 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -572,7 +572,9 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent)
{
Q_D(QDeclarativeComponent);
QDeclarativeContext* ctxt = creationContext();
- if(!ctxt)
+ if(!ctxt && d->engine)
+ ctxt = d->engine->rootContext();
+ if (!ctxt)
return QScriptValue(QScriptValue::NullValue);
QObject* ret = create(ctxt);
if (!ret)
diff --git a/src/declarative/qml/qdeclarativecustomparser.cpp b/src/declarative/qml/qdeclarativecustomparser.cpp
index 472a883..97a6a00 100644
--- a/src/declarative/qml/qdeclarativecustomparser.cpp
+++ b/src/declarative/qml/qdeclarativecustomparser.cpp
@@ -295,4 +295,14 @@ int QDeclarativeCustomParser::evaluateEnum(const QByteArray& script) const
return compiler->evaluateEnum(script);
}
+/*!
+ Resolves \a name to a type, or 0 if it is not a type. This can be used
+ to type-check object nodes.
+*/
+const QMetaObject *QDeclarativeCustomParser::resolveType(const QByteArray& name) const
+{
+ return compiler->resolveType(name);
+}
+
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativecustomparser_p.h b/src/declarative/qml/qdeclarativecustomparser_p.h
index 0e397c5..509e30a 100644
--- a/src/declarative/qml/qdeclarativecustomparser_p.h
+++ b/src/declarative/qml/qdeclarativecustomparser_p.h
@@ -113,10 +113,18 @@ private:
class Q_DECLARATIVE_EXPORT QDeclarativeCustomParser
{
public:
- QDeclarativeCustomParser() : compiler(0), object(0) {}
+ enum Flag {
+ NoFlag = 0x00000000,
+ AcceptsAttachedProperties = 0x00000001
+ };
+ Q_DECLARE_FLAGS(Flags, Flag);
+
+ QDeclarativeCustomParser() : compiler(0), object(0), m_flags(NoFlag) {}
+ QDeclarativeCustomParser(Flags f) : compiler(0), object(0), m_flags(f) {}
virtual ~QDeclarativeCustomParser() {}
void clearErrors();
+ Flags flags() const { return m_flags; }
virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &)=0;
virtual void setCustomData(QObject *, const QByteArray &)=0;
@@ -130,12 +138,16 @@ protected:
int evaluateEnum(const QByteArray&) const;
+ const QMetaObject *resolveType(const QByteArray&) const;
+
private:
QList<QDeclarativeError> exceptions;
QDeclarativeCompiler *compiler;
QDeclarativeParser::Object *object;
+ Flags m_flags;
friend class QDeclarativeCompiler;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeCustomParser::Flags);
#if 0
#define QML_REGISTER_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, CUSTOMTYPE) \
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 5c4d229..98b4bbf 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1033,6 +1033,17 @@ QDeclarativeContextData *QDeclarativeEnginePrivate::getContext(QScriptContext *c
return contextClass->contextFromValue(scopeNode);
}
+/*!
+ Returns the QUrl associated with the script \a ctxt for the case that there is
+ no QDeclarativeContext.
+*/
+QUrl QDeclarativeEnginePrivate::getUrl(QScriptContext *ctxt)
+{
+ QScriptValue scopeNode = QScriptDeclarativeClass::scopeChainValue(ctxt, -3);
+ Q_ASSERT(scopeNode.isValid());
+ Q_ASSERT(QScriptDeclarativeClass::scriptClass(scopeNode) == contextClass);
+ return contextClass->urlFromValue(scopeNode);
+}
QString QDeclarativeEnginePrivate::urlToLocalFileOrQrc(const QUrl& url)
{
@@ -1075,16 +1086,19 @@ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QS
static_cast<QDeclarativeScriptEngine*>(engine)->p;
QDeclarativeEngine* activeEngine = activeEnginePriv->q_func();
- QDeclarativeContextData* context = activeEnginePriv->getContext(ctxt);
- Q_ASSERT(context);
-
if(ctxt->argumentCount() != 1) {
return ctxt->throwError(QLatin1String("Qt.createComponent(): Invalid arguments"));
- }else{
+ } else {
+
QString arg = ctxt->argument(0).toString();
if (arg.isEmpty())
return engine->nullValue();
- QUrl url = QUrl(context->resolvedUrl(QUrl(arg)));
+ QUrl url;
+ QDeclarativeContextData* context = activeEnginePriv->getContext(ctxt);
+ if (context)
+ url = QUrl(context->resolvedUrl(QUrl(arg)));
+ else
+ url = activeEnginePriv->getUrl(ctxt).resolved(QUrl(arg));
QDeclarativeComponent *c = new QDeclarativeComponent(activeEngine, url, activeEngine);
QDeclarativeComponentPrivate::get(c)->creationContext = context;
QDeclarativeData::get(c, true)->setImplicitDestructible();
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index 3269e98..cfa9d73 100644
--- a/src/declarative/qml/qdeclarativeengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -315,6 +315,7 @@ public:
static QDeclarativeEnginePrivate *get(QScriptEngine *e) { return static_cast<QDeclarativeScriptEngine*>(e)->p; }
static QDeclarativeEngine *get(QDeclarativeEnginePrivate *p) { return p->q_func(); }
QDeclarativeContextData *getContext(QScriptContext *);
+ QUrl getUrl(QScriptContext *);
static QString urlToLocalFileOrQrc(const QUrl& url);
diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
index f29b3f4..3e22c82 100644
--- a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
@@ -55,6 +55,7 @@ QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engi
: QScriptClass(engine)
{
QString eval = QLatin1String("eval");
+ QString version = QLatin1String("version");
QScriptValue globalObject = engine->globalObject();
@@ -68,6 +69,9 @@ QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engi
QString name = iter.name();
+ if (name == version)
+ continue;
+
if (name != eval)
m_globalObject.setProperty(iter.scriptName(), iter.value());
newGlobalObject.setProperty(iter.scriptName(), iter.value());
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index aca01b2..3af892d 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -797,6 +797,26 @@ QScriptDeclarativeClass::Value MetaCallArgument::toValue(QDeclarativeEngine *e)
}
}
+int QDeclarativeObjectMethodScriptClass::enumType(const QMetaObject *meta, const QString &strname)
+{
+ QByteArray str = strname.toUtf8();
+ QByteArray scope;
+ QByteArray name;
+ int scopeIdx = str.lastIndexOf("::");
+ if (scopeIdx != -1) {
+ scope = str.left(scopeIdx);
+ name = str.mid(scopeIdx + 2);
+ } else {
+ name = str;
+ }
+ for (int i = meta->enumeratorCount() - 1; i >= 0; --i) {
+ QMetaEnum m = meta->enumerator(i);
+ if ((m.name() == name) && (scope.isEmpty() || (m.scope() == scope)))
+ return QVariant::Int;
+ }
+ return QVariant::Invalid;
+}
+
QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass::call(Object *o, QScriptContext *ctxt)
{
MethodData *method = static_cast<MethodData *>(o);
@@ -810,7 +830,9 @@ QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass::
// ### Cache
for (int ii = 0; ii < argTypeNames.count(); ++ii) {
argTypes[ii] = QMetaType::type(argTypeNames.at(ii));
- if (argTypes[ii] == QVariant::Invalid)
+ if (argTypes[ii] == QVariant::Invalid)
+ argTypes[ii] = enumType(method->object->metaObject(), argTypeNames.at(ii));
+ if (argTypes[ii] == QVariant::Invalid)
return Value(ctxt, ctxt->throwError(QString::fromLatin1("Unknown method parameter type: %1").arg(QLatin1String(argTypeNames.at(ii)))));
}
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h
index 4b27e53..75e384c 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h
@@ -80,6 +80,8 @@ protected:
virtual Value property(Object *, const Identifier &);
private:
+ int enumType(const QMetaObject *, const QString &);
+
PersistentIdentifier m_connectId;
PersistentIdentifier m_disconnectId;
QScriptValue m_connect;
diff --git a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp
index 2a3417a..764a8db 100644
--- a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp
+++ b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp
@@ -107,8 +107,7 @@ QDeclarativeTypeNameScriptClass::queryProperty(Object *obj, const Identifier &na
return 0;
}
- } else {
- Q_ASSERT(data->type);
+ } else if (data->type) {
QString strName = toString(name);
@@ -134,6 +133,7 @@ QDeclarativeTypeNameScriptClass::queryProperty(Object *obj, const Identifier &na
if (!object) return 0;
return ep->objectClass->queryProperty(object, name, flags, 0);
}
+
}
return 0;
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 9ed21a6..deb835d 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -551,9 +551,13 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser
QDeclarativeCustomParserNode node =
qvariant_cast<QDeclarativeCustomParserNode>(value);
- if (node.name() != "ListElement") {
- error(node, QDeclarativeListModel::tr("ListElement: cannot contain nested elements"));
- return false;
+ if (node.name() != listElementTypeName) {
+ const QMetaObject *mo = resolveType(node.name());
+ if (mo != &QDeclarativeListElement::staticMetaObject) {
+ error(node, QDeclarativeListModel::tr("ListElement: cannot contain nested elements"));
+ return false;
+ }
+ listElementTypeName = node.name(); // cache right name for next time
}
{
@@ -650,6 +654,7 @@ QByteArray QDeclarativeListModelParser::compile(const QList<QDeclarativeCustomPa
{
QList<ListInstruction> instr;
QByteArray data;
+ listElementTypeName = QByteArray(); // unknown
for(int ii = 0; ii < customProps.count(); ++ii) {
const QDeclarativeCustomParserProperty &prop = customProps.at(ii);
diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h
index d09062e..6aff9c6 100644
--- a/src/declarative/util/qdeclarativelistmodel_p.h
+++ b/src/declarative/util/qdeclarativelistmodel_p.h
@@ -135,6 +135,8 @@ private:
bool compileProperty(const QDeclarativeCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data);
bool definesEmptyList(const QString &);
+
+ QByteArray listElementTypeName;
};
diff --git a/src/declarative/util/qdeclarativepropertychanges_p.h b/src/declarative/util/qdeclarativepropertychanges_p.h
index c2ed466..bb0f944 100644
--- a/src/declarative/util/qdeclarativepropertychanges_p.h
+++ b/src/declarative/util/qdeclarativepropertychanges_p.h
@@ -79,6 +79,9 @@ public:
class QDeclarativePropertyChangesParser : public QDeclarativeCustomParser
{
public:
+ QDeclarativePropertyChangesParser()
+ : QDeclarativeCustomParser(AcceptsAttachedProperties) {}
+
void compileList(QList<QPair<QByteArray, QVariant> > &list, const QByteArray &pre, const QDeclarativeCustomParserProperty &prop);
virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &);
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 2a85fdc..ef719ca 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -3065,6 +3065,11 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
break;
}
}
+#ifndef Q_OS_WINCE
+ static bool trackMouseEventLookup = false;
+ typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT);
+ static PtrTrackMouseEvent ptrTrackMouseEvent = 0;
+#endif
state = translateButtonState(msg.wParam, type, button); // button state
const QPoint widgetPos = mapFromGlobal(QPoint(msg.pt.x, msg.pt.y));
QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos);
@@ -3129,9 +3134,6 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
#ifndef Q_OS_WINCE
if (curWin != 0) {
- static bool trackMouseEventLookup = false;
- typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT);
- static PtrTrackMouseEvent ptrTrackMouseEvent = 0;
if (!trackMouseEventLookup) {
trackMouseEventLookup = true;
ptrTrackMouseEvent = (PtrTrackMouseEvent)QLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent");
@@ -3245,6 +3247,21 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
qt_button_down = 0;
}
+#ifndef Q_OS_WINCE
+ if (type == QEvent::MouseButtonPress
+ && QApplication::activePopupWidget() != activePopupWidget
+ && ptrTrackMouseEvent
+ && curWin) {
+ // Since curWin is already the window we clicked on,
+ // we have to setup the mouse tracking here.
+ TRACKMOUSEEVENT tme;
+ tme.cbSize = sizeof(TRACKMOUSEEVENT);
+ tme.dwFlags = 0x00000002; // TME_LEAVE
+ tme.hwndTrack = curWin; // Track on window receiving msgs
+ tme.dwHoverTime = (DWORD)-1; // HOVER_DEFAULT
+ ptrTrackMouseEvent(&tme);
+ }
+#endif
if (type == QEvent::MouseButtonPress
&& QApplication::activePopupWidget() != activePopupWidget
&& replayPopupMouseEvent) {
diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp
index 873b8f9..3dc6afc 100644
--- a/src/gui/kernel/qkeymapper_mac.cpp
+++ b/src/gui/kernel/qkeymapper_mac.cpp
@@ -866,14 +866,27 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e
UInt32 macModifiers = 0;
GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, 0,
sizeof(macModifiers), 0, &macModifiers);
+#ifdef QT_MAC_USE_COCOA
+ // The unicode characters in the range 0xF700-0xF747 are reserved
+ // by Mac OS X for transient use as keyboard function keys. We
+ // wont send 'text' for such key events. This is done to match
+ // behavior on other platforms.
+ unsigned int *unicodeKey = (unsigned int*)info;
+ if (*unicodeKey >= 0xf700 && *unicodeKey <= 0xf747)
+ text = QString();
+ bool isAccepted;
+#endif
handled_event = QKeyMapper::sendKeyEvent(widget, grab,
(ekind == kEventRawKeyUp) ? QEvent::KeyRelease : QEvent::KeyPress,
qtKey, modifiers, text, ekind == kEventRawKeyRepeat, 0,
macScanCode, macVirtualKey, macModifiers
#ifdef QT_MAC_USE_COCOA
- ,static_cast<bool *>(info)
+ ,&isAccepted
#endif
);
+#ifdef QT_MAC_USE_COCOA
+ *unicodeKey = (unsigned int)isAccepted;
+#endif
}
return handled_event;
}
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 8cef03c..3fc27f4 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -682,10 +682,12 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve
NSEvent *event = static_cast<NSEvent *>(keyEvent);
EventRef key_event = static_cast<EventRef>(const_cast<void *>([event eventRef]));
Q_ASSERT(key_event);
+ unsigned int info = 0;
if ([event type] == NSKeyDown) {
NSString *characters = [event characters];
unichar value = [characters characterAtIndex:0];
qt_keymapper_private()->updateKeyMap(0, key_event, (void *)&value);
+ info = value;
}
// Redirect keys to alien widgets.
@@ -701,9 +703,8 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve
if (mustUseCocoaKeyEvent())
return qt_dispatchKeyEventWithCocoa(keyEvent, widgetToGetEvent);
- bool isAccepted;
- bool consumed = qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &isAccepted, true);
- return consumed && isAccepted;
+ bool consumed = qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &info, true);
+ return consumed && (info != 0);
#endif
}
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 280712a..a9bb691 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -2804,7 +2804,7 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
QList<QWidget *> widgets = q->findChildren<QWidget *>();
for (int i=0; i<widgets.size(); ++i) {
QWidget *child = widgets.at(i);
- if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created)) {
+ if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) {
if (set)
[qt_mac_window_for(q) addChildWindow:qt_mac_window_for(child) ordered:NSWindowAbove];
else
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 139139f..e6c36a4 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -413,7 +413,7 @@ struct QtFontFamily
bool fixedPitchComputed : 1;
#endif
#ifdef Q_WS_X11
- bool symbol_checked;
+ bool symbol_checked : 1;
#endif
QString name;
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index e08d135..b6e11df 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -53,16 +53,30 @@
QT_BEGIN_NAMESPACE
QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine)
- : CActive(CActive::EPriorityUserInput), engine(engine),
- ipConnectionNotifier(0), iHandleStateNotificationsFromManager(false),
- iFirstSync(true), iStoppedByUser(false), iClosedByUser(false), iDeprecatedConnectionId(0),
- iError(QNetworkSession::UnknownSessionError), iALREnabled(0), iConnectInBackground(false)
+: CActive(CActive::EPriorityUserInput), engine(engine),
+ iDynamicUnSetdefaultif(0), ipConnectionNotifier(0),
+ iHandleStateNotificationsFromManager(false), iFirstSync(true), iStoppedByUser(false),
+ iClosedByUser(false), iError(QNetworkSession::UnknownSessionError), iALREnabled(0),
+ iConnectInBackground(false), isOpening(false)
{
CActiveScheduler::Add(this);
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
iMobility = NULL;
#endif
+ // Try to load "Open C" dll dynamically and
+ // try to attach to unsetdefaultif function dynamically.
+ // This is to avoid build breaks with old OpenC versions.
+ if (iOpenCLibrary.Load(_L("libc")) == KErrNone) {
+ iDynamicUnSetdefaultif = (TOpenCUnSetdefaultifFunction)iOpenCLibrary.Lookup(597);
+ }
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - ";
+ if (iDynamicUnSetdefaultif)
+ qDebug() << "dynamic unsetdefaultif() is present in PIPS library. ";
+ else
+ qDebug() << "dynamic unsetdefaultif() not present in PIPS library. ";
+#endif
TRAP_IGNORE(iConnectionMonitor.ConnectL());
}
@@ -70,6 +84,7 @@ QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine)
QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
{
isOpen = false;
+ isOpening = false;
// Cancel Connection Progress Notifications first.
// Note: ConnectionNotifier must be destroyed before Canceling RConnection::Start()
@@ -77,9 +92,6 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
delete ipConnectionNotifier;
ipConnectionNotifier = NULL;
- // Cancel possible RConnection::Start()
- Cancel();
-
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (iMobility) {
delete iMobility;
@@ -87,13 +99,19 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
}
#endif
- iConnection.Close();
+ // Cancel possible RConnection::Start()
+ Cancel();
iSocketServ.Close();
// Close global 'Open C' RConnection
+ // Clears also possible unsetdefaultif() flags.
setdefaultif(0);
iConnectionMonitor.Close();
+ iOpenCLibrary.Close();
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - destroyed (and setdefaultif(0))";
+#endif
}
void QNetworkSessionPrivateImpl::configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState)
@@ -101,18 +119,12 @@ void QNetworkSessionPrivateImpl::configurationStateChanged(TUint32 accessPointId
if (iHandleStateNotificationsFromManager) {
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
qDebug() << "QNS this : " << QString::number((uint)this) << " - "
- << "configurationStateChanged from manager for IAP : " << QString::number(accessPointId)
- << "configurationStateChanged connMon ID : " << QString::number(connMonId)
- << " : to a state: " << newState
- << " whereas my current state is: " << state;
-#endif
- if (connMonId == iDeprecatedConnectionId) {
-#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
- qDebug() << "QNS this : " << QString::number((uint)this) << " - "
- << "however status update from manager ignored because it related to already closed connection.";
+ << "configurationStateChanged from manager for IAP : " << QString::number(accessPointId)
+ << "connMon ID : " << QString::number(connMonId) << " : to a state: " << newState
+ << "whereas my current state is: " << state;
+#else
+ Q_UNUSED(connMonId);
#endif
- return;
- }
this->newState(newState, accessPointId);
}
}
@@ -236,6 +248,14 @@ QNetworkInterface QNetworkSessionPrivateImpl::interface(TUint iapId) const
#ifndef QT_NO_NETWORKINTERFACE
QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const
{
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "currentInterface() requested, state: " << state
+ << "publicConfig validity: " << publicConfig.isValid();
+ if (activeInterface.isValid())
+ qDebug() << "interface is: " << activeInterface.humanReadableName();
+#endif
+
if (!publicConfig.isValid() || state != QNetworkSession::Connected) {
return QNetworkInterface();
}
@@ -292,12 +312,14 @@ void QNetworkSessionPrivateImpl::open()
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
qDebug() << "QNS this : " << QString::number((uint)this) << " - "
<< "open() called, session state is: " << state << " and isOpen is: "
- << isOpen;
+ << isOpen << isOpening;
#endif
- if (isOpen || (state == QNetworkSession::Connecting)) {
+
+ if (isOpen || isOpening)
return;
- }
-
+
+ isOpening = true;
+
// Stop handling IAP state change signals from QNetworkConfigurationManagerPrivate
// => RConnection::ProgressNotification will be used for IAP/SNAP monitoring
iHandleStateNotificationsFromManager = false;
@@ -325,7 +347,6 @@ void QNetworkSessionPrivateImpl::open()
// Clear possible previous states
iStoppedByUser = false;
iClosedByUser = false;
- iDeprecatedConnectionId = 0;
TInt error = iSocketServ.Connect();
if (error != KErrNone) {
@@ -358,44 +379,6 @@ void QNetworkSessionPrivateImpl::open()
}
if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
- // Search through existing connections.
- // If there is already connection which matches to given IAP
- // try to attach to existing connection.
- TBool connected(EFalse);
- TConnectionInfoBuf connInfo;
- TUint count;
- if (iConnection.EnumerateConnections(count) == KErrNone) {
- for (TUint i=1; i<=count; i++) {
- // Note: GetConnectionInfo expects 1-based index.
- if (iConnection.GetConnectionInfo(i, connInfo) == KErrNone) {
- SymbianNetworkConfigurationPrivate *symbianConfig =
- toSymbianConfig(privateConfiguration(publicConfig));
-
- if (connInfo().iIapId == symbianConfig->numericIdentifier()) {
- if (iConnection.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) {
- activeConfig = publicConfig;
-#ifndef QT_NO_NETWORKINTERFACE
- activeInterface = interface(symbianConfig->numericIdentifier());
-#endif
- connected = ETrue;
- startTime = QDateTime::currentDateTime();
- // Use name of the IAP to open global 'Open C' RConnection
- QByteArray nameAsByteArray = publicConfig.name().toUtf8();
- ifreq ifr;
- memset(&ifr, 0, sizeof(struct ifreq));
- strcpy(ifr.ifr_name, nameAsByteArray.constData());
- error = setdefaultif(&ifr);
- isOpen = true;
- // Make sure that state will be Connected
- newState(QNetworkSession::Connected);
- emit quitPendingWaitsForOpened();
- break;
- }
- }
- }
- }
- }
- if (!connected) {
SymbianNetworkConfigurationPrivate *symbianConfig =
toSymbianConfig(privateConfiguration(publicConfig));
@@ -420,13 +403,20 @@ void QNetworkSessionPrivateImpl::open()
if (!IsActive()) {
SetActive();
}
- newState(QNetworkSession::Connecting);
- }
+ // Avoid flip flop of states if the configuration is already
+ // active. IsOpen/opened() will indicate when ready.
+ if (state != QNetworkSession::Connected) {
+ newState(QNetworkSession::Connecting);
+ }
} else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
SymbianNetworkConfigurationPrivate *symbianConfig =
toSymbianConfig(privateConfiguration(publicConfig));
#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ // On Symbian^3 if service network is not reachable, it triggers a UI (aka EasyWLAN) where
+ // user can create new IAPs. To detect this, we need to store the number of IAPs
+ // there was before connection was started.
+ iKnownConfigsBeforeConnectionStart = engine->accessPointConfigurationIdentifiers();
TConnPrefList snapPref;
TExtendedConnPref prefs;
prefs.SetSnapId(symbianConfig->numericIdentifier());
@@ -441,7 +431,11 @@ void QNetworkSessionPrivateImpl::open()
if (!IsActive()) {
SetActive();
}
- newState(QNetworkSession::Connecting);
+ // Avoid flip flop of states if the configuration is already
+ // active. IsOpen/opened() will indicate when ready.
+ if (state != QNetworkSession::Connected) {
+ newState(QNetworkSession::Connecting);
+ }
} else if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
iKnownConfigsBeforeConnectionStart = engine->accessPointConfigurationIdentifiers();
iConnection.Start(iStatus);
@@ -453,6 +447,7 @@ void QNetworkSessionPrivateImpl::open()
if (error != KErrNone) {
isOpen = false;
+ isOpening = false;
iError = QNetworkSession::UnknownSessionError;
emit QNetworkSessionPrivate::error(iError);
if (ipConnectionNotifier) {
@@ -496,19 +491,19 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
<< "close() called, session state is: " << state << " and isOpen is : "
<< isOpen;
#endif
- if (!isOpen) {
+
+ if (!isOpen && state != QNetworkSession::Connecting) {
return;
}
// Mark this session as closed-by-user so that we are able to report
// distinguish between stop() and close() state transitions
// when reporting.
iClosedByUser = true;
-
isOpen = false;
- activeConfig = QNetworkConfiguration();
+ isOpening = false;
+
serviceConfig = QNetworkConfiguration();
- Cancel();
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (iMobility) {
delete iMobility;
@@ -522,17 +517,33 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
iHandleStateNotificationsFromManager = true;
}
- iConnection.Close();
+ Cancel(); // closes iConnection
iSocketServ.Close();
- // Close global 'Open C' RConnection
- setdefaultif(0);
+ // Close global 'Open C' RConnection. If OpenC supports,
+ // close the defaultif for good to avoid difficult timing
+ // and bouncing issues of network going immediately back up
+ // because of e.g. select() thread etc.
+ if (iDynamicUnSetdefaultif) {
+ iDynamicUnSetdefaultif();
+ } else {
+ setdefaultif(0);
+ }
- if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
+ // If UserChoice, go down immediately. If some other configuration,
+ // go down immediately if there is no reports expected from the platform;
+ // in practice Connection Monitor is aware of connections only after
+ // KFinishedSelection event, and hence reports only after that event, but
+ // that does not seem to be trusted on all Symbian versions --> safest
+ // to go down.
+ if (publicConfig.type() == QNetworkConfiguration::UserChoice || state == QNetworkSession::Connecting) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "going disconnected right away, since either UserChoice or Connecting";
+#endif
newState(QNetworkSession::Closing);
newState(QNetworkSession::Disconnected);
}
-
if (allowSignals) {
emit closed();
}
@@ -593,6 +604,7 @@ void QNetworkSessionPrivateImpl::stop()
#endif
// Since we are open, use RConnection to stop the interface
isOpen = false;
+ isOpening = false;
iStoppedByUser = true;
newState(QNetworkSession::Closing);
if (ipConnectionNotifier) {
@@ -602,6 +614,7 @@ void QNetworkSessionPrivateImpl::stop()
}
iConnection.Stop(RConnection::EStopAuthoritative);
isOpen = true;
+ isOpening = false;
close(false);
emit closed();
}
@@ -611,8 +624,13 @@ void QNetworkSessionPrivateImpl::migrate()
{
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (iMobility) {
- // Close global 'Open C' RConnection
- setdefaultif(0);
+ // Close global 'Open C' RConnection. If openC supports, use the 'heavy'
+ // version to block all subsequent requests.
+ if (iDynamicUnSetdefaultif) {
+ iDynamicUnSetdefaultif();
+ } else {
+ setdefaultif(0);
+ }
// Start migrating to new IAP
iMobility->MigrateToPreferredCarrier();
}
@@ -694,8 +712,17 @@ void QNetworkSessionPrivateImpl::PreferredCarrierAvailable(TAccessPointInfo aOld
SymbianNetworkConfigurationPrivate *symbianConfig =
toSymbianConfig(privateConfiguration(configs[i]));
- if (symbianConfig->numericIdentifier() == aNewAPInfo.AccessPoint())
- emit preferredConfigurationChanged(configs[i], aIsSeamless);
+ if (symbianConfig->numericIdentifier() == aNewAPInfo.AccessPoint()) {
+ // Any slot connected to the signal might throw an std::exception,
+ // which must not propagate into Symbian code (this function is a callback
+ // from platform). We could convert exception to a symbian Leave, but since the
+ // prototype of this function bans this (no trailing 'L'), we just catch
+ // and drop.
+ QT_TRY {
+ emit preferredConfigurationChanged(configs[i], aIsSeamless);
+ }
+ QT_CATCH (std::exception&) {}
+ }
}
} else {
migrate();
@@ -705,7 +732,10 @@ void QNetworkSessionPrivateImpl::PreferredCarrierAvailable(TAccessPointInfo aOld
void QNetworkSessionPrivateImpl::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*/, TBool /*aIsSeamless*/)
{
if (iALREnabled > 0) {
- emit newConfigurationActivated();
+ QT_TRY {
+ emit newConfigurationActivated();
+ }
+ QT_CATCH (std::exception&) {}
} else {
accept();
}
@@ -715,10 +745,11 @@ void QNetworkSessionPrivateImpl::Error(TInt /*aError*/)
{
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
qDebug() << "QNS this : " << QString::number((uint)this) << " - "
- << "roaming Error() occured";
+ << "roaming Error() occured, isOpen is: " << isOpen;
#endif
if (isOpen) {
isOpen = false;
+ isOpening = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::RoamingError;
@@ -727,18 +758,24 @@ void QNetworkSessionPrivateImpl::Error(TInt /*aError*/)
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- syncStateWithInterface();
- // In some cases IAP is still in Connected state when
- // syncStateWithInterface(); is called
- // => Following call makes sure that Session state
- // changes immediately to Disconnected.
- newState(QNetworkSession::Disconnected);
- emit closed();
+ QT_TRY {
+ syncStateWithInterface();
+ // In some cases IAP is still in Connected state when
+ // syncStateWithInterface(); is called
+ // => Following call makes sure that Session state
+ // changes immediately to Disconnected.
+ newState(QNetworkSession::Disconnected);
+ emit closed();
+ }
+ QT_CATCH (std::exception&) {}
} else if (iStoppedByUser) {
// If the user of this session has called the stop() and
// configuration is based on internet SNAP, this needs to be
// done here because platform might roam.
- newState(QNetworkSession::Disconnected);
+ QT_TRY {
+ newState(QNetworkSession::Disconnected);
+ }
+ QT_CATCH (std::exception&) {}
}
}
#endif
@@ -870,7 +907,7 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
_LIT(KSetting, "IAP\\Id");
iConnection.GetIntSetting(KSetting, iapId);
}
-
+
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
// Try to search IAP from the used SNAP using IAP Id
@@ -892,8 +929,8 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
// <=> Note: It's possible that in this case reported IAP is
// clone of the one of the IAPs of the used SNAP
// => If mappingName matches, clone has been found
- QNetworkConfiguration pt = QNetworkConfigurationManager()
- .configurationFromIdentifier(QString::number(qHash(iapId)));
+ QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier(
+ QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId)));
SymbianNetworkConfigurationPrivate *symbianConfig =
toSymbianConfig(privateConfiguration(pt));
@@ -907,20 +944,58 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
}
}
} else {
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ // On Symbian^3 (only, not earlier or Symbian^4) if the SNAP was not reachable, it triggers
+ // user choice type of activity (EasyWLAN). As a result, a new IAP may be created, and
+ // hence if was not found yet. Therefore update configurations and see if there is something new.
+ // 1. Update knowledge from the databases.
+ engine->requestUpdate();
+ // 2. Check if new configuration was created during connection creation
+ QList<QString> knownConfigs = engine->accessPointConfigurationIdentifiers();
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "opened configuration was not known beforehand, looking for new.";
+#endif
+ if (knownConfigs.count() > iKnownConfigsBeforeConnectionStart.count()) {
+ // Configuration count increased => new configuration was created
+ // => Search new, created configuration
+ QString newIapId;
+ for (int i=0; i < iKnownConfigsBeforeConnectionStart.count(); i++) {
+ if (knownConfigs[i] != iKnownConfigsBeforeConnectionStart[i]) {
+ newIapId = knownConfigs[i];
+ break;
+ }
+ }
+ if (newIapId.isEmpty()) {
+ newIapId = knownConfigs[knownConfigs.count()-1];
+ }
+ pt = QNetworkConfigurationManager().configurationFromIdentifier(newIapId);
+ if (pt.isValid()) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "new configuration was found, name, IAP id: " << pt.name() << pt.identifier();
+#endif
+ return pt;
+ }
+ }
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "configuration was not found, returning invalid.";
+#endif
+#endif // OCC_FUNCTIONALITY_AVAILABLE
// Given IAP Id was not found from known IAPs array
return QNetworkConfiguration();
}
-
// Matching IAP was not found from used SNAP
// => IAP from another SNAP is returned
// (Note: Returned IAP matches to given IAP Id)
return pt;
}
#endif
-
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
if (engine) {
- QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier(QString::number(qHash(iapId)));
+ QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier(
+ QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId)));
// Try to found User Selected IAP from known IAPs (accessPointConfigurations)
if (pt.isValid()) {
return pt;
@@ -957,6 +1032,10 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
void QNetworkSessionPrivateImpl::RunL()
{
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "RConnection::RunL with status code: " << iStatus.Int();
+#endif
TInt statusCode = iStatus.Int();
switch (statusCode) {
@@ -977,13 +1056,14 @@ void QNetworkSessionPrivateImpl::RunL()
if (error != KErrNone) {
isOpen = false;
+ isOpening = false;
iError = QNetworkSession::UnknownSessionError;
- emit QNetworkSessionPrivate::error(iError);
+ QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError));
Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- syncStateWithInterface();
+ QT_TRYCATCH_LEAVING(syncStateWithInterface());
return;
}
@@ -995,6 +1075,7 @@ void QNetworkSessionPrivateImpl::RunL()
#endif
isOpen = true;
+ isOpening = false;
activeConfig = newActiveConfig;
SymbianNetworkConfigurationPrivate *symbianConfig =
@@ -1010,26 +1091,30 @@ void QNetworkSessionPrivateImpl::RunL()
startTime = QDateTime::currentDateTime();
- newState(QNetworkSession::Connected);
- emit quitPendingWaitsForOpened();
+ QT_TRYCATCH_LEAVING({
+ newState(QNetworkSession::Connected);
+ emit quitPendingWaitsForOpened();
+ });
}
break;
case KErrNotFound: // Connection failed
isOpen = false;
+ isOpening = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::InvalidConfigurationError;
- emit QNetworkSessionPrivate::error(iError);
+ QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError));
Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- syncStateWithInterface();
+ QT_TRYCATCH_LEAVING(syncStateWithInterface());
break;
case KErrCancel: // Connection attempt cancelled
case KErrAlreadyExists: // Connection already exists
default:
isOpen = false;
+ isOpening = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
if (publicConfig.state() == QNetworkConfiguration::Undefined ||
@@ -1038,12 +1123,12 @@ void QNetworkSessionPrivateImpl::RunL()
} else {
iError = QNetworkSession::UnknownSessionError;
}
- emit QNetworkSessionPrivate::error(iError);
+ QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError));
Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- syncStateWithInterface();
+ QT_TRYCATCH_LEAVING(syncStateWithInterface());
break;
}
}
@@ -1110,6 +1195,12 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
return false;
}
+ // Make sure that some lagging 'connecting' state-changes do not overwrite
+ // if we are already connected (may righfully still happen with roaming though).
+ if (state == QNetworkSession::Connected && newState == QNetworkSession::Connecting) {
+ return false;
+ }
+
bool emitSessionClosed = false;
// If we abruptly go down and user hasn't closed the session, we've been aborted.
@@ -1123,6 +1214,7 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
// application or session stops connection or when network drops
// unexpectedly).
isOpen = false;
+ isOpening = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::SessionAbortedError;
@@ -1187,7 +1279,7 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
QNetworkConfiguration config = bestConfigFromSNAP(publicConfig);
if ((config.state() == QNetworkConfiguration::Defined) ||
(config.state() == QNetworkConfiguration::Discovered)) {
-
+ activeConfig = QNetworkConfiguration();
state = newState;
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed E to: " << state;
@@ -1208,24 +1300,30 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
}
}
}
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ // If the retVal is not true here, it means that the status update may apply to an IAP outside of
+ // SNAP (session is based on SNAP but follows IAP outside of it), which may occur on Symbian^3 EasyWlan.
+ if (retVal == false && activeConfig.d.data() && activeConfig.d.data()->numericId == accessPointId) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed G to: " << state;
+#endif
+ if (newState == QNetworkSession::Disconnected) {
+ activeConfig = QNetworkConfiguration();
+ }
+ state = newState;
+ emit q->stateChanged(state);
+ retVal = true;
+ }
+#endif
}
}
-
if (emitSessionClosed) {
emit closed();
}
if (state == QNetworkSession::Disconnected) {
- // The connection has gone down, and processing of status updates must be
- // stopped. Depending on platform, there may come 'connecting/connected' states
- // considerably later (almost a second). Connection id is an increasing
- // number, so this does not affect next _real_ 'conneting/connected' states.
-
- SymbianNetworkConfigurationPrivate *symbianConfig =
- toSymbianConfig(privateConfiguration(publicConfig));
-
- iDeprecatedConnectionId = symbianConfig->connectionIdentifier();
+ // Just in case clear activeConfiguration.
+ activeConfig = QNetworkConfiguration();
}
-
return retVal;
}
@@ -1250,7 +1348,6 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne
case KFinishedSelection:
if (aError == KErrNone)
{
- // The user successfully selected an IAP to be used
break;
}
else
@@ -1364,7 +1461,7 @@ void ConnectionProgressNotifier::DoCancel()
void ConnectionProgressNotifier::RunL()
{
if (iStatus == KErrNone) {
- iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError);
+ QT_TRYCATCH_LEAVING(iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError));
SetActive();
iConnection.ProgressNotification(iProgress, iStatus);
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h
index b045ff1..0754ace 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.h
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.h
@@ -73,6 +73,8 @@ QT_BEGIN_NAMESPACE
class ConnectionProgressNotifier;
class SymbianEngine;
+typedef void (*TOpenCUnSetdefaultifFunction)();
+
class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
, public MMobilityProtocolResp
@@ -153,6 +155,9 @@ private: // data
QDateTime startTime;
+ RLibrary iOpenCLibrary;
+ TOpenCUnSetdefaultifFunction iDynamicUnSetdefaultif;
+
mutable RSocketServ iSocketServ;
mutable RConnection iConnection;
mutable RConnectionMonitor iConnectionMonitor;
@@ -162,7 +167,6 @@ private: // data
bool iFirstSync;
bool iStoppedByUser;
bool iClosedByUser;
- TUint32 iDeprecatedConnectionId;
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
CActiveCommsMobilityApiExt* iMobility;
@@ -178,6 +182,8 @@ private: // data
TUint32 iOldRoamingIap;
TUint32 iNewRoamingIap;
+ bool isOpening;
+
friend class ConnectionProgressNotifier;
};
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index ab1ba28..ca444c1 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -46,7 +46,6 @@
#include <cdbcols.h>
#include <d32dbms.h>
#include <nifvar.h>
-#include <QEventLoop>
#include <QTimer>
#include <QTime> // For randgen seeding
#include <QtCore> // For randgen seeding
@@ -73,9 +72,6 @@
QT_BEGIN_NAMESPACE
-#ifdef SNAP_FUNCTIONALITY_AVAILABLE
- static const int KValueThatWillBeAddedToSNAPId = 1000;
-#endif
static const int KUserChoiceIAPId = 0;
SymbianNetworkConfigurationPrivate::SymbianNetworkConfigurationPrivate()
@@ -114,8 +110,8 @@ QString SymbianNetworkConfigurationPrivate::bearerName() const
}
SymbianEngine::SymbianEngine(QObject *parent)
-: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iFirstUpdate(true), iInitOk(true),
- iIgnoringUpdates(false)
+: QBearerEngine(parent), CActive(CActive::EPriorityHigh), iFirstUpdate(true), iInitOk(true),
+ iUpdatePending(false)
{
}
@@ -135,6 +131,9 @@ void SymbianEngine::initialize()
}
TRAP_IGNORE(iConnectionMonitor.ConnectL());
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+ TRAP_IGNORE(iConnectionMonitor.SetUintAttribute(EBearerIdAll, 0, KBearerGroupThreshold, 1));
+#endif
TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this));
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
@@ -190,6 +189,28 @@ SymbianEngine::~SymbianEngine()
delete cleanup;
}
+void SymbianEngine::delayedConfigurationUpdate()
+{
+ QMutexLocker locker(&mutex);
+
+ if (iUpdatePending) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug("QNCM delayed configuration update (ECommit or ERecover occurred).");
+#endif
+ TRAPD(error, updateConfigurationsL());
+ if (error == KErrNone) {
+ updateStatesToSnaps();
+ }
+ iUpdatePending = false;
+ // Start monitoring again.
+ if (!IsActive()) {
+ SetActive();
+ // Start waiting for new notification
+ ipCommsDB->RequestNotification(iStatus);
+ }
+ }
+}
+
bool SymbianEngine::hasIdentifier(const QString &id)
{
QMutexLocker locker(&mutex);
@@ -261,7 +282,7 @@ void SymbianEngine::updateConfigurationsL()
RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL(connectionMethods[i]);
CleanupClosePushL(connectionMethod);
TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId);
- QString ident = QString::number(qHash(iapId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId));
if (accessPointConfigurations.contains(ident)) {
knownConfigs.removeOne(ident);
} else {
@@ -272,7 +293,11 @@ void SymbianEngine::updateConfigurationsL()
accessPointConfigurations.insert(ptr->id, ptr);
mutex.unlock();
- emit configurationAdded(ptr);
+ // Emit configuration added. Connected slots may throw execptions
+ // which propagate here --> must be converted to leaves (standard
+ // std::exception would cause any TRAP trapping this function to terminate
+ // program).
+ QT_TRYCATCH_LEAVING(emit configurationAdded(ptr));
mutex.lock();
}
}
@@ -288,15 +313,15 @@ void SymbianEngine::updateConfigurationsL()
RCmDestination destination;
destination = iCmManager.DestinationL(destinations[i]);
CleanupClosePushL(destination);
- QString ident = QString::number(qHash(destination.Id()+KValueThatWillBeAddedToSNAPId)); //TODO: Check if it's ok to add 1000 SNAP Id to prevent SNAP ids overlapping IAP ids
+ QString ident = QT_BEARERMGMT_CONFIGURATION_SNAP_PREFIX +
+ QString::number(qHash(destination.Id()));
if (snapConfigurations.contains(ident)) {
knownSnapConfigs.removeOne(ident);
} else {
SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate;
- CleanupStack::PushL(cpPriv);
HBufC *pName = destination.NameLC();
- cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length());
+ QT_TRYCATCH_LEAVING(cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()));
CleanupStack::PopAndDestroy(pName);
pName = NULL;
@@ -313,10 +338,8 @@ void SymbianEngine::updateConfigurationsL()
snapConfigurations.insert(ident, ptr);
mutex.unlock();
- emit configurationAdded(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationAdded(ptr));
mutex.lock();
-
- CleanupStack::Pop(cpPriv);
}
QNetworkConfigurationPrivatePointer privSNAP = snapConfigurations.value(ident);
@@ -325,7 +348,7 @@ void SymbianEngine::updateConfigurationsL()
CleanupClosePushL(connectionMethod);
TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId);
- QString iface = QString::number(qHash(iapId));
+ QString iface = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId));
// Check that IAP can be found from accessPointConfigurations list
QNetworkConfigurationPrivatePointer priv = accessPointConfigurations.value(iface);
if (!priv) {
@@ -336,7 +359,7 @@ void SymbianEngine::updateConfigurationsL()
accessPointConfigurations.insert(ptr->id, ptr);
mutex.unlock();
- emit configurationAdded(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationAdded(ptr));
mutex.lock();
QMutexLocker configLocker(&privSNAP->mutex);
@@ -380,7 +403,7 @@ void SymbianEngine::updateConfigurationsL()
TInt retVal = pDbTView->GotoFirstRecord();
while (retVal == KErrNone) {
pDbTView->ReadUintL(TPtrC(COMMDB_ID), apId);
- QString ident = QString::number(qHash(apId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
if (accessPointConfigurations.contains(ident)) {
knownConfigs.removeOne(ident);
} else {
@@ -390,7 +413,7 @@ void SymbianEngine::updateConfigurationsL()
accessPointConfigurations.insert(ident, ptr);
mutex.unlock();
- emit configurationAdded(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationAdded(ptr));
mutex.lock();
} else {
delete cpPriv;
@@ -400,7 +423,7 @@ void SymbianEngine::updateConfigurationsL()
}
CleanupStack::PopAndDestroy(pDbTView);
#endif
- updateActiveAccessPoints();
+ QT_TRYCATCH_LEAVING(updateActiveAccessPoints());
foreach (const QString &oldIface, knownConfigs) {
//remove non existing IAP
@@ -408,6 +431,7 @@ void SymbianEngine::updateConfigurationsL()
mutex.unlock();
emit configurationRemoved(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationRemoved(ptr));
mutex.lock();
// Remove non existing IAP from SNAPs
@@ -431,6 +455,7 @@ void SymbianEngine::updateConfigurationsL()
mutex.unlock();
emit configurationRemoved(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationRemoved(ptr));
mutex.lock();
}
@@ -445,14 +470,12 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
RCmConnectionMethod& connectionMethod)
{
SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate;
- CleanupStack::PushL(cpPriv);
-
TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId);
- QString ident = QString::number(qHash(iapId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId));
HBufC *pName = connectionMethod.GetStringAttributeL(CMManager::ECmName);
CleanupStack::PushL(pName);
- cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length());
+ QT_TRYCATCH_LEAVING(cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()));
CleanupStack::PopAndDestroy(pName);
pName = NULL;
@@ -500,7 +523,7 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
if (error == KErrNone && pName) {
CleanupStack::PushL(pName);
- cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length());
+ QT_TRYCATCH_LEAVING(cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length()));
CleanupStack::PopAndDestroy(pName);
pName = NULL;
}
@@ -518,8 +541,6 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
cpPriv->purpose = QNetworkConfiguration::UnknownPurpose;
cpPriv->roamingSupported = false;
-
- CleanupStack::Pop(cpPriv);
return cpPriv;
}
#else
@@ -550,9 +571,9 @@ void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL(
User::Leave(KErrNotFound);
}
- QString ident = QString::number(qHash(aApId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(aApId));
- apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length());
+ QT_TRYCATCH_LEAVING(apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length()));
apNetworkConfiguration->isValid = true;
apNetworkConfiguration->id = ident;
apNetworkConfiguration->numericId = aApId;
@@ -617,10 +638,12 @@ QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfigurationL()
TCmDefConnValue defaultConnectionValue;
iCmManager.ReadDefConnL(defaultConnectionValue);
if (defaultConnectionValue.iType == ECmDefConnDestination) {
- QString iface = QString::number(qHash(defaultConnectionValue.iId+KValueThatWillBeAddedToSNAPId));
+ QString iface = QT_BEARERMGMT_CONFIGURATION_SNAP_PREFIX +
+ QString::number(qHash(defaultConnectionValue.iId));
ptr = snapConfigurations.value(iface);
} else if (defaultConnectionValue.iType == ECmDefConnConnectionMethod) {
- QString iface = QString::number(qHash(defaultConnectionValue.iId));
+ QString iface = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX +
+ QString::number(qHash(defaultConnectionValue.iId));
ptr = accessPointConfigurations.value(iface);
}
#endif
@@ -658,8 +681,14 @@ void SymbianEngine::updateActiveAccessPoints()
iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount);
iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
User::WaitForRequest(status);
- QString ident = QString::number(qHash(apId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ if (!ptr) {
+ // If IAP was not found, check if the update was about EasyWLAN
+ ptr = configurationFromEasyWlan(apId, connectionId);
+ }
+#endif
if (ptr) {
iConnectionMonitor.GetIntAttribute(connectionId, subConnectionCount, KConnectionStatus, connectionStatus, status);
User::WaitForRequest(status);
@@ -690,7 +719,7 @@ void SymbianEngine::updateActiveAccessPoints()
if (iOnline != online) {
iOnline = online;
mutex.unlock();
- emit this->onlineStateChanged(iOnline);
+ emit this->onlineStateChanged(online);
mutex.lock();
}
}
@@ -715,7 +744,8 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn
// Set state of returned IAPs to Discovered
// if state is not already Active
for(TUint i=0; i<iapInfo.iCount; i++) {
- QString ident = QString::number(qHash(iapInfo.iIap[i].iIapId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX +
+ QString::number(qHash(iapInfo.iIap[i].iIapId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
if (ptr) {
unavailableConfigs.removeOne(ident);
@@ -783,6 +813,59 @@ void SymbianEngine::updateStatesToSnaps()
}
}
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+void SymbianEngine::updateMobileBearerToConfigs(TConnMonBearerInfo bearerInfo)
+{
+ QHash<QString, QNetworkConfigurationPrivatePointer>::const_iterator i =
+ accessPointConfigurations.constBegin();
+ while (i != accessPointConfigurations.constEnd()) {
+ QNetworkConfigurationPrivatePointer ptr = i.value();
+
+ QMutexLocker locker(&ptr->mutex);
+
+ SymbianNetworkConfigurationPrivate *p = toSymbianConfig(ptr);
+
+ if (p->bearer >= SymbianNetworkConfigurationPrivate::Bearer2G &&
+ p->bearer <= SymbianNetworkConfigurationPrivate::BearerHSPA) {
+ switch (bearerInfo) {
+ case EBearerInfoCSD:
+ p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G;
+ break;
+ case EBearerInfoWCDMA:
+ p->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA;
+ break;
+ case EBearerInfoCDMA2000:
+ p->bearer = SymbianNetworkConfigurationPrivate::BearerCDMA2000;
+ break;
+ case EBearerInfoGPRS:
+ p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G;
+ break;
+ case EBearerInfoHSCSD:
+ p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G;
+ break;
+ case EBearerInfoEdgeGPRS:
+ p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G;
+ break;
+ case EBearerInfoWcdmaCSD:
+ p->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA;
+ break;
+ case EBearerInfoHSDPA:
+ p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA;
+ break;
+ case EBearerInfoHSUPA:
+ p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA;
+ break;
+ case EBearerInfoHSxPA:
+ p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA;
+ break;
+ }
+ }
+
+ ++i;
+ }
+}
+#endif
+
bool SymbianEngine::changeConfigurationStateTo(QNetworkConfigurationPrivatePointer ptr,
QNetworkConfiguration::StateFlags newState)
{
@@ -873,55 +956,30 @@ void SymbianEngine::RunL()
{
QMutexLocker locker(&mutex);
- if (iIgnoringUpdates) {
-#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
- qDebug("QNCM CommsDB event handling postponed (postpone-timer running because IAPs/SNAPs were updated very recently).");
-#endif
- return;
- }
-
- RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int());
-
- switch (event) {
- case RDbNotifier::EUnlock: /** All read locks have been removed. */
- case RDbNotifier::ECommit: /** A transaction has been committed. */
- case RDbNotifier::ERollback: /** A transaction has been rolled back */
- case RDbNotifier::ERecover: /** The database has been recovered */
+ if (iStatus != KErrCancel) {
+ // By default, start relistening notifications. Stop only if interesting event occured.
+ iWaitingCommsDatabaseNotifications = true;
+ RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int());
+ switch (event) {
+ case RDbNotifier::ECommit: /** A transaction has been committed. */
+ case RDbNotifier::ERecover: /** The database has been recovered */
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
- qDebug("QNCM CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int());
+ qDebug("QNCM CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int());
#endif
- iIgnoringUpdates = true;
- // Other events than ECommit get lower priority. In practice with those events,
- // we delay_before_updating methods, whereas
- // with ECommit we _update_before_delaying the reaction to next event.
- // Few important notes: 1) listening to only ECommit does not seem to be adequate,
- // but updates will be missed. Hence other events are reacted upon too.
- // 2) RDbNotifier records the most significant event, and that will be returned once
- // we issue new RequestNotification, and hence updates will not be missed even
- // when we are 'not reacting to them' for few seconds.
- if (event == RDbNotifier::ECommit) {
- TRAPD(error, updateConfigurationsL());
- if (error == KErrNone) {
- updateStatesToSnaps();
- }
- locker.unlock();
- waitRandomTime();
- locker.relock();
- } else {
- locker.unlock();
- waitRandomTime();
- locker.relock();
- TRAPD(error, updateConfigurationsL());
- if (error == KErrNone) {
- updateStatesToSnaps();
+ // Mark that there is update pending. No need to ask more events,
+ // as we know we will be updating anyway when the timer expires.
+ if (!iUpdatePending) {
+ iUpdatePending = true;
+ iWaitingCommsDatabaseNotifications = false;
+ // Update after random time, so that many processes won't
+ // start updating simultaneously
+ updateConfigurationsAfterRandomTime();
}
+ break;
+ default:
+ // Do nothing
+ break;
}
- iIgnoringUpdates = false; // Wait time done, allow updating again
- iWaitingCommsDatabaseNotifications = true;
- break;
- default:
- // Do nothing
- break;
}
if (iWaitingCommsDatabaseNotifications) {
@@ -945,6 +1003,20 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
QMutexLocker locker(&mutex);
switch (aEvent.EventType()) {
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+ case EConnMonBearerInfoChange:
+ {
+ CConnMonBearerInfoChange* realEvent;
+ realEvent = (CConnMonBearerInfoChange*) &aEvent;
+ TUint connectionId = realEvent->ConnectionId();
+ if (connectionId == EBearerIdAll) {
+ //Network level event
+ TConnMonBearerInfo bearerInfo = (TConnMonBearerInfo)realEvent->BearerInfo();
+ updateMobileBearerToConfigs(bearerInfo);
+ }
+ break;
+ }
+#endif
case EConnMonConnectionStatusChange:
{
CConnMonConnectionStatusChange* realEvent;
@@ -960,14 +1032,23 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
TRequestStatus status;
iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
User::WaitForRequest(status);
- QString ident = QString::number(qHash(apId));
+
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ if (!ptr) {
+ // Check if status was regarding EasyWLAN
+ ptr = configurationFromEasyWlan(apId, connectionId);
+ }
+#endif
if (ptr) {
ptr->mutex.lock();
toSymbianConfig(ptr)->connectionId = connectionId;
ptr->mutex.unlock();
- emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
- connectionId, QNetworkSession::Connecting);
+ QT_TRYCATCH_LEAVING(
+ emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
+ connectionId, QNetworkSession::Connecting)
+ );
}
} else if (connectionStatus == KLinkLayerOpen) {
// Connection has been successfully opened
@@ -977,31 +1058,41 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
TRequestStatus status;
iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
User::WaitForRequest(status);
- QString ident = QString::number(qHash(apId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ if (!ptr) {
+ // Check for EasyWLAN
+ ptr = configurationFromEasyWlan(apId, connectionId);
+ }
+#endif
if (ptr) {
ptr->mutex.lock();
toSymbianConfig(ptr)->connectionId = connectionId;
ptr->mutex.unlock();
// Configuration is Active
- if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) {
- updateStatesToSnaps();
- }
- emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
- connectionId, QNetworkSession::Connected);
+ QT_TRYCATCH_LEAVING(
+ if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) {
+ updateStatesToSnaps();
+ }
+ emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
+ connectionId, QNetworkSession::Connected);
- if (!iOnline) {
- iOnline = true;
- emit this->onlineStateChanged(iOnline);
- }
+ if (!iOnline) {
+ iOnline = true;
+ emit this->onlineStateChanged(iOnline);
+ }
+ );
}
} else if (connectionStatus == KConfigDaemonStartingDeregistration) {
TUint connectionId = realEvent->ConnectionId();
QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId);
if (ptr) {
- emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
- connectionId, QNetworkSession::Closing);
+ QT_TRYCATCH_LEAVING(
+ emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
+ connectionId, QNetworkSession::Closing)
+ );
}
} else if (connectionStatus == KLinkLayerClosed ||
connectionStatus == KConnectionClosed) {
@@ -1011,12 +1102,13 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId);
if (ptr) {
// Configuration is either Defined or Discovered
- if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) {
- updateStatesToSnaps();
- }
-
- emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
- connectionId, QNetworkSession::Disconnected);
+ QT_TRYCATCH_LEAVING(
+ if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) {
+ updateStatesToSnaps();
+ }
+ emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
+ connectionId, QNetworkSession::Disconnected);
+ );
}
bool online = false;
@@ -1030,7 +1122,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
}
if (iOnline != online) {
iOnline = online;
- emit this->onlineStateChanged(iOnline);
+ QT_TRYCATCH_LEAVING(emit this->onlineStateChanged(iOnline));
}
}
}
@@ -1043,12 +1135,13 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
TConnMonIapInfo iaps = realEvent->IapAvailability();
QList<QString> unDiscoveredConfigs = accessPointConfigurations.keys();
for ( TUint i = 0; i < iaps.Count(); i++ ) {
- QString ident = QString::number(qHash(iaps.iIap[i].iIapId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX +
+ QString::number(qHash(iaps.iIap[i].iIapId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
if (ptr) {
// Configuration is either Discovered or Active
- changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered);
+ QT_TRYCATCH_LEAVING(changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered));
unDiscoveredConfigs.removeOne(ident);
}
}
@@ -1056,7 +1149,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface);
if (ptr) {
// Configuration is Defined
- changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined);
+ QT_TRYCATCH_LEAVING(changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined));
}
}
}
@@ -1073,8 +1166,14 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
TRequestStatus status;
iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
User::WaitForRequest(status);
- QString ident = QString::number(qHash(apId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ if (!ptr) {
+ // If IAP was not found, check if the update was about EasyWLAN
+ ptr = configurationFromEasyWlan(apId, connectionId);
+ }
+#endif
if (ptr) {
QMutexLocker configLocker(&ptr->mutex);
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
@@ -1090,6 +1189,43 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
}
}
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+// Tries to derive configuration from EasyWLAN.
+// First checks if the interface brought up was EasyWLAN, then derives the real SSID,
+// and looks up configuration based on that one.
+QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromEasyWlan(TUint32 apId, TUint connectionId)
+{
+ if (apId == iCmManager.EasyWlanIdL()) {
+ TRequestStatus status;
+ TBuf<50> easyWlanNetworkName;
+ iConnectionMonitor.GetStringAttribute( connectionId, 0, KNetworkName,
+ easyWlanNetworkName, status );
+ User::WaitForRequest(status);
+ if (status.Int() == KErrNone) {
+ QString realSSID = QString::fromUtf16(easyWlanNetworkName.Ptr(), easyWlanNetworkName.Length());
+
+ // Browser through all items and check their name for match
+ QHash<QString, QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> >::const_iterator i =
+ accessPointConfigurations.constBegin();
+ while (i != accessPointConfigurations.constEnd()) {
+ QNetworkConfigurationPrivatePointer ptr = i.value();
+
+ QMutexLocker configLocker(&ptr->mutex);
+
+ if (ptr->name == realSSID) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNCM EasyWlan uses real SSID: " << realSSID;
+#endif
+ return ptr;
+ }
+ ++i;
+ }
+ }
+ }
+ return QNetworkConfigurationPrivatePointer();
+}
+#endif
+
// Sessions may use this function to report configuration state changes,
// because on some Symbian platforms (especially Symbian^3) all state changes are not
// reported by the RConnectionMonitor, in particular in relation to stop() call,
@@ -1107,7 +1243,8 @@ void SymbianEngine::configurationStateChangeReport(TUint32 accessPointId, QNetwo
switch (newState) {
case QNetworkSession::Disconnected:
{
- QString ident = QString::number(qHash(accessPointId));
+ QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX +
+ QString::number(qHash(accessPointId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
if (ptr) {
// Configuration is either Defined or Discovered
@@ -1129,15 +1266,13 @@ void SymbianEngine::configurationStateChangeReport(TUint32 accessPointId, QNetwo
}
// Waits for 2..6 seconds.
-void SymbianEngine::waitRandomTime()
+void SymbianEngine::updateConfigurationsAfterRandomTime()
{
- int iTimeToWait = qMax(2000, (qAbs(qrand()) % 7) * 1000);
+ int iTimeToWait = qMax(1000, (qAbs(qrand()) % 68) * 100);
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
qDebug("QNCM waiting random time: %d ms", iTimeToWait);
#endif
- QEventLoop loop;
- QTimer::singleShot(iTimeToWait, &loop, SLOT(quit()));
- loop.exec();
+ QTimer::singleShot(iTimeToWait, this, SLOT(delayedConfigurationUpdate()));
}
QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aConnectionId)
@@ -1158,7 +1293,7 @@ QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aCon
AccessPointsAvailabilityScanner::AccessPointsAvailabilityScanner(SymbianEngine& owner,
RConnectionMonitor& connectionMonitor)
- : CActive(CActive::EPriorityStandard), iOwner(owner), iConnectionMonitor(connectionMonitor)
+ : CActive(CActive::EPriorityHigh), iOwner(owner), iConnectionMonitor(connectionMonitor)
{
CActiveScheduler::Add(this);
}
@@ -1198,9 +1333,9 @@ void AccessPointsAvailabilityScanner::RunL()
if (iStatus.Int() != KErrNone) {
iIapBuf().iCount = 0;
- iOwner.accessPointScanningReady(false,iIapBuf());
+ QT_TRYCATCH_LEAVING(iOwner.accessPointScanningReady(false,iIapBuf()));
} else {
- iOwner.accessPointScanningReady(true,iIapBuf());
+ QT_TRYCATCH_LEAVING(iOwner.accessPointScanningReady(true,iIapBuf()));
}
}
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index 18fd249..cfddc29 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -55,6 +55,9 @@
// Uncomment and compile QtBearer to gain detailed state tracing
// #define QT_BEARERMGMT_SYMBIAN_DEBUG
+#define QT_BEARERMGMT_CONFIGURATION_SNAP_PREFIX QLatin1String("S_")
+#define QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX QLatin1String("I_")
+
class CCommsDatabase;
class QEventLoop;
@@ -159,6 +162,7 @@ Q_SIGNALS:
public Q_SLOTS:
void updateConfigurations();
+ void delayedConfigurationUpdate();
private:
void updateStatesToSnaps();
@@ -169,6 +173,7 @@ private:
bool changeConfigurationStateAtMaxTo(QNetworkConfigurationPrivatePointer ptr,
QNetworkConfiguration::StateFlags newState);
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+ void updateMobileBearerToConfigs(TConnMonBearerInfo bearerInfo);
SymbianNetworkConfigurationPrivate *configFromConnectionMethodL(RCmConnectionMethod& connectionMethod);
#else
bool readNetworkConfigurationValuesFromCommsDb(
@@ -183,7 +188,7 @@ private:
void accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo);
void startCommsDatabaseNotifications();
void stopCommsDatabaseNotifications();
- void waitRandomTime();
+ void updateConfigurationsAfterRandomTime();
QNetworkConfigurationPrivatePointer defaultConfigurationL();
TBool GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) const;
@@ -201,6 +206,9 @@ private:
// For QNetworkSessionPrivate to indicate about state changes
void configurationStateChangeReport(TUint32 accessPointId,
QNetworkSession::State newState);
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ QNetworkConfigurationPrivatePointer configurationFromEasyWlan(TUint32 apId, TUint connectionId);
+#endif
private: // Data
bool iFirstUpdate;
@@ -211,7 +219,7 @@ private: // Data
TBool iOnline;
TBool iInitOk;
TBool iUpdateGoingOn;
- TBool iIgnoringUpdates;
+ TBool iUpdatePending;
AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner;
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index a093e4c..4addb84 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -175,13 +175,6 @@ symbian: {
particlesImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/particles
DEPLOYMENT += folderlistmodelImport gesturesImport particlesImport
-
- contains(QT_CONFIG, webkit): {
- webkitImport.sources = $$QT_BUILD_TREE/imports/QtWebKit/qmlwebkitplugin$${QT_LIBINFIX}.dll
- webkitImport.sources += $$QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/declarative/qmldir
- webkitImport.path = c:$$QT_IMPORTS_BASE_DIR/QtWebKit
- DEPLOYMENT += webkitImport
- }
}
graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.js b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.js
new file mode 100644
index 0000000..092bc2b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.js
@@ -0,0 +1 @@
+;
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml
new file mode 100644
index 0000000..56e7885
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml
@@ -0,0 +1,8 @@
+import Qt 4.7
+import "qtbug_11600.js" as Test
+
+QtObject {
+ id: goo
+
+ property bool test: undefined == goo.Test.foo
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11606.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11606.qml
new file mode 100644
index 0000000..6efb9c1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11606.qml
@@ -0,0 +1,12 @@
+import Qt 4.7
+
+QtObject {
+ property bool test: false
+ Component.onCompleted: {
+ try {
+ console.log(sorryNoSuchProperty);
+ } catch (e) {
+ test = true;
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml
index 4395ba3..2548005 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml
@@ -1,10 +1,10 @@
import Qt 4.7
+import Qt.test 1.0
-Item {
+MyQmlObject {
id: root
property int foo: 12
- property int console: 11
property bool test1: foo == 12
property bool test2: console != 11
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
index 7bb8a8e..849879e 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
@@ -86,6 +86,7 @@ class MyQmlObject : public QObject
Q_PROPERTY(bool trueProperty READ trueProperty CONSTANT)
Q_PROPERTY(bool falseProperty READ falseProperty CONSTANT)
Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int console READ console CONSTANT)
Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringChanged)
Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty NOTIFY objectChanged)
Q_PROPERTY(QDeclarativeListProperty<QObject> objectListProperty READ objectListProperty CONSTANT)
@@ -142,6 +143,7 @@ public:
QRegExp regExp() { return m_regExp; }
void setRegExp(const QRegExp &regExp) { m_regExp = regExp; }
+ int console() const { return 11; }
signals:
void basicSignal();
void argumentSignal(int a, QString b, qreal c);
@@ -555,7 +557,9 @@ Q_DECLARE_METATYPE(QScriptValue);
class MyInvokableObject : public QObject
{
Q_OBJECT
+ Q_ENUMS(TestEnum)
public:
+ enum TestEnum { EnumValue1, EnumValue2 };
MyInvokableObject() { reset(); }
int invoked() const { return m_invoked; }
@@ -587,6 +591,8 @@ public:
Q_INVOKABLE void method_overload(int a) { invoke(16); m_actuals << a; }
Q_INVOKABLE void method_overload(int a, int b) { invoke(17); m_actuals << a << b; }
+ Q_INVOKABLE void method_with_enum(TestEnum e) { invoke(18); m_actuals << (int)e; }
+
private:
void invoke(int idx) { if (m_invoked != -1) m_invokedError = true; m_invoked = idx;}
int m_invoked;
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 50da55d..43900ae 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -155,6 +155,8 @@ private slots:
void eval();
void function();
void qtbug_10696();
+ void qtbug_11606();
+ void qtbug_11600();
void include();
@@ -1719,6 +1721,13 @@ void tst_qdeclarativeecmascript::callQtInvokables()
QCOMPARE(o.actuals().count(), 2);
QCOMPARE(o.actuals().at(0), QVariant(10));
QCOMPARE(o.actuals().at(1), QVariant(11));
+
+ o.reset();
+ QCOMPARE(engine->evaluate("object.method_with_enum(9)").isUndefined(), true);
+ QCOMPARE(o.error(), false);
+ QCOMPARE(o.invoked(), 18);
+ QCOMPARE(o.actuals().count(), 1);
+ QCOMPARE(o.actuals().at(0), QVariant(9));
}
// QTBUG-5675
@@ -2503,6 +2512,25 @@ void tst_qdeclarativeecmascript::qtbug_10696()
delete o;
}
+void tst_qdeclarativeecmascript::qtbug_11606()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("qtbug_11606.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
+void tst_qdeclarativeecmascript::qtbug_11600()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("qtbug_11600.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
+
QTEST_MAIN(tst_qdeclarativeecmascript)
#include "tst_qdeclarativeecmascript.moc"
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.errors.txt
new file mode 100644
index 0000000..c83e5ae
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.errors.txt
@@ -0,0 +1 @@
+4:5:Illegal property name
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.qml
new file mode 100644
index 0000000..6077de4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.qml
@@ -0,0 +1,5 @@
+import Qt 4.7
+
+QtObject {
+ property int parseInt
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 413843a..3ce356e 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -370,6 +370,7 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("destroyedSignal") << "destroyedSignal.qml" << "destroyedSignal.errors.txt" << false;
QTest::newRow("assignToNamespace") << "assignToNamespace.qml" << "assignToNamespace.errors.txt" << false;
QTest::newRow("invalidOn") << "invalidOn.qml" << "invalidOn.errors.txt" << false;
+ QTest::newRow("invalidProperty") << "invalidProperty.qml" << "invalidProperty.errors.txt" << false;
}
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index 3d66733..f15ac8f 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -559,6 +559,18 @@ void tst_qdeclarativelistmodel::error_data()
QTest::newRow("QML elements not allowed in ListElement")
<< "import Qt 4.7\nListModel { ListElement { a: Item { } } }"
<< "ListElement: cannot contain nested elements";
+
+ QTest::newRow("qualified ListElement supported")
+ << "import Qt 4.7 as Foo\nFoo.ListModel { Foo.ListElement { a: 123 } }"
+ << "";
+
+ QTest::newRow("qualified ListElement required")
+ << "import Qt 4.7 as Foo\nFoo.ListModel { ListElement { a: 123 } }"
+ << "ListElement is not a type";
+
+ QTest::newRow("unknown qualified ListElement not allowed")
+ << "import Qt 4.7\nListModel { Foo.ListElement { a: 123 } }"
+ << "Foo.ListElement - Foo is not a namespace";
}
void tst_qdeclarativelistmodel::error()
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js
index c165e29..30499e9 100644
--- a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js
+++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js
@@ -5,3 +5,7 @@ function loadComponent() {
return component.status;
}
+function createComponent() {
+ var component = Qt.createComponent("createComponentData.qml");
+ return component.createObject(null);
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml
index aae7a91..33203c7 100644
--- a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml
+++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml
@@ -3,8 +3,10 @@ import "createComponent_lib.js" as Test
Item {
property int status: Component.Null
+ property int readValue: 0
Component.onCompleted: {
status = Test.loadComponent()
+ readValue = Test.createComponent().test;
}
}
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index fb100a5..895ee6c 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -365,14 +365,12 @@ void tst_qdeclarativeqt::createComponent()
void tst_qdeclarativeqt::createComponent_pragmaLibrary()
{
// Currently, just loading createComponent_lib.qml causes crash on some platforms
- /*
QDeclarativeComponent component(&engine, TEST_FILE("createComponent_lib.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
-
- QEXPECT_FAIL("", "QTBUG-11507", Continue);
QCOMPARE(object->property("status").toInt(), int(QDeclarativeComponent::Ready));
- */
+ QCOMPARE(object->property("readValue").toInt(), int(1913));
+ delete object;
}
void tst_qdeclarativeqt::createQmlObject()
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index 2913ddd..639b2f3 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -263,7 +263,6 @@ void tst_qdeclarativestates::attachedPropertyChanges()
MyAttached *att = qobject_cast<MyAttached*>(attObj);
QVERIFY(att);
- QEXPECT_FAIL("", "QTBUG-11283", Abort);
QCOMPARE(att->foo(), 1);
}
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments.qml b/tests/auto/declarative/qdeclarativetext/data/alignments.qml
index b10c335..b1f701b 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments.qml
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments.qml
@@ -20,8 +20,6 @@ Rectangle {
id: t
anchors.fill: parent
- font.family: "Misc Fixed"
- font.pixelSize: 8
horizontalAlignment: TextEdit.AlignRight
verticalAlignment: TextEdit.AlignBottom
wrapMode: TextEdit.WordWrap
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png b/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png
index b0ad381..99de219 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png b/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png
index 98232ce..cb85251 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png b/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png
index b606ba5..ddca549 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_lb.png b/tests/auto/declarative/qdeclarativetext/data/alignments_lb.png
index a8f095d..1b50a81 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments_lb.png
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments_lb.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_lc.png b/tests/auto/declarative/qdeclarativetext/data/alignments_lc.png
index c2a0679..f041b86 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments_lc.png
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments_lc.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_lt.png b/tests/auto/declarative/qdeclarativetext/data/alignments_lt.png
index c019551..c75e0d1 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments_lt.png
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments_lt.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_rb.png b/tests/auto/declarative/qdeclarativetext/data/alignments_rb.png
index 08d581a..b06a5da 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments_rb.png
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments_rb.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_rc.png b/tests/auto/declarative/qdeclarativetext/data/alignments_rc.png
index d607955..e468857 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments_rc.png
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments_rc.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_rt.png b/tests/auto/declarative/qdeclarativetext/data/alignments_rt.png
index 2acfb9e..576715f 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments_rt.png
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments_rt.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 91b3ca0..8a4f152 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -424,6 +424,13 @@ void tst_qdeclarativetext::alignments()
QFETCH(int, vAlign);
QFETCH(QString, expectfile);
+#ifdef Q_WS_X11
+ // Font-specific, but not likely platform-specific, so only test on one platform
+ QFont fn;
+ fn.setRawName("-misc-fixed-medium-r-*-*-8-*-*-*-*-*-*-*");
+ QApplication::setFont(fn);
+#endif
+
QDeclarativeView *canvas = createView(SRCDIR "/data/alignments.qml");
canvas->show();
@@ -443,7 +450,7 @@ void tst_qdeclarativetext::alignments()
QImage expect(expectfile);
-#ifdef Q_OS_LINUX
+#ifdef Q_WS_X11
// Font-specific, but not likely platform-specific, so only test on one platform
QCOMPARE(actual,expect);
#endif
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml b/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml
index b10c335..b1f701b 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml
+++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml
@@ -20,8 +20,6 @@ Rectangle {
id: t
anchors.fill: parent
- font.family: "Misc Fixed"
- font.pixelSize: 8
horizontalAlignment: TextEdit.AlignRight
verticalAlignment: TextEdit.AlignBottom
wrapMode: TextEdit.WordWrap
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments_cb.png b/tests/auto/declarative/qdeclarativetextedit/data/alignments_cb.png
index b0ad381..99de219 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/alignments_cb.png
+++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments_cb.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments_cc.png b/tests/auto/declarative/qdeclarativetextedit/data/alignments_cc.png
index 98232ce..cb85251 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/alignments_cc.png
+++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments_cc.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments_ct.png b/tests/auto/declarative/qdeclarativetextedit/data/alignments_ct.png
index b606ba5..ddca549 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/alignments_ct.png
+++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments_ct.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments_lb.png b/tests/auto/declarative/qdeclarativetextedit/data/alignments_lb.png
index a8f095d..1b50a81 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/alignments_lb.png
+++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments_lb.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments_lc.png b/tests/auto/declarative/qdeclarativetextedit/data/alignments_lc.png
index c2a0679..f041b86 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/alignments_lc.png
+++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments_lc.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments_lt.png b/tests/auto/declarative/qdeclarativetextedit/data/alignments_lt.png
index c019551..c75e0d1 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/alignments_lt.png
+++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments_lt.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments_rb.png b/tests/auto/declarative/qdeclarativetextedit/data/alignments_rb.png
index 08d581a..b06a5da 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/alignments_rb.png
+++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments_rb.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments_rc.png b/tests/auto/declarative/qdeclarativetextedit/data/alignments_rc.png
index d607955..e468857 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/alignments_rc.png
+++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments_rc.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments_rt.png b/tests/auto/declarative/qdeclarativetextedit/data/alignments_rt.png
index 2acfb9e..576715f 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/alignments_rt.png
+++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments_rt.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 009d354..f1a367f 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -325,6 +325,13 @@ void tst_qdeclarativetextedit::alignments()
QFETCH(int, vAlign);
QFETCH(QString, expectfile);
+#ifdef Q_WS_X11
+ // Font-specific, but not likely platform-specific, so only test on one platform
+ QFont fn;
+ fn.setRawName("-misc-fixed-medium-r-*-*-8-*-*-*-*-*-*-*");
+ QApplication::setFont(fn);
+#endif
+
QDeclarativeView *canvas = createView(SRCDIR "/data/alignments.qml");
canvas->show();
@@ -344,7 +351,7 @@ void tst_qdeclarativetextedit::alignments()
QImage expect(expectfile);
-#ifdef Q_OS_LINUX
+#ifdef Q_WS_X11
// Font-specific, but not likely platform-specific, so only test on one platform
QCOMPARE(actual,expect);
#endif
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/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/qml/deviceorientation_maemo.cpp b/tools/qml/deviceorientation_maemo5.cpp
index 443edc8..e942579 100644
--- a/tools/qml/deviceorientation_maemo.cpp
+++ b/tools/qml/deviceorientation_maemo5.cpp
@@ -124,4 +124,4 @@ DeviceOrientation* DeviceOrientation::instance()
return o;
}
-#include "deviceorientation_maemo.moc"
+#include "deviceorientation_maemo5.moc"
diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp
index 3ae2b5e..8aa029f 100644
--- a/tools/qml/loggerwidget.cpp
+++ b/tools/qml/loggerwidget.cpp
@@ -39,29 +39,48 @@
**
****************************************************************************/
-#include "loggerwidget.h"
#include <qglobal.h>
#include <QDebug>
#include <QSettings>
#include <QActionGroup>
#include <QMenu>
+#include <QPlainTextEdit>
+#ifdef Q_WS_MAEMO_5
+# include <QScrollArea>
+# include <QVBoxLayout>
+# include "texteditautoresizer_maemo5.h"
+#endif
+
+#include "loggerwidget.h"
QT_BEGIN_NAMESPACE
LoggerWidget::LoggerWidget(QWidget *parent) :
- QPlainTextEdit(parent),
+ QMainWindow(parent),
m_visibilityOrigin(SettingsOrigin)
{
setAttribute(Qt::WA_QuitOnClose, false);
setWindowTitle(tr("Warnings"));
+ m_plainTextEdit = new QPlainTextEdit();
+
+#ifdef Q_WS_MAEMO_5
+ new TextEditAutoResizer(m_plainTextEdit);
+ setAttribute(Qt::WA_Maemo5StackedWindow);
+ QScrollArea *area = new QScrollArea();
+ area->setWidget(m_plainTextEdit);
+ area->setWidgetResizable(true);
+ setCentralWidget(area);
+#else
+ setCentralWidget(m_plainTextEdit);
+#endif
readSettings();
setupPreferencesMenu();
}
void LoggerWidget::append(const QString &msg)
{
- appendPlainText(msg);
+ m_plainTextEdit->appendPlainText(msg);
if (!isVisible() && (defaultVisibility() == AutoShowWarnings))
setVisible(true);
diff --git a/tools/qml/loggerwidget.h b/tools/qml/loggerwidget.h
index fd20c41..13c319f 100644
--- a/tools/qml/loggerwidget.h
+++ b/tools/qml/loggerwidget.h
@@ -42,12 +42,17 @@
#ifndef LOGGERWIDGET_H
#define LOGGERWIDGET_H
-#include <QPlainTextEdit>
+#include <QMainWindow>
+#include <QMetaType>
QT_BEGIN_NAMESPACE
-class LoggerWidget : public QPlainTextEdit {
-Q_OBJECT
+class QPlainTextEdit;
+class QMenu;
+class QAction;
+
+class LoggerWidget : public QMainWindow {
+ Q_OBJECT
public:
LoggerWidget(QWidget *parent=0);
@@ -80,6 +85,7 @@ private:
QMenu *m_preferencesMenu;
QAction *m_showWidgetAction;
+ QPlainTextEdit *m_plainTextEdit;
enum ConfigOrigin { CommandLineOrigin, SettingsOrigin };
ConfigOrigin m_visibilityOrigin;
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index a75023b..de5bca2 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -346,7 +346,7 @@ int main(int argc, char ** argv)
if (stayOnTop)
wflags |= Qt::WindowStaysOnTopHint;
- QDeclarativeViewer *viewer = new QDeclarativeViewer(0, wflags);
+ QDeclarativeViewer *viewer = QDeclarativeViewer::instance(0, wflags);
viewer->setAttribute(Qt::WA_DeleteOnClose, true);
if (!scriptopts.isEmpty()) {
QStringList options =
diff --git a/tools/qml/proxysettings.cpp b/tools/qml/proxysettings.cpp
index 3255e42..ffaa4c0 100644
--- a/tools/qml/proxysettings.cpp
+++ b/tools/qml/proxysettings.cpp
@@ -48,11 +48,14 @@
QT_BEGIN_NAMESPACE
ProxySettings::ProxySettings (QWidget * parent)
- : QDialog (parent), Ui::ProxySettings()
+ : QDialog (parent), Ui::ProxySettings()
{
setupUi (this);
+#if !defined Q_WS_MAEMO_5
+ // the onscreen keyboard can't cope with masks
proxyServerEdit->setInputMask ("000.000.000.000;_");
+#endif
QIntValidator *validator = new QIntValidator (0, 9999, this);
proxyPortEdit->setValidator (validator);
diff --git a/tools/qml/proxysettings.h b/tools/qml/proxysettings.h
index 325929a..5d4d137 100644
--- a/tools/qml/proxysettings.h
+++ b/tools/qml/proxysettings.h
@@ -44,7 +44,11 @@
#include <QDialog>
#include <QNetworkProxy>
+#ifdef Q_WS_MAEMO_5
+#include "ui_proxysettings_maemo5.h"
+#else
#include "ui_proxysettings.h"
+#endif
QT_BEGIN_NAMESPACE
/**
diff --git a/tools/qml/proxysettings_maemo5.ui b/tools/qml/proxysettings_maemo5.ui
new file mode 100644
index 0000000..83f0c2a
--- /dev/null
+++ b/tools/qml/proxysettings_maemo5.ui
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ProxySettings</class>
+ <widget class="QDialog" name="ProxySettings">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>449</width>
+ <height>164</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>HTTP Proxy</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <property name="leftMargin">
+ <number>16</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>16</number>
+ </property>
+ <property name="bottomMargin">
+ <number>8</number>
+ </property>
+ <property name="horizontalSpacing">
+ <number>16</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="proxyCheckBox">
+ <property name="text">
+ <string>Use HTTP Proxy</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" rowspan="2">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0" rowspan="2">
+ <widget class="QWidget" name="widget" native="true">
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="horizontalSpacing">
+ <number>16</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="serverAddressLabel">
+ <property name="text">
+ <string>Server</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="proxyServerEdit">
+ <property name="placeholderText">
+ <string>Name or IP</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Port</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="proxyPortEdit">
+ <property name="text">
+ <string>8080</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="usernameLabel">
+ <property name="text">
+ <string>Username</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="usernameEdit"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="passwordLabel">
+ <property name="text">
+ <string>Password</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="passwordEdit">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>proxyCheckBox</tabstop>
+ <tabstop>proxyServerEdit</tabstop>
+ <tabstop>proxyPortEdit</tabstop>
+ <tabstop>usernameEdit</tabstop>
+ <tabstop>passwordEdit</tabstop>
+ <tabstop>buttonBox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ProxySettings</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>318</x>
+ <y>100</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>116</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>ProxySettings</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>318</x>
+ <y>100</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>116</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri
index 58d8cc1..3e5a88b 100644
--- a/tools/qml/qml.pri
+++ b/tools/qml/qml.pri
@@ -19,10 +19,12 @@ SOURCES += $$PWD/qmlruntime.cpp \
RESOURCES = $$PWD/qmlruntime.qrc
maemo5 {
QT += dbus
- SOURCES += $$PWD/deviceorientation_maemo.cpp
+ HEADERS += $$PWD/texteditautoresizer_maemo5.h
+ SOURCES += $$PWD/deviceorientation_maemo5.cpp
+ FORMS = $$PWD/recopts_maemo5.ui \
+ $$PWD/proxysettings_maemo5.ui
} else {
SOURCES += $$PWD/deviceorientation.cpp
+ FORMS = $$PWD/recopts.ui \
+ $$PWD/proxysettings.ui
}
-
-FORMS = $$PWD/recopts.ui \
- $$PWD/proxysettings.ui
diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro
index 9cdec77..63efff1 100644
--- a/tools/qml/qml.pro
+++ b/tools/qml/qml.pro
@@ -29,6 +29,9 @@ wince* {
QT += webkit
}
}
+maemo5 {
+ QT += maemo5
+}
symbian {
TARGET.UID3 = 0x20021317
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index 676881d..109de7d 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -44,7 +44,15 @@
#ifdef hz
#undef hz
#endif
-#include "ui_recopts.h"
+#ifdef Q_WS_MAEMO_5
+# include <QMaemo5ValueButton>
+# include <QMaemo5ListPickSelector>
+# include <QWidgetAction>
+# include <QStringListModel>
+# include "ui_recopts_maemo5.h"
+#else
+# include "ui_recopts.h"
+#endif
#include "qmlruntime.h"
#include <qdeclarativecontext.h>
@@ -136,24 +144,59 @@ private:
};
-class SizedMenuBar : public QMenuBar
-{
+
+#if defined(Q_WS_MAEMO_5)
+
+class Maemo5PickerAction : public QWidgetAction {
Q_OBJECT
public:
- SizedMenuBar(QWidget *parent, QWidget *referenceWidget)
- : QMenuBar(parent), refWidget(referenceWidget)
+ Maemo5PickerAction(const QString &text, QActionGroup *actions, QObject *parent)
+ : QWidgetAction(parent), m_text(text), m_actions(actions)
+ { }
+
+ QWidget *createWidget(QWidget *parent)
{
+ QMaemo5ValueButton *button = new QMaemo5ValueButton(m_text, parent);
+ button->setValueLayout(QMaemo5ValueButton::ValueUnderTextCentered);
+ QMaemo5ListPickSelector *pick = new QMaemo5ListPickSelector(button);
+ button->setPickSelector(pick);
+ if (m_actions) {
+ QStringList sl;
+ int curIdx = -1, idx = 0;
+ foreach (QAction *a, m_actions->actions()) {
+ sl << a->text();
+ if (a->isChecked())
+ curIdx = idx;
+ idx++;
+ }
+ pick->setModel(new QStringListModel(sl));
+ pick->setCurrentIndex(curIdx);
+ } else {
+ button->setEnabled(false);
+ }
+ connect(pick, SIGNAL(selected(QString)), this, SLOT(emitTriggered()));
+ return button;
}
- virtual QSize sizeHint() const
+private slots:
+ void emitTriggered()
{
- return QSize(refWidget->sizeHint().width(), QMenuBar::sizeHint().height());
+ QMaemo5ListPickSelector *pick = qobject_cast<QMaemo5ListPickSelector *>(sender());
+ if (!pick)
+ return;
+ int idx = pick->currentIndex();
+
+ if (m_actions && idx >= 0 && idx < m_actions->actions().count())
+ m_actions->actions().at(idx)->trigger();
}
private:
- QWidget *refWidget;
+ QString m_text;
+ QPointer<QActionGroup> m_actions;
};
+#endif // Q_WS_MAEMO_5
+
static struct { const char *name, *args; } ffmpegprofiles[] = {
{"Maximum Quality", "-sameq"},
{"High Quality", "-qmax 2"},
@@ -170,7 +213,9 @@ public:
RecordingDialog(QWidget *parent) : QDialog(parent)
{
setupUi(this);
+#ifndef Q_WS_MAEMO_5
hz->setValidator(new QDoubleValidator(hz));
+#endif
for (int i=0; ffmpegprofiles[i].name; ++i) {
profile->addItem(ffmpegprofiles[i].name);
}
@@ -197,6 +242,132 @@ public:
return ffmpegprofiles[i].args[0] ? QLatin1String(ffmpegprofiles[i].args) : customargs;
}
+ void setOriginalSize(const QSize &s)
+ {
+ QString str = tr("Original (%1x%2)").arg(s.width()).arg(s.height());
+
+#ifdef Q_WS_MAEMO_5
+ sizeCombo->setItemText(0, str);
+#else
+ sizeOriginal->setText(str);
+ if (sizeWidth->value()<=1) {
+ sizeWidth->setValue(s.width());
+ sizeHeight->setValue(s.height());
+ }
+#endif
+ }
+
+ void showffmpegOptions(bool b)
+ {
+#ifdef Q_WS_MAEMO_5
+ profileLabel->setVisible(b);
+ profile->setVisible(b);
+ ffmpegHelp->setVisible(b);
+ args->setVisible(b);
+#else
+ ffmpegOptions->setVisible(b);
+#endif
+ }
+
+ void showRateOptions(bool b)
+ {
+#ifdef Q_WS_MAEMO_5
+ rateLabel->setVisible(b);
+ rateCombo->setVisible(b);
+#else
+ rateOptions->setVisible(b);
+#endif
+ }
+
+ void setVideoRate(int rate)
+ {
+#ifdef Q_WS_MAEMO_5
+ int idx;
+ if (rate >= 60)
+ idx = 0;
+ else if (rate >= 50)
+ idx = 2;
+ else if (rate >= 25)
+ idx = 3;
+ else if (rate >= 24)
+ idx = 4;
+ else if (rate >= 20)
+ idx = 5;
+ else if (rate >= 15)
+ idx = 6;
+ else
+ idx = 7;
+ rateCombo->setCurrentIndex(idx);
+#else
+ if (rate == 24)
+ hz24->setChecked(true);
+ else if (rate == 25)
+ hz25->setChecked(true);
+ else if (rate == 50)
+ hz50->setChecked(true);
+ else if (rate == 60)
+ hz60->setChecked(true);
+ else {
+ hzCustom->setChecked(true);
+ hz->setText(QString::number(rate));
+ }
+#endif
+ }
+
+ int videoRate() const
+ {
+#ifdef Q_WS_MAEMO_5
+ switch (rateCombo->currentIndex()) {
+ case 0: return 60;
+ case 1: return 50;
+ case 2: return 25;
+ case 3: return 24;
+ case 4: return 20;
+ case 5: return 15;
+ case 7: return 10;
+ default: return 60;
+ }
+#else
+ if (hz24->isChecked())
+ return 24;
+ else if (hz25->isChecked())
+ return 25;
+ else if (hz50->isChecked())
+ return 50;
+ else if (hz60->isChecked())
+ return 60;
+ else {
+ return hz->text().toInt();
+ }
+#endif
+ }
+
+ QSize videoSize() const
+ {
+#ifdef Q_WS_MAEMO_5
+ switch (sizeCombo->currentIndex()) {
+ case 0: return QSize();
+ case 1: return QSize(640,480);
+ case 2: return QSize(320,240);
+ case 3: return QSize(1280,720);
+ default: return QSize();
+ }
+#else
+ if (sizeOriginal->isChecked())
+ return QSize();
+ else if (size720p->isChecked())
+ return QSize(1280,720);
+ else if (sizeVGA->isChecked())
+ return QSize(640,480);
+ else if (sizeQVGA->isChecked())
+ return QSize(320,240);
+ else
+ return QSize(sizeWidth->value(), sizeHeight->value());
+#endif
+ }
+
+
+
private slots:
void pickProfile(int i)
{
@@ -363,15 +534,21 @@ QString QDeclarativeViewer::getVideoFileName()
return QFileDialog::getSaveFileName(this, title, "", types.join(";; "));
}
+QDeclarativeViewer *QDeclarativeViewer::inst = 0;
+
+QDeclarativeViewer *QDeclarativeViewer::instance(QWidget *parent, Qt::WindowFlags flags)
+{
+ if (!inst) {
+ inst = new QDeclarativeViewer(parent, flags);
+ inst->setAttribute(Qt::WA_DeleteOnClose);
+ }
+ return inst;
+}
QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
-#if defined(Q_OS_SYMBIAN)
: QMainWindow(parent, flags)
-#else
- : QWidget(parent, flags)
-#endif
- , loggerWindow(new LoggerWidget())
- , frame_stream(0), mb(0)
+ , loggerWindow(new LoggerWidget(this))
+ , frame_stream(0)
, orientation(0)
, showWarningsWindow(0)
, m_scriptOptions(0)
@@ -381,6 +558,10 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
{
QDeclarativeViewer::registerTypes();
setWindowTitle(tr("Qt QML Viewer"));
+#ifdef Q_WS_MAEMO_5
+ setAttribute(Qt::WA_Maemo5StackedWindow);
+// setPalette(QApplication::palette("QLabel"));
+#endif
devicemode = false;
canvas = 0;
@@ -393,9 +574,9 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
senseFfmpeg();
senseImageMagick();
if (!ffmpegAvailable)
- recdlg->ffmpegOptions->hide();
+ recdlg->showffmpegOptions(false);
if (!ffmpegAvailable && !convertAvailable)
- recdlg->rateOptions->hide();
+ recdlg->showRateOptions(false);
QString warn;
if (!ffmpegAvailable) {
if (!convertAvailable)
@@ -422,21 +603,14 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
QObject::connect(warningsWidget(), SIGNAL(closed()), this, SLOT(warningsWidgetClosed()));
if (!(flags & Qt::FramelessWindowHint)) {
- createMenu(menuBar(),0);
+ createMenu();
changeOrientation(orientation->actions().value(0));
+ } else {
+ setMenuBar(0);
}
-#if !defined(Q_OS_SYMBIAN)
- QVBoxLayout *layout = new QVBoxLayout;
- layout->setMargin(0);
- layout->setSpacing(0);
- setLayout(layout);
- if (mb)
- layout->addWidget(mb);
- layout->addWidget(canvas);
-#else
setCentralWidget(canvas);
-#endif
+
namFactory = new NetworkAccessManagerFactory;
canvas->engine()->setNetworkAccessManagerFactory(namFactory);
@@ -468,26 +642,6 @@ void QDeclarativeViewer::enableExperimentalGestures()
canvas->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
}
-int QDeclarativeViewer::menuBarHeight() const
-{
- if (!(windowFlags() & Qt::FramelessWindowHint))
- return menuBar()->height();
- else
- return 0; // don't create menu
-}
-
-QMenuBar *QDeclarativeViewer::menuBar() const
-{
-#if !defined(Q_OS_SYMBIAN)
- if (!mb)
- mb = new SizedMenuBar((QWidget*)this, canvas);
-#else
- mb = QMainWindow::menuBar();
-#endif
-
- return mb;
-}
-
QDeclarativeView *QDeclarativeViewer::view() const
{
return canvas;
@@ -498,120 +652,128 @@ LoggerWidget *QDeclarativeViewer::warningsWidget() const
return loggerWindow;
}
-void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu)
+void QDeclarativeViewer::createMenu()
{
- QObject *parent = flatmenu ? (QObject*)flatmenu : (QObject*)menu;
-
- QMenu *fileMenu = flatmenu ? flatmenu : menu->addMenu(tr("&File"));
-
- QAction *openAction = new QAction(tr("&Open..."), parent);
+ QAction *openAction = new QAction(tr("&Open..."), this);
openAction->setShortcut(QKeySequence("Ctrl+O"));
connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
- fileMenu->addAction(openAction);
- QAction *reloadAction = new QAction(tr("&Reload"), parent);
+ QAction *reloadAction = new QAction(tr("&Reload"), this);
reloadAction->setShortcut(QKeySequence("Ctrl+R"));
connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload()));
- fileMenu->addAction(reloadAction);
-
-#if !defined(Q_OS_SYMBIAN)
- if (flatmenu) flatmenu->addSeparator();
-
- QMenu *recordMenu = flatmenu ? flatmenu : menu->addMenu(tr("&Recording"));
- QAction *snapshotAction = new QAction(tr("&Take Snapshot\tF3"), parent);
+ QAction *snapshotAction = new QAction(tr("&Take Snapshot"), this);
+ snapshotAction->setShortcut(QKeySequence("F3"));
connect(snapshotAction, SIGNAL(triggered()), this, SLOT(takeSnapShot()));
- recordMenu->addAction(snapshotAction);
- recordAction = new QAction(tr("Start Recording &Video\tF9"), parent);
+ recordAction = new QAction(tr("Start Recording &Video"), this);
+ recordAction->setShortcut(QKeySequence("F9"));
connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecordingWithSelection()));
- recordMenu->addAction(recordAction);
- QAction *recordOptions = new QAction(tr("Video &Options..."), parent);
+ QAction *recordOptions = new QAction(tr("Video &Options..."), this);
connect(recordOptions, SIGNAL(triggered()), this, SLOT(chooseRecordingOptions()));
- if (flatmenu)
- flatmenu->addAction(recordOptions);
-
- if (flatmenu) flatmenu->addSeparator();
-
- QMenu *debugMenu = flatmenu ? flatmenu->addMenu(tr("&Debugging")) : menu->addMenu(tr("&Debugging"));
-
- QAction *slowAction = new QAction(tr("&Slow Down Animations"), parent);
+ QAction *slowAction = new QAction(tr("&Slow Down Animations"), this);
slowAction->setShortcut(QKeySequence("Ctrl+."));
slowAction->setCheckable(true);
connect(slowAction, SIGNAL(triggered(bool)), this, SLOT(setSlowMode(bool)));
- debugMenu->addAction(slowAction);
- showWarningsWindow = new QAction(tr("Show Warnings"), parent);
+ showWarningsWindow = new QAction(tr("Show Warnings"), this);
showWarningsWindow->setCheckable((true));
showWarningsWindow->setChecked(loggerWindow->isVisible());
connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool)));
-#if !defined(Q_OS_SYMBIAN)
- debugMenu->addAction(showWarningsWindow);
-#endif
-
- if (flatmenu) flatmenu->addSeparator();
-
-#endif // Q_OS_SYMBIAN
-
- QMenu *settingsMenu = flatmenu ? flatmenu : menu->addMenu(tr("S&ettings"));
- QAction *proxyAction = new QAction(tr("Http &proxy..."), parent);
+ QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this);
connect(proxyAction, SIGNAL(triggered()), this, SLOT(showProxySettings()));
- settingsMenu->addAction(proxyAction);
-#if !defined(Q_OS_SYMBIAN)
- if (!flatmenu)
- settingsMenu->addAction(recordOptions);
- settingsMenu->addMenu(loggerWindow->preferencesMenu());
-#else
- QAction *fullscreenAction = new QAction(tr("Full Screen"), parent);
+ QAction *fullscreenAction = new QAction(tr("Full Screen"), this);
fullscreenAction->setCheckable(true);
connect(fullscreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
- settingsMenu->addAction(fullscreenAction);
-#endif
-
- if (flatmenu) flatmenu->addSeparator();
-
- QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties"));
-
- orientation = new QActionGroup(parent);
- QAction *rotateOrientation = new QAction(tr("Rotate orientation"), parent);
+ QAction *rotateOrientation = new QAction(tr("Rotate orientation"), this);
rotateOrientation->setShortcut(QKeySequence("Ctrl+T"));
- settingsMenu->addAction(rotateOrientation);
connect(rotateOrientation, SIGNAL(triggered()), this, SLOT(rotateOrientation()));
+ orientation = new QActionGroup(this);
orientation->setExclusive(true);
connect(orientation, SIGNAL(triggered(QAction*)), this, SLOT(changeOrientation(QAction*)));
- orientation->addAction(tr("orientation: Portrait"));
- orientation->addAction(tr("orientation: Landscape"));
- orientation->addAction(tr("orientation: Portrait (Inverted)"));
- orientation->addAction(tr("orientation: Landscape (Inverted)"));
- QList<QAction *> actions = orientation->actions();
- for (int i=0; i<actions.count(); i++) {
- propertiesMenu->addAction(actions[i]);
- actions[i]->setCheckable(true);
- }
-
- if (flatmenu) flatmenu->addSeparator();
+ QAction *portraitAction = new QAction(tr("Portrait"), this);
+ portraitAction->setCheckable(true);
+ QAction *landscapeAction = new QAction(tr("Landscape"), this);
+ landscapeAction->setCheckable(true);
+ QAction *portraitInvAction = new QAction(tr("Portrait (inverted)"), this);
+ portraitInvAction->setCheckable(true);
+ QAction *landscapeInvAction = new QAction(tr("Landscape (inverted)"), this);
+ landscapeInvAction->setCheckable(true);
- QMenu *helpMenu = flatmenu ? flatmenu : menu->addMenu(tr("&Help"));
- QAction *aboutAction = new QAction(tr("&About Qt..."), parent);
+ QAction *aboutAction = new QAction(tr("&About Qt..."), this);
connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
- helpMenu->addAction(aboutAction);
- QAction *quitAction = new QAction(tr("&Quit"), parent);
+ QAction *quitAction = new QAction(tr("&Quit"), this);
quitAction->setShortcut(QKeySequence("Ctrl+Q"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+
+ QMenuBar *menu = menuBar();
+ if (!menu)
+ return;
+
+#if defined(Q_WS_MAEMO_5)
+ menu->addAction(openAction);
+ menu->addAction(reloadAction);
+
+ menu->addAction(snapshotAction);
+ menu->addAction(recordAction);
+
+ menu->addAction(recordOptions);
+ menu->addAction(proxyAction);
+
+ menu->addAction(slowAction);
+ menu->addAction(showWarningsWindow);
+
+ orientation->addAction(landscapeAction);
+ orientation->addAction(portraitAction);
+ menu->addAction(new Maemo5PickerAction(tr("Set orientation"), orientation, this));
+ menu->addAction(fullscreenAction);
+ return;
+#endif // Q_WS_MAEMO_5
+
+ QMenu *fileMenu = menu->addMenu(tr("&File"));
+ fileMenu->addAction(openAction);
+ fileMenu->addAction(reloadAction);
fileMenu->addSeparator();
fileMenu->addAction(quitAction);
- if (menu) {
- menu->setFixedHeight(menu->sizeHint().height());
- menu->setMinimumWidth(10);
- }
+
+#if !defined(Q_OS_SYMBIAN)
+ QMenu *recordMenu = menu->addMenu(tr("&Recording"));
+ recordMenu->addAction(snapshotAction);
+ recordMenu->addAction(recordAction);
+
+ QMenu *debugMenu = menu->addMenu(tr("&Debugging"));
+ debugMenu->addAction(slowAction);
+ debugMenu->addAction(showWarningsWindow);
+#endif // ! Q_OS_SYMBIAN
+
+ QMenu *settingsMenu = menu->addMenu(tr("S&ettings"));
+ settingsMenu->addAction(proxyAction);
+#if !defined(Q_OS_SYMBIAN)
+ settingsMenu->addAction(recordOptions);
+ settingsMenu->addMenu(loggerWindow->preferencesMenu());
+#else // ! Q_OS_SYMBIAN
+ settingsMenu->addAction(fullscreenAction);
+#endif // Q_OS_SYMBIAN
+ settingsMenu->addAction(rotateOrientation);
+
+ QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties"));
+
+ orientation->addAction(portraitAction);
+ orientation->addAction(landscapeAction);
+ orientation->addAction(portraitInvAction);
+ orientation->addAction(landscapeInvAction);
+ propertiesMenu->addActions(orientation->actions());
+
+ QMenu *helpMenu = menu->addMenu(tr("&Help"));
+ helpMenu->addAction(aboutAction);
}
void QDeclarativeViewer::showProxySettings()
@@ -685,25 +847,11 @@ void QDeclarativeViewer::chooseRecordingOptions()
recdlg->file->setText(record_file);
// Size
- recdlg->sizeOriginal->setText(tr("Original (%1x%2)").arg(canvas->width()).arg(canvas->height()));
- if (recdlg->sizeWidth->value()<=1) {
- recdlg->sizeWidth->setValue(canvas->width());
- recdlg->sizeHeight->setValue(canvas->height());
- }
+ recdlg->setOriginalSize(canvas->size());
// Rate
- if (record_rate == 24)
- recdlg->hz24->setChecked(true);
- else if (record_rate == 25)
- recdlg->hz25->setChecked(true);
- else if (record_rate == 50)
- recdlg->hz50->setChecked(true);
- else if (record_rate == 60)
- recdlg->hz60->setChecked(true);
- else {
- recdlg->hzCustom->setChecked(true);
- recdlg->hz->setText(QString::number(record_rate));
- }
+ recdlg->setVideoRate(record_rate);
+
// Profile
recdlg->setArguments(record_args.join(" "));
@@ -711,28 +859,9 @@ void QDeclarativeViewer::chooseRecordingOptions()
// File
record_file = recdlg->file->text();
// Size
- if (recdlg->sizeOriginal->isChecked())
- record_outsize = QSize();
- else if (recdlg->size720p->isChecked())
- record_outsize = QSize(1280,720);
- else if (recdlg->sizeVGA->isChecked())
- record_outsize = QSize(640,480);
- else if (recdlg->sizeQVGA->isChecked())
- record_outsize = QSize(320,240);
- else
- record_outsize = QSize(recdlg->sizeWidth->value(),recdlg->sizeHeight->value());
+ record_outsize = recdlg->videoSize();
// Rate
- if (recdlg->hz24->isChecked())
- record_rate = 24;
- else if (recdlg->hz25->isChecked())
- record_rate = 25;
- else if (recdlg->hz50->isChecked())
- record_rate = 50;
- else if (recdlg->hz60->isChecked())
- record_rate = 60;
- else {
- record_rate = recdlg->hz->text().toDouble();
- }
+ record_rate = recdlg->videoRate();
// Profile
record_args = recdlg->arguments().split(" ",QString::SkipEmptyParts);
}
@@ -807,8 +936,9 @@ void QDeclarativeViewer::statusChanged()
initialSize = canvas->initialSize();
if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) {
if (!isFullScreen() && !isMaximized()) {
- resize(QSize(initialSize.width(), initialSize.height()+menuBarHeight()));
- updateSizeHints();
+ canvas->setFixedSize(initialSize);
+ resize(1, 1); // workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrink
+ QTimer::singleShot(0, this, SLOT(updateSizeHints()));
}
}
}
@@ -1181,14 +1311,14 @@ void QDeclarativeViewer::changeOrientation(QAction *action)
return;
action->setChecked(true);
- QString o = action->text().split(QLatin1Char(':')).value(1).trimmed();
+ QString o = action->text();
if (o == QLatin1String("Portrait"))
DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait);
else if (o == QLatin1String("Landscape"))
DeviceOrientation::instance()->setOrientation(DeviceOrientation::Landscape);
- else if (o == QLatin1String("Portrait (Inverted)"))
+ else if (o == QLatin1String("Portrait (inverted)"))
DeviceOrientation::instance()->setOrientation(DeviceOrientation::PortraitInverted);
- else if (o == QLatin1String("Landscape (Inverted)"))
+ else if (o == QLatin1String("Landscape (inverted)"))
DeviceOrientation::instance()->setOrientation(DeviceOrientation::LandscapeInverted);
}
@@ -1197,9 +1327,10 @@ void QDeclarativeViewer::orientationChanged()
if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) {
if (canvas->rootObject()) {
QSizeF rootObjectSize = canvas->rootObject()->boundingRect().size();
- QSize newSize(rootObjectSize.width(), rootObjectSize.height()+menuBarHeight());
- if (size() != newSize) {
- resize(newSize);
+ if (size() != rootObjectSize.toSize()) {
+ canvas->setMinimumSize(rootObjectSize.toSize());
+ canvas->resize(rootObjectSize.toSize());
+ resize(1, 1); // workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrinks
}
}
}
@@ -1253,16 +1384,14 @@ void QDeclarativeViewer::updateSizeHints()
{
if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) {
QSize newWindowSize = canvas->sizeHint();
- newWindowSize.setHeight(newWindowSize.height()+menuBarHeight());
if (!isFullScreen() && !isMaximized()) {
- resize(newWindowSize);
- setFixedSize(newWindowSize);
+ canvas->setMinimumSize(newWindowSize);
+ canvas->resize(newWindowSize);
+ resize(1, 1); // workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrinks
}
} else { // QDeclarativeView::SizeRootObjectToView
canvas->setMinimumSize(QSize(0,0));
canvas->setMaximumSize(QSize(16777215,16777215));
- setMinimumSize(QSize(0,0));
- setMaximumSize(QSize(16777215,16777215));
}
}
diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h
index 27bd217..cec3204 100644
--- a/tools/qml/qmlruntime.h
+++ b/tools/qml/qmlruntime.h
@@ -43,7 +43,6 @@
#define QDECLARATIVEVIEWER_H
#include <QMainWindow>
-#include <QMenuBar>
#include <private/qdeclarativetimer_p.h>
#include <QTime>
#include <QList>
@@ -62,17 +61,17 @@ class QNetworkReply;
class QNetworkCookieJar;
class NetworkAccessManagerFactory;
class QTranslator;
+class QActionGroup;
class QDeclarativeViewer
-#if defined(Q_OS_SYMBIAN)
: public QMainWindow
-#else
- : public QWidget
-#endif
{
-Q_OBJECT
+ Q_OBJECT
+ QDeclarativeViewer(QWidget *parent = 0, Qt::WindowFlags flags = 0);
+ static QDeclarativeViewer *inst;
+
public:
- QDeclarativeViewer(QWidget *parent=0, Qt::WindowFlags flags=0);
+ static QDeclarativeViewer *instance(QWidget *parent = 0, Qt::WindowFlags flags = 0);
~QDeclarativeViewer();
static void registerTypes();
@@ -103,11 +102,8 @@ public:
void addPluginPath(const QString& plugin);
void setUseGL(bool use);
void setUseNativeFileBrowser(bool);
- void updateSizeHints();
void setSizeToView(bool sizeToView);
- QMenuBar *menuBar() const;
-
QDeclarativeView *view() const;
LoggerWidget *warningsWidget() const;
@@ -132,7 +128,7 @@ public slots:
protected:
virtual void keyPressEvent(QKeyEvent *);
virtual bool event(QEvent *);
- void createMenu(QMenuBar *menu, QMenu *flatmenu);
+ void createMenu();
private slots:
void autoStartRecording();
@@ -148,9 +144,10 @@ private slots:
void warningsWidgetOpened();
void warningsWidgetClosed();
+ void updateSizeHints();
+
private:
QString getVideoFileName();
- int menuBarHeight() const;
LoggerWidget *loggerWindow;
QDeclarativeView *canvas;
@@ -173,7 +170,6 @@ private:
QAction *recordAction;
QString currentSkin;
bool scaleSkin;
- mutable QMenuBar *mb;
RecordingDialog *recdlg;
void senseImageMagick();
diff --git a/tools/qml/recopts_maemo5.ui b/tools/qml/recopts_maemo5.ui
new file mode 100644
index 0000000..3bb5eca
--- /dev/null
+++ b/tools/qml/recopts_maemo5.ui
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>RecordingOptions</class>
+ <widget class="QDialog" name="RecordingOptions">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>469</width>
+ <height>142</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Video options</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" columnstretch="0,2,0">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetMinAndMaxSize</enum>
+ </property>
+ <property name="leftMargin">
+ <number>16</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>16</number>
+ </property>
+ <property name="bottomMargin">
+ <number>8</number>
+ </property>
+ <property name="horizontalSpacing">
+ <number>16</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>0</number>
+ </property>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="file"/>
+ </item>
+ <item row="0" column="2" rowspan="3">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>72</width>
+ <height>56</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Size</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="sizeCombo">
+ <item>
+ <property name="text">
+ <string/>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>VGA</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>QVGA</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>720p</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="2" column="0" rowspan="2">
+ <widget class="QLabel" name="rateLabel">
+ <property name="text">
+ <string>Rate</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" rowspan="2">
+ <widget class="QComboBox" name="rateCombo">
+ <item>
+ <property name="text">
+ <string>60 Hz</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>50 Hz</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>25 Hz</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>24 Hz</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>20 Hz</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>15 Hz</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>10 Hz</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLineEdit" name="args"/>
+ </item>
+ <item row="4" column="1">
+ <widget class="QComboBox" name="profile"/>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="profileLabel">
+ <property name="text">
+ <string>Profile</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" colspan="2">
+ <widget class="QLabel" name="warning">
+ <property name="text">
+ <string notr="true">warning</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="2" rowspan="3">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QPushButton" name="pickfile">
+ <property name="text">
+ <string>File</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QPushButton" name="ffmpegHelp">
+ <property name="text">
+ <string>Options</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>RecordingOptions</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>258</x>
+ <y>424</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>60</x>
+ <y>219</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>RecordingOptions</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>258</x>
+ <y>424</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>92</x>
+ <y>219</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>profile</sender>
+ <signal>activated(int)</signal>
+ <receiver>RecordingOptions</receiver>
+ <slot>pickProfile(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>92</x>
+ <y>329</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>48</x>
+ <y>194</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>args</sender>
+ <signal>textEdited(QString)</signal>
+ <receiver>RecordingOptions</receiver>
+ <slot>storeCustomArgs(QString)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>128</x>
+ <y>357</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>102</x>
+ <y>189</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+ <slots>
+ <signal>filePicked(QString)</signal>
+ <signal>argumentsPicked(QString)</signal>
+ <slot>pickFile()</slot>
+ <slot>pickProfile(int)</slot>
+ <slot>storeCustomArgs(QString)</slot>
+ </slots>
+</ui>
diff --git a/tools/qml/texteditautoresizer_maemo5.h b/tools/qml/texteditautoresizer_maemo5.h
new file mode 100644
index 0000000..bb5567a
--- /dev/null
+++ b/tools/qml/texteditautoresizer_maemo5.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** 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 examples 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 <QtGui/qplaintextedit.h>
+#include <QtGui/qtextedit.h>
+#include <QtGui/qabstractkineticscroller.h>
+#include <QtGui/qscrollarea.h>
+#include <QtDebug>
+
+#ifndef TEXTEDITAUTORESIZER_H
+#define TEXTEDITAUTORESIZER_H
+
+class TextEditAutoResizer : public QObject
+{
+ Q_OBJECT
+public:
+ TextEditAutoResizer(QWidget *parent)
+ : QObject(parent), plainTextEdit(qobject_cast<QPlainTextEdit *>(parent)),
+ textEdit(qobject_cast<QTextEdit *>(parent)), edit(qobject_cast<QFrame *>(parent))
+ {
+ // parent must either inherit QPlainTextEdit or QTextEdit!
+ Q_ASSERT(plainTextEdit || textEdit);
+
+ connect(parent, SIGNAL(textChanged()), this, SLOT(textEditChanged()));
+ connect(parent, SIGNAL(cursorPositionChanged()), this, SLOT(textEditChanged()));
+
+ textEditChanged();
+ }
+
+private Q_SLOTS:
+ inline void textEditChanged();
+
+private:
+ QPlainTextEdit *plainTextEdit;
+ QTextEdit *textEdit;
+ QFrame *edit;
+};
+
+void TextEditAutoResizer::textEditChanged()
+{
+ QTextDocument *doc = textEdit ? textEdit->document() : plainTextEdit->document();
+ QRect cursor = textEdit ? textEdit->cursorRect() : plainTextEdit->cursorRect();
+
+ QSize s = doc->size().toSize();
+ if (plainTextEdit)
+ s.setHeight((s.height() + 2) * edit->fontMetrics().lineSpacing());
+
+ const QRect fr = edit->frameRect();
+ const QRect cr = edit->contentsRect();
+
+ edit->setMinimumHeight(qMax(70, s.height() + (fr.height() - cr.height() - 1)));
+
+ // make sure the cursor is visible in case we have a QAbstractScrollArea parent
+ QPoint pos = edit->pos();
+ QWidget *pw = edit->parentWidget();
+ while (pw) {
+ if (qobject_cast<QScrollArea *>(pw))
+ break;
+ pw = pw->parentWidget();
+ }
+
+ if (pw) {
+ QScrollArea *area = static_cast<QScrollArea *>(pw);
+ QPoint scrollto = area->widget()->mapFrom(edit, cursor.center());
+ QPoint margin(10 + cursor.width(), 2 * cursor.height());
+
+ if (QAbstractKineticScroller *scroller = area->property("kineticScroller").value<QAbstractKineticScroller *>()) {
+ scroller->ensureVisible(scrollto, margin.x(), margin.y());
+ } else {
+ area->ensureVisible(scrollto.x(), scrollto.y(), margin.x(), margin.y());
+ }
+ }
+}
+
+#endif