Changeset View
Changeset View
Standalone View
Standalone View
kcm/qml/main.qml
Show All 14 Lines | 1 | /* | |||
---|---|---|---|---|---|
15 | Lesser General Public License for more details. | 15 | Lesser General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.1 | 21 | import QtQuick 2.1 | ||
22 | import QtQuick.Dialogs 1.1 | 22 | import QtQuick.Dialogs 1.1 | ||
23 | import QtQuick.Controls 1.2 as QtControls | 23 | import QtQuick.Controls 2.5 as QQC2 | ||
24 | import org.kde.plasma.core 2.0 as PlasmaCore | 24 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
25 | import org.kde.plasma.extras 2.0 as PlasmaExtras | 25 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||
26 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | 26 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | ||
27 | 27 | | |||
28 | Item { | 28 | Item { | ||
29 | id: root | 29 | id: root | ||
30 | 30 | | |||
31 | focus: true | 31 | focus: true | ||
Show All 19 Lines | |||||
51 | } | 51 | } | ||
52 | 52 | | |||
53 | PlasmaNM.EditorProxyModel { | 53 | PlasmaNM.EditorProxyModel { | ||
54 | id: editorProxyModel | 54 | id: editorProxyModel | ||
55 | 55 | | |||
56 | sourceModel: connectionModel | 56 | sourceModel: connectionModel | ||
57 | } | 57 | } | ||
58 | 58 | | |||
59 | QtControls.TextField { | 59 | QQC2.TextField { | ||
60 | id: searchField | 60 | id: searchField | ||
61 | 61 | | |||
62 | anchors { | 62 | anchors { | ||
63 | left: parent.left | 63 | left: parent.left | ||
64 | right: parent.right | 64 | right: parent.right | ||
65 | top: parent.top | 65 | top: parent.top | ||
66 | } | 66 | } | ||
67 | 67 | | |||
68 | placeholderText: i18n("Search...") | 68 | placeholderText: i18n("Search...") | ||
69 | 69 | | |||
70 | onTextChanged: { | 70 | onTextChanged: { | ||
71 | editorProxyModel.setFilterRegExp(text) | 71 | editorProxyModel.setFilterRegExp(text) | ||
72 | } | 72 | } | ||
73 | } | 73 | } | ||
74 | 74 | | |||
75 | QtControls.ScrollView { | 75 | QQC2.ScrollView { | ||
76 | id: scrollView | 76 | id: scrollView | ||
77 | 77 | | |||
78 | Component.onCompleted: background.visible = true // show frame | ||||
79 | | ||||
78 | anchors { | 80 | anchors { | ||
79 | bottom: buttonRow.top | 81 | bottom: buttonRow.top | ||
80 | bottomMargin: Math.round(units.gridUnit / 3) | 82 | bottomMargin: Math.round(units.gridUnit / 3) | ||
81 | left: parent.left | 83 | left: parent.left | ||
82 | right: parent.right | 84 | right: parent.right | ||
83 | top: searchField.bottom | 85 | top: searchField.bottom | ||
84 | } | 86 | } | ||
85 | 87 | | |||
86 | ListView { | 88 | ListView { | ||
87 | id: connectionView | 89 | id: connectionView | ||
88 | 90 | | |||
89 | property bool currentConnectionExportable: false | 91 | property bool currentConnectionExportable: false | ||
90 | property string currentConnectionName | 92 | property string currentConnectionName | ||
91 | property string currentConnectionPath | 93 | property string currentConnectionPath | ||
92 | 94 | | |||
93 | anchors.fill: parent | 95 | anchors.fill: parent | ||
94 | clip: true | 96 | clip: true | ||
97 | focus: true | ||||
98 | activeFocusOnTab: true | ||||
95 | model: editorProxyModel | 99 | model: editorProxyModel | ||
96 | currentIndex: -1 | 100 | currentIndex: -1 | ||
97 | boundsBehavior: Flickable.StopAtBounds | 101 | boundsBehavior: Flickable.StopAtBounds | ||
98 | section.property: "KcmConnectionType" | 102 | section.property: "KcmConnectionType" | ||
99 | section.delegate: Header { text: section } | 103 | section.delegate: Header { text: section } | ||
100 | delegate: ConnectionItem { | 104 | delegate: ConnectionItem { | ||
101 | onAboutToChangeConnection: { | 105 | onAboutToChangeConnection: { | ||
102 | // Shouldn't be problem to set this in advance | 106 | // Shouldn't be problem to set this in advance | ||
Show All 28 Lines | 133 | Row { | |||
131 | 135 | | |||
132 | anchors { | 136 | anchors { | ||
133 | bottom: parent.bottom | 137 | bottom: parent.bottom | ||
134 | right: parent.right | 138 | right: parent.right | ||
135 | margins: Math.round(units.gridUnit / 3) | 139 | margins: Math.round(units.gridUnit / 3) | ||
136 | } | 140 | } | ||
137 | spacing: Math.round(units.gridUnit / 2) | 141 | spacing: Math.round(units.gridUnit / 2) | ||
138 | 142 | | |||
139 | QtControls.ToolButton { | 143 | QQC2.ToolButton { | ||
140 | id: addConnectionButton | 144 | id: addConnectionButton | ||
141 | 145 | | |||
142 | iconName: "list-add" | 146 | icon.name: "list-add" | ||
143 | tooltip: i18n("Add new connection") | 147 | | ||
148 | QQC2.ToolTip { | ||||
149 | text: i18n("Add new connection") | ||||
150 | } | ||||
144 | 151 | | |||
145 | onClicked: { | 152 | onClicked: { | ||
146 | addNewConnectionDialog.open() | 153 | addNewConnectionDialog.open() | ||
147 | } | 154 | } | ||
148 | } | 155 | } | ||
149 | 156 | | |||
150 | QtControls.ToolButton { | 157 | QQC2.ToolButton { | ||
151 | id: removeConnectionButton | 158 | id: removeConnectionButton | ||
152 | 159 | | |||
153 | enabled: connectionView.currentConnectionPath && connectionView.currentConnectionPath.length | 160 | enabled: connectionView.currentConnectionPath && connectionView.currentConnectionPath.length | ||
154 | iconName: "list-remove" | 161 | icon.name: "list-remove" | ||
155 | tooltip: i18n("Remove selected connection") | 162 | | ||
163 | QQC2.ToolTip { | ||||
164 | text: i18n("Remove selected connection") | ||||
165 | } | ||||
156 | 166 | | |||
157 | onClicked: { | 167 | onClicked: { | ||
158 | deleteConfirmationDialog.connectionName = connectionView.currentConnectionName | 168 | deleteConfirmationDialog.connectionName = connectionView.currentConnectionName | ||
159 | deleteConfirmationDialog.connectionPath = connectionView.currentConnectionPath | 169 | deleteConfirmationDialog.connectionPath = connectionView.currentConnectionPath | ||
160 | deleteConfirmationDialog.open() | 170 | deleteConfirmationDialog.open() | ||
161 | } | 171 | } | ||
162 | } | 172 | } | ||
163 | 173 | | |||
164 | QtControls.ToolButton { | 174 | QQC2.ToolButton { | ||
165 | id: exportConnectionButton | 175 | id: exportConnectionButton | ||
166 | 176 | | |||
167 | enabled: connectionView.currentConnectionExportable | 177 | enabled: connectionView.currentConnectionExportable | ||
168 | iconName: "document-export" | 178 | icon.name: "document-export" | ||
169 | tooltip: i18n("Export selected connection") | 179 | | ||
180 | QQC2.ToolTip { | ||||
181 | text: i18n("Export selected connection") | ||||
182 | } | ||||
170 | 183 | | |||
171 | onClicked: { | 184 | onClicked: { | ||
172 | root.requestExportConnection(connectionView.currentConnectionPath) | 185 | root.requestExportConnection(connectionView.currentConnectionPath) | ||
173 | } | 186 | } | ||
174 | } | 187 | } | ||
175 | } | 188 | } | ||
176 | 189 | | |||
177 | MessageDialog { | 190 | MessageDialog { | ||
Show All 36 Lines |