VirtualBox

Changeset 33438 in vbox


Ignore:
Timestamp:
Oct 25, 2010 5:45:24 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67028
Message:

Main;FE/Qt4: implement Cd and CdUp in IVFSExplorer

Location:
trunk/src/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIExportApplianceWzd.cpp

    r33421 r33438  
    552552        }
    553553    }
    554     CVFSExplorer explorer = appliance->CreateVFSExplorer(uri());
     554    CVFSExplorer explorer = appliance->CreateVFSExplorer(uri(false /* fWithFile */));
    555555    CProgress progress = explorer.Update();
    556556    bool fResult = explorer.isOk();
     
    631631}
    632632
    633 QString UIExportApplianceWzdPage4::uri() const
     633QString UIExportApplianceWzdPage4::uri(bool fWithFile) const
    634634{
    635635    StorageType type = field("storageType").value<StorageType>();
     636
     637    QString path = field("path").toString();
     638    if (!fWithFile)
     639    {
     640        QFileInfo fi(path);
     641        path = fi.path();
     642    }
    636643    switch (type)
    637644    {
    638645        case Filesystem:
    639646        {
    640             return field("path").toString();
     647            return path;
    641648        }
    642649        case SunCloud:
     
    649656            if (!field("username").toString().isEmpty() || !field("username").toString().isEmpty())
    650657                uri = QString("%1@").arg(uri);
    651             uri = QString("%1%2/%3/%4").arg(uri).arg("object.storage.network.com").arg(field("bucket").toString()).arg(field("path").toString());
     658            uri = QString("%1%2/%3/%4").arg(uri).arg("object.storage.network.com").arg(field("bucket").toString()).arg(path);
    652659            return uri;
    653660        }
     
    661668            if (!field("username").toString().isEmpty() || !field("password").toString().isEmpty())
    662669                uri = QString("%1@").arg(uri);
    663             uri = QString("%1%2/%3/%4").arg(uri).arg(field("hostname").toString()).arg(field("bucket").toString()).arg(field("path").toString());
     670            uri = QString("%1%2/%3/%4").arg(uri).arg(field("hostname").toString()).arg(field("bucket").toString()).arg(path);
    664671            return uri;
    665672        }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIExportApplianceWzd.h

    r33421 r33438  
    188188    bool exportAppliance();
    189189    bool exportVMs(CAppliance &appliance);
    190     QString uri() const;
     190    QString uri(bool fWithFile = true) const;
    191191
    192192    ExportAppliancePointer applianceWidget() const { return m_pApplianceWidget; }
  • trunk/src/VBox/Main/VFSExplorerImpl.cpp

    r32718 r33438  
    293293    try
    294294    {
    295         pszPath = RTStrDup(m->strPath.c_str());
    296         RTPathStripFilename(pszPath);
    297         int vrc = RTDirOpen(&pDir, pszPath);
     295        int vrc = RTDirOpen(&pDir, m->strPath.c_str());
    298296        if (RT_FAILURE(vrc))
    299297            throw setError(VBOX_E_FILE_ERROR, tr ("Can't open directory '%s' (%Rrc)"), pszPath, vrc);
     
    570568{
    571569    CheckComArgStrNotEmptyOrNull(aDir);
    572     CheckComArgOutPointerValid(aProgress);
    573 
    574     return E_NOTIMPL;
     570
     571    AutoCaller autoCaller(this);
     572    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     573
     574    {
     575        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     576        m->strPath = aDir;
     577    }
     578
     579    return Update(aProgress);
    575580}
    576581
    577582STDMETHODIMP VFSExplorer::CdUp(IProgress **aProgress)
    578583{
    579     CheckComArgOutPointerValid(aProgress);
    580 
    581     return E_NOTIMPL;
     584    AutoCaller autoCaller(this);
     585    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     586
     587    Utf8Str strUpPath;
     588    {
     589        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     590        /* Remove lowest dir entry in a platform neutral way. */
     591        char *pszNewPath = RTStrDup(m->strPath.c_str());
     592        RTPathStripTrailingSlash(pszNewPath);
     593        RTPathStripFilename(pszNewPath);
     594        strUpPath = pszNewPath;
     595        RTStrFree(pszNewPath);
     596    }
     597
     598    return Cd(Bstr(strUpPath).raw(), aProgress);
    582599}
    583600
     
    626643    std::list<BSTR> listExists;
    627644
    628     std::list<VFSExplorer::Data::DirEntry>::const_iterator it;
    629     for (it = m->entryList.begin();
    630          it != m->entryList.end();
    631          ++it)
    632     {
    633         const VFSExplorer::Data::DirEntry &entry = (*it);
    634         for (size_t a=0; a < sfaNames.size(); ++a)
    635         {
     645    for (size_t a=0; a < sfaNames.size(); ++a)
     646    {
     647        std::list<VFSExplorer::Data::DirEntry>::const_iterator it;
     648        for (it = m->entryList.begin();
     649             it != m->entryList.end();
     650             ++it)
     651        {
     652            const VFSExplorer::Data::DirEntry &entry = (*it);
    636653            if (entry.name == RTPathFilename(Utf8Str(sfaNames[a]).c_str()))
    637654            {
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