VirtualBox

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


Ignore:
Timestamp:
Apr 6, 2018 7:43:08 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699 Print out COM errors in the log window of the file manager

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

Legend:

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

    r71639 r71693  
    2525# include <QHBoxLayout>
    2626# include <QHeaderView>
    27 # include <QPlainTextEdit>
     27# include <QTextEdit>
    2828# include <QPushButton>
    2929# include <QSplitter>
     
    3636# include "QITreeWidget.h"
    3737# include "QIWithRetranslateUI.h"
     38# include "UIErrorString.h"
    3839# include "UIExtraDataManager.h"
    3940# include "UIIconPool.h"
     
    392393    }
    393394
    394     m_pLogOutput = new QPlainTextEdit;
     395    m_pLogOutput = new QTextEdit;
    395396    if (m_pLogOutput)
    396397    {
     
    482483        if (m_pLogOutput)
    483484        {
    484             m_pLogOutput->appendPlainText("Could not find Guest Additions");
     485            m_pLogOutput->append("Could not find Guest Additions");
    485486            postSessionClosed();
    486487            return;
     
    490491    {
    491492        if (m_pLogOutput)
    492             m_pLogOutput->appendPlainText("No user name is given");
     493            m_pLogOutput->append("No user name is given");
    493494        return;
    494495    }
     
    500501    if (!m_comGuestSession.isOk())
    501502    {
    502         m_pLogOutput->appendPlainText("Guest session is not valid");
     503        m_pLogOutput->append("Guest session is not valid");
    503504        postSessionClosed();
    504505        return;
     
    511512
    512513    m_comGuestSession.Close();
    513     m_pLogOutput->appendPlainText("Guest session is closed");
     514    m_pLogOutput->append("Guest session is closed");
    514515    postSessionClosed();
    515516}
     
    522523        if (cErrorInfo.isOk())
    523524        {
    524             m_pLogOutput->appendPlainText(cErrorInfo.GetText());
     525            m_pLogOutput->append(cErrorInfo.GetText());
    525526        }
    526527    }
     
    532533    else
    533534    {
    534         m_pLogOutput->appendPlainText("Session status has changed");
     535        m_pLogOutput->append("Session status has changed");
    535536    }
    536537}
     
    539540{
    540541    if (m_pLogOutput)
    541         m_pLogOutput->appendPlainText(strOutput);
     542        m_pLogOutput->append(strOutput);
    542543}
    543544
     
    601602    if (!m_comGuestSession.isOk())
    602603    {
    603         m_pLogOutput->appendPlainText("Guest session could not be created");
     604        m_pLogOutput->append(UIErrorString::formatErrorInfo(m_comGuestSession));
    604605        return false;
    605606    }
    606607
    607     m_pLogOutput->appendPlainText("Guest session has been created");
     608    m_pLogOutput->append("Guest session has been created");
    608609    if (m_pSessionCreateWidget)
    609610        m_pSessionCreateWidget->switchSessionCloseMode();
     
    624625     /* Wait session to start. For some reason we cannot get GuestSessionStatusChanged event
    625626        consistently. So we wait: */
    626     m_pLogOutput->appendPlainText("Waiting the session to start");
     627    m_pLogOutput->append("Waiting the session to start");
    627628    const ULONG waitTimeout = 2000;
    628629    KGuestSessionWaitResult waitResult = m_comGuestSession.WaitFor(KGuestSessionWaitForFlag_Start, waitTimeout);
    629630    if (waitResult != KGuestSessionWaitResult_Start)
    630631    {
    631         m_pLogOutput->appendPlainText("The session did not start");
     632        m_pLogOutput->append("The session did not start");
    632633        sltCloseSession();
    633634        return false;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileManager.h

    r71654 r71693  
    3535/* Forward declarations: */
    3636class QHBoxLayout;
    37 class QPlainTextEdit;
     37class QTextEdit;
    3838class QVBoxLayout;
    3939class QSplitter;
     
    105105    QVBoxLayout        *m_pMainLayout;
    106106    QSplitter          *m_pVerticalSplitter;
    107     QPlainTextEdit     *m_pLogOutput;
     107    QTextEdit          *m_pLogOutput;
    108108    UIToolBar          *m_pToolBar;
    109109    QAction            *m_pCopyGuestToHost;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.cpp

    r71654 r71693  
    269269/* static */ QStringList UIPathOperations::pathTrail(const QString &path)
    270270{
    271     QList<QString> pathList = path.split(UIPathOperations::delimiter, QString::SkipEmptyParts);
     271    QStringList pathList = path.split(UIPathOperations::delimiter, QString::SkipEmptyParts);
    272272    return pathList;
    273273}
     
    10681068}
    10691069
    1070 void UIGuestControlFileTable::goIntoDirectory(const QList<QString> &pathTrail)
     1070void UIGuestControlFileTable::goIntoDirectory(const QStringList &pathTrail)
    10711071{
    10721072    UIFileTableItem *parent = getStartDirectoryItem();
     
    12291229        return;
    12301230
    1231     QList<QString> pathList = comboLocation.split(UIPathOperations::delimiter, QString::SkipEmptyParts);
     1231    QStringList pathList = comboLocation.split(UIPathOperations::delimiter, QString::SkipEmptyParts);
    12321232    goIntoDirectory(pathList);
    12331233}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.h

    r71654 r71693  
    269269    void             goIntoDirectory(const QModelIndex &itemIndex);
    270270    /** Follows the path trail, opens directories as it descends */
    271     void             goIntoDirectory(const QList<QString> &pathTrail);
     271    void             goIntoDirectory(const QStringList &pathTrail);
    272272    /** Goes into directory pointed by the @p item */
    273273    void             goIntoDirectory(UIFileTableItem *item);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestFileTable.cpp

    r71670 r71693  
    2727/* GUI includes: */
    2828# include "QILabel.h"
     29# include "UIErrorString.h"
    2930# include "UIGuestFileTable.h"
    3031# include "UIVMInformationDialog.h"
     
    100101    if (!m_comGuestSession.isOk())
    101102        return;
    102 
    103103    /* if the object is a file or a symlink then read the size and return: */
    104104    if (fileInfo.GetType() == KFsObjType_File)
     
    122122    QVector<KDirectoryOpenFlag> flag(KDirectoryOpenFlag_None);
    123123    CGuestDirectory directory = m_comGuestSession.DirectoryOpen(path, /*aFilter*/ "", flag);
     124    if (!m_comGuestSession.isOk())
     125        return;
    124126
    125127    if (directory.isOk())
     
    155157        return;
    156158    m_comGuestSession = session;
    157 
    158 
    159159    initializeFileTree();
    160160}
     
    179179
    180180    directory = m_comGuestSession.DirectoryOpen(strPath, /*aFilter*/ "", flag);
     181    if (!m_comGuestSession.isOk())
     182    {
     183        emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession));
     184        return;
     185    }
     186
    181187    parent->setIsOpened(true);
    182188    if (directory.isOk())
     
    229235    if (!item)
    230236        return;
    231     if (!m_comGuestSession.isOk())
    232         return;
    233237    if (item->isUpDirectory())
    234238        return;
     
    242246        m_comGuestSession.FsObjRemove(item->path());
    243247    if (!m_comGuestSession.isOk())
     248    {
    244249        emit sigLogOutput(QString(item->path()).append(" could not be deleted"));
    245 
     250        emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession));
     251    }
    246252}
    247253
     
    257263
    258264    QString userHome = UIPathOperations::sanitize(m_comGuestSession.GetUserHome());
    259     QList<QString> pathList = userHome.split(UIPathOperations::delimiter, QString::SkipEmptyParts);
     265    if (!m_comGuestSession.isOk())
     266    {
     267        emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession));
     268        return;
     269    }
     270    QStringList pathList = userHome.split(UIPathOperations::delimiter, QString::SkipEmptyParts);
    260271    goIntoDirectory(pathList);
    261272}
     
    264275{
    265276
    266     if (!item || item->isUpDirectory() || newBaseName.isEmpty() || !m_comGuestSession.isOk())
     277    if (!item || item->isUpDirectory() || newBaseName.isEmpty())
    267278        return false;
    268279    QString newPath = UIPathOperations::constructNewItemPath(item->path(), newBaseName);
     
    271282    m_comGuestSession.FsObjRename(item->path(), newPath, aFlags);
    272283    if (!m_comGuestSession.isOk())
    273         return false;
     284    {
     285        emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession));
     286        return false;
     287    }
     288
    274289    item->setPath(newPath);
    275290    return true;
     
    278293bool UIGuestFileTable::createDirectory(const QString &path, const QString &directoryName)
    279294{
    280     if (!m_comGuestSession.isOk())
    281         return false;
    282 
    283295    QString newDirectoryPath = UIPathOperations::mergePaths(path, directoryName);
    284296    QVector<KDirectoryCreateFlag> flags(KDirectoryCreateFlag_None);
    285297
    286298    m_comGuestSession.DirectoryCreate(newDirectoryPath, 0/*aMode*/, flags);
     299
    287300    if (!m_comGuestSession.isOk())
    288301    {
    289302        emit sigLogOutput(newDirectoryPath.append(" could not be created"));
     303        emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession));
    290304        return false;
    291305    }
     
    331345    }
    332346    if (!m_comGuestSession.isOk())
    333         return false;
     347    {
     348        emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession));
     349        return false;
     350    }
     351
    334352    return true;
    335353}
     
    342360    if (!hostFileInfo.exists())
    343361        return false;
    344 
     362    CProgress comProgress;
    345363    /* Currently API expects a path including a file name for file copy*/
    346364    if (hostFileInfo.isFile() || hostFileInfo.isSymLink())
     
    349367        QString destinationFilePath =  UIPathOperations::addTrailingDelimiters(guestDestinationPath);
    350368        /** @todo listen to CProgress object to monitor copy operation: */
    351         /*CProgress comProgress =*/ m_comGuestSession.FileCopyToGuest(hostSourcePath, destinationFilePath, flags);
     369        comProgress = m_comGuestSession.FileCopyToGuest(hostSourcePath, destinationFilePath, flags);
    352370    }
    353371    else if(hostFileInfo.isDir())
     
    357375        QString destinationFilePath =  UIPathOperations::addTrailingDelimiters(guestDestinationPath);
    358376        /** @todo listen to CProgress object to monitor copy operation: */
    359         /*CProgress comProgress = */ m_comGuestSession.DirectoryCopyToGuest(hostSourcePath, destinationFilePath, aFlags);
    360     }
    361     if (!m_comGuestSession.isOk())
    362         return false;
     377        comProgress = m_comGuestSession.DirectoryCopyToGuest(hostSourcePath, destinationFilePath, aFlags);
     378
     379
     380    }
     381    /** @todo currently I cannot get an errorfrom CProgress: */
     382    if (m_comGuestSession.isOk())
     383    {
     384        if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     385        {
     386            emit sigLogOutput(UIErrorString::formatErrorInfo(comProgress));
     387            return false;
     388        }
     389    }
     390    else
     391    {
     392        emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession));
     393        return false;
     394    }
     395
    363396    return true;
    364397}
     
    405438        CGuestFsObjInfo fileInfo = m_comGuestSession.FsObjQueryInfo(selectedObjects.at(0), true);
    406439        if (!m_comGuestSession.isOk())
     440        {
     441            emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession));
    407442            return QString();
     443        }
     444
    408445
    409446        QString propertyString;
     
    440477        CGuestFsObjInfo fileInfo = m_comGuestSession.FsObjQueryInfo(selectedObjects.at(0), true);
    441478        if (!m_comGuestSession.isOk())
     479        {
     480            emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession));
    442481            continue;
     482        }
     483
    443484        FileObjectType type = fileType(fileInfo);
    444485
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIHostFileTable.cpp

    r71645 r71693  
    227227
    228228    QString userHome = UIPathOperations::sanitize(QDir::homePath());
    229     QList<QString> pathList = userHome.split(UIPathOperations::delimiter, QString::SkipEmptyParts);
     229    QStringList pathList = userHome.split(UIPathOperations::delimiter, QString::SkipEmptyParts);
    230230    goIntoDirectory(pathList);
    231231}
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