VirtualBox

Changeset 102515 in vbox for trunk


Ignore:
Timestamp:
Dec 7, 2023 9:08:14 AM (10 months ago)
Author:
vboxsync
Message:

FE/Qt: ​bugref:9080, bugref:10141. Fixing host browser's menu entries.

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

Legend:

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

    r102485 r102515  
    143143    determinePathSeparator();
    144144    retranslateUi();
    145 }
    146 
    147 void UIFileManagerHostTable::setModifierActionsVisible(bool fShown)
    148 {
    149     if (m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Delete))
    150         m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Delete)->setVisible(fShown);
    151     if (m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Rename))
    152         m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Rename)->setVisible(fShown);
    153     if (m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_CreateNewDirectory))
    154         m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_CreateNewDirectory)->setVisible(fShown);
    155     if (m_pModifierActionSeparator)
    156         m_pModifierActionSeparator->setVisible(fShown);
    157145}
    158146
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.h

    r102507 r102515  
    5151
    5252    UIFileManagerHostTable(UIActionPool *pActionPool, QWidget *pParent = 0);
    53     /** Hide delete, rename, new folder actions. */
    54     void setModifierActionsVisible(bool fShown);
    5553
    5654    static KFsObjType  fileType(const QFileInfo &fsInfo);
     
    6462    static bool scanDirectory(const QString& strPath, UIFileSystemItem *parent,
    6563                              QMap<QString, UIFileSystemItem*> &fileObjects);
    66     void            retranslateUi() override final;
     64    void            retranslateUi() override;
    6765    virtual bool    readDirectory(const QString& strPath, UIFileSystemItem *parent, bool isStartDir = false) override final;
    6866    virtual void    deleteByItem(UIFileSystemItem *item) override final;
     
    7573    virtual void    determinePathSeparator() override final;
    7674    virtual void    prepareToolbar() override final;
    77     virtual void    createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) override final;
     75    virtual void    createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) override;
    7876    virtual void    toggleForwardBackwardActions() override final;
    7977
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp

    r102507 r102515  
    4747#include "UIDesktopWidgetWatchdog.h"
    4848#include "UIExtraDataManager.h"
    49 #include "UIFileManagerHostTable.h"
    5049#include "UIIconPool.h"
    5150#include "UIPaneContainer.h"
     
    9594    QGridLayout  *m_pVisoOptionsGridLayout;
    9695};
     96
     97
     98/*********************************************************************************************************************************
     99*   UIVisoHostBrowser implementation.                                                                                            *
     100*********************************************************************************************************************************/
     101
     102UIVisoHostBrowser::UIVisoHostBrowser(UIActionPool *pActionPool, QWidget *pParent /* = 0 */)
     103    :UIFileManagerHostTable(pActionPool, pParent)
     104{
     105}
     106
     107void UIVisoHostBrowser::createFileViewContextMenu(const QWidget *pWidget, const QPoint &point)
     108{
     109    if (!pWidget)
     110        return;
     111
     112    QMenu menu;
     113    menu.addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoUp));
     114
     115    menu.addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoHome));
     116    menu.addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Refresh));
     117    menu.addSeparator();
     118    menu.addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_SelectAll));
     119    menu.addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_InvertSelection));
     120    menu.addSeparator();
     121    menu.addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_ShowProperties));
     122    menu.exec(pWidget->mapToGlobal(point));
     123}
     124
     125void UIVisoHostBrowser::prepareMainMenu(QMenu *pMenu)
     126{
     127    AssertReturnVoid(pMenu);
     128    QMenu *pSubMenu = new QMenu(QApplication::translate("UIVisoCreatorWidget", "Host Browser"), pMenu);
     129    pMenu->addMenu(pSubMenu);
     130    AssertReturnVoid(pSubMenu);
     131    m_pSubMenu = pSubMenu;
     132
     133    pSubMenu->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoUp));
     134
     135    pSubMenu->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_GoHome));
     136    pSubMenu->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_Refresh));
     137    pSubMenu->addSeparator();
     138    pSubMenu->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_SelectAll));
     139    pSubMenu->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_InvertSelection));
     140    pSubMenu->addSeparator();
     141    pSubMenu->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_Host_ShowProperties));
     142}
     143
     144
     145void UIVisoHostBrowser::retranslateUi()
     146{
     147    UIFileManagerHostTable::retranslateUi();
     148    if (m_pSubMenu)
     149        m_pSubMenu->setTitle(QApplication::translate("UIVisoCreatorWidget", "VISO Browser"));
     150
     151    //setFileTableLabelText(QApplication::translate("UIVisoCreatorWidget","VISO Content"));
     152}
    97153
    98154
     
    488544    pContainerLayout->setContentsMargins(0, 0, 0, 0);
    489545
    490     m_pHostFileBrowser = new UIFileManagerHostTable(m_pActionPool);
     546    m_pHostFileBrowser = new UIVisoHostBrowser(m_pActionPool);
    491547    AssertPtrReturnVoid(m_pHostFileBrowser);
    492548    pContainerLayout->addWidget(m_pHostFileBrowser, 0, 0, 1, 4);
    493     m_pHostFileBrowser->setModifierActionsVisible(false);
    494549    m_pHostFileBrowser->setDragDropMode(QAbstractItemView::DragOnly);
    495550
     
    523578    //     connect(m_pHostBrowser, &UIVisoHostBrowser::sigAddObjectsToViso,
    524579    //             this, &UIVisoCreatorWidget::sltAddObjectsToViso);
    525         connect(m_pHostFileBrowser, &UIFileManagerHostTable::sigSelectionChanged,
     580        connect(m_pHostFileBrowser, &UIVisoHostBrowser::sigSelectionChanged,
    526581                this, &UIVisoCreatorWidget::sltHostBrowserTableSelectionChanged);
    527582    }
     
    608663    }
    609664
    610     // if (m_pHostBrowser)
    611     //     m_pHostBrowser->prepareMainMenu(m_pMainMenu);
     665    if (m_pHostFileBrowser)
     666        m_pHostFileBrowser->prepareMainMenu(m_pMainMenu);
    612667
    613668    if (m_pVISOContentBrowser)
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h

    r102474 r102515  
    3939#include "QIWithRestorableGeometry.h"
    4040#include "QIWithRetranslateUI.h"
     41#include "UIFileManagerHostTable.h"
    4142
    4243#include <iprt/stream.h>
     
    5152class QIToolBar;
    5253class UIActionPool;
    53 class UIFileManagerHostTable;
    5454class UIVisoContentBrowser;
    5555class UIVisoSettingWidget;
     56
     57
     58class UIVisoHostBrowser : public UIFileManagerHostTable
     59{
     60
     61public:
     62
     63    UIVisoHostBrowser(UIActionPool *pActionPool, QWidget *pParent = 0);
     64    void prepareMainMenu(QMenu *pMenu);
     65
     66private:
     67
     68    virtual void createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) override final;
     69    virtual void retranslateUi() override;
     70    QPointer<QMenu>        m_pSubMenu;
     71};
     72
    5673
    5774/** A QIMainDialog extension. It hosts two UIVisoBrowserBase extensions, one for host and one
     
    154171    QVBoxLayout            *m_pMainLayout;
    155172    UIVisoContentBrowser   *m_pVISOContentBrowser;
    156     UIFileManagerHostTable *m_pHostFileBrowser;
     173    UIVisoHostBrowser      *m_pHostFileBrowser;
    157174
    158175    QIToolBar             *m_pToolBar;
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