dialogs/qfilesystemmodel.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3bool QFileSystemModel::remove(const QModelIndex &aindex) -
4{ -
5 -
6 QString path = filePath(aindex); -
7 QFileSystemModelPrivate * d = const_cast<QFileSystemModelPrivate*>(d_func()); -
8 d->fileInfoGatherer.removePath(path); -
9 QDirIterator it(path, -
10 QDir::AllDirs | QDir:: Files | QDir::NoDotAndDotDot, -
11 QDirIterator::Subdirectories); -
12 QStringList children; -
13 while (it.hasNext())
never evaluated: it.hasNext()
0
14 children.prepend(it.next());
never executed: children.prepend(it.next());
0
15 children.append(path); -
16 -
17 bool error = false; -
18 for (int i = 0; i < children.count(); ++i) {
never evaluated: i < children.count()
0
19 QFileInfo info(children.at(i)); -
20 QModelIndex modelIndex = index(children.at(i)); -
21 if (info.isDir()) {
never evaluated: info.isDir()
0
22 QDir dir; -
23 if (children.at(i) != path)
never evaluated: children.at(i) != path
0
24 error |= remove(modelIndex);
never executed: error |= remove(modelIndex);
0
25 error |= rmdir(modelIndex); -
26 } else {
never executed: }
0
27 error |= QFile::remove(filePath(modelIndex)); -
28 }
never executed: }
0
29 } -
30 return error;
never executed: return error;
0
31} -
32 -
33 -
34 -
35 -
36QFileSystemModel::QFileSystemModel(QObject *parent) -
37 : QAbstractItemModel(*new QFileSystemModelPrivate, parent) -
38{ -
39 QFileSystemModelPrivate * const d = d_func(); -
40 d->init(); -
41}
executed: }
Execution Count:202
202
42 -
43 -
44 -
45 -
46QFileSystemModel::QFileSystemModel(QFileSystemModelPrivate &dd, QObject *parent) -
47 : QAbstractItemModel(dd, parent) -
48{ -
49 QFileSystemModelPrivate * const d = d_func(); -
50 d->init(); -
51}
never executed: }
0
52 -
53 -
54 -
55 -
56QFileSystemModel::~QFileSystemModel() -
57{ -
58} -
59 -
60 -
61 -
62 -
63QModelIndex QFileSystemModel::index(int row, int column, const QModelIndex &parent) const -
64{ -
65 const QFileSystemModelPrivate * const d = d_func(); -
66 if (row < 0 || column < 0 || row >= rowCount(parent) || column >= columnCount(parent))
partially evaluated: row < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20367
partially evaluated: column < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20367
partially evaluated: row >= rowCount(parent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20367
partially evaluated: column >= columnCount(parent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20367
0-20367
67 return QModelIndex();
never executed: return QModelIndex();
0
68 -
69 -
70 QFileSystemModelPrivate::QFileSystemNode *parentNode = (d->indexValid(parent) ? d->node(parent) :
evaluated: d->indexValid(parent)
TRUEFALSE
yes
Evaluation Count:19047
yes
Evaluation Count:1320
1320-19047
71 const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&d->root)); -
72 qt_noop(); -
73 -
74 -
75 QString childName = parentNode->visibleChildren[d->translateVisibleLocation(parentNode, row)]; -
76 const QFileSystemModelPrivate::QFileSystemNode *indexNode = parentNode->children.value(childName); -
77 qt_noop(); -
78 -
79 return createIndex(row, column, const_cast<QFileSystemModelPrivate::QFileSystemNode*>(indexNode));
executed: return createIndex(row, column, const_cast<QFileSystemModelPrivate::QFileSystemNode*>(indexNode));
Execution Count:20367
20367
80} -
81 -
82 -
83 -
84 -
85 -
86 -
87QModelIndex QFileSystemModel::index(const QString &path, int column) const -
88{ -
89 const QFileSystemModelPrivate * const d = d_func(); -
90 QFileSystemModelPrivate::QFileSystemNode *node = d->node(path, false); -
91 QModelIndex idx = d->index(node); -
92 if (idx.column() != column)
evaluated: idx.column() != column
TRUEFALSE
yes
Evaluation Count:757
yes
Evaluation Count:2553
757-2553
93 idx = idx.sibling(idx.row(), column);
executed: idx = idx.sibling(idx.row(), column);
Execution Count:757
757
94 return idx;
executed: return idx;
Execution Count:3310
3310
95} -
96 -
97 -
98 -
99 -
100 -
101 -
102QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QModelIndex &index) const -
103{ -
104 if (!index.isValid())
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:4991
yes
Evaluation Count:114032
4991-114032
105 return const_cast<QFileSystemNode*>(&root);
executed: return const_cast<QFileSystemNode*>(&root);
Execution Count:4991
4991
106 QFileSystemModelPrivate::QFileSystemNode *indexNode = static_cast<QFileSystemModelPrivate::QFileSystemNode*>(index.internalPointer()); -
107 qt_noop(); -
108 return indexNode;
executed: return indexNode;
Execution Count:114032
114032
109} -
110QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QString &path, bool fetch) const -
111{ -
112 const QFileSystemModel * const q = q_func(); -
113 (void)q;; -
114 if (path.isEmpty() || path == myComputer() || path.startsWith(QLatin1Char(':')))
evaluated: path.isEmpty()
TRUEFALSE
yes
Evaluation Count:652
yes
Evaluation Count:3183
partially evaluated: path == myComputer()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3183
partially evaluated: path.startsWith(QLatin1Char(':'))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3183
0-3183
115 return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
executed: return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
Execution Count:652
652
116 -
117 -
118 QString absolutePath; -
119 -
120 -
121 -
122 QString longPath = path; -
123 -
124 if (longPath == rootDir.path())
evaluated: longPath == rootDir.path()
TRUEFALSE
yes
Evaluation Count:1941
yes
Evaluation Count:1242
1242-1941
125 absolutePath = rootDir.absolutePath();
executed: absolutePath = rootDir.absolutePath();
Execution Count:1941
1941
126 else -
127 absolutePath = QDir(longPath).absolutePath();
executed: absolutePath = QDir(longPath).absolutePath();
Execution Count:1242
1242
128 -
129 -
130 QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts); -
131 if ((pathElements.isEmpty())
evaluated: (pathElements.isEmpty())
TRUEFALSE
yes
Evaluation Count:96
yes
Evaluation Count:3087
96-3087
132 -
133 && QDir::fromNativeSeparators(longPath) != QLatin1String("/")
evaluated: QDir::fromNativeSeparators(longPath) != QLatin1String("/")
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:90
6-90
134 -
135 ) -
136 return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
executed: return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
Execution Count:6
6
137 QModelIndex index = QModelIndex(); -
138 if (absolutePath[0] == QLatin1Char('/'))
partially evaluated: absolutePath[0] == QLatin1Char('/')
TRUEFALSE
yes
Evaluation Count:3177
no
Evaluation Count:0
0-3177
139 pathElements.prepend(QLatin1String("/"));
executed: pathElements.prepend(QLatin1String("/"));
Execution Count:3177
3177
140 -
141 -
142 QFileSystemModelPrivate::QFileSystemNode *parent = node(index); -
143 -
144 for (int i = 0; i < pathElements.count(); ++i) {
evaluated: i < pathElements.count()
TRUEFALSE
yes
Evaluation Count:15614
yes
Evaluation Count:3061
3061-15614
145 QString element = pathElements.at(i); -
146 -
147 -
148 -
149 -
150 -
151 bool alreadyExisted = parent->children.contains(element); -
152 -
153 -
154 -
155 if (alreadyExisted) {
evaluated: alreadyExisted
TRUEFALSE
yes
Evaluation Count:13951
yes
Evaluation Count:1663
1663-13951
156 if ((parent->children.count() == 0)
partially evaluated: (parent->children.count() == 0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13951
0-13951
157 || (parent->caseSensitive()
evaluated: parent->caseSensitive()
TRUEFALSE
yes
Evaluation Count:10950
yes
Evaluation Count:3001
3001-10950
158 && parent->children.value(element)->fileName != element)
partially evaluated: parent->children.value(element)->fileName != element
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10950
0-10950
159 || (!parent->caseSensitive()
evaluated: !parent->caseSensitive()
TRUEFALSE
yes
Evaluation Count:3001
yes
Evaluation Count:10950
3001-10950
160 && parent->children.value(element)->fileName.toLower() != element.toLower()))
partially evaluated: parent->children.value(element)->fileName.toLower() != element.toLower()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3001
0-3001
161 alreadyExisted = false;
never executed: alreadyExisted = false;
0
162 }
executed: }
Execution Count:13951
13951
163 -
164 QFileSystemModelPrivate::QFileSystemNode *node; -
165 if (!alreadyExisted) {
evaluated: !alreadyExisted
TRUEFALSE
yes
Evaluation Count:1663
yes
Evaluation Count:13951
1663-13951
166 -
167 -
168 QFileInfo info(absolutePath); -
169 if (!info.exists())
evaluated: !info.exists()
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:1615
48-1615
170 return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
executed: return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
Execution Count:48
48
171 QFileSystemModelPrivate *p = const_cast<QFileSystemModelPrivate*>(this); -
172 node = p->addNode(parent, element,info); -
173 node->populate(fileInfoGatherer.getInfo(info)); -
174 } else {
executed: }
Execution Count:1615
1615
175 node = parent->children.value(element); -
176 }
executed: }
Execution Count:13951
13951
177 -
178 qt_noop(); -
179 if (!node->isVisible) {
evaluated: !node->isVisible
TRUEFALSE
yes
Evaluation Count:1683
yes
Evaluation Count:13883
1683-13883
180 -
181 if (alreadyExisted && node->hasInformation() && !fetch)
evaluated: alreadyExisted
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:1615
partially evaluated: node->hasInformation()
TRUEFALSE
yes
Evaluation Count:68
no
Evaluation Count:0
partially evaluated: !fetch
TRUEFALSE
yes
Evaluation Count:68
no
Evaluation Count:0
0-1615
182 return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
executed: return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
Execution Count:68
68
183 -
184 QFileSystemModelPrivate *p = const_cast<QFileSystemModelPrivate*>(this); -
185 p->addVisibleFiles(parent, QStringList(element)); -
186 if (!p->bypassFilters.contains(node))
partially evaluated: !p->bypassFilters.contains(node)
TRUEFALSE
yes
Evaluation Count:1615
no
Evaluation Count:0
0-1615
187 p->bypassFilters[node] = 1;
executed: p->bypassFilters[node] = 1;
Execution Count:1615
1615
188 QString dir = q->filePath(this->index(parent)); -
189 if (!node->hasInformation() && fetch) {
partially evaluated: !node->hasInformation()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1615
never evaluated: fetch
0-1615
190 Fetching f; -
191 f.dir = dir; -
192 f.file = element; -
193 f.node = node; -
194 p->toFetch.append(f); -
195 p->fetchingTimer.start(0, const_cast<QFileSystemModel*>(q)); -
196 }
never executed: }
0
197 }
executed: }
Execution Count:1615
1615
198 parent = node; -
199 }
executed: }
Execution Count:15498
15498
200 -
201 return parent;
executed: return parent;
Execution Count:3061
3061
202} -
203 -
204 -
205 -
206 -
207void QFileSystemModel::timerEvent(QTimerEvent *event) -
208{ -
209 QFileSystemModelPrivate * const d = d_func(); -
210 if (event->timerId() == d->fetchingTimer.timerId()) {
never evaluated: event->timerId() == d->fetchingTimer.timerId()
0
211 d->fetchingTimer.stop(); -
212 -
213 for (int i = 0; i < d->toFetch.count(); ++i) {
never evaluated: i < d->toFetch.count()
0
214 const QFileSystemModelPrivate::QFileSystemNode *node = d->toFetch.at(i).node; -
215 if (!node->hasInformation()) {
never evaluated: !node->hasInformation()
0
216 d->fileInfoGatherer.fetchExtendedInformation(d->toFetch.at(i).dir, -
217 QStringList(d->toFetch.at(i).file)); -
218 } else {
never executed: }
0
219 -
220 }
never executed: }
0
221 } -
222 -
223 d->toFetch.clear(); -
224 }
never executed: }
0
225}
never executed: }
0
226 -
227 -
228 -
229 -
230 -
231bool QFileSystemModel::isDir(const QModelIndex &index) const -
232{ -
233 -
234 const QFileSystemModelPrivate * const d = d_func(); -
235 if (!index.isValid())
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:181
yes
Evaluation Count:494
181-494
236 return true;
executed: return true;
Execution Count:181
181
237 QFileSystemModelPrivate::QFileSystemNode *n = d->node(index); -
238 if (n->hasInformation())
partially evaluated: n->hasInformation()
TRUEFALSE
yes
Evaluation Count:494
no
Evaluation Count:0
0-494
239 return n->isDir();
executed: return n->isDir();
Execution Count:494
494
240 return fileInfo(index).isDir();
never executed: return fileInfo(index).isDir();
0
241} -
242 -
243 -
244 -
245 -
246qint64 QFileSystemModel::size(const QModelIndex &index) const -
247{ -
248 const QFileSystemModelPrivate * const d = d_func(); -
249 if (!index.isValid())
never evaluated: !index.isValid()
0
250 return 0;
never executed: return 0;
0
251 return d->node(index)->size();
never executed: return d->node(index)->size();
0
252} -
253 -
254 -
255 -
256 -
257QString QFileSystemModel::type(const QModelIndex &index) const -
258{ -
259 const QFileSystemModelPrivate * const d = d_func(); -
260 if (!index.isValid())
never evaluated: !index.isValid()
0
261 return QString();
never executed: return QString();
0
262 return d->node(index)->type();
never executed: return d->node(index)->type();
0
263} -
264 -
265 -
266 -
267 -
268QDateTime QFileSystemModel::lastModified(const QModelIndex &index) const -
269{ -
270 const QFileSystemModelPrivate * const d = d_func(); -
271 if (!index.isValid())
never evaluated: !index.isValid()
0
272 return QDateTime();
never executed: return QDateTime();
0
273 return d->node(index)->lastModified();
never executed: return d->node(index)->lastModified();
0
274} -
275 -
276 -
277 -
278 -
279QModelIndex QFileSystemModel::parent(const QModelIndex &index) const -
280{ -
281 const QFileSystemModelPrivate * const d = d_func(); -
282 if (!d->indexValid(index))
partially evaluated: !d->indexValid(index)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22519
0-22519
283 return QModelIndex();
never executed: return QModelIndex();
0
284 -
285 QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(index); -
286 qt_noop(); -
287 QFileSystemModelPrivate::QFileSystemNode *parentNode = (indexNode ? indexNode->parent : 0);
partially evaluated: indexNode
TRUEFALSE
yes
Evaluation Count:22519
no
Evaluation Count:0
0-22519
288 if (parentNode == 0 || parentNode == &d->root)
partially evaluated: parentNode == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22519
evaluated: parentNode == &d->root
TRUEFALSE
yes
Evaluation Count:3847
yes
Evaluation Count:18672
0-22519
289 return QModelIndex();
executed: return QModelIndex();
Execution Count:3847
3847
290 -
291 -
292 QFileSystemModelPrivate::QFileSystemNode *grandParentNode = parentNode->parent; -
293 qt_noop(); -
294 int visualRow = d->translateVisibleLocation(grandParentNode, grandParentNode->visibleLocation(grandParentNode->children.value(parentNode->fileName)->fileName)); -
295 if (visualRow == -1)
partially evaluated: visualRow == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18672
0-18672
296 return QModelIndex();
never executed: return QModelIndex();
0
297 return createIndex(visualRow, 0, parentNode);
executed: return createIndex(visualRow, 0, parentNode);
Execution Count:18672
18672
298} -
299 -
300 -
301 -
302 -
303 -
304 -
305QModelIndex QFileSystemModelPrivate::index(const QFileSystemModelPrivate::QFileSystemNode *node) const -
306{ -
307 const QFileSystemModel * const q = q_func(); -
308 QFileSystemModelPrivate::QFileSystemNode *parentNode = (node ? node->parent : 0);
partially evaluated: node
TRUEFALSE
yes
Evaluation Count:7147
no
Evaluation Count:0
0-7147
309 if (node == &root || !parentNode)
evaluated: node == &root
TRUEFALSE
yes
Evaluation Count:1128
yes
Evaluation Count:6019
partially evaluated: !parentNode
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6019
0-6019
310 return QModelIndex();
executed: return QModelIndex();
Execution Count:1128
1128
311 -
312 -
313 qt_noop(); -
314 if (!node->isVisible)
partially evaluated: !node->isVisible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6019
0-6019
315 return QModelIndex();
never executed: return QModelIndex();
0
316 -
317 int visualRow = translateVisibleLocation(parentNode, parentNode->visibleLocation(node->fileName)); -
318 return q->createIndex(visualRow, 0, const_cast<QFileSystemNode*>(node));
executed: return q->createIndex(visualRow, 0, const_cast<QFileSystemNode*>(node));
Execution Count:6019
6019
319} -
320 -
321 -
322 -
323 -
324bool QFileSystemModel::hasChildren(const QModelIndex &parent) const -
325{ -
326 const QFileSystemModelPrivate * const d = d_func(); -
327 if (parent.column() > 0)
partially evaluated: parent.column() > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1025
0-1025
328 return false;
never executed: return false;
0
329 -
330 if (!parent.isValid())
evaluated: !parent.isValid()
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:983
42-983
331 return true;
executed: return true;
Execution Count:42
42
332 -
333 const QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(parent); -
334 qt_noop(); -
335 return (indexNode->isDir());
executed: return (indexNode->isDir());
Execution Count:983
983
336} -
337 -
338 -
339 -
340 -
341bool QFileSystemModel::canFetchMore(const QModelIndex &parent) const -
342{ -
343 const QFileSystemModelPrivate * const d = d_func(); -
344 const QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(parent); -
345 return (!indexNode->populatedChildren);
executed: return (!indexNode->populatedChildren);
Execution Count:1943
1943
346} -
347 -
348 -
349 -
350 -
351void QFileSystemModel::fetchMore(const QModelIndex &parent) -
352{ -
353 QFileSystemModelPrivate * const d = d_func(); -
354 if (!d->setRootPath)
evaluated: !d->setRootPath
TRUEFALSE
yes
Evaluation Count:1309
yes
Evaluation Count:305
305-1309
355 return;
executed: return;
Execution Count:1309
1309
356 QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(parent); -
357 if (indexNode->populatedChildren)
evaluated: indexNode->populatedChildren
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:303
2-303
358 return;
executed: return;
Execution Count:2
2
359 indexNode->populatedChildren = true; -
360 d->fileInfoGatherer.list(filePath(parent)); -
361}
executed: }
Execution Count:303
303
362 -
363 -
364 -
365 -
366int QFileSystemModel::rowCount(const QModelIndex &parent) const -
367{ -
368 const QFileSystemModelPrivate * const d = d_func(); -
369 if (parent.column() > 0)
partially evaluated: parent.column() > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:28872
0-28872
370 return 0;
never executed: return 0;
0
371 -
372 if (!parent.isValid())
evaluated: !parent.isValid()
TRUEFALSE
yes
Evaluation Count:4512
yes
Evaluation Count:24360
4512-24360
373 return d->root.visibleChildren.count();
executed: return d->root.visibleChildren.count();
Execution Count:4512
4512
374 -
375 const QFileSystemModelPrivate::QFileSystemNode *parentNode = d->node(parent); -
376 return parentNode->visibleChildren.count();
executed: return parentNode->visibleChildren.count();
Execution Count:24360
24360
377} -
378 -
379 -
380 -
381 -
382int QFileSystemModel::columnCount(const QModelIndex &parent) const -
383{ -
384 return (parent.column() > 0) ? 0 : 4;
executed: return (parent.column() > 0) ? 0 : 4;
Execution Count:23602
23602
385} -
386 -
387 -
388 -
389 -
390 -
391 -
392QVariant QFileSystemModel::myComputer(int role) const -
393{ -
394 const QFileSystemModelPrivate * const d = d_func(); -
395 switch (role) { -
396 case Qt::DisplayRole: -
397 return d->myComputer();
executed: return d->myComputer();
Execution Count:181
181
398 case Qt::DecorationRole: -
399 return d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Computer);
executed: return d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Computer);
Execution Count:181
181
400 } -
401 return QVariant();
never executed: return QVariant();
0
402} -
403 -
404 -
405 -
406 -
407QVariant QFileSystemModel::data(const QModelIndex &index, int role) const -
408{ -
409 const QFileSystemModelPrivate * const d = d_func(); -
410 if (!index.isValid() || index.model() != this)
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:543
yes
Evaluation Count:73698
partially evaluated: index.model() != this
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:73698
0-73698
411 return QVariant();
executed: return QVariant();
Execution Count:543
543
412 -
413 switch (role) { -
414 case Qt::EditRole: -
415 case Qt::DisplayRole: -
416 switch (index.column()) { -
417 case 0: return d->displayName(index);
executed: return d->displayName(index);
Execution Count:7328
7328
418 case 1: return d->size(index);
executed: return d->size(index);
Execution Count:917
917
419 case 2: return d->type(index);
executed: return d->type(index);
Execution Count:917
917
420 case 3: return d->time(index);
executed: return d->time(index);
Execution Count:914
914
421 default: -
422 QMessageLogger("dialogs/qfilesystemmodel.cpp", 697, __PRETTY_FUNCTION__).warning("data: invalid display value column %d", index.column()); -
423 break;
never executed: break;
0
424 } -
425 break;
never executed: break;
0
426 case FilePathRole: -
427 return filePath(index);
executed: return filePath(index);
Execution Count:1511
1511
428 case FileNameRole: -
429 return d->name(index);
executed: return d->name(index);
Execution Count:2097
2097
430 case Qt::DecorationRole: -
431 if (index.column() == 0) {
evaluated: index.column() == 0
TRUEFALSE
yes
Evaluation Count:7388
yes
Evaluation Count:2748
2748-7388
432 QIcon icon = d->icon(index); -
433 if (icon.isNull()) {
partially evaluated: icon.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7388
0-7388
434 if (d->node(index)->isDir())
never evaluated: d->node(index)->isDir()
0
435 icon = d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Folder);
never executed: icon = d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Folder);
0
436 else -
437 icon = d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::File);
never executed: icon = d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::File);
0
438 } -
439 return icon;
executed: return icon;
Execution Count:7388
7388
440 } -
441 break;
executed: break;
Execution Count:2748
2748
442 case Qt::TextAlignmentRole: -
443 if (index.column() == 1)
evaluated: index.column() == 1
TRUEFALSE
yes
Evaluation Count:892
yes
Evaluation Count:7698
892-7698
444 return Qt::AlignRight;
executed: return Qt::AlignRight;
Execution Count:892
892
445 break;
executed: break;
Execution Count:7698
7698
446 case FilePermissions: -
447 int p = permissions(index); -
448 return p;
never executed: return p;
0
449 } -
450 -
451 return QVariant();
executed: return QVariant();
Execution Count:51734
51734
452} -
453 -
454 -
455 -
456 -
457QString QFileSystemModelPrivate::size(const QModelIndex &index) const -
458{ -
459 if (!index.isValid())
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:917
0-917
460 return QString();
never executed: return QString();
0
461 const QFileSystemNode *n = node(index); -
462 if (n->isDir()) {
evaluated: n->isDir()
TRUEFALSE
yes
Evaluation Count:575
yes
Evaluation Count:342
342-575
463 -
464 -
465 -
466 return QLatin1String("");
executed: return QLatin1String("");
Execution Count:575
575
467 -
468 -
469 -
470 -
471 -
472 } -
473 return size(n->size());
executed: return size(n->size());
Execution Count:342
342
474} -
475 -
476QString QFileSystemModelPrivate::size(qint64 bytes) -
477{ -
478 -
479 -
480 const qint64 kb = 1024; -
481 const qint64 mb = 1024 * kb; -
482 const qint64 gb = 1024 * mb; -
483 const qint64 tb = 1024 * gb; -
484 if (bytes >= tb)
partially evaluated: bytes >= tb
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:342
0-342
485 return QFileSystemModel::tr("%1 TB").arg(QLocale().toString(qreal(bytes) / tb, 'f', 3));
never executed: return QFileSystemModel::tr("%1 TB").arg(QLocale().toString(qreal(bytes) / tb, 'f', 3));
0
486 if (bytes >= gb)
partially evaluated: bytes >= gb
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:342
0-342
487 return QFileSystemModel::tr("%1 GB").arg(QLocale().toString(qreal(bytes) / gb, 'f', 2));
never executed: return QFileSystemModel::tr("%1 GB").arg(QLocale().toString(qreal(bytes) / gb, 'f', 2));
0
488 if (bytes >= mb)
evaluated: bytes >= mb
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:302
40-302
489 return QFileSystemModel::tr("%1 MB").arg(QLocale().toString(qreal(bytes) / mb, 'f', 1));
executed: return QFileSystemModel::tr("%1 MB").arg(QLocale().toString(qreal(bytes) / mb, 'f', 1));
Execution Count:40
40
490 if (bytes >= kb)
evaluated: bytes >= kb
TRUEFALSE
yes
Evaluation Count:217
yes
Evaluation Count:85
85-217
491 return QFileSystemModel::tr("%1 KB").arg(QLocale().toString(bytes / kb));
executed: return QFileSystemModel::tr("%1 KB").arg(QLocale().toString(bytes / kb));
Execution Count:217
217
492 return QFileSystemModel::tr("%1 bytes").arg(QLocale().toString(bytes));
executed: return QFileSystemModel::tr("%1 bytes").arg(QLocale().toString(bytes));
Execution Count:85
85
493} -
494 -
495 -
496 -
497 -
498QString QFileSystemModelPrivate::time(const QModelIndex &index) const -
499{ -
500 if (!index.isValid())
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:914
0-914
501 return QString();
never executed: return QString();
0
502 -
503 return node(index)->lastModified().toString(Qt::SystemLocaleDate);
executed: return node(index)->lastModified().toString(Qt::SystemLocaleDate);
Execution Count:914
914
504 -
505 -
506 -
507 -
508} -
509 -
510 -
511 -
512 -
513QString QFileSystemModelPrivate::type(const QModelIndex &index) const -
514{ -
515 if (!index.isValid())
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:917
0-917
516 return QString();
never executed: return QString();
0
517 return node(index)->type();
executed: return node(index)->type();
Execution Count:917
917
518} -
519 -
520 -
521 -
522 -
523QString QFileSystemModelPrivate::name(const QModelIndex &index) const -
524{ -
525 if (!index.isValid())
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9425
0-9425
526 return QString();
never executed: return QString();
0
527 QFileSystemNode *dirNode = node(index); -
528 if (dirNode->isSymLink() && fileInfoGatherer.resolveSymlinks()) {
evaluated: dirNode->isSymLink()
TRUEFALSE
yes
Evaluation Count:576
yes
Evaluation Count:8849
partially evaluated: fileInfoGatherer.resolveSymlinks()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:576
0-8849
529 QString fullPath = QDir::fromNativeSeparators(filePath(index)); -
530 if (resolvedSymLinks.contains(fullPath))
never evaluated: resolvedSymLinks.contains(fullPath)
0
531 return resolvedSymLinks[fullPath];
never executed: return resolvedSymLinks[fullPath];
0
532 }
never executed: }
0
533 return dirNode->fileName;
executed: return dirNode->fileName;
Execution Count:9425
9425
534} -
535 -
536 -
537 -
538 -
539QString QFileSystemModelPrivate::displayName(const QModelIndex &index) const -
540{ -
541 -
542 -
543 -
544 -
545 -
546 return name(index);
executed: return name(index);
Execution Count:7328
7328
547} -
548 -
549 -
550 -
551 -
552QIcon QFileSystemModelPrivate::icon(const QModelIndex &index) const -
553{ -
554 if (!index.isValid())
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7388
0-7388
555 return QIcon();
never executed: return QIcon();
0
556 return node(index)->icon();
executed: return node(index)->icon();
Execution Count:7388
7388
557} -
558 -
559 -
560 -
561 -
562bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, int role) -
563{ -
564 QFileSystemModelPrivate * const d = d_func(); -
565 if (!idx.isValid()
partially evaluated: !idx.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
566 || idx.column() != 0
partially evaluated: idx.column() != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
567 || role != Qt::EditRole
partially evaluated: role != Qt::EditRole
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
568 || (flags(idx) & Qt::ItemIsEditable) == 0) {
evaluated: (flags(idx) & Qt::ItemIsEditable) == 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
569 return false;
executed: return false;
Execution Count:1
1
570 } -
571 -
572 QString newName = value.toString(); -
573 QString oldName = idx.data().toString(); -
574 if (newName == idx.data().toString())
partially evaluated: newName == idx.data().toString()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
575 return true;
never executed: return true;
0
576 -
577 if (newName.isEmpty()
partially evaluated: newName.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
578 || newName.contains(QDir::separator())
partially evaluated: newName.contains(QDir::separator())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
579 || !QDir(filePath(parent(idx))).rename(oldName, newName)) {
partially evaluated: !QDir(filePath(parent(idx))).rename(oldName, newName)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
580 -
581 QMessageBox::information(0, QFileSystemModel::tr("Invalid filename"), -
582 QFileSystemModel::tr("<b>The name \"%1\" can not be used.</b><p>Try using another name, with fewer characters or no punctuations marks.") -
583 .arg(newName), -
584 QMessageBox::Ok); -
585 -
586 return false;
never executed: return false;
0
587 } else { -
588 QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(idx); -
589 QFileSystemModelPrivate::QFileSystemNode *parentNode = indexNode->parent; -
590 int visibleLocation = parentNode->visibleLocation(parentNode->children.value(indexNode->fileName)->fileName); -
591 -
592 d->addNode(parentNode, newName,indexNode->info->fileInfo()); -
593 parentNode->visibleChildren.removeAt(visibleLocation); -
594 QFileSystemModelPrivate::QFileSystemNode * oldValue = parentNode->children.value(oldName); -
595 parentNode->children[newName] = oldValue; -
596 QFileInfo info(d->rootDir, newName); -
597 oldValue->fileName = newName; -
598 oldValue->parent = parentNode; -
599 oldValue->populate(d->fileInfoGatherer.getInfo(info)); -
600 oldValue->isVisible = true; -
601 -
602 parentNode->children.remove(oldName); -
603 parentNode->visibleChildren.insert(visibleLocation, newName); -
604 -
605 d->delayedSort(); -
606 fileRenamed(filePath(idx.parent()), oldName, newName); -
607 }
executed: }
Execution Count:1
1
608 return true;
executed: return true;
Execution Count:1
1
609} -
610 -
611 -
612 -
613 -
614QVariant QFileSystemModel::headerData(int section, Qt::Orientation orientation, int role) const -
615{ -
616 switch (role) { -
617 case Qt::DecorationRole: -
618 if (section == 0) {
evaluated: section == 0
TRUEFALSE
yes
Evaluation Count:103
yes
Evaluation Count:218
103-218
619 -
620 -
621 QImage pixmap(16, 1, QImage::Format_Mono); -
622 pixmap.fill(0); -
623 pixmap.setAlphaChannel(pixmap.createAlphaMask()); -
624 return pixmap;
executed: return pixmap;
Execution Count:103
103
625 } -
626 break;
executed: break;
Execution Count:218
218
627 case Qt::TextAlignmentRole: -
628 return Qt::AlignLeft;
executed: return Qt::AlignLeft;
Execution Count:85
85
629 } -
630 -
631 if (orientation != Qt::Horizontal || role != Qt::DisplayRole)
partially evaluated: orientation != Qt::Horizontal
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1651
evaluated: role != Qt::DisplayRole
TRUEFALSE
yes
Evaluation Count:973
yes
Evaluation Count:678
0-1651
632 return QAbstractItemModel::headerData(section, orientation, role);
executed: return QAbstractItemModel::headerData(section, orientation, role);
Execution Count:973
973
633 -
634 QString returnValue; -
635 switch (section) { -
636 case 0: returnValue = tr("Name"); -
637 break;
executed: break;
Execution Count:103
103
638 case 1: returnValue = tr("Size"); -
639 break;
executed: break;
Execution Count:194
194
640 case 2: returnValue = -
641 -
642 -
643 -
644 tr("Type", "All other platforms"); -
645 -
646 break;
executed: break;
Execution Count:192
192
647 -
648 -
649 -
650 -
651 case 3: returnValue = tr("Date Modified"); -
652 break;
executed: break;
Execution Count:189
189
653 default: return QVariant();
never executed: return QVariant();
0
654 } -
655 return returnValue;
executed: return returnValue;
Execution Count:678
678
656} -
657 -
658 -
659 -
660 -
661Qt::ItemFlags QFileSystemModel::flags(const QModelIndex &index) const -
662{ -
663 const QFileSystemModelPrivate * const d = d_func(); -
664 Qt::ItemFlags flags = QAbstractItemModel::flags(index); -
665 if (!index.isValid())
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4768
0-4768
666 return flags;
never executed: return flags;
0
667 -
668 QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(index); -
669 if (d->nameFilterDisables && !d->passNameFilters(indexNode)) {
evaluated: d->nameFilterDisables
TRUEFALSE
yes
Evaluation Count:1789
yes
Evaluation Count:2979
partially evaluated: !d->passNameFilters(indexNode)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1789
0-2979
670 flags &= ~Qt::ItemIsEnabled; -
671 -
672 return flags;
never executed: return flags;
0
673 } -
674 -
675 flags |= Qt::ItemIsDragEnabled; -
676 if (d->readOnly)
evaluated: d->readOnly
TRUEFALSE
yes
Evaluation Count:1787
yes
Evaluation Count:2981
1787-2981
677 return flags;
executed: return flags;
Execution Count:1787
1787
678 if ((index.column() == 0) && indexNode->permissions() & QFile::WriteUser) {
evaluated: (index.column() == 0)
TRUEFALSE
yes
Evaluation Count:2972
yes
Evaluation Count:9
evaluated: indexNode->permissions() & QFile::WriteUser
TRUEFALSE
yes
Evaluation Count:1805
yes
Evaluation Count:1167
9-2972
679 flags |= Qt::ItemIsEditable; -
680 if (indexNode->isDir())
evaluated: indexNode->isDir()
TRUEFALSE
yes
Evaluation Count:1486
yes
Evaluation Count:319
319-1486
681 flags |= Qt::ItemIsDropEnabled;
executed: flags |= Qt::ItemIsDropEnabled;
Execution Count:1486
1486
682 }
executed: }
Execution Count:1805
1805
683 return flags;
executed: return flags;
Execution Count:2981
2981
684} -
685 -
686 -
687 -
688 -
689void QFileSystemModelPrivate::_q_performDelayedSort() -
690{ -
691 QFileSystemModel * const q = q_func(); -
692 q->sort(sortColumn, sortOrder); -
693}
executed: }
Execution Count:134
134
694 -
695static inline QChar getNextChar(const QString &s, int location) -
696{ -
697 return (location < s.length()) ? s.at(location) : QChar();
executed: return (location < s.length()) ? s.at(location) : QChar();
Execution Count:40363
40363
698} -
699int QFileSystemModelPrivate::naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs) -
700{ -
701 for (int l1 = 0, l2 = 0; l1 <= s1.count() && l2 <= s2.count(); ++l1, ++l2) {
evaluated: l1 <= s1.count()
TRUEFALSE
yes
Evaluation Count:17639
yes
Evaluation Count:115
partially evaluated: l2 <= s2.count()
TRUEFALSE
yes
Evaluation Count:17639
no
Evaluation Count:0
0-17639
702 -
703 QChar c1 = getNextChar(s1, l1); -
704 while (c1.isSpace())
partially evaluated: c1.isSpace()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17639
0-17639
705 c1 = getNextChar(s1, ++l1);
never executed: c1 = getNextChar(s1, ++l1);
0
706 QChar c2 = getNextChar(s2, l2); -
707 while (c2.isSpace())
partially evaluated: c2.isSpace()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17639
0-17639
708 c2 = getNextChar(s2, ++l2);
never executed: c2 = getNextChar(s2, ++l2);
0
709 -
710 if (c1.isDigit() && c2.isDigit()) {
evaluated: c1.isDigit()
TRUEFALSE
yes
Evaluation Count:460
yes
Evaluation Count:17179
evaluated: c2.isDigit()
TRUEFALSE
yes
Evaluation Count:432
yes
Evaluation Count:28
28-17179
711 while (c1.digitValue() == 0)
evaluated: c1.digitValue() == 0
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:432
33-432
712 c1 = getNextChar(s1, ++l1);
executed: c1 = getNextChar(s1, ++l1);
Execution Count:33
33
713 while (c2.digitValue() == 0)
evaluated: c2.digitValue() == 0
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:432
30-432
714 c2 = getNextChar(s2, ++l2);
executed: c2 = getNextChar(s2, ++l2);
Execution Count:30
30
715 -
716 int lookAheadLocation1 = l1; -
717 int lookAheadLocation2 = l2; -
718 int currentReturnValue = 0; -
719 -
720 for ( -
721 QChar lookAhead1 = c1, lookAhead2 = c2; -
722 (lookAheadLocation1 <= s1.length() && lookAheadLocation2 <= s2.length());
partially evaluated: lookAheadLocation1 <= s1.length()
TRUEFALSE
yes
Evaluation Count:2943
no
Evaluation Count:0
partially evaluated: lookAheadLocation2 <= s2.length()
TRUEFALSE
yes
Evaluation Count:2943
no
Evaluation Count:0
0-2943
723 lookAhead1 = getNextChar(s1, ++lookAheadLocation1), -
724 lookAhead2 = getNextChar(s2, ++lookAheadLocation2) -
725 ) { -
726 bool is1ADigit = !lookAhead1.isNull() && lookAhead1.isDigit();
evaluated: !lookAhead1.isNull()
TRUEFALSE
yes
Evaluation Count:2745
yes
Evaluation Count:198
evaluated: lookAhead1.isDigit()
TRUEFALSE
yes
Evaluation Count:2519
yes
Evaluation Count:226
198-2745
727 bool is2ADigit = !lookAhead2.isNull() && lookAhead2.isDigit();
evaluated: !lookAhead2.isNull()
TRUEFALSE
yes
Evaluation Count:2737
yes
Evaluation Count:206
evaluated: lookAhead2.isDigit()
TRUEFALSE
yes
Evaluation Count:2522
yes
Evaluation Count:215
206-2737
728 if (!is1ADigit && !is2ADigit)
evaluated: !is1ADigit
TRUEFALSE
yes
Evaluation Count:424
yes
Evaluation Count:2519
evaluated: !is2ADigit
TRUEFALSE
yes
Evaluation Count:413
yes
Evaluation Count:11
11-2519
729 break;
executed: break;
Execution Count:413
413
730 if (!is1ADigit)
evaluated: !is1ADigit
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:2519
11-2519
731 return -1;
executed: return -1;
Execution Count:11
11
732 if (!is2ADigit)
evaluated: !is2ADigit
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2511
8-2511
733 return 1;
executed: return 1;
Execution Count:8
8
734 if (currentReturnValue == 0) {
evaluated: currentReturnValue == 0
TRUEFALSE
yes
Evaluation Count:1129
yes
Evaluation Count:1382
1129-1382
735 if (lookAhead1 < lookAhead2) {
evaluated: lookAhead1 < lookAhead2
TRUEFALSE
yes
Evaluation Count:99
yes
Evaluation Count:1030
99-1030
736 currentReturnValue = -1; -
737 } else if (lookAhead1 > lookAhead2) {
executed: }
Execution Count:99
evaluated: lookAhead1 > lookAhead2
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:962
68-962
738 currentReturnValue = 1; -
739 }
executed: }
Execution Count:68
68
740 } -
741 }
executed: }
Execution Count:2511
2511
742 if (currentReturnValue != 0)
evaluated: currentReturnValue != 0
TRUEFALSE
yes
Evaluation Count:167
yes
Evaluation Count:246
167-246
743 return currentReturnValue;
executed: return currentReturnValue;
Execution Count:167
167
744 }
executed: }
Execution Count:246
246
745 -
746 if (cs == Qt::CaseInsensitive) {
partially evaluated: cs == Qt::CaseInsensitive
TRUEFALSE
yes
Evaluation Count:17453
no
Evaluation Count:0
0-17453
747 if (!c1.isLower()) c1 = c1.toLower();
executed: c1 = c1.toLower();
Execution Count:1574
evaluated: !c1.isLower()
TRUEFALSE
yes
Evaluation Count:1574
yes
Evaluation Count:15879
1574-15879
748 if (!c2.isLower()) c2 = c2.toLower();
executed: c2 = c2.toLower();
Execution Count:1644
evaluated: !c2.isLower()
TRUEFALSE
yes
Evaluation Count:1644
yes
Evaluation Count:15809
1644-15809
749 }
executed: }
Execution Count:17453
17453
750 int r = QString::localeAwareCompare(c1, c2); -
751 if (r < 0)
evaluated: r < 0
TRUEFALSE
yes
Evaluation Count:5036
yes
Evaluation Count:12417
5036-12417
752 return -1;
executed: return -1;
Execution Count:5036
5036
753 if (r > 0)
evaluated: r > 0
TRUEFALSE
yes
Evaluation Count:3047
yes
Evaluation Count:9370
3047-9370
754 return 1;
executed: return 1;
Execution Count:3047
3047
755 }
executed: }
Execution Count:9370
9370
756 -
757 return QString::compare(s1, s2, cs);
executed: return QString::compare(s1, s2, cs);
Execution Count:115
115
758} -
759 -
760 -
761 -
762 -
763 -
764class QFileSystemModelSorter -
765{ -
766public: -
767 inline QFileSystemModelSorter(int column) : sortColumn(column) {}
executed: }
Execution Count:112
112
768 -
769 bool compareNodes(const QFileSystemModelPrivate::QFileSystemNode *l, -
770 const QFileSystemModelPrivate::QFileSystemNode *r) const -
771 { -
772 switch (sortColumn) { -
773 case 0: { -
774 -
775 -
776 bool left = l->isDir(); -
777 bool right = r->isDir(); -
778 if (left ^ right)
evaluated: left ^ right
TRUEFALSE
yes
Evaluation Count:510
yes
Evaluation Count:7528
510-7528
779 return left;
executed: return left;
Execution Count:510
510
780 -
781 return QFileSystemModelPrivate::naturalCompare(l->fileName, 7528
782 r->fileName, Qt::CaseInsensitive) < 0;
executed: return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
Execution Count:7528
7528
783 } -
784 case 1: -
785 { -
786 -
787 bool left = l->isDir(); -
788 bool right = r->isDir(); -
789 if (left ^ right)
evaluated: left ^ right
TRUEFALSE
yes
Evaluation Count:163
yes
Evaluation Count:1241
163-1241
790 return left;
executed: return left;
Execution Count:163
163
791 -
792 qint64 sizeDifference = l->size() - r->size(); -
793 if (sizeDifference == 0)
evaluated: sizeDifference == 0
TRUEFALSE
yes
Evaluation Count:856
yes
Evaluation Count:385
385-856
794 return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
executed: return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
Execution Count:856
856
795 -
796 return sizeDifference < 0;
executed: return sizeDifference < 0;
Execution Count:385
385
797 } -
798 case 2: -
799 { -
800 int compare = QString::localeAwareCompare(l->type(), r->type()); -
801 if (compare == 0)
never evaluated: compare == 0
0
802 return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
never executed: return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
0
803 -
804 return compare < 0;
never executed: return compare < 0;
0
805 } -
806 case 3: -
807 { -
808 if (l->lastModified() == r->lastModified())
never evaluated: l->lastModified() == r->lastModified()
0
809 return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
never executed: return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
0
810 -
811 return l->lastModified() < r->lastModified();
never executed: return l->lastModified() < r->lastModified();
0
812 } -
813 } -
814 qt_noop(); -
815 return false;
never executed: return false;
0
816 } -
817 -
818 bool operator()(const QPair<QFileSystemModelPrivate::QFileSystemNode*, int> &l, -
819 const QPair<QFileSystemModelPrivate::QFileSystemNode*, int> &r) const -
820 { -
821 return compareNodes(l.first, r.first);
executed: return compareNodes(l.first, r.first);
Execution Count:9442
9442
822 } -
823 -
824 -
825private: -
826 int sortColumn; -
827}; -
828 -
829 -
830 -
831 -
832 -
833 -
834void QFileSystemModelPrivate::sortChildren(int column, const QModelIndex &parent) -
835{ -
836 QFileSystemModel * const q = q_func(); -
837 QFileSystemModelPrivate::QFileSystemNode *indexNode = node(parent); -
838 if (indexNode->children.count() == 0)
evaluated: indexNode->children.count() == 0
TRUEFALSE
yes
Evaluation Count:1047
yes
Evaluation Count:112
112-1047
839 return;
executed: return;
Execution Count:1047
1047
840 -
841 QList<QPair<QFileSystemModelPrivate::QFileSystemNode*, int> > values; -
842 QHash<QString, QFileSystemNode *>::const_iterator iterator; -
843 int i = 0; -
844 for(iterator = indexNode->children.constBegin() ; iterator != indexNode->children.constEnd() ; ++iterator) {
evaluated: iterator != indexNode->children.constEnd()
TRUEFALSE
yes
Evaluation Count:1964
yes
Evaluation Count:112
112-1964
845 if (filtersAcceptsNode(iterator.value())) {
evaluated: filtersAcceptsNode(iterator.value())
TRUEFALSE
yes
Evaluation Count:1520
yes
Evaluation Count:444
444-1520
846 values.append(QPair<QFileSystemModelPrivate::QFileSystemNode*, int>((iterator.value()), i)); -
847 } else {
executed: }
Execution Count:1520
1520
848 iterator.value()->isVisible = false; -
849 }
executed: }
Execution Count:444
444
850 i++; -
851 }
executed: }
Execution Count:1964
1964
852 QFileSystemModelSorter ms(column); -
853 std::sort(values.begin(), values.end(), ms); -
854 -
855 indexNode->visibleChildren.clear(); -
856 -
857 indexNode->dirtyChildrenIndex = -1; -
858 for (int i = 0; i < values.count(); ++i) {
evaluated: i < values.count()
TRUEFALSE
yes
Evaluation Count:1520
yes
Evaluation Count:112
112-1520
859 indexNode->visibleChildren.append(values.at(i).first->fileName); -
860 values.at(i).first->isVisible = true; -
861 }
executed: }
Execution Count:1520
1520
862 -
863 if (!disableRecursiveSort) {
evaluated: !disableRecursiveSort
TRUEFALSE
yes
Evaluation Count:85
yes
Evaluation Count:27
27-85
864 for (int i = 0; i < q->rowCount(parent); ++i) {
evaluated: i < q->rowCount(parent)
TRUEFALSE
yes
Evaluation Count:844
yes
Evaluation Count:85
85-844
865 const QModelIndex childIndex = q->index(i, 0, parent); -
866 QFileSystemModelPrivate::QFileSystemNode *indexNode = node(childIndex); -
867 -
868 if (indexNode->isVisible)
partially evaluated: indexNode->isVisible
TRUEFALSE
yes
Evaluation Count:844
no
Evaluation Count:0
0-844
869 sortChildren(column, childIndex);
executed: sortChildren(column, childIndex);
Execution Count:844
844
870 }
executed: }
Execution Count:844
844
871 }
executed: }
Execution Count:85
85
872}
executed: }
Execution Count:112
112
873 -
874 -
875 -
876 -
877void QFileSystemModel::sort(int column, Qt::SortOrder order) -
878{ -
879 QFileSystemModelPrivate * const d = d_func(); -
880 if (d->sortOrder == order && d->sortColumn == column && !d->forceSort)
evaluated: d->sortOrder == order
TRUEFALSE
yes
Evaluation Count:327
yes
Evaluation Count:12
evaluated: d->sortColumn == column
TRUEFALSE
yes
Evaluation Count:325
yes
Evaluation Count:2
evaluated: !d->forceSort
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:311
2-327
881 return;
executed: return;
Execution Count:14
14
882 -
883 layoutAboutToBeChanged(); -
884 QModelIndexList oldList = persistentIndexList(); -
885 QList<QPair<QFileSystemModelPrivate::QFileSystemNode*, int> > oldNodes; -
886 for (int i = 0; i < oldList.count(); ++i) {
evaluated: i < oldList.count()
TRUEFALSE
yes
Evaluation Count:109
yes
Evaluation Count:325
109-325
887 QPair<QFileSystemModelPrivate::QFileSystemNode*, int> pair(d->node(oldList.at(i)), oldList.at(i).column()); -
888 oldNodes.append(pair); -
889 }
executed: }
Execution Count:109
109
890 -
891 if (!(d->sortColumn == column && d->sortOrder != order && !d->forceSort)) {
evaluated: d->sortColumn == column
TRUEFALSE
yes
Evaluation Count:323
yes
Evaluation Count:2
evaluated: d->sortOrder != order
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:311
evaluated: !d->forceSort
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:2
2-323
892 -
893 d->sortChildren(column, index(rootPath())); -
894 d->sortColumn = column; -
895 d->forceSort = false; -
896 }
executed: }
Execution Count:315
315
897 d->sortOrder = order; -
898 -
899 QModelIndexList newList; -
900 for (int i = 0; i < oldNodes.count(); ++i) {
evaluated: i < oldNodes.count()
TRUEFALSE
yes
Evaluation Count:109
yes
Evaluation Count:325
109-325
901 QModelIndex idx = d->index(oldNodes.at(i).first); -
902 idx = idx.sibling(idx.row(), oldNodes.at(i).second); -
903 newList.append(idx); -
904 }
executed: }
Execution Count:109
109
905 changePersistentIndexList(oldList, newList); -
906 layoutChanged(); -
907}
executed: }
Execution Count:325
325
908 -
909 -
910 -
911 -
912 -
913QStringList QFileSystemModel::mimeTypes() const -
914{ -
915 return QStringList(QLatin1String("text/uri-list"));
never executed: return QStringList(QLatin1String("text/uri-list"));
0
916} -
917QMimeData *QFileSystemModel::mimeData(const QModelIndexList &indexes) const -
918{ -
919 QList<QUrl> urls; -
920 QList<QModelIndex>::const_iterator it = indexes.begin(); -
921 for (; it != indexes.end(); ++it)
never evaluated: it != indexes.end()
0
922 if ((*it).column() == 0)
never evaluated: (*it).column() == 0
0
923 urls << QUrl::fromLocalFile(filePath(*it));
never executed: urls << QUrl::fromLocalFile(filePath(*it));
0
924 QMimeData *data = new QMimeData(); -
925 data->setUrls(urls); -
926 return data;
never executed: return data;
0
927} -
928bool QFileSystemModel::dropMimeData(const QMimeData *data, Qt::DropAction action, -
929 int row, int column, const QModelIndex &parent) -
930{ -
931 (void)row;; -
932 (void)column;; -
933 if (!parent.isValid() || isReadOnly())
never evaluated: !parent.isValid()
never evaluated: isReadOnly()
0
934 return false;
never executed: return false;
0
935 -
936 bool success = true; -
937 QString to = filePath(parent) + QDir::separator(); -
938 -
939 QList<QUrl> urls = data->urls(); -
940 QList<QUrl>::const_iterator it = urls.constBegin(); -
941 -
942 switch (action) { -
943 case Qt::CopyAction: -
944 for (; it != urls.constEnd(); ++it) {
never evaluated: it != urls.constEnd()
0
945 QString path = (*it).toLocalFile(); -
946 success = QFile::copy(path, to + QFileInfo(path).fileName()) && success;
never evaluated: QFile::copy(path, to + QFileInfo(path).fileName())
never evaluated: success
0
947 }
never executed: }
0
948 break;
never executed: break;
0
949 case Qt::LinkAction: -
950 for (; it != urls.constEnd(); ++it) {
never evaluated: it != urls.constEnd()
0
951 QString path = (*it).toLocalFile(); -
952 success = QFile::link(path, to + QFileInfo(path).fileName()) && success;
never evaluated: QFile::link(path, to + QFileInfo(path).fileName())
never evaluated: success
0
953 }
never executed: }
0
954 break;
never executed: break;
0
955 case Qt::MoveAction: -
956 for (; it != urls.constEnd(); ++it) {
never evaluated: it != urls.constEnd()
0
957 QString path = (*it).toLocalFile(); -
958 success = QFile::rename(path, to + QFileInfo(path).fileName()) && success;
never evaluated: QFile::rename(path, to + QFileInfo(path).fileName())
never evaluated: success
0
959 }
never executed: }
0
960 break;
never executed: break;
0
961 default: -
962 return false;
never executed: return false;
0
963 } -
964 -
965 return success;
never executed: return success;
0
966} -
967 -
968 -
969 -
970 -
971Qt::DropActions QFileSystemModel::supportedDropActions() const -
972{ -
973 return Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
never executed: return Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
0
974} -
975 -
976 -
977 -
978 -
979 -
980QString QFileSystemModel::filePath(const QModelIndex &index) const -
981{ -
982 const QFileSystemModelPrivate * const d = d_func(); -
983 QString fullPath = d->filePath(index); -
984 QFileSystemModelPrivate::QFileSystemNode *dirNode = d->node(index); -
985 if (dirNode->isSymLink() && d->fileInfoGatherer.resolveSymlinks()
partially evaluated: dirNode->isSymLink()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3447
never evaluated: d->fileInfoGatherer.resolveSymlinks()
0-3447
986 && d->resolvedSymLinks.contains(fullPath)
never evaluated: d->resolvedSymLinks.contains(fullPath)
0
987 && dirNode->isDir()) {
never evaluated: dirNode->isDir()
0
988 QFileInfo resolvedInfo(fullPath); -
989 resolvedInfo = resolvedInfo.canonicalFilePath(); -
990 if (resolvedInfo.exists())
never evaluated: resolvedInfo.exists()
0
991 return resolvedInfo.filePath();
never executed: return resolvedInfo.filePath();
0
992 }
never executed: }
0
993 return fullPath;
executed: return fullPath;
Execution Count:3447
3447
994} -
995 -
996QString QFileSystemModelPrivate::filePath(const QModelIndex &index) const -
997{ -
998 const QFileSystemModel * const q = q_func(); -
999 (void)q;; -
1000 if (!index.isValid())
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:254
yes
Evaluation Count:3193
254-3193
1001 return QString();
executed: return QString();
Execution Count:254
254
1002 qt_noop(); -
1003 -
1004 QStringList path; -
1005 QModelIndex idx = index; -
1006 while (idx.isValid()) {
evaluated: idx.isValid()
TRUEFALSE
yes
Evaluation Count:16127
yes
Evaluation Count:3193
3193-16127
1007 QFileSystemModelPrivate::QFileSystemNode *dirNode = node(idx); -
1008 if (dirNode)
partially evaluated: dirNode
TRUEFALSE
yes
Evaluation Count:16127
no
Evaluation Count:0
0-16127
1009 path.prepend(dirNode->fileName);
executed: path.prepend(dirNode->fileName);
Execution Count:16127
16127
1010 idx = idx.parent(); -
1011 }
executed: }
Execution Count:16127
16127
1012 QString fullPath = QDir::fromNativeSeparators(path.join(QDir::separator())); -
1013 -
1014 if ((fullPath.length() > 2) && fullPath[0] == QLatin1Char('/') && fullPath[1] == QLatin1Char('/'))
evaluated: (fullPath.length() > 2)
TRUEFALSE
yes
Evaluation Count:2878
yes
Evaluation Count:315
partially evaluated: fullPath[0] == QLatin1Char('/')
TRUEFALSE
yes
Evaluation Count:2878
no
Evaluation Count:0
partially evaluated: fullPath[1] == QLatin1Char('/')
TRUEFALSE
yes
Evaluation Count:2878
no
Evaluation Count:0
0-2878
1015 fullPath = fullPath.mid(1);
executed: fullPath = fullPath.mid(1);
Execution Count:2878
2878
1016 -
1017 -
1018 -
1019 -
1020 -
1021 return fullPath;
executed: return fullPath;
Execution Count:3193
3193
1022} -
1023 -
1024 -
1025 -
1026 -
1027QModelIndex QFileSystemModel::mkdir(const QModelIndex &parent, const QString &name) -
1028{ -
1029 QFileSystemModelPrivate * const d = d_func(); -
1030 if (!parent.isValid())
partially evaluated: !parent.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1031 return parent;
never executed: return parent;
0
1032 -
1033 QDir dir(filePath(parent)); -
1034 if (!dir.mkdir(name))
partially evaluated: !dir.mkdir(name)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1035 return QModelIndex();
never executed: return QModelIndex();
0
1036 QFileSystemModelPrivate::QFileSystemNode *parentNode = d->node(parent); -
1037 d->addNode(parentNode, name, QFileInfo()); -
1038 qt_noop(); -
1039 QFileSystemModelPrivate::QFileSystemNode *node = parentNode->children[name]; -
1040 node->populate(d->fileInfoGatherer.getInfo(QFileInfo(dir.absolutePath() + QDir::separator() + name))); -
1041 d->addVisibleFiles(parentNode, QStringList(name)); -
1042 return d->index(node);
executed: return d->index(node);
Execution Count:3
3
1043} -
1044 -
1045 -
1046 -
1047 -
1048QFile::Permissions QFileSystemModel::permissions(const QModelIndex &index) const -
1049{ -
1050 const QFileSystemModelPrivate * const d = d_func(); -
1051 return d->node(index)->permissions();
executed: return d->node(index)->permissions();
Execution Count:6
6
1052} -
1053QModelIndex QFileSystemModel::setRootPath(const QString &newPath) -
1054{ -
1055 QFileSystemModelPrivate * const d = d_func(); -
1056 -
1057 -
1058 -
1059 -
1060 -
1061 -
1062 -
1063 QString longNewPath = newPath; -
1064 -
1065 QDir newPathDir(longNewPath); -
1066 -
1067 if (!newPath.isEmpty()) {
evaluated: !newPath.isEmpty()
TRUEFALSE
yes
Evaluation Count:213
yes
Evaluation Count:2
2-213
1068 longNewPath = QDir::cleanPath(longNewPath); -
1069 newPathDir.setPath(longNewPath); -
1070 }
executed: }
Execution Count:213
213
1071 -
1072 d->setRootPath = true; -
1073 -
1074 -
1075 if (!newPath.isEmpty() && longNewPath.isEmpty())
evaluated: !newPath.isEmpty()
TRUEFALSE
yes
Evaluation Count:213
yes
Evaluation Count:2
partially evaluated: longNewPath.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:213
0-213
1076 return d->index(rootPath());
never executed: return d->index(rootPath());
0
1077 -
1078 if (d->rootDir.path() == longNewPath)
evaluated: d->rootDir.path() == longNewPath
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:214
1-214
1079 return d->index(rootPath());
executed: return d->index(rootPath());
Execution Count:1
1
1080 -
1081 bool showDrives = (longNewPath.isEmpty() || longNewPath == d->myComputer());
evaluated: longNewPath.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:212
partially evaluated: longNewPath == d->myComputer()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:212
0-212
1082 if (!showDrives && !newPathDir.exists())
evaluated: !showDrives
TRUEFALSE
yes
Evaluation Count:212
yes
Evaluation Count:2
evaluated: !newPathDir.exists()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:210
2-212
1083 return d->index(rootPath());
executed: return d->index(rootPath());
Execution Count:2
2
1084 -
1085 -
1086 if (!rootPath().isEmpty() && rootPath() != QLatin1String(".")) {
partially evaluated: !rootPath().isEmpty()
TRUEFALSE
yes
Evaluation Count:212
no
Evaluation Count:0
evaluated: rootPath() != QLatin1String(".")
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:175
0-212
1087 -
1088 d->fileInfoGatherer.removePath(rootPath()); -
1089 -
1090 -
1091 -
1092 d->node(rootPath())->populatedChildren = false; -
1093 }
executed: }
Execution Count:37
37
1094 -
1095 -
1096 d->rootDir = newPathDir; -
1097 QModelIndex newRootIndex; -
1098 if (showDrives) {
evaluated: showDrives
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:210
2-210
1099 -
1100 d->rootDir.setPath(QLatin1String("")); -
1101 } else {
executed: }
Execution Count:2
2
1102 newRootIndex = d->index(newPathDir.path()); -
1103 }
executed: }
Execution Count:210
210
1104 fetchMore(newRootIndex); -
1105 rootPathChanged(longNewPath); -
1106 d->forceSort = true; -
1107 d->delayedSort(); -
1108 return newRootIndex;
executed: return newRootIndex;
Execution Count:212
212
1109} -
1110 -
1111 -
1112 -
1113 -
1114 -
1115 -
1116QString QFileSystemModel::rootPath() const -
1117{ -
1118 const QFileSystemModelPrivate * const d = d_func(); -
1119 return d->rootDir.path();
executed: return d->rootDir.path();
Execution Count:2174
2174
1120} -
1121 -
1122 -
1123 -
1124 -
1125 -
1126 -
1127QDir QFileSystemModel::rootDirectory() const -
1128{ -
1129 const QFileSystemModelPrivate * const d = d_func(); -
1130 QDir dir(d->rootDir); -
1131 dir.setNameFilters(nameFilters()); -
1132 dir.setFilter(filter()); -
1133 return dir;
executed: return dir;
Execution Count:154
154
1134} -
1135 -
1136 -
1137 -
1138 -
1139void QFileSystemModel::setIconProvider(QFileIconProvider *provider) -
1140{ -
1141 QFileSystemModelPrivate * const d = d_func(); -
1142 d->fileInfoGatherer.setIconProvider(provider); -
1143 d->root.updateIcon(provider, QString()); -
1144}
executed: }
Execution Count:4
4
1145 -
1146 -
1147 -
1148 -
1149QFileIconProvider *QFileSystemModel::iconProvider() const -
1150{ -
1151 const QFileSystemModelPrivate * const d = d_func(); -
1152 return d->fileInfoGatherer.iconProvider();
executed: return d->fileInfoGatherer.iconProvider();
Execution Count:4
4
1153} -
1154void QFileSystemModel::setFilter(QDir::Filters filters) -
1155{ -
1156 QFileSystemModelPrivate * const d = d_func(); -
1157 if (d->filters == filters)
evaluated: d->filters == filters
TRUEFALSE
yes
Evaluation Count:134
yes
Evaluation Count:27
27-134
1158 return;
executed: return;
Execution Count:134
134
1159 d->filters = filters; -
1160 -
1161 setNameFilters(nameFilters()); -
1162 d->forceSort = true; -
1163 d->delayedSort(); -
1164}
executed: }
Execution Count:27
27
1165QDir::Filters QFileSystemModel::filter() const -
1166{ -
1167 const QFileSystemModelPrivate * const d = d_func(); -
1168 return d->filters;
executed: return d->filters;
Execution Count:588
588
1169} -
1170void QFileSystemModel::setResolveSymlinks(bool enable) -
1171{ -
1172 QFileSystemModelPrivate * const d = d_func(); -
1173 d->fileInfoGatherer.setResolveSymlinks(enable); -
1174}
executed: }
Execution Count:2
2
1175 -
1176bool QFileSystemModel::resolveSymlinks() const -
1177{ -
1178 const QFileSystemModelPrivate * const d = d_func(); -
1179 return d->fileInfoGatherer.resolveSymlinks();
never executed: return d->fileInfoGatherer.resolveSymlinks();
0
1180} -
1181void QFileSystemModel::setReadOnly(bool enable) -
1182{ -
1183 QFileSystemModelPrivate * const d = d_func(); -
1184 d->readOnly = enable; -
1185}
executed: }
Execution Count:128
128
1186 -
1187bool QFileSystemModel::isReadOnly() const -
1188{ -
1189 const QFileSystemModelPrivate * const d = d_func(); -
1190 return d->readOnly;
executed: return d->readOnly;
Execution Count:8
8
1191} -
1192 -
1193 -
1194 -
1195 -
1196 -
1197 -
1198 -
1199void QFileSystemModel::setNameFilterDisables(bool enable) -
1200{ -
1201 QFileSystemModelPrivate * const d = d_func(); -
1202 if (d->nameFilterDisables == enable)
partially evaluated: d->nameFilterDisables == enable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:136
0-136
1203 return;
never executed: return;
0
1204 d->nameFilterDisables = enable; -
1205 d->forceSort = true; -
1206 d->delayedSort(); -
1207}
executed: }
Execution Count:136
136
1208 -
1209bool QFileSystemModel::nameFilterDisables() const -
1210{ -
1211 const QFileSystemModelPrivate * const d = d_func(); -
1212 return d->nameFilterDisables;
never executed: return d->nameFilterDisables;
0
1213} -
1214 -
1215 -
1216 -
1217 -
1218void QFileSystemModel::setNameFilters(const QStringList &filters) -
1219{ -
1220 -
1221 -
1222 QFileSystemModelPrivate * const d = d_func(); -
1223 -
1224 if (!d->bypassFilters.isEmpty()) {
evaluated: !d->bypassFilters.isEmpty()
TRUEFALSE
yes
Evaluation Count:170
yes
Evaluation Count:3
3-170
1225 -
1226 d->bypassFilters.clear(); -
1227 -
1228 QPersistentModelIndex root(index(rootPath())); -
1229 QModelIndexList persistantList = persistentIndexList(); -
1230 for (int i = 0; i < persistantList.count(); ++i) {
evaluated: i < persistantList.count()
TRUEFALSE
yes
Evaluation Count:170
yes
Evaluation Count:170
170
1231 QFileSystemModelPrivate::QFileSystemNode *node; -
1232 node = d->node(persistantList.at(i)); -
1233 while (node) {
evaluated: node
TRUEFALSE
yes
Evaluation Count:1635
yes
Evaluation Count:170
170-1635
1234 if (d->bypassFilters.contains(node))
partially evaluated: d->bypassFilters.contains(node)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1635
0-1635
1235 break;
never executed: break;
0
1236 if (node->isDir())
partially evaluated: node->isDir()
TRUEFALSE
yes
Evaluation Count:1635
no
Evaluation Count:0
0-1635
1237 d->bypassFilters[node] = true;
executed: d->bypassFilters[node] = true;
Execution Count:1635
1635
1238 node = node->parent; -
1239 }
executed: }
Execution Count:1635
1635
1240 }
executed: }
Execution Count:170
170
1241 }
executed: }
Execution Count:170
170
1242 -
1243 d->nameFilters.clear(); -
1244 const Qt::CaseSensitivity caseSensitive = -
1245 (filter() & QDir::CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive;
evaluated: (filter() & QDir::CaseSensitive)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:170
3-170
1246 for (int i = 0; i < filters.size(); ++i) {
evaluated: i < filters.size()
TRUEFALSE
yes
Evaluation Count:168
yes
Evaluation Count:173
168-173
1247 d->nameFilters << QRegExp(filters.at(i), caseSensitive, QRegExp::Wildcard); -
1248 }
executed: }
Execution Count:168
168
1249 d->forceSort = true; -
1250 d->delayedSort(); -
1251 -
1252}
executed: }
Execution Count:173
173
1253 -
1254 -
1255 -
1256 -
1257QStringList QFileSystemModel::nameFilters() const -
1258{ -
1259 const QFileSystemModelPrivate * const d = d_func(); -
1260 QStringList filters; -
1261 -
1262 for (int i = 0; i < d->nameFilters.size(); ++i) {
evaluated: i < d->nameFilters.size()
TRUEFALSE
yes
Evaluation Count:161
yes
Evaluation Count:182
161-182
1263 filters << d->nameFilters.at(i).pattern(); -
1264 }
executed: }
Execution Count:161
161
1265 -
1266 return filters;
executed: return filters;
Execution Count:182
182
1267} -
1268 -
1269 -
1270 -
1271 -
1272bool QFileSystemModel::event(QEvent *event) -
1273{ -
1274 QFileSystemModelPrivate * const d = d_func(); -
1275 if (event->type() == QEvent::LanguageChange) {
partially evaluated: event->type() == QEvent::LanguageChange
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:536
0-536
1276 d->root.retranslateStrings(d->fileInfoGatherer.iconProvider(), QString()); -
1277 return true;
never executed: return true;
0
1278 } -
1279 return QAbstractItemModel::event(event);
executed: return QAbstractItemModel::event(event);
Execution Count:536
536
1280} -
1281 -
1282bool QFileSystemModel::rmdir(const QModelIndex &aindex) -
1283{ -
1284 QString path = filePath(aindex); -
1285 QFileSystemModelPrivate * d = const_cast<QFileSystemModelPrivate*>(d_func()); -
1286 d->fileInfoGatherer.removePath(path); -
1287 return QDir().rmdir(path);
never executed: return QDir().rmdir(path);
0
1288} -
1289 -
1290 -
1291 -
1292 -
1293 -
1294 -
1295 -
1296void QFileSystemModelPrivate::_q_directoryChanged(const QString &directory, const QStringList &files) -
1297{ -
1298 QFileSystemModelPrivate::QFileSystemNode *parentNode = node(directory, false); -
1299 if (parentNode->children.count() == 0)
evaluated: parentNode->children.count() == 0
TRUEFALSE
yes
Evaluation Count:73
yes
Evaluation Count:54
54-73
1300 return;
executed: return;
Execution Count:73
73
1301 QStringList toRemove; -
1302 QStringList newFiles = files; -
1303 qSort(newFiles.begin(), newFiles.end()); -
1304 QHash<QString, QFileSystemNode*>::const_iterator i = parentNode->children.constBegin(); -
1305 while (i != parentNode->children.constEnd()) {
evaluated: i != parentNode->children.constEnd()
TRUEFALSE
yes
Evaluation Count:751
yes
Evaluation Count:54
54-751
1306 QStringList::iterator iterator; -
1307 iterator = qBinaryFind(newFiles.begin(), newFiles.end(), -
1308 i.value()->fileName); -
1309 if (iterator == newFiles.end()) {
evaluated: iterator == newFiles.end()
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:722
29-722
1310 toRemove.append(i.value()->fileName); -
1311 }
executed: }
Execution Count:29
29
1312 ++i; -
1313 }
executed: }
Execution Count:751
751
1314 for (int i = 0 ; i < toRemove.count() ; ++i )
evaluated: i < toRemove.count()
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:54
29-54
1315 removeNode(parentNode, toRemove[i]);
executed: removeNode(parentNode, toRemove[i]);
Execution Count:29
29
1316}
executed: }
Execution Count:54
54
1317QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFileSystemNode *parentNode, const QString &fileName, const QFileInfo& info) -
1318{ -
1319 -
1320 QFileSystemModelPrivate::QFileSystemNode *node = new QFileSystemModelPrivate::QFileSystemNode(fileName, parentNode); -
1321 -
1322 node->populate(info); -
1323 parentNode->children.insert(fileName, node); -
1324 return node;
executed: return node;
Execution Count:3557
3557
1325} -
1326void QFileSystemModelPrivate::removeNode(QFileSystemModelPrivate::QFileSystemNode *parentNode, const QString& name) -
1327{ -
1328 QFileSystemModel * const q = q_func(); -
1329 QModelIndex parent = index(parentNode); -
1330 bool indexHidden = isHiddenByFilter(parentNode, parent); -
1331 -
1332 int vLocation = parentNode->visibleLocation(name); -
1333 if (vLocation >= 0 && !indexHidden)
evaluated: vLocation >= 0
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:16
partially evaluated: !indexHidden
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-16
1334 q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation), 13
1335 translateVisibleLocation(parentNode, vLocation));
executed: q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation), translateVisibleLocation(parentNode, vLocation));
Execution Count:13
13
1336 QFileSystemNode * node = parentNode->children.take(name); -
1337 delete node; -
1338 -
1339 if (vLocation >= 0)
evaluated: vLocation >= 0
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:16
13-16
1340 parentNode->visibleChildren.removeAt(vLocation);
executed: parentNode->visibleChildren.removeAt(vLocation);
Execution Count:13
13
1341 if (vLocation >= 0 && !indexHidden)
evaluated: vLocation >= 0
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:16
partially evaluated: !indexHidden
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-16
1342 q->endRemoveRows();
executed: q->endRemoveRows();
Execution Count:13
13
1343}
executed: }
Execution Count:29
29
1344 -
1345 -
1346 -
1347 -
1348 -
1349class QFileSystemModelVisibleFinder -
1350{ -
1351public: -
1352 inline QFileSystemModelVisibleFinder(QFileSystemModelPrivate::QFileSystemNode *node, QFileSystemModelSorter *sorter) : parentNode(node), sorter(sorter) {}
never executed: }
0
1353 -
1354 bool operator()(const QString &, QString r) const -
1355 { -
1356 return sorter->compareNodes(parentNode->children.value(name), parentNode->children.value(r));
never executed: return sorter->compareNodes(parentNode->children.value(name), parentNode->children.value(r));
0
1357 } -
1358 -
1359 QString name; -
1360private: -
1361 QFileSystemModelPrivate::QFileSystemNode *parentNode; -
1362 QFileSystemModelSorter *sorter; -
1363}; -
1364void QFileSystemModelPrivate::addVisibleFiles(QFileSystemNode *parentNode, const QStringList &newFiles) -
1365{ -
1366 QFileSystemModel * const q = q_func(); -
1367 QModelIndex parent = index(parentNode); -
1368 bool indexHidden = isHiddenByFilter(parentNode, parent); -
1369 if (!indexHidden) {
partially evaluated: !indexHidden
TRUEFALSE
yes
Evaluation Count:1720
no
Evaluation Count:0
0-1720
1370 q->beginInsertRows(parent, parentNode->visibleChildren.count() , parentNode->visibleChildren.count() + newFiles.count() - 1); -
1371 }
executed: }
Execution Count:1720
1720
1372 -
1373 if (parentNode->dirtyChildrenIndex == -1)
evaluated: parentNode->dirtyChildrenIndex == -1
TRUEFALSE
yes
Evaluation Count:1621
yes
Evaluation Count:99
99-1621
1374 parentNode->dirtyChildrenIndex = parentNode->visibleChildren.count();
executed: parentNode->dirtyChildrenIndex = parentNode->visibleChildren.count();
Execution Count:1621
1621
1375 -
1376 for (int i = 0; i < newFiles.count(); ++i) {
evaluated: i < newFiles.count()
TRUEFALSE
yes
Evaluation Count:3125
yes
Evaluation Count:1720
1720-3125
1377 parentNode->visibleChildren.append(newFiles.at(i)); -
1378 parentNode->children[newFiles.at(i)]->isVisible = true; -
1379 }
executed: }
Execution Count:3125
3125
1380 if (!indexHidden)
partially evaluated: !indexHidden
TRUEFALSE
yes
Evaluation Count:1720
no
Evaluation Count:0
0-1720
1381 q->endInsertRows();
executed: q->endInsertRows();
Execution Count:1720
1720
1382}
executed: }
Execution Count:1720
1720
1383void QFileSystemModelPrivate::removeVisibleFile(QFileSystemNode *parentNode, int vLocation) -
1384{ -
1385 QFileSystemModel * const q = q_func(); -
1386 if (vLocation == -1)
never evaluated: vLocation == -1
0
1387 return;
never executed: return;
0
1388 QModelIndex parent = index(parentNode); -
1389 bool indexHidden = isHiddenByFilter(parentNode, parent); -
1390 if (!indexHidden)
never evaluated: !indexHidden
0
1391 q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation), 0
1392 translateVisibleLocation(parentNode, vLocation));
never executed: q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation), translateVisibleLocation(parentNode, vLocation));
0
1393 parentNode->children[parentNode->visibleChildren.at(vLocation)]->isVisible = false; -
1394 parentNode->visibleChildren.removeAt(vLocation); -
1395 if (!indexHidden)
never evaluated: !indexHidden
0
1396 q->endRemoveRows();
never executed: q->endRemoveRows();
0
1397}
never executed: }
0
1398 -
1399 -
1400 -
1401 -
1402 -
1403 -
1404 -
1405void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QList<QPair<QString, QFileInfo> > &updates) -
1406{ -
1407 QFileSystemModel * const q = q_func(); -
1408 QVector<QString> rowsToUpdate; -
1409 QStringList newFiles; -
1410 QFileSystemModelPrivate::QFileSystemNode *parentNode = node(path, false); -
1411 QModelIndex parentIndex = index(parentNode); -
1412 for (int i = 0; i < updates.count(); ++i) {
evaluated: i < updates.count()
TRUEFALSE
yes
Evaluation Count:2271
yes
Evaluation Count:148
148-2271
1413 QString fileName = updates.at(i).first; -
1414 qt_noop(); -
1415 QExtendedInformation info = fileInfoGatherer.getInfo(updates.at(i).second); -
1416 bool previouslyHere = parentNode->children.contains(fileName); -
1417 if (!previouslyHere) {
evaluated: !previouslyHere
TRUEFALSE
yes
Evaluation Count:1938
yes
Evaluation Count:333
333-1938
1418 addNode(parentNode, fileName, info.fileInfo()); -
1419 }
executed: }
Execution Count:1938
1938
1420 QFileSystemModelPrivate::QFileSystemNode * node = parentNode->children.value(fileName); -
1421 bool isCaseSensitive = parentNode->caseSensitive(); -
1422 if (isCaseSensitive) {
evaluated: isCaseSensitive
TRUEFALSE
yes
Evaluation Count:2254
yes
Evaluation Count:17
17-2254
1423 if (node->fileName != fileName)
partially evaluated: node->fileName != fileName
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2254
0-2254
1424 continue;
never executed: continue;
0
1425 } else {
executed: }
Execution Count:2254
2254
1426 if (QString::compare(node->fileName,fileName,Qt::CaseInsensitive) != 0)
partially evaluated: QString::compare(node->fileName,fileName,Qt::CaseInsensitive) != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
1427 continue;
never executed: continue;
0
1428 }
executed: }
Execution Count:17
17
1429 if (isCaseSensitive) {
evaluated: isCaseSensitive
TRUEFALSE
yes
Evaluation Count:2254
yes
Evaluation Count:17
17-2254
1430 qt_noop(); -
1431 } else {
executed: }
Execution Count:2254
2254
1432 node->fileName = fileName; -
1433 }
executed: }
Execution Count:17
17
1434 -
1435 if (info.size() == -1 && !info.isSymLink()) {
partially evaluated: info.size() == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2271
never evaluated: !info.isSymLink()
0-2271
1436 removeNode(parentNode, fileName); -
1437 continue;
never executed: continue;
0
1438 } -
1439 if (*node != info ) {
evaluated: *node != info
TRUEFALSE
yes
Evaluation Count:1961
yes
Evaluation Count:310
310-1961
1440 node->populate(info); -
1441 bypassFilters.remove(node); -
1442 -
1443 if (filtersAcceptsNode(node)) {
evaluated: filtersAcceptsNode(node)
TRUEFALSE
yes
Evaluation Count:1530
yes
Evaluation Count:431
431-1530
1444 if (!node->isVisible) {
evaluated: !node->isVisible
TRUEFALSE
yes
Evaluation Count:1507
yes
Evaluation Count:23
23-1507
1445 newFiles.append(fileName); -
1446 } else {
executed: }
Execution Count:1507
1507
1447 rowsToUpdate.append(fileName); -
1448 }
executed: }
Execution Count:23
23
1449 } else { -
1450 if (node->isVisible) {
partially evaluated: node->isVisible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:431
0-431
1451 int visibleLocation = parentNode->visibleLocation(fileName); -
1452 removeVisibleFile(parentNode, visibleLocation); -
1453 } else {
never executed: }
0
1454 -
1455 }
executed: }
Execution Count:431
431
1456 } -
1457 } -
1458 }
executed: }
Execution Count:2271
2271
1459 -
1460 -
1461 qSort(rowsToUpdate.begin(), rowsToUpdate.end()); -
1462 QString min; -
1463 QString max; -
1464 for (int i = 0; i < rowsToUpdate.count(); ++i) {
evaluated: i < rowsToUpdate.count()
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:148
23-148
1465 QString value = rowsToUpdate.at(i); -
1466 max = value; -
1467 min = value; -
1468 int visibleMin = parentNode->visibleLocation(min); -
1469 int visibleMax = parentNode->visibleLocation(max); -
1470 if (visibleMin >= 0
partially evaluated: visibleMin >= 0
TRUEFALSE
yes
Evaluation Count:23
no
Evaluation Count:0
0-23
1471 && visibleMin < parentNode->visibleChildren.count()
partially evaluated: visibleMin < parentNode->visibleChildren.count()
TRUEFALSE
yes
Evaluation Count:23
no
Evaluation Count:0
0-23
1472 && parentNode->visibleChildren.at(visibleMin) == min
partially evaluated: parentNode->visibleChildren.at(visibleMin) == min
TRUEFALSE
yes
Evaluation Count:23
no
Evaluation Count:0
0-23
1473 && visibleMax >= 0) {
partially evaluated: visibleMax >= 0
TRUEFALSE
yes
Evaluation Count:23
no
Evaluation Count:0
0-23
1474 QModelIndex bottom = q->index(translateVisibleLocation(parentNode, visibleMin), 0, parentIndex); -
1475 QModelIndex top = q->index(translateVisibleLocation(parentNode, visibleMax), 3, parentIndex); -
1476 q->dataChanged(bottom, top); -
1477 }
executed: }
Execution Count:23
23
1478 -
1479 -
1480 -
1481 }
executed: }
Execution Count:23
23
1482 -
1483 if (newFiles.count() > 0) {
evaluated: newFiles.count() > 0
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:46
46-102
1484 addVisibleFiles(parentNode, newFiles); -
1485 }
executed: }
Execution Count:102
102
1486 -
1487 if (newFiles.count() > 0 || (sortColumn != 0 && rowsToUpdate.count() > 0)) {
evaluated: newFiles.count() > 0
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:46
partially evaluated: sortColumn != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46
never evaluated: rowsToUpdate.count() > 0
0-102
1488 forceSort = true; -
1489 delayedSort(); -
1490 }
executed: }
Execution Count:102
102
1491}
executed: }
Execution Count:148
148
1492 -
1493 -
1494 -
1495 -
1496void QFileSystemModelPrivate::_q_resolvedName(const QString &fileName, const QString &resolvedName) -
1497{ -
1498 resolvedSymLinks[fileName] = resolvedName; -
1499}
never executed: }
0
1500 -
1501 -
1502 -
1503 -
1504void QFileSystemModelPrivate::init() -
1505{ -
1506 QFileSystemModel * const q = q_func(); -
1507 qRegisterMetaType<QList<QPair<QString,QFileInfo> > >(); -
1508 q->connect(&fileInfoGatherer, "2""newListOfFiles(QString,QStringList)", -
1509 q, "1""_q_directoryChanged(QString,QStringList)"); -
1510 q->connect(&fileInfoGatherer, "2""updates(QString,QList<QPair<QString,QFileInfo> >)", -
1511 q, "1""_q_fileSystemChanged(QString,QList<QPair<QString,QFileInfo> >)"); -
1512 q->connect(&fileInfoGatherer, "2""nameResolved(QString,QString)", -
1513 q, "1""_q_resolvedName(QString,QString)"); -
1514 q->connect(&fileInfoGatherer, "2""directoryLoaded(QString)", -
1515 q, "2""directoryLoaded(QString)"); -
1516 q->connect(&delayedSortTimer, "2""timeout()", q, "1""_q_performDelayedSort()", Qt::QueuedConnection); -
1517 -
1518 roleNames.insertMulti(QFileSystemModel::FileIconRole, QByteArray("fileIcon", sizeof("fileIcon") - 1)); -
1519 roleNames.insert(QFileSystemModel::FilePathRole, QByteArray("filePath", sizeof("filePath") - 1)); -
1520 roleNames.insert(QFileSystemModel::FileNameRole, QByteArray("fileName", sizeof("fileName") - 1)); -
1521 roleNames.insert(QFileSystemModel::FilePermissions, QByteArray("filePermissions", sizeof("filePermissions") - 1)); -
1522}
executed: }
Execution Count:202
202
1523bool QFileSystemModelPrivate::filtersAcceptsNode(const QFileSystemNode *node) const -
1524{ -
1525 -
1526 if (node->parent == &root || bypassFilters.contains(node))
evaluated: node->parent == &root
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:3902
evaluated: bypassFilters.contains(node)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3896
6-3902
1527 return true;
executed: return true;
Execution Count:29
29
1528 -
1529 -
1530 if (!node->hasInformation())
partially evaluated: !node->hasInformation()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3896
0-3896
1531 return false;
never executed: return false;
0
1532 -
1533 const bool filterPermissions = ((filters & QDir::PermissionMask)
evaluated: (filters & QDir::PermissionMask)
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:3884
12-3884
1534 && (filters & QDir::PermissionMask) != QDir::PermissionMask);
partially evaluated: (filters & QDir::PermissionMask) != QDir::PermissionMask
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-12
1535 const bool hideDirs = !(filters & (QDir::Dirs | QDir::AllDirs)); -
1536 const bool hideFiles = !(filters & QDir::Files); -
1537 const bool hideReadable = !(!filterPermissions || (filters & QDir::Readable));
evaluated: !filterPermissions
TRUEFALSE
yes
Evaluation Count:3884
yes
Evaluation Count:12
partially evaluated: (filters & QDir::Readable)
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-3884
1538 const bool hideWritable = !(!filterPermissions || (filters & QDir::Writable));
evaluated: !filterPermissions
TRUEFALSE
yes
Evaluation Count:3884
yes
Evaluation Count:12
partially evaluated: (filters & QDir::Writable)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-3884
1539 const bool hideExecutable = !(!filterPermissions || (filters & QDir::Executable));
evaluated: !filterPermissions
TRUEFALSE
yes
Evaluation Count:3884
yes
Evaluation Count:12
partially evaluated: (filters & QDir::Executable)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-3884
1540 const bool hideHidden = !(filters & QDir::Hidden); -
1541 const bool hideSystem = !(filters & QDir::System); -
1542 const bool hideSymlinks = (filters & QDir::NoSymLinks); -
1543 const bool hideDot = (filters & QDir::NoDot); -
1544 const bool hideDotDot = (filters & QDir::NoDotDot); -
1545 -
1546 -
1547 bool isDot = (node->fileName == QLatin1String(".")); -
1548 bool isDotDot = (node->fileName == QLatin1String("..")); -
1549 if ( (hideHidden && !(isDot || isDotDot) && node->isHidden())
evaluated: hideHidden
TRUEFALSE
yes
Evaluation Count:3438
yes
Evaluation Count:458
evaluated: isDot
TRUEFALSE
yes
Evaluation Count:158
yes
Evaluation Count:3280
evaluated: isDotDot
TRUEFALSE
yes
Evaluation Count:158
yes
Evaluation Count:3122
evaluated: node->isHidden()
TRUEFALSE
yes
Evaluation Count:493
yes
Evaluation Count:2629
158-3438
1550 || (hideSystem && node->isSystem())
evaluated: hideSystem
TRUEFALSE
yes
Evaluation Count:3029
yes
Evaluation Count:374
partially evaluated: node->isSystem()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3029
0-3029
1551 || (hideDirs && node->isDir())
evaluated: hideDirs
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:3375
evaluated: node->isDir()
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:17
11-3375
1552 || (hideFiles && node->isFile())
evaluated: hideFiles
TRUEFALSE
yes
Evaluation Count:78
yes
Evaluation Count:3314
evaluated: node->isFile()
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:46
32-3314
1553 || (hideSymlinks && node->isSymLink())
partially evaluated: hideSymlinks
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3360
never evaluated: node->isSymLink()
0-3360
1554 || (hideReadable && node->isReadable())
partially evaluated: hideReadable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3360
never evaluated: node->isReadable()
0-3360
1555 || (hideWritable && node->isWritable())
evaluated: hideWritable
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3354
evaluated: node->isWritable()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4
2-3354
1556 || (hideExecutable && node->isExecutable())
evaluated: hideExecutable
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3354
evaluated: node->isExecutable()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2-3354
1557 || (hideDot && isDot)
evaluated: hideDot
TRUEFALSE
yes
Evaluation Count:2932
yes
Evaluation Count:424
evaluated: isDot
TRUEFALSE
yes
Evaluation Count:159
yes
Evaluation Count:2773
159-2932
1558 || (hideDotDot && isDotDot))
evaluated: hideDotDot
TRUEFALSE
yes
Evaluation Count:2777
yes
Evaluation Count:420
evaluated: isDotDot
TRUEFALSE
yes
Evaluation Count:159
yes
Evaluation Count:2618
159-2777
1559 return false;
executed: return false;
Execution Count:858
858
1560 -
1561 return nameFilterDisables || passNameFilters(node);
executed: return nameFilterDisables || passNameFilters(node);
Execution Count:3038
3038
1562} -
1563 -
1564 -
1565 -
1566 -
1567 -
1568 -
1569bool QFileSystemModelPrivate::passNameFilters(const QFileSystemNode *node) const -
1570{ -
1571 -
1572 if (nameFilters.isEmpty())
evaluated: nameFilters.isEmpty()
TRUEFALSE
yes
Evaluation Count:1852
yes
Evaluation Count:1500
1500-1852
1573 return true;
executed: return true;
Execution Count:1852
1852
1574 -
1575 -
1576 if (!(node->isDir() && (filters & QDir::AllDirs))) {
evaluated: node->isDir()
TRUEFALSE
yes
Evaluation Count:299
yes
Evaluation Count:1201
evaluated: (filters & QDir::AllDirs)
TRUEFALSE
yes
Evaluation Count:293
yes
Evaluation Count:6
6-1201
1577 for (int i = 0; i < nameFilters.size(); ++i) {
evaluated: i < nameFilters.size()
TRUEFALSE
yes
Evaluation Count:1215
yes
Evaluation Count:17
17-1215
1578 QRegExp copy = nameFilters.at(i); -
1579 if (copy.exactMatch(node->fileName))
evaluated: copy.exactMatch(node->fileName)
TRUEFALSE
yes
Evaluation Count:1190
yes
Evaluation Count:25
25-1190
1580 return true;
executed: return true;
Execution Count:1190
1190
1581 }
executed: }
Execution Count:25
25
1582 return false;
executed: return false;
Execution Count:17
17
1583 } -
1584 -
1585 return true;
executed: return true;
Execution Count:293
293
1586} -
1587 -
1588 -
1589 -
1590 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial