Qt 4.8
Public Functions | Public Variables | List of all members
QFileSystemModelPrivate::QFileSystemNode Class Reference

#include <qfilesystemmodel_p.h>

Public Functions

bool caseSensitive () const
 
bool hasInformation () const
 
QIcon icon () const
 
bool isDir () const
 
bool isExecutable () const
 
bool isFile () const
 
bool isHidden () const
 
bool isReadable () const
 
bool isSymLink (bool ignoreNtfsSymLinks=false) const
 
bool isSystem () const
 
bool isWritable () const
 
QDateTime lastModified () const
 
bool operator!= (const QExtendedInformation &fileInfo) const
 
bool operator< (const QFileSystemNode &node) const
 
bool operator< (const QString &name) const
 
bool operator== (const QString &name) const
 
bool operator== (const QExtendedInformation &fileInfo) const
 
bool operator> (const QString &name) const
 
QFile::Permissions permissions () const
 
void populate (const QExtendedInformation &fileInfo)
 
 QFileSystemNode (const QString &filename=QString(), QFileSystemNode *p=0)
 
void retranslateStrings (QFileIconProvider *iconProvider, const QString &path)
 
qint64 size () const
 
QString type () const
 
void updateIcon (QFileIconProvider *iconProvider, const QString &path)
 
int visibleLocation (QString childName)
 
 ~QFileSystemNode ()
 

Public Variables

QHash< QString, QFileSystemNode * > children
 
int dirtyChildrenIndex
 
QString fileName
 
QExtendedInformationinfo
 
bool isVisible
 
QFileSystemNodeparent
 
bool populatedChildren
 
QList< QStringvisibleChildren
 

Detailed Description

Definition at line 83 of file qfilesystemmodel_p.h.

Constructors and Destructors

◆ QFileSystemNode()

QFileSystemModelPrivate::QFileSystemNode::QFileSystemNode ( const QString filename = QString(),
QFileSystemNode p = 0 
)
inline

◆ ~QFileSystemNode()

QFileSystemModelPrivate::QFileSystemNode::~QFileSystemNode ( )
inline

Definition at line 88 of file qfilesystemmodel_p.h.

88  {
90  while (i != children.constEnd()) {
91  delete i.value();
92  ++i;
93  }
94  delete info;
95  info = 0;
96  parent = 0;
97  }
QHash< QString, QFileSystemNode * > children
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
Definition: qhash.h:395
const T & value() const
Returns the current item&#39;s value.
Definition: qhash.h:420

Functions

◆ caseSensitive()

bool QFileSystemModelPrivate::QFileSystemNode::caseSensitive ( ) const
inline

◆ hasInformation()

bool QFileSystemModelPrivate::QFileSystemNode::hasInformation ( ) const
inline

◆ icon()

QIcon QFileSystemModelPrivate::QFileSystemNode::icon ( ) const
inline

Definition at line 123 of file qfilesystemmodel_p.h.

123 { if (info) return info->icon; return QIcon(); }
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60

◆ isDir()

bool QFileSystemModelPrivate::QFileSystemNode::isDir ( ) const
inline

◆ isExecutable()

bool QFileSystemModelPrivate::QFileSystemNode::isExecutable ( ) const
inline

Definition at line 110 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModelPrivate::filtersAcceptsNode().

110 { return ((permissions() & QFile::ExeUser) != 0); }

◆ isFile()

bool QFileSystemModelPrivate::QFileSystemNode::isFile ( ) const
inline

Definition at line 118 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModelPrivate::filtersAcceptsNode().

118 { if (info) return info->isFile(); return true; }

◆ isHidden()

bool QFileSystemModelPrivate::QFileSystemNode::isHidden ( ) const
inline

Definition at line 120 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModelPrivate::filtersAcceptsNode().

120 { if (info) return info->isHidden(); return false; }

◆ isReadable()

bool QFileSystemModelPrivate::QFileSystemNode::isReadable ( ) const
inline

Definition at line 108 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModelPrivate::filtersAcceptsNode().

108 { return ((permissions() & QFile::ReadUser) != 0); }

◆ isSymLink()

bool QFileSystemModelPrivate::QFileSystemNode::isSymLink ( bool  ignoreNtfsSymLinks = false) const
inline

Definition at line 121 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModel::filePath(), QFileSystemModelPrivate::filtersAcceptsNode(), and QFileSystemModelPrivate::name().

121 { return info && info->isSymLink(ignoreNtfsSymLinks); }
bool isSymLink(bool ignoreNtfsSymLinks=false) const

◆ isSystem()

bool QFileSystemModelPrivate::QFileSystemNode::isSystem ( ) const
inline

Definition at line 119 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModelPrivate::filtersAcceptsNode().

119 { if (info) return info->isSystem(); return true; }

◆ isWritable()

bool QFileSystemModelPrivate::QFileSystemNode::isWritable ( ) const
inline

Definition at line 109 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModelPrivate::filtersAcceptsNode().

109 { return ((permissions() & QFile::WriteUser) != 0); }

◆ lastModified()

QDateTime QFileSystemModelPrivate::QFileSystemNode::lastModified ( ) const
inline

Definition at line 106 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModelSorter::compareNodes().

106 { if (info) return info->lastModified(); return QDateTime(); }
QDateTime lastModified() const
The QDateTime class provides date and time functions.
Definition: qdatetime.h:216

◆ operator!=()

bool QFileSystemModelPrivate::QFileSystemNode::operator!= ( const QExtendedInformation fileInfo) const
inline

Definition at line 140 of file qfilesystemmodel_p.h.

140  {
141  return !operator==(fileInfo);
142  }
bool operator==(const QString &name) const

◆ operator<() [1/2]

bool QFileSystemModelPrivate::QFileSystemNode::operator< ( const QFileSystemNode node) const
inline

Definition at line 125 of file qfilesystemmodel_p.h.

125  {
126  if (caseSensitive() || node.caseSensitive())
127  return fileName < node.fileName;
129  }
QFileSystemNode * node(const QModelIndex &index) const
Return the QFileSystemNode that goes to index.
int compare(const QString &s) const
Definition: qstring.cpp:5037

◆ operator<() [2/2]

bool QFileSystemModelPrivate::QFileSystemNode::operator< ( const QString name) const
inline

Definition at line 135 of file qfilesystemmodel_p.h.

135  {
136  if (caseSensitive())
137  return fileName < name;
138  return QString::compare(fileName, name, Qt::CaseInsensitive) < 0;
139  }
QString name(const QModelIndex &index) const
int compare(const QString &s) const
Definition: qstring.cpp:5037

◆ operator==() [1/2]

bool QFileSystemModelPrivate::QFileSystemNode::operator== ( const QString name) const
inline

Definition at line 143 of file qfilesystemmodel_p.h.

143  {
144  if (caseSensitive())
145  return fileName == name;
146  return QString::compare(fileName, name, Qt::CaseInsensitive) == 0;
147  }
QString name(const QModelIndex &index) const
int compare(const QString &s) const
Definition: qstring.cpp:5037

◆ operator==() [2/2]

bool QFileSystemModelPrivate::QFileSystemNode::operator== ( const QExtendedInformation fileInfo) const
inline

Definition at line 148 of file qfilesystemmodel_p.h.

148  {
149  return info && (*info == fileInfo);
150  }

◆ operator>()

bool QFileSystemModelPrivate::QFileSystemNode::operator> ( const QString name) const
inline

Definition at line 130 of file qfilesystemmodel_p.h.

130  {
131  if (caseSensitive())
132  return fileName > name;
133  return QString::compare(fileName, name, Qt::CaseInsensitive) > 0;
134  }
QString name(const QModelIndex &index) const
int compare(const QString &s) const
Definition: qstring.cpp:5037

◆ permissions()

QFile::Permissions QFileSystemModelPrivate::QFileSystemNode::permissions ( ) const
inline

Definition at line 107 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModel::flags().

107 { if (info) return info->permissions(); return 0; }
QFile::Permissions permissions() const

◆ populate()

void QFileSystemModelPrivate::QFileSystemNode::populate ( const QExtendedInformation fileInfo)
inline

Definition at line 154 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModelPrivate::addNode(), QFileSystemModelPrivate::node(), and QFileSystemModel::setData().

154  {
155  if (!info)
156  info = new QExtendedInformation(fileInfo.fileInfo());
157  (*info) = fileInfo;
158  }
QFileInfo fileInfo() const

◆ retranslateStrings()

void QFileSystemModelPrivate::QFileSystemNode::retranslateStrings ( QFileIconProvider iconProvider,
const QString path 
)
inline

Definition at line 180 of file qfilesystemmodel_p.h.

180  {
181  if (info)
182  info->displayType = iconProvider->type(QFileInfo(path));
184  for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) {
185  //On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
186  if (!path.isEmpty()) {
187  if (path.endsWith(QLatin1Char('/')))
188  iterator.value()->retranslateStrings(iconProvider, path + iterator.value()->fileName);
189  else
190  iterator.value()->retranslateStrings(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
191  } else
192  iterator.value()->retranslateStrings(iconProvider, iterator.value()->fileName);
193  }
194  }
QHash< QString, QFileSystemNode * > children
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
Definition: qhash.h:395
virtual QString type(const QFileInfo &info) const
Returns the type of the file described by info.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
const T & value() const
Returns the current item&#39;s value.
Definition: qhash.h:420
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
Definition: qstring.cpp:3796
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:60
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ size()

qint64 QFileSystemModelPrivate::QFileSystemNode::size ( ) const
inline

Definition at line 104 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModelSorter::compareNodes(), and QFileSystemModelPrivate::size().

104 { if (info && !info->isDir()) return info->size(); return 0; }

◆ type()

QString QFileSystemModelPrivate::QFileSystemNode::type ( ) const
inline

Definition at line 105 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModelSorter::compareNodes().

105 { if (info) return info->displayType; return QLatin1String(""); }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString

◆ updateIcon()

void QFileSystemModelPrivate::QFileSystemNode::updateIcon ( QFileIconProvider iconProvider,
const QString path 
)
inline

Definition at line 164 of file qfilesystemmodel_p.h.

164  {
165  if (info)
166  info->icon = iconProvider->icon(QFileInfo(path));
168  for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) {
169  //On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
170  if (!path.isEmpty()) {
171  if (path.endsWith(QLatin1Char('/')))
172  iterator.value()->updateIcon(iconProvider, path + iterator.value()->fileName);
173  else
174  iterator.value()->updateIcon(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
175  } else
176  iterator.value()->updateIcon(iconProvider, iterator.value()->fileName);
177  }
178  }
QHash< QString, QFileSystemNode * > children
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
Definition: qhash.h:395
virtual QIcon icon(IconType type) const
Returns an icon set for the given type.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
const T & value() const
Returns the current item&#39;s value.
Definition: qhash.h:420
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
Definition: qstring.cpp:3796
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:60
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ visibleLocation()

int QFileSystemModelPrivate::QFileSystemNode::visibleLocation ( QString  childName)
inline

Definition at line 161 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModelPrivate::_q_fileSystemChanged(), QFileSystemModelPrivate::index(), QFileSystemModelPrivate::node(), QFileSystemModel::parent(), QFileSystemModelPrivate::removeNode(), and QFileSystemModel::setData().

161  {
162  return visibleChildren.indexOf(childName);
163  }
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847

Properties

◆ children

QHash<QString,QFileSystemNode *> QFileSystemModelPrivate::QFileSystemNode::children

◆ dirtyChildrenIndex

int QFileSystemModelPrivate::QFileSystemNode::dirtyChildrenIndex

◆ fileName

QString QFileSystemModelPrivate::QFileSystemNode::fileName

◆ info

QExtendedInformation* QFileSystemModelPrivate::QFileSystemNode::info

Definition at line 204 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModel::setData().

◆ isVisible

bool QFileSystemModelPrivate::QFileSystemNode::isVisible

◆ parent

QFileSystemNode* QFileSystemModelPrivate::QFileSystemNode::parent

◆ populatedChildren

bool QFileSystemModelPrivate::QFileSystemNode::populatedChildren

◆ visibleChildren

QList<QString> QFileSystemModelPrivate::QFileSystemNode::visibleChildren

The documentation for this class was generated from the following file: