|
1 /* |
|
2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * WLAN Sniffer list view list widget item. |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 |
|
20 #include <HbIcon> |
|
21 |
|
22 // User includes |
|
23 |
|
24 #include "wlansnifferlistitem.h" |
|
25 |
|
26 /*! |
|
27 \class WlanSnifferListItem |
|
28 \brief This class implements the custom list widget item used in |
|
29 WLAN Sniffer list view. |
|
30 */ |
|
31 |
|
32 // External function prototypes |
|
33 |
|
34 // Local constants |
|
35 |
|
36 // ======== LOCAL FUNCTIONS ======== |
|
37 |
|
38 // ======== MEMBER FUNCTIONS ======== |
|
39 |
|
40 /*! |
|
41 Constructor. |
|
42 */ |
|
43 |
|
44 WlanSnifferListItem::WlanSnifferListItem() : HbListWidgetItem() |
|
45 { |
|
46 // Fill data model with empty icons to work as a skeleton |
|
47 QVariantList decoratorList; |
|
48 decoratorList << HbIcon() << HbIcon() << HbIcon(); |
|
49 setData(decoratorList, Qt::DecorationRole); |
|
50 |
|
51 // Fill data model with empty text to work as a skeleton |
|
52 QVariantList displayList; |
|
53 displayList << QString(); |
|
54 setData(displayList, Qt::DisplayRole); |
|
55 } |
|
56 |
|
57 /*! |
|
58 Destructor. |
|
59 */ |
|
60 |
|
61 WlanSnifferListItem::~WlanSnifferListItem() |
|
62 { |
|
63 } |
|
64 |
|
65 /*! |
|
66 List item network name setting function. |
|
67 |
|
68 @param [in] name Network name to set. |
|
69 */ |
|
70 |
|
71 void WlanSnifferListItem::setNetworkName(const QString &name) |
|
72 { |
|
73 setText(name); |
|
74 } |
|
75 |
|
76 /*! |
|
77 List item left icon setting function. |
|
78 |
|
79 @param [in] icon Icon logical name. |
|
80 */ |
|
81 |
|
82 void WlanSnifferListItem::setLeftIcon(const QString &icon) |
|
83 { |
|
84 setIcon(HbIcon(icon)); |
|
85 } |
|
86 |
|
87 /*! |
|
88 List item signal strength icon setting function. |
|
89 |
|
90 @param [in] icon Icon logical name. |
|
91 */ |
|
92 |
|
93 void WlanSnifferListItem::setSignalIcon(const QString &icon) |
|
94 { |
|
95 setSecondaryIcon(HbIcon(icon)); |
|
96 } |
|
97 |
|
98 /*! |
|
99 List item secure icon setting function. |
|
100 |
|
101 @param [in] icon Icon logical name. |
|
102 */ |
|
103 |
|
104 void WlanSnifferListItem::setSecureIcon(const QString &icon) |
|
105 { |
|
106 // Fetch the current decorators (icons) |
|
107 QVariant decorators = data(Qt::DecorationRole); |
|
108 Q_ASSERT(decorators.canConvert<QVariantList>()); |
|
109 QVariantList decoratorList = decorators.toList(); |
|
110 // There must always be three icons |
|
111 Q_ASSERT(decoratorList.count() == 3); |
|
112 |
|
113 // Replace old icon |
|
114 decoratorList[2] = HbIcon(icon); |
|
115 setData(decoratorList, Qt::DecorationRole); |
|
116 } |