update 'updated-at' metadata when moving a document to trash (as it is done on the metadata.rdf file)

preferencesAboutTextFull
Clément Fauconnier 5 years ago
parent 1dadb21212
commit 84fad66614
  1. 2
      src/document/UBDocumentController.cpp
  2. 2
      src/document/UBDocumentProxy.cpp

@ -942,7 +942,6 @@ void UBDocumentTreeModel::moveIndexes(const QModelIndexList &source, const QMode
fixNodeName(s, destinationParent); fixNodeName(s, destinationParent);
sourceNode->parentNode()->moveChild(sourceNode, destIndex, newParentNode); sourceNode->parentNode()->moveChild(sourceNode, destIndex, newParentNode);
updateIndexNameBindings(sourceNode); updateIndexNameBindings(sourceNode);
hasOneInsertion = true; hasOneInsertion = true;
} }
} }
@ -1224,6 +1223,7 @@ void UBDocumentTreeModel::updateIndexNameBindings(UBDocumentTreeNode *nd)
} else if (nd->proxyData()) { } else if (nd->proxyData()) {
nd->proxyData()->setMetaData(UBSettings::documentGroupName, virtualPathForIndex(indexForNode(nd->parentNode()))); nd->proxyData()->setMetaData(UBSettings::documentGroupName, virtualPathForIndex(indexForNode(nd->parentNode())));
nd->proxyData()->setMetaData(UBSettings::documentName, nd->nodeName()); nd->proxyData()->setMetaData(UBSettings::documentName, nd->nodeName());
nd->proxyData()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
UBPersistenceManager::persistenceManager()->persistDocumentMetadata(nd->proxyData()); UBPersistenceManager::persistenceManager()->persistDocumentMetadata(nd->proxyData());
} }
} }

@ -260,7 +260,7 @@ QDateTime UBDocumentProxy::lastUpdate()
{ {
if(mMetaDatas.contains(UBSettings::documentUpdatedAt)) if(mMetaDatas.contains(UBSettings::documentUpdatedAt))
return UBStringUtils::fromUtcIsoDate(metaData(UBSettings::documentUpdatedAt).toString()); return UBStringUtils::fromUtcIsoDate(metaData(UBSettings::documentUpdatedAt).toString());
return QDateTime().currentDateTime(); return QDateTime::currentDateTime();
} }
bool UBDocumentProxy::isModified() const bool UBDocumentProxy::isModified() const

Loading…
Cancel
Save