Commit 792587c5 authored by jan.koester's avatar jan.koester
Browse files

test

parent e09333b8
Loading
Loading
Loading
Loading

editor/CMakeLists.txt.orig

deleted100644 → 0
+0 −71
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.18)

find_package(Qt6 REQUIRED COMPONENTS Core Widgets Quick QuickControls2 WebEngineQuick Network)
qt_standard_project_setup()
qt_policy(SET QTP0001 NEW)
qt_policy(SET QTP0004 OLD)

set(CMAKE_AUTOMOC ON)

qt_add_executable(blogi-editor
    main.cpp
    documentmanager.cpp
    documentmanager.h
    htmlimport.cpp
    htmlimport.h
    edit.cpp
    edit.h
    publishclient.cpp
    publishclient.h
    localapi.cpp
    localapi.h
    themeprovider.h
    authimageprovider.cpp
    authimageprovider.h
    gitfilesystemmodel.cpp
    gitfilesystemmodel.h
)

qt_add_qml_module(blogi-editor
    URI BlogiEditor
    VERSION 1.0
    QML_FILES
        qml/Main.qml
        qml/SidebarSection.qml
        qml/WidgetToolbar.qml
        qml/DocumentTree.qml
        qml/PropertyPanel.qml
        qml/PreviewPane.qml
        qml/ConnectionPanel.qml
        qml/FileBrowserTab.qml
        qml/MediaBrowser.qml
        qml/PublishDialog.qml
        qml/publishhelper.js
        qml/AiPromptDialog.qml
)

target_link_libraries(blogi-editor PRIVATE
    Qt6::Core
    Qt6::Widgets
    Qt6::Quick
    Qt6::QuickControls2
    Qt6::WebEngineQuick
    Qt6::Network
    blogidev
    tinyxml2::tinyxml2
    json-c::json-c
    uuidp::uuidp
    htmlpp::htmlpp
)

target_include_directories(blogi-editor PRIVATE
    ${CMAKE_SOURCE_DIR}/src
)

target_compile_definitions(blogi-editor PRIVATE
    WEBEDIT_PLUGIN_DIR="${CMAKE_INSTALL_PREFIX}/lib/blogi/plugins/webedit"
)

add_subdirectory(widgets)

install(TARGETS blogi-editor DESTINATION bin)

editor/localapi.cpp.orig

deleted100644 → 0
+0 −775

File deleted.

Preview size limit exceeded, changes collapsed.

editor/localapi.cpp.rej

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
--- localapi.h
+++ localapi.h
@@ -51,6 +51,7 @@
     Q_INVOKABLE void renderPreviewOnServer(bool mobile, const QString &target, const QString &paramsJson);
 
+    Q_INVOKABLE QString readFile(const QString &filename);
+
     /* Media browse (requires connection) */
     Q_INVOKABLE void fetchAlbums();
     Q_INVOKABLE void fetchMedia(const QString &albumId);
--- /home/intranet.tuxist.de/jan.koester/Projects/blogi/editor/localapi.cpp

editor/localapi.h.orig

deleted100644 → 0
+0 −147
Original line number Diff line number Diff line
/*******************************************************************************
 * Copyright (c) 2026, Jan Koester jan.koester@gmx.net
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 * Neither the name of the <organization> nor the
 *      names of its contributors may be used to endorse or promote products
 *      derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *******************************************************************************/

#pragma once

#include <QObject>
#include <QString>
#include "gitfilesystemmodel.h"

class DocumentManager;
class PublishClient;

/*
 * LocalApi — exposed to QML as context property "localApi".
 */
class LocalApi : public QObject {
    Q_OBJECT
public:
    explicit LocalApi(DocumentManager *doc, PublishClient *pub, QObject *parent = nullptr);

    /* Plugin types */
    Q_INVOKABLE QString getPluginTypes();

    /* Filesystem Tree Model */
    Q_INVOKABLE GitFileSystemModel* fileSystemModel();
    Q_INVOKABLE void setFileSystemRoot(const QString &path);

    /* Document tree */
    Q_INVOKABLE QString getDocTree();

    /* Element manipulation */
    Q_INVOKABLE QString addElement(const QString &parentUuid, const QString &pluginName, int position);
    Q_INVOKABLE QString removeElement(const QString &uuid);
    Q_INVOKABLE QString moveUp(const QString &uuid);
    Q_INVOKABLE QString moveDown(const QString &uuid);
    Q_INVOKABLE QString indent(const QString &uuid);
    Q_INVOKABLE QString outdent(const QString &uuid);
    Q_INVOKABLE QString copyElement(const QString &uuid);
    Q_INVOKABLE QString pasteElement(const QString &targetUuid);

    /* Properties */
    Q_INVOKABLE QString getElementProperties(const QString &uuid);
    Q_INVOKABLE QString setElementProperties(const QString &uuid, const QString &propsJson);

    /* Export/Import */
    Q_INVOKABLE QString exportXml();
    Q_INVOKABLE bool importXml(const QString &xml);
    Q_INVOKABLE QString renderPreview();
    Q_INVOKABLE void renderPreviewOnServer(bool mobile, const QString &target, const QString &paramsJson);

    /* Media browse (requires connection) */
    Q_INVOKABLE void fetchAlbums();
    Q_INVOKABLE void fetchMedia(const QString &albumId);

    /* Theme colors (requires connection) */
    Q_INVOKABLE void fetchThemeColors();

    /* Survey list (requires connection) */
    Q_INVOKABLE void fetchSurveyList();

    /* Publish (requires connection) */
    Q_INVOKABLE void fetchPublishTargets();
    Q_INVOKABLE void publishToTarget(const QString &target, const QString &paramsJson);
    Q_INVOKABLE void publishToTargetOverwrite(const QString &target, const QString &paramsJson, const QString &existingId);
    Q_INVOKABLE QString collectRepeaterParams(QObject *repeater);
    Q_INVOKABLE QString jsonSet(const QString &json, const QString &key, const QString &value);

    /* File Browser */
    Q_INVOKABLE QString getLastBrowserFolder();
    Q_INVOKABLE void setLastBrowserFolder(const QString &path);
    Q_INVOKABLE bool createBrowserFolder(const QString &parentPath, const QString &name);
    Q_INVOKABLE bool createBrowserFile(const QString &parentPath, const QString &name);
    Q_INVOKABLE bool renameBrowserFile(const QString &oldPath, const QString &newName);
    Q_INVOKABLE bool deleteBrowserFile(const QString &path);
    Q_INVOKABLE bool deleteBrowserFolder(const QString &path);
    Q_INVOKABLE QString openFolderDialog();

    /* File operations (called from QML menus) */
    Q_INVOKABLE void newDocument();
    Q_INVOKABLE void openDocument();
    Q_INVOKABLE void importHtmlFile();
    Q_INVOKABLE void exportHtmlFile();
    Q_INVOKABLE QString generateAiPrompt(const QString &userRequest);
    Q_INVOKABLE void saveDocument();
    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();
    Q_INVOKABLE void abortConnection();
    Q_INVOKABLE void setIgnoreSslErrors(bool ignore);
    Q_INVOKABLE QString serverUrl() const;

    /* Saved connections CRUD */
    Q_INVOKABLE QString getSavedConnections();
    Q_INVOKABLE void    saveConnection(const QString &name, const QString &url, const QString &user, const QString &password, bool ignoreSsl);
    Q_INVOKABLE void    updateConnection(const QString &oldName, const QString &name, const QString &url, const QString &user, const QString &password, bool ignoreSsl);
    Q_INVOKABLE void    deleteConnection(const QString &name);

    /* Initial load */
    Q_INVOKABLE void refresh();

signals:
    void documentChanged();
    void statusMessage(const QString &msg);
    void currentFileChanged(const QString &path);
    void connectionStatusChanged(bool ok, const QString &msg);
    void serverPreviewReady(const QString &html);
    void albumsLoaded(const QString &json);
    void mediaLoaded(const QString &json);
    void publishTargetsLoaded(const QString &json);
    void publishCompleted(bool ok, const QString &msg);
    void themeColorsLoaded(const QString &json);
    void surveyListLoaded(const QString &json);
    void savedConnectionsChanged();

private:
    DocumentManager *_doc;
    PublishClient   *_pub;
    QString          _currentFile;
    GitFileSystemModel *_fsModel;
};
+0 −757

File deleted.

Preview size limit exceeded, changes collapsed.

Loading