diff --git a/AicsKnowledgeBase/qml/component/FileList.qml b/AicsKnowledgeBase/qml/component/FileList.qml index ab662a5..d1fdb2a 100644 --- a/AicsKnowledgeBase/qml/component/FileList.qml +++ b/AicsKnowledgeBase/qml/component/FileList.qml @@ -2,6 +2,7 @@ import QtQuick 2.15 import QtQuick.Layouts import FluentUI import "qrc:///AicsKnowledgeBase/qml/global" +import SignalFileOperation 1.0 Item { anchors.fill: parent @@ -163,7 +164,7 @@ Item { if (model.isDir) { listView.headerItem.add(model.title, model.uuid) } else { - emit: open(model.uuid) + emit: SignalFileOperation.open(model.uuid) } } } diff --git a/AicsKnowledgeBase/qml/global/SignalFileOperation.qml b/AicsKnowledgeBase/qml/global/SignalFileOperation.qml new file mode 100644 index 0000000..e60ce30 --- /dev/null +++ b/AicsKnowledgeBase/qml/global/SignalFileOperation.qml @@ -0,0 +1,8 @@ +pragma Singleton + +import QtQuick + +QtObject { + signal open(string file) + signal openNote(string note) +} diff --git a/AicsKnowledgeBase/qml/page/ContentPage.qml b/AicsKnowledgeBase/qml/page/ContentPage.qml index debb554..aec6663 100644 --- a/AicsKnowledgeBase/qml/page/ContentPage.qml +++ b/AicsKnowledgeBase/qml/page/ContentPage.qml @@ -6,12 +6,14 @@ import QtQuick.Controls.Basic import QtWebEngine 1.2 import FluentUI import AicsKB.FileTransferManager +import SignalFileOperation 1.0 import "qrc:///AicsKnowledgeBase/qml/page" FluArea { id: content_area paddings: 0 backgroundColor: "#f9f9f9" + visible: false property string type: "" property string knowledgeFileId signal download(string knowledgeFileId) @@ -23,6 +25,13 @@ FluArea { // bottom: 10 // left: 10 // } + Connections { + target: SignalFileOperation + function onOpen(file) { + content_area.visible = true + } + } + FluScrollablePage { id: content_page anchors.fill: parent diff --git a/AicsKnowledgeBase/src/main.cpp b/AicsKnowledgeBase/src/main.cpp index ef750eb..90a4c4f 100644 --- a/AicsKnowledgeBase/src/main.cpp +++ b/AicsKnowledgeBase/src/main.cpp @@ -54,6 +54,8 @@ int main(int argc, char *argv[]) qmlRegisterSingletonInstance("AicsKB.FileTransferManager", 1, 0, "FileTransferManager", fileTransferManager); + qmlRegisterSingletonType(QUrl("qrc:/AicsKnowledgeBase/qml/global/SignalFileOperation.qml"), "SignalFileOperation", 1, 0, + "SignalFileOperation"); const QUrl url(u"qrc:/AicsKnowledgeBase/qml/App.qml"_qs); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,