diff --git a/kcm/package/contents/ui/ConnectionItemDelegate.qml b/kcm/package/contents/ui/ConnectionItemDelegate.qml --- a/kcm/package/contents/ui/ConnectionItemDelegate.qml +++ b/kcm/package/contents/ui/ConnectionItemDelegate.qml @@ -39,13 +39,7 @@ signal aboutToExportConnection(string path) signal aboutToRemoveConnection(string name, string path) - RowLayout { - anchors { - left: parent.left - right: parent.right - verticalCenter: parent.verticalCenter - leftMargin: Kirigami.Units.largeSpacing - } + contentItem: RowLayout { spacing: Kirigami.Units.largeSpacing Kirigami.Icon { diff --git a/kcm/package/contents/ui/main.qml b/kcm/package/contents/ui/main.qml --- a/kcm/package/contents/ui/main.qml +++ b/kcm/package/contents/ui/main.qml @@ -26,7 +26,7 @@ import QtQuick.Controls 2.2 as QtControls import org.kde.kcm 1.2 -import org.kde.kirigami 2.3 as Kirigami // for Kirigami.Units +import org.kde.kirigami 2.4 as Kirigami // for Kirigami.Units import org.kde.plasma.networkmanagement 0.2 as PlasmaNM ScrollViewKCM { @@ -64,85 +64,58 @@ sourceModel: connectionModel } - header: Rectangle { - color: Kirigami.Theme.backgroundColor + header: QtControls.TextField { + id: searchField - width: root.width - height: Math.round(Kirigami.Units.gridUnit * 2.5) + Layout.minimumHeight: Layout.maximumHeight + Layout.maximumHeight: Kirigami.Units.iconSizes.smallMedium + Kirigami.Units.smallSpacing * 2 + Layout.fillWidth: true - RowLayout { - id: searchLayout + focus: true + placeholderText: i18n("Type here to search connection...") - spacing: Kirigami.Units.smallSpacing + onTextChanged: { + editorProxyModel.setFilterRegExp(text) + } + + MouseArea { anchors { - fill: parent - margins: Kirigami.Units.smallSpacing + right: parent.right + verticalCenter: parent.verticalCenter + rightMargin: y } - QtControls.TextField { - id: searchField + opacity: searchField.text.length > 0 ? 1 : 0 + width: Kirigami.Units.iconSizes.small + height: width - Layout.minimumHeight: Layout.maximumHeight - Layout.maximumHeight: Kirigami.Units.iconSizes.smallMedium + Kirigami.Units.smallSpacing * 2 - Layout.fillWidth: true - - focus: true - placeholderText: i18n("Type here to search connection...") - - onTextChanged: { - editorProxyModel.setFilterRegExp(text) - } + onClicked: { + searchField.text = "" + } - MouseArea { - anchors { - right: parent.right - verticalCenter: parent.verticalCenter - rightMargin: y - } - - opacity: searchField.text.length > 0 ? 1 : 0 - width: Kirigami.Units.iconSizes.small - height: width - - onClicked: { - searchField.text = "" - } - - Kirigami.Icon { - anchors.fill: parent - source: LayoutMirroring.enabled ? "edit-clear-rtl" : "edit-clear" - } - - Behavior on opacity { - OpacityAnimator { - duration: Kirigami.Units.longDuration - easing.type: Easing.InOutQuad - } - } - } + Kirigami.Icon { + anchors.fill: parent + source: LayoutMirroring.enabled ? "edit-clear-rtl" : "edit-clear" } - } - Kirigami.Separator { - visible: !connectionView.atYBeginning - anchors { - left: parent.left - right: parent.right - top: parent.bottom + Behavior on opacity { + OpacityAnimator { + duration: Kirigami.Units.longDuration + easing.type: Easing.InOutQuad + } } } } + view: ListView { id: connectionView - clip: true model: editorProxyModel currentIndex: -1 - boundsBehavior: Flickable.StopAtBounds - activeFocusOnTab: true - keyNavigationWraps: true +// activeFocusOnTab: true + // keyNavigationWraps: true Accessible.role: Accessible.List - Keys.onTabPressed: { + Keys.onTabPressed: {//this shouldn't be needed if (applicationWindow().wideScreen && root.pageStack.depth > 1) { connectionEditor.focus = true; } @@ -152,6 +125,7 @@ property: "KcmConnectionType" delegate: Kirigami.AbstractListItem { supportsMouseEvents: false + width: connectionView.width background: Rectangle { color: palette.window } @@ -165,6 +139,7 @@ } delegate: ConnectionItemDelegate { + width: connectionView.width onAboutToChangeConnection: { // // Shouldn't be problem to set this in advance // root.currentConnectionExportable = exportable @@ -191,34 +166,28 @@ } } - footer: Row { - layoutDirection: Qt.RightToLeft + footer: RowLayout { spacing: Kirigami.Units.smallSpacing - padding: Kirigami.Units.smallSpacing - - QtControls.Button { - id: exportConnectionButton - height: Kirigami.Units.iconSizes.medium - width: Kirigami.Units.iconSizes.medium + Item { + Layout.fillWidth: true + } - enabled: root.currentConnectionExportable - icon.name: "document-export" + QtControls.Button { + id: addConnectionButton + icon.name: "list-add" - QtControls.ToolTip.text: i18n("Export selected connection") - QtControls.ToolTip.visible: exportConnectionButton.hovered + QtControls.ToolTip.text: i18n("Add new connection") + QtControls.ToolTip.visible: addConnectionButton.hovered onClicked: { - kcm.requestExportConnection(root.currentConnectionPath) + addNewConnectionDialog.open() } } QtControls.Button { id: removeConnectionButton - height: Kirigami.Units.iconSizes.medium - width: Kirigami.Units.iconSizes.medium - enabled: root.currentConnectionPath && root.currentConnectionPath.length icon.name: "list-remove" @@ -233,25 +202,22 @@ } QtControls.Button { - id: addConnectionButton - - width: Kirigami.Units.iconSizes.medium - height: Kirigami.Units.iconSizes.medium - - icon.name: "list-add" + id: exportConnectionButton + enabled: root.currentConnectionExportable + icon.name: "document-export" - QtControls.ToolTip.text: i18n("Add new connection") - QtControls.ToolTip.visible: addConnectionButton.hovered + QtControls.ToolTip.text: i18n("Export selected connection") + QtControls.ToolTip.visible: exportConnectionButton.hovered onClicked: { - addNewConnectionDialog.open() + kcm.requestExportConnection(root.currentConnectionPath) } } } ConnectionEditor { id: connectionEditor - opacity: applicationWindow().pageStack.currentIndex == 1 + visible: false } MessageDialog { @@ -304,6 +270,7 @@ if (currentConnectionPath) { if (applicationWindow().pageStack.depth < 2) { applicationWindow().pageStack.push(connectionEditor) + connectionEditor.visible = true; } else { applicationWindow().pageStack.currentIndex = 1 }