Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/examples/network/fortuneserver/fortuneserver.pro

    r769 r846  
    1111
    1212symbian {
    13     TARGET.UID3 = 0xA000CF71
     13    TARGET.UID3 = 0xA000E406
    1414    include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
    15     HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h
    16     LIBS += -lesock -lcommdb -linsock # For IAP selection
    17     TARGET.CAPABILITY = "All -TCB"
     15    TARGET.CAPABILITY = "NetworkServices ReadUserData"
    1816    TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
    1917}
  • trunk/examples/network/fortuneserver/main.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    77** This file is part of the examples of the Qt Toolkit.
    88**
    9 ** $QT_BEGIN_LICENSE:LGPL$
    10 ** Commercial Usage
    11 ** Licensees holding valid Qt Commercial licenses may use this file in
    12 ** accordance with the Qt Commercial License Agreement provided with the
    13 ** Software or, alternatively, in accordance with the terms contained in
    14 ** a written agreement between you and Nokia.
     9** $QT_BEGIN_LICENSE:BSD$
     10** You may use this file under the terms of the BSD license as follows:
    1511**
    16 ** GNU Lesser General Public License Usage
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
    18 ** General Public License version 2.1 as published by the Free Software
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
    20 ** packaging of this file.  Please review the following information to
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     12** "Redistribution and use in source and binary forms, with or without
     13** modification, are permitted provided that the following conditions are
     14** met:
     15**   * Redistributions of source code must retain the above copyright
     16**     notice, this list of conditions and the following disclaimer.
     17**   * Redistributions in binary form must reproduce the above copyright
     18**     notice, this list of conditions and the following disclaimer in
     19**     the documentation and/or other materials provided with the
     20**     distribution.
     21**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
     22**     the names of its contributors may be used to endorse or promote
     23**     products derived from this software without specific prior written
     24**     permission.
    2325**
    24 ** In addition, as a special exception, Nokia gives you certain additional
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    27 **
    28 ** GNU General Public License Usage
    29 ** Alternatively, this file may be used under the terms of the GNU
    30 ** General Public License version 3.0 as published by the Free Software
    31 ** Foundation and appearing in the file LICENSE.GPL included in the
    32 ** packaging of this file.  Please review the following information to
    33 ** ensure the GNU General Public License version 3.0 requirements will be
    34 ** met: http://www.gnu.org/copyleft/gpl.html.
    35 **
    36 ** If you have questions regarding the use of this file, please contact
    37 ** Nokia at qt-info@nokia.com.
     26** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     27** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     28** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     29** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     30** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     31** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     32** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     33** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     34** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     35** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     36** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
    3837** $QT_END_LICENSE$
    3938**
     
    4746#include "server.h"
    4847
    49 #ifdef Q_OS_SYMBIAN
    50 #include "sym_iap_util.h"
    51 #endif
    52 
    5348int main(int argc, char *argv[])
    5449{
    55 #ifdef Q_OS_SYMBIAN
    56     qt_SetDefaultIap();
    57 #endif
    5850    QApplication app(argc, argv);
    5951    Server server;
  • trunk/examples/network/fortuneserver/server.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    77** This file is part of the examples of the Qt Toolkit.
    88**
    9 ** $QT_BEGIN_LICENSE:LGPL$
    10 ** Commercial Usage
    11 ** Licensees holding valid Qt Commercial licenses may use this file in
    12 ** accordance with the Qt Commercial License Agreement provided with the
    13 ** Software or, alternatively, in accordance with the terms contained in
    14 ** a written agreement between you and Nokia.
     9** $QT_BEGIN_LICENSE:BSD$
     10** You may use this file under the terms of the BSD license as follows:
    1511**
    16 ** GNU Lesser General Public License Usage
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
    18 ** General Public License version 2.1 as published by the Free Software
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
    20 ** packaging of this file.  Please review the following information to
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     12** "Redistribution and use in source and binary forms, with or without
     13** modification, are permitted provided that the following conditions are
     14** met:
     15**   * Redistributions of source code must retain the above copyright
     16**     notice, this list of conditions and the following disclaimer.
     17**   * Redistributions in binary form must reproduce the above copyright
     18**     notice, this list of conditions and the following disclaimer in
     19**     the documentation and/or other materials provided with the
     20**     distribution.
     21**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
     22**     the names of its contributors may be used to endorse or promote
     23**     products derived from this software without specific prior written
     24**     permission.
    2325**
    24 ** In addition, as a special exception, Nokia gives you certain additional
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    27 **
    28 ** GNU General Public License Usage
    29 ** Alternatively, this file may be used under the terms of the GNU
    30 ** General Public License version 3.0 as published by the Free Software
    31 ** Foundation and appearing in the file LICENSE.GPL included in the
    32 ** packaging of this file.  Please review the following information to
    33 ** ensure the GNU General Public License version 3.0 requirements will be
    34 ** met: http://www.gnu.org/copyleft/gpl.html.
    35 **
    36 ** If you have questions regarding the use of this file, please contact
    37 ** Nokia at qt-info@nokia.com.
     26** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     27** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     28** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     29** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     30** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     31** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     32** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     33** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     34** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     35** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     36** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
    3837** $QT_END_LICENSE$
    3938**
     
    4847
    4948Server::Server(QWidget *parent)
    50     : QDialog(parent)
     49:   QDialog(parent), tcpServer(0), networkSession(0)
    5150{
    5251    statusLabel = new QLabel;
    5352    quitButton = new QPushButton(tr("Quit"));
    5453    quitButton->setAutoDefault(false);
     54
     55    QNetworkConfigurationManager manager;
     56    if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
     57        // Get saved network configuration
     58        QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
     59        settings.beginGroup(QLatin1String("QtNetwork"));
     60        const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
     61        settings.endGroup();
     62
     63        // If the saved network configuration is not currently discovered use the system default
     64        QNetworkConfiguration config = manager.configurationFromIdentifier(id);
     65        if ((config.state() & QNetworkConfiguration::Discovered) !=
     66            QNetworkConfiguration::Discovered) {
     67            config = manager.defaultConfiguration();
     68        }
     69
     70        networkSession = new QNetworkSession(config, this);
     71        connect(networkSession, SIGNAL(opened()), this, SLOT(sessionOpened()));
     72
     73        statusLabel->setText(tr("Opening network session."));
     74        networkSession->open();
     75    } else {
     76        sessionOpened();
     77    }
     78
     79    //! [2]
     80        fortunes << tr("You've been leading a dog's life. Stay off the furniture.")
     81                 << tr("You've got to think about tomorrow.")
     82                 << tr("You will be surprised by a loud noise.")
     83                 << tr("You will feel hungry again in another hour.")
     84                 << tr("You might have mail.")
     85                 << tr("You cannot kill time without injuring eternity.")
     86                 << tr("Computers are not intelligent. They only think they are.");
     87    //! [2]
     88
     89        connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
     90    //! [3]
     91        connect(tcpServer, SIGNAL(newConnection()), this, SLOT(sendFortune()));
     92    //! [3]
     93
     94        QHBoxLayout *buttonLayout = new QHBoxLayout;
     95        buttonLayout->addStretch(1);
     96        buttonLayout->addWidget(quitButton);
     97        buttonLayout->addStretch(1);
     98
     99        QVBoxLayout *mainLayout = new QVBoxLayout;
     100        mainLayout->addWidget(statusLabel);
     101        mainLayout->addLayout(buttonLayout);
     102        setLayout(mainLayout);
     103
     104        setWindowTitle(tr("Fortune Server"));
     105}
     106
     107void Server::sessionOpened()
     108{
     109    // Save the used configuration
     110    if (networkSession) {
     111        QNetworkConfiguration config = networkSession->configuration();
     112        QString id;
     113        if (config.type() == QNetworkConfiguration::UserChoice)
     114            id = networkSession->sessionProperty(QLatin1String("UserChoiceConfiguration")).toString();
     115        else
     116            id = config.identifier();
     117
     118        QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
     119        settings.beginGroup(QLatin1String("QtNetwork"));
     120        settings.setValue(QLatin1String("DefaultNetworkConfiguration"), id);
     121        settings.endGroup();
     122    }
    55123
    56124//! [0] //! [1]
     
    81149                         .arg(ipAddress).arg(tcpServer->serverPort()));
    82150//! [1]
    83 
    84 //! [2]
    85     fortunes << tr("You've been leading a dog's life. Stay off the furniture.")
    86              << tr("You've got to think about tomorrow.")
    87              << tr("You will be surprised by a loud noise.")
    88              << tr("You will feel hungry again in another hour.")
    89              << tr("You might have mail.")
    90              << tr("You cannot kill time without injuring eternity.")
    91              << tr("Computers are not intelligent. They only think they are.");
    92 //! [2]
    93 
    94     connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
    95 //! [3]
    96     connect(tcpServer, SIGNAL(newConnection()), this, SLOT(sendFortune()));
    97 //! [3]
    98 
    99     QHBoxLayout *buttonLayout = new QHBoxLayout;
    100     buttonLayout->addStretch(1);
    101     buttonLayout->addWidget(quitButton);
    102     buttonLayout->addStretch(1);
    103 
    104     QVBoxLayout *mainLayout = new QVBoxLayout;
    105     mainLayout->addWidget(statusLabel);
    106     mainLayout->addLayout(buttonLayout);
    107     setLayout(mainLayout);
    108 
    109     setWindowTitle(tr("Fortune Server"));
    110151}
    111152
  • trunk/examples/network/fortuneserver/server.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    77** This file is part of the examples of the Qt Toolkit.
    88**
    9 ** $QT_BEGIN_LICENSE:LGPL$
    10 ** Commercial Usage
    11 ** Licensees holding valid Qt Commercial licenses may use this file in
    12 ** accordance with the Qt Commercial License Agreement provided with the
    13 ** Software or, alternatively, in accordance with the terms contained in
    14 ** a written agreement between you and Nokia.
     9** $QT_BEGIN_LICENSE:BSD$
     10** You may use this file under the terms of the BSD license as follows:
    1511**
    16 ** GNU Lesser General Public License Usage
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
    18 ** General Public License version 2.1 as published by the Free Software
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
    20 ** packaging of this file.  Please review the following information to
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     12** "Redistribution and use in source and binary forms, with or without
     13** modification, are permitted provided that the following conditions are
     14** met:
     15**   * Redistributions of source code must retain the above copyright
     16**     notice, this list of conditions and the following disclaimer.
     17**   * Redistributions in binary form must reproduce the above copyright
     18**     notice, this list of conditions and the following disclaimer in
     19**     the documentation and/or other materials provided with the
     20**     distribution.
     21**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
     22**     the names of its contributors may be used to endorse or promote
     23**     products derived from this software without specific prior written
     24**     permission.
    2325**
    24 ** In addition, as a special exception, Nokia gives you certain additional
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    27 **
    28 ** GNU General Public License Usage
    29 ** Alternatively, this file may be used under the terms of the GNU
    30 ** General Public License version 3.0 as published by the Free Software
    31 ** Foundation and appearing in the file LICENSE.GPL included in the
    32 ** packaging of this file.  Please review the following information to
    33 ** ensure the GNU General Public License version 3.0 requirements will be
    34 ** met: http://www.gnu.org/copyleft/gpl.html.
    35 **
    36 ** If you have questions regarding the use of this file, please contact
    37 ** Nokia at qt-info@nokia.com.
     26** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     27** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     28** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     29** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     30** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     31** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     32** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     33** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     34** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     35** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     36** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
    3837** $QT_END_LICENSE$
    3938**
     
    4948class QPushButton;
    5049class QTcpServer;
     50class QNetworkSession;
    5151QT_END_NAMESPACE
    5252
     
    6060
    6161private slots:
     62    void sessionOpened();
    6263    void sendFortune();
    6364
     
    6768    QTcpServer *tcpServer;
    6869    QStringList fortunes;
     70    QNetworkSession *networkSession;
    6971};
    7072//! [0]
Note: See TracChangeset for help on using the changeset viewer.