VirtualBox

Changeset 55509 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 29, 2015 9:16:18 AM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 7676: Disk Encryption (DE) support for Export Appliance wizard.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r55504 r55509  
    16811681}
    16821682
     1683void UIMessageCenter::cannotAddDiskEncryptionPassword(const CAppliance &appliance, QWidget *pParent /* = 0 */)
     1684{
     1685    error(pParent, MessageType_Error,
     1686          tr("Bad password or authentication failure."),
     1687          formatErrorInfo(appliance));
     1688}
     1689
    16831690void UIMessageCenter::showRuntimeError(const CConsole &console, bool fFatal, const QString &strErrorId, const QString &strErrorMsg) const
    16841691{
     
    20862093{
    20872094    error(0, MessageType_Error,
    2088           tr("Unable to enter password!"),
     2095          tr("Bad password or authentication failure."),
    20892096          formatErrorInfo(console));
    20902097}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r55422 r55509  
    280280    void cannotExportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent = 0) const;
    281281    void cannotFindSnapshotByName(const CMachine &machine, const QString &strMachine, QWidget *pParent = 0) const;
     282    void cannotAddDiskEncryptionPassword(const CAppliance &appliance, QWidget *pParent = 0);
    282283
    283284    /* API: Runtime UI warnings: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp

    r52816 r55509  
    3232# include "UIWizardExportAppPageBasic4.h"
    3333# include "UIWizardExportAppPageExpert.h"
     34# include "UIAddDiskEncryptionPasswordDialog.h"
    3435# include "UIMessageCenter.h"
    3536
     
    132133bool UIWizardExportApp::exportVMs(CAppliance &appliance)
    133134{
     135    /* Get the map of the password IDs: */
     136    EncryptedMediumMap encryptedMediums;
     137    foreach (const QString &strPasswordId, appliance.GetPasswordIds())
     138        foreach (const QString &strMediumId, appliance.GetMediumIdsForPasswordId(strPasswordId))
     139            encryptedMediums.insert(strPasswordId, strMediumId);
     140
     141    /* Ask for the disk encryption passwords if necessary: */
     142    if (!encryptedMediums.isEmpty())
     143    {
     144        /* Create corresponding dialog: */
     145        QPointer<UIAddDiskEncryptionPasswordDialog> pDlg =
     146             new UIAddDiskEncryptionPasswordDialog(this,
     147                                                   window()->windowTitle(),
     148                                                   encryptedMediums);
     149
     150        /* Execute the dialog: */
     151        if (pDlg->exec() == QDialog::Accepted)
     152        {
     153            /* Acquire the passwords provided: */
     154            const EncryptionPasswordMap encryptionPasswords = pDlg->encryptionPasswords();
     155
     156            /* Delete the dialog: */
     157            delete pDlg;
     158
     159            /* Make sure the passwords were really provided: */
     160            AssertReturn(!encryptionPasswords.isEmpty(), false);
     161
     162            /* Provide appliance with passwords if possible: */
     163            appliance.AddPasswords(encryptionPasswords.keys().toVector(),
     164                                   encryptionPasswords.values().toVector());
     165            if (!appliance.isOk())
     166            {
     167                /* Warn the user about failure: */
     168                msgCenter().cannotAddDiskEncryptionPassword(appliance);
     169
     170                return false;
     171            }
     172        }
     173        else
     174        {
     175            /* Any modal dialog can be destroyed in own event-loop
     176             * as a part of application termination procedure..
     177             * We have to check if the dialog still valid. */
     178            if (pDlg)
     179            {
     180                /* Delete the dialog: */
     181                delete pDlg;
     182            }
     183
     184            return false;
     185        }
     186    }
     187
    134188    /* Write the appliance: */
    135189    QVector<KExportOptions> options;
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