Fix typo
[yandex-traffic] / connection.hpp
1 #ifndef __CONNECTION_H__
2 #define __CONNECTION_H__
3
4 #include <QtCore>
5 #include <QtDBus>
6
7
8 // Singleton, which listens for ICD DBUS events about connection change
9 class ConnectionChecker : public QObject
10 {
11     Q_OBJECT
12
13 public:
14     enum network_type_t {
15         Net_None,
16         Net_WLAN,
17         Net_GSM,
18     };
19
20 private:
21     bool _connected;
22     network_type_t _net_type;
23     int _conn_counter;
24
25     QDBusConnection _bus;
26     QDBusInterface *_itf;
27
28 protected:
29     ConnectionChecker ();
30
31     void updateState (bool new_state, const QString& net_type = QString ());
32
33 protected slots:
34     void stateSignal (const QDBusMessage& msg);
35
36 public:
37     static ConnectionChecker *instance ();
38
39     bool isConnected () const
40     { return _connected; };
41
42     bool checkConnection (bool allow_gsm, bool allow_wifi);
43
44     network_type_t network_type () const
45     { return _net_type; };
46
47     void requestState ();
48
49 signals:
50     void connected (bool active);
51     void type_changed (ConnectionChecker::network_type_t type);
52 };
53
54 #endif // __CONNECTION_H__