VirtualBox

Changeset 105260 in vbox


Ignore:
Timestamp:
Jul 10, 2024 2:01:29 PM (5 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10707. Checking virtual media file location during wizard sanity checks.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDExpertPage.cpp

    r104985 r105260  
    182182bool UIWizardCloneVDExpertPage::isComplete() const
    183183{
    184     bool fResult = true;
    185 
    186     if (m_pFormatComboBox)
    187         fResult = m_pFormatComboBox->mediumFormat().isNull();
    188     if (m_pVariantWidget)
    189         fResult = m_pVariantWidget->isComplete();
    190     if (m_pMediumSizePathGroupBox)
    191         fResult =  m_pMediumSizePathGroupBox->isComplete();
    192 
    193     return fResult;
     184    AssertReturn(m_pFormatComboBox, false);
     185    AssertReturn(m_pVariantWidget, false);
     186    AssertReturn(m_pMediumSizePathGroupBox, false);
     187
     188    if (m_pFormatComboBox->mediumFormat().isNull())
     189        return false;
     190
     191    if (!m_pVariantWidget->isComplete())
     192        return false;
     193
     194    if (!m_pMediumSizePathGroupBox->pathExists())
     195        return false;
     196    if (!m_pMediumSizePathGroupBox->filePathUnique())
     197        return false;
     198
     199    return true;
    194200}
    195201
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPathSizePage.cpp

    r103957 r105260  
    100100{
    101101    AssertReturn(m_pMediumSizePathGroupBox, false);
    102     return m_pMediumSizePathGroupBox->isComplete();
     102    if (!m_pMediumSizePathGroupBox->pathExists())
     103        return false;
     104    if (!m_pMediumSizePathGroupBox->filePathUnique())
     105        return false;
     106    return true;
    103107}
    104108
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardDiskEditors.cpp

    r104985 r105260  
    332332}
    333333
    334 bool UIMediumSizeAndPathGroupBox::isComplete() const
    335 {
     334bool UIMediumSizeAndPathGroupBox::pathExists() const
     335{
     336    /* Check if the path upto file name exists: */
     337    if (!QFileInfo(mediumPath()).exists())
     338    {
     339        m_pLocationEditor->mark(true, tr("Disk file path does not exists"), tr("Disk file path is valid"));
     340        return false;
     341    }
     342    m_pLocationEditor->mark(false, tr("Disk file path does not exists"), tr("Disk file path is valid"));
     343    return true;
     344}
     345
     346bool UIMediumSizeAndPathGroupBox::filePathUnique() const
     347{
     348    /* Check if there is not such file already: */
    336349    if (QFileInfo(mediumFilePath()).exists())
    337350    {
     
    340353    }
    341354    m_pLocationEditor->mark(false, tr("Disk file name is not unique"), tr("Disk file name is valid"));
    342 
    343355    return true;
    344356}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardDiskEditors.h

    r104985 r105260  
    137137    void setMediumSize(qulonglong uSize);
    138138
    139     bool isComplete() const;
     139    bool filePathUnique() const;
     140    bool pathExists() const;
    140141
    141142private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDExpertPage.cpp

    r104985 r105260  
    196196    if (pWizard->mediumSize() > m_uMediumSizeMax || pWizard->mediumSize() < m_uMediumSizeMin)
    197197        return false;
     198    if (!m_pSizeAndPathGroup->filePathUnique() || !m_pSizeAndPathGroup->pathExists())
     199        return false;
    198200    return true;
    199201}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMExpertPage.cpp

    r104899 r105260  
    646646            fIsComplete = false;
    647647        }
     648        /* Check only the uniqueness of the file and not path existence since the vm folder (default medium path)
     649         * has not been created yet: */
     650        if (!m_pSizeAndLocationGroup->filePathUnique())
     651            fIsComplete = false;
    648652    }
    649653    return fIsComplete;
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