mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
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.
This commit is contained in:
parent
9e20f1b0a6
commit
9d76d1f06b
@ -86,19 +86,28 @@ void BufferMgr::open(const QString &p_filePath, const QSharedPointer<FileOpenPar
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
QFileInfo info(p_filePath);
|
||||
if (!info.exists() || info.isDir()) {
|
||||
qWarning() << QString("failed to open file %1 exists:%2 isDir:%3").arg(p_filePath).arg(info.exists()).arg(info.isDir());
|
||||
QFileInfo finfo(p_filePath);
|
||||
if (!finfo.exists()) {
|
||||
qWarning() << QString("failed to open file %1 that does not exist").arg(p_filePath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if it is an internal node or not.
|
||||
auto node = loadNodeByPath(p_filePath);
|
||||
if (node) {
|
||||
if (node->getType() == 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;
|
||||
}
|
||||
|
||||
auto buffer = findBuffer(p_filePath);
|
||||
|
@ -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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user