VirtualBox

Changeset 71385 in vbox


Ignore:
Timestamp:
Mar 20, 2018 9:16:13 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699 Populate property dialog of guest file objects

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

Legend:

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

    r71380 r71385  
    5757*********************************************************************************************************************************/
    5858
    59 /** A collection of utility functions for some path string manipulations */
     59/** A collection of utility functions for so
     60me path string manipulations */
    6061class UIPathOperations
    6162{
     
    445446    if (m_pInfoEdit)
    446447    {
    447         // m_pInfoEdit->setTextFormat(Qt::RichText);
    448448        m_pInfoEdit->setReadOnly(true);
    449449        m_pInfoEdit->setFrameStyle(QFrame::NoFrame);
    450         //  m_pInfoEdit->setText("Line 1\nLine 2\n\nLine 4");
    451         //  m_pInfoEdit->setWordWrap(true);
    452450    }
    453451    QIDialogButtonBox *pButtonBox =
     
    11251123
    11261124    UIPropertiesDialog *dialog = new UIPropertiesDialog();
     1125    if (!dialog)
     1126        return;
     1127    dialog->setWindowTitle("Properties");
    11271128    dialog->setPropertyText(fsPropertyString);
    11281129    dialog->execute();
    1129 
    1130 
    1131 
    1132     // QIMessageBox *pFsObjectPropertiesBox = new QIMessageBox("Properties",
    1133     //                                                         fsPropertyString,
    1134     //                                                         AlertIconType_Information,
    1135     //                                                         AlertButton_Ok| AlertButtonOption_Escape, 0, 0, this);
    1136     // pFsObjectPropertiesBox->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::MinimumExpanding);
    1137 
    1138 
    1139     //     //pFsObjectPropertiesBox->setFixedWidth(300);
    1140     // pFsObjectPropertiesBox->exec();
    1141 
    1142     // delete pFsObjectPropertiesBox;
    11431130}
    11441131
     
    16091596}
    16101597
     1598FileObjectType UIGuestFileTable::fileType(const CGuestFsObjInfo &fsInfo)
     1599{
     1600    if (fsInfo.isNull() || !fsInfo.isOk())
     1601        return FileObjectType_Unknown;
     1602    if (fsInfo.GetType() == KFsObjType_Directory)
     1603         return FileObjectType_Directory;
     1604    else if (fsInfo.GetType() == KFsObjType_File)
     1605        return FileObjectType_File;
     1606    else if (fsInfo.GetType() == KFsObjType_Symlink)
     1607        return FileObjectType_SymLink;
     1608
     1609    return FileObjectType_Other;
     1610}
     1611
     1612
    16111613QString UIGuestFileTable::fsObjectPropertyString()
    16121614{
     1615    if (m_comGuestSession.isNull())
     1616        return QString();
     1617
     1618    QStringList selectedObjects = selectedItemPathList();
     1619    if (selectedObjects.isEmpty())
     1620        return QString();
     1621    if (selectedObjects.size() == 1)
     1622    {
     1623        if (selectedObjects.at(0).isNull())
     1624            return QString();
     1625        CGuestFsObjInfo fileInfo = m_comGuestSession.FsObjQueryInfo(selectedObjects.at(0), true);
     1626        if (!m_comGuestSession.isOk())
     1627            return QString();
     1628
     1629        QString propertyString;
     1630        /* Name: */
     1631        propertyString += "<b>Name:</b> " + UIPathOperations::getObjectName(fileInfo.GetName()) + "\n";
     1632        propertyString += "<br/>";
     1633        /* Size: */
     1634        propertyString += "<b>Size:</b> " + QString::number(fileInfo.GetObjectSize()) + QString(" bytes");
     1635        propertyString += "<br/>";
     1636        /* Type: */
     1637        propertyString += "<b>Type:</b> " + fileTypeString(fileType(fileInfo));
     1638        propertyString += "<br/>";
     1639        /* Creation Date: */
     1640        //     LONG64 GetChangeTime() const;
     1641        propertyString += "<b>Created:</b> " + QDateTime::fromMSecsSinceEpoch(fileInfo.GetChangeTime()/1000000).toString();
     1642        propertyString += "<br/>";
     1643        /* Last Modification Date: */
     1644        propertyString += "<b>Modified:</b> " + QDateTime::fromMSecsSinceEpoch(fileInfo.GetModificationTime()/1000000).toString();
     1645        propertyString += "<br/>";
     1646        /* Owner: */
     1647        propertyString += "<b>Owner:</b> " + fileInfo.GetUserName();
     1648        return propertyString;
     1649    }
    16131650    return QString();
    16141651}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.h

    r71380 r71385  
    245245
    246246    static FileObjectType fileType(const CFsObjInfo &fsInfo);
     247    static FileObjectType fileType(const CGuestFsObjInfo &fsInfo);
     248
    247249    bool copyGuestToHost(const QString &guestSourcePath, const QString& hostDestinationPath);
    248250    bool copyHostToGuest(const QString& hostSourcePath, const QString &guestDestinationPath);
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