VirtualBox

Changeset 50609 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 26, 2014 2:32:11 PM (11 years ago)
Author:
vboxsync
Message:

DnD: A bit of error-to-text resolving.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestDnDImpl.cpp

    r50593 r50609  
    204204    HRESULT queryProgressTo(IProgress **ppProgress);
    205205
     206public:
     207
     208    Utf8Str errorToString(const ComObjPtr<Guest>& pGuest, int guestRc);
     209
    206210private:
    207211    RTSEMEVENT           m_EventSem;
     
    296300}
    297301
    298 DnDGuestResponse::~DnDGuestResponse()
     302DnDGuestResponse::~DnDGuestResponse(void)
    299303{
    300304    reset();
     
    303307}
    304308
    305 int DnDGuestResponse::notifyAboutGuestResponse()
    306 {
    307     return RTSemEventSignal(m_EventSem);
    308 }
    309 
    310 int DnDGuestResponse::waitForGuestResponse(RTMSINTERVAL msTimeout /*= 500 */)
    311 {
    312     int rc = RTSemEventWait(m_EventSem, msTimeout);
    313 #ifdef DEBUG_andy
    314     LogFlowFunc(("msTimeout=%RU32, rc=%Rrc\n", msTimeout, rc));
    315 #endif
    316     return rc;
    317 }
    318 
    319309int DnDGuestResponse::dataAdd(const void *pvData, uint32_t cbData,
    320310                              uint32_t *pcbCurSize)
     
    341331
    342332    return rc;
     333}
     334
     335/* static */
     336Utf8Str DnDGuestResponse::errorToString(const ComObjPtr<Guest>& pGuest, int guestRc)
     337{
     338    Utf8Str strError;
     339
     340    switch (guestRc)
     341    {
     342        case VERR_SHARING_VIOLATION:
     343            strError += Utf8StrFmt(pGuest->tr("One or more guest files or directories selected for transferring to the host were locked. "
     344                                              "Please make sure that all selected elements can be accessed and that your guest user has "
     345                                              "the appropriate rights."));
     346            break;
     347
     348        default:
     349            strError += Utf8StrFmt("Drag'n drop guest error (%Rrc)", guestRc);
     350            break;
     351    }
     352
     353    return strError;
     354}
     355
     356int DnDGuestResponse::notifyAboutGuestResponse(void)
     357{
     358    return RTSemEventSignal(m_EventSem);
    343359}
    344360
     
    384400            if (uState == DragAndDropSvc::DND_PROGRESS_ERROR)
    385401            {
    386                 hr = m_progress->notifyComplete(E_FAIL,
     402                hr = m_progress->notifyComplete(VBOX_E_IPRT_ERROR,
    387403                                                COM_IIDOF(IGuest),
    388404                                                m_parent->getComponentName(),
    389                                                 m_parent->tr("Drag'n drop guest error (%Rrc)"), rcOp);
     405                                                DnDGuestResponse::errorToString(m_parent, rcOp).c_str());
    390406                reset();
    391407            }
     
    458474}
    459475
     476int DnDGuestResponse::waitForGuestResponse(RTMSINTERVAL msTimeout /*= 500 */)
     477{
     478    int rc = RTSemEventWait(m_EventSem, msTimeout);
     479#ifdef DEBUG_andy
     480    LogFlowFunc(("msTimeout=%RU32, rc=%Rrc\n", msTimeout, rc));
     481#endif
     482    return rc;
     483}
     484
     485///////////////////////////////////////////////////////////////////////////////
     486
    460487HRESULT GuestDnDPrivate::adjustCoords(ULONG uScreenId, ULONG *puX, ULONG *puY) const
    461488{
     
    499526                          p->tr("VMM device is not available (is the VM running?)"));
    500527
    501     LogFlowFunc(("hgcmHostCall msg=%RU32, numParms=%RU32\n", u32Function, cParms));
     528    LogFlowFunc(("hgcmHostCall uMsg=%RU32, cParms=%RU32\n", u32Function, cParms));
    502529    int rc = pVMMDev->hgcmHostCall("VBoxDragAndDropSvc",
    503530                                   u32Function,
     
    505532    if (RT_FAILURE(rc))
    506533    {
    507         LogFlowFunc(("hgcmHostCall error: %Rrc\n", rc));
    508         throw p->setError(VBOX_E_VM_ERROR,
     534        LogFlowFunc(("hgcmHostCall failed with rc=%Rrc\n", rc));
     535        throw p->setError(VBOX_E_IPRT_ERROR,
    509536                          p->tr("hgcmHostCall failed (%Rrc)"), rc);
    510537    }
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