# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1273586324 -10800 # Node ID eb34711bcc75b00e317860891a29f62f1821c36a # Parent 87be51aa5b5b6716a08397a5f1c334f97f7cf95c Revision: 201017 Kit: 201019 diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/common.pri --- a/qtmobility/common.pri Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/common.pri Tue May 11 16:58:44 2010 +0300 @@ -13,6 +13,10 @@ 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" diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/config.pri --- a/qtmobility/config.pri Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/config.pri Tue May 11 16:58:44 2010 +0300 @@ -1,6 +1,7 @@ build_unit_tests = no build_examples = no build_docs = no +build_tools = no qmf_enabled = no isEmpty($$QT_MOBILITY_INCLUDE):QT_MOBILITY_INCLUDE=$$QT_MOBILITY_PREFIX/include isEmpty($$QT_MOBILITY_LIB):QT_MOBILITY_LIB=$$QT_MOBILITY_PREFIX/lib @@ -12,3 +13,5 @@ snap_enabled = yes occ_enabled = yes symbiancntsim_enabled = yes +MOBILITY_SD_MCL_BUILD = yes +sensors_symbian_enabled = yes \ No newline at end of file diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/configure --- a/qtmobility/configure Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/configure Tue May 11 16:58:44 2010 +0300 @@ -42,7 +42,7 @@ # return status of 1 if absolute path as first argument # also prints the return status -function isAbsPath() { +isAbsPath() { slash=$(echo $1 | cut -c 1) if [ "$slash" != "/" ]; then echo 0 @@ -57,7 +57,7 @@ # This is required because when building in scratchbox for # maemo we do not want to follow symbolic links that are # introduced by scratchbox -function absPath() { +absPath() { if [ "$2" = "maemo5" -o "$2" = "maemo6" ]; then if [ `isAbsPath $1` = '1' ]; then @@ -89,6 +89,7 @@ BUILD_UNITTESTS= BUILD_EXAMPLES= BUILD_DOCS=yes +BUILD_TOOLS=yes RELEASEMODE= BUILD_SILENT= LINUX_TARGET= @@ -103,7 +104,8 @@ { echo "Usage: configure [-prefix ] [headerdir ] [libdir ]" echo " [-bindir ] [-tests] [-examples] [-no-docs]" - echo " [-debug] [-release] [-silent] [-modules ]" + echo " [-no-tools] [-debug] [-release] [-silent]" + echo " [-modules ]" echo echo "Options:" echo @@ -123,6 +125,7 @@ echo " and should not be used for release builds." echo "-examples ......... Build example applications" echo "-no-docs .......... Do not build documentation (build by default)" + echo "-no-tools ......... Do not build tools (build by default)" echo "-modules ... Restrict list of modules to build (default all supported)" echo " Choose from: bearer contacts location publishsubscribe" echo " messaging multimedia systeminfo serviceframework versit" @@ -175,6 +178,9 @@ -no-docs) BUILD_DOCS= ;; + -no-tools) + BUILD_TOOLS= + ;; -debug) RELEASEMODE=debug ;; @@ -352,6 +358,12 @@ echo "build_docs = yes" >> "$CONFIG_IN" fi +if [ -z "$BUILD_TOOLS" ]; then + echo "build_tools = no" >> "$CONFIG_IN" +else + echo "build_tools = yes" >> "$CONFIG_IN" +fi + echo "Configuring Qt Mobility" echo diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/configure.bat --- a/qtmobility/configure.bat Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/configure.bat Tue May 11 16:58:44 2010 +0300 @@ -56,6 +56,7 @@ set BUILD_UNITTESTS=no set BUILD_EXAMPLES=no set BUILD_DOCS=yes +set BUILD_TOOLS=yes set MOBILITY_MODULES=bearer location contacts multimedia publishsubscribe versit messaging systeminfo serviceframework sensors set MOBILITY_MODULES_UNPARSED= set VC_TEMPLATE_OPTION= @@ -84,6 +85,7 @@ if "%1" == "-qt" goto qtTag if "%1" == "-vc" goto vcTag if "%1" == "-no-docs" goto nodocsTag +if "%1" == "-no-tools" goto noToolsTag if "%1" == "-modules" goto modulesTag if "%1" == "/?" goto usage if "%1" == "-h" goto usage @@ -211,6 +213,11 @@ shift goto cmdline_parsing +:noToolsTag +set BUILD_TOOLS=no +shift +goto cmdline_parsing + :modulesTag shift :: %1 can have leading/trailing quotes, so we can't use if "%1" == "" @@ -316,6 +323,9 @@ echo build_docs = %BUILD_DOCS% >> %PROJECT_CONFIG% set BUILD_DOCS= +echo build_tools = %BUILD_TOOLS% >> %PROJECT_CONFIG% +set BUILD_TOOLS= + echo qmf_enabled = no >> %PROJECT_CONFIG% echo isEmpty($$QT_MOBILITY_INCLUDE):QT_MOBILITY_INCLUDE=$$QT_MOBILITY_PREFIX/include >> %PROJECT_CONFIG% @@ -451,6 +461,8 @@ 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 echo End of compile tests echo. echo. @@ -485,7 +497,6 @@ perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\messaging ) else if %FIRST% == multimedia ( perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\multimedia - perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\multimedia\experimental ) else if %FIRST% == publishsubscribe ( perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\publishsubscribe ) else if %FIRST% == systeminfo ( diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/data/qtmobility.sisx Binary file qtmobility/data/qtmobility.sisx has changed diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearercloud/bearercloud.cpp --- a/qtmobility/examples/bearercloud/bearercloud.cpp Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/examples/bearercloud/bearercloud.cpp Tue May 11 16:58:44 2010 +0300 @@ -6,35 +6,34 @@ ** ** 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. +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: ** -** 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. +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. ** -** -** -** -** -** -** -** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearercloud/bearercloud.h --- a/qtmobility/examples/bearercloud/bearercloud.h Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/examples/bearercloud/bearercloud.h Tue May 11 16:58:44 2010 +0300 @@ -6,35 +6,34 @@ ** ** 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. +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: ** -** 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. +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. ** -** -** -** -** -** -** -** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearercloud/cloud.cpp --- a/qtmobility/examples/bearercloud/cloud.cpp Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/examples/bearercloud/cloud.cpp Tue May 11 16:58:44 2010 +0300 @@ -6,35 +6,34 @@ ** ** 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. +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: ** -** 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. +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. ** -** -** -** -** -** -** -** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearercloud/cloud.h --- a/qtmobility/examples/bearercloud/cloud.h Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/examples/bearercloud/cloud.h Tue May 11 16:58:44 2010 +0300 @@ -6,35 +6,34 @@ ** ** 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. +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: ** -** 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. +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. ** -** -** -** -** -** -** -** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearercloud/main.cpp --- a/qtmobility/examples/bearercloud/main.cpp Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/examples/bearercloud/main.cpp Tue May 11 16:58:44 2010 +0300 @@ -6,35 +6,34 @@ ** ** 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. +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: ** -** 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. +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. ** -** -** -** -** -** -** -** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearermonitor/bearermonitor.cpp --- a/qtmobility/examples/bearermonitor/bearermonitor.cpp Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/examples/bearermonitor/bearermonitor.cpp Tue May 11 16:58:44 2010 +0300 @@ -6,35 +6,34 @@ ** ** 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. +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: ** -** 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. +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. ** -** -** -** -** -** -** -** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -43,7 +42,7 @@ #include "sessionwidget.h" #include - +#include #ifdef Q_OS_WIN #include #undef interface @@ -57,15 +56,20 @@ : QWidget(parent) { setupUi(this); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + newSessionButton->hide(); + deleteSessionButton->hide(); +#else delete tabWidget->currentWidget(); sessionGroup->hide(); -#if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) +#endif +#if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) setWindowState(Qt::WindowMaximized); #endif updateConfigurations(); - +#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) onlineStateChanged(!manager.allConfigurations(QNetworkConfiguration::Active).isEmpty()); - +#endif QNetworkConfiguration defaultConfiguration = manager.defaultConfiguration(); for (int i = 0; i < treeWidget->topLevelItemCount(); ++i) { QTreeWidgetItem *item = treeWidget->topLevelItem(i); @@ -101,9 +105,10 @@ connect(newSessionButton, SIGNAL(clicked()), this, SLOT(createNewSession())); +#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) connect(deleteSessionButton, SIGNAL(clicked()), this, SLOT(deleteSession())); - +#endif connect(scanButton, SIGNAL(clicked()), this, SLOT(performScan())); } @@ -234,15 +239,22 @@ void BearerMonitor::onlineStateChanged(bool isOnline) { if (isOnline) +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + QMessageBox::information(this, "Connection state changed", "Online", QMessageBox::Close); + else + QMessageBox::information(this, "Connection state changed", "Offline", QMessageBox::Close); +#else onlineState->setText(tr("Online")); else onlineState->setText(tr("Offline")); +#endif } #ifdef Q_OS_WIN void BearerMonitor::registerNetwork() { QTreeWidgetItem *item = treeWidget->currentItem(); + if (!item) return; QNetworkConfiguration configuration = manager.configurationFromIdentifier(item->data(0, Qt::UserRole).toString()); @@ -264,6 +276,7 @@ void BearerMonitor::unregisterNetwork() { QTreeWidgetItem *item = treeWidget->currentItem(); + if (!item) return; QNetworkConfiguration configuration = manager.configurationFromIdentifier(item->data(0, Qt::UserRole).toString()); @@ -362,7 +375,9 @@ tabWidget->addTab(session, conf.name()); +#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) sessionGroup->show(); +#endif sessionWidgets.append(session); } @@ -370,10 +385,12 @@ void BearerMonitor::createNewSession() { QTreeWidgetItem *item = treeWidget->currentItem(); + if (!item) return; createSessionFor(item); } +#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) void BearerMonitor::deleteSession() { SessionWidget *session = qobject_cast(tabWidget->currentWidget()); @@ -386,6 +403,7 @@ sessionGroup->hide(); } } +#endif void BearerMonitor::performScan() { diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearermonitor/bearermonitor.h --- a/qtmobility/examples/bearermonitor/bearermonitor.h Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/examples/bearermonitor/bearermonitor.h Tue May 11 16:58:44 2010 +0300 @@ -6,35 +6,34 @@ ** ** 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. +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: ** -** 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. +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. ** -** -** -** -** -** -** -** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -46,6 +45,8 @@ #include #if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) #include "ui_bearermonitor_240_320.h" +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#include "ui_bearermonitor_maemo.h" #else #include "ui_bearermonitor_640_480.h" #endif @@ -80,8 +81,9 @@ void createSessionFor(QTreeWidgetItem *item); void createNewSession(); +#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6) void deleteSession(); - +#endif void performScan(); private: diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearermonitor/bearermonitor.pro --- a/qtmobility/examples/bearermonitor/bearermonitor.pro Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/examples/bearermonitor/bearermonitor.pro Tue May 11 16:58:44 2010 +0300 @@ -1,24 +1,27 @@ +TARGET = bearermonitor +QT = core gui network + +INCLUDEPATH += ../../src/bearer +include(../examples.pri) + +CONFIG += mobility +MOBILITY = bearer + HEADERS = sessionwidget.h \ bearermonitor.h SOURCES = main.cpp \ bearermonitor.cpp \ sessionwidget.cpp - -FORMS = bearermonitor_240_320.ui \ - bearermonitor_640_480.ui \ - sessionwidget.ui -TARGET = bearermonitor - -QT = core gui network - -INCLUDEPATH += ../../src/bearer - -include(../examples.pri) - -CONFIG += mobility -MOBILITY = bearer +maemo5|maemo6 { + FORMS = bearermonitor_maemo.ui \ + sessionwidget_maemo.ui +} else { + FORMS = bearermonitor_240_320.ui \ + bearermonitor_640_480.ui \ + sessionwidget.ui +} win32:!wince*:LIBS += -lWs2_32 wince*:LIBS += -lWs2 diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearermonitor/bearermonitor_maemo.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobility/examples/bearermonitor/bearermonitor_maemo.ui Tue May 11 16:58:44 2010 +0300 @@ -0,0 +1,310 @@ + + + BearerMonitor + + + + 0 + 0 + 612 + 495 + + + + Form + + + + + + + 0 + 0 + + + + 0 + + + false + + + + Configurations + + + + + + + 0 + 0 + + + + false + + + + 1 + + + + + + + + + + + + Name: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + State: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Type: + + + + + + + + 0 + 0 + + + + Invalid + + + + + + + + + + + Purpose: + + + + + + + + 0 + 0 + + + + Unknown + + + + + + + + + + + Identifier: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Roaming: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Children: + + + + + + + + 0 + 0 + + + + + + + + + + + + + Network Location Awareness + + + + + + Register + + + + + + + Unregister + + + + + + + + + + New Session + + + + + + + Delete Session + + + + + + + Scan + + + + + + + 0 + + + 23280 + + + false + + + false + + + %p% + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearermonitor/main.cpp --- a/qtmobility/examples/bearermonitor/main.cpp Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/examples/bearermonitor/main.cpp Tue May 11 16:58:44 2010 +0300 @@ -6,35 +6,34 @@ ** ** 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. +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: ** -** 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. +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. ** -** -** -** -** -** -** -** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearermonitor/sessionwidget.cpp --- a/qtmobility/examples/bearermonitor/sessionwidget.cpp Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/examples/bearermonitor/sessionwidget.cpp Tue May 11 16:58:44 2010 +0300 @@ -1,40 +1,39 @@ /**************************************************************************** ** -** 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) ** ** 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. +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: ** -** 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. +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. ** -** -** -** -** -** -** -** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -52,7 +51,7 @@ connect(session, SIGNAL(stateChanged(QNetworkSession::State)), this, SLOT(updateSession())); connect(session, SIGNAL(error(QNetworkSession::SessionError)), - this, SLOT(updateSession())); + this, SLOT(updateSessionError(QNetworkSession::SessionError))); updateSession(); @@ -68,6 +67,10 @@ this, SLOT(closeSession())); connect(stopSessionButton, SIGNAL(clicked()), this, SLOT(stopSession())); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + connect(deleteSessionButton, SIGNAL(clicked()), + this, SLOT(deleteSession())); +#endif } SessionWidget::~SessionWidget() @@ -75,10 +78,16 @@ delete session; } +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +void SessionWidget::deleteSession() +{ + delete this; +} +#endif + void SessionWidget::updateSession() { updateSessionState(session->state()); - updateSessionError(session->error()); if (session->configuration().type() == QNetworkConfiguration::InternetAccessPoint) bearer->setText(session->configuration().bearerName()); @@ -94,12 +103,14 @@ void SessionWidget::openSession() { + clearError(); session->open(); updateSession(); } void SessionWidget::openSyncSession() { + clearError(); session->open(); session->waitForOpened(); updateSession(); @@ -107,12 +118,14 @@ void SessionWidget::closeSession() { + clearError(); session->close(); updateSession(); } void SessionWidget::stopSession() { + clearError(); session->stop(); updateSession(); } @@ -161,3 +174,8 @@ errorString->setText(session->errorString()); } +void SessionWidget::clearError() +{ + lastError->clear(); + errorString->clear(); +} diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearermonitor/sessionwidget.h --- a/qtmobility/examples/bearermonitor/sessionwidget.h Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/examples/bearermonitor/sessionwidget.h Tue May 11 16:58:44 2010 +0300 @@ -1,40 +1,39 @@ /**************************************************************************** ** -** 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) ** ** 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. +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: ** -** 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. +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. ** -** -** -** -** -** -** -** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -42,8 +41,11 @@ #ifndef SESSIONWIDGET_H #define SESSIONWIDGET_H +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#include "ui_sessionwidget_maemo.h" +#else #include "ui_sessionwidget.h" - +#endif #include QTM_USE_NAMESPACE @@ -58,7 +60,7 @@ private: void updateSessionState(QNetworkSession::State state); - void updateSessionError(QNetworkSession::SessionError error); + void clearError(); private Q_SLOTS: void openSession(); @@ -66,6 +68,11 @@ void closeSession(); void stopSession(); void updateSession(); + void updateSessionError(QNetworkSession::SessionError error); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + void deleteSession(); +#endif + private: QNetworkSession *session; diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearermonitor/sessionwidget.ui --- a/qtmobility/examples/bearermonitor/sessionwidget.ui Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/examples/bearermonitor/sessionwidget.ui Tue May 11 16:58:44 2010 +0300 @@ -195,7 +195,7 @@ - Error String + Error String: diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/examples/bearermonitor/sessionwidget_maemo.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobility/examples/bearermonitor/sessionwidget_maemo.ui Tue May 11 16:58:44 2010 +0300 @@ -0,0 +1,262 @@ + + + SessionWidget + + + + 0 + 0 + 497 + 615 + + + + Form + + + + + + + + + + Session ID: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + 0 + 0 + + + + Session State: + + + + + + + + 0 + 0 + + + + Invalid + + + + + + + + + + + Configuration: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Bearer: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Interface Name: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Interface GUID: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Last Error: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Error String + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + + Open + + + + + + + Close + + + + + + + Blocking Open + + + + + + + Stop + + + + + + + Delete + + + + + + + + + + diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/features/mobility.prf --- a/qtmobility/features/mobility.prf Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/features/mobility.prf Tue May 11 16:58:44 2010 +0300 @@ -13,6 +13,7 @@ } mac: LIBS += -F$${MOBILITY_LIB} LIBS+= -L$${MOBILITY_LIB} +QMAKE_RPATHDIR+=$${MOBILITY_LIB} contains(MOBILITY, bearer) { DEFINES += QT_MOBILITY_BEARER diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/features/mobility.prf.template --- a/qtmobility/features/mobility.prf.template Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/features/mobility.prf.template Tue May 11 16:58:44 2010 +0300 @@ -13,6 +13,7 @@ } mac: LIBS += -F$${MOBILITY_LIB} LIBS+= -L$${MOBILITY_LIB} +QMAKE_RPATHDIR+=$${MOBILITY_LIB} contains(MOBILITY, bearer) { DEFINES += QT_MOBILITY_BEARER diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/qtmobility.pro --- a/qtmobility/qtmobility.pro Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/qtmobility.pro Tue May 11 16:58:44 2010 +0300 @@ -19,6 +19,27 @@ #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) { @@ -41,28 +62,34 @@ } -#generate prf file for Qt integration -#PRF_OUTPUT=$${QT_MOBILITY_BUILD_TREE}/features/mobility.prf +# MCL builds for Symbian do not run configure and require some manual setup steps. +# This test permits SD builds to skip installation of mobility.prf from within qmake. +# It is installed in a separate step. MCL builds for SD must set the +# MOBILITY_SD_MCL_BUILD flag to yes. +!contains(MOBILITY_SD_MCL_BUILD, yes) { + #generate prf file for Qt integration + PRF_OUTPUT=$${QT_MOBILITY_BUILD_TREE}/features/mobility.prf -#system(echo MOBILITY_PREFIX=$${QT_MOBILITY_PREFIX} > $$PRF_OUTPUT) -#system(echo MOBILITY_INCLUDE=$${QT_MOBILITY_INCLUDE} >> $$PRF_OUTPUT) -#system(echo MOBILITY_LIB=$${QT_MOBILITY_LIB} >> $$PRF_OUTPUT) - -#unix:!symbian:system(cat $${QT_MOBILITY_SOURCE_TREE}/features/mobility.prf.template >> $$PRF_OUTPUT) -#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) + system(echo MOBILITY_PREFIX=$${QT_MOBILITY_PREFIX} > $$PRF_OUTPUT) + system(echo MOBILITY_INCLUDE=$${QT_MOBILITY_INCLUDE} >> $$PRF_OUTPUT) + system(echo MOBILITY_LIB=$${QT_MOBILITY_LIB} >> $$PRF_OUTPUT) -#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") -#} + unix:!symbian:system(cat $${QT_MOBILITY_SOURCE_TREE}/features/mobility.prf.template >> $$PRF_OUTPUT) + 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) -# install feature file -#feature.path = $$[QT_INSTALL_DATA]/mkspecs/features -#feature.files = $$QT_MOBILITY_BUILD_TREE/features/mobility.prf -#INSTALLS += feature + #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") + } + + # install feature file + feature.path = $$[QT_INSTALL_DATA]/mkspecs/features + feature.files = $$QT_MOBILITY_BUILD_TREE/features/mobility.prf + INSTALLS += feature +} TEMPLATE = subdirs CONFIG+=ordered diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/src/3rdparty/icd-network-wlan/libicd-network-wlan-dev.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobility/src/3rdparty/icd-network-wlan/libicd-network-wlan-dev.h Tue May 11 16:58:44 2010 +0300 @@ -0,0 +1,140 @@ +#ifndef WLAN_DEV_H +#define WLAN_DEV_H + +/** + * Copyright (C) 2007,2008 Nokia Corporation. All rights reserved. + * + * @author jukka.rissanen@nokia.com + * + * @file libicd-network-wlan-dev.h + */ + +#include +#include +#include +#include + + +/* Difference between network attributes value and wlan capabilities: + * + * WLAN + * Network capability Combined + * LSB attribute (from wlancond.h) + * ---- --------- ---------- -------- + * 0 mode mode + * 1 mode mode + * 2 mode mode + * 3 autoconnect attempt method + * 4 encrypt method method + * 5 encrypt method method + * 6 encrypt method method + * 7 encrypt method WPA2 + * 8 WPA2 algorithm + * 9 WPS algorithm + * 10 WPS PIN algorithm + * 11 WPS push button algorithm + * 12 WPS configured WPS + * 13 WPS PIN + * 14 WPS push button + * 15 WPS configured + * 16 rate + * 17 rate + * 18 rate + * 19 rate + * 20 rate + * 21 rate + * 22 rate + * 23 iap name rate iap name + * 24 silent rate silent + * 25 rate + * 26 + * 27 + * 28 security algorithm + * 29 always online security algorithm always online + * 30 security algorithm + * 31 security algorithm + * MSB + * + * + * Same view from different angle. + * + * MSB LSB (of 32 bits) + * 10987654321098765432109876543210 + * + * WWWWaaaaWmmmmmmm Combined format + * PPPPllllPeeeeooo + * SSSSggggAttttddd + * cbp oooo2hhhheee + * fti oooo + * gnn dddd + * + * aaaa Wmmmm mmm Capability format + * llll Peeee ooo + * gggg Atttt ddd + * oooo 2hhhh eee + * oooo + * dddd + * + * + * Note that WPS bits in nwattrs are moved towards MSB because algorithm + * was there first and we do not want to break binary compatibility. + */ + +/* capability bits inside network attributes var */ +#define NWATTR_WPS_MASK 0x0000F000 +#define NWATTR_ALGORITHM_MASK 0x00000F00 +#define NWATTR_WPA2_MASK 0x00000080 +#define NWATTR_METHOD_MASK 0x00000078 +#define NWATTR_MODE_MASK 0x00000007 + +#define CAP_LOCALMASK 0x0FFFE008 + +/* how much to shift between capability and network attributes var */ +#define CAP_SHIFT_WPS 3 +#define CAP_SHIFT_ALGORITHM 20 +#define CAP_SHIFT_WPA2 1 +#define CAP_SHIFT_METHOD 1 +#define CAP_SHIFT_MODE 0 +#define CAP_SHIFT_ALWAYS_ONLINE 26 + +/* ------------------------------------------------------------------------- */ +/* From combined to capability */ +static inline dbus_uint32_t nwattr2cap(guint nwattrs, dbus_uint32_t *cap) +{ + guint oldval = *cap; + + *cap &= CAP_LOCALMASK; /* clear old capabilities */ + *cap |= + ((nwattrs & ICD_NW_ATTR_ALWAYS_ONLINE) >> CAP_SHIFT_ALWAYS_ONLINE) | + ((nwattrs & NWATTR_WPS_MASK) >> CAP_SHIFT_WPS) | + ((nwattrs & NWATTR_ALGORITHM_MASK) << CAP_SHIFT_ALGORITHM) | + ((nwattrs & NWATTR_WPA2_MASK) << CAP_SHIFT_WPA2) | + ((nwattrs & NWATTR_METHOD_MASK) << CAP_SHIFT_METHOD) | + (nwattrs & NWATTR_MODE_MASK); + + return oldval; +} + + +/* ------------------------------------------------------------------------- */ +/* From capability to combined */ +static inline guint cap2nwattr(dbus_uint32_t cap, guint *nwattrs) +{ + guint oldval = *nwattrs; + + *nwattrs &= ~ICD_NW_ATTR_LOCALMASK; /* clear old capabilities */ + *nwattrs |= +#ifdef WLANCOND_WPS_MASK + ((cap & WLANCOND_WPS_MASK) << CAP_SHIFT_WPS) | +#endif + ((cap & (WLANCOND_ENCRYPT_ALG_MASK | + WLANCOND_ENCRYPT_GROUP_ALG_MASK)) >> CAP_SHIFT_ALGORITHM)| + ((cap & WLANCOND_ENCRYPT_WPA2_MASK) >> CAP_SHIFT_WPA2) | + ((cap & WLANCOND_ENCRYPT_METHOD_MASK) >> CAP_SHIFT_METHOD) | + (cap & WLANCOND_MODE_MASK); + + return oldval; +} + + +#endif diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/src/bearer/qnativewifiengine_win.cpp --- a/qtmobility/src/bearer/qnativewifiengine_win.cpp Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/src/bearer/qnativewifiengine_win.cpp Tue May 11 16:58:44 2010 +0300 @@ -43,7 +43,6 @@ #include "qnetworkconfiguration_p.h" #include -#include #include #include @@ -330,13 +329,15 @@ static WlanFreeMemoryProto local_WlanFreeMemory = 0; static WlanCloseHandleProto local_WlanCloseHandle = 0; +Q_GLOBAL_STATIC_WITH_ARGS(QMutex, dynamicLoadMutex, (QMutex::Recursive)); + static void resolveLibrary() { static volatile bool triedResolve = false; if (!triedResolve) { #ifndef QT_NO_THREAD - QMutexLocker locker(QMutexPool::globalInstanceGet(&local_WlanOpenHandle)); + QMutexLocker locker(dynamicLoadMutex()); #endif if (!triedResolve) { diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/src/bearer/qnetworksession_maemo.cpp --- a/qtmobility/src/bearer/qnetworksession_maemo.cpp Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksession_maemo.cpp Tue May 11 16:58:44 2010 +0300 @@ -51,6 +51,61 @@ #include #include + +QDBusArgument &operator<<(QDBusArgument &argument, + const QtMobility::ICd2DetailsDBusStruct &icd2) +{ + argument.beginStructure(); + argument << icd2.serviceType; + argument << icd2.serviceAttributes; + argument << icd2.setviceId; + argument << icd2.networkType; + argument << icd2.networkAttributes; + argument << icd2.networkId; + argument.endStructure(); + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, + QtMobility::ICd2DetailsDBusStruct &icd2) +{ + argument.beginStructure(); + argument >> icd2.serviceType; + argument >> icd2.serviceAttributes; + argument >> icd2.setviceId; + argument >> icd2.networkType; + argument >> icd2.networkAttributes; + argument >> icd2.networkId; + argument.endStructure(); + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, + QtMobility::ICd2DetailsList &detailsList) +{ + argument.beginArray(); + detailsList.clear(); + + while (!argument.atEnd()) { + QtMobility::ICd2DetailsDBusStruct element; + argument >> element; + detailsList.append(element); + } + + argument.endArray(); + return argument; +} + +QDBusArgument &operator<<(QDBusArgument &argument, + const QtMobility::ICd2DetailsList &detailsList) +{ + argument.beginArray(qMetaTypeId()); + for (int i = 0; i < detailsList.count(); ++i) + argument << detailsList[i]; + argument.endArray(); + return argument; +} + QTM_BEGIN_NAMESPACE static QHash properties; @@ -605,208 +660,206 @@ if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) { state = QNetworkSession::Connecting; emit q->stateChanged(state); - - QTimer::singleShot(0, this, SLOT(do_open())); - return; + QTimer::singleShot(0, this, SLOT(do_open())); + return; } - isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; if (isOpen) emit quitPendingWaitsForOpened(); } else { - /* We seem to be active so inform caller */ - emit quitPendingWaitsForOpened(); + /* We seem to be active so inform caller */ + emit quitPendingWaitsForOpened(); } } - void QNetworkSessionPrivate::do_open() { icd_connection_flags flags = connectFlags; - bool st; - QString result; QString iap = publicConfig.identifier(); if (state == QNetworkSession::Connected) { #ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Already connected to" << activeConfig.identifier(); + qDebug() << "Already connected to" << activeConfig.identifier(); #endif emit q->stateChanged(QNetworkSession::Connected); - emit quitPendingWaitsForOpened(); + emit quitPendingWaitsForOpened(); return; } - Maemo::IcdConnectResult connect_result; - Maemo::Icd icd(ICD_LONG_CONNECT_TIMEOUT); - QNetworkConfiguration config; if (publicConfig.type() == QNetworkConfiguration::UserChoice) - config = activeConfig; + config = activeConfig; else - config = publicConfig; + config = publicConfig; if (iap == OSSO_IAP_ANY) { #ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "connecting to default IAP" << iap; + qDebug() << "connecting to default IAP" << iap; #endif - st = icd.connect(flags, connect_result); - + m_connectRequestTimer.start(ICD_LONG_CONNECT_TIMEOUT); + m_dbusInterface->asyncCall(ICD_DBUS_API_CONNECT_REQ, (uint)flags); // Return value ignored + m_asynchCallActive = true; } else { - - QList params; - Maemo::ConnectParams param; - param.connect.service_type = config.d->service_type; - param.connect.service_attrs = config.d->service_attrs; - param.connect.service_id = config.d->service_id; - param.connect.network_type = config.d->iap_type; - param.connect.network_attrs = config.d->network_attrs; - if (config.d->network_attrs & ICD_NW_ATTR_IAPNAME) - param.connect.network_id = QByteArray(iap.toLatin1()); - else - param.connect.network_id = config.d->network_id; - params.append(param); + ICd2DetailsDBusStruct icd2; + icd2.serviceType = config.d->service_type; + icd2.serviceAttributes = config.d->service_attrs; + icd2.setviceId = config.d->service_id; + icd2.networkType = config.d->iap_type; + icd2.networkAttributes = config.d->network_attrs; + if (config.d->network_attrs & ICD_NW_ATTR_IAPNAME) { + icd2.networkId = QByteArray(iap.toLatin1()); + } else { + icd2.networkId = config.d->network_id; + } #ifdef BEARER_MANAGEMENT_DEBUG - qDebug("connecting to %s/%s/0x%x/%s/0x%x/%s", - param.connect.network_id.data(), - param.connect.network_type.toAscii().constData(), - param.connect.network_attrs, - param.connect.service_type.toAscii().constData(), - param.connect.service_attrs, - param.connect.service_id.toAscii().constData()); -#endif - st = icd.connect(flags, params, connect_result); - } - - if (st) { - result = connect_result.connect.network_id.data(); - QString connected_iap = result; - - if (connected_iap.isEmpty()) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "connect to"<< iap << "failed, result is empty"; -#endif - updateState(QNetworkSession::Disconnected); - emit q->error(QNetworkSession::InvalidConfigurationError); - if (publicConfig.type() == QNetworkConfiguration::UserChoice) - copyConfig(publicConfig, activeConfig); - return; - } - - /* If the user tried to connect to some specific connection (foo) - * and we were already connected to some other connection (bar), - * then we cannot activate this session although icd has a valid - * connection to somewhere. - */ - if ((publicConfig.type() != QNetworkConfiguration::UserChoice) && - (connected_iap != config.identifier())) { - updateState(QNetworkSession::Disconnected); - emit q->error(QNetworkSession::InvalidConfigurationError); - return; - } - - - /* Did we connect to non saved IAP? */ - if (!(config.d->network_attrs & ICD_NW_ATTR_IAPNAME)) { - /* Because the connection succeeded, the IAP is now known. - */ - config.d->network_attrs |= ICD_NW_ATTR_IAPNAME; - config.d->id = connected_iap; - } - - /* User might have changed the IAP name when a new IAP was saved */ - Maemo::IAPConf iap_name(config.d->id); - QString name = iap_name.value("name").toString(); - if (!name.isEmpty()) - config.d->name = name; - - config.d->iap_type = connect_result.connect.network_type; - - config.d->isValid = true; - config.d->state = QNetworkConfiguration::Active; - config.d->type = QNetworkConfiguration::InternetAccessPoint; - - startTime = QDateTime::currentDateTime(); - updateState(QNetworkSession::Connected); - - currentNetworkInterface = get_network_interface(); - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "connected to" << result << config.d->name << "at" << currentNetworkInterface; + qDebug("connecting to %s/%s/0x%x/%s/0x%x/%s", + icd2.networkId.data(), + icd2.networkType.toAscii().constData(), + icd2.networkAttributes, + icd2.serviceType.toAscii().constData(), + icd2.serviceAttributes, + icd2.setviceId.toAscii().constData()); #endif - /* We first check if the configuration already exists in the manager - * and if it is not found there, we then insert it. Note that this - * is only done for user choice config only because it can be missing - * from config manager list. - */ + ICd2DetailsList paramArray; + paramArray.append(icd2); + m_connectRequestTimer.start(ICD_LONG_CONNECT_TIMEOUT); + m_dbusInterface->asyncCall(ICD_DBUS_API_CONNECT_REQ, (uint)flags, QVariant::fromValue(paramArray)); // Return value ignored + m_asynchCallActive = true; + } +} + + void QNetworkSessionPrivate::stateChange(const QDBusMessage& rep) +{ + if (m_asynchCallActive == true) { + if (m_connectRequestTimer.isActive()) + m_connectRequestTimer.stop(); + m_asynchCallActive = false; + + QString result = rep.arguments().at(5).toString(); // network id or empty string + QString connected_iap = result; + if (connected_iap.isEmpty()) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "connect to"<< publicConfig.identifier() << "failed, result is empty"; +#endif + updateState(QNetworkSession::Disconnected); + emit q->error(QNetworkSession::InvalidConfigurationError); + if (publicConfig.type() == QNetworkConfiguration::UserChoice) + copyConfig(publicConfig, activeConfig); + return; + } - if (publicConfig.d->type == QNetworkConfiguration::UserChoice) { + /* If the user tried to connect to some specific connection (foo) + * and we were already connected to some other connection (bar), + * then we cannot activate this session although icd has a valid + * connection to somewhere. + */ + if ((publicConfig.type() != QNetworkConfiguration::UserChoice) && + (connected_iap != config.identifier())) { + updateState(QNetworkSession::Disconnected); + emit q->error(QNetworkSession::InvalidConfigurationError); + return; + } + + /* Did we connect to non saved IAP? */ + if (!(config.d->network_attrs & ICD_NW_ATTR_IAPNAME)) { + /* Because the connection succeeded, the IAP is now known. + */ + config.d->network_attrs |= ICD_NW_ATTR_IAPNAME; + config.d->id = connected_iap; + } + /* User might have changed the IAP name when a new IAP was saved */ + Maemo::IAPConf iap_name(config.d->id); + QString name = iap_name.value("name").toString(); + if (!name.isEmpty()) + config.d->name = name; + + config.d->iap_type = rep.arguments().at(3).toString(); // connect_result.connect.network_type; + config.d->isValid = true; + config.d->state = QNetworkConfiguration::Active; + config.d->type = QNetworkConfiguration::InternetAccessPoint; + + startTime = QDateTime::currentDateTime(); + updateState(QNetworkSession::Connected); + //currentNetworkInterface = get_network_interface(); +#ifdef BEARER_MANAGEMENT_DEBUG + //qDebug() << "connected to" << result << config.d->name << "at" << currentNetworkInterface; +#endif + + /* We first check if the configuration already exists in the manager + * and if it is not found there, we then insert it. Note that this + * is only done for user choice config only because it can be missing + * from config manager list. + */ + if (publicConfig.d->type == QNetworkConfiguration::UserChoice) { #ifdef BEARER_MANAGEMENT_DEBUG #if 0 - QList configs; - QNetworkConfigurationManagerPrivate *conPriv = (QNetworkConfigurationManagerPrivate*)config.d.data()->manager; - QList cpsIdents = conPriv->accessPointConfigurations.keys(); - foreach( QString ii, cpsIdents) { - QExplicitlySharedDataPointer p = - conPriv->accessPointConfigurations.value(ii); - QNetworkConfiguration pt; - pt.d = conPriv->accessPointConfigurations.value(ii); - configs << pt; - } + QList configs; + QNetworkConfigurationManagerPrivate *conPriv = (QNetworkConfigurationManagerPrivate*)config.d.data()->manager; + QList cpsIdents = conPriv->accessPointConfigurations.keys(); + foreach( QString ii, cpsIdents) { + QExplicitlySharedDataPointer p = + conPriv->accessPointConfigurations.value(ii); + QNetworkConfiguration pt; + pt.d = conPriv->accessPointConfigurations.value(ii); + configs << pt; + } - int all = configs.count(); - qDebug() << "All configurations:" << all; - foreach(QNetworkConfiguration p, configs) { - qDebug() << p.name() <<": isvalid->" <"<< p.type() << - " roaming->" << p.isRoamingAvailable() << "identifier->" << p.identifier() << - " purpose->" << p.purpose() << " state->" << p.state(); - } + int all = configs.count(); + qDebug() << "All configurations:" << all; + foreach(QNetworkConfiguration p, configs) { + qDebug() << p.name() <<": isvalid->" <"<< p.type() << + " roaming->" << p.isRoamingAvailable() << "identifier->" << p.identifier() << + " purpose->" << p.purpose() << " state->" << p.state(); + } #endif #endif QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager; if (!mgr->accessPointConfigurations.contains(result)) { - QExplicitlySharedDataPointer ptr = config.d; - mgr->accessPointConfigurations.insert(result, ptr); + QExplicitlySharedDataPointer ptr = config.d; + mgr->accessPointConfigurations.insert(result, ptr); - QNetworkConfiguration item; - item.d = ptr; - emit mgr->configurationAdded(item); + QNetworkConfiguration item; + item.d = ptr; + emit mgr->configurationAdded(item); #ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"New configuration"< priv = mgr->accessPointConfigurations.value(result); - QNetworkConfiguration reference; - reference.d = priv; + QNetworkConfiguration reference; + reference.d = priv; copyConfig(config, reference, false); reference.d.data()->id = result; // Note: Id was not copied in copyConfig() function config = reference; activeConfig = reference; #ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"Existing configuration"<error(QNetworkSession::UnknownSessionError); - } + emit q->error(QNetworkSession::UnknownSessionError); } void QNetworkSessionPrivate::close() { + if (m_connectRequestTimer.isActive()) + m_connectRequestTimer.stop(); + if (serviceConfig.isValid()) { lastError = QNetworkSession::OperationNotSupportedError; emit q->error(lastError); @@ -820,6 +873,9 @@ void QNetworkSessionPrivate::stop() { + if (m_connectRequestTimer.isActive()) + m_connectRequestTimer.stop(); + if (serviceConfig.isValid()) { lastError = QNetworkSession::OperationNotSupportedError; emit q->error(lastError); diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/src/bearer/qnetworksession_maemo_p.h --- a/qtmobility/src/bearer/qnetworksession_maemo_p.h Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksession_maemo_p.h Tue May 11 16:58:44 2010 +0300 @@ -64,6 +64,18 @@ QTM_BEGIN_NAMESPACE +struct ICd2DetailsDBusStruct +{ + QString serviceType; + uint serviceAttributes; + QString setviceId; + QString networkType; + uint networkAttributes; + QByteArray networkId; +}; + +typedef QList ICd2DetailsList; + class QNetworkSessionPrivate : public QObject { Q_OBJECT @@ -71,10 +83,32 @@ QNetworkSessionPrivate() : tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), connectFlags(ICD_CONNECTION_FLAG_USER_EVENT), - currentState(QNetworkSession::Invalid) + currentState(QNetworkSession::Invalid), + m_asynchCallActive(false) { m_stopTimer.setSingleShot(true); connect(&m_stopTimer, SIGNAL(timeout()), this, SLOT(finishStopBySendingClosedSignal())); + + QDBusConnection systemBus = QDBusConnection::systemBus(); + + m_dbusInterface = new QDBusInterface(ICD_DBUS_API_INTERFACE, + ICD_DBUS_API_PATH, + ICD_DBUS_API_INTERFACE, + systemBus, + this); + + systemBus.connect(ICD_DBUS_API_INTERFACE, + ICD_DBUS_API_PATH, + ICD_DBUS_API_INTERFACE, + ICD_DBUS_API_CONNECT_SIG, + this, + SLOT(stateChange(const QDBusMessage&))); + + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + + m_connectRequestTimer.setSingleShot(true); + connect(&m_connectRequestTimer, SIGNAL(timeout()), this, SLOT(connectTimeout())); } ~QNetworkSessionPrivate() @@ -121,6 +155,8 @@ void iapStateChanged(const QString& iapid, uint icd_connection_state); void updateProxies(QNetworkSession::State newState); void finishStopBySendingClosedSignal(); + void stateChange(const QDBusMessage& rep); + void connectTimeout(); private: QNetworkConfigurationManager manager; @@ -131,6 +167,7 @@ // The config set on QNetworkSession. QNetworkConfiguration publicConfig; + QNetworkConfiguration config; // If publicConfig is a ServiceNetwork this is a copy of publicConfig. // If publicConfig is an UserChoice that is resolved to a ServiceNetwork this is the actual @@ -166,10 +203,24 @@ void clearProxyInformation(); QNetworkSession::State currentState; + QDBusInterface *m_dbusInterface; + QTimer m_stopTimer; + + bool m_asynchCallActive; + QTimer m_connectRequestTimer; }; QTM_END_NAMESPACE +// Marshall the ICd2DetailsDBusStruct data into a D-Bus argument +QDBusArgument &operator<<(QDBusArgument &argument, const QtMobility::ICd2DetailsDBusStruct &icd2); + +// Retrieve the ICd2DetailsDBusStruct data from the D-Bus argument +const QDBusArgument &operator>>(const QDBusArgument &argument, QtMobility::ICd2DetailsDBusStruct &icd2); + +Q_DECLARE_METATYPE(QtMobility::ICd2DetailsDBusStruct); +Q_DECLARE_METATYPE(QtMobility::ICd2DetailsList); + #endif //QNETWORKSESSIONPRIVATE_H diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/src/bearer/qnetworksession_s60_p.cpp --- a/qtmobility/src/bearer/qnetworksession_s60_p.cpp Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/src/bearer/qnetworksession_s60_p.cpp Tue May 11 16:58:44 2010 +0300 @@ -57,7 +57,10 @@ iALREnabled(0), iConnectInBackground(false) { CActiveScheduler::Add(this); - + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility = NULL; +#endif TRAP_IGNORE(iConnectionMonitor.ConnectL()); } @@ -507,22 +510,26 @@ void QNetworkSessionPrivate::migrate() { #ifdef SNAP_FUNCTIONALITY_AVAILABLE - // Close global 'Open C' RConnection - setdefaultif(0); - - // Start migrating to new IAP - iMobility->MigrateToPreferredCarrier(); + if (iMobility) { + // Close global 'Open C' RConnection + setdefaultif(0); + // Start migrating to new IAP + iMobility->MigrateToPreferredCarrier(); + } #endif } void QNetworkSessionPrivate::ignore() { #ifdef SNAP_FUNCTIONALITY_AVAILABLE - iMobility->IgnorePreferredCarrier(); - if (!iALRUpgradingConnection) { - newState(QNetworkSession::Disconnected); - } else { - newState(QNetworkSession::Connected,iOldRoamingIap); + if (iMobility) { + iMobility->IgnorePreferredCarrier(); + + if (!iALRUpgradingConnection) { + newState(QNetworkSession::Disconnected); + } else { + newState(QNetworkSession::Connected,iOldRoamingIap); + } } #endif } @@ -530,39 +537,43 @@ void QNetworkSessionPrivate::accept() { #ifdef SNAP_FUNCTIONALITY_AVAILABLE - iMobility->NewCarrierAccepted(); - - QNetworkConfiguration newActiveConfig = activeConfiguration(iNewRoamingIap); + if (iMobility) { + iMobility->NewCarrierAccepted(); + + QNetworkConfiguration newActiveConfig = activeConfiguration(iNewRoamingIap); - // Use name of the new IAP to open global 'Open C' RConnection - QByteArray nameAsByteArray = newActiveConfig.name().toUtf8(); - ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); - strcpy(ifr.ifr_name, nameAsByteArray.constData()); - setdefaultif(&ifr); - - newState(QNetworkSession::Connected, iNewRoamingIap); + // Use name of the new IAP to open global 'Open C' RConnection + QByteArray nameAsByteArray = newActiveConfig.name().toUtf8(); + ifreq ifr; + memset(&ifr, 0, sizeof(struct ifreq)); + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + setdefaultif(&ifr); + + newState(QNetworkSession::Connected, iNewRoamingIap); + } #endif } void QNetworkSessionPrivate::reject() { #ifdef SNAP_FUNCTIONALITY_AVAILABLE - iMobility->NewCarrierRejected(); + if (iMobility) { + iMobility->NewCarrierRejected(); - if (!iALRUpgradingConnection) { - newState(QNetworkSession::Disconnected); - } else { - QNetworkConfiguration newActiveConfig = activeConfiguration(iOldRoamingIap); + if (!iALRUpgradingConnection) { + newState(QNetworkSession::Disconnected); + } else { + QNetworkConfiguration newActiveConfig = activeConfiguration(iOldRoamingIap); - // Use name of the old IAP to open global 'Open C' RConnection - QByteArray nameAsByteArray = newActiveConfig.name().toUtf8(); - ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); - strcpy(ifr.ifr_name, nameAsByteArray.constData()); - setdefaultif(&ifr); + // Use name of the old IAP to open global 'Open C' RConnection + QByteArray nameAsByteArray = newActiveConfig.name().toUtf8(); + ifreq ifr; + memset(&ifr, 0, sizeof(struct ifreq)); + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + setdefaultif(&ifr); - newState(QNetworkSession::Connected, iOldRoamingIap); + newState(QNetworkSession::Connected, iOldRoamingIap); + } } #endif } diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/src/s60installs/s60installs.pro --- a/qtmobility/src/s60installs/s60installs.pro Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/src/s60installs/s60installs.pro Tue May 11 16:58:44 2010 +0300 @@ -31,17 +31,17 @@ isEmpty(epoc31) { EPOCROOT31 = $${EPOCROOT} } else { - EPOCROOT31 = $$(EPOCROOT31) + EPOCROOT31 = $$(EPOCROOT31) } isEmpty(epoc32) { EPOCROOT32 = $${EPOCROOT} }else { - EPOCROOT32 = $$(EPOCROOT32) + EPOCROOT32 = $$(EPOCROOT32) } isEmpty(epoc50) { EPOCROOT50 = $${EPOCROOT} } else { - EPOCROOT50 = $$(EPOCROOT50) + EPOCROOT50 = $$(EPOCROOT50) } contains(mobility_modules, bearer) { diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp --- a/qtmobility/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp Tue May 11 16:58:44 2010 +0300 @@ -72,6 +72,8 @@ private slots: + void robustnessBombing(); + void outOfProcessSession(); void invalidSession(); @@ -229,6 +231,23 @@ #endif } +// Robustness test for calling interfaces in nonsense order / with nonsense parameters +void tst_QNetworkSession::robustnessBombing() +{ + QNetworkConfigurationManager mgr; + QNetworkSession testSession(mgr.defaultConfiguration()); + // Should not reset even session is not opened + testSession.migrate(); + testSession.accept(); + testSession.ignore(); + testSession.reject(); + quint64 temp; + temp = testSession.bytesWritten(); + temp = testSession.bytesReceived(); + temp = testSession.activeTime(); +} + + void tst_QNetworkSession::invalidSession() { // 1. Verify that session created with invalid configuration remains in invalid state diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/tests/bearerex/bearerex.h --- a/qtmobility/tests/bearerex/bearerex.h Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/tests/bearerex/bearerex.h Tue May 11 16:58:44 2010 +0300 @@ -43,10 +43,15 @@ #include +#include "ui_detailedinfodialog.h" + +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) +#include "ui_bearerex_maemo.h" +#include "ui_sessiondialog_maemo.h" +#else #include "ui_bearerex.h" -#include "ui_detailedinfodialog.h" #include "ui_sessiondialog.h" - +#endif #include "qnetworkconfigmanager.h" #include "qnetworksession.h" #include "xqlistwidget.h" diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/tests/bearerex/bearerex.pro --- a/qtmobility/tests/bearerex/bearerex.pro Tue Apr 27 17:29:55 2010 +0300 +++ b/qtmobility/tests/bearerex/bearerex.pro Tue May 11 16:58:44 2010 +0300 @@ -5,9 +5,15 @@ gui \ network -FORMS += sessiondialog.ui \ - bearerex.ui \ - detailedinfodialog.ui +FORMS += detailedinfodialog.ui +maemo5|maemo6 { + FORMS += sessiondialog_maemo.ui \ + bearerex_maemo.ui +} else { + FORMS += sessiondialog.ui \ + bearerex.ui +} + include(../../common.pri) #not really a test case but deployment happens same way CONFIG += testcase diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/tests/bearerex/bearerex_maemo.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobility/tests/bearerex/bearerex_maemo.ui Tue May 11 16:58:44 2010 +0300 @@ -0,0 +1,100 @@ + + + BearerExMainWindow + + + + 0 + 0 + 360 + 640 + + + + Bearer Example + + + + + + + + Main + + + + + + + + Network Configurations + + + Qt::AlignCenter + + + + + + + + + + + + + + Update Configs + + + + + + + Update List + + + + + + + Create Session + + + + + + + Show Details + + + + + + + + + + Events + + + + + + + + + Clear + + + + + + + + + + + + + diff -r 87be51aa5b5b -r eb34711bcc75 qtmobility/tests/bearerex/sessiondialog_maemo.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobility/tests/bearerex/sessiondialog_maemo.ui Tue May 11 16:58:44 2010 +0300 @@ -0,0 +1,151 @@ + + + SessionTab + + + + 0 + 0 + 423 + 214 + + + + + + + QFormLayout::ExpandingFieldsGrow + + + + + SNAP + + + + + + + true + + + + + + + IAP + + + + + + + true + + + true + + + + + + + Bearer + + + + + + + true + + + + + + + Sent/Rec. + + + + + + + true + + + + + + + State + + + + + + + true + + + + + + + + + + + Open Session + + + + + + + Close Session + + + + + + + Stop Conn. + + + + + + + Send Test Req. + + + + + + + Create QHttp + + + + + + + Delete Session + + + + + + + Enable ALR + + + + + + + + + +