VirtualBox

Changeset 71195 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 5, 2018 10:37:56 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
121100
Message:

FE/Qt bugref:6699 Disable/enable file table widgets according to the guest session state

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileManager.cpp

    r71191 r71195  
    308308            containerLayout->setContentsMargins(0, 0, 0, 0);
    309309            m_pGuestFileTable = new UIGuestFileTable;
     310            m_pGuestFileTable->setEnabled(false);
    310311            if (m_pGuestFileTable)
    311312                containerLayout->addWidget(m_pGuestFileTable);
     
    315316            {
    316317                m_pToolBar->setOrientation(Qt::Vertical);
     318                m_pToolBar->setEnabled(false);
    317319
    318320                /* Add to dummy QWidget to toolbar to center the action icons vertically: */
     
    324326                bottomSpacerWidget->setVisible(true);
    325327
    326 
    327 
    328328                m_pCopyGuestToHost = new QAction(this);
    329329                m_pCopyGuestToHost->setIcon(UIIconPool::iconSet(QString(":/arrow_right_10px_x2.png")));
     
    384384    if (guestSession == m_comGuestSession && m_comGuestSession.isOk())
    385385        m_comGuestSession.detach();
    386     if (m_pSessionCreateWidget)
    387         m_pSessionCreateWidget->switchSessionCreateMode();
     386    postSessionClosed();
    388387}
    389388
    390389void UIGuestControlFileManager::sltCreateSession(QString strUserName, QString strPassword)
    391390{
     391    if (!UIGuestControlInterface::isGuestAdditionsAvailable(m_comGuest))
     392    {
     393        if (m_pLogOutput)
     394        {
     395            m_pLogOutput->appendPlainText("Could not find Guest Additions");
     396            return;
     397        }
     398    }
    392399    if (strUserName.isEmpty())
    393400    {
    394         m_pLogOutput->appendPlainText("No user name is given");
     401        if (m_pLogOutput)
     402            m_pLogOutput->appendPlainText("No user name is given");
    395403        return;
    396404    }
     
    413421    m_comGuestSession.Close();
    414422    m_pLogOutput->appendPlainText("Guest session is closed");
    415     if (m_pSessionCreateWidget)
    416         m_pSessionCreateWidget->switchSessionCreateMode();
     423    postSessionClosed();
    417424}
    418425
     
    430437    {
    431438        initFileTable();
     439        postSessionCreated();
    432440    }
    433441    else
     
    446454}
    447455
     456void UIGuestControlFileManager::postSessionCreated()
     457{
     458    if (m_pSessionCreateWidget)
     459        m_pSessionCreateWidget->switchSessionCloseMode();
     460    if(m_pGuestFileTable)
     461        m_pGuestFileTable->setEnabled(true);
     462    if(m_pToolBar)
     463        m_pToolBar->setEnabled(true);
     464}
     465
     466void UIGuestControlFileManager::postSessionClosed()
     467{
     468    if (m_pSessionCreateWidget)
     469        m_pSessionCreateWidget->switchSessionCreateMode();
     470    if(m_pGuestFileTable)
     471        m_pGuestFileTable->setEnabled(false);
     472    if(m_pToolBar)
     473        m_pToolBar->setEnabled(false);
     474
     475}
    448476
    449477
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileManager.h

    r71191 r71195  
    8282
    8383    void initFileTable();
     84    void postSessionCreated();
     85    void postSessionClosed();
    8486
    8587    template<typename T>
    8688    QStringList   getFsObjInfoStringList(const T &fsObjectInfo) const;
    87 
    88 
    8989
    9090    const int         m_iMaxRecursionDepth;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.cpp

    r71191 r71195  
    551551void UIGuestControlInterface::putCommand(const QString &strCommand)
    552552{
    553     if (!isGuestAdditionsAvaible(m_comGuest))
     553    if (!isGuestAdditionsAvailable(m_comGuest))
    554554    {
    555555        emit sigOutputString("No guest addtions detected. Guest control needs guest additions");
     
    664664}
    665665
    666 bool UIGuestControlInterface::isGuestAdditionsAvaible(CGuest &guest)
     666bool UIGuestControlInterface::isGuestAdditionsAvailable(const CGuest &guest)
    667667{
    668668    if (!guest.isOk())
    669669        return false;
    670     return guest.GetAdditionsStatus(guest.GetAdditionsRunLevel());
    671 
     670    CGuest guestNonConst = const_cast<CGuest&>(guest);
     671    return guestNonConst.GetAdditionsStatus(guestNonConst.GetAdditionsRunLevel());
    672672}
    673673
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.h

    r71169 r71195  
    5454        /** Pass a non-const ref since for some reason CGuest::GetAdditionsStatus
    5555            is non-const?! */
    56        static bool    isGuestAdditionsAvaible(CGuest &guest);
     56       static bool    isGuestAdditionsAvailable(const CGuest &guest);
    5757       static QString getFsObjTypeString(KFsObjType type);
    5858    /** @} */
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