Files
dms-chat/forms/SockChatConnectForm.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

73 lines
2.1 KiB
QML

import QtQuick
import QtQuick.Layouts
import qs.Common
import qs.Widgets
// Sneedchat (SockChat) login is ordinary XenForo username+password, plus an
// optional TOTP secret for accounts with 2FA - see backend/sockchat/auth.rs.
// Unlike Discord's QR flow there's nothing to scan, but like Discord, the
// actual login (Tor bootstrap + auth + a possible proof-of-work solve) can
// take anywhere from instant to over a minute, so this only ever renders a
// status string fed by sockChatLoginStatus/sockChatLoginResult events - see
// ChatView.qml's handling of those, mirrored from its Discord equivalent.
ColumnLayout {
id: root
signal connectRequested(string username, string password, string totpSecret)
property string statusText: ""
property bool pending: false
onStatusTextChanged: root.pending = false
spacing: Theme.spacingXS
RowLayout {
Layout.fillWidth: true
spacing: Theme.spacingXS
DankTextField {
id: usernameField
Layout.fillWidth: true
placeholderText: "username"
}
DankTextField {
id: passwordField
Layout.preferredWidth: 160
placeholderText: "password"
echoMode: TextInput.Password
}
}
DankTextField {
id: totpField
Layout.fillWidth: true
placeholderText: "TOTP secret (only if 2FA is enabled)"
}
DankButton {
text: root.pending ? "Connecting..." : "Connect"
enabled: !root.pending
onClicked: {
if (!usernameField.text || !passwordField.text) {
root.statusText = "Username and password are required.";
return;
}
root.pending = true;
root.statusText = "";
root.connectRequested(usernameField.text, passwordField.text, totpField.text);
passwordField.text = "";
totpField.text = "";
}
}
StyledText {
Layout.fillWidth: true
visible: root.statusText !== ""
text: root.statusText
wrapMode: Text.WordWrap
color: Theme.surfaceVariantText
}
}