Changeset 56653 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jun 26, 2015 8:31:29 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101289
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestDnDPrivate.h
r56074 r56653 147 147 /** Target (VM) screen ID. */ 148 148 uint32_t mScreenID; 149 /** Drag'n drop format to send. */150 com::Utf8Str mF ormat;149 /** Drag'n drop format requested by the guest. */ 150 com::Utf8Str mFmtReq; 151 151 /** Drag'n drop data to send. 152 152 * This can be arbitrary data or an URI list. */ … … 361 361 uint32_t defAction(void) const { return m_defAction; } 362 362 363 void setF ormat(const Utf8Str &strFormat) { m_strFormat= strFormat; }364 Utf8Str f ormat(void) const { return m_strFormat; }363 void setFmtReq(const Utf8Str &strFormat) { m_strFmtReq = strFormat; } 364 Utf8Str fmtReq(void) const { return m_strFmtReq; } 365 365 366 366 void reset(void); … … 383 383 /** Pointer to context this class is tied to. */ 384 384 void *m_pvCtx; 385 /** Event for waiting for response. */ 385 386 RTSEMEVENT m_EventSem; 387 /** Default action to perform in case of a 388 * successful drop. */ 386 389 uint32_t m_defAction; 390 /** Actions supported by the guest in case of 391 * a successful drop. */ 387 392 uint32_t m_allActions; 388 Utf8Str m_strFormat;389 393 /** Format requested by the guest. */ 394 Utf8Str m_strFmtReq; 390 395 /** Pointer to IGuest parent object. */ 391 396 ComObjPtr<Guest> m_parent; … … 451 456 /** @name Static helper methods. 452 457 * @{ */ 453 static com::Utf8Str toFormatString(const std::vector<com::Utf8Str> &lstSupportedFormats, const std::vector<com::Utf8Str> &lst Formats);458 static com::Utf8Str toFormatString(const std::vector<com::Utf8Str> &lstSupportedFormats, const std::vector<com::Utf8Str> &lstWantedFormats); 454 459 static void toFormatVector(const std::vector<com::Utf8Str> &lstSupportedFormats, const com::Utf8Str &strFormats, std::vector<com::Utf8Str> &vecformats); 455 460 static DnDAction_T toMainAction(uint32_t uAction); … … 528 533 const ComObjPtr<Guest> m_pGuest; 529 534 /** List of supported MIME/Content-type formats. */ 530 std::vector<com::Utf8Str> m_strFormats; 535 std::vector<com::Utf8Str> m_vecFmtSup; 536 /** List of offered/compatible MIME/Content-type formats to the 537 * counterpart. */ 538 std::vector<com::Utf8Str> m_vecFmtOff; 531 539 /** @} */ 532 540 -
trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp
r56494 r56653 221 221 m_allActions = 0; 222 222 223 m_strF ormat= "";223 m_strFmtReq = ""; 224 224 } 225 225 … … 382 382 383 383 if ( pCBData->cbFormat == 0 384 || pCBData->cbFormat > 384 || pCBData->cbFormat > _64K) 385 385 { 386 386 rc = VERR_INVALID_PARAMETER; … … 388 388 else 389 389 { 390 setF ormat(pCBData->pszFormat);390 setFmtReq(pCBData->pszFormat); 391 391 392 392 rc = VINF_SUCCESS; … … 428 428 else 429 429 { 430 setF ormat(pCBData->pszFormat);430 setFmtReq (pCBData->pszFormat); 431 431 setDefAction (pCBData->uDefAction); 432 432 setAllActions(pCBData->uAllActions); … … 492 492 493 493 /* List of supported default MIME types. */ 494 LogRel2(("DnD: Supported default host formats:\n")); 494 495 const com::Utf8Str arrEntries[] = { VBOX_DND_FORMATS_DEFAULT }; 495 496 for (size_t i = 0; i < RT_ELEMENTS(arrEntries); i++) 497 { 496 498 m_strDefaultFormats.push_back(arrEntries[i]); 499 LogRel2(("DnD: \t%s\n", arrEntries[i].c_str())); 500 } 497 501 } 498 502 … … 577 581 /* static */ 578 582 com::Utf8Str GuestDnD::toFormatString(const std::vector<com::Utf8Str> &lstSupportedFormats, 579 const std::vector<com::Utf8Str> &lst Formats)583 const std::vector<com::Utf8Str> &lstWantedFormats) 580 584 { 581 585 com::Utf8Str strFormat; 582 for (size_t i = 0; i < lst Formats.size(); ++i)583 { 584 const com::Utf8Str &f = lst Formats.at(i);586 for (size_t i = 0; i < lstWantedFormats.size(); ++i) 587 { 588 const com::Utf8Str &f = lstWantedFormats.at(i); 585 589 /* Only keep allowed format types. */ 586 590 if (std::find(lstSupportedFormats.begin(), … … 707 711 * Initialize public attributes. 708 712 */ 709 m_ strFormats= GuestDnDInst()->defaultFormats();713 m_vecFmtSup = GuestDnDInst()->defaultFormats(); 710 714 } 711 715 712 716 HRESULT GuestDnDBase::i_isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported) 713 717 { 714 *aSupported = std::find(m_ strFormats.begin(),715 m_ strFormats.end(), aFormat) != m_strFormats.end()718 *aSupported = std::find(m_vecFmtSup.begin(), 719 m_vecFmtSup.end(), aFormat) != m_vecFmtSup.end() 716 720 ? TRUE : FALSE; 717 721 return S_OK; … … 720 724 HRESULT GuestDnDBase::i_getFormats(std::vector<com::Utf8Str> &aFormats) 721 725 { 722 aFormats = m_ strFormats;726 aFormats = m_vecFmtSup; 723 727 724 728 return S_OK; … … 730 734 { 731 735 Utf8Str strFormat = aFormats.at(i); 732 if (std::find(m_ strFormats.begin(),733 m_ strFormats.end(), strFormat) == m_strFormats.end())734 { 735 m_ strFormats.push_back(strFormat);736 if (std::find(m_vecFmtSup.begin(), 737 m_vecFmtSup.end(), strFormat) == m_vecFmtSup.end()) 738 { 739 m_vecFmtSup.push_back(strFormat); 736 740 } 737 741 } … … 745 749 { 746 750 Utf8Str strFormat = aFormats.at(i); 747 std::vector<com::Utf8Str>::iterator itFormat = std::find(m_ strFormats.begin(),748 m_ strFormats.end(), strFormat);749 if (itFormat != m_ strFormats.end())750 m_ strFormats.erase(itFormat);751 std::vector<com::Utf8Str>::iterator itFormat = std::find(m_vecFmtSup.begin(), 752 m_vecFmtSup.end(), strFormat); 753 if (itFormat != m_vecFmtSup.end()) 754 m_vecFmtSup.erase(itFormat); 751 755 } 752 756
Note:
See TracChangeset
for help on using the changeset viewer.