VirtualBox

Changeset 57288 in vbox


Ignore:
Timestamp:
Aug 12, 2015 11:45:18 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
102047
Message:

DnD: Fe/Qt: Emit signal for sltGetData() instead of directly calling it, send extra mouse event to guest on a successful drop to host to more reliably let the guest know what happened.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
4 edited

Legend:

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

    r57227 r57288  
    383383            m_pMIMEData, SLOT(sltDropActionChanged(Qt::DropAction)));
    384384
     385    /* Invoke this handler as data needs to be retrieved by our derived QMimeData class. */
     386    connect(m_pMIMEData, SIGNAL(sigGetData(Qt::DropAction, const QString&, QVariant::Type, QVariant&)),
     387            this, SLOT(sltGetData(Qt::DropAction, const QString&, QVariant::Type, QVariant&)));
     388
    385389    /*
    386390     * Set MIME data object and start the (modal) drag'n drop operation on the host.
     
    651655    int rc = VINF_SUCCESS;
    652656
     657    /* Send a mouse event with released mouse buttons into the guest that triggers
     658     * the "drop" event in our proxy window on the guest. */
     659    AssertPtr(m_pSession);
     660    m_pSession->mouse().PutMouseEvent(0, 0, 0, 0, 0);
     661
    653662    /* Start getting the data from the source. Request and transfer data
    654663     * from the source and display a modal progress dialog while doing this. */
     
    703712    m_enmMode = enmMode;
    704713    LogFlowFunc(("Mode is now: %RU32\n", m_enmMode));
     714}
     715
     716int UIDnDHandler::sltGetData(      Qt::DropAction  dropAction,
     717                             const QString        &strMIMEType,
     718                                   QVariant::Type  vaType,
     719                                   QVariant       &vaData)
     720{
     721    int rc = retrieveData(dropAction, strMIMEType, vaType, vaData);
     722    LogFlowFuncLeaveRC(rc);
     723    return rc;
    705724}
    706725
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.h

    r57221 r57288  
    100100    static Qt::DropActions     toQtDnDActions(const QVector<KDnDAction> &vecActions);
    101101
     102public slots:
     103
     104    /**
     105     * Called by UIDnDMIMEData (Linux, OS X, Solaris) to start retrieving the actual data
     106     * from the guest. This function will block and show a modal progress dialog until
     107     * the data transfer is complete.
     108     *
     109     * @return IPRT status code.
     110     * @param dropAction            Drop action to perform.
     111     * @param strMIMEType           MIME data type.
     112     * @param vaType                Qt's variant type of the MIME data.
     113     * @param vaData                Reference to QVariant where to store the retrieved data.
     114     */
     115    int                        sltGetData(Qt::DropAction dropAction, const QString &strMIMEType, QVariant::Type vaType, QVariant &vaData);
     116
    102117protected:
    103118
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDMIMEData.cpp

    r57221 r57288  
    159159    {
    160160        QVariant vaData;
    161         rc = m_pDnDHandler->retrieveData(Qt::CopyAction, strMIMEType, vaType, vaData);
     161        rc = emit sigGetData(Qt::CopyAction, strMIMEType, vaType, vaData);
    162162        if (RT_SUCCESS(rc))
    163163        {
     
    174174        LogRel(("DnD: Retrieving data failed with %Rrc\n", rc));
    175175
    176     return QMimeData::retrieveData(strMIMEType, vaType);
     176    return QVariant(QVariant::Invalid);
    177177}
    178178
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDMIMEData.h

    r57221 r57288  
    7070     *
    7171     * @returns IPRT status code.
    72      * @param strMIMEType               MIME type to retrieve data for.
     72     * @param dropAction            Drop action to perform.
     73     * @param strMimeType           MIME data type.
     74     * @param vaType                Qt's variant type of the MIME data.
     75     * @param vaData                Reference to QVariant where to store the retrieved data.
    7376     */
    74     int getData(const QString &strMIMEType) const;
    75 
    76 #ifdef RT_OS_DARWIN
    77     void notifyDropped(void) const;
    78 #endif
     77    int sigGetData(Qt::DropAction dropAction, const QString &strMIMEType, QVariant::Type vaType, QVariant &vaData) const;
    7978
    8079public slots:
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