VirtualBox

Changeset 92899 in vbox for trunk/src


Ignore:
Timestamp:
Dec 14, 2021 2:55:00 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9371. Toggle copy actions according to file table selections.

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

Legend:

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

    r92847 r92899  
    257257
    258258    m_pVerticalToolBar->setOrientation(Qt::Vertical);
    259     m_pVerticalToolBar->setEnabled(false);
    260259
    261260    /* Add to dummy QWidget to toolbar to center the action icons vertically: */
     
    268267
    269268    m_pVerticalToolBar->addWidget(topSpacerWidget);
    270     m_pVerticalToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_CopyToHost));
    271     m_pVerticalToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_CopyToGuest));
     269    if (m_pActionPool->action(UIActionIndex_M_FileManager_S_CopyToHost))
     270    {
     271        m_pVerticalToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_CopyToHost));
     272        m_pActionPool->action(UIActionIndex_M_FileManager_S_CopyToHost)->setEnabled(false);
     273    }
     274    if (m_pActionPool->action(UIActionIndex_M_FileManager_S_CopyToGuest))
     275    {
     276        m_pVerticalToolBar->addAction(m_pActionPool->action(UIActionIndex_M_FileManager_S_CopyToGuest));
     277        m_pActionPool->action(UIActionIndex_M_FileManager_S_CopyToGuest)->setEnabled(false);
     278    }
     279
    272280    m_pVerticalToolBar->addWidget(bottomSpacerWidget);
    273281
     
    315323        connect(m_pHostFileTable, &UIFileManagerHostTable::sigDeleteConfirmationOptionChanged,
    316324                this, &UIFileManager::sltHandleOptionsUpdated);
     325        connect(m_pHostFileTable, &UIFileManagerGuestTable::sigSelectionChanged,
     326                this, &UIFileManager::sltFileTableSelectionChanged);
    317327    }
    318328    connect(&uiCommon(), &UICommon::sigAskToCommitData,
     
    431441}
    432442
     443void UIFileManager::sltFileTableSelectionChanged(bool fHasSelection)
     444{
     445    /* Enable/disable vertical toolbar actions: */
     446    UIFileManagerGuestTable *pGuestTable = qobject_cast<UIFileManagerGuestTable*>(sender());
     447
     448    if (pGuestTable)
     449    {
     450        if (m_pActionPool->action(UIActionIndex_M_FileManager_S_CopyToHost))
     451            m_pActionPool->action(UIActionIndex_M_FileManager_S_CopyToHost)->setEnabled(fHasSelection);
     452        return;
     453    }
     454
     455    if (sender() == m_pHostFileTable)
     456    {
     457        if (m_pActionPool->action(UIActionIndex_M_FileManager_S_CopyToGuest))
     458            m_pActionPool->action(UIActionIndex_M_FileManager_S_CopyToGuest)->setEnabled(fHasSelection);
     459    }
     460}
     461
    433462void UIFileManager::copyToHost()
    434463{
     
    691720            connect(pGuestFileTable, &UIFileManagerGuestTable::sigLogOutput,
    692721                    this, &UIFileManager::sltReceieveLogOutput);
     722            connect(pGuestFileTable, &UIFileManagerGuestTable::sigSelectionChanged,
     723                    this, &UIFileManager::sltFileTableSelectionChanged);
     724
    693725        //     connect(m_pGuestFileTable, &UIFileManagerGuestTable::sigNewFileOperation,
    694726        //             this, &UIFileManager::sltReceieveNewFileOperation);
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h

    r92790 r92899  
    114114    void sltHandleHidePanel(UIDialogPanel *pPanel);
    115115    void sltCommitDataSignalReceived();
     116    void sltFileTableSelectionChanged(bool fHasSelection);
    116117
    117118private:
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp

    r92860 r92899  
    14441444    foreach (QAction *pAction, m_selectionDependentActions)
    14451445        pAction->setEnabled(fIsEnabled);
     1446    if (m_pView)
     1447        emit sigSelectionChanged(m_pView->hasSelection());
    14461448}
    14471449
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h

    r92860 r92899  
    138138    void sigLogOutput(QString strLog, const QString &strMachineName, FileManagerLogType eLogType);
    139139    void sigDeleteConfirmationOptionChanged();
     140    void sigSelectionChanged(bool fHasSelection);
    140141
    141142public:
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