VirtualBox

Changeset 84462 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 22, 2020 1:47:23 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Chooser pane: Prevent group being renamed to name already used by another VM, not only another group.

File:
1 edited

Legend:

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

    r84420 r84462  
    936936    m_pNameEditorWidget->close();
    937937
    938     /* Enumerate all the group names: */
    939     QStringList groupNames;
    940     foreach (UIChooserItem *pItem, parentItem()->items(UIChooserNodeType_Group))
     938    /* Enumerate all the used machine and group names: */
     939    QStringList usedNames;
     940    foreach (UIChooserItem *pItem, parentItem()->items())
    941941    {
    942942        AssertPtrReturnVoid(pItem);
    943         UIChooserItemGroup *pGroupItem = pItem->toGroupItem();
    944         AssertPtrReturnVoid(pGroupItem);
    945         if (pGroupItem->groupType() == UIChooserNodeGroupType_Local)
    946             groupNames << pItem->name();
     943        if (   pItem->type() == UIChooserNodeType_Machine
     944            || (   pItem->type() == UIChooserNodeType_Group
     945                && pItem->toGroupItem()->groupType() == UIChooserNodeGroupType_Local))
     946            usedNames << pItem->name();
    947947    }
    948948    /* If proposed name is empty or not unique, reject it: */
    949949    QString strNewName = m_pNameEditorWidget->text().trimmed();
    950     if (strNewName.isEmpty() || groupNames.contains(strNewName))
     950    if (strNewName.isEmpty() || usedNames.contains(strNewName))
    951951        return;
    952952
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