VirtualBox

Ignore:
Timestamp:
Dec 4, 2018 10:49:47 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
127150
Message:

FE/Qt: bugref:6699. Make the permission string avaible on the file table column

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

Legend:

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

    r75932 r75941  
    200200        {
    201201            QVector<QVariant> data;
    202             QDateTime changeTime = QDateTime::fromMSecsSinceEpoch(fsInfo.GetChangeTime()/1000000);
     202            QDateTime changeTime = QDateTime::fromMSecsSinceEpoch(fsInfo.GetChangeTime()/RT_NS_1MS);
    203203
    204204            data << fsInfo.GetName() << static_cast<qulonglong>(fsInfo.GetObjectSize())
    205                  << changeTime << fsInfo.GetUserName();
     205                 << changeTime << fsInfo.GetUserName() << permissionString(fsInfo);
     206
    206207            FileObjectType fsObjectType = fileType(fsInfo);
    207208            UIFileTableItem *item = new UIFileTableItem(data, parent, fsObjectType);
     209
    208210            if (!item)
    209211                continue;
     
    219221                item->setIsOpened(false);
    220222            }
    221             /** @todo Seems like our API is not able to detect symlinks: */
    222223            else if(fsObjectType == FileObjectType_SymLink)
    223224            {
    224225                files.insert(fsInfo.GetName(), item);
    225226                item->setIsOpened(false);
     227                /* @todo. We will need to wait a fully implemented SymlinkRead function
     228                 * to be able to handle sym links properly: */
     229                // QString path = UIPathOperations::mergePaths(strPath, fsInfo.GetName());
     230                // QVector<KSymlinkReadFlag> aFlags;
     231                // printf("%s %s %s\n", qPrintable(fsInfo.GetName()), qPrintable(path),
     232                //        qPrintable(m_comGuestSession.SymlinkRead(path, aFlags)));
    226233            }
    227234
     
    438445        LONG64 size = fileInfo.GetObjectSize();
    439446        propertyStringList << UIGuestControlFileManager::tr("<b>Size:</b> %1 bytes").arg(QString::number(size));
    440         if (size >= 1024)
     447        if (size >= UIGuestControlFileTable::m_iKiloByte)
    441448            propertyStringList << QString(" (%1)<br/>").arg(humanReadableSize(size));
    442449        else
     
    446453        size = fileInfo.GetAllocatedSize();
    447454        propertyStringList << UIGuestControlFileManager::tr("<b>Allocated:</b> %1 bytes").arg(QString::number(size));
    448         if (size >= 1024)
     455        if (size >= UIGuestControlFileTable::m_iKiloByte)
    449456            propertyStringList << QString(" (%1)<br/>").arg(humanReadableSize(size));
    450457        else
     
    731738    return true;
    732739}
     740
     741QString UIGuestFileTable::permissionString(const CFsObjInfo &fsInfo)
     742{
     743    /* Attributes: */
     744    QString strAttributes = fsInfo.GetFileAttributes();
     745
     746    if (strAttributes.isEmpty())
     747        return strAttributes;
     748
     749    int offSpace = strAttributes.indexOf(' ');
     750    if (offSpace < 0)
     751        offSpace = strAttributes.length();
     752    return strAttributes.left(offSpace);
     753}
     754
    733755#include "UIGuestFileTable.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestFileTable.h

    r75903 r75941  
    7878    void prepareActionConnections();
    7979    bool checkGuestSession();
    80 
     80    QString permissionString(const CFsObjInfo &fsInfo);
    8181    mutable CGuestSession     m_comGuestSession;
    8282};
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