qtmobility/examples/fetchgooglemaps/mapwindow.cpp
changeset 11 06b8e2af4411
parent 5 453da2cfceef
equal deleted inserted replaced
8:71781823f776 11:06b8e2af4411
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the Qt Mobility Components.
     7 ** This file is part of the Qt Mobility Components.
     8 **
     8 **
    42 #include <QtWebKit>
    42 #include <QtWebKit>
    43 
    43 
    44 #include <qgeopositioninfosource.h>
    44 #include <qgeopositioninfosource.h>
    45 #include <qnmeapositioninfosource.h>
    45 #include <qnmeapositioninfosource.h>
    46 #include <qgeosatelliteinfosource.h>
    46 #include <qgeosatelliteinfosource.h>
    47 #ifndef Q_WS_MAEMO_5
       
    48 #include <qnetworksession.h>
    47 #include <qnetworksession.h>
    49 #include <qnetworkconfigmanager.h>
    48 #include <qnetworkconfigmanager.h>
    50 #endif
       
    51 
    49 
    52 #include "satellitedialog.h"
    50 #include "satellitedialog.h"
    53 
    51 
    54 #include "mapwindow.h"
    52 #include "mapwindow.h"
    55 
    53 
   134 }
   132 }
   135 
   133 
   136 MapWindow::~MapWindow()
   134 MapWindow::~MapWindow()
   137 {
   135 {
   138     location->stopUpdates();
   136     location->stopUpdates();
   139 #ifndef Q_WS_MAEMO_5
       
   140     session->close();
   137     session->close();
   141 #endif
       
   142 }
   138 }
   143 
   139 
   144 void MapWindow::delayedInit()
   140 void MapWindow::delayedInit()
   145 {
   141 {
   146     if (usingLogFile) {
   142     if (usingLogFile) {
   149     } else {
   145     } else {
   150         waitForFix();
   146         waitForFix();
   151         location->stopUpdates();
   147         location->stopUpdates();
   152     }
   148     }
   153 
   149 
   154 #ifndef Q_WS_MAEMO_5
       
   155     // Set Internet Access Point
   150     // Set Internet Access Point
   156     QNetworkConfigurationManager manager;
   151     QNetworkConfigurationManager manager;
   157     const bool canStartIAP = (manager.capabilities()
   152     const bool canStartIAP = (manager.capabilities()
   158                               & QNetworkConfigurationManager::CanStartAndStopInterfaces);
   153                               & QNetworkConfigurationManager::CanStartAndStopInterfaces);
   159     // Is there default access point, use it
   154     // Is there default access point, use it
   165     }
   160     }
   166 
   161 
   167     session = new QTM_PREPEND_NAMESPACE(QNetworkSession)(cfg, this);
   162     session = new QTM_PREPEND_NAMESPACE(QNetworkSession)(cfg, this);
   168     session->open();
   163     session->open();
   169     session->waitForOpened(-1);
   164     session->waitForOpened(-1);
   170 #endif
       
   171     connect(location, SIGNAL(updateTimeout()), this, SLOT(waitForFix()));
   165     connect(location, SIGNAL(updateTimeout()), this, SLOT(waitForFix()));
   172 
   166 
   173     location->startUpdates();
   167     location->startUpdates();
   174 }
   168 }
   175 
   169