diff --git a/initialstart/modules/wifi/package/contents/ui/ConnectDialog.qml b/initialstart/modules/wifi/package/contents/ui/ConnectDialog.qml index 5947abff..b3b84cb2 100644 --- a/initialstart/modules/wifi/package/contents/ui/ConnectDialog.qml +++ b/initialstart/modules/wifi/package/contents/ui/ConnectDialog.qml @@ -1,31 +1,31 @@ -// SPDX-FileCopyrightText: 2023 Devin Lin -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: 2020-2024 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later -import QtQuick 2.15 -import QtQuick.Layouts 1.15 -import QtQuick.Controls 2.15 as Controls - -import org.kde.kirigami 2.20 as Kirigami +import QtQuick 2.6 +import QtQuick.Layouts 1.2 +import QtQuick.Controls 2.2 as Controls +import org.kde.kirigami as Kirigami Kirigami.PromptDialog { id: dialogRoot + title: headingText + property int securityType property string headingText property string devicePath property string specificPath - + signal donePressed(string password) - + function openAndClear() { warning.visible = false; this.open(); passwordField.text = ""; passwordField.focus = true; } - - title: headingText + standardButtons: Controls.Dialog.Ok | Controls.Dialog.Cancel - + onOpened: passwordField.forceActiveFocus() onRejected: { dialogRoot.close(); @@ -40,22 +40,23 @@ Kirigami.PromptDialog { } passwordField.focus = false; } - + ColumnLayout { id: column spacing: Kirigami.Units.largeSpacing - + PasswordField { id: passwordField Layout.fillWidth: true securityType: dialogRoot.securityType onAccepted: dialogRoot.accept() } - + Controls.Label { id: warning text: i18n("Invalid input.") visible: false } } + } diff --git a/kcms/wifi/ui/ConnectDialog.qml b/kcms/wifi/ui/ConnectDialog.qml index a7f7ca9f..b3b84cb2 100644 --- a/kcms/wifi/ui/ConnectDialog.qml +++ b/kcms/wifi/ui/ConnectDialog.qml @@ -1,16 +1,15 @@ -/* - SPDX-FileCopyrightText: 2020 Devin Lin +// SPDX-FileCopyrightText: 2020-2024 Devin Lin +// SPDX-License-Identifier: LGPL-2.0-or-later - SPDX-License-Identifier: LGPL-2.0-or-later -*/ import QtQuick 2.6 import QtQuick.Layouts 1.2 import QtQuick.Controls 2.2 as Controls -import Qt5Compat.GraphicalEffects -import org.kde.kirigami 2.12 as Kirigami +import org.kde.kirigami as Kirigami -Controls.Dialog { +Kirigami.PromptDialog { id: dialogRoot + title: headingText + property int securityType property string headingText property string devicePath @@ -25,8 +24,6 @@ Controls.Dialog { passwordField.focus = true; } - anchors.centerIn: parent - modal: true standardButtons: Controls.Dialog.Ok | Controls.Dialog.Cancel onOpened: passwordField.forceActiveFocus() @@ -44,84 +41,8 @@ Controls.Dialog { passwordField.focus = false; } - property int translateY: (1 - opacity) * Kirigami.Units.gridUnit * 2 - - NumberAnimation on opacity { - to: 1 - from: 0 - duration: Kirigami.Units.veryShortDuration - easing.type: Easing.InOutQuad - running: true - } - - background: Item { - transform: Translate { y: dialogRoot.translateY } - - RectangularGlow { - anchors.fill: rect - anchors.topMargin: 1 - cornerRadius: rect.radius * 2 - glowRadius: 2 - spread: 0.2 - color: Qt.rgba(0, 0, 0, 0.3) - } - Rectangle { - id: rect - anchors.fill: parent - Kirigami.Theme.inherit: false - Kirigami.Theme.colorSet: Kirigami.Theme.Window - color: Kirigami.Theme.backgroundColor - radius: Kirigami.Units.smallSpacing - - Kirigami.Separator { - id: topSeparator - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.topMargin: dialogRoot.header.implicitHeight - } - - Kirigami.Separator { - id: bottomSeparator - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.bottomMargin: dialogRoot.footer.implicitHeight - } - - Rectangle { - Kirigami.Theme.inherit: false - Kirigami.Theme.colorSet: Kirigami.Theme.View - color: Kirigami.Theme.backgroundColor - anchors.left: parent.left - anchors.right: parent.right - anchors.top: topSeparator.bottom - anchors.bottom: bottomSeparator.top - } - } - } - - header: Item { - transform: Translate { y: dialogRoot.translateY } - implicitHeight: heading.implicitHeight + Kirigami.Units.largeSpacing * 2 - - Kirigami.Heading { - id: heading - level: 2 - text: headingText - wrapMode: Text.WordWrap - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: Kirigami.Units.largeSpacing - anchors.verticalCenter: parent.verticalCenter - } - } - - footer.transform: Translate { y: dialogRoot.translateY } - ColumnLayout { id: column - transform: Translate { y: dialogRoot.translateY } spacing: Kirigami.Units.largeSpacing PasswordField { diff --git a/kcms/wifi/ui/main.qml b/kcms/wifi/ui/main.qml index bd623fd3..79a8fc57 100644 --- a/kcms/wifi/ui/main.qml +++ b/kcms/wifi/ui/main.qml @@ -61,6 +61,7 @@ SimpleKCM { ConnectDialog { id: connectionDialog + parent: root } ColumnLayout {