Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef NSQTNETWORKMANAGER_H_
6 #define NSQTNETWORKMANAGER_H_
8 #include <QNetworkConfigurationManager>
9 #include <QObject>
10 #include <QTimer>
11 #include <QNetworkConfiguration>
12 #include <QNetworkSession>
13 #include "nscore.h"
15 class nsQtNetworkManager;
19 class nsQtNetworkManager : public QObject
20 {
21 Q_OBJECT
22 public:
23 static void create();
24 static void destroy();
25 virtual ~nsQtNetworkManager();
27 static nsQtNetworkManager* get() { return gQtNetworkManager; }
29 static bool IsConnected();
30 static bool GetLinkStatusKnown();
31 static void enableInstance();
32 bool openConnection(const QString&);
33 bool isOnline();
34 Q_SIGNALS:
35 void openConnectionSignal();
37 public Q_SLOTS:
38 void closeSession();
39 void onlineStateChanged(bool);
41 private Q_SLOTS:
42 void openSession();
44 private:
45 explicit nsQtNetworkManager(QObject* parent = 0);
47 static nsQtNetworkManager* gQtNetworkManager;
48 QNetworkSession* networkSession;
49 QNetworkConfiguration networkConfiguration;
50 QNetworkConfigurationManager networkConfigurationManager;
51 QTimer mBlockTimer;
52 bool mOnline;
53 };
55 #endif /* NSQTNETWORKMANAGER_H_ */