VirtualBox

Ignore:
Timestamp:
Jun 1, 2020 3:12:33 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Chooser pane: A bit of selections stuff cleanup.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r84622 r84624  
    321321}
    322322
    323 void UIChooserModel::makeSureAtLeastOneItemSelected()
    324 {
    325     /* If we have no item selected but at
    326      * least one item in the navigation list (global item): */
    327     if (!firstSelectedItem() && !navigationItems().isEmpty())
    328     {
    329         /* We are choosing it, selection became invalidated: */
    330         setSelectedItem(navigationItems().first());
    331         emit sigSelectionInvalidated();
    332     }
    333 }
    334 
    335323bool UIChooserModel::isGroupItemSelected() const
    336324{
     
    434422}
    435423
    436 void UIChooserModel::makeSureNoItemWithCertainIdIsSelected(const QUuid &uId)
     424void UIChooserModel::makeSureNoItemWithCertainIdSelected(const QUuid &uId)
    437425{
    438426    /* Look for all nodes with passed uId: */
     
    453441        setSelectedItem(findClosestUnselectedItem());
    454442
    455     /* If global item was chosen, selection became invalidated: */
     443    /* If global item is currently chosen, selection should be invalidated: */
    456444    if (firstSelectedItem()->type() == UIChooserNodeType_Global)
    457445        emit sigSelectionInvalidated();
     446}
     447
     448void UIChooserModel::makeSureAtLeastOneItemSelected()
     449{
     450    /* If we have no item selected but
     451     * at least one in the navigation list (global item): */
     452    if (!firstSelectedItem() && !navigationItems().isEmpty())
     453    {
     454        /* We are choosing it, selection should be invalidated: */
     455        setSelectedItem(navigationItems().first());
     456        emit sigSelectionInvalidated();
     457    }
    458458}
    459459
     
    10721072void UIChooserModel::sltLocalMachineRegistered(const QUuid &uId, const bool fRegistered)
    10731073{
    1074     /* Make sure no item with passed uId is selected: */
     1074    /* Existing VM unregistered => make sure no item with passed uId is selected: */
    10751075    if (!fRegistered)
    1076         makeSureNoItemWithCertainIdIsSelected(uId);
     1076        makeSureNoItemWithCertainIdSelected(uId);
    10771077
    10781078    /* Call to base-class: */
     
    11041104                                               const QUuid &uId, const bool fRegistered)
    11051105{
    1106     /* Make sure no item with passed uId is selected: */
     1106    /* Existing VM unregistered => make sure no item with passed uId is selected: */
    11071107    if (!fRegistered)
    1108         makeSureNoItemWithCertainIdIsSelected(uId);
     1108        makeSureNoItemWithCertainIdSelected(uId);
    11091109
    11101110    /* Call to base-class: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h

    r84592 r84624  
    154154        QList<UIVirtualMachineItem*> selectedMachineItems() const;
    155155
    156         /** Makes sure at least one item selected. */
    157         void makeSureAtLeastOneItemSelected();
    158 
    159156        /** Returns whether group item is selected. */
    160157        bool isGroupItemSelected() const;
     
    179176        UIChooserItem *findClosestUnselectedItem() const;
    180177        /** Makes sure selection doesn't contain item with certain @a uId. */
    181         void makeSureNoItemWithCertainIdIsSelected(const QUuid &uId);
     178        void makeSureNoItemWithCertainIdSelected(const QUuid &uId);
     179        /** Makes sure at least one item selected. */
     180        void makeSureAtLeastOneItemSelected();
    182181
    183182        /** Defines current @a pItem. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette