Exemplo n.º 1
0
KACL KFileItem::ACL() const
{
    if ( hasExtendedACL() ) {
        // Extract it from the KIO::UDSEntry
        const QString fieldVal = d->m_entry.stringValue( KIO::UDSEntry::UDS_ACL_STRING );
        if ( !fieldVal.isEmpty() )
            return KACL( fieldVal );
    }
    // create one from the basic permissions
    return KACL( d->m_permissions );
}
Exemplo n.º 2
0
KACL KFileItem::ACL() const
{
  if ( hasExtendedACL() ) {
    // Extract it from the KIO::UDSEntry
    KIO::UDSEntry::ConstIterator it = m_entry.begin();
    for( ; it != m_entry.end(); ++it )
      if ( (*it).m_uds == KIO::UDS_ACL_STRING )
        return KACL((*it).m_str);
  }
  // create one from the basic permissions
  return KACL( m_permissions );
}
Exemplo n.º 3
0
QString KFileItem::parsePermissions(mode_t perm) const
{
    char p[] = "---------- ";

    if (isDir())
	p[0]='d';
    else if (isLink())
	p[0]='l';

    if (perm & QFileInfo::ReadUser)
	p[1]='r';
    if (perm & QFileInfo::WriteUser)
        p[2]='w';
    if ((perm & QFileInfo::ExeUser) && !(perm & S_ISUID)) p[3]='x';
    else if ((perm & QFileInfo::ExeUser) && (perm & S_ISUID)) p[3]='s';
    else if (!(perm & QFileInfo::ExeUser) && (perm & S_ISUID)) p[3]='S';

    if (perm & QFileInfo::ReadGroup)
	p[4]='r';
    if (perm & QFileInfo::WriteGroup)
        p[5]='w';
    if ((perm & QFileInfo::ExeGroup) && !(perm & S_ISGID)) p[6]='x';
    else if ((perm & QFileInfo::ExeGroup) && (perm & S_ISGID)) p[6]='s';
    else if (!(perm & QFileInfo::ExeGroup) && (perm & S_ISGID)) p[6]='S';

    if (perm & QFileInfo::ReadOther)
	p[7]='r';
    if (perm & QFileInfo::WriteOther)
        p[8]='w';
    if ((perm & QFileInfo::ExeOther) && !(perm & S_ISVTX)) p[9]='x';
    else if ((perm & QFileInfo::ExeOther) && (perm & S_ISVTX)) p[9]='t';
    else if (!(perm & QFileInfo::ExeOther) && (perm & S_ISVTX)) p[9]='T';

    if (hasExtendedACL())
        p[10]='+';

    return QString::fromLatin1(p);
}