mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
VNoteFile: update config file after save() to update the modified time
This commit is contained in:
parent
6f1a0c6980
commit
42fbdace55
@ -262,9 +262,15 @@ void VFileList::fillItem(QListWidgetItem *p_item, const VNoteFile *p_file)
|
|||||||
{
|
{
|
||||||
qulonglong ptr = (qulonglong)p_file;
|
qulonglong ptr = (qulonglong)p_file;
|
||||||
p_item->setData(Qt::UserRole, ptr);
|
p_item->setData(Qt::UserRole, ptr);
|
||||||
p_item->setToolTip(p_file->getName());
|
|
||||||
p_item->setText(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));
|
V_ASSERT(sizeof(p_file) <= sizeof(ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,9 +164,9 @@ QJsonObject VNoteFile::toConfigJson() const
|
|||||||
// Attachments.
|
// Attachments.
|
||||||
QJsonArray attachmentJson;
|
QJsonArray attachmentJson;
|
||||||
for (int i = 0; i < m_attachments.size(); ++i) {
|
for (int i = 0; i < m_attachments.size(); ++i) {
|
||||||
const VAttachment &item = m_attachments[i];
|
const VAttachment &att = m_attachments[i];
|
||||||
QJsonObject attachmentItem;
|
QJsonObject attachmentItem;
|
||||||
attachmentItem[DirConfig::c_name] = item.m_name;
|
attachmentItem[DirConfig::c_name] = att.m_name;
|
||||||
attachmentJson.append(attachmentItem);
|
attachmentJson.append(attachmentItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -652,3 +652,17 @@ bool VNoteFile::addTag(const QString &p_tag)
|
|||||||
|
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
|
@ -47,6 +47,8 @@ public:
|
|||||||
|
|
||||||
QString getImageFolderInLink() const Q_DECL_OVERRIDE;
|
QString getImageFolderInLink() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
bool save() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
// Set the name of this file.
|
// Set the name of this file.
|
||||||
void setName(const QString &p_name);
|
void setName(const QString &p_name);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user