mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 22:09: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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
QFileInfo finfo(p_filePath);
|
||||||
QFileInfo info(p_filePath);
|
if (!finfo.exists()) {
|
||||||
if (!info.exists() || info.isDir()) {
|
qWarning() << QString("failed to open file %1 that does not exist").arg(p_filePath);
|
||||||
qWarning() << QString("failed to open file %1 exists:%2 isDir:%3").arg(p_filePath).arg(info.exists()).arg(info.isDir());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Check if it is an internal node or not.
|
// Check if it is an internal node or not.
|
||||||
auto node = loadNodeByPath(p_filePath);
|
auto node = loadNodeByPath(p_filePath);
|
||||||
if (node) {
|
if (node) {
|
||||||
|
if (node->getType() == Node::File) {
|
||||||
open(node.data(), p_paras);
|
open(node.data(), p_paras);
|
||||||
return;
|
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);
|
auto buffer = findBuffer(p_filePath);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
using namespace vnotex;
|
using namespace vnotex;
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
#define VX_DEBUG_WEB
|
// #define VX_DEBUG_WEB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const QString ConfigMgr::c_orgName = "VNote";
|
const QString ConfigMgr::c_orgName = "VNote";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user