VirtualBox

Changeset 66555 in vbox


Ignore:
Timestamp:
Apr 13, 2017 12:09:31 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: Machine settings: Adjust error handling stuff to make sure each logical block has just one error message.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
Files:
10 edited

Legend:

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

    r66475 r66555  
    270270        CAudioAdapter comAdapter = m_machine.GetAudioAdapter();
    271271        fSuccess = m_machine.isOk() && comAdapter.isNotNull();
     272
    272273        /* Show error message if necessary: */
    273274        if (!fSuccess)
    274275            msgCenter().cannotSaveAudioSettings(m_machine, this);
    275 
    276         /* Save whether audio is enabled: */
    277         if (fSuccess && isMachineOffline() && newAudioData.m_fAudioEnabled != oldAudioData.m_fAudioEnabled)
     276        else
    278277        {
    279             comAdapter.SetEnabled(newAudioData.m_fAudioEnabled);
    280             fSuccess = comAdapter.isOk();
     278            /* Save whether audio is enabled: */
     279            if (fSuccess && isMachineOffline() && newAudioData.m_fAudioEnabled != oldAudioData.m_fAudioEnabled)
     280            {
     281                comAdapter.SetEnabled(newAudioData.m_fAudioEnabled);
     282                fSuccess = comAdapter.isOk();
     283            }
     284            /* Save audio driver type: */
     285            if (fSuccess && isMachineOffline() && newAudioData.m_audioDriverType != oldAudioData.m_audioDriverType)
     286            {
     287                comAdapter.SetAudioDriver(newAudioData.m_audioDriverType);
     288                fSuccess = comAdapter.isOk();
     289            }
     290            /* Save audio controller type: */
     291            if (fSuccess && isMachineOffline() && newAudioData.m_audioControllerType != oldAudioData.m_audioControllerType)
     292            {
     293                comAdapter.SetAudioController(newAudioData.m_audioControllerType);
     294                fSuccess = comAdapter.isOk();
     295            }
     296
     297            /* Show error message if necessary: */
     298            if (!fSuccess)
     299                msgCenter().cannotSaveAudioAdapterSettings(comAdapter, this);
    281300        }
    282         /* Save audio driver type: */
    283         if (fSuccess && isMachineOffline() && newAudioData.m_audioDriverType != oldAudioData.m_audioDriverType)
    284         {
    285             comAdapter.SetAudioDriver(newAudioData.m_audioDriverType);
    286             fSuccess = comAdapter.isOk();
    287         }
    288         /* Save audio controller type: */
    289         if (fSuccess && isMachineOffline() && newAudioData.m_audioControllerType != oldAudioData.m_audioControllerType)
    290         {
    291             comAdapter.SetAudioController(newAudioData.m_audioControllerType);
    292             fSuccess = comAdapter.isOk();
    293         }
    294         /* Show error message if necessary: */
    295         if (!fSuccess)
    296             msgCenter().cannotSaveAudioAdapterSettings(comAdapter, this);
    297301    }
    298302    /* Return result: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r66476 r66555  
    12641264        }
    12651265#endif
     1266
    12661267        /* Get machine ID for further activities: */
    12671268        QString strMachineId;
     
    12711272            fSuccess = m_machine.isOk();
    12721273        }
     1274
    12731275        /* Show error message if necessary: */
    12741276        if (!fSuccess)
     
    13031305        CVRDEServer comServer = m_machine.GetVRDEServer();
    13041306        fSuccess = m_machine.isOk() && comServer.isNotNull();
     1307
    13051308        /* Show error message if necessary: */
    13061309        if (!fSuccess)
    13071310            msgCenter().cannotSaveDisplaySettings(m_machine, this);
    1308 
    1309         /* Save whether remote display server is enabled: */
    1310         if (fSuccess && newDisplayData.m_fRemoteDisplayServerEnabled != oldDisplayData.m_fRemoteDisplayServerEnabled)
    1311         {
    1312             comServer.SetEnabled(newDisplayData.m_fRemoteDisplayServerEnabled);
    1313             fSuccess = comServer.isOk();
    1314         }
    1315         /* Save remote display server port: */
    1316         if (fSuccess && newDisplayData.m_strRemoteDisplayPort != oldDisplayData.m_strRemoteDisplayPort)
    1317         {
    1318             comServer.SetVRDEProperty("TCP/Ports", newDisplayData.m_strRemoteDisplayPort);
    1319             fSuccess = comServer.isOk();
    1320         }
    1321         /* Save remote display server auth type: */
    1322         if (fSuccess && newDisplayData.m_remoteDisplayAuthType != oldDisplayData.m_remoteDisplayAuthType)
    1323         {
    1324             comServer.SetAuthType(newDisplayData.m_remoteDisplayAuthType);
    1325             fSuccess = comServer.isOk();
    1326         }
    1327         /* Save remote display server timeout: */
    1328         if (fSuccess && newDisplayData.m_uRemoteDisplayTimeout != oldDisplayData.m_uRemoteDisplayTimeout)
    1329         {
    1330             comServer.SetAuthTimeout(newDisplayData.m_uRemoteDisplayTimeout);
    1331             fSuccess = comServer.isOk();
    1332         }
    1333         /* Save whether remote display server allows multiple connections: */
    1334         if (   fSuccess
    1335             && (isMachineOffline() || isMachineSaved())
    1336             && (newDisplayData.m_fRemoteDisplayMultiConnAllowed != oldDisplayData.m_fRemoteDisplayMultiConnAllowed))
    1337         {
    1338             comServer.SetAllowMultiConnection(newDisplayData.m_fRemoteDisplayMultiConnAllowed);
    1339             fSuccess = comServer.isOk();
    1340         }
    1341         /* Show error message if necessary: */
    1342         if (!fSuccess)
    1343             msgCenter().cannotSaveRemoteDisplayServerSettings(comServer, this);
     1311        else
     1312        {
     1313            /* Save whether remote display server is enabled: */
     1314            if (fSuccess && newDisplayData.m_fRemoteDisplayServerEnabled != oldDisplayData.m_fRemoteDisplayServerEnabled)
     1315            {
     1316                comServer.SetEnabled(newDisplayData.m_fRemoteDisplayServerEnabled);
     1317                fSuccess = comServer.isOk();
     1318            }
     1319            /* Save remote display server port: */
     1320            if (fSuccess && newDisplayData.m_strRemoteDisplayPort != oldDisplayData.m_strRemoteDisplayPort)
     1321            {
     1322                comServer.SetVRDEProperty("TCP/Ports", newDisplayData.m_strRemoteDisplayPort);
     1323                fSuccess = comServer.isOk();
     1324            }
     1325            /* Save remote display server auth type: */
     1326            if (fSuccess && newDisplayData.m_remoteDisplayAuthType != oldDisplayData.m_remoteDisplayAuthType)
     1327            {
     1328                comServer.SetAuthType(newDisplayData.m_remoteDisplayAuthType);
     1329                fSuccess = comServer.isOk();
     1330            }
     1331            /* Save remote display server timeout: */
     1332            if (fSuccess && newDisplayData.m_uRemoteDisplayTimeout != oldDisplayData.m_uRemoteDisplayTimeout)
     1333            {
     1334                comServer.SetAuthTimeout(newDisplayData.m_uRemoteDisplayTimeout);
     1335                fSuccess = comServer.isOk();
     1336            }
     1337            /* Save whether remote display server allows multiple connections: */
     1338            if (   fSuccess
     1339                && (isMachineOffline() || isMachineSaved())
     1340                && (newDisplayData.m_fRemoteDisplayMultiConnAllowed != oldDisplayData.m_fRemoteDisplayMultiConnAllowed))
     1341            {
     1342                comServer.SetAllowMultiConnection(newDisplayData.m_fRemoteDisplayMultiConnAllowed);
     1343                fSuccess = comServer.isOk();
     1344            }
     1345
     1346            /* Show error message if necessary: */
     1347            if (!fSuccess)
     1348                msgCenter().cannotSaveRemoteDisplayServerSettings(comServer, this);
     1349        }
    13441350    }
    13451351    /* Return result: */
     
    14761482            }
    14771483        }
     1484
    14781485        /* Show error message if necessary: */
    14791486        if (!fSuccess)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r66482 r66555  
    713713                fSuccess = m_machine.isOk();
    714714            }
    715             /* Show error message if necessary: */
    716             if (!fSuccess)
    717                 msgCenter().cannotSaveGeneralSettings(m_machine, this);
    718         }
     715        }
     716
     717        /* Show error message if necessary: */
     718        if (!fSuccess)
     719            msgCenter().cannotSaveGeneralSettings(m_machine, this);
    719720    }
    720721    /* Return result: */
     
    760761            fSuccess = m_machine.isOk();
    761762        }
     763
    762764        /* Show error message if necessary: */
    763765        if (!fSuccess)
     
    786788            fSuccess = m_machine.isOk();
    787789        }
     790
    788791        /* Show error message if necessary: */
    789792        if (!fSuccess)
     
    828831                fSuccess = m_machine.isOk();
    829832            }
     833
    830834            /* Show error message if necessary: */
    831835            if (!fSuccess)
    832836                msgCenter().cannotSaveGeneralSettings(m_machine, this);
    833837
    834             /* Enumerate attachments: */
     838            /* For each attachment: */
    835839            for (int iIndex = 0; fSuccess && iIndex < attachments.size(); ++iIndex)
    836840            {
     
    852856                    fSuccess = comAttachment.isOk();
    853857                }
     858
    854859                /* Show error message if necessary: */
    855860                if (!fSuccess)
    856861                    msgCenter().cannotSaveStorageAttachmentSettings(comAttachment, this);
    857 
    858                 /* Enumerate hard-drives only: */
    859                 if (enmType != KDeviceType_HardDisk)
    860                     continue;
    861 
    862                 /* Get medium id for further activities: */
    863                 QString strMediumId;
    864                 if (fSuccess)
     862                else
    865863                {
    866                     strMediumId = comMedium.GetId();
    867                     fSuccess = comMedium.isOk();
     864                    /* Pass hard-drives only: */
     865                    if (enmType != KDeviceType_HardDisk)
     866                        continue;
     867
     868                    /* Get medium id for further activities: */
     869                    QString strMediumId;
     870                    if (fSuccess)
     871                    {
     872                        strMediumId = comMedium.GetId();
     873                        fSuccess = comMedium.isOk();
     874                    }
     875
     876                    /* Create encryption update progress: */
     877                    CProgress comProgress;
     878                    if (fSuccess)
     879                    {
     880                        /* Cipher attribute changed? */
     881                        QString strNewCipher;
     882                        if (newGeneralData.m_fEncryptionCipherChanged)
     883                        {
     884                            strNewCipher = newGeneralData.m_fEncryptionEnabled ?
     885                                           m_encryptionCiphers.at(newGeneralData.m_iEncryptionCipherIndex) : QString();
     886                        }
     887
     888                        /* Password attribute changed? */
     889                        QString strNewPassword;
     890                        QString strNewPasswordId;
     891                        if (newGeneralData.m_fEncryptionPasswordChanged)
     892                        {
     893                            strNewPassword = newGeneralData.m_fEncryptionEnabled ?
     894                                             newGeneralData.m_strEncryptionPassword : QString();
     895                            strNewPasswordId = newGeneralData.m_fEncryptionEnabled ?
     896                                               strMachineName : QString();
     897                        }
     898
     899                        /* Get the maps of encrypted mediums and their passwords: */
     900                        const EncryptedMediumMap &encryptedMedium = newGeneralData.m_encryptedMediums;
     901                        const EncryptionPasswordMap &encryptionPasswords = newGeneralData.m_encryptionPasswords;
     902
     903                        /* Check if old password exists/provided: */
     904                        const QString strOldPasswordId = encryptedMedium.key(strMediumId);
     905                        const QString strOldPassword = encryptionPasswords.value(strOldPasswordId);
     906
     907                        /* Create encryption progress: */
     908                        comProgress = comMedium.ChangeEncryption(strOldPassword,
     909                                                                 strNewCipher,
     910                                                                 strNewPassword,
     911                                                                 strNewPasswordId);
     912                        fSuccess = comMedium.isOk();
     913                    }
     914
     915                    // TODO: Decide what to do with it (also below).
     916                    // if (!comMedium.isOk())
     917                    // {
     918                    //     QMetaObject::invokeMethod(this, "sigOperationProgressError", Qt::BlockingQueuedConnection,
     919                    //                               Q_ARG(QString, UIMessageCenter::formatErrorInfo(comMedium)));
     920                    //     continue;
     921                    // }
     922
     923                    /* Create encryption update progress dialog: */
     924                    QPointer<UIProgress> pDlg;
     925                    if (fSuccess)
     926                    {
     927                        // TODO: Decide what to do with it (also above).
     928                        // This dialog connected to settings serializer, not to message-center directly.
     929                        // What's the better approach in that case? Probably connect everything to serializer?
     930                        pDlg = new UIProgress(comProgress);
     931                        connect(pDlg, SIGNAL(sigProgressChange(ulong, QString, ulong, ulong)),
     932                                this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
     933                                Qt::QueuedConnection);
     934                        connect(pDlg, SIGNAL(sigProgressError(QString)),
     935                                this, SIGNAL(sigOperationProgressError(QString)),
     936                                Qt::BlockingQueuedConnection);
     937                        pDlg->run(350);
     938                        if (pDlg)
     939                            delete pDlg;
     940                        else
     941                        {
     942                            // Premature application shutdown,
     943                            // exit immediately:
     944                            return true;
     945                        }
     946                    }
     947
     948                    /* Show error message if necessary: */
     949                    if (!fSuccess)
     950                        msgCenter().cannotSaveStorageMediumSettings(comMedium, this);
    868951                }
    869 
    870                 /* Create encryption update progress: */
    871                 CProgress comProgress;
    872                 if (fSuccess)
    873                 {
    874                     /* Cipher attribute changed? */
    875                     QString strNewCipher;
    876                     if (newGeneralData.m_fEncryptionCipherChanged)
    877                     {
    878                         strNewCipher = newGeneralData.m_fEncryptionEnabled ?
    879                                        m_encryptionCiphers.at(newGeneralData.m_iEncryptionCipherIndex) : QString();
    880                     }
    881 
    882                     /* Password attribute changed? */
    883                     QString strNewPassword;
    884                     QString strNewPasswordId;
    885                     if (newGeneralData.m_fEncryptionPasswordChanged)
    886                     {
    887                         strNewPassword = newGeneralData.m_fEncryptionEnabled ?
    888                                          newGeneralData.m_strEncryptionPassword : QString();
    889                         strNewPasswordId = newGeneralData.m_fEncryptionEnabled ?
    890                                            strMachineName : QString();
    891                     }
    892 
    893                     /* Get the maps of encrypted mediums and their passwords: */
    894                     const EncryptedMediumMap &encryptedMedium = newGeneralData.m_encryptedMediums;
    895                     const EncryptionPasswordMap &encryptionPasswords = newGeneralData.m_encryptionPasswords;
    896 
    897                     /* Check if old password exists/provided: */
    898                     const QString strOldPasswordId = encryptedMedium.key(strMediumId);
    899                     const QString strOldPassword = encryptionPasswords.value(strOldPasswordId);
    900 
    901                     /* Create encryption progress: */
    902                     comProgress = comMedium.ChangeEncryption(strOldPassword,
    903                                                              strNewCipher,
    904                                                              strNewPassword,
    905                                                              strNewPasswordId);
    906                     fSuccess = comMedium.isOk();
    907                 }
    908 
    909                 // TODO: Decide what to do with it (also below).
    910                 // if (!comMedium.isOk())
    911                 // {
    912                 //     QMetaObject::invokeMethod(this, "sigOperationProgressError", Qt::BlockingQueuedConnection,
    913                 //                               Q_ARG(QString, UIMessageCenter::formatErrorInfo(comMedium)));
    914                 //     continue;
    915                 // }
    916 
    917                 /* Create encryption update progress dialog: */
    918                 QPointer<UIProgress> pDlg;
    919                 if (fSuccess)
    920                 {
    921                     // TODO: Decide what to do with it (also above).
    922                     // This dialog connected to settings serializer, not to message-center directly.
    923                     // What's the better approach in that case? Probably connect everything to serializer?
    924                     pDlg = new UIProgress(comProgress);
    925                     connect(pDlg, SIGNAL(sigProgressChange(ulong, QString, ulong, ulong)),
    926                             this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
    927                             Qt::QueuedConnection);
    928                     connect(pDlg, SIGNAL(sigProgressError(QString)),
    929                             this, SIGNAL(sigOperationProgressError(QString)),
    930                             Qt::BlockingQueuedConnection);
    931                     pDlg->run(350);
    932                     if (pDlg)
    933                         delete pDlg;
    934                     else
    935                     {
    936                         // Premature application shutdown,
    937                         // exit immediately:
    938                         return true;
    939                     }
    940                 }
    941 
    942                 /* Show error message if necessary: */
    943                 if (!fSuccess)
    944                     msgCenter().cannotSaveStorageMediumSettings(comMedium, this);
    945952            }
    946953        }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r66500 r66555  
    546546    m_pGenericPropertiesLabel->setEnabled(m_pParent->isMachineInValidMode());
    547547    m_pGenericPropertiesTextEdit->setEnabled(m_pParent->isMachineInValidMode());
     548    m_pCableConnectedCheckBox->setEnabled(m_pParent->isMachineInValidMode());
    548549    m_pPortForwardingButton->setEnabled(m_pParent->isMachineInValidMode() &&
    549550                                        attachmentType() == KNetworkAttachmentType_NAT);
     
    15041505            CNetworkAdapter comAdapter = m_machine.GetNetworkAdapter(iSlot);
    15051506            fSuccess = m_machine.isOk() && comAdapter.isNotNull();
     1507
    15061508            /* Show error message if necessary: */
    15071509            if (!fSuccess)
    15081510                msgCenter().cannotSaveNetworkSettings(m_machine, this);
    1509 
    1510             /* Save whether the adapter is enabled: */
    1511             if (fSuccess && isMachineOffline() && newAdapterData.m_fAdapterEnabled != oldAdapterData.m_fAdapterEnabled)
     1511            else
    15121512            {
    1513                 comAdapter.SetEnabled(newAdapterData.m_fAdapterEnabled);
    1514                 fSuccess = comAdapter.isOk();
     1513                /* Save whether the adapter is enabled: */
     1514                if (fSuccess && isMachineOffline() && newAdapterData.m_fAdapterEnabled != oldAdapterData.m_fAdapterEnabled)
     1515                {
     1516                    comAdapter.SetEnabled(newAdapterData.m_fAdapterEnabled);
     1517                    fSuccess = comAdapter.isOk();
     1518                }
     1519                /* Save adapter type: */
     1520                if (fSuccess && isMachineOffline() && newAdapterData.m_adapterType != oldAdapterData.m_adapterType)
     1521                {
     1522                    comAdapter.SetAdapterType(newAdapterData.m_adapterType);
     1523                    fSuccess = comAdapter.isOk();
     1524                }
     1525                /* Save adapter MAC address: */
     1526                if (fSuccess && isMachineOffline() && newAdapterData.m_strMACAddress != oldAdapterData.m_strMACAddress)
     1527                {
     1528                    comAdapter.SetMACAddress(newAdapterData.m_strMACAddress);
     1529                    fSuccess = comAdapter.isOk();
     1530                }
     1531                /* Save adapter attachment type: */
     1532                switch (newAdapterData.m_attachmentType)
     1533                {
     1534                    case KNetworkAttachmentType_Bridged:
     1535                    {
     1536                        if (fSuccess && newAdapterData.m_strBridgedAdapterName != oldAdapterData.m_strBridgedAdapterName)
     1537                        {
     1538                            comAdapter.SetBridgedInterface(newAdapterData.m_strBridgedAdapterName);
     1539                            fSuccess = comAdapter.isOk();
     1540                        }
     1541                        break;
     1542                    }
     1543                    case KNetworkAttachmentType_Internal:
     1544                    {
     1545                        if (fSuccess && newAdapterData.m_strInternalNetworkName != oldAdapterData.m_strInternalNetworkName)
     1546                        {
     1547                            comAdapter.SetInternalNetwork(newAdapterData.m_strInternalNetworkName);
     1548                            fSuccess = comAdapter.isOk();
     1549                        }
     1550                        break;
     1551                    }
     1552                    case KNetworkAttachmentType_HostOnly:
     1553                    {
     1554                        if (fSuccess && newAdapterData.m_strHostInterfaceName != oldAdapterData.m_strHostInterfaceName)
     1555                        {
     1556                            comAdapter.SetHostOnlyInterface(newAdapterData.m_strHostInterfaceName);
     1557                            fSuccess = comAdapter.isOk();
     1558                        }
     1559                        break;
     1560                    }
     1561                    case KNetworkAttachmentType_Generic:
     1562                    {
     1563                        if (fSuccess && newAdapterData.m_strGenericDriverName != oldAdapterData.m_strGenericDriverName)
     1564                        {
     1565                            comAdapter.SetGenericDriver(newAdapterData.m_strGenericDriverName);
     1566                            fSuccess = comAdapter.isOk();
     1567                        }
     1568                        if (fSuccess && newAdapterData.m_strGenericProperties != oldAdapterData.m_strGenericProperties)
     1569                            fSuccess = saveGenericProperties(comAdapter, newAdapterData.m_strGenericProperties);
     1570                        break;
     1571                    }
     1572                    case KNetworkAttachmentType_NATNetwork:
     1573                    {
     1574                        if (fSuccess && newAdapterData.m_strNATNetworkName != oldAdapterData.m_strNATNetworkName)
     1575                        {
     1576                            comAdapter.SetNATNetwork(newAdapterData.m_strNATNetworkName);
     1577                            fSuccess = comAdapter.isOk();
     1578                        }
     1579                        break;
     1580                    }
     1581                    default:
     1582                        break;
     1583                }
     1584                if (fSuccess && newAdapterData.m_attachmentType != oldAdapterData.m_attachmentType)
     1585                {
     1586                    comAdapter.SetAttachmentType(newAdapterData.m_attachmentType);
     1587                    fSuccess = comAdapter.isOk();
     1588                }
     1589                /* Save adapter promiscuous mode: */
     1590                if (fSuccess && newAdapterData.m_promiscuousMode != oldAdapterData.m_promiscuousMode)
     1591                {
     1592                    comAdapter.SetPromiscModePolicy(newAdapterData.m_promiscuousMode);
     1593                    fSuccess = comAdapter.isOk();
     1594                }
     1595                /* Save whether the adapter cable connected: */
     1596                if (fSuccess && newAdapterData.m_fCableConnected != oldAdapterData.m_fCableConnected)
     1597                {
     1598                    comAdapter.SetCableConnected(newAdapterData.m_fCableConnected);
     1599                    fSuccess = comAdapter.isOk();
     1600                }
     1601                /* Save adapter redirect options: */
     1602                if (   fSuccess && newAdapterData.m_redirects != oldAdapterData.m_redirects
     1603                    && (   oldAdapterData.m_attachmentType == KNetworkAttachmentType_NAT
     1604                        || newAdapterData.m_attachmentType == KNetworkAttachmentType_NAT))
     1605                {
     1606                    foreach (const QString &strOldRedirect, comAdapter.GetNATEngine().GetRedirects())
     1607                        comAdapter.GetNATEngine().RemoveRedirect(strOldRedirect.section(',', 0, 0));
     1608                    foreach (const UIPortForwardingData &newRedirect, newAdapterData.m_redirects)
     1609                        comAdapter.GetNATEngine().AddRedirect(newRedirect.name, newRedirect.protocol,
     1610                                                           newRedirect.hostIp, newRedirect.hostPort.value(),
     1611                                                           newRedirect.guestIp, newRedirect.guestPort.value());
     1612                }
     1613
     1614                /* Show error message if necessary: */
     1615                if (!fSuccess)
     1616                    msgCenter().cannotSaveNetworkAdapterSettings(comAdapter, this);
    15151617            }
    1516             /* Save adapter type: */
    1517             if (fSuccess && isMachineOffline() && newAdapterData.m_adapterType != oldAdapterData.m_adapterType)
    1518             {
    1519                 comAdapter.SetAdapterType(newAdapterData.m_adapterType);
    1520                 fSuccess = comAdapter.isOk();
    1521             }
    1522             /* Save adapter MAC address: */
    1523             if (fSuccess && isMachineOffline() && newAdapterData.m_strMACAddress != oldAdapterData.m_strMACAddress)
    1524             {
    1525                 comAdapter.SetMACAddress(newAdapterData.m_strMACAddress);
    1526                 fSuccess = comAdapter.isOk();
    1527             }
    1528             /* Save adapter attachment type: */
    1529             switch (newAdapterData.m_attachmentType)
    1530             {
    1531                 case KNetworkAttachmentType_Bridged:
    1532                 {
    1533                     if (fSuccess && newAdapterData.m_strBridgedAdapterName != oldAdapterData.m_strBridgedAdapterName)
    1534                     {
    1535                         comAdapter.SetBridgedInterface(newAdapterData.m_strBridgedAdapterName);
    1536                         fSuccess = comAdapter.isOk();
    1537                     }
    1538                     break;
    1539                 }
    1540                 case KNetworkAttachmentType_Internal:
    1541                 {
    1542                     if (fSuccess && newAdapterData.m_strInternalNetworkName != oldAdapterData.m_strInternalNetworkName)
    1543                     {
    1544                         comAdapter.SetInternalNetwork(newAdapterData.m_strInternalNetworkName);
    1545                         fSuccess = comAdapter.isOk();
    1546                     }
    1547                     break;
    1548                 }
    1549                 case KNetworkAttachmentType_HostOnly:
    1550                 {
    1551                     if (fSuccess && newAdapterData.m_strHostInterfaceName != oldAdapterData.m_strHostInterfaceName)
    1552                     {
    1553                         comAdapter.SetHostOnlyInterface(newAdapterData.m_strHostInterfaceName);
    1554                         fSuccess = comAdapter.isOk();
    1555                     }
    1556                     break;
    1557                 }
    1558                 case KNetworkAttachmentType_Generic:
    1559                 {
    1560                     if (fSuccess && newAdapterData.m_strGenericDriverName != oldAdapterData.m_strGenericDriverName)
    1561                     {
    1562                         comAdapter.SetGenericDriver(newAdapterData.m_strGenericDriverName);
    1563                         fSuccess = comAdapter.isOk();
    1564                     }
    1565                     if (fSuccess && newAdapterData.m_strGenericProperties != oldAdapterData.m_strGenericProperties)
    1566                         fSuccess = saveGenericProperties(comAdapter, newAdapterData.m_strGenericProperties);
    1567                     break;
    1568                 }
    1569                 case KNetworkAttachmentType_NATNetwork:
    1570                 {
    1571                     if (fSuccess && newAdapterData.m_strNATNetworkName != oldAdapterData.m_strNATNetworkName)
    1572                     {
    1573                         comAdapter.SetNATNetwork(newAdapterData.m_strNATNetworkName);
    1574                         fSuccess = comAdapter.isOk();
    1575                     }
    1576                     break;
    1577                 }
    1578                 default:
    1579                     break;
    1580             }
    1581             if (fSuccess && newAdapterData.m_attachmentType != oldAdapterData.m_attachmentType)
    1582             {
    1583                 comAdapter.SetAttachmentType(newAdapterData.m_attachmentType);
    1584                 fSuccess = comAdapter.isOk();
    1585             }
    1586             /* Save adapter promiscuous mode: */
    1587             if (fSuccess && newAdapterData.m_promiscuousMode != oldAdapterData.m_promiscuousMode)
    1588             {
    1589                 comAdapter.SetPromiscModePolicy(newAdapterData.m_promiscuousMode);
    1590                 fSuccess = comAdapter.isOk();
    1591             }
    1592             /* Save whether the adapter cable connected: */
    1593             if (fSuccess && newAdapterData.m_fCableConnected != oldAdapterData.m_fCableConnected)
    1594             {
    1595                 comAdapter.SetCableConnected(newAdapterData.m_fCableConnected);
    1596                 fSuccess = comAdapter.isOk();
    1597             }
    1598             /* Save adapter redirect options: */
    1599             if (   fSuccess && newAdapterData.m_redirects != oldAdapterData.m_redirects
    1600                 && (   oldAdapterData.m_attachmentType == KNetworkAttachmentType_NAT
    1601                     || newAdapterData.m_attachmentType == KNetworkAttachmentType_NAT))
    1602             {
    1603                 foreach (const QString &strOldRedirect, comAdapter.GetNATEngine().GetRedirects())
    1604                     comAdapter.GetNATEngine().RemoveRedirect(strOldRedirect.section(',', 0, 0));
    1605                 foreach (const UIPortForwardingData &newRedirect, newAdapterData.m_redirects)
    1606                     comAdapter.GetNATEngine().AddRedirect(newRedirect.name, newRedirect.protocol,
    1607                                                        newRedirect.hostIp, newRedirect.hostPort.value(),
    1608                                                        newRedirect.guestIp, newRedirect.guestPort.value());
    1609             }
    1610             /* Show error message if necessary: */
    1611             if (!fSuccess)
    1612                 msgCenter().cannotSaveNetworkAdapterSettings(comAdapter, this);
    16131618        }
    16141619    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp

    r66501 r66555  
    586586            CParallelPort comPort = m_machine.GetParallelPort(iPort);
    587587            fSuccess = m_machine.isOk() && comPort.isNotNull();
     588
    588589            /* Show error message if necessary: */
    589590            if (!fSuccess)
    590591                msgCenter().cannotSaveParallelSettings(m_machine, this);
    591 
    592             /* Save whether the port is enabled: */
    593             if (fSuccess && isMachineOffline() && newPortData.m_fPortEnabled != oldPortData.m_fPortEnabled)
     592            else
    594593            {
    595                 comPort.SetEnabled(newPortData.m_fPortEnabled);
    596                 fSuccess = comPort.isOk();
     594                /* Save whether the port is enabled: */
     595                if (fSuccess && isMachineOffline() && newPortData.m_fPortEnabled != oldPortData.m_fPortEnabled)
     596                {
     597                    comPort.SetEnabled(newPortData.m_fPortEnabled);
     598                    fSuccess = comPort.isOk();
     599                }
     600                /* Save port IRQ: */
     601                if (fSuccess && isMachineOffline() && newPortData.m_uIRQ != oldPortData.m_uIRQ)
     602                {
     603                    comPort.SetIRQ(newPortData.m_uIRQ);
     604                    fSuccess = comPort.isOk();
     605                }
     606                /* Save port IO base: */
     607                if (fSuccess && isMachineOffline() && newPortData.m_uIOBase != oldPortData.m_uIOBase)
     608                {
     609                    comPort.SetIOBase(newPortData.m_uIOBase);
     610                    fSuccess = comPort.isOk();
     611                }
     612                /* Save port path: */
     613                if (fSuccess && isMachineOffline() && newPortData.m_strPath != oldPortData.m_strPath)
     614                {
     615                    comPort.SetPath(newPortData.m_strPath);
     616                    fSuccess = comPort.isOk();
     617                }
     618
     619                /* Show error message if necessary: */
     620                if (!fSuccess)
     621                    msgCenter().cannotSaveParallelPortSettings(comPort, this);
    597622            }
    598             /* Save port IRQ: */
    599             if (fSuccess && isMachineOffline() && newPortData.m_uIRQ != oldPortData.m_uIRQ)
    600             {
    601                 comPort.SetIRQ(newPortData.m_uIRQ);
    602                 fSuccess = comPort.isOk();
    603             }
    604             /* Save port IO base: */
    605             if (fSuccess && isMachineOffline() && newPortData.m_uIOBase != oldPortData.m_uIOBase)
    606             {
    607                 comPort.SetIOBase(newPortData.m_uIOBase);
    608                 fSuccess = comPort.isOk();
    609             }
    610             /* Save port path: */
    611             if (fSuccess && isMachineOffline() && newPortData.m_strPath != oldPortData.m_strPath)
    612             {
    613                 comPort.SetPath(newPortData.m_strPath);
    614                 fSuccess = comPort.isOk();
    615             }
    616             /* Show error message if necessary: */
    617             if (!fSuccess)
    618                 msgCenter().cannotSaveParallelPortSettings(comPort, this);
    619623        }
    620624    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp

    r66540 r66555  
    866866                folders = m_machine.GetSharedFolders();
    867867                fSuccess = m_machine.isOk();
     868
    868869                /* Show error message if necessary: */
    869870                if (!fSuccess)
    870871                    msgCenter().cannotLoadFoldersSettings(m_machine, this);
     872
    871873                break;
    872874            }
     
    878880                folders = m_console.GetSharedFolders();
    879881                fSuccess = m_console.isOk();
     882
    880883                /* Show error message if necessary: */
    881884                if (!fSuccess)
    882885                    msgCenter().cannotLoadFoldersSettings(m_console, this);
     886
    883887                break;
    884888            }
     
    908912            fSuccess = comCurrentFolder.isOk();
    909913        }
     914
    910915        /* Show error message if necessary: */
    911916        if (!fSuccess)
     
    934939
    935940            /* Remove folder marked for 'remove' or 'update': */
    936             if (folderCache.wasRemoved() || folderCache.wasUpdated())
     941            if (fSuccess && (folderCache.wasRemoved() || folderCache.wasUpdated()))
    937942                fSuccess = removeSharedFolder(folderCache);
    938943
    939944            /* Create folder marked for 'create' or 'update': */
    940             if (folderCache.wasCreated() || folderCache.wasUpdated())
     945            if (fSuccess && (folderCache.wasCreated() || folderCache.wasUpdated()))
    941946                fSuccess = createSharedFolder(folderCache);
    942947        }
     
    966971        CSharedFolder comFolder;
    967972        if (fSuccess)
    968             /* fSuccess = */ getSharedFolder(strFolderName, folders, comFolder);
     973            fSuccess = getSharedFolder(strFolderName, folders, comFolder);
    969974
    970975        /* Make sure such folder really exists: */
    971         if (!comFolder.isNull())
     976        if (fSuccess && !comFolder.isNull())
    972977        {
    973978            /* Remove existing folder: */
     
    10131018    /* Prepare result: */
    10141019    bool fSuccess = true;
    1015     /* Remove folder: */
     1020    /* Create folder: */
    10161021    if (fSuccess)
    10171022    {
     
    10321037        CSharedFolder comFolder;
    10331038        if (fSuccess)
    1034             /* fSuccess = */ getSharedFolder(strFolderName, folders, comFolder);
     1039            fSuccess = getSharedFolder(strFolderName, folders, comFolder);
    10351040
    10361041        /* Make sure such folder doesn't exist: */
    1037         if (comFolder.isNull())
     1042        if (fSuccess && comFolder.isNull())
    10381043        {
    10391044            /* Create new folder: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp

    r66502 r66555  
    643643            CSerialPort comPort = m_machine.GetSerialPort(iPort);
    644644            fSuccess = m_machine.isOk() && comPort.isNotNull();
     645
    645646            /* Show error message if necessary: */
    646647            if (!fSuccess)
    647648                msgCenter().cannotSaveSerialSettings(m_machine, this);
    648 
    649             // This *must* be first.
    650             // If the requested host mode is changed to disconnected we should do it first.
    651             // That allows to automatically fulfill the requirements for some of the settings below.
    652             /* Save port host mode: */
    653             if (   fSuccess && isMachineOffline()
    654                 && newPortData.m_hostMode != oldPortData.m_hostMode
    655                 && newPortData.m_hostMode == KPortMode_Disconnected)
     649            else
    656650            {
    657                 comPort.SetHostMode(newPortData.m_hostMode);
    658                 fSuccess = comPort.isOk();
     651                // This *must* be first.
     652                // If the requested host mode is changed to disconnected we should do it first.
     653                // That allows to automatically fulfill the requirements for some of the settings below.
     654                /* Save port host mode: */
     655                if (   fSuccess && isMachineOffline()
     656                    && newPortData.m_hostMode != oldPortData.m_hostMode
     657                    && newPortData.m_hostMode == KPortMode_Disconnected)
     658                {
     659                    comPort.SetHostMode(newPortData.m_hostMode);
     660                    fSuccess = comPort.isOk();
     661                }
     662                /* Save whether the port is enabled: */
     663                if (fSuccess && isMachineOffline() && newPortData.m_fPortEnabled != oldPortData.m_fPortEnabled)
     664                {
     665                    comPort.SetEnabled(newPortData.m_fPortEnabled);
     666                    fSuccess = comPort.isOk();
     667                }
     668                /* Save port IRQ: */
     669                if (fSuccess && isMachineOffline() && newPortData.m_uIRQ != oldPortData.m_uIRQ)
     670                {
     671                    comPort.SetIRQ(newPortData.m_uIRQ);
     672                    fSuccess = comPort.isOk();
     673                }
     674                /* Save port IO base: */
     675                if (fSuccess && isMachineOffline() && newPortData.m_uIOBase != oldPortData.m_uIOBase)
     676                {
     677                    comPort.SetIOBase(newPortData.m_uIOBase);
     678                    fSuccess = comPort.isOk();
     679                }
     680                /* Save whether the port is server: */
     681                if (fSuccess && isMachineOffline() && newPortData.m_fServer != oldPortData.m_fServer)
     682                {
     683                    comPort.SetServer(newPortData.m_fServer);
     684                    fSuccess = comPort.isOk();
     685                }
     686                /* Save port path: */
     687                if (fSuccess && isMachineOffline() && newPortData.m_strPath != oldPortData.m_strPath)
     688                {
     689                    comPort.SetPath(newPortData.m_strPath);
     690                    fSuccess = comPort.isOk();
     691                }
     692                // This *must* be last.
     693                // The host mode will be changed to disconnected if some of the necessary
     694                // settings above will not meet the requirements for the selected mode.
     695                /* Save port host mode: */
     696                if (   fSuccess && isMachineOffline()
     697                    && newPortData.m_hostMode != oldPortData.m_hostMode
     698                    && newPortData.m_hostMode != KPortMode_Disconnected)
     699                {
     700                    comPort.SetHostMode(newPortData.m_hostMode);
     701                    fSuccess = comPort.isOk();
     702                }
     703
     704                /* Show error message if necessary: */
     705                if (!fSuccess)
     706                    msgCenter().cannotSaveSerialPortSettings(comPort, this);
    659707            }
    660             /* Save whether the port is enabled: */
    661             if (fSuccess && isMachineOffline() && newPortData.m_fPortEnabled != oldPortData.m_fPortEnabled)
    662             {
    663                 comPort.SetEnabled(newPortData.m_fPortEnabled);
    664                 fSuccess = comPort.isOk();
    665             }
    666             /* Save port IRQ: */
    667             if (fSuccess && isMachineOffline() && newPortData.m_uIRQ != oldPortData.m_uIRQ)
    668             {
    669                 comPort.SetIRQ(newPortData.m_uIRQ);
    670                 fSuccess = comPort.isOk();
    671             }
    672             /* Save port IO base: */
    673             if (fSuccess && isMachineOffline() && newPortData.m_uIOBase != oldPortData.m_uIOBase)
    674             {
    675                 comPort.SetIOBase(newPortData.m_uIOBase);
    676                 fSuccess = comPort.isOk();
    677             }
    678             /* Save whether the port is server: */
    679             if (fSuccess && isMachineOffline() && newPortData.m_fServer != oldPortData.m_fServer)
    680             {
    681                 comPort.SetServer(newPortData.m_fServer);
    682                 fSuccess = comPort.isOk();
    683             }
    684             /* Save port path: */
    685             if (fSuccess && isMachineOffline() && newPortData.m_strPath != oldPortData.m_strPath)
    686             {
    687                 comPort.SetPath(newPortData.m_strPath);
    688                 fSuccess = comPort.isOk();
    689             }
    690             // This *must* be last.
    691             // The host mode will be changed to disconnected if some of the necessary
    692             // settings above will not meet the requirements for the selected mode.
    693             /* Save port host mode: */
    694             if (   fSuccess && isMachineOffline()
    695                 && newPortData.m_hostMode != oldPortData.m_hostMode
    696                 && newPortData.m_hostMode != KPortMode_Disconnected)
    697             {
    698                 comPort.SetHostMode(newPortData.m_hostMode);
    699                 fSuccess = comPort.isOk();
    700             }
    701             /* Show error message if necessary: */
    702             if (!fSuccess)
    703                 msgCenter().cannotSaveSerialPortSettings(comPort, this);
    704708        }
    705709    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r66543 r66555  
    40124012        const UIDataSettingsMachineStorageController &oldControllerData = controllerCache.base();
    40134013
    4014         /* Make sure controller really exists: */
     4014        /* Search for a controller with the same name: */
    40154015        const CStorageController &comController = m_machine.GetStorageControllerByName(oldControllerData.m_strControllerName);
    40164016        fSuccess = m_machine.isOk() && comController.isNotNull();
    40174017
    4018         /* Remove controller with all the attachments at one shot: */
     4018        /* Make sure controller really exists: */
    40194019        if (fSuccess)
    40204020        {
     4021            /* Remove controller with all the attachments at one shot: */
    40214022            m_machine.RemoveStorageController(oldControllerData.m_strControllerName);
    40224023            fSuccess = m_machine.isOk();
    40234024        }
     4025
    40244026        /* Show error message if necessary: */
    40254027        if (!fSuccess)
     
    40404042        const UIDataSettingsMachineStorageController &newControllerData = controllerCache.data();
    40414043
    4042         /* Make sure controller doesn't exist: */
     4044        /* Search for a controller with the same name: */
    40434045        const CMachine comMachine(m_machine);
    40444046        CStorageController comController = comMachine.GetStorageControllerByName(newControllerData.m_strControllerName);
     
    40464048        AssertReturn(fSuccess, false);
    40474049
    4048         /* Create controller: */
     4050        /* Make sure controller doesn't exist: */
    40494051        if (fSuccess)
    40504052        {
     4053            /* Create controller: */
    40514054            comController = m_machine.AddStorageController(newControllerData.m_strControllerName, newControllerData.m_controllerBus);
    40524055            fSuccess = m_machine.isOk() && comController.isNotNull();
    40534056        }
     4057
    40544058        /* Show error message if necessary: */
    40554059        if (!fSuccess)
    40564060            msgCenter().cannotSaveStorageSettings(m_machine, this);
    4057 
    4058         /* Save controller type: */
    4059         if (fSuccess)
    4060         {
    4061             comController.SetControllerType(newControllerData.m_controllerType);
    4062             fSuccess = comController.isOk();
    4063         }
    4064         /* Save whether controller uses host IO cache: */
    4065         if (fSuccess)
    4066         {
    4067             comController.SetUseHostIOCache(newControllerData.m_fUseHostIOCache);
    4068             fSuccess = comController.isOk();
    4069         }
    4070         /* Save controller port number: */
    4071         if (   fSuccess
    4072             && (   newControllerData.m_controllerBus == KStorageBus_SATA
    4073                 || newControllerData.m_controllerBus == KStorageBus_SAS
    4074                 || newControllerData.m_controllerBus == KStorageBus_PCIe))
    4075         {
    4076             ULONG uNewPortCount = newControllerData.m_uPortCount;
     4061        else
     4062        {
     4063            /* Save controller type: */
    40774064            if (fSuccess)
    40784065            {
    4079                 uNewPortCount = qMax(uNewPortCount, comController.GetMinPortCount());
     4066                comController.SetControllerType(newControllerData.m_controllerType);
    40804067                fSuccess = comController.isOk();
    40814068            }
     4069            /* Save whether controller uses host IO cache: */
    40824070            if (fSuccess)
    40834071            {
    4084                 uNewPortCount = qMin(uNewPortCount, comController.GetMaxPortCount());
     4072                comController.SetUseHostIOCache(newControllerData.m_fUseHostIOCache);
    40854073                fSuccess = comController.isOk();
    40864074            }
    4087             if (fSuccess)
     4075            /* Save controller port number: */
     4076            if (   fSuccess
     4077                && (   newControllerData.m_controllerBus == KStorageBus_SATA
     4078                    || newControllerData.m_controllerBus == KStorageBus_SAS
     4079                    || newControllerData.m_controllerBus == KStorageBus_PCIe))
    40884080            {
    4089                 comController.SetPortCount(uNewPortCount);
    4090                 fSuccess = comController.isOk();
     4081                ULONG uNewPortCount = newControllerData.m_uPortCount;
     4082                if (fSuccess)
     4083                {
     4084                    uNewPortCount = qMax(uNewPortCount, comController.GetMinPortCount());
     4085                    fSuccess = comController.isOk();
     4086                }
     4087                if (fSuccess)
     4088                {
     4089                    uNewPortCount = qMin(uNewPortCount, comController.GetMaxPortCount());
     4090                    fSuccess = comController.isOk();
     4091                }
     4092                if (fSuccess)
     4093                {
     4094                    comController.SetPortCount(uNewPortCount);
     4095                    fSuccess = comController.isOk();
     4096                }
    40914097            }
    4092         }
    4093         /* Show error message if necessary: */
    4094         if (!fSuccess)
    4095             msgCenter().cannotSaveStorageControllerSettings(comController, this);
    4096 
    4097         /* For each attachment: */
    4098         for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
    4099         {
    4100             /* Get attachment cache: */
    4101             const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
    4102 
    4103             /* Create attachment if it was not 'removed': */
    4104             if (!attachmentCache.wasRemoved())
    4105                 fSuccess = createStorageAttachment(controllerCache, attachmentCache);
     4098
     4099            /* Show error message if necessary: */
     4100            if (!fSuccess)
     4101                msgCenter().cannotSaveStorageControllerSettings(comController, this);
     4102
     4103            /* For each attachment: */
     4104            for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
     4105            {
     4106                /* Get attachment cache: */
     4107                const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
     4108
     4109                /* Create attachment if it was not 'removed': */
     4110                if (!attachmentCache.wasRemoved())
     4111                    fSuccess = createStorageAttachment(controllerCache, attachmentCache);
     4112            }
    41064113        }
    41074114    }
     
    41224129        const UIDataSettingsMachineStorageController &newControllerData = controllerCache.data();
    41234130
    4124         /* Make sure controller really exists: */
     4131        /* Search for a controller with the same name: */
    41254132        CStorageController comController = m_machine.GetStorageControllerByName(oldControllerData.m_strControllerName);
    41264133        fSuccess = m_machine.isOk() && comController.isNotNull();
     4134
    41274135        /* Show error message if necessary: */
    41284136        if (!fSuccess)
    41294137            msgCenter().cannotSaveStorageSettings(m_machine, this);
    4130 
    4131         /* Save controller type: */
    4132         if (fSuccess && newControllerData.m_controllerType != oldControllerData.m_controllerType)
    4133         {
    4134             comController.SetControllerType(newControllerData.m_controllerType);
    4135             fSuccess = comController.isOk();
    4136         }
    4137         /* Save whether controller uses IO cache: */
    4138         if (fSuccess && newControllerData.m_fUseHostIOCache != oldControllerData.m_fUseHostIOCache)
    4139         {
    4140             comController.SetUseHostIOCache(newControllerData.m_fUseHostIOCache);
    4141             fSuccess = comController.isOk();
    4142         }
    4143         /* Save controller port number: */
    4144         if (   fSuccess
    4145             && newControllerData.m_uPortCount != oldControllerData.m_uPortCount
    4146             && (   newControllerData.m_controllerBus == KStorageBus_SATA
    4147                 || newControllerData.m_controllerBus == KStorageBus_SAS
    4148                 || newControllerData.m_controllerBus == KStorageBus_PCIe))
    4149         {
    4150             ULONG uNewPortCount = newControllerData.m_uPortCount;
    4151             if (fSuccess)
     4138        else
     4139        {
     4140            /* Save controller type: */
     4141            if (fSuccess && newControllerData.m_controllerType != oldControllerData.m_controllerType)
    41524142            {
    4153                 uNewPortCount = qMax(uNewPortCount, comController.GetMinPortCount());
     4143                comController.SetControllerType(newControllerData.m_controllerType);
    41544144                fSuccess = comController.isOk();
    41554145            }
    4156             if (fSuccess)
     4146            /* Save whether controller uses IO cache: */
     4147            if (fSuccess && newControllerData.m_fUseHostIOCache != oldControllerData.m_fUseHostIOCache)
    41574148            {
    4158                 uNewPortCount = qMin(uNewPortCount, comController.GetMaxPortCount());
     4149                comController.SetUseHostIOCache(newControllerData.m_fUseHostIOCache);
    41594150                fSuccess = comController.isOk();
    41604151            }
    4161             if (fSuccess)
     4152            /* Save controller port number: */
     4153            if (   fSuccess
     4154                && newControllerData.m_uPortCount != oldControllerData.m_uPortCount
     4155                && (   newControllerData.m_controllerBus == KStorageBus_SATA
     4156                    || newControllerData.m_controllerBus == KStorageBus_SAS
     4157                    || newControllerData.m_controllerBus == KStorageBus_PCIe))
    41624158            {
    4163                 comController.SetPortCount(uNewPortCount);
    4164                 fSuccess = comController.isOk();
     4159                ULONG uNewPortCount = newControllerData.m_uPortCount;
     4160                if (fSuccess)
     4161                {
     4162                    uNewPortCount = qMax(uNewPortCount, comController.GetMinPortCount());
     4163                    fSuccess = comController.isOk();
     4164                }
     4165                if (fSuccess)
     4166                {
     4167                    uNewPortCount = qMin(uNewPortCount, comController.GetMaxPortCount());
     4168                    fSuccess = comController.isOk();
     4169                }
     4170                if (fSuccess)
     4171                {
     4172                    comController.SetPortCount(uNewPortCount);
     4173                    fSuccess = comController.isOk();
     4174                }
    41654175            }
    4166         }
    4167         /* Show error message if necessary: */
    4168         if (!fSuccess)
    4169             msgCenter().cannotSaveStorageControllerSettings(comController, this);
    4170 
    4171         /* For each attachment ('removing' step): */
    4172         // We need to separately remove attachments first because
    4173         // there could be limited amount of attachments available.
    4174         for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
    4175         {
    4176             /* Get attachment cache: */
    4177             const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
    4178 
    4179             /* Remove attachment marked for 'remove' or 'update' (if it can't be updated): */
    4180             if (attachmentCache.wasRemoved() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache)))
    4181                 fSuccess = removeStorageAttachment(controllerCache, attachmentCache);
    4182         }
    4183 
    4184         /* For each attachment ('creating' step): */
    4185         for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
    4186         {
    4187             /* Get attachment cache: */
    4188             const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
    4189 
    4190             /* Create attachment marked for 'create' or 'update' (if it can't be updated): */
    4191             if (attachmentCache.wasCreated() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache)))
    4192                 fSuccess = createStorageAttachment(controllerCache, attachmentCache);
    4193 
    4194             else
    4195 
    4196             /* Update attachment marked for 'update' (if it can be updated): */
    4197             if (attachmentCache.wasUpdated() && isAttachmentCouldBeUpdated(attachmentCache))
    4198                 fSuccess = updateStorageAttachment(controllerCache, attachmentCache);
     4176
     4177            /* Show error message if necessary: */
     4178            if (!fSuccess)
     4179                msgCenter().cannotSaveStorageControllerSettings(comController, this);
     4180
     4181            /* For each attachment ('removing' step): */
     4182            // We need to separately remove attachments first because
     4183            // there could be limited amount of attachments available.
     4184            for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
     4185            {
     4186                /* Get attachment cache: */
     4187                const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
     4188
     4189                /* Remove attachment marked for 'remove' or 'update' (if it can't be updated): */
     4190                if (attachmentCache.wasRemoved() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache)))
     4191                    fSuccess = removeStorageAttachment(controllerCache, attachmentCache);
     4192            }
     4193
     4194            /* For each attachment ('creating' step): */
     4195            for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
     4196            {
     4197                /* Get attachment cache: */
     4198                const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
     4199
     4200                /* Create attachment marked for 'create' or 'update' (if it can't be updated): */
     4201                if (attachmentCache.wasCreated() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache)))
     4202                    fSuccess = createStorageAttachment(controllerCache, attachmentCache);
     4203
     4204                else
     4205
     4206                /* Update attachment marked for 'update' (if it can be updated): */
     4207                if (attachmentCache.wasUpdated() && isAttachmentCouldBeUpdated(attachmentCache))
     4208                    fSuccess = updateStorageAttachment(controllerCache, attachmentCache);
     4209            }
    41994210        }
    42004211    }
     
    42164227        const UIDataSettingsMachineStorageAttachment &oldAttachmentData = attachmentCache.base();
    42174228
    4218         /* Make sure attachment really exists: */
     4229        /* Search for an attachment with the same parameters: */
    42194230        const CMediumAttachment &comAttachment = m_machine.GetMediumAttachment(oldControllerData.m_strControllerName,
    42204231                                                                               oldAttachmentData.m_iAttachmentPort,
     
    42224233        fSuccess = m_machine.isOk() && comAttachment.isNotNull();
    42234234
    4224         /* Remove attachment: */
     4235        /* Make sure attachment really exists: */
    42254236        if (fSuccess)
    42264237        {
     4238            /* Remove attachment: */
    42274239            m_machine.DetachDevice(oldControllerData.m_strControllerName,
    42284240                                   oldAttachmentData.m_iAttachmentPort,
     
    42304242            fSuccess = m_machine.isOk();
    42314243        }
     4244
    42324245        /* Show error message if necessary: */
    42334246        if (!fSuccess)
     
    42514264        const UIDataSettingsMachineStorageAttachment &newAttachmentData = attachmentCache.data();
    42524265
    4253         /* Make sure attachment doesn't exist: */
     4266        /* Search for an attachment with the same parameters: */
    42544267        const CMachine comMachine(m_machine);
    42554268        const CMediumAttachment &comAttachment = comMachine.GetMediumAttachment(newControllerData.m_strControllerName,
     
    42594272        AssertReturn(fSuccess, false);
    42604273
    4261         /* Create attachment: */
     4274        /* Make sure attachment doesn't exist: */
    42624275        if (fSuccess)
    42634276        {
     4277            /* Create attachment: */
    42644278            const UIMedium vboxMedium = vboxGlobal().medium(newAttachmentData.m_strAttachmentMediumId);
    42654279            const CMedium comMedium = vboxMedium.medium();
     
    42714285            fSuccess = m_machine.isOk();
    42724286        }
     4287
    42734288        if (newAttachmentData.m_attachmentType == KDeviceType_DVD)
    42744289        {
     
    43044319            }
    43054320        }
     4321
    43064322        if (newControllerData.m_controllerBus == KStorageBus_SATA || newControllerData.m_controllerBus == KStorageBus_USB)
    43074323        {
     
    43164332            }
    43174333        }
     4334
    43184335        /* Show error message if necessary: */
    43194336        if (!fSuccess)
     
    43374354        const UIDataSettingsMachineStorageAttachment &newAttachmentData = attachmentCache.data();
    43384355
    4339         /* Make sure attachment really exists: */
     4356        /* Search for an attachment with the same parameters: */
    43404357        const CMediumAttachment &comAttachment = m_machine.GetMediumAttachment(newControllerData.m_strControllerName,
    43414358                                                                               newAttachmentData.m_iAttachmentPort,
    43424359                                                                               newAttachmentData.m_iAttachmentDevice);
    43434360        fSuccess = m_machine.isOk() && comAttachment.isNotNull();
     4361
    43444362        /* Show error message if necessary: */
    43454363        if (!fSuccess)
    43464364            msgCenter().cannotSaveStorageSettings(m_machine, this);
    43474365
    4348         /* Remount attachment: */
     4366        /* Make sure attachment doesn't exist: */
    43494367        if (fSuccess)
    43504368        {
     4369            /* Remount attachment: */
    43514370            const UIMedium vboxMedium = vboxGlobal().medium(newAttachmentData.m_strAttachmentMediumId);
    43524371            const CMedium comMedium = vboxMedium.medium();
     
    43584377            fSuccess = m_machine.isOk();
    43594378        }
     4379
    43604380        if (newAttachmentData.m_attachmentType == KDeviceType_DVD)
    43614381        {
     
    43914411            }
    43924412        }
     4413
    43934414        if (newControllerData.m_controllerBus == KStorageBus_SATA || newControllerData.m_controllerBus == KStorageBus_USB)
    43944415        {
     
    44034424            }
    44044425        }
     4426
    44054427        /* Show error message if necessary: */
    44064428        if (!fSuccess)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r66549 r66555  
    11361136            }
    11371137        }
     1138
    11381139        /* Show error message if necessary: */
    11391140        if (!fSuccess)
     
    11741175            fSuccess = m_machine.isOk();
    11751176        }
     1177
    11761178        /* Show error message if necessary: */
    11771179        if (!fSuccess)
     
    12121214            fSuccess = m_machine.isOk();
    12131215        }
     1216
    12141217        /* Show error message if necessary: */
    12151218        if (!fSuccess)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r66552 r66555  
    10121012            CUSBDeviceFilters comFiltersObject = m_machine.GetUSBDeviceFilters();
    10131013            fSuccess = m_machine.isOk() && comFiltersObject.isNotNull();
     1014
    10141015            /* Show error message if necessary: */
    10151016            if (!fSuccess)
    10161017                msgCenter().cannotSaveUSBSettings(m_machine, this);
    1017 
    1018             /* For each filter data set: */
    1019             int iOperationPosition = 0;
    1020             for (int iFilterIndex = 0; fSuccess && iFilterIndex < m_pCache->childCount(); ++iFilterIndex)
    1021             {
    1022                 /* Check if USB filter data was changed: */
    1023                 const UISettingsCacheMachineUSBFilter &filterCache = m_pCache->child(iFilterIndex);
    1024                 if (filterCache.wasChanged())
     1018            else
     1019            {
     1020                /* For each filter data set: */
     1021                int iOperationPosition = 0;
     1022                for (int iFilterIndex = 0; fSuccess && iFilterIndex < m_pCache->childCount(); ++iFilterIndex)
    10251023                {
     1024                    /* Check if USB filter data was changed: */
     1025                    const UISettingsCacheMachineUSBFilter &filterCache = m_pCache->child(iFilterIndex);
     1026
    10261027                    /* Remove filter marked for 'remove' or 'update': */
    1027                     if (filterCache.wasRemoved() || filterCache.wasUpdated())
     1028                    if (fSuccess && (filterCache.wasRemoved() || filterCache.wasUpdated()))
    10281029                    {
    10291030                        fSuccess = removeUSBFilter(comFiltersObject, iOperationPosition);
     
    10331034
    10341035                    /* Create filter marked for 'create' or 'update': */
    1035                     if (filterCache.wasCreated() || filterCache.wasUpdated())
     1036                    if (fSuccess && (filterCache.wasCreated() || filterCache.wasUpdated()))
    10361037                        fSuccess = createUSBFilter(comFiltersObject, iOperationPosition, filterCache.data());
     1038
     1039                    /* Advance operation position: */
     1040                    ++iOperationPosition;
    10371041                }
    1038                 /* Advance operation position: */
    1039                 ++iOperationPosition;
    10401042            }
    10411043        }
     
    10551057        const CUSBControllerVector &controllers = m_machine.GetUSBControllers();
    10561058        fSuccess = m_machine.isOk();
     1059
    10571060        /* Show error message if necessary: */
    10581061        if (!fSuccess)
     
    10791082                fSuccess = comController.isOk();
    10801083            }
     1084
    10811085            /* Show error message if necessary: */
    10821086            if (!fSuccess)
    10831087                msgCenter().cannotSaveUSBControllerSettings(comController, this);
    1084 
    1085             /* Pass only if requested types were not defined or contains the one we found: */
    1086             if (!types.isEmpty() && !types.contains(enmType))
    1087                 continue;
    1088 
    1089             /* Remove controller: */
    1090             if (fSuccess)
    1091             {
    1092                 m_machine.RemoveUSBController(comController.GetName());
    1093                 fSuccess = m_machine.isOk();
    1094             }
    1095             /* Show error message if necessary: */
    1096             if (!fSuccess)
    1097                 msgCenter().cannotSaveUSBSettings(m_machine, this);
     1088            else
     1089            {
     1090                /* Pass only if requested types were not defined or contains the one we found: */
     1091                if (!types.isEmpty() && !types.contains(enmType))
     1092                    continue;
     1093
     1094                /* Remove controller: */
     1095                if (fSuccess)
     1096                {
     1097                    m_machine.RemoveUSBController(comController.GetName());
     1098                    fSuccess = m_machine.isOk();
     1099                }
     1100
     1101                /* Show error message if necessary: */
     1102                if (!fSuccess)
     1103                    msgCenter().cannotSaveUSBSettings(m_machine, this);
     1104            }
    10981105        }
    10991106    }
     
    11281135            fSuccess = m_machine.isOk();
    11291136        }
     1137
    11301138        /* Show error message if necessary: */
    11311139        if (!fSuccess)
    11321140            msgCenter().cannotSaveUSBSettings(m_machine, this);
    1133 
    1134         /* For requested controller type: */
    1135         switch (enmType)
    1136         {
    1137             case KUSBControllerType_OHCI:
    1138             {
    1139                 /* Remove excessive controllers: */
    1140                 if (cXhciCtls || cEhciCtls)
    1141                     fSuccess = removeUSBControllers(QSet<KUSBControllerType>()
    1142                                                     << KUSBControllerType_XHCI
    1143                                                     << KUSBControllerType_EHCI);
    1144 
    1145                 /* Add required controller: */
    1146                 if (fSuccess && !cOhciCtls)
     1141        else
     1142        {
     1143            /* For requested controller type: */
     1144            switch (enmType)
     1145            {
     1146                case KUSBControllerType_OHCI:
    11471147                {
    1148                     m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
    1149                     fSuccess = m_machine.isOk();
     1148                    /* Remove excessive controllers: */
     1149                    if (cXhciCtls || cEhciCtls)
     1150                        fSuccess = removeUSBControllers(QSet<KUSBControllerType>()
     1151                                                        << KUSBControllerType_XHCI
     1152                                                        << KUSBControllerType_EHCI);
     1153
     1154                    /* Add required controller: */
     1155                    if (fSuccess && !cOhciCtls)
     1156                    {
     1157                        m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
     1158                        fSuccess = m_machine.isOk();
     1159
     1160                        /* Show error message if necessary: */
     1161                        if (!fSuccess)
     1162                            msgCenter().cannotSaveUSBSettings(m_machine, this);
     1163                    }
     1164
     1165                    break;
    11501166                }
    1151                 /* Show error message if necessary: */
    1152                 if (!fSuccess)
    1153                     msgCenter().cannotSaveUSBSettings(m_machine, this);
    1154 
    1155                 break;
    1156             }
    1157             case KUSBControllerType_EHCI:
    1158             {
    1159                 /* Remove excessive controllers: */
    1160                 if (cXhciCtls)
    1161                     fSuccess = removeUSBControllers(QSet<KUSBControllerType>()
    1162                                                     << KUSBControllerType_XHCI);
    1163 
    1164                 /* Add required controllers: */
    1165                 if (fSuccess && !cOhciCtls)
     1167                case KUSBControllerType_EHCI:
    11661168                {
    1167                     m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
    1168                     fSuccess = m_machine.isOk();
     1169                    /* Remove excessive controllers: */
     1170                    if (cXhciCtls)
     1171                        fSuccess = removeUSBControllers(QSet<KUSBControllerType>()
     1172                                                        << KUSBControllerType_XHCI);
     1173
     1174                    /* Add required controllers: */
     1175                    if (fSuccess)
     1176                    {
     1177                        if (fSuccess && !cOhciCtls)
     1178                        {
     1179                            m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
     1180                            fSuccess = m_machine.isOk();
     1181                        }
     1182                        if (fSuccess && !cEhciCtls)
     1183                        {
     1184                            m_machine.AddUSBController("EHCI", KUSBControllerType_EHCI);
     1185                            fSuccess = m_machine.isOk();
     1186                        }
     1187
     1188                        /* Show error message if necessary: */
     1189                        if (!fSuccess)
     1190                            msgCenter().cannotSaveUSBSettings(m_machine, this);
     1191                    }
     1192
     1193                    break;
    11691194                }
    1170                 if (fSuccess && !cEhciCtls)
     1195                case KUSBControllerType_XHCI:
    11711196                {
    1172                     m_machine.AddUSBController("EHCI", KUSBControllerType_EHCI);
    1173                     fSuccess = m_machine.isOk();
     1197                    /* Remove excessive controllers: */
     1198                    if (cEhciCtls || cOhciCtls)
     1199                        fSuccess = removeUSBControllers(QSet<KUSBControllerType>()
     1200                                                        << KUSBControllerType_EHCI
     1201                                                        << KUSBControllerType_OHCI);
     1202
     1203                    /* Add required controller: */
     1204                    if (fSuccess && !cXhciCtls)
     1205                    {
     1206                        m_machine.AddUSBController("xHCI", KUSBControllerType_XHCI);
     1207                        fSuccess = m_machine.isOk();
     1208
     1209                        /* Show error message if necessary: */
     1210                        if (!fSuccess)
     1211                            msgCenter().cannotSaveUSBSettings(m_machine, this);
     1212                    }
     1213
     1214                    break;
    11741215                }
    1175                 /* Show error message if necessary: */
    1176                 if (!fSuccess)
    1177                     msgCenter().cannotSaveUSBSettings(m_machine, this);
    1178 
    1179                 break;
    1180             }
    1181             case KUSBControllerType_XHCI:
    1182             {
    1183                 /* Remove excessive controllers: */
    1184                 if (cEhciCtls || cOhciCtls)
    1185                     fSuccess = removeUSBControllers(QSet<KUSBControllerType>()
    1186                                                     << KUSBControllerType_EHCI
    1187                                                     << KUSBControllerType_OHCI);
    1188 
    1189                 /* Add required controller: */
    1190                 if (fSuccess && !cXhciCtls)
    1191                 {
    1192                     m_machine.AddUSBController("xHCI", KUSBControllerType_XHCI);
    1193                     fSuccess = m_machine.isOk();
    1194                 }
    1195                 /* Show error message if necessary: */
    1196                 if (!fSuccess)
    1197                     msgCenter().cannotSaveUSBSettings(m_machine, this);
    1198 
    1199                 break;
    1200             }
    1201             default:
    1202                 break;
     1216                default:
     1217                    break;
     1218            }
    12031219        }
    12041220    }
     
    12171233        comFiltersObject.RemoveDeviceFilter(iPosition);
    12181234        fSuccess = comFiltersObject.isOk();
     1235
    12191236        /* Show error message if necessary: */
    12201237        if (!fSuccess)
     
    12351252        CUSBDeviceFilter comFilter = comFiltersObject.CreateDeviceFilter(filterData.m_strName);
    12361253        fSuccess = comFiltersObject.isOk() && comFilter.isNotNull();
     1254
    12371255        /* Show error message if necessary: */
    12381256        if (!fSuccess)
    12391257            msgCenter().cannotSaveUSBDeviceFiltersSettings(comFiltersObject, this);
    1240 
    1241         /* Save whether filter is active: */
    1242         if (fSuccess)
    1243         {
    1244             comFilter.SetActive(filterData.m_fActive);
    1245             fSuccess = comFilter.isOk();
    1246         }
    1247         /* Save filter Vendor ID: */
    1248         if (fSuccess)
    1249         {
    1250             comFilter.SetVendorId(filterData.m_strVendorId);
    1251             fSuccess = comFilter.isOk();
    1252         }
    1253         /* Save filter Product ID: */
    1254         if (fSuccess)
    1255         {
    1256             comFilter.SetProductId(filterData.m_strProductId);
    1257             fSuccess = comFilter.isOk();
    1258         }
    1259         /* Save filter revision: */
    1260         if (fSuccess)
    1261         {
    1262             comFilter.SetRevision(filterData.m_strRevision);
    1263             fSuccess = comFilter.isOk();
    1264         }
    1265         /* Save filter manufacturer: */
    1266         if (fSuccess)
    1267         {
    1268             comFilter.SetManufacturer(filterData.m_strManufacturer);
    1269             fSuccess = comFilter.isOk();
    1270         }
    1271         /* Save filter product: */
    1272         if (fSuccess)
    1273         {
    1274             comFilter.SetProduct(filterData.m_strProduct);
    1275             fSuccess = comFilter.isOk();
    1276         }
    1277         /* Save filter serial number: */
    1278         if (fSuccess)
    1279         {
    1280             comFilter.SetSerialNumber(filterData.m_strSerialNumber);
    1281             fSuccess = comFilter.isOk();
    1282         }
    1283         /* Save filter port: */
    1284         if (fSuccess)
    1285         {
    1286             comFilter.SetPort(filterData.m_strPort);
    1287             fSuccess = comFilter.isOk();
    1288         }
    1289         /* Save filter remote mode: */
    1290         if (fSuccess)
    1291         {
    1292             comFilter.SetRemote(filterData.m_strRemote);
    1293             fSuccess = comFilter.isOk();
    1294         }
    1295         /* Show error message if necessary: */
    1296         if (!fSuccess)
    1297             msgCenter().cannotSaveUSBDeviceFilterSettings(comFilter, this);
    1298 
    1299         /* Insert filter onto corresponding position: */
    1300         if (fSuccess)
    1301         {
    1302             comFiltersObject.InsertDeviceFilter(iPosition, comFilter);
    1303             fSuccess = comFiltersObject.isOk();
    1304         }
    1305         /* Show error message if necessary: */
    1306         if (!fSuccess)
    1307             msgCenter().cannotSaveUSBDeviceFiltersSettings(comFiltersObject, this);
     1258        else
     1259        {
     1260            /* Save whether filter is active: */
     1261            if (fSuccess)
     1262            {
     1263                comFilter.SetActive(filterData.m_fActive);
     1264                fSuccess = comFilter.isOk();
     1265            }
     1266            /* Save filter Vendor ID: */
     1267            if (fSuccess)
     1268            {
     1269                comFilter.SetVendorId(filterData.m_strVendorId);
     1270                fSuccess = comFilter.isOk();
     1271            }
     1272            /* Save filter Product ID: */
     1273            if (fSuccess)
     1274            {
     1275                comFilter.SetProductId(filterData.m_strProductId);
     1276                fSuccess = comFilter.isOk();
     1277            }
     1278            /* Save filter revision: */
     1279            if (fSuccess)
     1280            {
     1281                comFilter.SetRevision(filterData.m_strRevision);
     1282                fSuccess = comFilter.isOk();
     1283            }
     1284            /* Save filter manufacturer: */
     1285            if (fSuccess)
     1286            {
     1287                comFilter.SetManufacturer(filterData.m_strManufacturer);
     1288                fSuccess = comFilter.isOk();
     1289            }
     1290            /* Save filter product: */
     1291            if (fSuccess)
     1292            {
     1293                comFilter.SetProduct(filterData.m_strProduct);
     1294                fSuccess = comFilter.isOk();
     1295            }
     1296            /* Save filter serial number: */
     1297            if (fSuccess)
     1298            {
     1299                comFilter.SetSerialNumber(filterData.m_strSerialNumber);
     1300                fSuccess = comFilter.isOk();
     1301            }
     1302            /* Save filter port: */
     1303            if (fSuccess)
     1304            {
     1305                comFilter.SetPort(filterData.m_strPort);
     1306                fSuccess = comFilter.isOk();
     1307            }
     1308            /* Save filter remote mode: */
     1309            if (fSuccess)
     1310            {
     1311                comFilter.SetRemote(filterData.m_strRemote);
     1312                fSuccess = comFilter.isOk();
     1313            }
     1314
     1315            /* Show error message if necessary: */
     1316            if (!fSuccess)
     1317                msgCenter().cannotSaveUSBDeviceFilterSettings(comFilter, this);
     1318            else
     1319            {
     1320                /* Insert filter onto corresponding position: */
     1321                comFiltersObject.InsertDeviceFilter(iPosition, comFilter);
     1322                fSuccess = comFiltersObject.isOk();
     1323
     1324                /* Show error message if necessary: */
     1325                if (!fSuccess)
     1326                    msgCenter().cannotSaveUSBDeviceFiltersSettings(comFiltersObject, this);
     1327            }
     1328        }
    13081329    }
    13091330    /* Return result: */
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