Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/ConnectionItem.qml
Show All 40 Lines | 38 | (Type == PlasmaNM.Enums.Wired || | |||
---|---|---|---|---|---|
41 | Type == PlasmaNM.Enums.Cdma) | 41 | Type == PlasmaNM.Enums.Cdma) | ||
42 | property bool visibleDetails: false | 42 | property bool visibleDetails: false | ||
43 | property bool visiblePasswordDialog: false | 43 | property bool visiblePasswordDialog: false | ||
44 | 44 | | |||
45 | checked: connectionItem.containsMouse | 45 | checked: connectionItem.containsMouse | ||
46 | enabled: true | 46 | enabled: true | ||
47 | height: expanded ? baseHeight + separator.height + expandableComponentLoader.height + (2 * Math.round(units.gridUnit / 3)) : baseHeight | 47 | height: expanded ? baseHeight + separator.height + expandableComponentLoader.height + (2 * Math.round(units.gridUnit / 3)) : baseHeight | ||
48 | 48 | | |||
49 | PlasmaCore.DataSource { | | |||
50 | id: dataSource | | |||
51 | | ||||
52 | property string downloadSource: "network/interfaces/" + DeviceName + "/receiver/data" | | |||
53 | property string uploadSource: "network/interfaces/" + DeviceName + "/transmitter/data" | | |||
54 | | ||||
55 | connectedSources: showSpeed && plasmoid.expanded ? [downloadSource, uploadSource] : [] | | |||
56 | engine: "systemmonitor" | | |||
57 | interval: 2000 | | |||
58 | } | | |||
59 | | ||||
60 | ColumnLayout { | 49 | ColumnLayout { | ||
61 | anchors.fill: parent | 50 | anchors.fill: parent | ||
62 | 51 | | |||
63 | RowLayout { | 52 | RowLayout { | ||
64 | Layout.fillWidth: true | 53 | Layout.fillWidth: true | ||
65 | spacing: Math.round(units.gridUnit / 2) | 54 | spacing: Math.round(units.gridUnit / 2) | ||
66 | 55 | | |||
67 | PlasmaCore.SvgItem { | 56 | PlasmaCore.SvgItem { | ||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | 142 | PlasmaComponents.TabBar { | |||
154 | id: detailsTabBar | 143 | id: detailsTabBar | ||
155 | 144 | | |||
156 | anchors { | 145 | anchors { | ||
157 | left: parent.left | 146 | left: parent.left | ||
158 | right: parent.right | 147 | right: parent.right | ||
159 | top: parent.top | 148 | top: parent.top | ||
160 | } | 149 | } | ||
161 | height: visible ? implicitHeight : 0 | 150 | height: visible ? implicitHeight : 0 | ||
162 | visible: showSpeed && dataSource.data && dataSource.data[dataSource.downloadSource] && dataSource.data[dataSource.uploadSource] | 151 | visible: showSpeed | ||
163 | 152 | | |||
164 | PlasmaComponents.TabButton { | 153 | PlasmaComponents.TabButton { | ||
165 | id: speedTabButton | 154 | id: speedTabButton | ||
166 | text: i18n("Speed") | 155 | text: i18n("Speed") | ||
167 | } | 156 | } | ||
168 | 157 | | |||
169 | PlasmaComponents.TabButton { | 158 | PlasmaComponents.TabButton { | ||
170 | id: detailsTabButton | 159 | id: detailsTabButton | ||
Show All 21 Lines | |||||
192 | 181 | | |||
193 | TrafficMonitor { | 182 | TrafficMonitor { | ||
194 | anchors { | 183 | anchors { | ||
195 | left: parent.left | 184 | left: parent.left | ||
196 | right: parent.right | 185 | right: parent.right | ||
197 | top: detailsTabBar.visible ? detailsTabBar.bottom : parent.top | 186 | top: detailsTabBar.visible ? detailsTabBar.bottom : parent.top | ||
198 | topMargin: Math.round(units.gridUnit / 3) | 187 | topMargin: Math.round(units.gridUnit / 3) | ||
199 | } | 188 | } | ||
200 | dataEngine: dataSource | 189 | rxBytes: RxBytes | ||
201 | deviceName: DeviceName | 190 | txBytes: TxBytes | ||
191 | interval: 2000 | ||||
202 | visible: detailsTabBar.currentTab == speedTabButton | 192 | visible: detailsTabBar.currentTab == speedTabButton | ||
203 | } | 193 | } | ||
204 | } | 194 | } | ||
205 | } | 195 | } | ||
206 | 196 | | |||
207 | Component { | 197 | Component { | ||
208 | id: passwordDialogComponent | 198 | id: passwordDialogComponent | ||
209 | 199 | | |||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 295 | } else if (ConnectionState == PlasmaNM.Enums.Deactivating) { | |||
308 | else | 298 | else | ||
309 | return DeviceState | 299 | return DeviceState | ||
310 | } else if (ConnectionState == PlasmaNM.Enums.Deactivated) { | 300 | } else if (ConnectionState == PlasmaNM.Enums.Deactivated) { | ||
311 | var result = LastUsed | 301 | var result = LastUsed | ||
312 | if (SecurityType > PlasmaNM.Enums.NoneSecurity) | 302 | if (SecurityType > PlasmaNM.Enums.NoneSecurity) | ||
313 | result += ", " + SecurityTypeString | 303 | result += ", " + SecurityTypeString | ||
314 | return result | 304 | return result | ||
315 | } else if (ConnectionState == PlasmaNM.Enums.Activated) { | 305 | } else if (ConnectionState == PlasmaNM.Enums.Activated) { | ||
316 | if (showSpeed && dataSource.data && dataSource.data[dataSource.downloadSource] && dataSource.data[dataSource.uploadSource]) { | 306 | if (showSpeed) { | ||
317 | var downloadColor = theme.highlightColor | 307 | var downloadColor = theme.highlightColor | ||
318 | // cycle upload color by 180 degrees | 308 | // cycle upload color by 180 degrees | ||
319 | var uploadColor = Qt.hsva((downloadColor.hsvHue + 0.5) % 1, downloadColor.hsvSaturation, downloadColor.hsvValue, downloadColor.a) | 309 | var uploadColor = Qt.hsva((downloadColor.hsvHue + 0.5) % 1, downloadColor.hsvSaturation, downloadColor.hsvValue, downloadColor.a) | ||
320 | 310 | | |||
321 | return i18n("Connected, <font color='%1'>⬇</font> %2/s, <font color='%3'>⬆</font> %4/s", | 311 | return i18n("Connected, <font color='%1'>⬇</font> %2, <font color='%3'>⬆</font> %4", | ||
322 | downloadColor, | 312 | downloadColor, | ||
323 | KCoreAddons.Format.formatByteSize(dataSource.data[dataSource.downloadSource].value * 1024 || 0), | 313 | KCoreAddons.Format.formatByteSize(RxBytes), | ||
324 | uploadColor, | 314 | uploadColor, | ||
325 | KCoreAddons.Format.formatByteSize(dataSource.data[dataSource.uploadSource].value * 1024 || 0)) | 315 | KCoreAddons.Format.formatByteSize(TxBytes)) | ||
326 | } else { | 316 | } else { | ||
327 | return i18n("Connected") | 317 | return i18n("Connected") | ||
328 | } | 318 | } | ||
329 | } | 319 | } | ||
330 | } | 320 | } | ||
331 | 321 | | |||
332 | onActivatingChanged: { | 322 | onActivatingChanged: { | ||
333 | if (ConnectionState == PlasmaNM.Enums.Activating) { | 323 | if (ConnectionState == PlasmaNM.Enums.Activating) { | ||
Show All 25 Lines |