diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index b8d9d972..c333d8d8 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -994,8 +994,13 @@ void UBDocumentController::itemChanged(QTreeWidgetItem * item, int column) disconnect(UBPersistenceManager::persistenceManager(), SIGNAL(documentMetadataChanged(UBDocumentProxy*)) , this, SLOT(updateDocumentInTree(UBDocumentProxy*))); - if (proxyItem) - proxyItem->proxy()->setMetaData(UBSettings::documentName, item->text(column)); + if (proxyItem) { + if (proxyItem->proxy()->metaData(UBSettings::documentName).toString() != item->text(column)) { + // The item was renamed, we should persist it immediately + proxyItem->proxy()->setMetaData(UBSettings::documentName, item->text(column)); + UBPersistenceManager::persistenceManager()->persistDocumentMetadata(proxyItem->proxy()); + } + } else { // it is a group