mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
FileList: fix context menu and do not open new file in unkown type
This commit is contained in:
parent
de1e6ed3fa
commit
b3555cffba
@ -659,14 +659,14 @@ void VFileList::contextMenuRequested(QPoint pos)
|
|||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
if (selectedSize == 1) {
|
if (selectedSize == 1) {
|
||||||
QAction *openLocationAct = new QAction(VIconUtils::menuIcon(":/resources/icons/open_location.svg"),
|
QAction *openLocationAct = new QAction(VIconUtils::menuIcon(":/resources/icons/open_location.svg"),
|
||||||
tr("&Open Note Location"),
|
tr("Open Note &Location"),
|
||||||
&menu);
|
&menu);
|
||||||
openLocationAct->setToolTip(tr("Explore the folder containing this note in operating system"));
|
openLocationAct->setToolTip(tr("Explore the folder containing this note in operating system"));
|
||||||
connect(openLocationAct, &QAction::triggered,
|
connect(openLocationAct, &QAction::triggered,
|
||||||
this, &VFileList::openFileLocation);
|
this, &VFileList::openFileLocation);
|
||||||
menu.addAction(openLocationAct);
|
menu.addAction(openLocationAct);
|
||||||
|
|
||||||
QAction *copyPathAct = new QAction(tr("Copy File Path"), &menu);
|
QAction *copyPathAct = new QAction(tr("Copy File &Path"), &menu);
|
||||||
connect(copyPathAct, &QAction::triggered,
|
connect(copyPathAct, &QAction::triggered,
|
||||||
this, [this]() {
|
this, [this]() {
|
||||||
QList<QListWidgetItem *> items = fileList->selectedItems();
|
QList<QListWidgetItem *> items = fileList->selectedItems();
|
||||||
|
@ -276,7 +276,14 @@ void VMainWindow::setupUI()
|
|||||||
connect(m_fileList, &VFileList::fileClicked,
|
connect(m_fileList, &VFileList::fileClicked,
|
||||||
m_editArea, &VEditArea::openFile);
|
m_editArea, &VEditArea::openFile);
|
||||||
connect(m_fileList, &VFileList::fileCreated,
|
connect(m_fileList, &VFileList::fileCreated,
|
||||||
m_editArea, &VEditArea::openFile);
|
m_editArea, [this](VNoteFile *p_file,
|
||||||
|
OpenFileMode p_mode,
|
||||||
|
bool p_forceMode) {
|
||||||
|
if (p_file->getDocType() == DocType::Markdown
|
||||||
|
|| p_file->getDocType() == DocType::Html) {
|
||||||
|
m_editArea->openFile(p_file, p_mode, p_forceMode);
|
||||||
|
}
|
||||||
|
});
|
||||||
connect(m_fileList, &VFileList::fileUpdated,
|
connect(m_fileList, &VFileList::fileUpdated,
|
||||||
m_editArea, &VEditArea::handleFileUpdated);
|
m_editArea, &VEditArea::handleFileUpdated);
|
||||||
connect(m_editArea, &VEditArea::tabStatusUpdated,
|
connect(m_editArea, &VEditArea::tabStatusUpdated,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user