|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * This file implements the NetworkDelegate class. |
|
20 */ |
|
21 #include <QList> |
|
22 #include <QString> |
|
23 #include "NetworkDelegate.h" |
|
24 #include "Utilities.h" |
|
25 |
|
26 namespace GVA { |
|
27 |
|
28 NetworkDelegate::NetworkDelegate(NetworkImpl *networkImpl = NULL) |
|
29 { |
|
30 m_networkImpl = networkImpl; |
|
31 |
|
32 if (m_networkImpl) |
|
33 { |
|
34 // set up handlers for system network info signals |
|
35 safe_connect(m_networkImpl, SIGNAL(networkNameChanged(const QString&)), |
|
36 this, SIGNAL(networkNameChanged(const QString&))); |
|
37 safe_connect(m_networkImpl, SIGNAL(networkSignalStrengthChanged(int)), |
|
38 this, SIGNAL(networkSignalStrengthChanged(int))); |
|
39 } |
|
40 |
|
41 // this will be the name javascript uses to access properties and signals |
|
42 // from this class |
|
43 setObjectName("networkDelegate"); |
|
44 } |
|
45 |
|
46 NetworkDelegate::~NetworkDelegate() |
|
47 { |
|
48 if (m_networkImpl) |
|
49 delete m_networkImpl; |
|
50 } |
|
51 |
|
52 //! Gets the network name for the current network mode. |
|
53 QString NetworkDelegate::getNetworkName() const |
|
54 { |
|
55 return m_networkImpl->getNetworkName(); |
|
56 } |
|
57 |
|
58 //! Gets the network signal strength for the current network mode. |
|
59 int NetworkDelegate::getNetworkSignalStrength() const |
|
60 { |
|
61 return m_networkImpl->getNetworkSignalStrength(); |
|
62 } |
|
63 |
|
64 } // GVA |