Changeset 83930 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 22, 2020 3:07:59 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137476
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp
r83926 r83930 411 411 /* Compose full group name: */ 412 412 const QString strGroupName = QString("/%1/%2").arg(strProviderShortName, strProfileName); 413 414 /* Existing VM unregistered? */415 if (!fRegistered)416 {417 /* Remove machine-items with passed id: */418 invisibleRoot()->removeAllNodes(uMachineId);419 }420 /* New VM registered? */421 else422 {423 /* Add new machine-item: */424 const CCloudMachine comMachine = cloudMachineById(strProviderShortName, strProfileName, uMachineId);425 addCloudMachineIntoTheTree(strGroupName, comMachine, true /* make it visible */);426 }427 428 413 /* Search for corresponding profile node: */ 429 414 QList<UIChooserNode*> profileNodes; … … 433 418 UIChooserNodeGroup *pProfileNode = profileNodes.first()->toGroupNode(); 434 419 AssertPtrReturnVoid(pProfileNode); 435 /* If we are unregistering and there are no items left: */ 436 if (!fRegistered && pProfileNode->nodes(UIChooserNodeType_Machine).isEmpty()) 437 { 438 /* Add fake cloud VM item: */ 439 UIChooserNodeMachine *pFakeNode = new UIChooserNodeMachine(pProfileNode /* parent */, 440 false /* favorite */, 441 0 /* position */); 442 AssertPtrReturnVoid(pFakeNode); 443 AssertReturnVoid(pFakeNode->cacheType() == UIVirtualMachineItemType_CloudFake); 444 pFakeNode->cache()->toCloud()->setFakeCloudItemState(UIFakeCloudVirtualMachineItemState_Done); 445 pFakeNode->cache()->toCloud()->recache(); 446 } 447 /* If we are registering and there is at least one real item exists now: */ 448 else if (fRegistered && !pProfileNode->nodes(UIChooserNodeType_Machine).isEmpty()) 449 { 450 /* Search for corresponding fake node: */ 420 421 /* Existing VM unregistered? */ 422 if (!fRegistered) 423 { 424 /* Remove machine-items with passed id: */ 425 invisibleRoot()->removeAllNodes(uMachineId); 426 427 /* If there are no items left: */ 428 if (pProfileNode->nodes(UIChooserNodeType_Machine).isEmpty()) 429 { 430 /* Add fake cloud VM item: */ 431 UIChooserNodeMachine *pFakeNode = new UIChooserNodeMachine(pProfileNode /* parent */, 432 false /* favorite */, 433 0 /* position */); 434 AssertPtrReturnVoid(pFakeNode); 435 AssertReturnVoid(pFakeNode->cacheType() == UIVirtualMachineItemType_CloudFake); 436 pFakeNode->cache()->toCloud()->setFakeCloudItemState(UIFakeCloudVirtualMachineItemState_Done); 437 pFakeNode->cache()->toCloud()->recache(); 438 } 439 } 440 /* New VM registered? */ 441 else 442 { 443 /* Add new machine-item: */ 444 const CCloudMachine comMachine = cloudMachineById(strProviderShortName, strProfileName, uMachineId); 445 addCloudMachineIntoTheTree(strGroupName, comMachine, true /* make it visible */); 446 447 /* Search for possible fake node: */ 451 448 QList<UIChooserNode*> fakeNodes; 452 449 pProfileNode->searchForNodes(toOldStyleUuid(QUuid()), UIChooserItemSearchFlag_Machine | UIChooserItemSearchFlag_ExactId, fakeNodes); 453 /* Delete the only fake node: */454 AssertReturnVoid(!fakeNodes.isEmpty());455 delete fakeNodes.first();450 /* Delete fake node if present: */ 451 if (!fakeNodes.isEmpty()) 452 delete fakeNodes.first(); 456 453 } 457 454 }
Note:
See TracChangeset
for help on using the changeset viewer.