diff --git a/gui/main.qml b/gui/main.qml index dffbe10..25be535 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -182,7 +182,7 @@ ApplicationWindow { newSessionDialog.backendModel = dbus.listBackends() newSessionDialog.cwdField.text = dbus.activeCwd || "" newSessionDialog.backendCombo.currentIndex = 0 - newSessionDialog.modelField.text = "" + newSessionDialog.modelCombo.editText = "" newSessionDialog.open() } @@ -196,14 +196,14 @@ ApplicationWindow { property alias cwdField: cwdInput property alias backendCombo: backendSelect - property alias modelField: modelInput + property alias modelCombo: modelSelect property var backendModel: [] onAccepted: { let cwd = cwdInput.text.trim() if (cwd === "") cwd = dbus.activeCwd || "" let backend = backendSelect.currentText - let model = modelInput.text.trim() + let model = modelSelect.editText.trim() || modelSelect.currentText dbus.createSession(cwd, backend, model) } @@ -236,13 +236,18 @@ ApplicationWindow { id: backendSelect Layout.fillWidth: true model: newSessionDialog.backendModel + onCurrentTextChanged: { + if (currentText) + modelSelect.model = dbus.listModelsByBackend(currentText) + } } - Label { text: "Model (optional):" } - TextField { - id: modelInput + Label { text: "Model:" } + ComboBox { + id: modelSelect Layout.fillWidth: true - placeholderText: "default" + editable: true + editText: "" } } } diff --git a/plasmoid/plugin/olliedbusclient.cpp b/plasmoid/plugin/olliedbusclient.cpp index 607612f..44507bc 100644 --- a/plasmoid/plugin/olliedbusclient.cpp +++ b/plasmoid/plugin/olliedbusclient.cpp @@ -595,3 +595,11 @@ QStringList OllieDBusClient::listModels(const QString &sessionId) return reply.value(); return {}; } + +QStringList OllieDBusClient::listModelsByBackend(const QString &backend) +{ + QDBusReply reply = m_iface->call("ListModelsByBackend", backend); + if (reply.isValid()) + return reply.value(); + return {}; +} diff --git a/plasmoid/plugin/olliedbusclient.h b/plasmoid/plugin/olliedbusclient.h index c26dfc0..82dd308 100644 --- a/plasmoid/plugin/olliedbusclient.h +++ b/plasmoid/plugin/olliedbusclient.h @@ -56,6 +56,7 @@ public: Q_INVOKABLE bool interrupt(const QString &sessionId); Q_INVOKABLE QStringList listBackends(); Q_INVOKABLE QStringList listModels(const QString &sessionId); + Q_INVOKABLE QStringList listModelsByBackend(const QString &backend); // Detached process management Q_INVOKABLE bool detachProcess(const QString &sessionId);