VirtualBox

Changeset 76959 in vbox


Ignore:
Timestamp:
Jan 23, 2019 6:45:09 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9080: Save and load the most recently used host directory in viso creator dialog

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r76883 r76959  
    26422642        return QString();
    26432643    windowManager().registerNewParent(pVisoCreator, pDialogParent);
     2644    pVisoCreator->setCurrentPath(gEDataManager->recentFolderForVISOContent());
    26442645
    26452646    if (pVisoCreator->exec(false /* not application modal */))
     
    26502651        if (files.empty() || files[0].isEmpty())
    26512652            return QUuid();
     2653
     2654        gEDataManager->setRecentFolderForVISOContent(pVisoCreator->currentPath());
    26522655
    26532656        /* Produce the VISO. */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp

    r76948 r76959  
    7979}
    8080
     81QString UIVisoCreator::currentPath() const
     82{
     83    if (!m_pHostBrowser)
     84        return QString();
     85    return m_pHostBrowser->currentPath();
     86}
     87
     88void UIVisoCreator::setCurrentPath(const QString &strPath)
     89{
     90    if (!m_pHostBrowser)
     91        return;
     92    m_pHostBrowser->setCurrentPath(strPath);
     93}
     94
    8195void UIVisoCreator::retranslateUi()
    8296{
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h

    r76947 r76959  
    5959    const QString &visoName() const;
    6060    const QStringList &customOptions() const;
     61    /** Returns the current path that the host browser is listing. */
     62    QString currentPath() const;
     63    void setCurrentPath(const QString &strPath);
    6164
    6265#ifdef VBOX_WS_MAC
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoHostBrowser.cpp

    r76826 r76959  
    271271}
    272272
     273QString UIVisoHostBrowser::currentPath() const
     274{
     275    if (!m_pTreeView || !m_pTreeModel)
     276        return QString();
     277    QModelIndex currentTreeIndex = m_pTreeView->selectionModel()->currentIndex();
     278    return QDir::fromNativeSeparators(m_pTreeModel->filePath(currentTreeIndex));
     279}
     280
     281void UIVisoHostBrowser::setCurrentPath(const QString &strPath)
     282{
     283    if (strPath.isEmpty() || !m_pTreeModel)
     284        return;
     285    QModelIndex index = m_pTreeModel->index(strPath);
     286    setTreeCurrentIndex(index);
     287}
     288
    273289void UIVisoHostBrowser::sltHandleAddAction()
    274290{
     
    316332    else
    317333        strCurrentTablePath = m_pTableModel->filePath(index);
    318     m_pTreeView->setCurrentIndex(m_pTreeModel->index(strCurrentTablePath));
     334    QModelIndex treeIndex = m_pTreeModel->index(strCurrentTablePath);
     335    m_pTreeView->setCurrentIndex(treeIndex);
     336    m_pTreeView->setExpanded(treeIndex, true);
     337    m_pTreeView->scrollTo(treeIndex, QAbstractItemView::PositionAtCenter);
    319338}
    320339
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoHostBrowser.h

    r76913 r76959  
    4646    ~UIVisoHostBrowser();
    4747    virtual void showHideHiddenObjects(bool bShow) /* override */;
     48    QString currentPath() const;
     49    void setCurrentPath(const QString &strPath);
    4850
    4951protected:
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