VirtualBox

Changeset 78132 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 15, 2019 7:22:36 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9434: Import Appliance wizard: 2nd basic page: Initialize Form Editor widget.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.cpp

    r78128 r78132  
    2424#include "QIRichTextLabel.h"
    2525#include "UIApplianceUnverifiedCertificateViewer.h"
     26#include "UIMessageCenter.h"
    2627#include "UIWizardImportApp.h"
    2728#include "UIWizardImportAppPageBasic2.h"
     
    3031#include "CAppliance.h"
    3132#include "CCertificate.h"
     33#include "CVirtualSystemDescriptionForm.h"
    3234
    3335
     
    7476        if (m_pFormEditor)
    7577        {
    76             m_pFormEditor->hide();
    77 
    7878            /* Add into layout: */
    7979            pMainLayout->addWidget(m_pFormEditor);
     
    139139void UIWizardImportAppPageBasic2::initializePage()
    140140{
    141     /* Acquire appliance: */
    142     CAppliance *pAppliance = m_pApplianceWidget->appliance();
    143 
    144     /* Check if pAppliance is alive. If not just return here.
    145      * This prevents crashes when an invalid ova file is supllied: */
    146     if (!pAppliance)
    147     {
    148         if (wizard())
    149             wizard()->reject();
    150         return;
    151     }
    152 
    153     /* Acquire certificate: */
    154     CCertificate comCertificate = pAppliance->GetCertificate();
    155     if (comCertificate.isNull())
    156         m_enmCertText = kCertText_Unsigned;
     141    /* Check whether there was cloud source selected: */
     142    const bool fIsSourceCloudOne = field("isSourceCloudOne").toBool();
     143
     144    /* Update widget visibility: */
     145    m_pFormEditor->setVisible(fIsSourceCloudOne);
     146    m_pApplianceWidget->setVisible(!fIsSourceCloudOne);
     147
     148    if (fIsSourceCloudOne)
     149        m_pFormEditor->setVirtualSystemDescriptionForm(field("vsdForm").value<CVirtualSystemDescriptionForm>());
    157150    else
    158151    {
    159         /* Pick a 'signed-by' name: */
    160         m_strSignedBy = comCertificate.GetFriendlyName();
    161 
    162         /* If trusted, just select the right message: */
    163         if (comCertificate.GetTrusted())
    164         {
    165             if (comCertificate.GetSelfSigned())
    166                 m_enmCertText = !comCertificate.GetExpired() ? kCertText_SelfSignedTrusted : kCertText_SelfSignedExpired;
     152        /* Acquire appliance: */
     153        CAppliance *pAppliance = m_pApplianceWidget->appliance();
     154
     155        /* Check if pAppliance is alive. If not just return here.
     156         * This prevents crashes when an invalid ova file is supllied: */
     157        if (!pAppliance)
     158        {
     159            if (wizard())
     160                wizard()->reject();
     161            return;
     162        }
     163
     164        /* Acquire certificate: */
     165        CCertificate comCertificate = pAppliance->GetCertificate();
     166        if (comCertificate.isNull())
     167            m_enmCertText = kCertText_Unsigned;
     168        else
     169        {
     170            /* Pick a 'signed-by' name: */
     171            m_strSignedBy = comCertificate.GetFriendlyName();
     172
     173            /* If trusted, just select the right message: */
     174            if (comCertificate.GetTrusted())
     175            {
     176                if (comCertificate.GetSelfSigned())
     177                    m_enmCertText = !comCertificate.GetExpired() ? kCertText_SelfSignedTrusted : kCertText_SelfSignedExpired;
     178                else
     179                    m_enmCertText = !comCertificate.GetExpired() ? kCertText_IssuedTrusted     : kCertText_IssuedExpired;
     180            }
    167181            else
    168                 m_enmCertText = !comCertificate.GetExpired() ? kCertText_IssuedTrusted     : kCertText_IssuedExpired;
    169         }
    170         else
    171         {
    172             /* Not trusted!  Must ask the user whether to continue in this case: */
    173             m_enmCertText = comCertificate.GetSelfSigned() ? kCertText_SelfSignedUnverified : kCertText_IssuedUnverified;
    174 
    175             /* Translate page early: */
    176             retranslateUi();
    177 
    178             /* Instantiate the dialog: */
    179             QPointer<UIApplianceUnverifiedCertificateViewer> pDialog = new UIApplianceUnverifiedCertificateViewer(this, comCertificate);
    180             AssertPtrReturnVoid(pDialog.data());
    181 
    182             /* Show viewer in modal mode: */
    183             const int iResultCode = pDialog->exec();
    184 
    185             /* Leave if viewer destroyed prematurely: */
    186             if (!pDialog)
    187                 return;
    188             /* Delete viewer finally: */
    189             delete pDialog;
    190 
    191             /* Dismiss the entire import-appliance wizard if user rejects certificate: */
    192             if (iResultCode == QDialog::Rejected)
    193                 wizard()->reject();
     182            {
     183                /* Not trusted!  Must ask the user whether to continue in this case: */
     184                m_enmCertText = comCertificate.GetSelfSigned() ? kCertText_SelfSignedUnverified : kCertText_IssuedUnverified;
     185
     186                /* Translate page early: */
     187                retranslateUi();
     188
     189                /* Instantiate the dialog: */
     190                QPointer<UIApplianceUnverifiedCertificateViewer> pDialog = new UIApplianceUnverifiedCertificateViewer(this, comCertificate);
     191                AssertPtrReturnVoid(pDialog.data());
     192
     193                /* Show viewer in modal mode: */
     194                const int iResultCode = pDialog->exec();
     195
     196                /* Leave if viewer destroyed prematurely: */
     197                if (!pDialog)
     198                    return;
     199                /* Delete viewer finally: */
     200                delete pDialog;
     201
     202                /* Dismiss the entire import-appliance wizard if user rejects certificate: */
     203                if (iResultCode == QDialog::Rejected)
     204                    wizard()->reject();
     205            }
    194206        }
    195207    }
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