VirtualBox

Changeset 100302 in vbox for trunk


Ignore:
Timestamp:
Jun 27, 2023 5:27:44 PM (23 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
158017
Message:

FE/Qt: bugref:6699. Adding forward and backward navigation actions.

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

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp

    r100301 r100302  
    4343#include "UIFileManagerHostTable.h"
    4444#include "UIFileManagerGuestTable.h"
     45#include "UIFileTableNavigationWidget.h"
    4546#include "UIIconPool.h"
    4647#include "UIMessageCenter.h"
     
    10501051    if (m_pToolBar && m_pActionPool)
    10511052    {
     1053        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoBackward));
     1054        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoForward));
    10521055        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoUp));
    10531056        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoHome));
     
    10911094
    10921095    QMenu menu;
     1096    menu.addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoBackward));
     1097    menu.addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoForward));
    10931098    menu.addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoUp));
    10941099
     
    11531158    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_ShowProperties), &UIFileManagerTable::sltShowProperties);
    11541159    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_CreateNewDirectory), &UIFileManagerTable::sltCreateNewDirectory);
     1160
     1161    /* Also disable/enable go forward/backward actions: */
     1162    toggleForwardBackwardActions();
    11551163}
    11561164
     
    14781486void UIFileManagerGuestTable::toggleForwardBackwardActions()
    14791487{
     1488    int iCount = m_pNavigationWidget->historyItemCount();
     1489    int iCurrent = m_pNavigationWidget->currentHistoryIndex();
     1490    if (m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoForward))
     1491        m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoForward)->setEnabled(iCurrent < iCount - 1);
     1492    if (m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoBackward))
     1493        m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoBackward)->setEnabled(iCurrent > 0);
    14801494}
    14811495
     
    16461660}
    16471661
    1648 
    16491662#include "UIFileManagerGuestTable.moc"
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.cpp

    r100301 r100302  
    3535#include "UIActionPool.h"
    3636#include "UIFileManager.h"
     37#include "UIFileTableNavigationWidget.h"
    3738#include "UICustomFileSystemModel.h"
    3839#include "UIFileManagerHostTable.h"
     
    191192    if (m_pToolBar && m_pActionPool)
    192193    {
     194        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoBackward));
     195        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoForward));
    193196        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoUp));
    194197        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoHome));
     
    249252void UIFileManagerHostTable::toggleForwardBackwardActions()
    250253{
     254    int iCount = m_pNavigationWidget->historyItemCount();
     255    int iCurrent = m_pNavigationWidget->currentHistoryIndex();
     256    if (m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoForward))
     257        m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoForward)->setEnabled(iCurrent < iCount - 1);
     258    if (m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoBackward))
     259        m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoBackward)->setEnabled(iCurrent > 0);
    251260}
    252261
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h

    r100301 r100302  
    268268    /** This name is appended to the log messages which are shown in the log panel. */
    269269    QString          m_strTableName;
     270    /** Contains m_pBreadCrumbsWidget and m_pLocationComboBox. */
     271    UIFileTableNavigationWidget   *m_pNavigationWidget;
    270272
    271273private slots:
     
    311313    UIGuestControlFileView        *m_pView;
    312314    UICustomFileSystemProxyModel  *m_pProxyModel;
    313     /** Contains m_pBreadCrumbsWidget and m_pLocationComboBox. */
    314     UIFileTableNavigationWidget   *m_pNavigationWidget;
    315315
    316316    QILineEdit      *m_pSearchLineEdit;
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFileTableNavigationWidget.cpp

    r100300 r100302  
    268268int UIFileTableNavigationWidget::historyItemCount() const
    269269{
    270     if (m_pHistoryComboBox)
     270    if (!m_pHistoryComboBox)
    271271        return 0;
    272272    return m_pHistoryComboBox->count();
     
    275275int UIFileTableNavigationWidget::currentHistoryIndex() const
    276276{
    277     if (m_pHistoryComboBox)
     277    if (!m_pHistoryComboBox)
    278278        return 0;
    279279    return m_pHistoryComboBox->currentIndex();
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