VirtualBox

Changeset 91578 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 5, 2021 5:24:33 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9996: UIWizardImportApp: Moving appliance related code from UIApplianceImportEditorWidget to UIWizardImportApp itself where it belongs.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.cpp

    r91567 r91578  
    2222#include "QITreeView.h"
    2323#include "UIApplianceImportEditorWidget.h"
    24 #include "UICommon.h"
    2524#include "UIMessageCenter.h"
    26 #include "UINotificationCenter.h"
    27 #include "UIWizardImportApp.h"
    28 
    29 /* COM includes: */
    30 #include "CAppliance.h"
    3125
    3226
     
    4943*********************************************************************************************************************************/
    5044
    51 UIApplianceImportEditorWidget::UIApplianceImportEditorWidget(QWidget *pParent)
     45UIApplianceImportEditorWidget::UIApplianceImportEditorWidget(QWidget *pParent /* = 0 */)
    5246    : UIApplianceEditorWidget(pParent)
    5347{
    5448}
    5549
    56 bool UIApplianceImportEditorWidget::setFile(const QString& strFile)
     50void UIApplianceImportEditorWidget::setAppliance(const CAppliance &comAppliance)
    5751{
    58     bool fResult = false;
    59     if (!strFile.isEmpty())
     52    /* Cache newly passed appliance: */
     53    m_comAppliance = comAppliance;
     54
     55    /* Cleanup previous stuff: */
     56    if (m_pModel)
     57        delete m_pModel;
     58
     59    /* Prepare model: */
     60    QVector<CVirtualSystemDescription> vsds = m_comAppliance.GetVirtualSystemDescriptions();
     61    m_pModel = new UIApplianceModel(vsds, m_pTreeViewSettings);
     62    if (m_pModel)
    6063    {
    61         CProgress comProgress;
     64        /* Create proxy model: */
     65        ImportSortProxyModel *pProxy = new ImportSortProxyModel(m_pModel);
     66        if (pProxy)
     67        {
     68            pProxy->setSourceModel(m_pModel);
     69            pProxy->sort(ApplianceViewSection_Description, Qt::DescendingOrder);
    6270
    63         /* Create a appliance object: */
    64         CVirtualBox comVBox = uiCommon().virtualBox();
    65         m_pAppliance = new CAppliance(comVBox.CreateAppliance());
    66         fResult = m_pAppliance->isOk();
    67         if (fResult)
    68         {
    69             /* Read the appliance: */
    70             comProgress = m_pAppliance->Read(strFile);
    71             fResult = m_pAppliance->isOk();
    72             if (fResult)
    73             {
    74                 /* Show some progress, so the user know whats going on: */
    75                 msgCenter().showModalProgressDialog(comProgress, tr("Reading Appliance ..."),
    76                                                     ":/progress_reading_appliance_90px.png", this);
    77                 if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    78                     fResult = false;
    79                 else
    80                 {
    81                     /* Now we have to interpret that stuff: */
    82                     m_pAppliance->Interpret();
    83                     fResult = m_pAppliance->isOk();
    84                     if (fResult)
    85                     {
    86                         /* Cleanup previous stuff: */
    87                         if (m_pModel)
    88                             delete m_pModel;
     71            /* Set our own model: */
     72            m_pTreeViewSettings->setModel(pProxy);
     73            /* Set our own delegate: */
     74            UIApplianceDelegate *pDelegate = new UIApplianceDelegate(pProxy);
     75            if (pDelegate)
     76                m_pTreeViewSettings->setItemDelegate(pDelegate);
    8977
    90                         /* Prepare model: */
    91                         QVector<CVirtualSystemDescription> vsds = m_pAppliance->GetVirtualSystemDescriptions();
    92                         m_pModel = new UIApplianceModel(vsds, m_pTreeViewSettings);
    93                         if (m_pModel)
    94                         {
    95                             /* Create proxy model: */
    96                             ImportSortProxyModel *pProxy = new ImportSortProxyModel(m_pModel);
    97                             if (pProxy)
    98                             {
    99                                 pProxy->setSourceModel(m_pModel);
    100                                 pProxy->sort(ApplianceViewSection_Description, Qt::DescendingOrder);
    101 
    102                                 /* Set our own model */
    103                                 m_pTreeViewSettings->setModel(pProxy);
    104                                 /* Set our own delegate */
    105                                 UIApplianceDelegate *pDelegate = new UIApplianceDelegate(pProxy);
    106                                 if (pDelegate)
    107                                     m_pTreeViewSettings->setItemDelegate(pDelegate);
    108 
    109                                 /* For now we hide the original column. This data is displayed as tooltip also. */
    110                                 m_pTreeViewSettings->setColumnHidden(ApplianceViewSection_OriginalValue, true);
    111                                 m_pTreeViewSettings->expandAll();
    112                                 /* Set model root index and make it current: */
    113                                 m_pTreeViewSettings->setRootIndex(pProxy->mapFromSource(m_pModel->root()));
    114                                 m_pTreeViewSettings->setCurrentIndex(pProxy->mapFromSource(m_pModel->root()));
    115                             }
    116                         }
    117 
    118                         /* Check for warnings & if there are one display them: */
    119                         const QVector<QString> warnings = m_pAppliance->GetWarnings();
    120                         bool fWarningsEnabled = warnings.size() > 0;
    121                         foreach (const QString &strText, warnings)
    122                             m_pTextEditWarning->append("- " + strText);
    123                         m_pPaneWarning->setVisible(fWarningsEnabled);
    124                     }
    125                 }
    126             }
    127         }
    128 
    129         if (!fResult)
    130         {
    131             if (!m_pAppliance->isOk())
    132                 msgCenter().cannotImportAppliance(*m_pAppliance, this);
    133             else if (!comProgress.isNull() && (!comProgress.isOk() || comProgress.GetResultCode() != 0))
    134                 msgCenter().cannotImportAppliance(comProgress, m_pAppliance->GetPath(), this);
    135             /* Delete the appliance in a case of an error: */
    136             delete m_pAppliance;
    137             m_pAppliance = 0;
     78            /* For now we hide the original column. This data is displayed as tooltip also. */
     79            m_pTreeViewSettings->setColumnHidden(ApplianceViewSection_OriginalValue, true);
     80            m_pTreeViewSettings->expandAll();
     81            /* Set model root index and make it current: */
     82            m_pTreeViewSettings->setRootIndex(pProxy->mapFromSource(m_pModel->root()));
     83            m_pTreeViewSettings->setCurrentIndex(pProxy->mapFromSource(m_pModel->root()));
    13884        }
    13985    }
    14086
    141     return fResult;
     87    /* Check for warnings & if there are one display them: */
     88    const QVector<QString> warnings = m_comAppliance.GetWarnings();
     89    const bool fWarningsEnabled = warnings.size() > 0;
     90    foreach (const QString &strText, warnings)
     91        m_pTextEditWarning->append("- " + strText);
     92    m_pPaneWarning->setVisible(fWarningsEnabled);
    14293}
    14394
    14495void UIApplianceImportEditorWidget::prepareImport()
    14596{
    146     if (m_pAppliance)
     97    if (m_comAppliance.isNotNull())
    14798        m_pModel->putBack();
    14899}
    149 
    150 bool UIApplianceImportEditorWidget::import(const QVector<KImportOptions> &options)
    151 {
    152     if (m_pAppliance)
    153     {
    154         /* Import appliance: */
    155         UINotificationProgressApplianceImport *pNotification = new UINotificationProgressApplianceImport(*m_pAppliance,
    156                                                                                                          options);
    157         gpNotificationCenter->append(pNotification);
    158 
    159         /* Positive: */
    160         return true;
    161     }
    162     return false;
    163 }
    164 
    165 QList<QPair<QString, QString> > UIApplianceImportEditorWidget::licenseAgreements() const
    166 {
    167     QList<QPair<QString, QString> > list;
    168 
    169     foreach (CVirtualSystemDescription comVsd, m_pAppliance->GetVirtualSystemDescriptions())
    170     {
    171         QVector<QString> strLicense;
    172         strLicense = comVsd.GetValuesByType(KVirtualSystemDescriptionType_License,
    173                                             KVirtualSystemDescriptionValueType_Original);
    174         if (!strLicense.isEmpty())
    175         {
    176             QVector<QString> strName;
    177             strName = comVsd.GetValuesByType(KVirtualSystemDescriptionType_Name,
    178                                              KVirtualSystemDescriptionValueType_Auto);
    179             list << QPair<QString, QString>(strName.first(), strLicense.first());
    180         }
    181     }
    182 
    183     return list;
    184 }
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.h

    r91567 r91578  
    2525#include "UIApplianceEditorWidget.h"
    2626
    27 /* Forward declarations: */
    28 class UIFilePathSelector;
    29 class QComboBox;
    30 
    31 /** MAC address policies. */
    32 enum MACAddressImportPolicy
    33 {
    34     MACAddressImportPolicy_KeepAllMACs,
    35     MACAddressImportPolicy_KeepNATMACs,
    36     MACAddressImportPolicy_StripAllMACs,
    37     MACAddressImportPolicy_MAX
    38 };
    39 Q_DECLARE_METATYPE(MACAddressImportPolicy);
     27/* COM includes: */
     28#include "CAppliance.h"
    4029
    4130/** UIApplianceEditorWidget subclass for Import Appliance wizard. */
     
    4736
    4837    /** Constructs widget passing @a pParent to the base-class. */
    49     UIApplianceImportEditorWidget(QWidget *pParent);
     38    UIApplianceImportEditorWidget(QWidget *pParent = 0);
    5039
    51     /** Defines @a strFaile name. */
    52     bool setFile(const QString &strFile);
     40    /** Assigns @a comAppliance and populates widget contents. */
     41    void setAppliance(const CAppliance &comAppliance);
    5342
    5443    /** Prepares import by pushing edited data back to appliance. */
    5544    void prepareImport();
    5645
    57     /** Performs import. */
    58     bool import(const QVector<KImportOptions> &options);
     46private:
    5947
    60     /** Returns a list of license agreement pairs. */
    61     QList<QPair<QString, QString> > licenseAgreements() const;
     48    /** Holds the appliance wrapper instance. */
     49    CAppliance  m_comAppliance;
    6250};
    6351
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.cpp

    r91567 r91578  
    55
    66/*
    7  * Copyright (C) 2009-2020 Oracle Corporation
     7 * Copyright (C) 2009-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    189189}
    190190
     191CAppliance UIWizardImportApp::appliance() const
     192{
     193    return m_comAppliance;
     194}
     195
     196bool UIWizardImportApp::setFile(const QString &strFileName)
     197{
     198    /* Clear object: */
     199    m_comAppliance = CAppliance();
     200
     201    if (strFileName.isEmpty())
     202        return false;
     203
     204    /* Create an appliance object: */
     205    CVirtualBox comVBox = uiCommon().virtualBox();
     206    CAppliance comAppliance = comVBox.CreateAppliance();
     207    if (!comVBox.isOk())
     208    {
     209        msgCenter().cannotCreateAppliance(comVBox, this);
     210        return false;
     211    }
     212
     213    /* Read the file to appliance: */
     214    CProgress comProgress = comAppliance.Read(strFileName);
     215    if (!comAppliance.isOk())
     216    {
     217        msgCenter().cannotImportAppliance(comAppliance, this);
     218        return false;
     219    }
     220
     221    /* Show Reading Appliance progress: */
     222    msgCenter().showModalProgressDialog(comProgress, tr("Reading Appliance ..."),
     223                                        ":/progress_reading_appliance_90px.png", this);
     224    if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     225    {
     226        msgCenter().cannotImportAppliance(comProgress, comAppliance.GetPath(), this);
     227        return false;
     228    }
     229
     230    /* Now we have to interpret that stuff: */
     231    comAppliance.Interpret();
     232    if (!comAppliance.isOk())
     233    {
     234        msgCenter().cannotImportAppliance(comAppliance, this);
     235        return false;
     236    }
     237
     238    /* Remember appliance: */
     239    m_comAppliance = comAppliance;
     240
     241    /* Success finally: */
     242    return true;
     243}
     244
    191245bool UIWizardImportApp::isValid() const
    192246{
    193     bool fResult = false;
    194     if (UIApplianceImportEditorWidget *pImportApplianceWidget = field("applianceWidget").value<ImportAppliancePointer>())
    195         fResult = pImportApplianceWidget->isValid();
    196     return fResult;
     247    return m_comAppliance.isNotNull();
    197248}
    198249
     
    220271    else
    221272    {
    222         /* Get import appliance widget: */
    223         UIApplianceImportEditorWidget *pImportApplianceWidget = field("applianceWidget").value<ImportAppliancePointer>();
    224         /* Make sure the final values are puted back: */
    225         pImportApplianceWidget->prepareImport();
    226273        /* Check if there are license agreements the user must confirm: */
    227         QList < QPair <QString, QString> > licAgreements = pImportApplianceWidget->licenseAgreements();
     274        QList < QPair <QString, QString> > licAgreements = licenseAgreements();
    228275        if (!licAgreements.isEmpty())
    229276        {
     
    231278            for (int i = 0; i < licAgreements.size(); ++ i)
    232279            {
    233                 const QPair <QString, QString> &lic = licAgreements.at(i);
     280                const QPair<QString, QString> &lic = licAgreements.at(i);
    234281                ilv.setContents(lic.first, lic.second);
    235282                if (ilv.exec() == QDialog::Rejected)
     
    251298            options.append(KImportOptions_ImportToVDI);
    252299
    253         /* Now import all virtual systems: */
    254         return pImportApplianceWidget->import(options);
     300        /* Import appliance: */
     301        UINotificationProgressApplianceImport *pNotification = new UINotificationProgressApplianceImport(m_comAppliance,
     302                                                                                                         options);
     303        gpNotificationCenter->append(pNotification);
     304
     305        /* Positive: */
     306        return true;
    255307    }
    256308}
     
    292344}
    293345
     346QList<QPair<QString, QString> > UIWizardImportApp::licenseAgreements() const
     347{
     348    QList<QPair<QString, QString> > list;
     349
     350    foreach (CVirtualSystemDescription comVsd, m_comAppliance.GetVirtualSystemDescriptions())
     351    {
     352        QVector<QString> strLicense;
     353        strLicense = comVsd.GetValuesByType(KVirtualSystemDescriptionType_License,
     354                                            KVirtualSystemDescriptionValueType_Original);
     355        if (!strLicense.isEmpty())
     356        {
     357            QVector<QString> strName;
     358            strName = comVsd.GetValuesByType(KVirtualSystemDescriptionType_Name,
     359                                             KVirtualSystemDescriptionValueType_Auto);
     360            list << QPair<QString, QString>(strName.first(), strLicense.first());
     361        }
     362    }
     363
     364    return list;
     365}
     366
    294367
    295368#include "UIWizardImportApp.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.h

    r82968 r91578  
    55
    66/*
    7  * Copyright (C) 2009-2020 Oracle Corporation
     7 * Copyright (C) 2009-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2424/* GUI includes: */
    2525#include "UIWizard.h"
     26
     27/* COM includes: */
     28#include "COMEnums.h"
     29#include "CAppliance.h"
     30
     31/** MAC address policies. */
     32enum MACAddressImportPolicy
     33{
     34    MACAddressImportPolicy_KeepAllMACs,
     35    MACAddressImportPolicy_KeepNATMACs,
     36    MACAddressImportPolicy_StripAllMACs,
     37    MACAddressImportPolicy_MAX
     38};
     39Q_DECLARE_METATYPE(MACAddressImportPolicy);
    2640
    2741/** Import Appliance wizard. */
     
    5266    virtual void prepare() /* override */;
    5367
     68    /** Returns appliance. */
     69    CAppliance appliance() const;
     70    /** Defines @a strFileName. */
     71    bool setFile(const QString &strFileName);
    5472    /** Returns whether appliance is valid. */
    5573    bool isValid() const;
     
    7290private:
    7391
     92    /** Returns a list of license agreement pairs. */
     93    QList<QPair<QString, QString> > licenseAgreements() const;
     94
    7495    /** Holds whether default source should be Import from OCI. */
    7596    bool     m_fImportFromOCIByDefault;
    7697    /** Handles the appliance file name. */
    7798    QString  m_strFileName;
     99
     100    /** Holds the appliance wrapper instance. */
     101    CAppliance  m_comAppliance;
    78102};
    79103
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp

    r91564 r91578  
    677677    else
    678678    {
    679         /* Get import appliance widget: */
    680         ImportAppliancePointer pImportApplianceWidget = field("applianceWidget").value<ImportAppliancePointer>();
    681         AssertMsg(!pImportApplianceWidget.isNull(), ("Appliance Widget is not set!\n"));
    682 
    683679        /* If file name was changed: */
    684680        if (m_pFileSelector->isModified())
    685681        {
    686             /* Check if set file contains valid appliance: */
    687             if (!pImportApplianceWidget->setFile(m_pFileSelector->path()))
     682            /* Check if specified file contains valid appliance: */
     683            if (   !QFile::exists(m_pFileSelector->path())
     684                || !qobject_cast<UIWizardImportApp*>(wizard())->setFile(m_pFileSelector->path()))
    688685                return false;
    689686            /* Reset the modified bit afterwards: */
     
    692689
    693690        /* If we have a valid ovf proceed to the appliance settings page: */
    694         return pImportApplianceWidget->isValid();
     691        return qobject_cast<UIWizardImportApp*>(wizard())->isValid();
    695692    }
    696693}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.cpp

    r91567 r91578  
    142142
    143143UIWizardImportAppPageBasic2::UIWizardImportAppPageBasic2(const QString &strFileName)
    144     : m_enmCertText(kCertText_Uninitialized)
     144    : m_strFileName(strFileName)
     145    , m_enmCertText(kCertText_Uninitialized)
    145146{
    146147    /* Create main layout: */
     
    174175                    {
    175176                        m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
    176                         m_pApplianceWidget->setFile(strFileName);
    177177                        pApplianceWidgetLayout->addWidget(m_pApplianceWidget, 0, 0, 1, 3);
    178178                    }
     
    370370    /* Update widget visibility: */
    371371    updatePageAppearance();
    372     /* Populate MAC address import combo: */
    373     populateMACAddressImportPolicies();
    374372
    375373    /* Check whether there was cloud source selected: */
    376374    const bool fIsSourceCloudOne = field("isSourceCloudOne").toBool();
    377375    if (fIsSourceCloudOne)
     376    {
     377        /* Refresh form properties table: */
    378378        refreshFormPropertiesTable();
     379    }
    379380    else
    380381    {
    381         /* Acquire appliance: */
    382         CAppliance *pAppliance = m_pApplianceWidget->appliance();
    383 
    384         /* Check if pAppliance is alive. If not just return here.
    385          * This prevents crashes when an invalid ova file is supllied: */
    386         if (!pAppliance)
     382        /* Populate MAC address import combo: */
     383        populateMACAddressImportPolicies();
     384
     385        /* If we have file name passed,
     386         * check if specified file contains valid appliance: */
     387        if (   !m_strFileName.isEmpty()
     388            && !qobject_cast<UIWizardImportApp*>(wizard())->setFile(m_strFileName))
    387389        {
    388             if (wizard())
    389                 wizard()->reject();
     390            wizard()->reject();
    390391            return;
    391392        }
    392393
    393         /* Make sure we initialize model items with correct base folder path: */
     394        /* Acquire appliance: */
     395        CAppliance comAppliance = qobject_cast<UIWizardImportApp*>(wizard())->appliance();
     396
     397        /* Initialize appliance widget: */
     398        m_pApplianceWidget->setAppliance(comAppliance);
     399        /* Make sure we initialize appliance widget model with correct base folder path: */
    394400        if (m_pEditorImportFilePath)
    395401            sltHandlePathChanged(m_pEditorImportFilePath->path());
    396402
    397403        /* Acquire certificate: */
    398         CCertificate comCertificate = pAppliance->GetCertificate();
     404        CCertificate comCertificate = comAppliance.GetCertificate();
    399405        if (comCertificate.isNull())
    400406            m_enmCertText = kCertText_Unsigned;
     
    421427
    422428                /* Instantiate the dialog: */
    423                 QPointer<UIApplianceUnverifiedCertificateViewer> pDialog = new UIApplianceUnverifiedCertificateViewer(this, comCertificate);
    424                 AssertPtrReturnVoid(pDialog.data());
     429                QPointer<UIApplianceUnverifiedCertificateViewer> pDialog =
     430                    new UIApplianceUnverifiedCertificateViewer(this, comCertificate);
    425431
    426432                /* Show viewer in modal mode: */
     
    481487        }
    482488    }
     489    else
     490    {
     491        /* Make sure widget has own data committed: */
     492        m_pApplianceWidget->prepareImport();
     493    }
    483494
    484495    /* Try to import appliance: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.h

    r91567 r91578  
    2424/* GUI includes: */
    2525#include "UIFormEditorWidget.h"
     26#include "UIWizardImportApp.h"
    2627#include "UIWizardImportAppDefs.h"
    2728#include "UIWizardPage.h"
     
    3233class QStackedLayout;
    3334class QIRichTextLabel;
     35class UIFilePathSelector;
    3436
    3537/** UIWizardPageBase extension for 2nd page of the Import Appliance wizard. */
     
    129131private:
    130132
     133    /** Handles the appliance file name. */
     134    QString  m_strFileName;
     135
    131136    /** Holds the label instance. */
    132137    QIRichTextLabel *m_pLabel;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.cpp

    r91567 r91578  
    4747UIWizardImportAppPageExpert::UIWizardImportAppPageExpert(bool fImportFromOCIByDefault, const QString &strFileName)
    4848    : UIWizardImportAppPage1(fImportFromOCIByDefault)
     49    , m_strFileName(strFileName)
    4950    , m_pCntSource(0)
    5051    , m_pSettingsCnt(0)
     
    184185                        {
    185186                            m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
    186                             m_pApplianceWidget->setFile(strFileName);
    187187                            pApplianceWidgetLayout->addWidget(m_pApplianceWidget, 0, 0, 1, 3);
    188188                        }
     
    408408    /* Translate page: */
    409409    retranslateUi();
     410
     411    /* If we have file name passed,
     412     * check if specified file contains valid appliance: */
     413    if (   !m_strFileName.isEmpty()
     414        && !qobject_cast<UIWizardImportApp*>(wizard())->setFile(m_strFileName))
     415    {
     416        wizard()->reject();
     417        return;
     418    }
     419
     420    /* Acquire appliance: */
     421    CAppliance comAppliance = qobject_cast<UIWizardImportApp*>(wizard())->appliance();
     422    if (comAppliance.isNotNull())
     423    {
     424        /* Initialize appliance widget: */
     425        m_pApplianceWidget->setAppliance(comAppliance);
     426        /* Make sure we initialize appliance widget model with correct base folder path: */
     427        if (m_pEditorImportFilePath)
     428            sltHandlePathChanged(m_pEditorImportFilePath->path());
     429    }
    410430}
    411431
     
    423443                      && UICommon::hasAllowedExtension(m_pFileSelector->path().toLower(), OVFFileExts)
    424444                      && QFile::exists(m_pFileSelector->path())
    425                       && m_pApplianceWidget->isValid())
     445                      && qobject_cast<UIWizardImportApp*>(wizard())->isValid())
    426446                  || (   fCSP
    427447                      && !m_comCloudProfile.isNull()
     
    464484        }
    465485    }
     486    else
     487    {
     488        /* Make sure widget has own data committed: */
     489        m_pApplianceWidget->prepareImport();
     490    }
    466491
    467492    /* Try to import appliance: */
     
    506531void UIWizardImportAppPageExpert::sltFilePathChangeHandler()
    507532{
    508     /* Check if set file contains valid appliance: */
    509     if (   QFile::exists(m_pFileSelector->path())
    510         && m_pApplianceWidget->setFile(m_pFileSelector->path()))
    511     {
    512         /* Reset the modified bit if file was correctly set: */
    513         m_pFileSelector->resetModified();
    514     }
     533    /* Check if specified file contains valid appliance: */
     534    if (   !QFile::exists(m_pFileSelector->path())
     535        || !qobject_cast<UIWizardImportApp*>(wizard())->setFile(m_pFileSelector->path()))
     536        return;
     537    /* Reset the modified bit afterwards: */
     538    m_pFileSelector->resetModified();
     539
     540    /* Acquire appliance: */
     541    CAppliance comAppliance = qobject_cast<UIWizardImportApp*>(wizard())->appliance();
     542    /* Initialize appliance widget: */
     543    m_pApplianceWidget->setAppliance(comAppliance);
     544    /* Make sure we initialize appliance widget model with correct base folder path: */
     545    if (m_pEditorImportFilePath)
     546        sltHandlePathChanged(m_pEditorImportFilePath->path());
    515547
    516548    emit completeChanged();
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.h

    r91567 r91578  
    9696private:
    9797
     98    /** Handles the appliance file name. */
     99    QString  m_strFileName;
     100
    98101    /** Holds the source container instance. */
    99102    QGroupBox *m_pCntSource;
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