56 #include "qnetworksession.h" |
56 #include "qnetworksession.h" |
57 |
57 |
58 #include <qnetworksession.h> |
58 #include <qnetworksession.h> |
59 #include <QNetworkInterface> |
59 #include <QNetworkInterface> |
60 #include <QDateTime> |
60 #include <QDateTime> |
|
61 #include <QTimer> |
61 |
62 |
62 #ifdef Q_WS_MAEMO_6 |
|
63 #include <icd/dbus_api.h> |
63 #include <icd/dbus_api.h> |
64 #endif |
|
65 |
64 |
66 QTM_BEGIN_NAMESPACE |
65 QTM_BEGIN_NAMESPACE |
67 |
66 |
68 class QNetworkSessionPrivate : public QObject |
67 class QNetworkSessionPrivate : public QObject |
69 { |
68 { |
70 Q_OBJECT |
69 Q_OBJECT |
71 public: |
70 public: |
72 QNetworkSessionPrivate() : |
71 QNetworkSessionPrivate() : |
73 tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), |
72 tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), |
74 #ifdef Q_WS_MAEMO_6 |
|
75 connectFlags(ICD_CONNECTION_FLAG_USER_EVENT), |
73 connectFlags(ICD_CONNECTION_FLAG_USER_EVENT), |
76 #else |
|
77 connectFlags(0), |
|
78 #endif |
|
79 currentState(QNetworkSession::Invalid) |
74 currentState(QNetworkSession::Invalid) |
80 { |
75 { |
|
76 m_stopTimer.setSingleShot(true); |
|
77 connect(&m_stopTimer, SIGNAL(timeout()), this, SLOT(finishStopBySendingClosedSignal())); |
81 } |
78 } |
82 |
79 |
83 ~QNetworkSessionPrivate() |
80 ~QNetworkSessionPrivate() |
84 { |
81 { |
85 cleanupSession(); |
82 cleanupSession(); |
119 void quitPendingWaitsForOpened(); |
116 void quitPendingWaitsForOpened(); |
120 |
117 |
121 private Q_SLOTS: |
118 private Q_SLOTS: |
122 void do_open(); |
119 void do_open(); |
123 void networkConfigurationsChanged(); |
120 void networkConfigurationsChanged(); |
124 void configurationChanged(const QNetworkConfiguration &config); |
121 void iapStateChanged(const QString& iapid, uint icd_connection_state); |
125 void updateProxies(QNetworkSession::State newState); |
122 void updateProxies(QNetworkSession::State newState); |
|
123 void finishStopBySendingClosedSignal(); |
126 |
124 |
127 private: |
125 private: |
128 QNetworkConfigurationManager manager; |
126 QNetworkConfigurationManager manager; |
129 |
127 |
130 quint64 tx_data; |
128 quint64 tx_data; |
143 // Either a copy of publicConfig or one of serviceConfig.children(). |
141 // Either a copy of publicConfig or one of serviceConfig.children(). |
144 QNetworkConfiguration activeConfig; |
142 QNetworkConfiguration activeConfig; |
145 |
143 |
146 QNetworkConfiguration& copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy = true); |
144 QNetworkConfiguration& copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy = true); |
147 void clearConfiguration(QNetworkConfiguration &config); |
145 void clearConfiguration(QNetworkConfiguration &config); |
148 void cleanupAnyConfiguration(); |
|
149 |
146 |
150 QNetworkSession::State state; |
147 QNetworkSession::State state; |
151 bool isOpen; |
148 bool isOpen; |
152 bool opened; |
149 bool opened; |
153 icd_connection_flags connectFlags; |
150 icd_connection_flags connectFlags; |
159 |
156 |
160 QDateTime startTime; |
157 QDateTime startTime; |
161 QString currentNetworkInterface; |
158 QString currentNetworkInterface; |
162 friend class IcdListener; |
159 friend class IcdListener; |
163 void updateState(QNetworkSession::State); |
160 void updateState(QNetworkSession::State); |
164 void updateIdentifier(QString &newId); |
161 void updateIdentifier(const QString &newId); |
165 quint64 getStatistics(bool sent) const; |
162 quint64 getStatistics(bool sent) const; |
166 void cleanupSession(void); |
163 void cleanupSession(void); |
167 |
164 |
168 void updateProxyInformation(); |
165 void updateProxyInformation(); |
169 void clearProxyInformation(); |
166 void clearProxyInformation(); |
170 QNetworkSession::State currentState; |
167 QNetworkSession::State currentState; |
|
168 |
|
169 QTimer m_stopTimer; |
171 }; |
170 }; |
172 |
171 |
173 QTM_END_NAMESPACE |
172 QTM_END_NAMESPACE |
174 |
173 |
175 #endif //QNETWORKSESSIONPRIVATE_H |
174 #endif //QNETWORKSESSIONPRIVATE_H |