From 9d76d1f06b47c936b8f447e83ea0a709a4685208 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Wed, 13 Jan 2021 21:46:25 +0800 Subject: [PATCH] support opening link to folder in read mode If it is a folder node, then locate to it. Otherwise, open it in the file browser of OS. --- src/core/buffermgr.cpp | 23 ++++++++++++++++------- src/core/configmgr.cpp | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/core/buffermgr.cpp b/src/core/buffermgr.cpp index fc687df2..48ac861a 100644 --- a/src/core/buffermgr.cpp +++ b/src/core/buffermgr.cpp @@ -86,18 +86,27 @@ void BufferMgr::open(const QString &p_filePath, const QSharedPointergetType() == Node::File) { + open(node.data(), p_paras); + return; + } else { + // Folder node. Currently just locate to it. + emit VNoteX::getInst().locateNodeRequested(node.data()); + return; + } + } + + if (finfo.isDir()) { + WidgetUtils::openUrlByDesktop(QUrl::fromLocalFile(p_filePath)); return; } diff --git a/src/core/configmgr.cpp b/src/core/configmgr.cpp index f042c3e1..1fcad027 100644 --- a/src/core/configmgr.cpp +++ b/src/core/configmgr.cpp @@ -24,7 +24,7 @@ using namespace vnotex; #ifndef QT_NO_DEBUG -#define VX_DEBUG_WEB +// #define VX_DEBUG_WEB #endif const QString ConfigMgr::c_orgName = "VNote";