diff --git a/src/vfilelist.cpp b/src/vfilelist.cpp index 568e5bb7..cda755f5 100644 --- a/src/vfilelist.cpp +++ b/src/vfilelist.cpp @@ -262,9 +262,15 @@ void VFileList::fillItem(QListWidgetItem *p_item, const VNoteFile *p_file) { qulonglong ptr = (qulonglong)p_file; p_item->setData(Qt::UserRole, ptr); - p_item->setToolTip(p_file->getName()); p_item->setText(p_file->getName()); + QString createdTime = VUtils::displayDateTime(p_file->getCreatedTimeUtc().toLocalTime()); + QString modifiedTime = VUtils::displayDateTime(p_file->getModifiedTimeUtc().toLocalTime()); + QString tooltip = tr("%1\n\nCreated Time: %2\nModified Time: %3") + .arg(p_file->getName()) + .arg(createdTime) + .arg(modifiedTime); + p_item->setToolTip(tooltip); V_ASSERT(sizeof(p_file) <= sizeof(ptr)); } diff --git a/src/vnotefile.cpp b/src/vnotefile.cpp index 72753657..9981a543 100644 --- a/src/vnotefile.cpp +++ b/src/vnotefile.cpp @@ -164,9 +164,9 @@ QJsonObject VNoteFile::toConfigJson() const // Attachments. QJsonArray attachmentJson; for (int i = 0; i < m_attachments.size(); ++i) { - const VAttachment &item = m_attachments[i]; + const VAttachment &att = m_attachments[i]; QJsonObject attachmentItem; - attachmentItem[DirConfig::c_name] = item.m_name; + attachmentItem[DirConfig::c_name] = att.m_name; attachmentJson.append(attachmentItem); } @@ -652,3 +652,17 @@ bool VNoteFile::addTag(const QString &p_tag) return true; } + +bool VNoteFile::save() +{ + bool ret = VFile::save(); + if (ret) { + if (!getDirectory()->updateFileConfig(this)) { + qWarning() << "fail to update config of file" << m_name + << "in directory" << fetchBasePath(); + ret = false; + } + } + + return ret; +} diff --git a/src/vnotefile.h b/src/vnotefile.h index b432f586..b95ef855 100644 --- a/src/vnotefile.h +++ b/src/vnotefile.h @@ -47,6 +47,8 @@ public: QString getImageFolderInLink() const Q_DECL_OVERRIDE; + bool save() Q_DECL_OVERRIDE; + // Set the name of this file. void setName(const QString &p_name);