MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / documentUpdated

Method documentUpdated

src/gui/UBDocumentTreeWidget.cpp:324–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322
323
324void 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

Callers

nothing calls this directly

Calls 7

findDocumentMethod · 0.80
metaDataMethod · 0.80
insertChildMethod · 0.80
parentMethod · 0.45
proxyMethod · 0.45
removeChildMethod · 0.45
setSelectedMethod · 0.45

Tested by

no test coverage detected