Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/main.qml
Show All 21 Lines | |||||
22 | import org.kde.plasma.plasmoid 2.0 | 22 | import org.kde.plasma.plasmoid 2.0 | ||
23 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | 23 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | ||
24 | import org.kde.kquickcontrolsaddons 2.0 | 24 | import org.kde.kquickcontrolsaddons 2.0 | ||
25 | import QtQuick.Layouts 1.1 | 25 | import QtQuick.Layouts 1.1 | ||
26 | 26 | | |||
27 | Item { | 27 | Item { | ||
28 | id: mainWindow | 28 | id: mainWindow | ||
29 | 29 | | |||
30 | property bool showSections: true | | |||
31 | readonly property string kcm: "kcm_networkmanagement.desktop" | 30 | readonly property string kcm: "kcm_networkmanagement.desktop" | ||
32 | readonly property bool kcmAuthorized: KCMShell.authorize(kcm).length == 1 | 31 | readonly property bool kcmAuthorized: KCMShell.authorize(kcm).length == 1 | ||
33 | 32 | | |||
34 | Plasmoid.toolTipMainText: i18n("Networks") | 33 | Plasmoid.toolTipMainText: i18n("Networks") | ||
35 | Plasmoid.toolTipSubText: networkStatus.activeConnections | 34 | Plasmoid.toolTipSubText: networkStatus.activeConnections | ||
36 | Plasmoid.icon: connectionIconProvider.connectionTooltipIcon | 35 | Plasmoid.icon: connectionIconProvider.connectionTooltipIcon | ||
37 | Plasmoid.switchWidth: units.gridUnit * 10 | 36 | Plasmoid.switchWidth: units.gridUnit * 10 | ||
38 | Plasmoid.switchHeight: units.gridUnit * 10 | 37 | Plasmoid.switchHeight: units.gridUnit * 10 | ||
39 | Plasmoid.compactRepresentation: CompactRepresentation { } | 38 | Plasmoid.compactRepresentation: CompactRepresentation { } | ||
40 | Plasmoid.fullRepresentation: PopupDialog { | 39 | Plasmoid.fullRepresentation: PopupDialog { | ||
41 | id: dialogItem | 40 | id: dialogItem | ||
42 | Layout.minimumWidth: units.iconSizes.medium * 10 | 41 | Layout.minimumWidth: units.iconSizes.medium * 10 | ||
43 | Layout.minimumHeight: units.gridUnit * 20 | 42 | Layout.minimumHeight: units.gridUnit * 20 | ||
44 | anchors.fill: parent | 43 | anchors.fill: parent | ||
45 | focus: true | 44 | focus: true | ||
46 | } | 45 | } | ||
47 | 46 | | |||
48 | function action_openKCM() { | 47 | function action_openKCM() { | ||
49 | KCMShell.open(kcm) | 48 | KCMShell.open(kcm) | ||
50 | | ||||
51 | | ||||
52 | } | 49 | } | ||
50 | | ||||
53 | function action_showPortal() { | 51 | function action_showPortal() { | ||
54 | Qt.openUrlExternally("http://networkcheck.kde.org") | 52 | Qt.openUrlExternally("http://networkcheck.kde.org") | ||
55 | } | 53 | } | ||
56 | 54 | | |||
57 | Component.onCompleted: { | 55 | Component.onCompleted: { | ||
58 | if (kcmAuthorized) { | 56 | if (kcmAuthorized) { | ||
59 | plasmoid.setAction("openKCM", i18n("&Configure Network Connections..."), "preferences-system-network"); | 57 | plasmoid.setAction("openKCM", i18n("&Configure Network Connections..."), "preferences-system-network"); | ||
60 | } | 58 | } | ||
59 | plasmoid.removeAction("configure"); | ||||
61 | plasmoid.setAction("showPortal", i18n("Open Network Login Page..."), "internet-services"); | 60 | plasmoid.setAction("showPortal", i18n("Open Network Login Page..."), "internet-services"); | ||
62 | 61 | | |||
63 | var action = plasmoid.action("showPortal"); | 62 | var action = plasmoid.action("showPortal"); | ||
64 | action.visible = Qt.binding(function() { return connectionIconProvider.needsPortal; }) | 63 | action.visible = Qt.binding(function() { return connectionIconProvider.needsPortal; }) | ||
65 | } | 64 | } | ||
66 | 65 | | |||
67 | PlasmaNM.NetworkStatus { | 66 | PlasmaNM.NetworkStatus { | ||
68 | id: networkStatus | 67 | id: networkStatus | ||
Show All 10 Lines | |||||
79 | Timer { | 78 | Timer { | ||
80 | id: scanTimer | 79 | id: scanTimer | ||
81 | interval: 10200 | 80 | interval: 10200 | ||
82 | repeat: true | 81 | repeat: true | ||
83 | running: plasmoid.expanded && !connectionIconProvider.airplaneMode | 82 | running: plasmoid.expanded && !connectionIconProvider.airplaneMode | ||
84 | 83 | | |||
85 | onTriggered: handler.requestScan() | 84 | onTriggered: handler.requestScan() | ||
86 | } | 85 | } | ||
87 | | ||||
88 | PlasmaNM.Configuration { | | |||
89 | id: configuration | | |||
90 | unlockModemOnDetection: plasmoid.configuration.unlockModemOnDetection | | |||
91 | manageVirtualConnections: plasmoid.configuration.manageVirtualConnections | | |||
92 | } | | |||
93 | } | 86 | } |