VirtualBox

Changeset 77592 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 7, 2019 8:46:46 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6769. cleaning the created folder correctly as the wizard is cancelled.

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

Legend:

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

    r76606 r77592  
    5656    /* Register classes: */
    5757    qRegisterMetaType<CGuestOSType>();
     58
     59    connect(this, &UIWizardNewVM::rejected, this, &UIWizardNewVM::sltHandleWizardCancel);
    5860}
    5961
     
    326328}
    327329
     330void UIWizardNewVM::sltHandleWizardCancel()
     331{
     332    switch (mode())
     333    {
     334        case WizardMode_Basic:
     335        {
     336            UIWizardNewVMPageBasic1 *pPage1 = qobject_cast<UIWizardNewVMPageBasic1*> (page(Page1));
     337            if (pPage1)
     338                pPage1->cleanupMachineFolder(true);
     339            break;
     340        }
     341        case WizardMode_Expert:
     342        {
     343            UIWizardNewVMPageExpert *pPage = qobject_cast<UIWizardNewVMPageExpert*> (page(PageExpert));
     344            if (pPage)
     345                pPage->cleanupMachineFolder(true);
     346            break;
     347        }
     348        default:
     349            break;
     350    }
     351}
     352
    328353void UIWizardNewVM::retranslateUi()
    329354{
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r76581 r77592  
    6868    friend class UIWizardNewVMPageExpert;
    6969
     70private slots:
     71
     72    void sltHandleWizardCancel();
     73
    7074private:
    7175
     
    9094
    9195#endif /* !FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVM_h */
    92 
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp

    r76606 r77592  
    245245    composeMachineFilePath();
    246246
    247 
    248247    /* Check if the folder already exists and check if it has been created by this wizard */
    249248    if (QDir(m_strMachineFolder).exists())
     
    271270}
    272271
    273 bool UIWizardNewVMPage1::cleanupMachineFolder()
     272bool UIWizardNewVMPage1::cleanupMachineFolder(bool fWizardCancel /* = false */)
    274273{
    275274    /* Make sure folder was previosly created: */
    276     if (!m_strCreatedFolder.isEmpty() && m_strCreatedFolder != m_strMachineFolder)
     275    if (m_strCreatedFolder.isEmpty())
     276        return true;
     277    /* Clean this folder if the machine folder has been changed by the user or we are cancelling the wizard: */
     278    if (m_strCreatedFolder != m_strMachineFolder || fWizardCancel)
    277279    {
    278280        /* Try to cleanup folder (and it's predecessors): */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h

    r76581 r77592  
    4343    bool createMachineFolder();
    4444    /** Removes a previously created folder (if exists) before creating a new one.
    45      *  used during page cleanup and new folder creation. */
    46     bool cleanupMachineFolder();
     45     *  used during page cleanup and new folder creation. Called upon page Next/Back and
     46     *  wizard cancel */
     47    bool cleanupMachineFolder(bool fWizardCancel = false);
    4748
    4849    QString machineFilePath() const;
     
    7778    bool m_fSupportsHWVirtEx;
    7879    bool m_fSupportsLongMode;
     80    friend class UIWizardNewVM;
    7981};
    8082
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