VirtualBox

Ignore:
Timestamp:
Jun 7, 2019 4:36:53 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7127: Update parseAttachment worker with workaround to process previously mounted medium.

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

Legend:

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

    r78893 r79044  
    590590          tr("Encryption password for <nobr>ID = '%1'</nobr> is invalid.")
    591591             .arg(strPasswordId));
     592}
     593
     594void UIMessageCenter::cannotAcquireMachineParameter(const CMachine &comMachine, QWidget *pParent /* = 0 */) const
     595{
     596    /* Show the error: */
     597    error(pParent, MessageType_Error,
     598          tr("Failed to acquire machine parameter."), UIErrorString::formatErrorInfo(comMachine));
    592599}
    593600
     
    14901497}
    14911498
    1492 void UIMessageCenter::cannotAcquireAttachmentMedium(const CMediumAttachment &comAttachment, QWidget *pParent /* = 0 */) const
     1499void UIMessageCenter::cannotAcquireAttachmentParameter(const CMediumAttachment &comAttachment, QWidget *pParent /* = 0 */) const
    14931500{
    14941501    /* Show the error: */
    14951502    error(pParent, MessageType_Error,
    1496           tr("Failed to acquire attachment medium."), UIErrorString::formatErrorInfo(comAttachment));
     1503          tr("Failed to acquire attachment parameter."), UIErrorString::formatErrorInfo(comAttachment));
    14971504}
    14981505
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r78893 r79044  
    263263    void cannotSetExtraData(const CMachine &machine, const QString &strKey, const QString &strValue);
    264264    void warnAboutInvalidEncryptionPassword(const QString &strPasswordId, QWidget *pParent = 0);
     265    void cannotAcquireMachineParameter(const CMachine &comMachine, QWidget *pParent = 0) const;
    265266
    266267    /* API: Selector warnings: */
     
    346347    void cannotOpenMedium(const CVirtualBox &comVBox, const QString &strLocation, QWidget *pParent = 0) const;
    347348    void cannotOpenKnownMedium(const CVirtualBox &comVBox, const QUuid &uMediumId, QWidget *pParent = 0) const;
    348     void cannotAcquireAttachmentMedium(const CMediumAttachment &comAttachment, QWidget *pParent = 0) const;
     349    void cannotAcquireAttachmentParameter(const CMediumAttachment &comAttachment, QWidget *pParent = 0) const;
    349350    void cannotAcquireMediumAttribute(const CMedium &comMedium, QWidget *pParent = 0) const;
    350351    void cannotCloseMedium(const UIMedium &medium, const COMResult &rc, QWidget *pParent = 0) const;
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp

    r79043 r79044  
    776776        {
    777777            LogRel2(("GUI: UIMediumEnumerator:  Unable to acquire attachment medium!\n"));
    778             msgCenter().cannotAcquireAttachmentMedium(comAttachment);
     778            msgCenter().cannotAcquireAttachmentParameter(comAttachment);
    779779        }
    780780        else
     
    782782            /* Parse medium: */
    783783            result << parseMedium(comMedium);
     784
     785            // WORKAROUND:
     786            // In current architecture there is no way to determine medium previously mounted
     787            // to this attachment, so we will have to enumerate all other cached media which
     788            // belongs to the same VM, since they may no longer belong to it.
     789
     790            /* Acquire parent VM: */
     791            CMachine comMachine = comAttachment.GetMachine();
     792            if (!comAttachment.isOk())
     793            {
     794                LogRel2(("GUI: UIMediumEnumerator:  Unable to acquire attachment parent machine!\n"));
     795                msgCenter().cannotAcquireAttachmentParameter(comAttachment);
     796            }
     797            else
     798            {
     799                /* Acquire machine ID: */
     800                const QUuid uMachineId = comMachine.GetId();
     801                if (!comMachine.isOk())
     802                {
     803                    LogRel2(("GUI: UIMediumEnumerator:  Unable to acquire machine ID!\n"));
     804                    msgCenter().cannotAcquireMachineParameter(comMachine);
     805                }
     806                else
     807                {
     808                    /* For each the cached UIMedium we have: */
     809                    foreach (const QUuid &uMediumId, mediumIDs())
     810                    {
     811                        const UIMedium guiMedium = medium(uMediumId);
     812                        if (   !guiMedium.isNull()
     813                            && guiMedium.machineIds().contains(uMachineId)
     814                            && !result.contains(uMediumId))
     815                        {
     816                            /* Enumerate corresponding UIMedium: */
     817                            LogRel2(("GUI: UIMediumEnumerator:  Medium {%s} will be enumerated..\n",
     818                                     uMediumId.toString().toUtf8().constData()));
     819                            createMediumEnumerationTask(guiMedium);
     820                            result << uMediumId;
     821                        }
     822                    }
     823                }
     824            }
    784825        }
    785826    }
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