本文整理汇总了C++中QFileInfo::owner方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileInfo::owner方法的具体用法?C++ QFileInfo::owner怎么用?C++ QFileInfo::owner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFileInfo
的用法示例。
在下文中一共展示了QFileInfo::owner方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addFileNode
tlp::node addFileNode(const QFileInfo &infos, tlp::Graph *g) {
tlp::node n = g->addNode();
_absolutePaths->setNodeValue(n,tlp::QStringToTlpString(infos.absoluteFilePath()));
_baseNames->setNodeValue(n,tlp::QStringToTlpString(infos.baseName()));
_createdDates->setNodeValue(n,tlp::QStringToTlpString(infos.created().toString()));
_fileNames->setNodeValue(n,tlp::QStringToTlpString(infos.fileName()));
_isDir->setNodeValue(n,infos.isDir());
_isExecutable->setNodeValue(n,infos.isExecutable());
_isReadable->setNodeValue(n,infos.isReadable());
_isSymlink->setNodeValue(n,infos.isSymLink());
_isWritable->setNodeValue(n,infos.isWritable());
_lastModifiedDates->setNodeValue(n,tlp::QStringToTlpString(infos.lastModified().toString()));
_lastReadDates->setNodeValue(n,tlp::QStringToTlpString(infos.lastRead().toString()));
_owners->setNodeValue(n,tlp::QStringToTlpString(infos.owner()));
_permissions->setNodeValue(n,(int)(infos.permissions()));
_suffixes->setNodeValue(n,tlp::QStringToTlpString(infos.suffix()));
_sizes->setNodeValue(n,infos.size());
if (_useIcons) {
std::string extension = infos.suffix().toStdString();
if (infos.isDir()) {
_fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FolderO);
tlp::ColorProperty *viewColor = graph->getProperty<tlp::ColorProperty>("viewColor");
viewColor->setNodeValue(n, dirColor);
}
else if (std::find(commonTextFilesExt.begin(), commonTextFilesExt.end(), extension) != commonTextFilesExt.end()) {
_fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileTextO);
}
else if (std::find(commonArchiveFilesExt.begin(), commonArchiveFilesExt.end(), extension) != commonArchiveFilesExt.end()) {
_fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileArchiveO);
}
else if (std::find(commonAudioFilesExt.begin(), commonAudioFilesExt.end(), extension) != commonAudioFilesExt.end()) {
_fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileAudioO);
}
else if (std::find(commonImageFilesExt.begin(), commonImageFilesExt.end(), extension) != commonImageFilesExt.end()) {
_fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileImageO);
}
else if (std::find(commonVideoFilesExt.begin(), commonVideoFilesExt.end(), extension) != commonVideoFilesExt.end()) {
_fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileVideoO);
}
else if (std::find(commonDevFilesExt.begin(), commonDevFilesExt.end(), extension) != commonDevFilesExt.end()) {
_fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileCodeO);
}
else if (extension == "pdf") {
_fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FilePdfO);
}
else if (extension == "doc" || extension == "docx") {
_fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileWordO);
}
else if (extension == "xls" || extension == "xlsx") {
_fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FileExcelO);
}
else if (extension == "ppt" || extension == "pptx") {
_fontAwesomeIcon->setNodeValue(n, tlp::TulipFontAwesome::FilePowerpointO);
}
}
return n;
}
示例2: ListFilesInDirectoryTest
QMultiMap<QString,FileAttributes> ListFilesInDirectoryTest(QDir dir, bool Hash)
{
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
qt_ntfs_permission_lookup++; // turn checking on
QMultiMap<QString, FileAttributes> fileAttHashTable; //making hash table to store file attributes
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir.setSorting(QDir::Name);
QFileInfoList list = dir.entryInfoList();
for (int i = 0; i < list.size(); ++i)
{
QFileInfo fileInfo = list.at(i);
if (fileInfo.isFile())
{
FileAttributes tempFileAttributes;
QDateTime date = fileInfo.lastModified();
QString lastModified = date.toString();
tempFileAttributes.absoluteFilePath = fileInfo.absoluteFilePath();
tempFileAttributes.fileName = fileInfo.fileName();
tempFileAttributes.filePath= fileInfo.path();
if (Hash) tempFileAttributes.md5Hash = GetFileMd5hash(fileInfo.absoluteFilePath());
tempFileAttributes.lastModified = fileInfo.lastModified();
tempFileAttributes.lastRead = fileInfo.lastRead();
tempFileAttributes.created = fileInfo.created();
tempFileAttributes.isHidden = fileInfo.isHidden();
tempFileAttributes.size = fileInfo.size();
tempFileAttributes.owner = fileInfo.owner();
fileAttHashTable.insert(fileInfo.absoluteFilePath(),tempFileAttributes);
}
}
return fileAttHashTable;
}
示例3: name
MyDirEntry::MyDirEntry(const QFileInfo& info) :
name(info.fileName()),
owner(info.owner()),
group(info.group()),
lastModified(info.lastModified()),
permissions(info.permissions()),
lastModifiedBy(hostName),
parent(0)
{};
示例4: info
TEST(codegen, DISABLED_reference)
{
soft::Reference reference;
QFileInfo info ("/tmp/thermo-edited.dat");
reference.uri = "file://" + info.absoluteFilePath().toStdString();
reference.created = info.created().toString("dd-mm-yyyy").toStdString();
reference.owner = info.owner().toStdString();
reference.lastModified = info.lastModified().toString("dd-mm-yyyy").toStdString();
reference.sha1 = toStdBlob(sha1(info.absoluteFilePath()));
soft::Storage storage("mongo2", "mongodb://localhost", "db=codegentest;coll=reference");
storage.save(&reference);
}
示例5: main
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
// QDir * _dir=new QDir();
// // _dir->mkdir("tmp//audio");
// _dir->mkpath("tmp/audio");
/**/
QDir directory(this->getPath());
qDebug()<<"getIOSFilePath,m :"<<this->getPath();
QFileInfoList fileInfoList;
if (this->hiddenFiles)
{
fileInfoList = directory.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
}
else
{
fileInfoList = directory.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
}
QFileInfo fileInfo;
File file;
QList<File> *fileList = new QList<File>;
QFileIconProvider *provider = new QFileIconProvider;
while (!fileInfoList.isEmpty())
{
if (this->procesEvents)
qApp->processEvents();
fileInfo = fileInfoList.takeFirst();
file.fileIcon = provider->icon(fileInfo);
file.fileName = fileInfo.fileName();
qDebug()<<"IOSFileName:"<<file.fileName;
file.fileSize = QString::number(fileInfo.size());
file.fileDate = fileInfo.lastModified().toString("MMM dd yyyy");
file.filePath = fileInfo.absoluteFilePath();
file.filePermissions = "";
file.fileOwner = fileInfo.owner();
if (fileInfo.isDir())
file.fileType = "dir";
else
file.fileType = "file";
fileList->append(file);
}
delete provider;
return fileList;
return a.exec();
}
示例6: QWidget
//! [7]
PermissionsTab::PermissionsTab(const QFileInfo &fileInfo, QWidget *parent)
: QWidget(parent)
{
QGroupBox *permissionsGroup = new QGroupBox(tr("Permissions"));
QCheckBox *readable = new QCheckBox(tr("Readable"));
if (fileInfo.isReadable())
readable->setChecked(true);
QCheckBox *writable = new QCheckBox(tr("Writable"));
if ( fileInfo.isWritable() )
writable->setChecked(true);
QCheckBox *executable = new QCheckBox(tr("Executable"));
if ( fileInfo.isExecutable() )
executable->setChecked(true);
QGroupBox *ownerGroup = new QGroupBox(tr("Ownership"));
QLabel *ownerLabel = new QLabel(tr("Owner"));
QLabel *ownerValueLabel = new QLabel(fileInfo.owner());
ownerValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
QLabel *groupLabel = new QLabel(tr("Group"));
QLabel *groupValueLabel = new QLabel(fileInfo.group());
groupValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
QVBoxLayout *permissionsLayout = new QVBoxLayout;
permissionsLayout->addWidget(readable);
permissionsLayout->addWidget(writable);
permissionsLayout->addWidget(executable);
permissionsGroup->setLayout(permissionsLayout);
QVBoxLayout *ownerLayout = new QVBoxLayout;
ownerLayout->addWidget(ownerLabel);
ownerLayout->addWidget(ownerValueLabel);
ownerLayout->addWidget(groupLabel);
ownerLayout->addWidget(groupValueLabel);
ownerGroup->setLayout(ownerLayout);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(permissionsGroup);
mainLayout->addWidget(ownerGroup);
mainLayout->addStretch(1);
setLayout(mainLayout);
}
示例7: loadSchemes
void TupThemeSelector::loadSchemes()
{
QDir themeDir(SHARE_DIR + "themes");
if (themeDir.exists()) {
m_allSchemes->clear();
QFileInfoList files = themeDir.entryInfoList(QStringList() <<"*.tupt");
for (int i = 0; i < files.count(); i++) {
QFileInfo iterator = files[i];
QTreeWidgetItem *item = new QTreeWidgetItem(m_allSchemes);
item->setText(0, iterator.fileName());
item->setText(1, iterator.owner());
item->setText(2, iterator.created().toString());
}
}
}
示例8: operationListChildren
void QLocalFs::operationListChildren( QNetworkOperation *op )
{
#ifdef QLOCALFS_DEBUG
qDebug( "QLocalFs: operationListChildren" );
#endif
op->setState( StInProgress );
dir = QDir( url()->path() );
dir.setNameFilter( url()->nameFilter() );
dir.setMatchAllDirs( TRUE );
if ( !dir.isReadable() ) {
QString msg = tr( "Could not read directory\n%1" ).arg( url()->path() );
op->setState( StFailed );
op->setProtocolDetail( msg );
op->setErrorCode( (int)ErrListChildren );
emit finished( op );
return;
}
const QFileInfoList *filist = dir.entryInfoList( QDir::All | QDir::Hidden | QDir::System );
if ( !filist ) {
QString msg = tr( "Could not read directory\n%1" ).arg( url()->path() );
op->setState( StFailed );
op->setProtocolDetail( msg );
op->setErrorCode( (int)ErrListChildren );
emit finished( op );
return;
}
emit start( op );
QFileInfoListIterator it( *filist );
QFileInfo *fi;
QValueList<QUrlInfo> infos;
while ( ( fi = it.current() ) != 0 ) {
++it;
infos << QUrlInfo( fi->fileName(), convertPermissions(fi), fi->owner(), fi->group(),
fi->size(), fi->lastModified(), fi->lastRead(), fi->isDir(), fi->isFile(),
fi->isSymLink(), fi->isWritable(), fi->isReadable(), fi->isExecutable() );
}
emit newChildren( infos, op );
op->setState( StDone );
emit finished( op );
}
示例9: QGroupBox
////////////////////////////////////////////////////////////////////////////////
//
// GeneralTab
//
////////////////////////////////////////////////////////////////////////////////
PermissionTab::PermissionTab(const QFileInfo& fileInfo, QWidget* parent)
{
auto permissionGroup = new QGroupBox(tr("Permissions"));
auto readable = new QCheckBox(tr("Readable"));
if (fileInfo.isReadable())
readable->setChecked(true);
auto writable = new QCheckBox(tr("Writable"));
if (fileInfo.isWritable())
writable->setChecked(true);
auto executable = new QCheckBox(tr("Executable"));
if (fileInfo.isWritable())
executable->setChecked(true);
auto ownerLabel = new QLabel(tr("Owner"));
auto ownerValueLabel = new QLabel(fileInfo.owner());
ownerValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
auto groupLabel = new QLabel(tr("Group"));
auto groupValueLabel = new QLabel(fileInfo.group());
groupValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
auto permissionLayout = new QVBoxLayout;
permissionLayout->addWidget(readable);
permissionLayout->addWidget(writable);
permissionLayout->addWidget(executable);
permissionGroup->setLayout(permissionLayout);
auto ownerGroup = new QGroupBox(tr("Ownership"));
auto ownerLaout = new QVBoxLayout;
ownerLaout->addWidget(ownerLabel);
ownerLaout->addWidget(ownerValueLabel);
ownerLaout->addWidget(groupLabel);
ownerLaout->addWidget(groupValueLabel);
ownerGroup->setLayout(ownerLaout);
auto layout = new QVBoxLayout();
layout->addWidget(permissionGroup);
layout->addWidget(ownerGroup);
layout->addStretch(1);
this->setLayout(layout);
}
示例10: finished
void Q3LocalFs::operationListChildren( Q3NetworkOperation *op )
{
#ifdef QLOCALFS_DEBUG
qDebug( "Q3LocalFs: operationListChildren" );
#endif
op->setState( StInProgress );
dir = QDir( url()->path() );
dir.setNameFilter( url()->nameFilter() );
dir.setMatchAllDirs( true );
if ( !dir.isReadable() ) {
QString msg = tr( "Could not read directory\n%1" ).arg( url()->path() );
op->setState( StFailed );
op->setProtocolDetail( msg );
op->setErrorCode( (int)ErrListChildren );
emit finished( op );
return;
}
QFileInfoList filist = dir.entryInfoList(QDir::All | QDir::Hidden | QDir::System);
if ( filist.isEmpty() ) {
QString msg = tr( "Could not read directory\n%1" ).arg( url()->path() );
op->setState( StFailed );
op->setProtocolDetail( msg );
op->setErrorCode( (int)ErrListChildren );
emit finished( op );
return;
}
emit start( op );
Q3ValueList<QUrlInfo> infos;
for (int i = 0; i < filist.size(); ++i) {
QFileInfo fi = filist.at(i);
infos << QUrlInfo( fi.fileName(), convertPermissions(&fi), fi.owner(), fi.group(),
fi.size(), fi.lastModified(), fi.lastRead(), fi.isDir(), fi.isFile(),
fi.isSymLink(), fi.isWritable(), fi.isReadable(), fi.isExecutable() );
}
emit newChildren( infos, op );
op->setState( StDone );
emit finished( op );
}
示例11: directory
QList<File> *Computer::getFileList()
{
QDir directory(this->getPath());
QFileInfoList fileInfoList;
if (this->hiddenFiles)
{
fileInfoList = directory.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
}
else
{
fileInfoList = directory.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
}
QFileInfo fileInfo;
File file;
QList<File> *fileList = new QList<File>;
QFileIconProvider *provider = new QFileIconProvider;
while (!fileInfoList.isEmpty())
{
if (this->procesEvents)
qApp->processEvents();
fileInfo = fileInfoList.takeFirst();
file.fileIcon = provider->icon(fileInfo);
file.fileName = fileInfo.fileName();
file.fileSize = QString::number(fileInfo.size());
file.fileDate = fileInfo.lastModified().toString("MMM dd yyyy");
file.filePath = fileInfo.absoluteFilePath();
file.filePermissions = "";
file.fileOwner = fileInfo.owner();
if (fileInfo.isDir())
file.fileType = "dir";
else
file.fileType = "file";
fileList->append(file);
}
delete provider;
return fileList;
}
示例12: di
FileTreeItem::FileTreeItem(const QFileInfo & fileInfo,const FileTreeItem * parentItem,
bool scan_subdirs,bool encripted) {
m_path = (parentItem->rootItem?"":parentItem->archivePath()) + fileInfo.fileName();
if (fileInfo.isDir()) m_path += "/";
m_perms = permissions(fileInfo);
m_user = fileInfo.owner();
m_group = fileInfo.group();
m_link_to = fileInfo.symLinkTarget();
m_file_size = fileInfo.size();
m_date = fileInfo.lastModified();
m_parentItem = (FileTreeItem *)parentItem;
m_encripted = encripted;
rootItem = false;
if (is_dir()) {
if (scan_subdirs) {
QDirIterator di(fileInfo.filePath(),QDir::AllEntries | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot);
while (di.hasNext()) {
di.next();
appendChild(new FileTreeItem(QFileInfo(di.filePath()),this,true,encripted));
}
}
}
}
示例13: equals
bool MyDirEntry::equals(const QFileInfo& info) const{
return ( isDir() == info.isDir()
&& owner == info.owner()
&& lastModified == info.lastModified()
&& permissions == info.permissions());
}
示例14: dir
/** Creates the \c ls command result
*
* It creates it in the packetData string.
*
*/
void RainbruRPG::Network::Ftp::FtpTransfer::lsResult(){
LOGI("LIST command result :");
packetData="";
unsigned int childs=1;
QDir dir(currentDirectory );
dir.setFilter(QDir::Dirs| QDir::Files| QDir::NoSymLinks);
dir.setSorting(QDir::Name);
QFileInfoList list = dir.entryInfoList();
LOGCATS("Sending ");
LOGCATI(list.size());
LOGCATS(" files.");
LOGCAT();
for (int i = 0; i < list.size(); ++i) {
QFileInfo fileInfo = list.at(i);
// ====== User permissions
// Diretory ?
if (fileInfo.isDir()){
packetData+="d";
QDir dir2(fileInfo.absoluteFilePath());
childs=dir2.count();
}
else{
packetData+="-";
childs=1;
}
packetData+=filePermissions(fileInfo.isReadable(),fileInfo.isWritable(),
fileInfo.isExecutable());
packetData+=filePermissions(fileInfo.permission(QFile::ReadGroup),
fileInfo.permission(QFile::WriteGroup),
fileInfo.permission(QFile::ExeGroup));
packetData+=filePermissions(fileInfo.permission(QFile::ReadOther),
fileInfo.permission(QFile::WriteOther),
fileInfo.permission(QFile::ExeOther));
// Child number
QString sChild;
sChild.setNum(childs);
sChild=sChild.rightJustified(5);
packetData+=sChild;
// Owner and group names
packetData+=' ';
QString sOwner=fileInfo.owner();
sOwner=sOwner.leftJustified(9);
packetData+=sOwner;
QString sGroup=fileInfo.group();
sGroup=sGroup.leftJustified(9);
packetData+=sGroup;
// File size
qint64 size=fileInfo.size();
QString sSize=fileSizeToString(size);
sSize=sSize.rightJustified(8);
packetData+=sSize;
// Last modified time
packetData+=" ";
QDateTime dt=fileInfo.lastModified();
packetData+=dt.toString("yyyy-MM-dd hh:mm");
// File name and EOL
packetData+=" ";
packetData+=fileInfo.fileName();
packetData+="\n";
}
LOGI("PacketData done. LIST result can be sent");
int i= packetData.size();
LOGCATS("PacketData lenght :");
LOGCATI(i);
LOGCAT();
}
示例15: Load
void CFileList::Load( QString *in_cwd )
{
#ifdef QT_V4LAYOUT
Q3ListViewItem *pListViewItem;
#else
QListViewItem *pListViewItem;
#endif
QDir d;
clear();
if ( in_cwd )
{
cwd = *in_cwd;
}
d.setFilter( QDir::Files | QDir::Hidden );
d.cd( cwd );
d.setNameFilter("*.dsn");
#ifdef QT_V4LAYOUT
const QFileInfoList list = d.entryInfoList();
QFileInfo fi; // pointer for traversing
for ( int i = 0; i < list.size(); i ++ ) {
QString perm, size;
char driver[ 128 ];
fi = list.at(i);
perm = "-";
perm += fi.permission( QFileInfo::ReadUser ) ? "r" : "-";
perm += fi.permission( QFileInfo::WriteUser ) ? "w" : "-";
perm += fi.permission( QFileInfo::ExeUser ) ? "x" : "-";
perm += fi.permission( QFileInfo::ReadGroup ) ? "r" : "-";
perm += fi.permission( QFileInfo::WriteGroup ) ? "w" : "-";
perm += fi.permission( QFileInfo::ExeGroup ) ? "x" : "-";
perm += fi.permission( QFileInfo::ReadOther ) ? "r" : "-";
perm += fi.permission( QFileInfo::WriteOther ) ? "w" : "-";
perm += fi.permission( QFileInfo::ExeOther ) ? "x" : "-";
size.sprintf( "%d bytes", fi.size());
pListViewItem = new Q3ListViewItem( this, fi.fileName(), perm, fi.owner(), fi.group(), size );
}
#else
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) )
{ // for each file...
QString perm, size;
char driver[ 128 ];
perm = "-";
perm += fi->permission( QFileInfo::ReadUser ) ? "r" : "-";
perm += fi->permission( QFileInfo::WriteUser ) ? "w" : "-";
perm += fi->permission( QFileInfo::ExeUser ) ? "x" : "-";
perm += fi->permission( QFileInfo::ReadGroup ) ? "r" : "-";
perm += fi->permission( QFileInfo::WriteGroup ) ? "w" : "-";
perm += fi->permission( QFileInfo::ExeGroup ) ? "x" : "-";
perm += fi->permission( QFileInfo::ReadOther ) ? "r" : "-";
perm += fi->permission( QFileInfo::WriteOther ) ? "w" : "-";
perm += fi->permission( QFileInfo::ExeOther ) ? "x" : "-";
size.sprintf( "%d bytes", fi->size());
pListViewItem = new QListViewItem( this, fi->fileName(), perm, fi->owner(), fi->group(), size );
++it; // goto next list element
}
#endif
}