# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1277127386 -10800 # Node ID 4203353e74ea75c32f549a5d37628b99214d96ed # Parent 4ea83c148e8436602cdcf6cc57f98ee49651104c Revision: 201023 Kit: 2010125 diff -r 4ea83c148e84 -r 4203353e74ea group/bld.inf --- a/group/bld.inf Wed Jun 09 10:36:00 2010 +0300 +++ b/group/bld.inf Mon Jun 21 16:36:26 2010 +0300 @@ -25,7 +25,10 @@ TOOLS2 PRJ_EXPORTS +qtextensionsconfig.xml /epoc32/tools/makefile_templates/qt/qtextensionsconfig.xml +qtmobilityheaders.flm /epoc32/tools/makefile_templates/qt/qtmobilityheaders.flm ../qtmobility/features/mobility.prf /epoc32/tools/qt/mkspecs/features/mobility.prf +../qtmobility/features/mobilityconfig.prf /epoc32/tools/qt/mkspecs/features/mobilityconfig.prf //For UDA image ../qtmobility/confml/qtmobility.confml CONFML_EXPORT_PATH(qtmobility.confml,uda_content) @@ -40,4 +43,6 @@ PRJ_EXTENSIONS - +START EXTENSION qt/qtmobilityheaders +OPTION MODULES bearer +END diff -r 4ea83c148e84 -r 4203353e74ea group/qtextensionsconfig.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/qtextensionsconfig.xml Mon Jun 21 16:36:26 2010 +0300 @@ -0,0 +1,13 @@ + + + + + + + + + + + diff -r 4ea83c148e84 -r 4203353e74ea group/qtmobilityheaders.flm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/qtmobilityheaders.flm Mon Jun 21 16:36:26 2010 +0300 @@ -0,0 +1,108 @@ +# /**************************************************************************** +# ** +# ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +# ** Contact: +# ** +# ****************************************************************************/ + +# FLM to generate Qt style headers for QtMobility +QTMOBILITY_ROOT := $(subst group,,$(subst \,/,$(EXTENSION_ROOT)qtmobility/)) +QTMOBILITY_BIN := $(QTMOBILITY_ROOT)bin +QTMOBILITY_INCLUDE := $(QTMOBILITY_ROOT)include +QTMOBILITY_BEARER_INCLUDE := $(QTMOBILITY_INCLUDE)/QtmBearer +QTMOBILITY_CONTACTS_INCLUDE := $(QTMOBILITY_INCLUDE)/QtmContacts +QTMOBILITY_LOCATION_INCLUDE := $(QTMOBILITY_INCLUDE)/QtmLocation +QTMOBILITY_MESSAGING_INCLUDE := $(QTMOBILITY_INCLUDE)/QtmMessaging +QTMOBILITY_MULTIMEDIA_INCLUDE := $(QTMOBILITY_INCLUDE)/QtMultimedia +QTMOBILITY_PUBLISHSUBSCRIBE_INCLUDE := $(QTMOBILITY_INCLUDE)/QtmPubSub +QTMOBILITY_SYSTEMINFO_INCLUDE := $(QTMOBILITY_INCLUDE)/QtmSystemInfo +QTMOBILITY_SERVICEFRAMEWORK_INCLUDE := $(QTMOBILITY_INCLUDE)/QtmServiceFramework +QTMOBILITY_VERSIT_INCLUDE := $(QTMOBILITY_INCLUDE)/QtmVersit +QTMOBILITY_SENSORS_INCLUDE := $(QTMOBILITY_INCLUDE)/QtmSensors +QTMOBILITY_SRC := $(QTMOBILITY_ROOT)src +QTMOBILITY_GLOBAL_SRC := $(QTMOBILITY_SRC)/global +QTMOBILITY_BEARER_SRC := $(QTMOBILITY_SRC)/bearer +QTMOBILITY_CONTACTS_SRC := $(QTMOBILITY_SRC)/contacts +QTMOBILITY_LOCATION_SRC := $(QTMOBILITY_SRC)/location +QTMOBILITY_MESSAGING_SRC := $(QTMOBILITY_SRC)/messaging +QTMOBILITY_MULTIMEDIA_SRC := $(QTMOBILITY_SRC)/multimedia +QTMOBILITY_PUBLISHSUBSCRIBE_SRC := $(QTMOBILITY_SRC)/publishsubscribe +QTMOBILITY_SYSTEMINFO_SRC := $(QTMOBILITY_SRC)/systeminfo +QTMOBILITY_SERVICEFRAMEWORK_SRC := $(QTMOBILITY_SRC)/serviceframework +QTMOBILITY_VERSIT_SRC := $(QTMOBILITY_SRC)/versit +QTMOBILITY_SENSORS_SRC := $(QTMOBILITY_SRC)/sensors + +define generate_module_headers + +EXPORT:: + $(call startrule,generate_module_headers,FORCESUCCESS) \ + cd $(QTMOBILITY_ROOT) && \ + $(PERL) -S $(QTMOBILITY_BIN)/$(SYNCHEADERS) $(1) $(2) \ + $(call endrule,generate_module_headers) + +CLEAN:: + $(call startrule,clean) \ + $(GNURM) -rf $(1) \ + $(call endrule,clean) + +WHAT:: + @(echo ""; \ + $(GNUFIND) $(1) -type f -print | (read LINE; \ + while [ $$$$? -eq 0 ]; do \ + echo "$$$$LINE"; \ + read LINE; \ + done); \ + echo "") $(if $(DESCRAMBLE),2>&1 | $(DESCRAMBLE)) + +endef + +GUARD:=done_$(call sanitise,$(QTMOBILITY_INCLUDE)) +ifeq ($($(GUARD)),) +$(GUARD) := 1 + +ifneq (,$(findstring bearer,$(MODULES))) +$(eval $(call generate_module_headers, $(QTMOBILITY_BEARER_INCLUDE), $(QTMOBILITY_BEARER_SRC))) +endif + +ifneq (,$(findstring contacts,$(MODULES))) +$(eval $(call generate_module_headers, $(QTMOBILITY_CONTACTS_INCLUDE), $(QTMOBILITY_CONTACTS_SRC))) +$(eval $(call generate_module_headers, $(QTMOBILITY_CONTACTS_INCLUDE), $(QTMOBILITY_CONTACTS_SRC)/requests)) +$(eval $(call generate_module_headers, $(QTMOBILITY_CONTACTS_INCLUDE), $(QTMOBILITY_CONTACTS_SRC)/filters)) +$(eval $(call generate_module_headers, $(QTMOBILITY_CONTACTS_INCLUDE), $(QTMOBILITY_CONTACTS_SRC)/details)) +endif + +ifneq (,$(findstring location,$(MODULES))) +$(eval $(call generate_module_headers, $(QTMOBILITY_LOCATION_INCLUDE), $(QTMOBILITY_LOCATION_SRC))) +endif + +ifneq (,$(findstring messaging,$(MODULES))) +$(eval $(call generate_module_headers, $(QTMOBILITY_MESSAGING_INCLUDE), $(QTMOBILITY_MESSAGING_SRC))) +endif + +ifneq (,$(findstring multimedia,$(MODULES))) +$(eval $(call generate_module_headers, $(QTMOBILITY_MULTIMEDIA_INCLUDE), $(QTMOBILITY_MULTIMEDIA_SRC))) +$(eval $(call generate_module_headers, $(QTMOBILITY_MULTIMEDIA_INCLUDE), $(QTMOBILITY_MULTIMEDIA_SRC)/audio)) +$(eval $(call generate_module_headers, $(QTMOBILITY_MULTIMEDIA_INCLUDE), $(QTMOBILITY_MULTIMEDIA_SRC)/video)) +endif + +ifneq (,$(findstring publishsubscribe,$(MODULES))) +$(eval $(call generate_module_headers, $(QTMOBILITY_PUBLISHSUBSCRIBE_INCLUDE), $(QTMOBILITY_PUBLISHSUBSCRIBE_SRC))) +endif + +ifneq (,$(findstring systeminfo,$(MODULES))) +$(eval $(call generate_module_headers, $(QTMOBILITY_SYSTEMINFO_INCLUDE), $(QTMOBILITY_SYSTEMINFO_SRC))) +endif + +ifneq (,$(findstring serviceframework,$(MODULES))) +$(eval $(call generate_module_headers, $(QTMOBILITY_SERVICEFRAMEWORK_INCLUDE), $(QTMOBILITY_SERVICEFRAMEWORK_SRC))) +endif + +ifneq (,$(findstring versit,$(MODULES))) +$(eval $(call generate_module_headers, $(QTMOBILITY_VERSIT_INCLUDE), $(QTMOBILITY_VERSIT_SRC))) +endif + +ifneq (,$(findstring sensors,$(MODULES))) +$(eval $(call generate_module_headers, $(QTMOBILITY_SENSORS_INCLUDE), $(QTMOBILITY_SENSORS_SRC))) +endif + +endif diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/bin/pathhelper --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobility/bin/pathhelper Mon Jun 21 16:36:26 2010 +0300 @@ -0,0 +1,59 @@ +#!/usr/bin/perl +############################################################################# +## +## 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 Qt Mobility Components. +## +## $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$ +## +############################################################################# + +use strict; +use warnings; +use Cwd; +use Cwd "abs_path"; + +my $path = shift(@ARGV) or usage(); +my $resolvedpath = abs_path($path); +print "$resolvedpath\n"; + +exit 0; + +sub usage +{ + warn " Usage: pathhelper \n"; + warn " Converts to an absolute path and returns it to the caller\n"; + exit 2; +} diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/bin/purge.sh --- a/qtmobility/bin/purge.sh Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/bin/purge.sh Mon Jun 21 16:36:26 2010 +0300 @@ -1,7 +1,7 @@ #!/bin/bash ############################################################################# ## -## 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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/bin/rununittests.bat --- a/qtmobility/bin/rununittests.bat Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/bin/rununittests.bat Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/bin/rununittests.sh --- a/qtmobility/bin/rununittests.sh Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/bin/rununittests.sh Mon Jun 21 16:36:26 2010 +0300 @@ -1,7 +1,7 @@ #!/bin/bash ############################################################################# ## -## 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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/bin/syncheaders --- a/qtmobility/bin/syncheaders Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/bin/syncheaders Mon Jun 21 16:36:26 2010 +0300 @@ -1,7 +1,7 @@ #!/usr/bin/perl ############################################################################# ## -## 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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/bin/syncheaders.bat --- a/qtmobility/bin/syncheaders.bat Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/bin/syncheaders.bat Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/common.pri --- a/qtmobility/common.pri Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/common.pri Mon Jun 21 16:36:26 2010 +0300 @@ -13,10 +13,6 @@ include(staticconfig.pri) -# use only $$QT_MOBILITY_BUILD_TREE. If you add an subfolder it will create a relative path!!! -# $$QT_MOBILITY_BUILD_TREE/src/global will become ../global -INCLUDEPATH += $$QT_MOBILITY_BUILD_TREE - symbian:contains(symbian_symbols_unfrozen,1) { #see configure.bat for details MMP_RULES+="EXPORTUNFROZEN" @@ -92,12 +88,19 @@ contains(TEMPLATE,.*lib) { DESTDIR = $$OUTPUT_DIR/lib symbian:defFilePath=../s60installs +# VERSION = 1.0.1 } else { DESTDIR = $$OUTPUT_DIR/bin } } else { - testplugin:DESTDIR = $$OUTPUT_DIR/build/tests/bin/plugins/$$PLUGIN_TYPE - !testplugin:DESTDIR = $$OUTPUT_DIR/plugins/$$PLUGIN_TYPE + testplugin { + DESTDIR = $$OUTPUT_DIR/build/tests/bin/plugins/$$PLUGIN_TYPE + } else { + #check that plugin_type is set or warn otherwise + isEmpty(PLUGIN_TYPE):message(PLUGIN_TYPE not specified - install rule may not work) + target.path=$${QT_MOBILITY_PLUGINS}/$${PLUGIN_TYPE} + INSTALLS += target + } } MOC_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/moc @@ -173,3 +176,4 @@ DEPENDPATH += . $$SOURCE_DIR INCLUDEPATH += $$SOURCE_DIR/src/global +!symbian:!wince*:DEFINES += QTM_PLUGIN_PATH=\\\"$$replace(QT_MOBILITY_PLUGINS, \\\\, /)\\\" diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/config.pri --- a/qtmobility/config.pri Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/config.pri Mon Jun 21 16:36:26 2010 +0300 @@ -6,6 +6,7 @@ isEmpty($$QT_MOBILITY_INCLUDE):QT_MOBILITY_INCLUDE=$$QT_MOBILITY_PREFIX/include isEmpty($$QT_MOBILITY_LIB):QT_MOBILITY_LIB=$$QT_MOBILITY_PREFIX/lib isEmpty($$QT_MOBILITY_BIN):QT_MOBILITY_BIN=$$QT_MOBILITY_PREFIX/bin +isEmpty($$QT_MOBILITY_PLUGINS):QT_MOBILITY_PLUGINS=$$QT_MOBILITY_PREFIX/plugins mobility_modules = bearer maemo5|maemo6:mobility_modules -= systeminfo contains(mobility_modules,versit): mobility_modules *= contacts @@ -14,4 +15,8 @@ occ_enabled = yes symbiancntsim_enabled = yes MOBILITY_SD_MCL_BUILD = yes -sensors_symbian_enabled = yes \ No newline at end of file +sensors_symbian_enabled = yes +audiorouting_s60_enabled = yes +radioutility_s60_enabled = yes +openmaxal_symbian_enabled = yes +surfaces_s60_enabled = yes diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/configure --- a/qtmobility/configure Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/configure Mon Jun 21 16:36:26 2010 +0300 @@ -1,7 +1,7 @@ #!/bin/sh ############################################################################# ## -## 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) ## @@ -58,17 +58,16 @@ # maemo we do not want to follow symbolic links that are # introduced by scratchbox absPath() { - if [ "$2" = "maemo5" -o "$2" = "maemo6" ]; then if [ `isAbsPath $1` = '1' ]; then echo $1; else - echo "Relative prefix paths are not supported for Maemo" + echo >&2 "Relative prefix/bin/lib/header/plugin paths are not supported for Maemo" exit 1; fi else - RESULT=`(cd "$1"; /bin/pwd)` - echo $RESULT + PATH=`$relpath/bin/pathhelper $1` + echo $PATH fi } @@ -86,6 +85,7 @@ QT_MOBILITY_INCLUDE= QT_MOBILITY_LIB= QT_MOBILITY_BIN= +QT_MOBILITY_PLUGINS= BUILD_UNITTESTS= BUILD_EXAMPLES= BUILD_DOCS=yes @@ -96,9 +96,12 @@ QMAKE_CACHE="$shadowpath/.qmake.cache" LIB_PATH="lib" BIN_PATH="bin" +PLUGIN_PATH="plugins" MAC_SDK= MOBILITY_MODULES="bearer location contacts multimedia publishsubscribe versit messaging systeminfo serviceframework sensors" MOBILITY_MODULES_UNPARSED= +QMKSPEC= +OS="other" usage() { @@ -117,6 +120,8 @@ echo " (default PREFIX/lib)" echo "-bindir ..... Executables will be installed to " echo " (default PREFIX/bin)" + echo "-plugindir .. Plug-ins will be installed to " + echo " (default PREFIX/plugins)" echo "-debug ............ Build with debugging symbols" echo "-release .......... Build without debugging symbols" echo "-silent ........... Reduces build output" @@ -169,6 +174,10 @@ QT_MOBILITY_BIN="$2" shift ;; + -plugindir) + QT_MOBILITY_PLUGINS="$2" + shift + ;; -tests) BUILD_UNITTESTS="yes" ;; @@ -232,13 +241,23 @@ shift done +checkostype() +{ + match="darwin" + if [ "$OSTYPE" = "${match}"* ]; then + OS="darwin" + QMKSPEC="-spec macx-g++" + echo "QMAKESPEC = "$QMKSPEC >> "$CONFIG_IN" + fi +} + findframeworks() { # figure out if Qt was built with frameworks # if so, install in the correct place. # and fix rpath echo "contains(QT_CONFIG,qt_framework):message(1)" > 1.pro - SOMETHING=`qmake 1.pro 2>&1` + SOMETHING=`qmake -spec macx-g++ 1.pro 2>&1` if [ "$SOMETHING" = "Project MESSAGE: 1" ]; then LIB_PATH="Library/Frameworks" BIN_PATH="Applications" @@ -246,7 +265,6 @@ rm 1.pro } -findframeworks findUniversal() { @@ -257,19 +275,26 @@ echo "contains(QT_CONFIG,ppc): system(echo CONFIG+=ppc >> mac.inc)" >> 2.pro echo "contains(QT_CONFIG,ppc64): system(echo CONFIG+=ppc64 >> mac.inc)" >> 2.pro echo "contains(QT_CONFIG,x86_64): system(echo CONFIG+=x86_64 >> mac.inc)" >> 2.pro - SOMETIME=`qmake 2.pro 2>&1` + SOMETIME=`qmake -spec macx-g++ 2.pro 2>&1` rm 2.pro if [ -e "mac.inc" ]; then echo "exists(mac.inc): include(mac.inc)" >> "$CONFIG_IN" fi } +checkostype + +if [ "$OS" = "darwin" ] ; then + findframeworks +fi if [ -n "$BUILD_SILENT" ]; then echo "CONFIG += silent" > "$CONFIG_IN" fi -findUniversal +if [ "$OS" = "darwin" ] ; then + findUniversal +fi if [ -z "$RELEASEMODE" ]; then RELEASEMODE="debug" @@ -286,24 +311,20 @@ fi #process PREFIX -if [ -d "$QT_MOBILITY_PREFIX" ]; then - QT_MOBILITY_PREFIX=`absPath $QT_MOBILITY_PREFIX $LINUX_TARGET` -else - mkdir -p "$QT_MOBILITY_PREFIX" - QT_MOBILITY_PREFIX=`absPath $QT_MOBILITY_PREFIX $LINUX_TARGET` - rm -rf "$QT_MOBILITY_PREFIX" +QT_MOBILITY_PREFIX=`absPath $QT_MOBILITY_PREFIX $LINUX_TARGET` +if [ "$?" -eq "1" ]; then + exit 1 fi echo "QT_MOBILITY_PREFIX = $QT_MOBILITY_PREFIX" >> "$CONFIG_IN" #process include path if [ -z "$QT_MOBILITY_INCLUDE" ]; then QT_MOBILITY_INCLUDE="$QT_MOBILITY_PREFIX/include" -elif [ -d "$QT_MOBILITY_INCLUDE" ]; then +else QT_MOBILITY_INCLUDE=`absPath $QT_MOBILITY_INCLUDE $LINUX_TARGET` -else - mkdir -p "$QT_MOBILITY_INCLUDE" - QT_MOBILITY_INCLUDE=`absPath $QT_MOBILITY_INCLUDE $LINUX_TARGET` - rm -rf "$QT_MOBILITY_INCLUDE" + if [ "$?" -eq "1" ]; then + exit 1 + fi fi echo "QT_MOBILITY_INCLUDE = $QT_MOBILITY_INCLUDE" >> "$CONFIG_IN" @@ -311,27 +332,37 @@ #process library path if [ -z "$QT_MOBILITY_LIB" ]; then QT_MOBILITY_LIB="$QT_MOBILITY_PREFIX/$LIB_PATH" -elif [ -d "$QT_MOBILITY_LIB" ]; then +else QT_MOBILITY_LIB=`absPath $QT_MOBILITY_LIB $LINUX_TARGET` -else - mkdir -p "$QT_MOBILITY_LIB" - QT_MOBILITY_LIB=`absPath $QT_MOBILITY_LIB $LINUX_TARGET` - rm -rf "$QT_MOBILITY_LIB" + if [ "$?" -eq "1" ]; then + exit 1 + fi fi echo "QT_MOBILITY_LIB = $QT_MOBILITY_LIB" >> "$CONFIG_IN" -#process binary path +#process bin path if [ -z "$QT_MOBILITY_BIN" ]; then QT_MOBILITY_BIN="$QT_MOBILITY_PREFIX/$BIN_PATH" -elif [ -d "$QT_MOBILITY_BIN" ]; then +else QT_MOBILITY_BIN=`absPath $QT_MOBILITY_BIN $LINUX_TARGET` -else - mkdir -p "$QT_MOBILITY_BIN" - QT_MOBILITY_BIN=`absPath $QT_MOBILITY_BIN $LINUX_TARGET` - rm -rf "$QT_MOBILITY_BIN" + if [ "$?" -eq "1" ]; then + exit 1 + fi fi echo "QT_MOBILITY_BIN = $QT_MOBILITY_BIN" >> "$CONFIG_IN" +#process plugin path +if [ -z "$QT_MOBILITY_PLUGINS" ]; then + QT_MOBILITY_PLUGINS="$QT_MOBILITY_PREFIX/$PLUGIN_PATH" +else + QT_MOBILITY_PLUGINS=`absPath $QT_MOBILITY_PLUGINS $LINUX_TARGET` + if [ "$?" -eq "1" ]; then + exit 1 + fi +fi +echo "QT_MOBILITY_PLUGINS = $QT_MOBILITY_PLUGINS" >> "$CONFIG_IN" + + echo "QT_MOBILITY_SOURCE_TREE = $relpath" >> "$QMAKE_CACHE" echo "QT_MOBILITY_BUILD_TREE = $shadowpath" >> "$QMAKE_CACHE" @@ -408,7 +439,7 @@ cd config.tests/$2 fi - qmake "$relpath/config.tests/$2/$2.pro" 2>> "$CONFIG_LOG" >> "$CONFIG_LOG" + qmake $QMKSPEC "$relpath/config.tests/$2/$2.pro" 2>> "$CONFIG_LOG" >> "$CONFIG_LOG" printf " ." "$MAKE" clean >> "$CONFIG_LOG" printf "." @@ -430,6 +461,12 @@ compileTest "CoreWLAN (MacOS 10.6)" corewlan compileTest "Maemo ICD" maemo-icd compileTest "Maemo ICD WLAN" maemo-icd-network-wlan +compileTest "Maemo5 contacts dependencies" maemo5-contacts +if [ "$LINUX_TARGET" = maemo6 ]; then + compileTest sensord sensord +else + echo "sensord_enabled = no" >> "$CONFIG_IN" +fi # Now module selection # using 'expr match ....' should help a bit @@ -438,6 +475,26 @@ # MOBILITY_MODULES="$MOBILITY_MODULES_UNPARSED" #fi +# Test if able to build multimedia +for module in $MOBILITY_MODULES; do + case "$module" in + multimedia) + echo "contains(QT_CONFIG,multimedia):message(1)" > 1.pro + SOMETHING=`qmake 1.pro 2>&1` + if [ "$SOMETHING" = "Project MESSAGE: 1" ]; then + MOBILITY_MODULES="$(echo $MOBILITY_MODULES | sed 's:multimedia::g')" + echo "Only one multimedia module allowed, please rebuild Qt with -no-multimedia" + fi + rm 1.pro + ;; + esac +done + +if [ -z "$MOBILITY_MODULES" ]; then + echo "No module available to build." + exit 1 +fi + # It's a lot easier to make qmake do the dependency checking... echo "mobility_modules = $MOBILITY_MODULES" >> "$CONFIG_IN" echo "contains(mobility_modules,versit): mobility_modules *= contacts" >> "$CONFIG_IN" @@ -455,42 +512,44 @@ for module in $MOBILITY_MODULES; do case "$module" in bearer) - $relpath/bin/syncheaders $shadowpath/include $relpath/src/bearer + $relpath/bin/syncheaders $shadowpath/include/QtmBearer $relpath/src/bearer ;; publishsubscribe) - $relpath/bin/syncheaders $shadowpath/include $relpath/src/publishsubscribe + $relpath/bin/syncheaders $shadowpath/include/QtmPubSub $relpath/src/publishsubscribe ;; location) - $relpath/bin/syncheaders $shadowpath/include $relpath/src/location + $relpath/bin/syncheaders $shadowpath/include/QtmLocation $relpath/src/location ;; serviceframework) - $relpath/bin/syncheaders $shadowpath/include $relpath/src/serviceframework + $relpath/bin/syncheaders $shadowpath/include/QtmServiceFramework $relpath/src/serviceframework ;; systeminfo) - $relpath/bin/syncheaders $shadowpath/include $relpath/src/systeminfo + $relpath/bin/syncheaders $shadowpath/include/QtmSystemInfo $relpath/src/systeminfo ;; contacts) - $relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts - $relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts/details - $relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts/requests - $relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts/filters + $relpath/bin/syncheaders $shadowpath/include/QtmContacts $relpath/src/contacts + $relpath/bin/syncheaders $shadowpath/include/QtmContacts $relpath/src/contacts/details + $relpath/bin/syncheaders $shadowpath/include/QtmContacts $relpath/src/contacts/requests + $relpath/bin/syncheaders $shadowpath/include/QtmContacts $relpath/src/contacts/filters ;; multimedia) - $relpath/bin/syncheaders $shadowpath/include $relpath/src/multimedia + $relpath/bin/syncheaders $shadowpath/include/QtMultimedia $relpath/src/multimedia + $relpath/bin/syncheaders $shadowpath/include/QtMultimedia $relpath/src/multimedia/audio + $relpath/bin/syncheaders $shadowpath/include/QtMultimedia $relpath/src/multimedia/video ;; messaging) - $relpath/bin/syncheaders $shadowpath/include $relpath/src/messaging + $relpath/bin/syncheaders $shadowpath/include/QtmMessaging $relpath/src/messaging ;; versit) #versit implies contacts - $relpath/bin/syncheaders $shadowpath/include $relpath/src/versit - $relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts - $relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts/details - $relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts/requests - $relpath/bin/syncheaders $shadowpath/include $relpath/src/contacts/filters + $relpath/bin/syncheaders $shadowpath/include/QtmVersit $relpath/src/versit + $relpath/bin/syncheaders $shadowpath/include/QtmContacts $relpath/src/contacts + $relpath/bin/syncheaders $shadowpath/include/QtmContacts $relpath/src/contacts/details + $relpath/bin/syncheaders $shadowpath/include/QtmContacts $relpath/src/contacts/requests + $relpath/bin/syncheaders $shadowpath/include/QtmContacts $relpath/src/contacts/filters ;; sensors) - $relpath/bin/syncheaders $shadowpath/include $relpath/src/sensors + $relpath/bin/syncheaders $shadowpath/include/QtmSensors $relpath/src/sensors ;; *) echo "Cannot generate headers for $module" @@ -505,7 +564,7 @@ fi echo "Running qmake..." -if qmake -recursive "$relpath/qtmobility.pro"; then +if qmake -makefile $QMKSPEC -recursive "$relpath/qtmobility.pro"; then echo "" echo "configure has finished. You may run make or gmake to build the project now." else diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/configure.bat --- a/qtmobility/configure.bat Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/configure.bat Mon Jun 21 16:36:26 2010 +0300 @@ -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) :: @@ -48,8 +48,8 @@ set SOURCE_PATH=%CD% cd /D %BUILD_PATH% -set PROJECT_CONFIG= %BUILD_PATH%\config.in -set PROJECT_LOG= %BUILD_PATH%\config.log +set PROJECT_CONFIG=%BUILD_PATH%\config.in +set PROJECT_LOG=%BUILD_PATH%\config.log set RELEASEMODE=release set WIN32_RELEASEMODE=debug_and_release build_all set QT_MOBILITY_LIB= @@ -59,18 +59,35 @@ set BUILD_TOOLS=yes set MOBILITY_MODULES=bearer location contacts multimedia publishsubscribe versit messaging systeminfo serviceframework sensors set MOBILITY_MODULES_UNPARSED= +set MOBILITY_MULTIMEDIA=yes set VC_TEMPLATE_OPTION= set QT_PATH= set QMAKE_CACHE=%BUILD_PATH%\.qmake.cache -if exist "%QMAKE_CACHE%" del %QMAKE_CACHE% -if exist "%PROJECT_LOG%" del %PROJECT_LOG% -if exist "%PROJECT_CONFIG%" del %PROJECT_CONFIG% +if exist "%QMAKE_CACHE%" del /Q %QMAKE_CACHE% +if exist "%PROJECT_LOG%" del /Q %PROJECT_LOG% +if exist "%PROJECT_CONFIG%" del /Q %PROJECT_CONFIG% echo QT_MOBILITY_SOURCE_TREE = %SOURCE_PATH% > %QMAKE_CACHE% echo QT_MOBILITY_BUILD_TREE = %BUILD_PATH% >> %QMAKE_CACHE% set QMAKE_CACHE= +if %BUILD_PATH% == %SOURCE_PATH% ( + cd %SOURCE_PATH%\config.tests\qtmultimedia + if exist make del qtmultimedia +) else ( + rmdir /S /Q config.tests\qtmultimedia + mkdir config.tests\qtmultimedia + cd config.tests\qtmultimedia +) +for /f "tokens=3" %%i in ('call %QT_PATH%qmake %SOURCE_PATH%\config.tests\qtmultimedia\qtmultimedia.pro 2^>^&1 1^>NUL') do set QTMULTIMEDIA=%%i +if %QTMULTIMEDIA% == no-multimedia ( + set MOBILITY_MULTIMEDIA=yes +) else ( + set MOBILITY_MULTIMEDIA=no +) +cd /D %BUILD_PATH% + :cmdline_parsing if "%1" == "" goto startProcessing if "%1" == "-debug" goto debugTag @@ -80,6 +97,7 @@ if "%1" == "-libdir" goto libTag if "%1" == "-bindir" goto binTag if "%1" == "-headerdir" goto headerTag +if "%1" == "-plugindir" goto pluginTag if "%1" == "-tests" goto testTag if "%1" == "-examples" goto exampleTag if "%1" == "-qt" goto qtTag @@ -112,11 +130,13 @@ echo (default PREFIX/lib) echo -bindir (dir) ..... Executables will be installed to dir echo (default PREFIX/bin) + echo -plugindir (dir) .. Plug-ins will be installed to dir + echo (default PREFIX/plugins) echo -debug ............ Build with debugging symbols echo -release .......... Build without debugging symbols echo -silent ........... Reduces build output echo -tests ............ Build unit tests (not build by default) - echo Note, this adds test symbols to all libraries + echo Note, this adds test symbols to all libraries echo and should not be used for release builds. echo -examples ......... Build example applications echo -no-docs .......... Do not build documentation (build by default) @@ -181,12 +201,19 @@ shift goto cmdline_parsing +:pluginTag +shift +echo QT_MOBILITY_PLUGINS = %1 >> %PROJECT_CONFIG% +shift +echo +goto cmdline_parsing + :unfrozenTag REM Should never be used in release builds -REM Some SDK's seem to exclude Q_AUTOTEST_EXPORT symbols if the +REM Some SDK's seem to exclude Q_AUTOTEST_EXPORT symbols if the REM libraries are frozen. This breaks unit tests relying on the auto test exports REM This flag unfreezes the SYMBIAN libraries for the purpose of unit test building. -REM Ideally this should be connected to '-tests' option but that would prevent +REM Ideally this should be connected to '-tests' option but that would prevent REM integration testing for frozen symbols as the CI system should test unit tests REM and frozen symbol compliance. echo symbian_symbols_unfrozen = 1 >> %PROJECT_CONFIG% @@ -240,8 +267,8 @@ echo Checking selected modules: :modulesTag2 -for /f "tokens=1,*" %%a in ("%MOBILITY_MODULES_UNPARSED%") do ( - set FIRST=%%a +for /f "tokens=1,*" %%a in ("%MOBILITY_MODULES_UNPARSED%") do ( + set FIRST=%%a set REMAINING=%%b ) @@ -272,7 +299,16 @@ goto errorTag ) -set MOBILITY_MODULES=%MOBILITY_MODULES% %FIRST% +if %FIRST% == multimedia ( + if %MOBILITY_MULTIMEDIA% == yes ( + set MOBILITY_MODULES=%MOBILITY_MODULES% %FIRST% + ) else ( + echo "Only one multimedia module allowed, please rebuild Qt with -no-multimedia" + ) +) else ( + set MOBILITY_MODULES=%MOBILITY_MODULES% %FIRST% +) + if "%REMAINING%" == "" ( shift ) else ( @@ -284,8 +320,41 @@ SET FIRST= goto cmdline_parsing +:removeMultimedia +set MOBILITY_MODULES_TEMP=%MOBILITY_MODULES% +set MOBILITY_MODULES= + +:removeMultimedia2 + +for /f "tokens=1,*" %%a in ("%MOBILITY_MODULES_TEMP%") do ( + set FIRST=%%a + set REMAINING=%%b +) +if NOT %FIRST% == multimedia ( + set MOBILITY_MODULES=%MOBILITY_MODULES% %FIRST% +) +if "%REMAINING%" == "" ( + goto startProcessing2 +) else ( + set MOBILITY_MODULES_TEMP=%REMAINING% + goto removeMultimedia2 +) + +goto startProcessing2 + :startProcessing +for %%a in (%MOBILITY_MODULES%) do ( + if %%a == multimedia ( + if %MOBILITY_MULTIMEDIA% == no ( + echo "Only one multimedia module allowed, please rebuild Qt with -no-multimedia" + goto removeMultimedia + ) + ) +) + +:startProcessing2 + echo CONFIG += %RELEASEMODE% >> %PROJECT_CONFIG% echo CONFIG_WIN32 += %WIN32_RELEASEMODE% %RELEASEMODE% >> %PROJECT_CONFIG% set RELEASEMODE= @@ -331,6 +400,7 @@ echo isEmpty($$QT_MOBILITY_INCLUDE):QT_MOBILITY_INCLUDE=$$QT_MOBILITY_PREFIX/include >> %PROJECT_CONFIG% echo isEmpty($$QT_MOBILITY_LIB):QT_MOBILITY_LIB=$$QT_MOBILITY_PREFIX/lib >> %PROJECT_CONFIG% echo isEmpty($$QT_MOBILITY_BIN):QT_MOBILITY_BIN=$$QT_MOBILITY_PREFIX/bin >> %PROJECT_CONFIG% +echo isEmpty($$QT_MOBILITY_PLUGINS):QT_MOBILITY_PLUGINS=$$QT_MOBILITY_PREFIX/plugins >> %PROJECT_CONFIG% echo mobility_modules = %MOBILITY_MODULES% >> %PROJECT_CONFIG% REM no Sysinfo support on Maemo yet @@ -375,25 +445,25 @@ set BUILDSYSTEM=%%b) ) - if %BUILDSYSTEM% == symbian-abld ( + if "%BUILDSYSTEM%" == "symbian-abld" ( call make -h >> %PROJECT_LOG% 2>&1 if not errorlevel 1 ( echo ... Symbian abld make found. set MAKE=make ) - ) else if %BUILDSYSTEM% == symbian-sbsv2 ( + ) else if "%BUILDSYSTEM%" == "symbian-sbsv2" ( call make -h >> %PROJECT_LOG% 2>&1 if not errorlevel 1 ( echo ... Symbian sbsv2 make found. set MAKE=make ) - ) else if %BUILDSYSTEM% == win32-nmake ( + ) else if "%BUILDSYSTEM%" == "win32-nmake" ( call nmake /? >> %PROJECT_LOG% 2>&1 if not errorlevel 1 ( echo ... nmake found. set MAKE=nmake ) - ) else if %BUILDSYSTEM% == win32-mingw ( + ) else if "%BUILDSYSTEM%" == "win32-mingw" ( call mingw32-make -v >> %PROJECT_LOG% 2>&1 if not errorlevel 1 ( echo ... mingw32-make found. @@ -416,6 +486,7 @@ :compileTest setlocal + @echo off echo Checking %1 set CURRENT_PWD=%CD% @@ -429,16 +500,21 @@ ) call %QT_PATH%qmake %SOURCE_PATH%\config.tests\%2\%2.pro >> %PROJECT_LOG% 2>&1 - call %MOBILITY_MAKE% clean >> %PROJECT_LOG% 2>&1 - call %MOBILITY_MAKE% >> %PROJECT_LOG% 2>&1 set FAILED=0 - if %MOBILITY_BUILDSYSTEM% == symbian-sbsv2 ( - for /f "tokens=2" %%i in ('%MOBILITY_MAKE% SBS^="@sbs --check"') do set FAILED=1 - ) else if %MOBILITY_BUILDSYSTEM% == symbian-abld ( - for /f "tokens=2" %%i in ('%MOBILITY_MAKE% ABLD^="@ABLD.BAT -c" 2^>^&1') do if not %%i == bldfiles set FAILED=1 - ) else if errorlevel 1 ( - set FAILED=1 + if "%MOBILITY_BUILDSYSTEM%" == "symbian-sbsv2" ( + call %MOBILITY_MAKE% release-armv5 >> %PROJECT_LOG% 2>&1 + for /f "tokens=2" %%i in ('%MOBILITY_MAKE% release-armv5 SBS^="@sbs --check"') do set FAILED=1 + ) else if "%MOBILITY_BUILDSYSTEM%" == "symbian-abld" ( + call %MOBILITY_MAKE% release-gcce >> %PROJECT_LOG% 2>&1 + for /f "tokens=2" %%i in ('%MOBILITY_MAKE% release-gcce ABLD^="@ABLD.BAT -c" 2^>^&1') do if not %%i == bldfiles set FAILED=1 + ) else { + REM Make for other builds + call %MOBILITY_MAKE% >> %PROJECT_LOG% 2>&1 + REM have to check error level for windows / other builds to be sure. + if errorlevel 1 ( + set FAILED=1 + ) ) if %FAILED% == 0 ( @@ -457,12 +533,26 @@ echo. echo Start of compile tests REM compile tests go here. +for /f "tokens=3" %%i in ('call %QT_PATH%qmake %SOURCE_PATH%\config.tests\make\make.pro 2^>^&1 1^>NUL') do set BUILDSYSTEM=%%i +if "%BUILDSYSTEM%" == "symbian-abld" goto symbianTests +if "%BUILDSYSTEM%" == "symbian-sbsv2" goto symbianTests +goto noTests + +:symbianTests call :compileTest LBT lbt call :compileTest SNAP snap call :compileTest OCC occ call :compileTest SymbianContactSIM symbiancntsim call :compileTest S60_Sensor_API sensors_s60_31 call :compileTest Symbian_Sensor_Framework sensors_symbian +call :compileTest Audiorouting_s60 audiorouting_s60 +call :compileTest Tunerlibrary_for_3.1 tunerlib_s60 +call :compileTest RadioUtility_for_post_3.1 radioutility_s60 +call :compileTest OpenMaxAl_support openmaxal_symbian +call :compileTest Surfaces_s60 surfaces_s60 + +:noTests + echo End of compile tests echo. echo. @@ -479,39 +569,43 @@ :generateHeaders -for /f "tokens=1,*" %%a in ("%MODULES_TEMP%") do ( - set FIRST=%%a +for /f "tokens=1,*" %%a in ("%MODULES_TEMP%") do ( + set FIRST=%%a set REMAINING=%%b ) if %FIRST% == bearer ( - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\bearer + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmBearer %SOURCE_PATH%\src\bearer ) else if %FIRST% == contacts ( - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\contacts - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\contacts\requests - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\contacts\filters - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\contacts\details + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmContacts %SOURCE_PATH%\src\contacts + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmContacts %SOURCE_PATH%\src\contacts\requests + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmContacts %SOURCE_PATH%\src\contacts\filters + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmContacts %SOURCE_PATH%\src\contacts\details ) else if %FIRST% == location ( - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\location + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmLocation %SOURCE_PATH%\src\location ) else if %FIRST% == messaging ( - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\messaging + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmMessaging %SOURCE_PATH%\src\messaging ) else if %FIRST% == multimedia ( - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\multimedia + if %MOBILITY_MULTIMEDIA% == yes ( + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtMultimedia %SOURCE_PATH%\src\multimedia + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtMultimedia %SOURCE_PATH%\src\multimedia\audio + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtMultimedia %SOURCE_PATH%\src\multimedia\video + ) ) else if %FIRST% == publishsubscribe ( - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\publishsubscribe + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmPubSub %SOURCE_PATH%\src\publishsubscribe ) else if %FIRST% == systeminfo ( - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\systeminfo + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmSystemInfo %SOURCE_PATH%\src\systeminfo ) else if %FIRST% == serviceframework ( - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\serviceframework + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmServiceFramework %SOURCE_PATH%\src\serviceframework ) else if %FIRST% == versit ( REM versit implies contacts - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\versit - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\contacts - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\contacts\requests - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\contacts\filters - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\contacts\details + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmVersit %SOURCE_PATH%\src\versit + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmContacts %SOURCE_PATH%\src\contacts + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmContacts %SOURCE_PATH%\src\contacts\requests + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmContacts %SOURCE_PATH%\src\contacts\filters + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmContacts %SOURCE_PATH%\src\contacts\details ) else if %FIRST% == sensors ( - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\sensors + perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include\QtmSensors %SOURCE_PATH%\src\sensors ) if "%REMAINING%" == "" ( diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/data/qtmobility.pkg --- a/qtmobility/data/qtmobility.pkg Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/data/qtmobility.pkg Mon Jun 21 16:36:26 2010 +0300 @@ -3,7 +3,7 @@ &EN ; SIS header: name, uid, version -#{"QtMobility"},(0x2002AC89),1,0,0,TYPE=SA,RU +#{"QtMobility"},(0x2002AC89),1,0,1,TYPE=SA,RU ; Localised Vendor name %{"Nokia"} diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/data/qtmobility.sisx Binary file qtmobility/data/qtmobility.sisx has changed diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/data/qtmobility_stub.pkg --- a/qtmobility/data/qtmobility_stub.pkg Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/data/qtmobility_stub.pkg Mon Jun 21 16:36:26 2010 +0300 @@ -3,7 +3,7 @@ &EN ; SIS header: name, uid, version -#{"QtMobility"},(0x2002AC89),1,0,0,TYPE=SA +#{"QtMobility"},(0x2002AC89),1,0,1,TYPE=SA ; Localised Vendor name %{"Nokia"} diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/data/qtmobility_stub.sis Binary file qtmobility/data/qtmobility_stub.sis has changed diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearercloud/bearercloud.cpp --- a/qtmobility/examples/bearercloud/bearercloud.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearercloud/bearercloud.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearercloud/bearercloud.h --- a/qtmobility/examples/bearercloud/bearercloud.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearercloud/bearercloud.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearercloud/cloud.cpp --- a/qtmobility/examples/bearercloud/cloud.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearercloud/cloud.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearercloud/cloud.h --- a/qtmobility/examples/bearercloud/cloud.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearercloud/cloud.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearercloud/main.cpp --- a/qtmobility/examples/bearercloud/main.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearercloud/main.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearermonitor/bearermonitor.cpp --- a/qtmobility/examples/bearermonitor/bearermonitor.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearermonitor/bearermonitor.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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) ** @@ -80,7 +80,7 @@ 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 @@ 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 @@ #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 @@ 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 items = treeWidget->findItems(QLatin1String("*"), Qt::MatchWildcard); QMap itemMap; while (!items.isEmpty()) { diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearermonitor/bearermonitor.h --- a/qtmobility/examples/bearermonitor/bearermonitor.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearermonitor/bearermonitor.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearermonitor/bearermonitor_240_320.ui --- a/qtmobility/examples/bearermonitor/bearermonitor_240_320.ui Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearermonitor/bearermonitor_240_320.ui Mon Jun 21 16:36:26 2010 +0300 @@ -11,7 +11,7 @@ - Form + BearerMonitor diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearermonitor/bearermonitor_640_480.ui --- a/qtmobility/examples/bearermonitor/bearermonitor_640_480.ui Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearermonitor/bearermonitor_640_480.ui Mon Jun 21 16:36:26 2010 +0300 @@ -11,7 +11,7 @@ - Form + BearerMonitor diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearermonitor/bearermonitor_maemo.ui --- a/qtmobility/examples/bearermonitor/bearermonitor_maemo.ui Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearermonitor/bearermonitor_maemo.ui Mon Jun 21 16:36:26 2010 +0300 @@ -11,7 +11,7 @@ - Form + BearerMonitor diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearermonitor/main.cpp --- a/qtmobility/examples/bearermonitor/main.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearermonitor/main.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearermonitor/sessionwidget.ui --- a/qtmobility/examples/bearermonitor/sessionwidget.ui Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearermonitor/sessionwidget.ui Mon Jun 21 16:36:26 2010 +0300 @@ -11,7 +11,7 @@ - Form + Session Details diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/bearermonitor/sessionwidget_maemo.ui --- a/qtmobility/examples/bearermonitor/sessionwidget_maemo.ui Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/bearermonitor/sessionwidget_maemo.ui Mon Jun 21 16:36:26 2010 +0300 @@ -11,7 +11,7 @@ - Form + Session Details diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/examples.pri --- a/qtmobility/examples/examples.pri Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/examples.pri Mon Jun 21 16:36:26 2010 +0300 @@ -20,7 +20,6 @@ } OUTPUT_DIR = $$QT_MOBILITY_BUILD_TREE -DESTDIR = $$OUTPUT_DIR/bin/examples MOC_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/moc RCC_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/rcc UI_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/ui @@ -30,6 +29,13 @@ QMAKE_RPATHDIR+=$$OUTPUT_DIR/lib INCLUDEPATH+= $$QT_MOBILITY_SOURCE_TREE/src/global +!plugin { + target.path=$$QT_MOBILITY_PREFIX/bin +} else { + target.path = $${QT_MOBILITY_PLUGINS}/$${PLUGIN_TYPE} +} +INSTALLS += target + maemo6 { DEFINES+= Q_WS_MAEMO_6 DEFINES+= QTM_EXAMPLES_SMALL_SCREEN diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/examples/examples.pro --- a/qtmobility/examples/examples.pro Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/examples/examples.pro Mon Jun 21 16:36:26 2010 +0300 @@ -8,5 +8,6 @@ } symbian { - SUBDIRS += s60installs/s60installs.pro + SUBDIRS += s60installs } + diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/features/deploy.pri --- a/qtmobility/features/deploy.pri Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/features/deploy.pri Mon Jun 21 16:36:26 2010 +0300 @@ -3,7 +3,7 @@ contains(TEMPLATE,.*lib) { target.path=$$QT_MOBILITY_LIB - TARGET = $$qtLibraryTarget($${TARGET}) + TARGET = $$qtLibraryTarget($${TARGET}$${QT_LIBINFIX}) symbian { middleware { path=$$MW_LAYER_PUBLIC_EXPORT_PATH("") } @@ -36,3 +36,5 @@ FRAMEWORK_HEADERS.path = Headers QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS } + +CONFIG+= create_prl diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/features/mobility.prf --- a/qtmobility/features/mobility.prf Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/features/mobility.prf Mon Jun 21 16:36:26 2010 +0300 @@ -18,6 +18,10 @@ contains(MOBILITY, bearer) { DEFINES += QT_MOBILITY_BEARER qtAddLibrary(QtBearer) + !equals(QT_MAJOR_VERSION,4)|!equals(QT_MINOR_VERSION, 6) { + message(Qt Mobility Bearer API is deprecated when using Qt 4.7 or higher.) + message(Please use source compatible replacement Bearer API in QtNetwork.) + } } contains(MOBILITY, publishsubscribe) { @@ -39,9 +43,11 @@ } contains(MOBILITY, multimedia) { - QT += network multimedia + QT += network contains(QT_CONFIG, opengl): QT += opengl - qtAddLibrary(QtMedia) + mac:LIBS += -framework QtMultimedia + else:win32:contains(QT_CONFIG, debug):LIBS += -lQtMultimediad + else:LIBS += -lQtMultimedia } contains(MOBILITY, contacts) { @@ -66,7 +72,7 @@ symbian:contains(CONFIG, mobility):!contains(TARGET.UID3, 0x2002AC89):!contains(TARGET.UID3, 0xE002AC89) { mobility_default_deployment.pkg_prerules += \ "; Default dependency to QtMobility libraries" \ - "(0x2002AC89), 1, 0, 0, {\"QtMobility\"}" + "(0x2002AC89), 1, 0, 1, {\"QtMobility\"}" DEPLOYMENT += mobility_default_deployment } diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/features/mobility.prf.template --- a/qtmobility/features/mobility.prf.template Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/features/mobility.prf.template Mon Jun 21 16:36:26 2010 +0300 @@ -18,6 +18,10 @@ contains(MOBILITY, bearer) { DEFINES += QT_MOBILITY_BEARER qtAddLibrary(QtBearer) + !equals(QT_MAJOR_VERSION,4)|!equals(QT_MINOR_VERSION, 6) { + message(Qt Mobility Bearer API is deprecated when using Qt 4.7 or higher.) + message(Please use source compatible replacement Bearer API in QtNetwork.) + } } contains(MOBILITY, publishsubscribe) { @@ -39,9 +43,11 @@ } contains(MOBILITY, multimedia) { - QT += network multimedia + QT += network contains(QT_CONFIG, opengl): QT += opengl - qtAddLibrary(QtMedia) + mac:LIBS += -framework QtMultimedia + else:win32:contains(QT_CONFIG, debug):LIBS += -lQtMultimediad + else:LIBS += -lQtMultimedia } contains(MOBILITY, contacts) { @@ -66,7 +72,7 @@ symbian:contains(CONFIG, mobility):!contains(TARGET.UID3, 0x2002AC89):!contains(TARGET.UID3, 0xE002AC89) { mobility_default_deployment.pkg_prerules += \ "; Default dependency to QtMobility libraries" \ - "(0x2002AC89), 1, 0, 0, {\"QtMobility\"}" + "(0x2002AC89), 1, 0, 1, {\"QtMobility\"}" DEPLOYMENT += mobility_default_deployment } diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/features/mobilityconfig.prf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobility/features/mobilityconfig.prf Mon Jun 21 16:36:26 2010 +0300 @@ -0,0 +1,1 @@ +MOBILITY_CONFIG=bearer diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/qtmobility.pro --- a/qtmobility/qtmobility.pro Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/qtmobility.pro Mon Jun 21 16:36:26 2010 +0300 @@ -1,17 +1,4 @@ - -#This is a temporary workaround for internal Symbian builds -#QT_MAJOR_VERSION et al are not set -symbian { - isEmpty(QT_MAJOR_VERSION) { - exists($${EPOCROOT}epoc32/data/z/system/install/Series60v5.2.sis) { - QT_MAJOR_VERSION=4; - QT_MINOR_VERSION=6; - QT_PATCH_VERSION=0; - } - } -} - -# config.pri specifies the configure options +# config.pri specifies the configure options and is pulled in via staticconfig.pri include(staticconfig.pri) !include($$QT_MOBILITY_BUILD_TREE/config.pri) { error("Please run configure script"); @@ -19,28 +6,6 @@ #happen if we are trying to shadow build w/o running configure } -#creating qbuildcfg header -!exists($$QT_MOBILITY_BUILD_TREE/src/global){ - message("creating qbuildcfg header") - symbian|win32|wince*{ - system($$QMAKE_MKDIR $$QT_MOBILITY_BUILD_TREE\src\global) - } - else{ - system($$QMAKE_MKDIR $$QT_MOBILITY_BUILD_TREE/src/global) - } -} - -QCFGH_OUTPUT=$$QT_MOBILITY_BUILD_TREE/src/global/qbuildcfg.h -mobilityprefixpath = $$QT_MOBILITY_PREFIX -symbian|win32|wince*{ - mobilityprefixpath = $$replace(mobilityprefixpath, \\\, \\\\) - system(echo static const char qt_mobility_configure_prefix_path_str [512 + 12] = \"$$mobilityprefixpath\\0\"; > $$QCFGH_OUTPUT) -} -else{ - system(echo static const char qt_mobility_configure_prefix_path_str [512 + 12] = '\\\"$$mobilityprefixpath\\\0\\\"\;' > $$QCFGH_OUTPUT) -} - - #don't build QtMobility if chosen config mismatches Qt's config win32:!contains(CONFIG_WIN32,build_all) { contains(QT_CONFIG,debug):!contains(QT_CONFIG,release):contains(CONFIG_WIN32,release) { @@ -78,17 +43,25 @@ win32:system(type $${QT_MOBILITY_SOURCE_TREE}\features\mobility.prf.template >> $$PRF_OUTPUT) symbian:system(type $${QT_MOBILITY_SOURCE_TREE}\features\mobility.prf.template >> $$PRF_OUTPUT) + PRF_CONFIG=$${QT_MOBILITY_BUILD_TREE}/features/mobilityconfig.prf + system(echo MOBILITY_CONFIG=$${mobility_modules} > $$PRF_CONFIG) + #symbian does not generate make install rule. we have to copy prf manually symbian { FORMATDIR=$$[QT_INSTALL_DATA]\mkspecs\features FORMATDIR=$$replace(FORMATDIR,/,\\ ) system(copy "$${QT_MOBILITY_BUILD_TREE}\features\mobility.prf $$FORMATDIR") + system(copy "$${QT_MOBILITY_BUILD_TREE}\features\mobilityconfig.prf $$FORMATDIR") } + # install config file + config.path = $$[QT_INSTALL_DATA]/mkspecs/features + config.files = $$QT_MOBILITY_BUILD_TREE/features/mobilityconfig.prf + # install feature file feature.path = $$[QT_INSTALL_DATA]/mkspecs/features feature.files = $$QT_MOBILITY_BUILD_TREE/features/mobility.prf - INSTALLS += feature + INSTALLS += feature config } TEMPLATE = subdirs @@ -99,8 +72,60 @@ contains(build_unit_tests, yes):SUBDIRS+=tests contains(build_examples, yes):SUBDIRS+=examples +#updating and deployment of translations requires Qt 4.6.3/qtPrepareTool +!symbian:defined(qtPrepareTool):SUBDIRS += translations + # install Qt style headers qtmheaders.path = $${QT_MOBILITY_INCLUDE} -qtmheaders.files = $${QT_MOBILITY_BUILD_TREE}/include/* + +!symbian { + qtmheaders.files = $${QT_MOBILITY_BUILD_TREE}/include/QtmBearer/* \ + $${QT_MOBILITY_BUILD_TREE}/include/QtmContacts/* \ + $${QT_MOBILITY_BUILD_TREE}/include/QtmLocation/* \ + $${QT_MOBILITY_BUILD_TREE}/include/QtmMessaging/* \ + $${QT_MOBILITY_BUILD_TREE}/include/QtMultimedia/* \ + $${QT_MOBILITY_BUILD_TREE}/include/QtmPubSub/* \ + $${QT_MOBILITY_BUILD_TREE}/include/QtmServiceFramework/* \ + $${QT_MOBILITY_BUILD_TREE}/include/QtmVersit/* \ + $${QT_MOBILITY_BUILD_TREE}/include/QtmSystemInfo/* \ + $${QT_MOBILITY_BUILD_TREE}/include/QtmSensors/* + INSTALLS += qtmheaders +} else { + #absolute path does not work and so is shadow building for Symbian + qtmAppHeaders = include/QtmContacts/* \ + include/QtmVersit/* -INSTALLS += qtmheaders + qtmMwHeaders = include/QtmBearer/* \ + include/QtmLocation/* \ + include/QtmMessaging/* \ + include/QtMultimedia/* \ + include/QtmPubSub/* \ + include/QtmServiceFramework/* \ + include/QtmSystemInfo/* \ + include/QtmSensors/* + + contains(mobility_modules,contacts|versit) { + for(api, qtmAppHeaders) { + INCLUDEFILES=$$files($$api); + #files() attaches a ';' at the end which we need to remove + cleanedFiles=$$replace(INCLUDEFILES, ;,) + for(header, cleanedFiles) { + exists($$header): + BLD_INF_RULES.prj_exports += "$$header $$APP_LAYER_PUBLIC_EXPORT_PATH($$basename(header))" + } + } + } + + contains(mobility_modules,serviceframework|location|bearer|publishsubscribe|systeminfo|multimedia|messaging) { + for(api, qtmMwHeaders) { + INCLUDEFILES=$$files($$api); + #files() attaches a ';' at the end which we need to remove + cleanedFiles=$$replace(INCLUDEFILES, ;,) + for(header, cleanedFiles) { + exists($$header): + BLD_INF_RULES.prj_exports += "$$header $$MW_LAYER_PUBLIC_EXPORT_PATH($$basename(header))" + } + } + } +} + diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qcorewlanengine_mac.mm --- a/qtmobility/src/bearer/qcorewlanengine_mac.mm Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qcorewlanengine_mac.mm Mon Jun 21 16:36:26 2010 +0300 @@ -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) ** @@ -314,7 +314,7 @@ config->isValid = fetchedConfigurations.at(i)->isValid; config->id = fetchedConfigurations.at(i)->id; config->state = fetchedConfigurations.at(i)->state; - + config->bearer = fetchedConfigurations.at(i)->bearer; config->type = fetchedConfigurations.at(i)->type; config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; config->purpose = fetchedConfigurations.at(i)->purpose; @@ -336,6 +336,9 @@ for(uint row=0; row < [wifiInterfaces count]; row++ ) { CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]]; + if (![wifiInterface power]) + continue; + NSString *nsInterfaceName = [wifiInterface name]; // add user configured system networks SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil); diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qcorewlanengine_mac_p.h --- a/qtmobility/src/bearer/qcorewlanengine_mac_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qcorewlanengine_mac_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qgenericengine.cpp --- a/qtmobility/src/bearer/qgenericengine.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qgenericengine.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qgenericengine_p.h --- a/qtmobility/src/bearer/qgenericengine_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qgenericengine_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnativewifiengine_win.cpp --- a/qtmobility/src/bearer/qnativewifiengine_win.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnativewifiengine_win.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnativewifiengine_win_p.h --- a/qtmobility/src/bearer/qnativewifiengine_win_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnativewifiengine_win_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkconfigmanager_maemo_p.h --- a/qtmobility/src/bearer/qnetworkconfigmanager_maemo_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkconfigmanager_maemo_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -60,7 +60,6 @@ #include "qnetworkconfigmanager.h" #include "qnetworkconfiguration_maemo_p.h" -#include "qnetworksession_maemo_p.h" QTM_BEGIN_NAMESPACE diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkconfigmanager_p.cpp --- a/qtmobility/src/bearer/qnetworkconfigmanager_p.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkconfigmanager_p.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkconfigmanager_p.h --- a/qtmobility/src/bearer/qnetworkconfigmanager_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkconfigmanager_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkconfigmanager_s60_p.cpp --- a/qtmobility/src/bearer/qnetworkconfigmanager_s60_p.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkconfigmanager_s60_p.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -69,13 +69,10 @@ QTM_BEGIN_NAMESPACE -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - static const int KValueThatWillBeAddedToSNAPId = 1000; -#endif static const int KUserChoiceIAPId = 0; QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() - : QObject(0), CActive(CActive::EPriorityIdle), capFlags(0), + : QObject(0), CActive(CActive::EPriorityHigh), capFlags(0), iFirstUpdate(true), iInitOk(true), iUpdatePending(false), iTimeToWait(0) { @@ -92,6 +89,9 @@ } 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 @@ -215,7 +215,6 @@ if (!iInitOk) { return; } - TRAP_IGNORE(updateConfigurationsL()); } @@ -236,7 +235,7 @@ 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 { @@ -268,7 +267,7 @@ 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 { @@ -304,7 +303,7 @@ 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 QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); if (priv.data() == 0) { @@ -358,7 +357,7 @@ 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 { @@ -420,7 +419,7 @@ { QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); 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); @@ -521,7 +520,7 @@ User::Leave(KErrNotFound); } - QString ident = QString::number(qHash(aApId)); + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(aApId)); QT_TRYCATCH_LEAVING(apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length())); apNetworkConfiguration->isValid = true; @@ -588,13 +587,13 @@ 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)); QExplicitlySharedDataPointer priv = snapConfigurations.value(iface); if (priv.data() != 0) { item.d = priv; } } else if (defaultConnectionValue.iType == ECmDefConnConnectionMethod) { - QString iface = QString::number(qHash(defaultConnectionValue.iId)); + QString iface = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(defaultConnectionValue.iId)); QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); if (priv.data() != 0) { item.d = priv; @@ -636,8 +635,14 @@ 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)); QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); +#ifdef OCC_FUNCTIONALITY_AVAILABLE + if (!priv.data()) { + // If IAP was not found, check if the update was about EasyWLAN + priv = configurationFromEasyWlan(apId, connectionId); + } +#endif if (priv.data()) { iConnectionMonitor.GetIntAttribute(connectionId, subConnectionCount, KConnectionStatus, connectionStatus, status); User::WaitForRequest(status); @@ -663,7 +668,7 @@ if (iOnline != online) { iOnline = online; - emit this->onlineStateChanged(iOnline); + emit this->onlineStateChanged(online); } } @@ -687,7 +692,7 @@ // Set state of returned IAPs to Discovered // if state is not already Active for(TUint i=0; i priv = accessPointConfigurations.value(ident); if (priv.data()) { unavailableConfigs.removeOne(ident); @@ -747,6 +752,31 @@ } } +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +void QNetworkConfigurationManagerPrivate::updateMobileBearerToConfigs(TConnMonBearerInfo bearerInfo) +{ + foreach (const QString &ii, accessPointConfigurations.keys()) { + QExplicitlySharedDataPointer p = + accessPointConfigurations.value(ii); + if (p->bearer >= QNetworkConfigurationPrivate::Bearer2G && + p->bearer <= QNetworkConfigurationPrivate::BearerHSPA) { + switch (bearerInfo) { + case EBearerInfoCSD: p->bearer = QNetworkConfigurationPrivate::Bearer2G; break; + case EBearerInfoWCDMA: p->bearer = QNetworkConfigurationPrivate::BearerWCDMA; break; + case EBearerInfoCDMA2000: p->bearer = QNetworkConfigurationPrivate::BearerCDMA2000; break; + case EBearerInfoGPRS: p->bearer = QNetworkConfigurationPrivate::Bearer2G; break; + case EBearerInfoHSCSD: p->bearer = QNetworkConfigurationPrivate::Bearer2G; break; + case EBearerInfoEdgeGPRS: p->bearer = QNetworkConfigurationPrivate::Bearer2G; break; + case EBearerInfoWcdmaCSD: p->bearer = QNetworkConfigurationPrivate::BearerWCDMA; break; + case EBearerInfoHSDPA: p->bearer = QNetworkConfigurationPrivate::BearerHSPA; break; + case EBearerInfoHSUPA: p->bearer = QNetworkConfigurationPrivate::BearerHSPA; break; + case EBearerInfoHSxPA: p->bearer = QNetworkConfigurationPrivate::BearerHSPA; break; + } + } + } +} +#endif + bool QNetworkConfigurationManagerPrivate::changeConfigurationStateTo(QExplicitlySharedDataPointer& sharedData, QNetworkConfiguration::StateFlags newState) { @@ -832,15 +862,15 @@ void QNetworkConfigurationManagerPrivate::RunL() { if (iStatus != KErrCancel) { -#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG - qDebug("QNCM CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int()); -#endif // 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()); +#endif // 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) { @@ -873,6 +903,20 @@ void QNetworkConfigurationManagerPrivate::EventL(const CConnMonEventBase& aEvent) { 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; @@ -888,10 +932,17 @@ 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)); QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); +#ifdef OCC_FUNCTIONALITY_AVAILABLE + if (!priv.data()) { + // Check if status was regarding EasyWLAN + priv = configurationFromEasyWlan(apId, connectionId); + } +#endif if (priv.data()) { - priv.data()->connectionId = connectionId; + priv.data()->connectionId = connectionId; QT_TRYCATCH_LEAVING(emit this->configurationStateChanged(priv.data()->numericId, connectionId, QNetworkSession::Connecting)); } } else if (connectionStatus == KLinkLayerOpen) { @@ -902,8 +953,14 @@ 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)); QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); +#ifdef OCC_FUNCTIONALITY_AVAILABLE + if (!priv.data()) { + // Check for EasyWLAN + priv = configurationFromEasyWlan(apId, connectionId); + } +#endif if (priv.data()) { priv.data()->connectionId = connectionId; // Configuration is Active @@ -963,7 +1020,7 @@ TConnMonIapInfo iaps = realEvent->IapAvailability(); QList 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)); QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); if (priv.data()) { // Configuration is either Discovered or Active @@ -992,8 +1049,14 @@ 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)); QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); +#ifdef OCC_FUNCTIONALITY_AVAILABLE + if (!priv.data()) { + // If IAP was not found, check if the update was about EasyWLAN + priv = configurationFromEasyWlan(apId, connectionId); + } +#endif if (priv.data()) { #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNCM updating connection monitor ID : from, to, whose: " << priv.data()->connectionId << connectionId << priv->name; @@ -1008,6 +1071,41 @@ } } +#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. +QExplicitlySharedDataPointer QNetworkConfigurationManagerPrivate::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 + QNetworkConfiguration item; + QHash >::const_iterator i = + accessPointConfigurations.constBegin(); + while (i != accessPointConfigurations.constEnd()) { + QExplicitlySharedDataPointer priv = i.value(); + if (priv.data()->name == realSSID) { +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNCM EasyWlan uses real SSID: " << realSSID; +#endif + return priv; + } + ++i; + } + } + } + return QExplicitlySharedDataPointer(); +} +#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, @@ -1023,7 +1121,7 @@ switch (newState) { case QNetworkSession::Disconnected: { - QString ident = QString::number(qHash(accessPointId)); + QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(accessPointId)); QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); if (priv.data()) { // Configuration is either Defined or Discovered @@ -1065,7 +1163,6 @@ } ++i; } - return QExplicitlySharedDataPointer(); } diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkconfigmanager_s60_p.h --- a/qtmobility/src/bearer/qnetworkconfigmanager_s60_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkconfigmanager_s60_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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) ** @@ -66,6 +66,9 @@ // Uncomment and compile QtBearer to gain detailed state tracing // #define QT_BEARERMGMT_SYMBIAN_DEBUG +#define QT_BEARERMGMT_CONFIGURATION_SNAP_PREFIX "S_" +#define QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX "I_" + class CCommsDatabase; class QEventLoop; @@ -113,6 +116,7 @@ bool changeConfigurationStateAtMaxTo(QExplicitlySharedDataPointer& sharedData, QNetworkConfiguration::StateFlags newState); #ifdef SNAP_FUNCTIONALITY_AVAILABLE + void updateMobileBearerToConfigs(TConnMonBearerInfo bearerInfo); QNetworkConfigurationPrivate* configFromConnectionMethodL(RCmConnectionMethod& connectionMethod); #else bool readNetworkConfigurationValuesFromCommsDb( @@ -145,6 +149,9 @@ // For QNetworkSessionPrivate to indicate about state changes void configurationStateChangeReport(TUint32 accessPointId, QNetworkSession::State newState); +#ifdef OCC_FUNCTIONALITY_AVAILABLE + QExplicitlySharedDataPointer configurationFromEasyWlan(TUint32 apId, TUint connectionId); +#endif public: // Data //this table contains an up to date list of all configs at any time. diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkconfiguration.cpp --- a/qtmobility/src/bearer/qnetworkconfiguration.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkconfiguration.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkconfiguration.h --- a/qtmobility/src/bearer/qnetworkconfiguration.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkconfiguration.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkconfiguration_maemo_p.h --- a/qtmobility/src/bearer/qnetworkconfiguration_maemo_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkconfiguration_maemo_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkconfiguration_p.h --- a/qtmobility/src/bearer/qnetworkconfiguration_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkconfiguration_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkconfiguration_s60_p.cpp --- a/qtmobility/src/bearer/qnetworkconfiguration_s60_p.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkconfiguration_s60_p.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkconfiguration_s60_p.h --- a/qtmobility/src/bearer/qnetworkconfiguration_s60_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkconfiguration_s60_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkmanagerservice_p.cpp --- a/qtmobility/src/bearer/qnetworkmanagerservice_p.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkmanagerservice_p.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworkmanagerservice_p.h --- a/qtmobility/src/bearer/qnetworkmanagerservice_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworkmanagerservice_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworksession.cpp --- a/qtmobility/src/bearer/qnetworksession.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksession.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworksession.h --- a/qtmobility/src/bearer/qnetworksession.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksession.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworksession_maemo.cpp --- a/qtmobility/src/bearer/qnetworksession_maemo.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksession_maemo.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworksession_maemo_p.h --- a/qtmobility/src/bearer/qnetworksession_maemo_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksession_maemo_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworksession_p.cpp --- a/qtmobility/src/bearer/qnetworksession_p.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksession_p.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworksession_p.h --- a/qtmobility/src/bearer/qnetworksession_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksession_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworksession_s60_p.cpp --- a/qtmobility/src/bearer/qnetworksession_s60_p.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksession_s60_p.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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) ** @@ -53,15 +53,29 @@ QNetworkSessionPrivate::QNetworkSessionPrivate() : CActive(CActive::EPriorityUserInput), state(QNetworkSession::Invalid), - isOpen(false), ipConnectionNotifier(0), iHandleStateNotificationsFromManager(false), - iFirstSync(true), iStoppedByUser(false), iClosedByUser(false), iDeprecatedConnectionId(0), - iError(QNetworkSession::UnknownSessionError), iALREnabled(0), iConnectInBackground(false) + isOpen(false), iDynamicUnSetdefaultif(0), ipConnectionNotifier(0), + iHandleStateNotificationsFromManager(false), iFirstSync(true), iStoppedByUser(false), + iClosedByUser(false), iDeprecatedConnectionId(0), iError(QNetworkSession::UnknownSessionError), + iALREnabled(0), iConnectInBackground(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 setdefaultif() resolution succeeded. "; + else + qDebug() << "dynamic setdefaultif() resolution failed. "; +#endif TRAP_IGNORE(iConnectionMonitor.ConnectL()); } @@ -76,9 +90,6 @@ delete ipConnectionNotifier; ipConnectionNotifier = NULL; - // Cancel possible RConnection::Start() - Cancel(); - #ifdef SNAP_FUNCTIONALITY_AVAILABLE if (iMobility) { delete iMobility; @@ -86,13 +97,16 @@ } #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(); } void QNetworkSessionPrivate::configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState) @@ -352,39 +366,6 @@ } 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) { - if (connInfo().iIapId == publicConfig.d.data()->numericId) { - if (iConnection.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) { - activeConfig = publicConfig; - activeInterface = interface(activeConfig.d.data()->numericId); - 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) { #ifdef OCC_FUNCTIONALITY_AVAILABLE // With One Click Connectivity (Symbian^3 onwards) it is possible // to connect silently, without any popups. @@ -405,9 +386,12 @@ SetActive(); } newState(QNetworkSession::Connecting); - } } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { #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 = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.keys(); TConnPrefList snapPref; TExtendedConnPref prefs; prefs.SetSnapId(publicConfig.d.data()->numericId); @@ -477,19 +461,23 @@ << "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; - isOpen = false; +#ifndef OCC_FUNCTIONALITY_AVAILABLE + // On Symbian^3 we need to keep track of active configuration longer + // in case of empty-SNAP-triggered EasyWLAN. activeConfig = QNetworkConfiguration(); +#endif serviceConfig = QNetworkConfiguration(); - Cancel(); #ifdef SNAP_FUNCTIONALITY_AVAILABLE if (iMobility) { delete iMobility; @@ -503,17 +491,39 @@ 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. Deprecating connection monitor ID: " << publicConfig.d.data()->connectionId; +#endif + + // 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. + iDeprecatedConnectionId = publicConfig.d.data()->connectionId; newState(QNetworkSession::Closing); newState(QNetworkSession::Disconnected); } - if (allowSignals) { emit q->closed(); } @@ -589,8 +599,13 @@ { #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(); } @@ -702,7 +717,7 @@ { #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; @@ -856,7 +871,7 @@ _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 @@ -877,7 +892,7 @@ // clone of the one of the IAPs of the used SNAP // => If mappingName matches, clone has been found QNetworkConfiguration pt; - pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(QString::number(qHash(iapId))); + pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId))); if (pt.d) { for (int i=0; i < children.count(); i++) { if (children[i].d.data()->mappingName == pt.d.data()->mappingName) { @@ -885,22 +900,59 @@ } } } 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. + ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->updateConfigurations(); + // 2. Check if new configuration was created during connection creation + QList knownConfigs = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.keys(); +#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.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(newIapId); + if (pt.d) { +#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 (publicConfig.d.data()->manager) { QNetworkConfiguration pt; // Try to found User Selected IAP from known IAPs (accessPointConfigurations) - pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(QString::number(qHash(iapId))); + pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId))); if (pt.d) { return pt; } else { @@ -937,6 +989,10 @@ void QNetworkSessionPrivate::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) { @@ -1139,6 +1195,7 @@ 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; @@ -1159,6 +1216,21 @@ } } } +#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 } } @@ -1171,8 +1243,11 @@ // considerably later (almost a second). Connection id is an increasing // number, so this does not affect next _real_ 'conneting/connected' states. iDeprecatedConnectionId = publicConfig.d.data()->connectionId; +#ifdef OCC_FUNCTIONALITY_AVAILABLE + // Just in case clear activeConfiguration. + activeConfig = QNetworkConfiguration(); +#endif } - return retVal; } @@ -1197,7 +1272,6 @@ case KFinishedSelection: if (aError == KErrNone) { - // The user successfully selected an IAP to be used break; } else diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworksession_s60_p.h --- a/qtmobility/src/bearer/qnetworksession_s60_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksession_s60_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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) ** @@ -71,6 +71,7 @@ QTM_BEGIN_NAMESPACE class ConnectionProgressNotifier; +typedef void (*TOpenCUnSetdefaultifFunction)(); class QNetworkSessionPrivate : public QObject, public CActive #ifdef SNAP_FUNCTIONALITY_AVAILABLE @@ -162,6 +163,9 @@ QNetworkSession* q; QDateTime startTime; + RLibrary iOpenCLibrary; + TOpenCUnSetdefaultifFunction iDynamicUnSetdefaultif; + mutable RSocketServ iSocketServ; mutable RConnection iConnection; mutable RConnectionMonitor iConnectionMonitor; diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworksessionengine.cpp --- a/qtmobility/src/bearer/qnetworksessionengine.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksessionengine.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworksessionengine_p.h --- a/qtmobility/src/bearer/qnetworksessionengine_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksessionengine_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnetworksessionengine_win_p.h --- a/qtmobility/src/bearer/qnetworksessionengine_win_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksessionengine_win_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnlaengine_win.cpp --- a/qtmobility/src/bearer/qnlaengine_win.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnlaengine_win.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnlaengine_win_p.h --- a/qtmobility/src/bearer/qnlaengine_win_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnlaengine_win_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnmdbushelper.cpp --- a/qtmobility/src/bearer/qnmdbushelper.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnmdbushelper.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnmdbushelper_p.h --- a/qtmobility/src/bearer/qnmdbushelper_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnmdbushelper_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnmwifiengine_unix.cpp --- a/qtmobility/src/bearer/qnmwifiengine_unix.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnmwifiengine_unix.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/bearer/qnmwifiengine_unix_p.h --- a/qtmobility/src/bearer/qnmwifiengine_unix_p.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/bearer/qnmwifiengine_unix_p.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/global/qmobilityglobal.h --- a/qtmobility/src/global/qmobilityglobal.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/global/qmobilityglobal.h Mon Jun 21 16:36:26 2010 +0300 @@ -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) ** @@ -42,13 +42,13 @@ #define QMOBILITYGLOBAL_H -#define QTM_VERSION_STR "1.0.0" +#define QTM_VERSION_STR "1.0.1" /* QTM_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QTM_VERSION 0x010000 +#define QTM_VERSION 0x010001 /* - can be used like #if (QTM_VERSION >= QTM_VERSION_CHECK(1, 0, 0)) + can be used like #if (QTM_VERSION >= QTM_VERSION_CHECK(1, 0, 1)) */ #define QTM_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) @@ -105,10 +105,10 @@ # else # define Q_MESSAGING_EXPORT Q_DECL_IMPORT # endif -# if defined(QT_BUILD_MEDIA_LIB) -# define Q_MEDIA_EXPORT Q_DECL_EXPORT +# if defined(QT_BUILD_MULTIMEDIA_LIB) +# define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT # else -# define Q_MEDIA_EXPORT Q_DECL_IMPORT +# define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT # endif # if defined(QT_BUILD_SFW_LIB) # define Q_SERVICEFW_EXPORT Q_DECL_EXPORT @@ -131,7 +131,7 @@ # define Q_CONTACTS_EXPORT Q_DECL_IMPORT # define Q_VERSIT_EXPORT Q_DECL_IMPORT # define Q_LOCATION_EXPORT Q_DECL_IMPORT -# define Q_MEDIA_EXPORT Q_DECL_IMPORT +# define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT # define Q_MESSAGING_EXPORT Q_DECL_IMPORT # define Q_SERVICEFW_EXPORT Q_DECL_IMPORT # define Q_SYSINFO_EXPORT Q_DECL_IMPORT @@ -146,7 +146,7 @@ # define Q_CONTACTS_EXPORT Q_DECL_EXPORT # define Q_VERSIT_EXPORT Q_DECL_EXPORT # define Q_LOCATION_EXPORT Q_DECL_EXPORT -# define Q_MEDIA_EXPORT Q_DECL_EXPORT +# define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT # define Q_MESSAGING_EXPORT Q_DECL_EXPORT # define Q_SERVICEFW_EXPORT Q_DECL_EXPORT # define Q_SYSINFO_EXPORT Q_DECL_EXPORT @@ -157,7 +157,7 @@ # define Q_CONTACTS_EXPORT # define Q_VERSIT_EXPORT # define Q_LOCATION_EXPORT -# define Q_MEDIA_EXPORT +# define Q_MULTIMEDIA_EXPORT # define Q_MESSAGING_EXPORT # define Q_SERVICEFW_EXPORT # define Q_SYSINFO_EXPORT diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/global/qmobilitypluginsearch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobility/src/global/qmobilitypluginsearch.h Mon Jun 21 16:36:26 2010 +0300 @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 +#include + +#if defined(Q_OS_SYMBIAN) +# include +#endif + +QTM_BEGIN_NAMESPACE + +class DirChecker +{ +public: + DirChecker(); + ~DirChecker(); + bool checkDir(const QDir& dir); + +private: +#if defined(Q_OS_SYMBIAN) + RFs rfs; +#endif +}; + +#if defined(Q_OS_SYMBIAN) +DirChecker::DirChecker() +{ + qt_symbian_throwIfError(rfs.Connect()); +} + +bool DirChecker::checkDir(const QDir& dir) +{ + bool pathFound = false; + // In Symbian, going cdUp() in a c:/private// will result in *platsec* error at fileserver (requires AllFiles capability) + // Also, trying to cd() to a nonexistent directory causes *platsec* error. This does not cause functional harm, but should + // nevertheless be changed to use native Symbian methods to avoid unnecessary platsec warnings (as per qpluginloader.cpp). + // Use native Symbian code to check for directory existence, because checking + // for files from under non-existent protected dir like E:/private/ using + // QDir::exists causes platform security violations on most apps. + QString nativePath = QDir::toNativeSeparators(dir.absolutePath()); + TPtrC ptr = TPtrC16(static_cast(nativePath.utf16()), nativePath.length()); + TUint attributes; + TInt err = rfs.Att(ptr, attributes); + if (err == KErrNone) { + // yes, the directory exists. + pathFound = true; + } + return pathFound; +} + +DirChecker::~DirChecker() +{ + rfs.Close(); +} +#else +DirChecker::DirChecker() +{ +} + +DirChecker::~DirChecker() +{ +} + +bool DirChecker::checkDir(const QDir &dir) +{ + return dir.exists(); +} +#endif + +inline QStringList mobilityPlugins(const QString plugintype) +{ +#if !defined QT_NO_DEBUG + const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0; +#endif + + QStringList paths = QApplication::libraryPaths(); +#ifdef QTM_PLUGIN_PATH + paths << QLatin1String(QTM_PLUGIN_PATH); +#endif +#if !defined QT_NO_DEBUG + if (showDebug) + qDebug() << "Plugin paths:" << paths; +#endif + + DirChecker dirChecker; + + //temp variable to avoid multiple identic path + QSet processed; + + /* Discover a bunch o plugins */ + QStringList plugins; + + /* Enumerate our plugin paths */ + for (int i=0; i < paths.count(); i++) { + if (processed.contains(paths.at(i))) + continue; + processed.insert(paths.at(i)); + QDir pluginsDir(paths.at(i)); + if (!dirChecker.checkDir(pluginsDir)) + continue; + +#if defined(Q_OS_WIN) + if (pluginsDir.dirName().toLower() == QLatin1String("debug") || pluginsDir.dirName().toLower() == QLatin1String("release")) + pluginsDir.cdUp(); +#elif defined(Q_OS_MAC) + if (pluginsDir.dirName() == QLatin1String("MacOS")) { + pluginsDir.cdUp(); + pluginsDir.cdUp(); + pluginsDir.cdUp(); + } +#endif + + QString subdir(QLatin1String("plugins/")); + subdir += plugintype; + if (pluginsDir.path().endsWith(QLatin1String("/plugins")) + || pluginsDir.path().endsWith(QLatin1String("/plugins/"))) + subdir = plugintype; + + if (dirChecker.checkDir(QDir(pluginsDir.path() + QLatin1Char('/') + subdir))) { + pluginsDir.cd(subdir); + QStringList files = pluginsDir.entryList(QDir::Files); + +#if !defined QT_NO_DEBUG + if (showDebug) + qDebug() << "Looking for " << plugintype << " plugins in" << pluginsDir.path() << files; +#endif + + for (int j=0; j < files.count(); j++) { + plugins << pluginsDir.absoluteFilePath(files.at(j)); + } + } + } + return plugins; +} + +QTM_END_NAMESPACE diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/s60installs/s60installs.pro --- a/qtmobility/src/s60installs/s60installs.pro Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/s60installs/s60installs.pro Mon Jun 21 16:36:26 2010 +0300 @@ -1,6 +1,6 @@ TEMPLATE = subdirs -symbian: { +isEmpty(QT_LIBINFIX):symbian { include(../../staticconfig.pri) load(data_caging_paths) include($$QT_MOBILITY_BUILD_TREE/config.pri) @@ -8,11 +8,8 @@ SUBDIRS = TARGET = "QtMobility" TARGET.UID3 = 0x2002AC89 - # TP preview 0.1.0 - # Beta 0.2.0 - # Final 1.0.0 - VERSION = 1.0.0 + VERSION = 1.0.1 vendorinfo = \ "; Localised Vendor name" \ @@ -59,9 +56,14 @@ qtmobilitydeployment.pkg_postrules += bearer } + !isEmpty(pluginstubs):qtmobilitydeployment.pkg_postrules += pluginstubs + qtmobilitydeployment.path = /sys/bin DEPLOYMENT += qtmobilitydeployment #BLD_INF_RULES.prj_exports += "./qtmobility.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qtmobility.iby)" + +} else { + message(Deployment of infixed library names not supported) } diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/src/src.pro --- a/qtmobility/src/src.pro Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/src/src.pro Mon Jun 21 16:36:26 2010 +0300 @@ -6,6 +6,6 @@ contains(mobility_modules,bearer): SUBDIRS += bearer symbian { - SUBDIRS += s60installs/s60installs.pro + SUBDIRS += s60installs } diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/auto/qbearertestcommon.h --- a/qtmobility/tests/auto/qbearertestcommon.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/tests/auto/qbearertestcommon.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp --- a/qtmobility/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/auto/qnetworksession/lackey/main.cpp --- a/qtmobility/tests/auto/qnetworksession/lackey/main.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/tests/auto/qnetworksession/lackey/main.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp --- a/qtmobility/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -74,17 +74,20 @@ 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(); @@ -127,6 +130,7 @@ // 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; @@ -261,6 +265,53 @@ testSession.reject(); } +void tst_QNetworkSession::sessionClosing_data() { + QTest::addColumn("bearerType"); + QTest::addColumn("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() { @@ -1044,15 +1095,27 @@ QTRY_VERIFY(stateChangedSpy.count() > 0); state = qvariant_cast(stateChangedSpy.at(stateChangedSpy.count() - 1).at(0)); + for (int i = 0; i < stateChangedSpy.count(); i++) { + QNetworkSession::State state_temp = + qvariant_cast(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(stateChangedSpy.at(stateChangedSpy.count() - 2).at(0)); QVERIFY(state == QNetworkSession::Roaming); @@ -1086,9 +1149,18 @@ QVERIFY(state == QNetworkSession::Closing); state = qvariant_cast(stateChangedSpy2.at(1).at(0)); QVERIFY(state == QNetworkSession::Disconnected); - } else { // Assume .count() == 1 - QCOMPARE(stateChangedSpy2.count(), 1); - QNetworkSession::State state = qvariant_cast(stateChangedSpy2.at(0).at(0)); + } else { + QVERIFY(stateChangedSpy2.count() >= 1); + + for (int i = 0; i < stateChangedSpy2.count(); i++) { + QNetworkSession::State state_temp = + qvariant_cast(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(stateChangedSpy2.at(stateChangedSpy2.count() - 1).at(0)); // Symbian version dependant. QVERIFY(state == QNetworkSession::Disconnected); } diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/bearerex/bearerex.cpp --- a/qtmobility/tests/bearerex/bearerex.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/tests/bearerex/bearerex.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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) ** @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include "bearerex.h" +#include "datatransferer.h" #include @@ -260,8 +261,8 @@ 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); @@ -299,37 +300,46 @@ SessionTab::~SessionTab() { - delete m_NetworkSession; - delete m_http; + 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) { + if (m_dataTransferer) { + disconnect(m_dataTransferer, 0, 0, 0); + delete m_dataTransferer; + m_dataTransferer = 0; + } + // 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; } - - if (m_http) { - disconnect(m_http, 0, 0, 0); - delete m_http; - } - 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(); } } @@ -414,7 +424,7 @@ 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); @@ -424,7 +434,7 @@ } 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); @@ -475,6 +485,18 @@ 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); @@ -486,7 +508,7 @@ 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); @@ -537,23 +559,25 @@ 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."); + 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 + // trigger the done() invokation). + if (m_NetworkSession) { + sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+ + QString(" / ")+ + QString::number(m_NetworkSession->bytesReceived())); } else { - QString result(m_http->readAll()); - msgBox.setText(QString("HTTP request finished successfully.\nReceived ")+QString::number(result.length())+QString(" bytes.")); + sentRecDataLineEdit->setText("Data amounts not available."); } - msgBox.exec(); - - sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+ - QString(" / ")+ - QString::number(m_NetworkSession->bytesReceived())); } // End of file diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/bearerex/bearerex.h --- a/qtmobility/tests/bearerex/bearerex.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/tests/bearerex/bearerex.h Mon Jun 21 16:36:26 2010 +0300 @@ -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) ** @@ -54,13 +54,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; QTM_USE_NAMESPACE @@ -112,14 +115,15 @@ 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); @@ -130,13 +134,14 @@ 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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/bearerex/bearerex.pro --- a/qtmobility/tests/bearerex/bearerex.pro Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/tests/bearerex/bearerex.pro Mon Jun 21 16:36:26 2010 +0300 @@ -24,11 +24,13 @@ # Example headers and sources HEADERS += bearerex.h \ - xqlistwidget.h + xqlistwidget.h \ + datatransferer.h SOURCES += bearerex.cpp \ main.cpp \ - xqlistwidget.cpp + xqlistwidget.cpp \ + datatransferer.cpp CONFIG += mobility MOBILITY = bearer diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/bearerex/datatransferer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobility/tests/bearerex/datatransferer.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -0,0 +1,179 @@ +#include +#include +#include +#include +#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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/bearerex/datatransferer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobility/tests/bearerex/datatransferer.h Mon Jun 21 16:36:26 2010 +0300 @@ -0,0 +1,89 @@ +#ifndef DATATRANSFERER_H +#define DATATRANSFERER_H + +#include +#include +#include +#include +#include +#include +#include + +// 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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/bearerex/main.cpp --- a/qtmobility/tests/bearerex/main.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/tests/bearerex/main.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/bearerex/sessiondialog.ui --- a/qtmobility/tests/bearerex/sessiondialog.ui Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/tests/bearerex/sessiondialog.ui Mon Jun 21 16:36:26 2010 +0300 @@ -1,78 +1,87 @@ - + + SessionTab - - + + + + 0 + 0 + 192 + 262 + + + - - - - + + + + SNAP - - - - true - - - - - - - IAP - - - - - - - true - - + + + true - - - - Bearer + + + + IAP - - - + + + + true + + true - - - + + + + Bearer + + + + + + + true + + + + + + Sent/Rec. - - - + + + true - - - + + + State - - - + + + true @@ -80,52 +89,71 @@ - - - - + + + + Open Session - - - + + + Close Session - - - + + + Stop Conn. - - - - Create QHttp + + + + Enable ALR - - - + + + Send Test Req. - - - - Enable ALR + + + + Create - - - + + + + + QNAM + + + + + QTcpSocket + + + + + QHttp + + + + + + + Delete Session @@ -135,5 +163,25 @@ - + + + comboBox + currentIndexChanged(QString) + SessionTab + on_dataObjectChanged(QString) + + + 40 + 211 + + + 10 + 258 + + + + + + on_dataObjectChanged(QString) + diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/bearerex/xqlistwidget.cpp --- a/qtmobility/tests/bearerex/xqlistwidget.cpp Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/tests/bearerex/xqlistwidget.cpp Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/bearerex/xqlistwidget.h --- a/qtmobility/tests/bearerex/xqlistwidget.h Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/tests/bearerex/xqlistwidget.h Mon Jun 21 16:36:26 2010 +0300 @@ -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 -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/networkmanager/README --- a/qtmobility/tests/networkmanager/README Wed Jun 09 10:36:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -This application serves as prototype/test-bed for NetworkManager development. The excellent (non-existing) documentation -for the various NetworkManager interfaces makes this harder than it should be. diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/networkmanager/dialog.ui --- a/qtmobility/tests/networkmanager/dialog.ui Wed Jun 09 10:36:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,213 +0,0 @@ - - - Dialog - - - - 0 - 0 - 919 - 657 - - - - Dialog - - - - - - - - Connections - - - - - - - - Path - - - - - State - - - - - Id - - - - - Settings - - - - - - - - - - - - Devices: - - - - - - - - Path - - - - - Managed - - - - - Interface - - - - - Driver - - - - - Type - - - - - State - - - - - IP4 Address - - - - - IP4 Config - - - - - Hostname - - - - - Domains - - - - - - - - - - Qt::Horizontal - - - - 908 - 20 - - - - - - - - true - - - - SSID - - - - - Strength - - - - - Wpa - - - - - Rsn - - - - - Freq - - - - - Hardware Address - - - - - Mode - - - - - Max Bitrate - - - - - - - - - - Start - - - - - - - Stop - - - - - - - Scan - - - - - - - Update - - - - - - - - - - diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/networkmanager/networkmanager.pro --- a/qtmobility/tests/networkmanager/networkmanager.pro Wed Jun 09 10:36:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -SOURCES += networkmanagertest.cpp nmview.cpp -HEADERS += nmview.h -TARGET = tst_networkmanagertest - -QT = core network dbus gui - -#not really a test case but deployment happens same way -CONFIG += testcase - -requires(contains(QT_CONFIG,dbus)) - -INCLUDEPATH += ../../src/bearer -include(../../common.pri) - -CONFIG += mobility -MOBILITY = bearer - -#MOC_DIR = .moc -#OBJECTS_DIR = .obj -FORMS += dialog.ui diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/networkmanager/networkmanagertest.cpp --- a/qtmobility/tests/networkmanager/networkmanagertest.cpp Wed Jun 09 10:36:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,287 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "nmview.h" - -#include - -typedef QMap< QString, QMap > SettingsMap; -Q_DECLARE_METATYPE(SettingsMap) - -void printConnectionDetails(const QString& service) -{ - QDBusConnection dbc = QDBusConnection::systemBus(); - if (!dbc.isConnected()) { - qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); - return; - } - QDBusInterface allCons(service, NM_DBUS_PATH_SETTINGS, NM_DBUS_IFACE_SETTINGS, dbc); - if (allCons.isValid()) { - QDBusReply > reply = allCons.call("ListConnections"); - if ( reply.isValid() ) { - qWarning() << "Known connections:"; - QList list = reply.value(); - foreach(QDBusObjectPath path, list) { - qWarning() << " " << path.path(); - QDBusInterface sysIface(NM_DBUS_SERVICE_SYSTEM_SETTINGS, path.path(), NM_DBUS_IFACE_SETTINGS_CONNECTION, dbc); - if (sysIface.isValid()) { - QDBusMessage r = sysIface.call("GetSettings"); - QDBusReply< SettingsMap > rep = sysIface.call("GetSettings"); - qWarning() << " GetSettings:" << r.arguments() << r.signature() << rep.isValid() << sysIface.lastError(); - QMap< QString, QMap > map = rep.value(); - QList list = map.keys(); - foreach (QString key, list) { - QMap innerMap = map[key]; - qWarning() << " Key: " << key; - QMap::const_iterator i = innerMap.constBegin(); - while (i != innerMap.constEnd()) { - QString k = i.key(); - qWarning() << " Key: " << k << " Entry: " << i.value(); - if (k == "addresses" && i.value().canConvert()) { - QDBusArgument arg = i.value().value(); - arg.beginArray(); - while (!arg.atEnd()) { - QDBusVariant addr; - arg >> addr; - uint ip = addr.variant().toUInt(); - qWarning() << ip; - qWarning() << " " << QHostAddress(htonl(ip)).toString(); - } - - } - i++; - } - } - } - } - } - } - - -} - -void readConnectionManagerDetails() -{ - qDBusRegisterMetaType(); - QDBusConnection dbc = QDBusConnection::systemBus(); - if (!dbc.isConnected()) { - qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); - return; - } - - QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbc); - if (!iface.isValid()) { - qWarning() << "Could not find NetworkManager"; - return; - } - - uint state = iface.property("State").toUInt(); - switch(state) { - case NM_STATE_UNKNOWN: - qWarning() << "State: Unknown"; break; - case NM_STATE_ASLEEP: - qWarning() << "State: Asleep"; break; - case NM_STATE_CONNECTING: - qWarning() << "State: Connecting"; break; - case NM_STATE_CONNECTED: - qWarning() << "State: Connected"; break; - case NM_STATE_DISCONNECTED: - qWarning() << "State: Disconnected"; break; - } - //get list of network devices - QDBusReply > reply = iface.call("GetDevices"); - if ( reply.isValid() ) { - qWarning() << "Current devices:"; - QList list = reply.value(); - foreach(QDBusObjectPath path, list) { - qWarning() << " " << path.path(); - QDBusInterface devIface(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_DEVICE, dbc); - if (devIface.isValid()) { - qWarning() << " Managed: " << devIface.property("Managed").toBool(); - qWarning() << " Interface: " << devIface.property("Interface").toString(); - qWarning() << " HAL UDI: " << devIface.property("Udi").toString(); - qWarning() << " Driver: " << devIface.property("Driver").toString(); - QVariant v = devIface.property("DeviceType"); - switch(v.toUInt()) { - case DEVICE_TYPE_UNKNOWN: - qWarning() << " DeviceType: Unknown" ; - break; - case DEVICE_TYPE_802_3_ETHERNET: - qWarning() << " DeviceType: Ethernet" ; - break; - case DEVICE_TYPE_802_11_WIRELESS: - qWarning() << " DeviceType: Wireless" ; - break; - case DEVICE_TYPE_GSM: - qWarning() << " DeviceType: GSM" ; - break; - case DEVICE_TYPE_CDMA: - qWarning() << " DeviceType: CDMA" ; - break; - - } - v = devIface.property("State"); - switch(v.toUInt()) { - case NM_DEVICE_STATE_UNKNOWN: - qWarning() << " State: Unknown" ; break; - case NM_DEVICE_STATE_UNMANAGED: - qWarning() << " State: Unmanaged" ; break; - case NM_DEVICE_STATE_UNAVAILABLE: - qWarning() << " State: Unavailable" ; break; - case NM_DEVICE_STATE_DISCONNECTED: - qWarning() << " State: Disconnected" ; break; - case NM_DEVICE_STATE_PREPARE: - qWarning() << " State: Preparing" ; break; - case NM_DEVICE_STATE_CONFIG: - qWarning() << " State: Being configured" ; break; - case NM_DEVICE_STATE_NEED_AUTH: - qWarning() << " State: Awaiting secrets" ; break; - case NM_DEVICE_STATE_IP_CONFIG: - qWarning() << " State: IP requested" ; break; - case NM_DEVICE_STATE_ACTIVATED: - qWarning() << " State: Activated" ; break; - case NM_DEVICE_STATE_FAILED: - qWarning() << " State: FAILED" ; break; - } - quint32 ip = devIface.property("Ip4Address").toUInt(); - qWarning() << " IP4Address: " << QHostAddress(htonl(ip)).toString(); - if (v.toUInt() == NM_DEVICE_STATE_ACTIVATED) { - QString path = devIface.property("Ip4Config").value().path(); - qWarning() << " IP4Config: " << path; - QDBusInterface ipIface(NM_DBUS_SERVICE, path, NM_DBUS_INTERFACE_IP4_CONFIG, dbc); - if (ipIface.isValid()) { - qWarning() << " Hostname: " << ipIface.property("Hostname").toString(); - qWarning() << " Domains: " << ipIface.property("Domains").toStringList(); - qWarning() << " NisDomain: " << ipIface.property("NisDomain").toString(); - QDBusArgument arg= ipIface.property("Addresses").value(); - //qWarning() << " " << arg.currentType(); - qWarning() << " Addresses: " << ipIface.property("Addresses"); - qWarning() << " Nameservers: " << ipIface.property("Nameservers"); - qWarning() << " NisServers: " << ipIface.property("NisServers"); - } - - } - - } - } - } - - //get list of active connections - QVariant prop = iface.property("ActiveConnections"); - QList connections = prop.value >(); - QString activePath; - if ( connections.count() ) - qWarning() << "Active connections:"; - foreach(QDBusObjectPath path, connections) { - qWarning() << " " << path.path(); - activePath = path.path(); - QString serviceName; - QDBusInterface conIface(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_ACTIVE_CONNECTION, dbc); - if (conIface.isValid()) { - qWarning() << " default connection: " << conIface.property("Default").toBool(); - serviceName = conIface.property("ServiceName").toString(); - qWarning() << " service name: " << serviceName; - qWarning() << " connection path: " << conIface.property("Connection").value().path(); - qWarning() << " specific object:" << conIface.property("SpecificObject").value().path(); - qWarning() << " sharedServiceName: " << conIface.property("SharedServiceName").toString(); - QList devs = conIface.property("Devices").value >(); - qWarning() << " devices: "; - foreach(QDBusObjectPath p, devs) - qWarning() << " " << path.path(); - QVariant v = conIface.property("State"); - switch (v.toInt()) { - case NM_ACTIVE_CONNECTION_STATE_UNKNOWN: - qWarning()<< " State: unknown"; break; - case NM_ACTIVE_CONNECTION_STATE_ACTIVATING: - qWarning()<< " State: activating"; break; - case NM_ACTIVE_CONNECTION_STATE_ACTIVATED: - qWarning()<< " State: activated"; break; - } - } else { - qWarning() << conIface.lastError(); - } - - } - - printConnectionDetails(NM_DBUS_SERVICE_SYSTEM_SETTINGS); - printConnectionDetails(NM_DBUS_SERVICE_USER_SETTINGS); - - - //turn active connection off - /*QDBusObjectPath dbop("/org/freedesktop/NetworkManager/ActiveConnection/1"); - QVariant asd = QVariant::fromValue(dbop); - iface.call(QLatin1String("DeactivateConnection"), asd); - qWarning() << iface.lastError();*/ - - /*QDBusObjectPath p1device("/org/freedesktop/Hal/devices/net_00_60_6e_82_02_65"); - QVariant p1v = QVariant::fromValue(p1device); - QDBusObjectPath p1con("/org/freedesktop/NetworkManagerSettings/0"); - QVariant p1c = QVariant::fromValue(p1con); - QDBusObjectPath p1sp(""); - QVariant p1sp1 = QVariant::fromValue(p1sp); - iface.call(QLatin1String("ActivateConnection"), - QString("/org/freedesktop/NetworkManagerSystemSettings"), p1c,p1v, p1v ); - qWarning() << iface.lastError(); - */ -} - -int main( int argc, char** argv) -{ - QApplication app(argc, argv); - //readConnectionManagerDetails(); - QMainWindow main; - NMView view; - main.setCentralWidget(&view); - main.show(); - return app.exec(); - -} diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/networkmanager/nmview.cpp --- a/qtmobility/tests/networkmanager/nmview.cpp Wed Jun 09 10:36:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1028 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $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 "nmview.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -//#include "ui_dialog.h" - -#include -#include -#include -#include - -//static QDBusConnection dbc = QDBusConnection::systemBus(); -//typedef QMap< QString, QMap > SettingsMap; -//Q_DECLARE_METATYPE(SettingsMap) - - -NMView::NMView(QDialog* parent) - : QDialog(parent, 0), dbc(QDBusConnection::systemBus()) -{ - init(); - - if (!dbc.isConnected()) { - qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); - return; - } - updateConnections(); - getDevices(); -} - -NMView::~NMView() -{ -} -void NMView::init() -{ - setupUi(this); - sess = 0; -// readSettings(); - connect(startButton, SIGNAL(clicked()), this, SLOT(activate())); - connect(stopButton, SIGNAL(clicked()), this, SLOT(deactivate())); - connect(scanButton, SIGNAL(clicked()), this, SLOT(findAccessPoints())); - connect(updateButton, SIGNAL(clicked()), this, SLOT(update())); - - connect(cons, SIGNAL(itemActivated(QTreeWidgetItem*, int)), - this,SLOT(connectionItemActivated(QTreeWidgetItem*, int))); - - - connect(devicesTreeWidget, SIGNAL(itemActivated(QTreeWidgetItem*, int)), - this, SLOT(deviceItemActivated(QTreeWidgetItem*, int))); - - cons->header()->setResizeMode(QHeaderView::ResizeToContents); - devicesTreeWidget->header()->setResizeMode(QHeaderView::ResizeToContents); - accessPointsTreeWidget->header()->setResizeMode(QHeaderView::ResizeToContents); -// accessPointsTreeWidget->header()->setResizeMode(QHeaderView::ResizeToContents); - - manager = new QNetworkConfigurationManager(this); - - connect(manager, SIGNAL(updateCompleted()), this, SLOT(updateCompleted())); - - connect(manager, SIGNAL(configurationAdded(const QNetworkConfiguration &)), - this, SLOT(configurationAdded(const QNetworkConfiguration&))); - - devicesTreeWidget->header()->hideSection(0); - devicesTreeWidget->header()->hideSection(1); - devicesTreeWidget->header()->hideSection(3); - devicesTreeWidget->header()->hideSection(5); - devicesTreeWidget->header()->hideSection(6); - devicesTreeWidget->header()->hideSection(7); - devicesTreeWidget->header()->hideSection(8); - devicesTreeWidget->header()->hideSection(9); -} - -void NMView::updateConnections() -{ - cons->clear(); - manager->updateConfigurations(); - QList configs = manager->allConfigurations(); - foreach(QNetworkConfiguration p, configs) { - QStringList strlist; - strlist << p.name(); - strlist << stateToString(p.state()); - strlist << p.identifier(); - strlist << typeToString(p.type()); - QTreeWidgetItem *item; - item = new QTreeWidgetItem(strlist); - cons->insertTopLevelItem(0, item); - } - cons->sortItems ( 1, Qt::AscendingOrder); -} - -void NMView::getActiveConnections() -{ - QList configs = manager->allConfigurations(QNetworkConfiguration::Active); - foreach(QNetworkConfiguration p, configs) { - qWarning() << __FUNCTION__ << p.name() << p.identifier(); - } - -// QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbc); -// if (!iface.isValid()) { -// qWarning() << "Could not find NetworkManager"; -// return; -// } - -// QVariant prop = iface.property("ActiveConnections"); -// QList connections = prop.value >(); -// foreach(QDBusObjectPath path, connections) { -// QDBusInterface conDetails(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_ACTIVE_CONNECTION, dbc); -// if (conDetails.isValid()) { -// QString desc = path.path(); -// conDetails.property("Connection Path").value().path(); - -// QList devices = conDetails.property("Devices").value >(); -// -// foreach(QDBusObjectPath devpath, devices) { -// QDBusInterface devIface(NM_DBUS_SERVICE, devpath.path(), NM_DBUS_INTERFACE_DEVICE, dbc); -// desc += " "+devIface.property("Interface").toString(); -// desc += " "+QHostAddress(htonl(devIface.property("Ip4Address").toUInt())).toString(); - -// } - -// qWarning() << conDetails.property("Connection").value().path() << path.path(); - -// QListWidgetItem* item = new QListWidgetItem(desc, activeCons); -// item->setData(Qt::UserRole, path.path()); -// } -// } -} - -void NMView::update() -{ -// QNetworkManagerInterface *dbIface; -// dbIface = new QNetworkManagerInterface; -// QList connections = dbIface->activeConnections(); -// -// foreach(QDBusObjectPath conpath, connections) { -// QNetworkManagerConnectionActive *aConn; -// aConn = new QNetworkManagerConnectionActive(conpath.path()); -// // in case of accesspoint, specificObject will hold the accessPOintObjectPath -// qWarning() << aConn->connection().path() << aConn->specificObject().path() << aConn->devices().count(); -// QList devs = aConn->devices(); -// foreach(QDBusObjectPath device, devs) { -// qWarning() << " " << device.path(); -// } -// } - - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; - foreach (QString service, connectionServices) { - QDBusInterface allCons(service, - NM_DBUS_PATH_SETTINGS, - NM_DBUS_IFACE_SETTINGS, - dbc); - if (allCons.isValid()) { - QDBusReply > reply = allCons.call("ListConnections"); - if ( reply.isValid() ) { - QList list = reply.value(); - foreach(QDBusObjectPath path, list) { - QDBusInterface sysIface(service, - path.path(), - NM_DBUS_IFACE_SETTINGS_CONNECTION, - dbc); - if (sysIface.isValid()) { - qWarning() << ""; - qWarning() << path.path(); - - // QDBusMessage r = sysIface.call("GetSettings"); - QDBusReply< QNmSettingsMap > rep = sysIface.call("GetSettings"); - - QMap< QString, QMap > map = rep.value(); - QList list = map.keys(); - foreach (QString key, list) { - QMap innerMap = map[key]; - qWarning() << " Key: " << key; - QMap::const_iterator i = innerMap.constBegin(); - - while (i != innerMap.constEnd()) { - QString k = i.key(); - qWarning() << " Key: " << k << " Entry: " << i.value(); - i++; - }//end innerMap - }//end foreach key - }//end settings connection - } // foreach path - } //end ListConnections - } //end settingsInterface - }// end services - QDBusInterface iface(NM_DBUS_SERVICE, - NM_DBUS_PATH, - NM_DBUS_INTERFACE, - dbc); - if (iface.isValid()) { - QVariant prop = iface.property("ActiveConnections"); - QList connections = prop.value >(); - foreach(QDBusObjectPath conpath, connections) { - qWarning() << "Active connection" << conpath.path(); - QDBusInterface conDetails(NM_DBUS_SERVICE, - conpath.path(), - NM_DBUS_INTERFACE_ACTIVE_CONNECTION, - dbc); - if (conDetails.isValid()) { - - QVariant prop = conDetails.property("Connection"); - QDBusObjectPath connection = prop.value(); - qWarning() << conDetails.property("Default").toBool() << connection.path(); - -// QVariant Sprop = conDetails.property("Devices"); -// QList so = Sprop.value >(); -// foreach(QDBusObjectPath device, so) { -// if(device.path() == devicePath) { -// path = connection.path(); -// } -// break; -// } - } - } - } -qWarning() << ""; -} - -void NMView::deactivate() -{ - QList configs = manager->allConfigurations(QNetworkConfiguration::Active); - foreach(QNetworkConfiguration p, configs) { - qWarning() << "Active cons" << p.name(); - if(p.name() == cons->currentItem()->text(0) - && p.identifier() == cons->currentItem()->text(2)) { - qWarning() <<__FUNCTION__<< p.name(); - if(!sess) { - sess = new QNetworkSession(p); - - connect(sess, SIGNAL(stateChanged(QNetworkSession::State)), - this, SLOT(stateChanged(QNetworkSession::State))); - - connect(sess, SIGNAL(error(QNetworkSession::SessionError)), - this, SLOT(networkSessionError(QNetworkSession::SessionError))); - } - sess->close(); - delete sess; - sess = 0; - } - } -} - -void NMView::activate() -{ - qWarning() << __FUNCTION__ << cons->currentItem()->text(0); - - QList configs = manager->allConfigurations(); - foreach(QNetworkConfiguration p, configs) { - if(p.name() == cons->currentItem()->text(0)) { - - sess = new QNetworkSession(p); - - connect(sess, SIGNAL(newConfigurationActivated()), - this, SLOT(getActiveConnections())); - - connect(sess, SIGNAL(stateChanged(QNetworkSession::State)), - this, SLOT(stateChanged(QNetworkSession::State))); - - connect(sess, SIGNAL(error(QNetworkSession::SessionError)), - this, SLOT(networkSessionError(QNetworkSession::SessionError))); - - sess->open(); - } - } -} - -void NMView::getDevices() -{ - qWarning() << ""; - qWarning() << __FUNCTION__; - devicesTreeWidget->clear(); - //qDBusRegisterMetaType(); - - if (!dbc.isConnected()) { - qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); - return; - } - QDBusInterface iface(NM_DBUS_SERVICE, - NM_DBUS_PATH, - NM_DBUS_INTERFACE, - dbc); -//NetworkManager interface - if (!iface.isValid()) { - qWarning() << "Could not find NetworkManager"; - return; - } - -// uint state = iface.property("State").toUInt(); -// switch(state) { -// case NM_STATE_UNKNOWN: -// qWarning() << "State: Unknown"; break; -// case NM_STATE_ASLEEP: -// qWarning() << "State: Asleep"; break; -// case NM_STATE_CONNECTING: -// qWarning() << "State: Connecting"; break; -// case NM_STATE_CONNECTED: -// qWarning() << "State: Connected"; break; -// case NM_STATE_DISCONNECTED: -// qWarning() << "State: Disconnected"; break; -// } - - //get list of network devices - QTreeWidgetItem *item; - QDBusReply > reply = iface.call("GetDevices"); - if ( reply.isValid() ) { -// qWarning() << "Current devices:"; - QList list = reply.value(); - foreach(QDBusObjectPath path, list) { - QStringList devicesList; - qWarning() << " " << path.path(); - devicesList << path.path(); - - QDBusInterface devIface(NM_DBUS_SERVICE, - path.path(), - NM_DBUS_INTERFACE_DEVICE, - dbc); - if (devIface.isValid()) { - - - - ////// connect the dbus signal -// /*if(*/dbc.connect(NM_DBUS_SERVICE, -// path.path(), -// NM_DBUS_INTERFACE_DEVICE, -// "StateChanged", -// this,SLOT(deviceStateChanged(quint32))); -// { -// qWarning() << "XXXXXXXXXX dbus connect successful" << path.path(); -// } - - - // qWarning() << " Managed: " << devIface.property("Managed").toBool(); - devicesList << devIface.property("Managed").toString(); - // qWarning() << " Interface: " << devIface.property("Interface").toString(); - devicesList << devIface.property("Interface").toString(); - // qWarning() << " HAL UDI: " << devIface.property("Udi").toString(); - // qWarning() << " Driver: " << devIface.property("Driver").toString(); - devicesList << devIface.property("Driver").toString(); - - QString x = deviceTypeToString(devIface.property("DeviceType").toUInt()); - // qWarning() << " Type:" << x; - devicesList << x; - - if( devIface.property("DeviceType").toUInt() == DEVICE_TYPE_802_11_WIRELESS) { - qWarning() << "Device is WIFI"; - // // findAccessPoints(path.path()); - } - - QVariant v = devIface.property("State"); - x = deviceStateToString(v.toUInt()); -// qWarning() << " State:" << x; - devicesList << x; - - quint32 ip = devIface.property("Ip4Address").toUInt(); -// qWarning() << " IP4Address: " << QHostAddress(htonl(ip)).toString(); - devicesList << QHostAddress(htonl(ip)).toString(); - - - if (v.toUInt() == NM_DEVICE_STATE_ACTIVATED) { - QString path = devIface.property("Ip4Config").value().path(); -// qWarning() << " IP4Config: " << path; - devicesList << path; - QDBusInterface ipIface(NM_DBUS_SERVICE, - path, - NM_DBUS_INTERFACE_IP4_CONFIG, - dbc); - if (ipIface.isValid()) { - // qWarning() << " Hostname: " << ipIface.property("Hostname").toString(); - devicesList << ipIface.property("Hostname").toString(); -// qWarning() << " Domains: " << ipIface.property("Domains").toStringList(); - devicesList << ipIface.property("Domains").toStringList().join(", "); -// qWarning() << " NisDomain: " << ipIface.property("NisDomain").toString(); - QDBusArgument arg= ipIface.property("Addresses").value(); -// qWarning() << " Addresses: " << ipIface.property("Addresses"); -// qWarning() << " Nameservers: " << ipIface.property("Nameservers"); -// qWarning() << " NisServers: " << ipIface.property("NisServers"); - } - - } - - } - item = new QTreeWidgetItem(devicesList); - devicesTreeWidget->insertTopLevelItem(0, item); - } - } - - -// netconfig(); - -} - -void NMView::readSettings() -{ - QDBusInterface settingsiface(NM_DBUS_SERVICE_SYSTEM_SETTINGS, - NM_DBUS_PATH_SETTINGS, - NM_DBUS_IFACE_SETTINGS, - dbc); - //NetworkManagerSettings interface - if (settingsiface.isValid()) { - QDBusReply > reply = settingsiface.call("ListConnections"); - if ( reply.isValid() ) { - QList list = reply.value(); - foreach(QDBusObjectPath path, list) { - qWarning() <<__FUNCTION__ << path.path(); - - } - } - } - - QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbc); - if (!iface.isValid()) { - qWarning() << "Could not find NetworkManager"; - return; - } - - // QStringList list = item->text().split(" -> "); - - QVariant prop = iface.property("ActiveConnections"); - QList connections = prop.value >(); - foreach(QDBusObjectPath path, connections) { - QDBusInterface conDetails(NM_DBUS_SERVICE, - path.path(), - NM_DBUS_INTERFACE_ACTIVE_CONNECTION, - dbc); - - if (conDetails.isValid()) { - QString desc = path.path(); - qWarning() << desc; - //if ( item->text(0) == conDetails.property("Connection").value().path() ) { - // QListWidgetItem* item = new QTreeWidgetItem( desc, - // cons); - // item->setData(Qt::UserRole, desc); - // activeItemActivated( item ); - //} - } - } -} - -void NMView::printConnectionDetails(const QString& service) -{ - Q_UNUSED(service); - -// -// qWarning() << __FUNCTION__ << service; -// -// QDBusConnection dbc = QDBusConnection::systemBus(); -// if (!dbc.isConnected()) { -// qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); -// return; -// } -// QDBusInterface allCons(service, -// NM_DBUS_PATH_SETTINGS, -// NM_DBUS_IFACE_SETTINGS, -// dbc); -// -// if (allCons.isValid()) { -// QDBusReply > reply = allCons.call("ListConnections"); -// -// if ( reply.isValid() ) { -// qWarning() << "Known connections:"; -// QList list = reply.value(); -// -// foreach(QDBusObjectPath path, list) { -// qWarning() << " " << path.path(); -// -// QDBusInterface sysIface(NM_DBUS_SERVICE_SYSTEM_SETTINGS, -// path.path(), -// NM_DBUS_IFACE_SETTINGS_CONNECTION, -// dbc); -// -// if (sysIface.isValid()) { -// QDBusMessage r = sysIface.call("GetSettings"); -// QDBusReply< QSettingsMap > rep = sysIface.call("GetSettings"); -// -// qWarning() << " GetSettings:" << r.arguments() << r.signature() << rep.isValid() << sysIface.lastError(); -// -// QMap< QString, QMap > map = rep.value(); -// QList list = map.keys(); -// -// foreach (QString key, list) { -// QMap innerMap = map[key]; -// qWarning() << " Key: " << key; -// QMap::const_iterator i = innerMap.constBegin(); -// -// while (i != innerMap.constEnd()) { -// QString k = i.key(); -// qWarning() << " Key: " << k << " Entry: " << i.value(); -// -// if (k == "addresses" && i.value().canConvert()) { -// QDBusArgument arg = i.value().value(); -// arg.beginArray(); -// -// while (!arg.atEnd()) { -// QDBusVariant addr; -// arg >> addr; -// uint ip = addr.variant().toUInt(); -// qWarning() << ip; -// qWarning() << " " << QHostAddress(htonl(ip)).toString(); -// } -// -// } -// i++; -// } -// } -// } -// } -// } -// } - qWarning() << ""; -} - -void NMView::getNetworkDevices() -{ - -} - -void NMView::connectionItemActivated( QTreeWidgetItem * item, int col ) -{ - Q_UNUSED(col); - - qWarning() <<__FUNCTION__<< item->text(0); - QDBusInterface iface(NM_DBUS_SERVICE, - NM_DBUS_PATH, - NM_DBUS_INTERFACE, - dbc); - if (!iface.isValid()) { - qWarning() << "Could not find NetworkManager"; - return; - } - QVariant prop = iface.property("ActiveConnections"); - QList connections = prop.value >(); - foreach(QDBusObjectPath path, connections) { - QDBusInterface conDetails(NM_DBUS_SERVICE, - path.path(), - NM_DBUS_INTERFACE_ACTIVE_CONNECTION, - dbc); - - if (conDetails.isValid()) { - QString desc = path.path(); - qWarning() << desc; - if ( item->text(0) == conDetails.property("Connection").value().path() ) { -// QListWidgetItem* item = new QTreeWidgetItem( desc, -// cons); -// item->setData(Qt::UserRole, desc); -// activeItemActivated( item ); - } - } - } -} - - - -void NMView::deviceItemActivated( QTreeWidgetItem * item , int section) -{ - Q_UNUSED(item); - Q_UNUSED(section); - - // qWarning() << item->text(section) << item->text(4); - //if(item->text(4) == "Wireless") findAccessPoints(item->text(0)); -} - - -void NMView::netconfig() -{ -// qWarning() << __FUNCTION__; - -// qDBusRegisterMetaType(); - QDBusConnection dbc = QDBusConnection::systemBus(); - if (!dbc.isConnected()) { - qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); - return; - } - - QDBusInterface iface(NM_DBUS_SERVICE, - NM_DBUS_PATH, - NM_DBUS_IFACE_SETTINGS_CONNECTION, - dbc); - if (!iface.isValid()) { - qWarning() << "Could not find NetworkManager Settings"; - return; - } else { - QDBusReply > reply = iface.call("ListConnections"); - QList list = reply.value(); -// qWarning() << reply.value(); - foreach(QDBusObjectPath path, list) { - qWarning() << " " << path.path(); - } - } -} - - -void NMView::findAccessPoints() -{ - accessPointsTreeWidget->clear(); - - QDBusInterface iface(NM_DBUS_SERVICE, - NM_DBUS_PATH, - NM_DBUS_INTERFACE, - dbc); - - QDBusReply > reply = iface.call("GetDevices"); - if ( reply.isValid() ) { - QList list = reply.value(); - foreach(QDBusObjectPath path, list) { - QDBusInterface devIface(NM_DBUS_SERVICE, - path.path(), - NM_DBUS_INTERFACE_DEVICE, - dbc); - if (devIface.isValid()) { - - if( devIface.property("DeviceType").toUInt() == DEVICE_TYPE_802_11_WIRELESS) { - -// qWarning() <<"deviface"<< devIface.path(); - QDBusInterface wififace(NM_DBUS_SERVICE, - devIface.path(), - NM_DBUS_INTERFACE_DEVICE_WIRELESS, - dbc); - if (!wififace.isValid()) { - qWarning() << "Could not find NetworkManager wireless interface"; - return; - } - -///////////////////////// -// if(dbc.connect(NM_DBUS_SERVICE, -// path.path(), -// NM_DBUS_INTERFACE_DEVICE_WIRELESS, -// "PropertiesChanged", -// this,SLOT(aPPropertiesChanged( QMap))) ) { -// qWarning() << "PropertiesChanged connect"; -// } else { -// qWarning() << "NOT connect"; - -// } -///////////////////////// - qWarning() <<"wififace"<< wififace.path(); - QDBusReply > reply2 = wififace.call("GetAccessPoints"); - if ( reply2.isValid() ) { - QTreeWidgetItem *item; - QList list2 = reply2.value(); - foreach(QDBusObjectPath path2, list2) { - QDBusInterface accessPointIface(NM_DBUS_SERVICE, - path2.path(), - NM_DBUS_INTERFACE_ACCESS_POINT, - dbc); - if (accessPointIface.isValid()) { -//// qWarning() <<"path2" << path2.path(); - -// if(dbc.connect(NM_DBUS_SERVICE, //signal strength -// path2.path(), -// NM_DBUS_INTERFACE_ACCESS_POINT, -// "PropertiesChanged", -// this,SLOT(aPPropertiesChanged( QMap))) ) { -// qWarning() << "PropertiesChanged connect"; -// } else { -// qWarning() << "NOT connect"; -// -// } - - QStringList accessPoints; - accessPoints << accessPointIface.property("Ssid").toString(); - accessPoints << QString::number(accessPointIface.property("Strength").toInt()); - accessPoints << securityCapabilitiesToString(accessPointIface.property("WpaFlags" ).toInt()); - accessPoints << securityCapabilitiesToString(accessPointIface.property("RsnFlags" ).toInt()); - accessPoints << accessPointIface.property("Frequency" ).toString(); - accessPoints << accessPointIface.property("HwAddress" ).toString(); - accessPoints << deviceModeToString(accessPointIface.property("Mode" ).toInt()); - accessPoints << accessPointIface.property("MaxBitrate" ).toString(); - //HwAddress - // if(accessPointIface.property("Flags" ).toInt() == NM_802_11_AP_FLAGS_PRIVACY ) { - // qWarning() << "Secure"; - // } - item = new QTreeWidgetItem(accessPoints); - accessPointsTreeWidget->insertTopLevelItem(0, item); - } - } - } - } - } - } - } -} - -QString NMView::deviceStateToString(int state) -{ - QString ret; - switch(state) { - case NM_DEVICE_STATE_UNKNOWN: - ret = "Unknown"; - break; - case NM_DEVICE_STATE_UNMANAGED: - ret = "Unmanaged"; - break; - case NM_DEVICE_STATE_UNAVAILABLE: - ret = "Unavailable"; - break; - case NM_DEVICE_STATE_DISCONNECTED: - ret = "Disconnected"; - break; - case NM_DEVICE_STATE_PREPARE: - ret = "Preparing to connect"; - break; - case NM_DEVICE_STATE_CONFIG: - ret = "Being configured"; - break; - case NM_DEVICE_STATE_NEED_AUTH: - ret = "Awaiting secrets"; - break; - case NM_DEVICE_STATE_IP_CONFIG: - ret = "IP requested"; - break; - case NM_DEVICE_STATE_ACTIVATED: - ret = "Activated"; - break; - case NM_DEVICE_STATE_FAILED: - ret = "FAILED"; - break; - }; - return ret; -} - -QString NMView::deviceTypeToString(int device) -{ - QString ret; - switch(device) { - case DEVICE_TYPE_UNKNOWN: - ret = "Unknown"; - break; - case DEVICE_TYPE_802_3_ETHERNET: - ret = "Ethernet"; - break; - case DEVICE_TYPE_802_11_WIRELESS: - ret = "Wireless"; - break; - case DEVICE_TYPE_GSM: - ret = "GSM"; - break; - case DEVICE_TYPE_CDMA: - ret = "CDMA"; - break; - }; - return ret; -} - -QString NMView::securityCapabilitiesToString(int caps) -{ - int check = caps; -// qWarning() << __FUNCTION__<< caps; - QString ret; - if( check == 0 ) - ret += "None."; - if( (check & NM_802_11_AP_SEC_PAIR_WEP40)) - ret += " 40-bit WEP encryption. "; - if( (check & NM_802_11_AP_SEC_PAIR_WEP104) ) - ret += " 104-bit WEP encryption. "; - if( (check & NM_802_11_AP_SEC_PAIR_TKIP) ) - ret += " TKIP encryption. "; - if( (check & NM_802_11_AP_SEC_PAIR_CCMP) ) - ret += " CCMP encryption. "; - if( (check & NM_802_11_AP_SEC_GROUP_WEP40)) - ret += " 40-bit WEP cipher. "; - if( (check & NM_802_11_AP_SEC_GROUP_WEP104)) - ret += " 104-bit WEP cipher. "; - if( (check & NM_802_11_AP_SEC_GROUP_TKIP) ) - ret += " TKIP cipher. "; - if( (check & NM_802_11_AP_SEC_GROUP_CCMP) ) - ret += " CCMP cipher. "; - if( (check & NM_802_11_AP_SEC_KEY_MGMT_PSK)) - ret += " PSK key management. "; - if( (check & NM_802_11_AP_SEC_KEY_MGMT_802_1X) ) - ret += " 802.1x key management. "; - return ret; -} - -QString NMView::deviceModeToString(int mode) -{ - QString ret; - switch (mode) { - case NM_802_11_MODE_UNKNOWN: - ret = "Unknown"; - break; - case NM_802_11_MODE_ADHOC: - ret = " (Adhoc)."; - break; - case NM_802_11_MODE_INFRA: - ret = " (Infrastructure)"; - }; - return ret; -} - -void NMView::netManagerState(quint32 state) -{ - qWarning() << __FUNCTION__ << state;// << old << reason; - switch(state) { - case NM_STATE_UNKNOWN: - qWarning() << "The NetworkManager daemon is in an unknown state. "; - break; - case NM_STATE_ASLEEP: - qWarning() << "The NetworkManager daemon is asleep and all interfaces managed by it are inactive. "; - break; - case NM_STATE_CONNECTING: - qWarning() << "The NetworkManager daemon is connecting a device. FIXME: What does this mean when one device is active and another is connecting? "; - break; - case NM_STATE_CONNECTED: - qWarning() <<"The NetworkManager daemon is connected. "; - break; - case NM_STATE_DISCONNECTED: - qWarning() << "The NetworkManager daemon is disconnected."; - break; - - }; -} - -void NMView::deviceStateChanged(quint32 state) -{ - qWarning() << __FUNCTION__ << state; - switch(state) { - case NM_DEVICE_STATE_UNKNOWN : - qWarning() <<"The device is in an unknown state. "; - break; - case NM_DEVICE_STATE_UNMANAGED: - qWarning() <<"The device is not managed by NetworkManager."; - break; - case NM_DEVICE_STATE_UNAVAILABLE: - qWarning() <<"The device cannot be used (carrier off, rfkill, etc)."; - break; - case NM_DEVICE_STATE_DISCONNECTED: - qWarning() <<"The device is not connected."; - break; - case NM_DEVICE_STATE_PREPARE: - qWarning() <<"The device is preparing to connect."; - break; - case NM_DEVICE_STATE_CONFIG: - qWarning() <<"The device is being configured."; - break; - case NM_DEVICE_STATE_NEED_AUTH: - qWarning() <<"The device is awaiting secrets necessary to continue connection."; - break; - case NM_DEVICE_STATE_IP_CONFIG: - qWarning() <<"The IP settings of the device are being requested and configured."; - break; - case NM_DEVICE_STATE_ACTIVATED: - qWarning() <<"The device is active."; - break; - case NM_DEVICE_STATE_FAILED: - qWarning() <<"The device is in a failure state following an attempt to activate it."; - break; - }; -} - -void NMView::updateCompleted() -{ - qWarning() << __FUNCTION__; -} - -void NMView::newConfigurationActivated() -{ - qWarning() << __FUNCTION__; - getActiveConnections(); -} - -void NMView::stateChanged(QNetworkSession::State state) -{ - // QString stateStringstr; - switch (state) { - case QNetworkSession::Invalid: - stateString = "Invalid session"; - break; - case QNetworkSession::NotAvailable: - stateString = "Session is defined but not yet discovered"; - break; - case QNetworkSession::Connecting: - stateString = "Session is being established"; - break; - case QNetworkSession::Connected: - stateString = "Session is active and can be used for socket operations"; - cons->currentItem()->setText(1, "Active"); - break; - case QNetworkSession::Closing: - stateString = "Session is being shutdown"; - break; - case QNetworkSession::Disconnected: - qWarning() << __FUNCTION__; - manager->updateConfigurations(); - stateString = "Session disconnected"; - cons->currentItem()->setText(1,"Discovered") ; - break; - case QNetworkSession::Roaming: - stateString = "session is roaming from one AP to another"; - break; - }; - qWarning() << __FUNCTION__ << state << stateString; -} - -QString NMView::stateToString(int state) -{ - switch (state) { - case QNetworkConfiguration::Undefined: - return "Undefined"; - break; - case QNetworkConfiguration::Defined: - return "Defined"; - break; - case QNetworkConfiguration::Discovered: - return "Discovered"; - break; - case QNetworkConfiguration::Active: - return "Active"; - break; - }; - return ""; -} - -void NMView::configurationAdded(const QNetworkConfiguration &config) -{ - qWarning() << __FUNCTION__<< config.name() << config.identifier(); -} - -QString NMView::typeToString(int type) -{ - switch(type) { - case QNetworkConfiguration::InternetAccessPoint: - return "Internet AccessPoint"; - break; - case QNetworkConfiguration::ServiceNetwork: - return "Service Network"; - break; - }; - return QString(); -} - -void NMView::aPPropertiesChanged( QMap map) -{ - //QMap::const_iterator iterator = d->values.find(type + QLatin1String("Path")) - QMapIterator i(map); - while (i.hasNext()) { - i.next(); - if( i.key() == "State") { - qWarning() << __FUNCTION__ << i.key() << ": " << i.value().toUInt(); -// deviceStateChanged(i.value().toUInt()); - } else if( i.key() == "ActiveAccessPoint") { - qWarning() << __FUNCTION__ << i.key() << ": " << i.value().value().path(); - } else if( i.key() == "Strength") - qWarning() << __FUNCTION__ << i.key() << ": " << i.value().toUInt(); - else - qWarning() << __FUNCTION__ << i.key() << ": " << i.value(); - } -} - -void NMView::networkSessionError(QNetworkSession::SessionError error) -{ - QString errorStr; - switch(error) { - case QNetworkSession::RoamingError: - errorStr = "Roaming error"; - break; - case QNetworkSession::SessionAbortedError: - errorStr = "Session aborted by user or system"; - break; - default: - case QNetworkSession::UnknownSessionError: - errorStr = "Unidentified Error"; - break; - }; - - QMessageBox::warning(this, tr("NMView"), errorStr, QMessageBox::Ok); -} diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/networkmanager/nmview.h --- a/qtmobility/tests/networkmanager/nmview.h Wed Jun 09 10:36:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $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 -#include -#include -#include -#include - -#include "ui_dialog.h" - -QTM_USE_NAMESPACE - -QT_BEGIN_NAMESPACE -class QListWidget; -class QTreeWidget; -class QTreeWidgetItem; -QT_END_NAMESPACE - -class NMView : public QDialog, private Ui::Dialog -{ - Q_OBJECT -public: - NMView(QDialog* parent = 0); - virtual ~NMView(); - -private: - void init(); - QString stateString; - - QDBusConnection dbc; - void printConnectionDetails(const QString&); - - QString deviceStateToString(int state); - QString deviceTypeToString(int device); - QString securityCapabilitiesToString(int caps); - QString deviceModeToString(int mode); -//QDBusInterface getInterface(); - QNetworkConfigurationManager *manager; - QNetworkSession *sess; - QString stateToString(int state); - QString typeToString(int type); - -private slots: - void update(); - void deactivate(); - void activate(); - void getActiveConnections(); - void updateConnections(); - void getDevices(); - // void readConnectionManagerDetails(); - void getNetworkDevices(); - void connectionItemActivated( QTreeWidgetItem *, int); -// void activeItemActivated( QListWidgetItem *); - void deviceItemActivated( QTreeWidgetItem *, int); - void netconfig(); - void findAccessPoints(); - - void netManagerState(quint32); - void readSettings(); - void updateCompleted(); - void newConfigurationActivated(); - - void stateChanged(QNetworkSession::State); - void deviceStateChanged(quint32 state); - - void configurationAdded(const QNetworkConfiguration &config); - void aPPropertiesChanged( QMap map); - void networkSessionError(QNetworkSession::SessionError); - -}; diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/networkmanager/startdlg.cpp --- a/qtmobility/tests/networkmanager/startdlg.cpp Wed Jun 09 10:36:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $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 "startdlg.h" -#include - - -StartDialog::StartDialog(QWidget * parent) - :QDialog(parent) -{ - QVBoxLayout *layout = new QVBoxLayout(this); - box = new QComboBox(); - layout->addWidget(box); - - QHBoxLayout* hbox = new QHBoxLayout(); - QPushButton* start = new QPushButton("Start"); - connect(start, SIGNAL(clicked()), this, SLOT(accept())); - QPushButton* cancel = new QPushButton("Cancel"); - connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); - - - hbox->addWidget(start); - hbox->addWidget(cancel); - - layout->addLayout(hbox); - - QDBusConnection dbc = QDBusConnection::systemBus(); - if (!dbc.isConnected()) { - qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); - return; - } - QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbc); - if (!iface.isValid()) { - qWarning() << "Could not find NetworkManager"; - return; - } - QDBusReply > reply = iface.call("GetDevices"); - if ( reply.isValid() ) { - QList list = reply.value(); - foreach(QDBusObjectPath path, list) { - QDBusInterface devIface(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_DEVICE, dbc); - if ( devIface.isValid() ) { - box->addItem(devIface.property("Interface").toString(), QVariant(path.path())); - } - } - } -} - -QString StartDialog::device() const -{ - return dev; -} - -void StartDialog::accept() -{ - dev = box->itemData(box->currentIndex(), Qt::UserRole).toString(); - QDialog::accept(); -} diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/networkmanager/startdlg.h --- a/qtmobility/tests/networkmanager/startdlg.h Wed Jun 09 10:36:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $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 -#include -#include - -class StartDialog : public QDialog -{ - Q_OBJECT -public: - StartDialog(QWidget* parent = 0); - - QString device() const; - -public slots: - void accept(); -private: - QString dev; - QComboBox* box; -}; diff -r 4ea83c148e84 -r 4203353e74ea qtmobility/tests/tests.pro --- a/qtmobility/tests/tests.pro Wed Jun 09 10:36:00 2010 +0300 +++ b/qtmobility/tests/tests.pro Mon Jun 21 16:36:26 2010 +0300 @@ -4,9 +4,6 @@ SUBDIRS += auto contains(mobility_modules,bearer) { - contains(QT_CONFIG,dbus) { - !symbian:!mac:!maemo6:!maemo5:unix:SUBDIRS += networkmanager - } symbian:SUBDIRS += bearerex }