VirtualBox

Changeset 71258 in vbox for trunk


Ignore:
Timestamp:
Mar 7, 2018 1:53:41 PM (7 years ago)
Author:
vboxsync
Message:

FE/QT: bugref:6699 Some improvements on guest control file views

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

Legend:

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

    r71105 r71258  
    119119    m_pTabWidget->setTabText(0, tr("Configuration &Details"));
    120120    m_pTabWidget->setTabText(1, tr("&Runtime Information"));
    121     m_pTabWidget->setTabText(2, tr("&Guest Session"));
     121    m_pTabWidget->setTabText(2, tr("&Guest Session Manager"));
    122122    m_pTabWidget->setTabText(3, tr("&Guest File Manager"));
    123123}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileManager.cpp

    r71255 r71258  
    343343
    344344                m_pCopyGuestToHost = new QAction(this);
    345                 m_pCopyGuestToHost->setIcon(UIIconPool::iconSet(QString(":/arrow_right_10px_x2.png")));
     345                if(m_pCopyGuestToHost)
     346                {
     347                    m_pCopyGuestToHost->setIcon(UIIconPool::iconSet(QString(":/arrow_right_10px_x2.png")));
     348                    m_pCopyGuestToHost->setEnabled(false);
     349                }
     350
    346351                m_pCopyHostToGuest = new QAction(this);
    347                 m_pCopyHostToGuest->setIcon(UIIconPool::iconSet(QString(":/arrow_left_10px_x2.png")));
    348 
    349 
     352                if (m_pCopyHostToGuest)
     353                {
     354                    m_pCopyHostToGuest->setIcon(UIIconPool::iconSet(QString(":/arrow_left_10px_x2.png")));
     355                    m_pCopyHostToGuest->setEnabled(false);
     356                }
    350357                m_pToolBar->addWidget(topSpacerWidget);
    351358                m_pToolBar->addAction(m_pCopyGuestToHost);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileTable.cpp

    r71255 r71258  
    2222/* Qt includes: */
    2323# include <QAction>
     24# include <QDateTime>
    2425# include <QDir>
    2526# include <QHeaderView>
     
    285286        {
    286287            if (m_pParent)
    287                 m_pParent->emitLogOutput(QString("cannot rename %1").arg(item->path()));
     288                m_pParent->emitLogOutput(QString(item->path()).append(" could not be renamed"));
    288289        }
    289290        return true;
     
    586587
    587588    m_pNewFolder = new QAction(this);
    588     m_pNewFolder->setIcon(UIIconPool::iconSet(QString(":/sf_32px.png")));
    589     m_pToolBar->addAction(m_pNewFolder);
     589    if (m_pNewFolder)
     590    {
     591        m_pNewFolder->setIcon(UIIconPool::iconSet(QString(":/sf_32px.png")));
     592        m_pToolBar->addAction(m_pNewFolder);
     593        m_pNewFolder->setEnabled(false);
     594    }
    590595
    591596    m_pCopy = new QAction(this);
    592     m_pCopy->setIcon(UIIconPool::iconSet(QString(":/fd_copy_22px.png")));
    593     m_pToolBar->addAction(m_pCopy);
     597    if (m_pCopy)
     598    {
     599        m_pCopy->setIcon(UIIconPool::iconSet(QString(":/fd_copy_22px.png")));
     600        m_pToolBar->addAction(m_pCopy);
     601        m_pCopy->setEnabled(false);
     602    }
    594603
    595604    m_pCut = new QAction(this);
    596     m_pCut->setIcon(UIIconPool::iconSet(QString(":/fd_move_22px.png")));
    597     m_pToolBar->addAction(m_pCut);
    598 
     605    if (m_pCut)
     606    {
     607        m_pCut->setIcon(UIIconPool::iconSet(QString(":/fd_move_22px.png")));
     608        m_pToolBar->addAction(m_pCut);
     609        m_pCut->setEnabled(false);
     610    }
    599611
    600612    m_pPaste = new QAction(this);
    601     m_pPaste->setIcon(UIIconPool::iconSet(QString(":/shared_clipboard_16px.png")));
    602     m_pToolBar->addAction(m_pPaste);
     613    if (m_pPaste)
     614    {
     615        m_pPaste->setIcon(UIIconPool::iconSet(QString(":/shared_clipboard_16px.png")));
     616        m_pToolBar->addAction(m_pPaste);
     617        m_pPaste->setEnabled(false);
     618    }
    603619}
    604620
     
    631647
    632648    QList<QVariant> headData;
    633     headData << "Name" << "Size";
     649    headData << "Name" << "Size" << "Change Time";
    634650    m_pRootItem = new UIFileTableItem(headData, true, 0);
    635651
    636652    QList<QVariant> startDirData;
    637     startDirData << "/" << 4096;
     653    startDirData << "/" << 4096 << QDateTime();
    638654    UIFileTableItem* startItem = new UIFileTableItem(startDirData, true, m_pRootItem);
    639655    startItem->setPath("/");
     
    941957    return newPath;
    942958}
     959
     960
    943961/*********************************************************************************************************************************
    944962*   UIGuestFileTable implementation.                                                                                             *
     
    9941012        {
    9951013            QList<QVariant> data;
    996             data << fsInfo.GetName() << static_cast<qulonglong>(fsInfo.GetObjectSize());
     1014            QDateTime changeTime = QDateTime::fromMSecsSinceEpoch(fsInfo.GetChangeTime()/1000);
     1015            data << fsInfo.GetName() << static_cast<qulonglong>(fsInfo.GetObjectSize()) << changeTime;
    9971016            bool isDirectory = (fsInfo.GetType() == KFsObjType_Directory);
    9981017            UIFileTableItem *item = new UIFileTableItem(data, isDirectory, parent);
    999 
    10001018            item->setPath(strPath, fsInfo.GetName());
    10011019            if (isDirectory)
     
    10331051    else
    10341052        m_comGuestSession.FsObjRemove(item->path());
     1053    if (!m_comGuestSession.isOk())
     1054        emit sigLogOutput(QString(item->path()).append(" could not be deleted"));
     1055
    10351056}
    10361057
    10371058void UIGuestFileTable::goToHomeDirectory()
    10381059{
    1039     /* TODO: not implemented in guest control yet: */
     1060    /** @todo not implemented in guest control yet: */
    10401061}
    10411062
     
    10601081}
    10611082
     1083
    10621084/*********************************************************************************************************************************
    10631085*   UIHostFileTable implementation.                                                                                              *
     
    10961118        const QFileInfo &fileInfo = entries.at(i);
    10971119        QList<QVariant> data;
    1098         data << fileInfo.baseName() << fileInfo.size();
     1120        data << fileInfo.baseName() << fileInfo.size() << fileInfo.lastModified();
    10991121        UIFileTableItem *item = new UIFileTableItem(data, fileInfo.isDir(), parent);
    11001122        item->setPath(fileInfo.absoluteFilePath());
     
    11561178}
    11571179
    1158 bool UIHostFileTable::renameItem(UIFileTableItem *item, QString newPath)
    1159 {
    1160     Q_UNUSED(item);
    1161     return true;
    1162 }
     1180bool UIHostFileTable::renameItem(UIFileTableItem *item, QString newBaseName)
     1181{
     1182    if (!item || item->isUpDirectory() || newBaseName.isEmpty())
     1183        return false;
     1184    QString newPath = constructNewItemPath(item->path(), newBaseName);
     1185    QDir a;
     1186    return a.rename(item->path(), newPath);
     1187}
     1188
     1189
    11631190#include "UIGuestControlFileTable.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileTable.h

    r71255 r71258  
    114114    virtual void deleteByItem(UIFileTableItem *item) = 0;
    115115    virtual void goToHomeDirectory() = 0;
    116     virtual bool renameItem(UIFileTableItem *item, QString newPath) = 0;
     116    virtual bool renameItem(UIFileTableItem *item, QString newBaseName) = 0;
    117117    void             goIntoDirectory(const QModelIndex &itemIndex);
    118118    /** Follow the path trail, open directories as we go and descend */
     
    187187    virtual void deleteByItem(UIFileTableItem *item) /* override */;
    188188    virtual void goToHomeDirectory() /* override */;
    189     virtual bool renameItem(UIFileTableItem *item, QString newPath);
     189    virtual bool renameItem(UIFileTableItem *item, QString newBaseName);
    190190
    191191private:
     
    212212    virtual void deleteByItem(UIFileTableItem *item) /* override */;
    213213    virtual void goToHomeDirectory() /* override */;
    214     virtual bool renameItem(UIFileTableItem *item, QString newPath);
     214    virtual bool renameItem(UIFileTableItem *item, QString newBaseName);
    215215};
    216216
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