diff --git a/src/data/extra/docs/en/about_vnotex.txt b/src/data/extra/docs/en/about_vnotex.txt index def88b95..6ccba5ad 100644 --- a/src/data/extra/docs/en/about_vnotex.txt +++ b/src/data/extra/docs/en/about_vnotex.txt @@ -1,5 +1,5 @@

-VNoteX is designed to be a pleasant note-taking platform, refactored from VNote, which is an open source note-taking application for Markdown since 2016. VNote shares most of the code base with VNoteX since version 3.0 and continue to be open source. +VNoteX is designed to be a pleasant note-taking platform, refactored from VNote, which is an open source note-taking application for Markdown since 2016. VNote shares most of the code base with VNoteX since version 3 and continue to be open source.

Source code of VNote could be found at GitHub.

diff --git a/src/data/extra/docs/zh_CN/about_vnotex.txt b/src/data/extra/docs/zh_CN/about_vnotex.txt index 10a93f5d..2363c50a 100644 --- a/src/data/extra/docs/zh_CN/about_vnotex.txt +++ b/src/data/extra/docs/zh_CN/about_vnotex.txt @@ -1,5 +1,5 @@

-VNoteX 致力于成为一个舒适的笔记平台。VNoteX 重构自 VNote,后者是一个始于2016年的专注于 Markdown 的开源笔记软件。VNote 3.0 会和 VNoteX 共享大部分源代码,并继续开源。 +VNoteX 致力于成为一个舒适的笔记平台。VNoteX 重构自 VNote,后者是一个始于2016年的专注于 Markdown 的开源笔记软件。VNote 在版本3之后会和 VNoteX 共享大部分源代码,并继续开源。

VNote 源代码可以在 GitHub 获取。

diff --git a/src/widgets/notebooknodeexplorer.cpp b/src/widgets/notebooknodeexplorer.cpp index 2aa676a0..122ca0fa 100644 --- a/src/widgets/notebooknodeexplorer.cpp +++ b/src/widgets/notebooknodeexplorer.cpp @@ -238,16 +238,7 @@ void NotebookNodeExplorer::setupMasterExplorer(QWidget *p_parent) NavigationModeMgr::getInst().registerNavigationTarget(m_navigationWrapper.data()); connect(m_masterExplorer, &QTreeWidget::itemExpanded, - this, [this](QTreeWidgetItem *p_item) { - auto cnt = p_item->childCount(); - for (int i = 0; i < cnt; ++i) { - auto child = p_item->child(i); - auto data = getItemNodeData(child); - if (data.isNode() && !data.isLoaded()) { - loadNode(child, data.getNode(), 1); - } - } - }); + this, &NotebookNodeExplorer::loadItemChildren); connect(m_masterExplorer, &QTreeWidget::customContextMenuRequested, this, [this](const QPoint &p_pos) { @@ -421,8 +412,13 @@ void NotebookNodeExplorer::loadNode(QTreeWidgetItem *p_item, Node *p_node, int p loadChildren(p_item, p_node, p_level - 1); - if (stateCache()->contains(p_item)) { - p_item->setExpanded(true); + if (stateCache()->contains(p_item) && p_item->childCount() > 0) { + if (p_item->isExpanded()) { + loadItemChildren(p_item); + } else { + // itemExpanded() will trigger loadItemChildren(). + p_item->setExpanded(true); + } } } @@ -2050,3 +2046,15 @@ void NotebookNodeExplorer::openSelectedNodesWithExternalProgram(const QString &p ProcessUtils::startDetached(command); } } + +void NotebookNodeExplorer::loadItemChildren(QTreeWidgetItem *p_item) const +{ + auto cnt = p_item->childCount(); + for (int i = 0; i < cnt; ++i) { + auto child = p_item->child(i); + auto data = getItemNodeData(child); + if (data.isNode() && !data.isLoaded()) { + loadNode(child, data.getNode(), 1); + } + } +} diff --git a/src/widgets/notebooknodeexplorer.h b/src/widgets/notebooknodeexplorer.h index 8f0f2541..d5a28e68 100644 --- a/src/widgets/notebooknodeexplorer.h +++ b/src/widgets/notebooknodeexplorer.h @@ -169,6 +169,8 @@ namespace vnotex void loadChildren(QTreeWidgetItem *p_item, Node *p_node, int p_level) const; + void loadItemChildren(QTreeWidgetItem *p_item) const; + void loadNode(QTreeWidgetItem *p_item, const QSharedPointer &p_node) const; void loadRecycleBinNode(Node *p_node) const;