VirtualBox

Ignore:
Timestamp:
Apr 2, 2015 3:50:21 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
99388
Message:

FE/Qt: 7676: Runtime UI: Disk Encryption (DE) support: Runtime UI: Canceling the Add Password dialog should bring the VM Close dialog afterwards.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r55015 r55093  
    24402440    if (!encryptedMediums.isEmpty())
    24412441    {
    2442         /* Create corresponding dialog: */
     2442        /* Create the dialog for acquiring encryption passwords: */
    24432443        QWidget *pDlgParent = windowManager().realParentWindow(activeMachineWindow());
    24442444        QPointer<UIAddDiskEncryptionPasswordDialog> pDlg =
     
    24462446                                                   machineName(),
    24472447                                                   encryptedMediums);
    2448         /* Execute it and acquire the result: */
     2448        /* Execute the dialog: */
    24492449        if (pDlg->exec() == QDialog::Accepted)
     2450        {
     2451            /* Acquire the passwords provided: */
    24502452            encryptionPasswords = pDlg->encryptionPasswords();
    2451         /* Delete dialog if still valid: */
    2452         if (pDlg)
     2453
     2454            /* Delete the dialog: */
    24532455            delete pDlg;
    2454     }
    2455 
    2456     /* Add the disk encryption passwords if necessary: */
    2457     if (!encryptionPasswords.isEmpty())
    2458     {
    2459         foreach (const QString &strKey, encryptionPasswords.keys())
     2456
     2457            /* Make sure the passwords were really provided: */
     2458            AssertReturnVoid(!encryptionPasswords.isEmpty());
     2459
     2460            /* Apply the disk encryption passwords: */
     2461            foreach (const QString &strKey, encryptionPasswords.keys())
     2462            {
     2463                console().AddDiskEncryptionPassword(strKey, encryptionPasswords.value(strKey), false);
     2464                if (!console().isOk())
     2465                    msgCenter().cannotAddDiskEncryptionPassword(console());
     2466            }
     2467        }
     2468        else
    24602469        {
    2461             console().AddDiskEncryptionPassword(strKey, encryptionPasswords.value(strKey), false);
    2462             if (!console().isOk())
    2463                 msgCenter().cannotAddDiskEncryptionPassword(console());
     2470            /* Any modal dialog can be destroyed in own event-loop
     2471             * as a part of VM power-off procedure which closes GUI.
     2472             * So we have to check if the dialog still valid.. */
     2473
     2474            /* If dialog still valid: */
     2475            if (pDlg)
     2476            {
     2477                /* Delete the dialog: */
     2478                delete pDlg;
     2479
     2480                /* Propose the user to close VM: */
     2481                QMetaObject::invokeMethod(this, "sltClose", Qt::QueuedConnection);
     2482            }
    24642483        }
    24652484    }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette