VirtualBox

Changeset 75732 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 26, 2018 12:38:19 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699. Handle copy failures correctly

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

Legend:

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

    r75643 r75732  
    292292        connect(m_pOperationsPanel, &UIGuestControlFileManagerOperationsPanel::sigFileOperationComplete,
    293293                this, &UIGuestControlFileManager::sltFileOperationComplete);
     294        connect(m_pOperationsPanel, &UIGuestControlFileManagerOperationsPanel::sigFileOperationFail,
     295                this, &UIGuestControlFileManager::sltReceieveLogOutput);
    294296        m_panelActionMap.insert(m_pOperationsPanel, m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_FileOperations));
    295297    }
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerOperationsPanel.cpp

    r75728 r75732  
    3030/* GUI includes: */
    3131# include "QIToolButton.h"
     32# include "UIErrorString.h"
    3233# include "UIIconPool.h"
    3334# include "UIGuestControlFileManager.h"
     
    6061signals:
    6162
    62     void sigProgressTaskComplete(QUuid progressId);
     63    void sigProgressComplete(QUuid progressId);
     64    void sigProgressFail(QString strErrorString, FileManagerLogType eLogType);
    6365
    6466protected:
     
    6971
    7072    void sltHandleProgressPercentageChange(const QUuid &uProgressId, const int iPercent);
    71     void sltHandleProgressTaskComplete(const QUuid &uProgressId);
     73    void sltHandleProgressComplete(const QUuid &uProgressId);
    7274    void sltCancelProgress();
    7375
     
    176178            this, &UIFileOperationProgressWidget::sltHandleProgressPercentageChange);
    177179    connect(m_pEventHandler, &UIProgressEventHandler::sigProgressTaskComplete,
    178             this, &UIFileOperationProgressWidget::sltHandleProgressTaskComplete);
     180            this, &UIFileOperationProgressWidget::sltHandleProgressComplete);
    179181}
    180182
     
    192194}
    193195
    194 void UIFileOperationProgressWidget::sltHandleProgressTaskComplete(const QUuid &uProgressId)
     196void UIFileOperationProgressWidget::sltHandleProgressComplete(const QUuid &uProgressId)
    195197{
    196198    Q_UNUSED(uProgressId);
    197199    if (m_pCancelButton)
    198200        m_pCancelButton->setEnabled(false);
    199     emit sigProgressTaskComplete(m_comProgress.GetId());
     201
     202    if (!m_comProgress.isOk() || m_comProgress.GetResultCode() != 0)
     203        emit sigProgressFail(UIErrorString::formatErrorInfo(m_comProgress), FileManagerLogType_Error);
     204    else
     205        emit sigProgressComplete(m_comProgress.GetId());
    200206}
    201207
     
    229235    UIFileOperationProgressWidget *pOperationsWidget = new UIFileOperationProgressWidget(comProgress);
    230236    m_pTableWidget->setCellWidget(m_pTableWidget->rowCount() - 1, 0, pOperationsWidget);
    231     connect(pOperationsWidget, &UIFileOperationProgressWidget::sigProgressTaskComplete,
     237    connect(pOperationsWidget, &UIFileOperationProgressWidget::sigProgressComplete,
    232238            this, &UIGuestControlFileManagerOperationsPanel::sigFileOperationComplete);
     239    connect(pOperationsWidget, &UIFileOperationProgressWidget::sigProgressFail,
     240            this, &UIGuestControlFileManagerOperationsPanel::sigFileOperationFail);
    233241
    234242    m_pTableWidget->resizeColumnsToContents();
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerOperationsPanel.h

    r75728 r75732  
    4242
    4343    void sigFileOperationComplete(QUuid progressId);
     44    void sigFileOperationFail(QString strErrorString, FileManagerLogType eLogType);
    4445
    4546public:
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestFileTable.cpp

    r75686 r75732  
    332332void UIGuestFileTable::copyHostToGuest(const QStringList &hostSourcePathList, bool fDeleteAfterSuccessfulCopy /* = false */)
    333333{
     334    if (!checkGuestSession())
     335        return;
    334336    QVector<QString> sourcePaths = hostSourcePathList.toVector();
    335337    QVector<QString>  aFilters;
     
    348350
    349351    CProgress progress = m_comGuestSession.CopyToGuest(sourcePaths, aFilters, aFlags, strDestinationPath);
    350     if (!m_comGuestSession.isOk())
    351     {
    352         emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession), FileManagerLogType_Error);
    353         return;
    354     }
     352    if (!checkGuestSession())
     353        return;
    355354    emit sigNewFileOperation(progress);
    356355    /* Cache the progress id and host source file objects' path in case of move operation. we will delete
     
    362361void UIGuestFileTable::copyGuestToHost(const QString& hostDestinationPath, bool fDeleteAfterSuccessfulCopy /* = false */)
    363362{
     363    if (!checkGuestSession())
     364        return;
    364365    QVector<QString> sourcePaths = selectedItemPathList().toVector();
    365366    QVector<QString>  aFilters;
     
    378379
    379380    CProgress progress = m_comGuestSession.CopyFromGuest(sourcePaths, aFilters, aFlags, hostDestinationPath);
    380     if (!m_comGuestSession.isOk())
    381     {
    382         emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession), FileManagerLogType_Error);
    383         return;
    384     }
     381    if (!checkGuestSession())
     382        return;
    385383    emit sigNewFileOperation(progress);
    386384    /* Cache the progress id and source file objects' path in case of move operation. we will delete
     
    651649}
    652650
     651bool UIGuestFileTable::checkGuestSession()
     652{
     653    if (!m_comGuestSession.isOk())
     654    {
     655        emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession), FileManagerLogType_Error);
     656        return false;
     657    }
     658    return true;
     659}
    653660#include "UIGuestFileTable.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestFileTable.h

    r75610 r75732  
    7171
    7272    void prepareActionConnections();
     73    bool checkGuestSession();
    7374
    7475    mutable CGuestSession     m_comGuestSession;
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