VirtualBox

Changeset 88246 in vbox


Ignore:
Timestamp:
Mar 22, 2021 3:25:33 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143446
Message:

FE/Qt: bugref:9515. dont start first run wizard in case an iso image is attached to new vm

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r88115 r88246  
    133133         * 2. or attach a new (empty) one.
    134134         * 3. and if the unattended install is not enabled
     135         * 4. User did not select an ISO image file
    135136         * Usually we are assigning extra-data values through UIExtraDataManager,
    136137         * but in that special case VM was not registered yet, so UIExtraDataManager is unaware of it: */
    137         if (!isUnattendedEnabled() &&
     138        if (ISOFilePath().isEmpty() &&
     139            !isUnattendedEnabled() &&
    138140            !m_virtualDisk.isNull())
    139141            m_machine.SetExtraData(GUI_FirstRun, "yes");
     
    428430        {
    429431            CMedium opticalDisk;
    430             QString strISOFilePath = getStringFieldValue("ISOFilePath");
     432            QString strISOFilePath = ISOFilePath();
    431433            if (!strISOFilePath.isEmpty() && !getBoolFieldValue("isUnattendedEnabled"))
    432434            {
    433                 QFileInfo isoFileInfo(strISOFilePath);
    434                 if (isoFileInfo.exists() && isoFileInfo.isReadable())
    435                 {
    436                     CVirtualBox vbox = uiCommon().virtualBox();
    437                     opticalDisk =
    438                         vbox.OpenMedium(strISOFilePath, KDeviceType_DVD,  KAccessMode_ReadWrite, false);
    439                     if (!vbox.isOk())
    440                         msgCenter().cannotOpenMedium(vbox, strISOFilePath, this);
    441                 }
     435                CVirtualBox vbox = uiCommon().virtualBox();
     436                opticalDisk =
     437                    vbox.OpenMedium(strISOFilePath, KDeviceType_DVD,  KAccessMode_ReadWrite, false);
     438                if (!vbox.isOk())
     439                    msgCenter().cannotOpenMedium(vbox, strISOFilePath, this);
    442440            }
    443441            machine.AttachDevice(comDVDController.GetName(), 1, 0, KDeviceType_DVD, opticalDisk);
     
    634632    setField("installGuestAdditions", m_unattendedInstallData.m_fInstallGuestAdditions);
    635633    setField("guestAdditionsISOPath", m_unattendedInstallData.m_strGuestAdditionsISOPath);
     634}
     635
     636QString UIWizardNewVM::ISOFilePath() const
     637{
     638    QString strPath = getStringFieldValue("ISOFilePath");
     639    if (strPath.isNull() || strPath.isEmpty())
     640        return QString();
     641    QFileInfo isoFileInfo(strPath);
     642    if (isoFileInfo.exists() && isoFileInfo.isReadable())
     643        return strPath;
     644    return QString();
    636645}
    637646
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r88038 r88246  
    130130    QString getNextControllerName(KStorageBus type);
    131131    void setFieldsFromDefaultUnttendedInstallData();
     132    /* Returns ISO file path if a readable ISO file is selected. Returns an empty string otherwise. */
     133    QString ISOFilePath() const;
    132134
    133135    /** @name Variables
Note: See TracChangeset for help on using the changeset viewer.

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