From dcb20ca25182635a03ff60c407ae725931a6aa35 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Tue, 22 Mar 2016 08:16:54 +0100 Subject: [PATCH] Fix documents not being renamed correctly (new name wasn't persisted) --- src/document/UBDocumentController.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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