Changeset 83920 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 22, 2020 11:27:59 AM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp
r83900 r83920 409 409 const QUuid &uMachineId, const bool fRegistered) 410 410 { 411 /* Compose full group name: */ 412 const QString strGroupName = QString("/%1/%2").arg(strProviderShortName, strProfileName); 413 411 414 /* Existing VM unregistered? */ 412 415 if (!fRegistered) … … 414 417 /* Remove machine-items with passed id: */ 415 418 invisibleRoot()->removeAllNodes(uMachineId); 416 /// @todo make sure there is fake item if no real item exist, never wipe out empty groups ..417 419 } 418 420 /* New VM registered? */ … … 420 422 { 421 423 /* Add new machine-item: */ 422 const QString strGroupName = QString("/%1/%2").arg(strProviderShortName, strProfileName);423 424 const CCloudMachine comMachine = cloudMachineById(strProviderShortName, strProfileName, uMachineId); 424 425 addCloudMachineIntoTheTree(strGroupName, comMachine, true /* make it visible */); 425 /// @todo make sure there is no fake item if at least one real item exists .. 426 } 427 428 /* Search for corresponding profile node: */ 429 QList<UIChooserNode*> profileNodes; 430 invisibleRoot()->searchForNodes(strGroupName, UIChooserItemSearchFlag_Group | UIChooserItemSearchFlag_ExactId, profileNodes); 431 if (!profileNodes.isEmpty()) 432 { 433 /* Acquire corresponding profile node: */ 434 UIChooserNodeGroup *pProfileNode = profileNodes.first()->toGroupNode(); 435 if (pProfileNode) 436 { 437 /* Add fake cloud VM item if necessary: */ 438 if (!fRegistered && pProfileNode->nodes(UIChooserNodeType_Machine).isEmpty()) 439 { 440 UIChooserNodeMachine *pFakeNode = new UIChooserNodeMachine(pProfileNode /* parent */, 441 false /* favorite */, 442 0 /* position */); 443 pFakeNode->toMachineNode()->cache()->toCloud()->setFakeCloudItemState(UIVirtualMachineItemCloud::FakeCloudItemState_Done); 444 pFakeNode->toMachineNode()->cache()->toCloud()->recache(); 445 } 446 /* Remove fake cloud VM item otherwise: */ 447 else if (fRegistered && !pProfileNode->nodes(UIChooserNodeType_Machine).isEmpty()) 448 { 449 /* Search for corresponding fake node: */ 450 QList<UIChooserNode*> fakeNodes; 451 pProfileNode->searchForNodes(toOldStyleUuid(QUuid()), UIChooserItemSearchFlag_Machine | UIChooserItemSearchFlag_ExactId, fakeNodes); 452 if (!fakeNodes.isEmpty()) 453 delete fakeNodes.first(); 454 } 455 } 426 456 } 427 457 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r83906 r83920 686 686 if (!fRegistered) 687 687 { 688 /* Updatetree for main root: */689 updateTreeForMainRoot();688 /* Rebuild tree for main root: */ 689 buildTreeForMainRoot(); 690 690 } 691 691 /* New VM registered? */ … … 1735 1735 // Hehey! Now we have to remove deleted VM nodes and then update tree for the main root node 1736 1736 // ourselves cause there is no corresponding event yet. So we are calling actual handler to do that. 1737 sltCloudMachineRegistered(QString() /* provider name */, 1738 QString() /* profile name */, 1737 UIChooserItem *pItem = root()->searchForItem(uId.toString(), 1738 UIChooserItemSearchFlag_Machine | 1739 UIChooserItemSearchFlag_ExactId); 1740 AssertPtrReturnVoid(pItem); 1741 AssertReturnVoid(pItem->node()->toMachineNode()->cache()->itemType() == UIVirtualMachineItem::ItemType_CloudReal); 1742 AssertPtrReturnVoid(pItem->parentItem()); 1743 AssertPtrReturnVoid(pItem->parentItem()->parentItem()); 1744 const QString strProviderShortName = pItem->parentItem()->parentItem()->name(); 1745 const QString strProfileName = pItem->parentItem()->name(); 1746 sltCloudMachineRegistered(strProviderShortName, 1747 strProfileName, 1739 1748 uId /* machine ID */, 1740 1749 false /* registered? */);
Note:
See TracChangeset
for help on using the changeset viewer.