mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 22:09:52 +08:00
FileList: bug fix when importing the same note file in the same folder
This commit is contained in:
parent
88d719bb28
commit
feea50d888
@ -44,7 +44,10 @@ bool VFile::open()
|
|||||||
Q_ASSERT(m_content.isEmpty());
|
Q_ASSERT(m_content.isEmpty());
|
||||||
|
|
||||||
QString filePath = fetchPath();
|
QString filePath = fetchPath();
|
||||||
Q_ASSERT(QFileInfo::exists(filePath));
|
if (!QFileInfo::exists(filePath)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_content = VUtils::readFileFromDisk(filePath);
|
m_content = VUtils::readFileFromDisk(filePath);
|
||||||
m_lastModified = QFileInfo(filePath).lastModified();
|
m_lastModified = QFileInfo(filePath).lastModified();
|
||||||
m_opened = true;
|
m_opened = true;
|
||||||
|
@ -771,6 +771,16 @@ bool VFileList::importFiles(const QStringList &p_files, QString *p_errMsg)
|
|||||||
|
|
||||||
bool copyNeeded = true;
|
bool copyNeeded = true;
|
||||||
if (VUtils::equalPath(dirPath, fi.absolutePath())) {
|
if (VUtils::equalPath(dirPath, fi.absolutePath())) {
|
||||||
|
// Check if it is already a note.
|
||||||
|
if (m_directory->findFile(name, false)) {
|
||||||
|
VUtils::addErrMsg(p_errMsg, tr("Skip importing file %1. "
|
||||||
|
"A note with the same name (case-insensitive) "
|
||||||
|
"in the same directory already exists.")
|
||||||
|
.arg(file));
|
||||||
|
ret = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
qDebug() << "skip cpoy file" << file << "locates in" << dirPath;
|
qDebug() << "skip cpoy file" << file << "locates in" << dirPath;
|
||||||
copyNeeded = false;
|
copyNeeded = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user