当前位置: 首页>>代码示例>>C++>>正文


C++ UDSEntry::count方法代码示例

本文整理汇总了C++中kio::UDSEntry::count方法的典型用法代码示例。如果您正苦于以下问题:C++ UDSEntry::count方法的具体用法?C++ UDSEntry::count怎么用?C++ UDSEntry::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kio::UDSEntry的用法示例。


在下文中一共展示了UDSEntry::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: KFileItemPrivate

 KFileItemPrivate(const KIO::UDSEntry &entry,
                  mode_t mode, mode_t permissions,
                  const QUrl &itemOrDirUrl,
                  bool urlIsDirectory,
                  bool delayedMimeTypes)
     : m_entry(entry),
       m_url(itemOrDirUrl),
       m_strName(),
       m_strText(),
       m_iconName(),
       m_strLowerCaseName(),
       m_mimeType(),
       m_fileMode(mode),
       m_permissions(permissions),
       m_bLink(false),
       m_bIsLocalUrl(itemOrDirUrl.isLocalFile()),
       m_bMimeTypeKnown(false),
       m_delayedMimeTypes(delayedMimeTypes),
       m_useIconNameCache(false),
       m_hidden(Auto),
       m_slow(SlowUnknown)
 {
     if (entry.count() != 0) {
         readUDSEntry(urlIsDirectory);
     } else {
         Q_ASSERT(!urlIsDirectory);
         m_strName = itemOrDirUrl.fileName();
         m_strText = KIO::decodeFileName(m_strName);
     }
     init();
 }
开发者ID:KDE,项目名称:kio,代码行数:31,代码来源:kfileitem.cpp

示例2: init

void KFileItemPrivate::init()
{
    m_access.clear();
    //  metaInfo = KFileMetaInfo();

    // stat() local files if needed
    // TODO: delay this until requested
    if (m_fileMode == KFileItem::Unknown || m_permissions == KFileItem::Unknown || m_entry.count() == 0) {
        if (m_url.isLocalFile()) {
            /* directories may not have a slash at the end if
             * we want to stat() them; it requires that we
             * change into it .. which may not be allowed
             * stat("/is/unaccessible")  -> rwx------
             * stat("/is/unaccessible/") -> EPERM            H.Z.
             * This is the reason for the StripTrailingSlash
             */
            QT_STATBUF buf;
            const QString path = m_url.adjusted(QUrl::StripTrailingSlash).toLocalFile();
            const QByteArray pathBA = QFile::encodeName(path);
            if (QT_LSTAT(pathBA.constData(), &buf) == 0) {
                m_entry.insert(KIO::UDSEntry::UDS_DEVICE_ID,           buf.st_dev);
                m_entry.insert(KIO::UDSEntry::UDS_INODE,               buf.st_ino);

                mode_t mode = buf.st_mode;
                if ((buf.st_mode & QT_STAT_MASK) == QT_STAT_LNK) {
                    m_bLink = true;
                    if (QT_STAT(pathBA, &buf) == 0) {
                        mode = buf.st_mode;
                    } else {// link pointing to nowhere (see FileProtocol::createUDSEntry() in ioslaves/file/file.cpp)
                        mode = (QT_STAT_MASK - 1) | S_IRWXU | S_IRWXG | S_IRWXO;
                    }
                }
                m_entry.insert(KIO::UDSEntry::UDS_SIZE,      buf.st_size);
                m_entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, buf.st_mode & QT_STAT_MASK); // extract file type
                m_entry.insert(KIO::UDSEntry::UDS_ACCESS,    buf.st_mode & 07777); // extract permissions
                m_entry.insert(KIO::UDSEntry::UDS_MODIFICATION_TIME,   buf.st_mtime); // TODO: we could use msecs too...
                m_entry.insert(KIO::UDSEntry::UDS_ACCESS_TIME,         buf.st_atime);
#ifndef Q_OS_WIN
                m_entry.insert(KIO::UDSEntry::UDS_USER,                KUser(buf.st_uid).loginName());
                m_entry.insert(KIO::UDSEntry::UDS_GROUP,               KUserGroup(buf.st_gid).name());
#endif

                // TODO: these can be removed, we can use UDS_FILE_TYPE and UDS_ACCESS everywhere
                if (m_fileMode == KFileItem::Unknown) {
                    m_fileMode = mode & QT_STAT_MASK; // extract file type
                }
                if (m_permissions == KFileItem::Unknown) {
                    m_permissions = mode & 07777; // extract permissions
                }
            }
        }
    }
}
开发者ID:KDE,项目名称:kio,代码行数:53,代码来源:kfileitem.cpp


注:本文中的kio::UDSEntry::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。