| 322 | |
| 323 | |
| 324 | void UBDocumentTreeWidget::documentUpdated(UBDocumentProxy *pDocument) |
| 325 | { |
| 326 | UBDocumentProxyTreeItem *treeItem = UBApplication::documentController->findDocument(pDocument); |
| 327 | if (treeItem) |
| 328 | { |
| 329 | QTreeWidgetItem * parent = treeItem->parent(); |
| 330 | |
| 331 | if (parent) |
| 332 | { |
| 333 | for (int i = 0; i < parent->indexOfChild(treeItem); i++) |
| 334 | { |
| 335 | QTreeWidgetItem *ti = parent->child(i); |
| 336 | UBDocumentProxyTreeItem* pi = dynamic_cast<UBDocumentProxyTreeItem*>(ti); |
| 337 | if (pi) |
| 338 | { |
| 339 | if (pDocument->metaData(UBSettings::documentDate).toString() >= pi->proxy()->metaData(UBSettings::documentDate).toString()) |
| 340 | { |
| 341 | bool selected = treeItem->isSelected(); |
| 342 | parent->removeChild(treeItem); |
| 343 | parent->insertChild(i, treeItem); |
| 344 | for (int j = 0; j < selectedItems().count(); j++) |
| 345 | selectedItems().at(j)->setSelected(false); |
| 346 | if (selected) |
| 347 | treeItem->setSelected(true); |
| 348 | break; |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * @brief Move a document to the specified destination folder |
nothing calls this directly
no test coverage detected