NotebookExplorer: use root node if it is recycle bin node on new file

This commit is contained in:
Le Tan 2020-12-06 10:28:09 +08:00
parent 52de2eee6c
commit aced51baff
2 changed files with 14 additions and 10 deletions

View File

@ -1,6 +1,8 @@
# vnote
A pleasant note-taking platform.
![CI-Windows](https://github.com/vnotex/vnote/workflows/CI-Windows/badge.svg) ![CI-Linux](https://github.com/vnotex/vnote/workflows/CI-Linux/badge.svg)
> At early 2019, I decided to refactor VNote as VNoteX. Now a fresh VNote is ready!
> VNoteX is closed source and is intended to keep several premium features compared to VNote. Most of VNoteX's code base will be open source as VNote 3.0, so VNote will share most of the code base with VNoteX and continue to be open source from 3.0.
> **Welcome to VNoteX and VNote 3.0!**
@ -14,8 +16,6 @@ The obsolete code base of VNote 2.0 is available at the [vnote2.0](https://githu
For more information, please visit [**VNote's Homepage**](https://vnotex.github.io/vnote).
![CI-Win](https://github.com/vnotex/vnote/workflows/CI-Win/badge.svg) ![CI-Linux](https://github.com/vnotex/vnote/workflows/CI-Linux/badge.svg)
![VNote](pics/vnote.png)
## Description

View File

@ -200,8 +200,9 @@ void NotebookExplorer::newFolder()
return;
}
if (m_currentNotebook->isRecycleBinNode(node)
|| m_currentNotebook->isNodeInRecycleBin(node)) {
if (m_currentNotebook->isRecycleBinNode(node)) {
node = m_currentNotebook->getRootNode().data();
} else if (m_currentNotebook->isNodeInRecycleBin(node)) {
MessageBoxHelper::notify(MessageBoxHelper::Information,
tr("Could not create folder within Recycle Bin."),
VNoteX::getInst().getMainWindow());
@ -221,8 +222,9 @@ void NotebookExplorer::newNote()
return;
}
if (m_currentNotebook->isRecycleBinNode(node)
|| m_currentNotebook->isNodeInRecycleBin(node)) {
if (m_currentNotebook->isRecycleBinNode(node)) {
node = m_currentNotebook->getRootNode().data();
} else if (m_currentNotebook->isNodeInRecycleBin(node)) {
MessageBoxHelper::notify(MessageBoxHelper::Information,
tr("Could not create note within Recycle Bin."),
VNoteX::getInst().getMainWindow());
@ -285,8 +287,9 @@ void NotebookExplorer::importFile()
return;
}
if (m_currentNotebook->isRecycleBinNode(node)
|| m_currentNotebook->isNodeInRecycleBin(node)) {
if (m_currentNotebook->isRecycleBinNode(node)) {
node = m_currentNotebook->getRootNode().data();
} else if (m_currentNotebook->isNodeInRecycleBin(node)) {
MessageBoxHelper::notify(MessageBoxHelper::Information,
tr("Could not create file within Recycle Bin."),
VNoteX::getInst().getMainWindow());
@ -325,8 +328,9 @@ void NotebookExplorer::importFolder()
return;
}
if (m_currentNotebook->isRecycleBinNode(node)
|| m_currentNotebook->isNodeInRecycleBin(node)) {
if (m_currentNotebook->isRecycleBinNode(node)) {
node = m_currentNotebook->getRootNode().data();
} else if (m_currentNotebook->isNodeInRecycleBin(node)) {
MessageBoxHelper::notify(MessageBoxHelper::Information,
tr("Could not create folder within Recycle Bin."),
VNoteX::getInst().getMainWindow());