[plasma/plasma-setup] /: feat: allow setup modules to request the Next action
Tiziano Gaia <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 621426887900d89ddfb4b1058b7dc477d7451d2d by Tiziano Gaia.
Committed on 08/08/2026 at 10:45.
Pushed by merritt into branch 'master'.
feat: allow setup modules to request the Next action
Add a new `nextRequested()` signal to setupmodule.h so modules can
request the same action as clicking the Next button without depending
on Wizard internals.
Connect the signal in Wizard.qml and use it in the Account module to
advance to the next page when the user presses Enter in the "Confirm
Password" field after validation succeeds.
Also document the new signal in CUSTOM_MODULES.md.
M +4 -0 docs/CUSTOM_MODULES.md
M +8 -0 modules/account/contents/ui/main.qml
M +6 -0 modules/hostname/contents/ui/main.qml
M +5 -0 src/components/setupmodule.h
M +15 -0 src/qml/Wizard.qml
https://invent.kde.org/plasma/plasma-setup/-/commit/621426887900d89ddfb4b1058b7dc477d7451d2d
diff --git a/docs/CUSTOM_MODULES.md b/docs/CUSTOM_MODULES.md
index 13a67b1..1d3dd14 100644
--- a/docs/CUSTOM_MODULES.md
+++ b/docs/CUSTOM_MODULES.md
@@ -1,5 +1,6 @@
<!--
SPDX-FileCopyrightText: 2025 Kristen McWilliam <[email protected]>
+ SPDX-FileCopyrightText: 2026 Tiziano Gaia <[email protected]>
SPDX-License-Identifier: CC0-1.0
-->
@@ -112,6 +113,9 @@ Key properties:
requirements are met
- **`contentItem`**: The actual page content to display
+Key signals:
+- **`nextRequested()`**: Emit this signal to request the same action as clicking the Next button (e.g., when the user presses Enter in the last input field)
+
### CMakeLists.txt
For QML-only modules:
diff --git a/modules/account/contents/ui/main.qml b/modules/account/contents/ui/main.qml
index adf5631..fe3749e 100644
--- a/modules/account/contents/ui/main.qml
+++ b/modules/account/contents/ui/main.qml
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2025 Carl Schwan <[email protected]>
// SPDX-FileCopyrightText: 2025 Kristen McWilliam <[email protected]>
// SPDX-FileCopyrightText: 2026 Jesús T. <[email protected]>
+// SPDX-FileCopyrightText: 2026 Tiziano Gaia <[email protected]>
//
// SPDX-License-Identifier: LGPL-2.0-or-later
@@ -158,6 +159,13 @@ PlasmaSetupComponents.SetupModule {
Kirigami.FormData.label: i18nc("@label:textbox", "Confirm Password")
placeholderText: "" // Form label already indicates this
+
+ onAccepted: {
+ if (root.nextEnabled) {
+ root.nextRequested();
+ }
+ }
+
onTextChanged: debouncer.reset()
onEditingFinished: {
diff --git a/modules/hostname/contents/ui/main.qml b/modules/hostname/contents/ui/main.qml
index d2f4001..b6cabd4 100644
--- a/modules/hostname/contents/ui/main.qml
+++ b/modules/hostname/contents/ui/main.qml
@@ -114,6 +114,12 @@ PlasmaSetupComponents.SetupModule {
validationDebouncer.reset();
}
+ onAccepted: {
+ if (root.nextEnabled) {
+ root.nextRequested();
+ }
+ }
+
onEditingFinished: {
HostnameUtil.hostname = text;
// `onEditingFinished` means the user pressed Enter or
diff --git a/src/components/setupmodule.h b/src/components/setupmodule.h
index 95adf9e..6ec21c6 100644
--- a/src/components/setupmodule.h
+++ b/src/components/setupmodule.h
@@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: 2024 Devin Lin <[email protected]>
// SPDX-FileCopyrightText: 2025 Kristen McWilliam <[email protected]>
+// SPDX-FileCopyrightText: 2026 Tiziano Gaia <[email protected]>
// SPDX-License-Identifier: LGPL-2.0-or-later
#pragma once
@@ -43,6 +44,10 @@ Q_SIGNALS:
void contentItemChanged();
void nextEnabledChanged();
void cardWidthChanged();
+ /*!
+ * Emitted when the module requests the same action as clicking the Next button.
+ */
+ void nextRequested();
private:
bool m_available{true};
diff --git a/src/qml/Wizard.qml b/src/qml/Wizard.qml
index 4afb723..fa3b5ac 100644
--- a/src/qml/Wizard.qml
+++ b/src/qml/Wizard.qml
@@ -438,5 +438,20 @@ Kirigami.Page {
item.updateRootItems();
}
}
+
+ // Allow modules to request the default "Next" action
+ Connections {
+ target: item.module
+
+ function onNextRequested(): void {
+ if (root.onFinalPage) {
+ return;
+ }
+
+ if (root.currentModule === item.module && item.module.nextEnabled) {
+ root.requestNextPage();
+ }
+ }
+ }
}
}