Loading client/CMakeLists.txt +1 −0 Changes for client/CMakeLists.txt: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ qt_add_qml_module(blogi-editor qml/DocumentTree.qml qml/PropertyPanel.qml qml/PreviewPane.qml qml/ConnectionPanel.qml ) target_link_libraries(blogi-editor PRIVATE Loading client/localapi.cpp +31 −8 Changes for client/localapi.cpp: 31 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ #include "publishclient.h" #include <QFileDialog> #include <QInputDialog> #include <QGuiApplication> LocalApi::LocalApi(DocumentManager *doc, PublishClient *pub, QObject *parent) Loading Loading @@ -165,13 +164,8 @@ void LocalApi::saveAsDocument() { void LocalApi::publishToServer() { if (!_pub->isConfigured()) { bool ok = false; QString url = QInputDialog::getText( nullptr, "Server URL", "Enter blogi server URL (e.g. https://blog.example.com):", QLineEdit::Normal, QString(), &ok); if (!ok || url.isEmpty()) return; _pub->setServerUrl(url); emit statusMessage("Not connected — use the connection panel."); return; } QString rendered = _doc->renderToHtml(); Loading @@ -189,6 +183,35 @@ void LocalApi::publishToServer() { }); } void LocalApi::connectToServer(const QString &url, const QString &user, const QString &password) { _pub->setServerUrl(url); if (user.isEmpty()) { /* No credentials — just set the URL and mark connected */ emit connectionStatusChanged(true, "Connected to " + url); emit statusMessage("Connected to " + url); return; } emit statusMessage("Logging in..."); _pub->login(user, password, [this, url](bool ok, const QString &msg) { if (ok) { emit connectionStatusChanged(true, "Connected to " + url); emit statusMessage("Logged in to " + url); } else { emit connectionStatusChanged(false, msg); emit statusMessage("Login failed: " + msg); } }); } void LocalApi::disconnectServer() { _pub->setServerUrl(""); _pub->setAuthToken(""); emit connectionStatusChanged(false, "Disconnected"); emit statusMessage("Disconnected from server"); } void LocalApi::refresh() { emit documentChanged(); } client/localapi.h +5 −0 Changes for client/localapi.h: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -73,6 +73,10 @@ public: Q_INVOKABLE void saveAsDocument(); Q_INVOKABLE void publishToServer(); /* Connection management */ Q_INVOKABLE void connectToServer(const QString &url, const QString &user, const QString &password); Q_INVOKABLE void disconnectServer(); /* Initial load */ Q_INVOKABLE void refresh(); Loading @@ -80,6 +84,7 @@ signals: void documentChanged(); void statusMessage(const QString &msg); void currentFileChanged(const QString &path); void connectionStatusChanged(bool ok, const QString &msg); private: DocumentManager *_doc; Loading client/qml/ConnectionPanel.qml 0 → 100644 +155 −0 Changes for client/qml/ConnectionPanel.qml: 155 added lines, 0 removed lines. Original line number Diff line number Diff line import QtQuick import QtQuick.Controls import QtQuick.Layouts ColumnLayout { id: connPanel spacing: 8 property bool connected: false property string serverUrl: "" property string statusText: "Not connected" property color statusColor: Theme.textMuted Label { text: qsTr("Server Connection") font.bold: true font.pixelSize: 13 color: Theme.textPrimary Layout.fillWidth: true } /* Status indicator */ RowLayout { spacing: 6 Rectangle { width: 8; height: 8; radius: 4 color: connected ? Theme.success : Theme.textMuted } Label { text: statusText font.pixelSize: 12 color: statusColor Layout.fillWidth: true elide: Text.ElideRight } } Rectangle { Layout.fillWidth: true; height: 1; color: Theme.border } /* URL field */ Label { text: qsTr("Server URL") font.pixelSize: 11; color: Theme.textSecondary } TextField { id: urlField Layout.fillWidth: true placeholderText: "https://blog.example.com" font.pixelSize: 13; color: Theme.textPrimary text: serverUrl background: Rectangle { color: Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius } } /* Username */ Label { text: qsTr("Username") font.pixelSize: 11; color: Theme.textSecondary } TextField { id: userField Layout.fillWidth: true placeholderText: "admin" font.pixelSize: 13; color: Theme.textPrimary background: Rectangle { color: Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius } } /* Password */ Label { text: qsTr("Password") font.pixelSize: 11; color: Theme.textSecondary } TextField { id: passField Layout.fillWidth: true echoMode: TextInput.Password font.pixelSize: 13; color: Theme.textPrimary background: Rectangle { color: Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius } Keys.onReturnPressed: connectBtn.clicked() } /* Connect / Disconnect button */ Button { id: connectBtn Layout.fillWidth: true text: connected ? qsTr("Disconnect") : qsTr("Connect") highlighted: true background: Rectangle { color: connected ? Theme.danger : Theme.accent radius: Theme.radius opacity: parent.hovered ? 0.9 : 1.0 } contentItem: Text { text: parent.text color: "#ffffff" font.pixelSize: 13; font.bold: true horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } onClicked: { if (connected) { localApi.disconnectServer() connected = false statusText = "Disconnected" statusColor = Theme.textMuted } else { if (urlField.text.length === 0) { statusText = "Enter a server URL" statusColor = Theme.warning return } statusText = "Connecting..." statusColor = Theme.textMuted localApi.connectToServer( urlField.text, userField.text, passField.text) } } } /* Publish button */ Button { Layout.fillWidth: true text: qsTr("Publish") enabled: connected opacity: enabled ? 1.0 : 0.5 background: Rectangle { color: Theme.accent radius: Theme.radius opacity: parent.enabled ? (parent.hovered ? 0.9 : 0.7) : 0.3 } contentItem: Text { text: parent.text color: "#ffffff" font.pixelSize: 13 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } onClicked: localApi.publishToServer() } Item { Layout.fillHeight: true } Connections { target: localApi function onConnectionStatusChanged(ok, msg) { connected = ok statusText = msg statusColor = ok ? Theme.success : Theme.danger if (ok) serverUrl = urlField.text } } } client/qml/Main.qml +26 −3 Changes for client/qml/Main.qml: 26 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -60,18 +60,19 @@ ApplicationWindow { /* ---- Sidebar ---- */ ScrollView { SplitView.preferredWidth: 320 SplitView.preferredWidth: 280 SplitView.minimumWidth: 200 SplitView.maximumWidth: 600 SplitView.maximumWidth: 500 clip: true ColumnLayout { width: parent.width spacing: 0 /* Widgets */ /* Widgets (collapsed by default) */ SidebarSection { title: qsTr("Widgets") collapsed: true WidgetToolbar { id: widgetToolbar; Layout.fillWidth: true } } Loading Loading @@ -107,6 +108,28 @@ ApplicationWindow { id: previewFrame SplitView.fillWidth: true } /* ---- Connection Manager (right) ---- */ ScrollView { SplitView.preferredWidth: 240 SplitView.minimumWidth: 180 SplitView.maximumWidth: 400 clip: true Rectangle { width: parent.width implicitHeight: connLayout.implicitHeight + 24 color: Theme.bgSecondary ColumnLayout { id: connLayout anchors.fill: parent anchors.margins: 12 ConnectionPanel { Layout.fillWidth: true; Layout.fillHeight: true } } } } } function setStatus(msg) { statusLabel.text = msg } Loading Loading
client/CMakeLists.txt +1 −0 Changes for client/CMakeLists.txt: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ qt_add_qml_module(blogi-editor qml/DocumentTree.qml qml/PropertyPanel.qml qml/PreviewPane.qml qml/ConnectionPanel.qml ) target_link_libraries(blogi-editor PRIVATE Loading
client/localapi.cpp +31 −8 Changes for client/localapi.cpp: 31 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ #include "publishclient.h" #include <QFileDialog> #include <QInputDialog> #include <QGuiApplication> LocalApi::LocalApi(DocumentManager *doc, PublishClient *pub, QObject *parent) Loading Loading @@ -165,13 +164,8 @@ void LocalApi::saveAsDocument() { void LocalApi::publishToServer() { if (!_pub->isConfigured()) { bool ok = false; QString url = QInputDialog::getText( nullptr, "Server URL", "Enter blogi server URL (e.g. https://blog.example.com):", QLineEdit::Normal, QString(), &ok); if (!ok || url.isEmpty()) return; _pub->setServerUrl(url); emit statusMessage("Not connected — use the connection panel."); return; } QString rendered = _doc->renderToHtml(); Loading @@ -189,6 +183,35 @@ void LocalApi::publishToServer() { }); } void LocalApi::connectToServer(const QString &url, const QString &user, const QString &password) { _pub->setServerUrl(url); if (user.isEmpty()) { /* No credentials — just set the URL and mark connected */ emit connectionStatusChanged(true, "Connected to " + url); emit statusMessage("Connected to " + url); return; } emit statusMessage("Logging in..."); _pub->login(user, password, [this, url](bool ok, const QString &msg) { if (ok) { emit connectionStatusChanged(true, "Connected to " + url); emit statusMessage("Logged in to " + url); } else { emit connectionStatusChanged(false, msg); emit statusMessage("Login failed: " + msg); } }); } void LocalApi::disconnectServer() { _pub->setServerUrl(""); _pub->setAuthToken(""); emit connectionStatusChanged(false, "Disconnected"); emit statusMessage("Disconnected from server"); } void LocalApi::refresh() { emit documentChanged(); }
client/localapi.h +5 −0 Changes for client/localapi.h: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -73,6 +73,10 @@ public: Q_INVOKABLE void saveAsDocument(); Q_INVOKABLE void publishToServer(); /* Connection management */ Q_INVOKABLE void connectToServer(const QString &url, const QString &user, const QString &password); Q_INVOKABLE void disconnectServer(); /* Initial load */ Q_INVOKABLE void refresh(); Loading @@ -80,6 +84,7 @@ signals: void documentChanged(); void statusMessage(const QString &msg); void currentFileChanged(const QString &path); void connectionStatusChanged(bool ok, const QString &msg); private: DocumentManager *_doc; Loading
client/qml/ConnectionPanel.qml 0 → 100644 +155 −0 Changes for client/qml/ConnectionPanel.qml: 155 added lines, 0 removed lines. Original line number Diff line number Diff line import QtQuick import QtQuick.Controls import QtQuick.Layouts ColumnLayout { id: connPanel spacing: 8 property bool connected: false property string serverUrl: "" property string statusText: "Not connected" property color statusColor: Theme.textMuted Label { text: qsTr("Server Connection") font.bold: true font.pixelSize: 13 color: Theme.textPrimary Layout.fillWidth: true } /* Status indicator */ RowLayout { spacing: 6 Rectangle { width: 8; height: 8; radius: 4 color: connected ? Theme.success : Theme.textMuted } Label { text: statusText font.pixelSize: 12 color: statusColor Layout.fillWidth: true elide: Text.ElideRight } } Rectangle { Layout.fillWidth: true; height: 1; color: Theme.border } /* URL field */ Label { text: qsTr("Server URL") font.pixelSize: 11; color: Theme.textSecondary } TextField { id: urlField Layout.fillWidth: true placeholderText: "https://blog.example.com" font.pixelSize: 13; color: Theme.textPrimary text: serverUrl background: Rectangle { color: Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius } } /* Username */ Label { text: qsTr("Username") font.pixelSize: 11; color: Theme.textSecondary } TextField { id: userField Layout.fillWidth: true placeholderText: "admin" font.pixelSize: 13; color: Theme.textPrimary background: Rectangle { color: Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius } } /* Password */ Label { text: qsTr("Password") font.pixelSize: 11; color: Theme.textSecondary } TextField { id: passField Layout.fillWidth: true echoMode: TextInput.Password font.pixelSize: 13; color: Theme.textPrimary background: Rectangle { color: Theme.bgTertiary; border.color: Theme.border; radius: Theme.radius } Keys.onReturnPressed: connectBtn.clicked() } /* Connect / Disconnect button */ Button { id: connectBtn Layout.fillWidth: true text: connected ? qsTr("Disconnect") : qsTr("Connect") highlighted: true background: Rectangle { color: connected ? Theme.danger : Theme.accent radius: Theme.radius opacity: parent.hovered ? 0.9 : 1.0 } contentItem: Text { text: parent.text color: "#ffffff" font.pixelSize: 13; font.bold: true horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } onClicked: { if (connected) { localApi.disconnectServer() connected = false statusText = "Disconnected" statusColor = Theme.textMuted } else { if (urlField.text.length === 0) { statusText = "Enter a server URL" statusColor = Theme.warning return } statusText = "Connecting..." statusColor = Theme.textMuted localApi.connectToServer( urlField.text, userField.text, passField.text) } } } /* Publish button */ Button { Layout.fillWidth: true text: qsTr("Publish") enabled: connected opacity: enabled ? 1.0 : 0.5 background: Rectangle { color: Theme.accent radius: Theme.radius opacity: parent.enabled ? (parent.hovered ? 0.9 : 0.7) : 0.3 } contentItem: Text { text: parent.text color: "#ffffff" font.pixelSize: 13 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } onClicked: localApi.publishToServer() } Item { Layout.fillHeight: true } Connections { target: localApi function onConnectionStatusChanged(ok, msg) { connected = ok statusText = msg statusColor = ok ? Theme.success : Theme.danger if (ok) serverUrl = urlField.text } } }
client/qml/Main.qml +26 −3 Changes for client/qml/Main.qml: 26 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -60,18 +60,19 @@ ApplicationWindow { /* ---- Sidebar ---- */ ScrollView { SplitView.preferredWidth: 320 SplitView.preferredWidth: 280 SplitView.minimumWidth: 200 SplitView.maximumWidth: 600 SplitView.maximumWidth: 500 clip: true ColumnLayout { width: parent.width spacing: 0 /* Widgets */ /* Widgets (collapsed by default) */ SidebarSection { title: qsTr("Widgets") collapsed: true WidgetToolbar { id: widgetToolbar; Layout.fillWidth: true } } Loading Loading @@ -107,6 +108,28 @@ ApplicationWindow { id: previewFrame SplitView.fillWidth: true } /* ---- Connection Manager (right) ---- */ ScrollView { SplitView.preferredWidth: 240 SplitView.minimumWidth: 180 SplitView.maximumWidth: 400 clip: true Rectangle { width: parent.width implicitHeight: connLayout.implicitHeight + 24 color: Theme.bgSecondary ColumnLayout { id: connLayout anchors.fill: parent anchors.margins: 12 ConnectionPanel { Layout.fillWidth: true; Layout.fillHeight: true } } } } } function setStatus(msg) { statusLabel.text = msg } Loading