VirtualBox

Changeset 56903 in vbox for trunk


Ignore:
Timestamp:
Jul 9, 2015 3:43:22 PM (10 years ago)
Author:
vboxsync
Message:

DnD/DnDURIList: Added support for keeping objects open while in list, todos.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/GuestHost/DragAndDrop.h

    r56900 r56903  
    7777/** Resolve all symlinks. */
    7878#define DNDURILIST_FLAGS_RESOLVE_SYMLINKS       RT_BIT(1)
     79/** Keep the files + directory entries open while
     80 *  being in this list. */
     81#define DNDURILIST_FLAGS_KEEP_OPEN              RT_BIT(2)
     82/** Lazy loading: Only enumerate sub directories when needed.
     83 ** @todo Implement lazy loading.  */
     84#define DNDURILIST_FLAGS_LAZY                   RT_BIT(3)
    7985
    8086class DnDURIObject
  • trunk/src/VBox/GuestHost/DragAndDrop/DnDURIList.cpp

    r56899 r56903  
    5050    AssertPtrReturn(pcszTarget, VERR_INVALID_POINTER);
    5151
    52     LogFlowFunc(("pcszSource=%s, pcszTarget=%s\n", pcszSource, pcszTarget));
     52    LogFlowFunc(("pcszSource=%s, pcszTarget=%s, fFlags=0x%x\n", pcszSource, pcszTarget, fFlags));
    5353
    5454    RTFSOBJINFO objInfo;
     
    6060            LogFlowFunc(("File '%s' -> '%s' (%RU64)\n", pcszSource, pcszTarget, (uint64_t)objInfo.cbObject));
    6161
    62             m_lstTree.append(DnDURIObject(DnDURIObject::File, pcszSource, pcszTarget,
    63                              objInfo.Attr.fMode, (uint64_t)objInfo.cbObject));
    64             m_cTotal++;
    65             m_cbTotal += (uint64_t)objInfo.cbObject;
     62            DnDURIObject objFile(DnDURIObject::File, pcszSource, pcszTarget);
     63            if (fFlags & DNDURILIST_FLAGS_KEEP_OPEN) /* Shall we keep the file open while being added to this list? */
     64            {
     65                /** @todo Add a standard fOpen mode for this list. */
     66                rc = objFile.Open(DnDURIObject::Source, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE, objInfo.Attr.fMode);
     67            }
     68
     69            if (RT_SUCCESS(rc))
     70            {
     71                m_lstTree.append(objFile);
     72
     73                m_cTotal++;
     74                m_cbTotal += (uint64_t)objInfo.cbObject;
     75            }
    6676        }
    6777        else if (RTFS_IS_DIRECTORY(objInfo.Attr.fMode))
     
    7181            m_lstTree.append(DnDURIObject(DnDURIObject::Directory, pcszSource, pcszTarget,
    7282                             objInfo.Attr.fMode, 0 /* Size */));
     83
     84            /** @todo Add DNDURILIST_FLAGS_KEEP_OPEN handling. */
     85
    7386            m_cTotal++;
    7487        }
     
    395408        return;
    396409
    397     DnDURIObject &curPath = m_lstTree.first();
    398 
    399     uint64_t cbSize = curPath.GetSize();
     410    DnDURIObject &curObj = m_lstTree.first();
     411
     412    uint64_t cbSize = curObj.GetSize();
    400413    Assert(m_cbTotal >= cbSize);
    401414    m_cbTotal -= cbSize; /* Adjust total size. */
     415
     416    curObj.Close();
    402417
    403418    m_lstTree.removeFirst();
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