Files
dms-chat/forms/QuickConnectForm.qml
SalastilandClaude Sonnet 5 7f3a1d36cd Restructure QML into views/settings/forms, add popout IPC command
- Move the ~17 top-level QML files into views/, settings/, and forms/
  subdirectories, grouped so cross-directory type references stay minimal
  (only 3 files need an added `import` line). Root now only holds the
  four surfaces plugin.json points at directly.
- Add a `dms ipc call dankChat popout` IPC target to open the floating
  window directly, alongside the existing `toggle`, and document both in
  the README along with the new directory layout.
- Add one line of breathing room between the last message and the
  composer bar via the message ListView's bottomMargin (measured with
  FontMetrics rather than a guessed pixel value).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-08-09 23:41:07 -04:00

78 lines
2.6 KiB
QML

import QtQuick
import QtQuick.Layouts
import qs.Common
import qs.Services
import qs.Widgets
// v1 stopgap for account setup (see the project plan: a real in-UI account
// editor calling the same addAccount method is a natural follow-up once
// this basic flow is proven, not blocking for the first working version).
ColumnLayout {
id: root
signal connectRequested(string nick, string host, int port, bool ssl)
property string errorText: ""
spacing: Theme.spacingXS
RowLayout {
Layout.fillWidth: true
spacing: Theme.spacingXS
DankTextField {
id: nickField
Layout.preferredWidth: 120
placeholderText: "nick"
}
DankTextField {
id: hostField
Layout.fillWidth: true
placeholderText: "host"
// A real default, not just placeholder text - placeholders
// are hint text shown only while the field is empty, they are
// NOT the field's value. Relying on someone reading a
// placeholder and assuming it's already filled in is exactly
// how "click Connect, nothing happens" happens: the click
// handler's empty-field guard below silently no-ops.
text: "irc.libera.chat"
}
DankTextField {
id: portField
Layout.preferredWidth: 70
placeholderText: "port"
text: "6697"
}
DankButton {
text: "Connect"
onClicked: {
console.log("[dankChat/QuickConnectForm] Connect clicked: nick=", JSON.stringify(nickField.text),
"host=", JSON.stringify(hostField.text), "port=", JSON.stringify(portField.text));
if (!nickField.text || !hostField.text) {
root.errorText = "Nick and host are required.";
return;
}
root.errorText = "";
const port = parseInt(portField.text || "6697", 10);
// Everything else this connection needs (SASL, encoding,
// flood control, ...) comes from ChatSettings.qml's
// "Connection defaults" - this form only asks for what
// someone reasonably wants to set per-connection.
const ssl = PluginService.loadPluginData("dankChat", "irc.defaultSsl", true);
root.connectRequested(nickField.text, hostField.text, port, ssl);
}
}
}
StyledText {
Layout.fillWidth: true
visible: root.errorText !== ""
text: root.errorText
color: Theme.error
wrapMode: Text.WordWrap
}
}