VirtualBox

Ignore:
Timestamp:
Oct 29, 2018 7:01:25 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699. Small fixes in selection logic of file manager

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

Legend:

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

    r75148 r75162  
    9292    virtual void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected) /*override */;
    9393    void contextMenuEvent(QContextMenuEvent *pEvent);
    94     //void keyPressEvent(QKeyEvent * pEvent);
    9594
    9695private:
     
    11101109    m_pModel->endReset();
    11111110    m_pView->setRootIndex(m_pProxyModel->mapFromSource(currentIndex));
     1111    setSelectionDependentActionsEnabled(m_pView->hasSelection());
    11121112}
    11131113
     
    12081208    Q_UNUSED(selected);
    12091209    Q_UNUSED(deselected);
    1210     if (m_pView->hasSelection())
    1211         enableSelectionDependentActions();
    1212     else
    1213         disableSelectionDependentActions();
    1214 }
    1215 
     1210    setSelectionDependentActionsEnabled(m_pView->hasSelection());
     1211}
    12161212
    12171213void UIGuestControlFileTable::prepareActionConnections()
     
    14831479}
    14841480
    1485 void UIGuestControlFileTable::enableSelectionDependentActions()
    1486 {
    1487     for (int i = 0; i < m_selectionDependentActions.size(); ++i)
    1488     {
    1489         if (m_selectionDependentActions[i])
    1490             m_selectionDependentActions[i]->setEnabled(true);
    1491     }
    1492 }
    1493 
    1494 void UIGuestControlFileTable::disableSelectionDependentActions()
    1495 {
    1496     /* Disable all the action that operate on some selection: */
    1497     for (int i = 0; i < m_selectionDependentActions.size(); ++i)
    1498     {
    1499         if (m_selectionDependentActions[i])
    1500             m_selectionDependentActions[i]->setEnabled(false);
     1481void UIGuestControlFileTable::setSelectionDependentActionsEnabled(bool fIsEnabled)
     1482{
     1483    foreach (QAction *pAction, m_selectionDependentActions)
     1484    {
     1485        pAction->setEnabled(fIsEnabled);
    15011486    }
    15021487}
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.h

    r75148 r75162  
    293293    bool             eventFilter(QObject *pObject, QEvent *pEvent) /* override */;
    294294    CGuestFsObjInfo  guestFsObjectInfo(const QString& path, CGuestSession &comGuestSession) const;
    295     void             enableSelectionDependentActions();
    296     void             disableSelectionDependentActions();
     295    void             setSelectionDependentActionsEnabled(bool fIsEnabled);
    297296    void             prepareActionConnections();
    298297
     
    307306     *  systems this is empty and for windows system it should at least contain C:/ */
    308307    QStringList m_driveLetterList;
    309 
     308    /** The set of actions which need some selection to work on. Like cut, copy etc. */
     309    QSet<QAction*> m_selectionDependentActions;
    310310
    311311protected slots:
     
    362362    QGridLayout     *m_pMainLayout;
    363363    QComboBox       *m_pLocationComboBox;
    364     //QAction         *m_pGoUp;
    365     //QAction         *m_pGoHome;
    366     //QAction         *m_pRefresh;
    367     //QAction         *m_pDelete;
    368     //QAction         *m_pRename;
    369     //QAction         *m_pCreateNewDirectory;
    370     // QAction         *m_pShowProperties;
    371     // QAction         *m_pSelectAll;
    372     // QAction         *m_pInvertSelection;
    373     /** The vector of actions which need some selection to work on. Like cut, copy etc. */
    374     QVector<QAction*> m_selectionDependentActions;
    375364    /** The absolue path list of the file objects which user has chosen to cut/copy. this
    376365     *  list will be cleaned after a paste operation or overwritten by a subsequent cut/copy */
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestFileTable.cpp

    r75157 r75162  
    611611        m_pToolBar->addSeparator();
    612612        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_ShowProperties));
    613     }
    614 
    615     disableSelectionDependentActions();
     613
     614        m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Delete));
     615        m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Rename));
     616        m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Copy));
     617        m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_Cut));
     618        m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Guest_ShowProperties));
     619
     620    }
     621    setSelectionDependentActionsEnabled(false);
    616622}
    617623
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIHostFileTable.cpp

    r75148 r75162  
    148148        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_GoHome));
    149149        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Refresh));
    150 
    151150        m_pToolBar->addSeparator();
    152151        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Delete));
     
    162161        m_pToolBar->addSeparator();
    163162        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_ShowProperties));
     163
     164        m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Delete));
     165        m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Rename));
     166        m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Copy));
     167        m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_Cut));
     168        m_selectionDependentActions.insert(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_Host_ShowProperties));
    164169    }
    165170
     
    172177    // if (m_pPaste)
    173178    //     m_pPaste->setVisible(false);
    174 
    175     disableSelectionDependentActions();
     179    setSelectionDependentActionsEnabled(false);
    176180}
    177181
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