VirtualBox

Ignore:
Timestamp:
May 3, 2011 7:15:23 AM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: VM Settings / Storage page: Validation updated, its now NOT possible to use already used or empty controller name.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r36589 r36922  
    20362036    QModelIndex rootIndex = mStorageModel->root();
    20372037    QMap <QString, QString> config;
     2038    QMap<int, QString> names;
     2039    /* For each controller: */
    20382040    for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
    20392041    {
    20402042        QModelIndex ctrIndex = rootIndex.child (i, 0);
    20412043        QString ctrName = mStorageModel->data (ctrIndex, StorageModel::R_CtrName).toString();
     2044        /* Check for name emptiness: */
     2045        if (ctrName.isEmpty())
     2046        {
     2047            aWarning = tr("no name specified for controller at position <b>%1</b>.").arg(i + 1);
     2048            return aWarning.isNull();
     2049        }
     2050        /* Check for name coincidence: */
     2051        if (names.values().contains(ctrName))
     2052        {
     2053            aWarning = tr("controller at position <b>%1</b> uses the name that is "
     2054                          "already used by controller at position <b>%2</b>.")
     2055                          .arg(i + 1).arg(names.key(ctrName) + 1);
     2056            return aWarning.isNull();
     2057        }
     2058        else names.insert(i, ctrName);
     2059        /* For each attachment: */
    20422060        for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j)
    20432061        {
     
    20502068            if (vboxGlobal().findMedium (key).isNull() && attDevice == KDeviceType_HardDisk)
    20512069            {
    2052                 aWarning = tr ("No hard disk is selected for <i>%1</i>.").arg (value);
     2070                aWarning = tr ("no hard disk is selected for <i>%1</i>.").arg (value);
    20532071                return aWarning.isNull();
    20542072            }
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