VirtualBox

Changeset 55305 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 16, 2015 12:40:54 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 7676: Disk Encryption (DE) support: Handling encryption progress errors during settings save routine.

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

Legend:

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

    r55214 r55305  
    914914             .arg(strSnapshotName).arg(strMachineName),
    915915          formatErrorInfo(progress));
     916}
     917
     918void UIMessageCenter::cannotSaveSettings(const QString strDetails, QWidget *pParent /* = 0 */) const
     919{
     920    error(pParent, MessageType_Error,
     921          tr("Failed to save the settings."),
     922          strDetails);
    916923}
    917924
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r55214 r55305  
    209209    void cannotRemoveSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const;
    210210    void cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const;
     211
     212    /* API: Common settings warnings: */
     213    void cannotSaveSettings(const QString strDetails, QWidget *pParent = 0) const;
    211214
    212215    /* API: Global settings warnings: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h

    r55279 r55305  
    8888                                    ulong iOperation, ulong iPercent);
    8989
     90    /** Notifies listeners about particular COM error.
     91      * @param strErrorInfo holds the details of the error happened. */
     92    void sigOperationProgressError(QString strErrorInfo);
     93
    9094public:
    9195
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.cpp

    r55282 r55305  
    2727/* GUI includes: */
    2828# include "UISettingsSerializer.h"
     29# include "UIMessageCenter.h"
    2930# include "UISettingsPage.h"
    3031# include "UIIconPool.h"
     
    147148        connect(pPage, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
    148149                this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)));
     150        connect(pPage, SIGNAL(sigOperationProgressError(QString)),
     151                this, SIGNAL(sigOperationProgressError(QString)));
    149152        if (pPage->isEnabled())
    150153        {
     
    157160        disconnect(pPage, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
    158161                   this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)));
     162        disconnect(pPage, SIGNAL(sigOperationProgressError(QString)),
     163                   this, SIGNAL(sigOperationProgressError(QString)));
    159164        pPage->setProcessed(true);
    160165        /* Remove processed page from our map: */
     
    233238        connect(m_pSerializer, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
    234239                this, SLOT(sltHandleOperationProgressChange(ulong, QString, ulong, ulong)));
     240        connect(m_pSerializer, SIGNAL(sigOperationProgressError(QString)),
     241                this, SLOT(sltHandleOperationProgressError(QString)));
    235242    }
    236243
     
    376383}
    377384
     385void UISettingsSerializerProgress::sltHandleOperationProgressError(QString strErrorInfo)
     386{
     387    /* Show the error message: */
     388    msgCenter().cannotSaveSettings(strErrorInfo, this);
     389}
     390
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.h

    r55279 r55305  
    7272                                    ulong iOperation, ulong iPercent);
    7373
     74    /** Notifies listeners about particular COM error.
     75      * @param strErrorInfo holds the details of the error happened. */
     76    void sigOperationProgressError(QString strErrorInfo);
     77
    7478public:
    7579
     
    196200                                          ulong iOperation, ulong iPercent);
    197201
     202    /** Handles particular COM error.
     203      * @param strErrorInfo holds the details of the error happened. */
     204    void sltHandleOperationProgressError(QString strErrorInfo);
     205
    198206private:
    199207
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r55279 r55305  
    329329                        QString strOldPassword = encryptionPasswords.value(strOldPasswordId);
    330330
    331 //                        printf(" Medium: %s, old password = %s, new cipher = %s, new password = %s, new password id = %s\n",
    332 //                               medium.GetId().toAscii().constData(),
    333 //                               strOldPassword.toAscii().constData(),
    334 //                               strNewCipher.toAscii().constData(),
    335 //                               strNewPassword.toAscii().constData(),
    336 //                               strNewPasswordId.toAscii().constData());
    337 
    338331                        /* Update encryption: */
    339332                        CProgress cprogress = medium.ChangeEncryption(strOldPassword,
     
    341334                                                                      strNewPassword,
    342335                                                                      strNewPasswordId);
    343 //                        if (!medium.isOk())
    344 //                            printf("  Medium API Error, rc = %s\n", msgCenter().formatRC(medium.lastRC()).toAscii().constData());
     336                        if (!medium.isOk())
     337                        {
     338                            QMetaObject::invokeMethod(this, "sigOperationProgressError", Qt::BlockingQueuedConnection,
     339                                                      Q_ARG(QString, UIMessageCenter::formatErrorInfo(medium)));
     340                            continue;
     341                        }
    345342                        UIProgress uiprogress(cprogress);
    346343                        connect(&uiprogress, SIGNAL(sigProgressChange(ulong, QString, ulong, ulong)),
    347344                                this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
    348345                                Qt::QueuedConnection);
     346                        connect(&uiprogress, SIGNAL(sigProgressError(QString)),
     347                                this, SIGNAL(sigOperationProgressError(QString)),
     348                                Qt::BlockingQueuedConnection);
    349349                        uiprogress.run(350);
    350 //                        if (!progress.isOk())
    351 //                            printf("  Progress API Error, rc = %s\n", msgCenter().formatRC(progress.lastRC()).toAscii().constData());
    352 //                        if (progress.GetResultCode() != 0)
    353 //                            printf("  Progress Processing Error, rc = %s\n", msgCenter().formatRC(progress.GetResultCode()).toAscii().constData());
    354350                    }
    355351                }
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp

    r55277 r55305  
    3030/* GUI includes: */
    3131# include "UIProgressDialog.h"
     32# include "UIMessageCenter.h"
     33# include "UISpecialControls.h"
     34# include "UIModalWindowManager.h"
    3235# include "QIDialogButtonBox.h"
    3336# include "QILabel.h"
    34 # include "UISpecialControls.h"
    3537# include "VBoxGlobal.h"
    36 # include "UIModalWindowManager.h"
    3738# ifdef Q_WS_MAC
    3839#  include "VBoxUtils-darwin.h"
     
    378379    if (!m_progress.isOk() || m_progress.GetCompleted())
    379380    {
     381        /* Notify listeners about the operation progress error: */
     382        if (!m_progress.isOk() || m_progress.GetResultCode() != 0)
     383            emit sigProgressError(UIMessageCenter::formatErrorInfo(m_progress));
     384
    380385        /* Exit from the event-loop if there is any: */
    381386        if (m_pEventLoop)
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.h

    r55277 r55305  
    115115                           ulong iOperation, ulong iPercent);
    116116
     117    /** Notifies listeners about particular COM error.
     118      * @param strErrorInfo holds the details of the error happened. */
     119    void sigProgressError(QString strErrorInfo);
     120
    117121public:
    118122
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