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:273
273
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:84100
partially evaluated: column < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:84100
partially evaluated: row >= rowCount(parent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:84100
partially evaluated: column >= columnCount(parent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:84100
0-84100
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:82114
yes
Evaluation Count:1986
1986-82114
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:84100
84100
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:1202
yes
Evaluation Count:4092
1202-4092
93 idx = idx.sibling(idx.row(), column);
executed: idx = idx.sibling(idx.row(), column);
Execution Count:1202
1202
94 return idx;
executed: return idx;
Execution Count:5294
5294
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:7663
yes
Evaluation Count:354188
7663-354188
105 return const_cast<QFileSystemNode*>(&root);
executed: return const_cast<QFileSystemNode*>(&root);
Execution Count:7663
7663
106 QFileSystemModelPrivate::QFileSystemNode *indexNode = static_cast<QFileSystemModelPrivate::QFileSystemNode*>(index.internalPointer()); -
107 qt_noop(); -
108 return indexNode;
executed: return indexNode;
Execution Count:354188
354188
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:1069
yes
Evaluation Count:4945
partially evaluated: path == myComputer()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4945
partially evaluated: path.startsWith(QLatin1Char(':'))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4945
0-4945
115 return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
executed: return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
Execution Count:1069
1069
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:2989
yes
Evaluation Count:1956
1956-2989
125 absolutePath = rootDir.absolutePath();
executed: absolutePath = rootDir.absolutePath();
Execution Count:2989
2989
126 else -
127 absolutePath = QDir(longPath).absolutePath();
executed: absolutePath = QDir(longPath).absolutePath();
Execution Count:1956
1956
128 -
129 -
130 QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts); -
131 if ((pathElements.isEmpty())
evaluated: (pathElements.isEmpty())
TRUEFALSE
yes
Evaluation Count:122
yes
Evaluation Count:4823
122-4823
132 -
133 && QDir::fromNativeSeparators(longPath) != QLatin1String("/")
evaluated: QDir::fromNativeSeparators(longPath) != QLatin1String("/")
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:116
6-116
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:4939
no
Evaluation Count:0
0-4939
139 pathElements.prepend(QLatin1String("/"));
executed: pathElements.prepend(QLatin1String("/"));
Execution Count:4939
4939
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:27312
yes
Evaluation Count:4788
4788-27312
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:24804
yes
Evaluation Count:2508
2508-24804
156 if ((parent->children.count() == 0)
partially evaluated: (parent->children.count() == 0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24804
0-24804
157 || (parent->caseSensitive()
evaluated: parent->caseSensitive()
TRUEFALSE
yes
Evaluation Count:20112
yes
Evaluation Count:4692
4692-20112
158 && parent->children.value(element)->fileName != element)
partially evaluated: parent->children.value(element)->fileName != element
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20112
0-20112
159 || (!parent->caseSensitive()
evaluated: !parent->caseSensitive()
TRUEFALSE
yes
Evaluation Count:4692
yes
Evaluation Count:20112
4692-20112
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:4692
0-4692
161 alreadyExisted = false;
never executed: alreadyExisted = false;
0
162 }
executed: }
Execution Count:24804
24804
163 -
164 QFileSystemModelPrivate::QFileSystemNode *node; -
165 if (!alreadyExisted) {
evaluated: !alreadyExisted
TRUEFALSE
yes
Evaluation Count:2508
yes
Evaluation Count:24804
2508-24804
166 -
167 -
168 QFileInfo info(absolutePath); -
169 if (!info.exists())
evaluated: !info.exists()
TRUEFALSE
yes
Evaluation Count:83
yes
Evaluation Count:2425
83-2425
170 return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
executed: return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
Execution Count:83
83
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:2425
2425
175 node = parent->children.value(element); -
176 }
executed: }
Execution Count:24804
24804
177 -
178 qt_noop(); -
179 if (!node->isVisible) {
evaluated: !node->isVisible
TRUEFALSE
yes
Evaluation Count:2493
yes
Evaluation Count:24736
2493-24736
180 -
181 if (alreadyExisted && node->hasInformation() && !fetch)
evaluated: alreadyExisted
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:2425
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-2425
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:2425
no
Evaluation Count:0
0-2425
187 p->bypassFilters[node] = 1;
executed: p->bypassFilters[node] = 1;
Execution Count:2425
2425
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:2425
never evaluated: fetch
0-2425
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:2425
2425
198 parent = node; -
199 }
executed: }
Execution Count:27161
27161
200 -
201 return parent;
executed: return parent;
Execution Count:4788
4788
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:298
yes
Evaluation Count:802
298-802
236 return true;
executed: return true;
Execution Count:298
298
237 QFileSystemModelPrivate::QFileSystemNode *n = d->node(index); -
238 if (n->hasInformation())
partially evaluated: n->hasInformation()
TRUEFALSE
yes
Evaluation Count:802
no
Evaluation Count:0
0-802
239 return n->isDir();
executed: return n->isDir();
Execution Count:802
802
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:36156
0-36156
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:36156
no
Evaluation Count:0
0-36156
288 if (parentNode == 0 || parentNode == &d->root)
partially evaluated: parentNode == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36156
evaluated: parentNode == &d->root
TRUEFALSE
yes
Evaluation Count:5601
yes
Evaluation Count:30555
0-36156
289 return QModelIndex();
executed: return QModelIndex();
Execution Count:5601
5601
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:30555
0-30555
296 return QModelIndex();
never executed: return QModelIndex();
0
297 return createIndex(visualRow, 0, parentNode);
executed: return createIndex(visualRow, 0, parentNode);
Execution Count:30555
30555
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:11020
no
Evaluation Count:0
0-11020
309 if (node == &root || !parentNode)
evaluated: node == &root
TRUEFALSE
yes
Evaluation Count:1722
yes
Evaluation Count:9298
partially evaluated: !parentNode
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9298
0-9298
310 return QModelIndex();
executed: return QModelIndex();
Execution Count:1722
1722
311 -
312 -
313 qt_noop(); -
314 if (!node->isVisible)
partially evaluated: !node->isVisible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9298
0-9298
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:9298
9298
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:5109
0-5109
328 return false;
never executed: return false;
0
329 -
330 if (!parent.isValid())
evaluated: !parent.isValid()
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:5069
40-5069
331 return true;
executed: return true;
Execution Count:40
40
332 -
333 const QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(parent); -
334 qt_noop(); -
335 return (indexNode->isDir());
executed: return (indexNode->isDir());
Execution Count:5069
5069
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:3094
3094
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:2079
yes
Evaluation Count:414
414-2079
355 return;
executed: return;
Execution Count:2079
2079
356 QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(parent); -
357 if (indexNode->populatedChildren)
evaluated: indexNode->populatedChildren
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:412
2-412
358 return;
executed: return;
Execution Count:2
2
359 indexNode->populatedChildren = true; -
360 d->fileInfoGatherer.list(filePath(parent)); -
361}
executed: }
Execution Count:412
412
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:105875
0-105875
370 return 0;
never executed: return 0;
0
371 -
372 if (!parent.isValid())
evaluated: !parent.isValid()
TRUEFALSE
yes
Evaluation Count:6710
yes
Evaluation Count:99165
6710-99165
373 return d->root.visibleChildren.count();
executed: return d->root.visibleChildren.count();
Execution Count:6710
6710
374 -
375 const QFileSystemModelPrivate::QFileSystemNode *parentNode = d->node(parent); -
376 return parentNode->visibleChildren.count();
executed: return parentNode->visibleChildren.count();
Execution Count:99165
99165
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:95951
95951
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:298
298
398 case Qt::DecorationRole: -
399 return d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Computer);
executed: return d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Computer);
Execution Count:298
298
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:893
yes
Evaluation Count:255359
partially evaluated: index.model() != this
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:255359
0-255359
411 return QVariant();
executed: return QVariant();
Execution Count:893
893
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:31228
31228
418 case 1: return d->size(index);
executed: return d->size(index);
Execution Count:1040
1040
419 case 2: return d->type(index);
executed: return d->type(index);
Execution Count:1040
1040
420 case 3: return d->time(index);
executed: return d->time(index);
Execution Count:1037
1037
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:2509
2509
428 case FileNameRole: -
429 return d->name(index);
executed: return d->name(index);
Execution Count:3717
3717
430 case Qt::DecorationRole: -
431 if (index.column() == 0) {
evaluated: index.column() == 0
TRUEFALSE
yes
Evaluation Count:31376
yes
Evaluation Count:3117
3117-31376
432 QIcon icon = d->icon(index); -
433 if (icon.isNull()) {
partially evaluated: icon.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31376
0-31376
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:31376
31376
440 } -
441 break;
executed: break;
Execution Count:3117
3117
442 case Qt::TextAlignmentRole: -
443 if (index.column() == 1)
evaluated: index.column() == 1
TRUEFALSE
yes
Evaluation Count:1001
yes
Evaluation Count:27588
1001-27588
444 return Qt::AlignRight;
executed: return Qt::AlignRight;
Execution Count:1001
1001
445 break;
executed: break;
Execution Count:27588
27588
446 case FilePermissions: -
447 int p = permissions(index); -
448 return p;
executed: return p;
Execution Count:3
3
449 } -
450 -
451 return QVariant();
executed: return QVariant();
Execution Count:182408
182408
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:1040
0-1040
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:555
yes
Evaluation Count:485
485-555
463 -
464 -
465 -
466 return QLatin1String("");
executed: return QLatin1String("");
Execution Count:555
555
467 -
468 -
469 -
470 -
471 -
472 } -
473 return size(n->size());
executed: return size(n->size());
Execution Count:485
485
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:485
0-485
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:485
0-485
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:65
yes
Evaluation Count:420
65-420
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:65
65
490 if (bytes >= kb)
evaluated: bytes >= kb
TRUEFALSE
yes
Evaluation Count:303
yes
Evaluation Count:117
117-303
491 return QFileSystemModel::tr("%1 KB").arg(QLocale().toString(bytes / kb));
executed: return QFileSystemModel::tr("%1 KB").arg(QLocale().toString(bytes / kb));
Execution Count:303
303
492 return QFileSystemModel::tr("%1 bytes").arg(QLocale().toString(bytes));
executed: return QFileSystemModel::tr("%1 bytes").arg(QLocale().toString(bytes));
Execution Count:117
117
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:1037
0-1037
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:1037
1037
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:1040
0-1040
516 return QString();
never executed: return QString();
0
517 return node(index)->type();
executed: return node(index)->type();
Execution Count:1040
1040
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:34945
0-34945
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:593
yes
Evaluation Count:34352
partially evaluated: fileInfoGatherer.resolveSymlinks()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:593
0-34352
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:34945
34945
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:31228
31228
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:31376
0-31376
555 return QIcon();
never executed: return QIcon();
0
556 return node(index)->icon();
executed: return node(index)->icon();
Execution Count:31376
31376
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:136
yes
Evaluation Count:305
136-305
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:136
136
625 } -
626 break;
executed: break;
Execution Count:305
305
627 case Qt::TextAlignmentRole: -
628 return Qt::AlignLeft;
executed: return Qt::AlignLeft;
Execution Count:123
123
629 } -
630 -
631 if (orientation != Qt::Horizontal || role != Qt::DisplayRole)
partially evaluated: orientation != Qt::Horizontal
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2348
evaluated: role != Qt::DisplayRole
TRUEFALSE
yes
Evaluation Count:1340
yes
Evaluation Count:1008
0-2348
632 return QAbstractItemModel::headerData(section, orientation, role);
executed: return QAbstractItemModel::headerData(section, orientation, role);
Execution Count:1340
1340
633 -
634 QString returnValue; -
635 switch (section) { -
636 case 0: returnValue = tr("Name"); -
637 break;
executed: break;
Execution Count:136
136
638 case 1: returnValue = tr("Size"); -
639 break;
executed: break;
Execution Count:293
293
640 case 2: returnValue = -
641 -
642 -
643 -
644 tr("Type", "All other platforms"); -
645 -
646 break;
executed: break;
Execution Count:291
291
647 -
648 -
649 -
650 -
651 case 3: returnValue = tr("Date Modified"); -
652 break;
executed: break;
Execution Count:288
288
653 default: return QVariant();
never executed: return QVariant();
0
654 } -
655 return returnValue;
executed: return returnValue;
Execution Count:1008
1008
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())
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:7030
1-7030
666 return flags;
executed: return flags;
Execution Count:1
1
667 -
668 QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(index); -
669 if (d->nameFilterDisables && !d->passNameFilters(indexNode)) {
evaluated: d->nameFilterDisables
TRUEFALSE
yes
Evaluation Count:1455
yes
Evaluation Count:5575
partially evaluated: !d->passNameFilters(indexNode)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1455
0-5575
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:1453
yes
Evaluation Count:5577
1453-5577
677 return flags;
executed: return flags;
Execution Count:1453
1453
678 if ((index.column() == 0) && indexNode->permissions() & QFile::WriteUser) {
evaluated: (index.column() == 0)
TRUEFALSE
yes
Evaluation Count:5249
yes
Evaluation Count:328
evaluated: indexNode->permissions() & QFile::WriteUser
TRUEFALSE
yes
Evaluation Count:3845
yes
Evaluation Count:1404
328-5249
679 flags |= Qt::ItemIsEditable; -
680 if (indexNode->isDir())
evaluated: indexNode->isDir()
TRUEFALSE
yes
Evaluation Count:3339
yes
Evaluation Count:506
506-3339
681 flags |= Qt::ItemIsDropEnabled;
executed: flags |= Qt::ItemIsDropEnabled;
Execution Count:3339
3339
682 }
executed: }
Execution Count:3845
3845
683 return flags;
executed: return flags;
Execution Count:5577
5577
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:164
164
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:1960658
1960658
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:929262
yes
Evaluation Count:2182
partially evaluated: l2 <= s2.count()
TRUEFALSE
yes
Evaluation Count:929262
no
Evaluation Count:0
0-929262
702 -
703 QChar c1 = getNextChar(s1, l1); -
704 while (c1.isSpace())
partially evaluated: c1.isSpace()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:929262
0-929262
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:929262
0-929262
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:52582
yes
Evaluation Count:876680
evaluated: c2.isDigit()
TRUEFALSE
yes
Evaluation Count:41301
yes
Evaluation Count:11281
11281-876680
711 while (c1.digitValue() == 0)
evaluated: c1.digitValue() == 0
TRUEFALSE
yes
Evaluation Count:6536
yes
Evaluation Count:41301
6536-41301
712 c1 = getNextChar(s1, ++l1);
executed: c1 = getNextChar(s1, ++l1);
Execution Count:6536
6536
713 while (c2.digitValue() == 0)
evaluated: c2.digitValue() == 0
TRUEFALSE
yes
Evaluation Count:5798
yes
Evaluation Count:41301
5798-41301
714 c2 = getNextChar(s2, ++l2);
executed: c2 = getNextChar(s2, ++l2);
Execution Count:5798
5798
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:86201
no
Evaluation Count:0
partially evaluated: lookAheadLocation2 <= s2.length()
TRUEFALSE
yes
Evaluation Count:86201
no
Evaluation Count:0
0-86201
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:84943
yes
Evaluation Count:1258
evaluated: lookAhead1.isDigit()
TRUEFALSE
yes
Evaluation Count:47665
yes
Evaluation Count:37278
1258-84943
727 bool is2ADigit = !lookAhead2.isNull() && lookAhead2.isDigit();
evaluated: !lookAhead2.isNull()
TRUEFALSE
yes
Evaluation Count:84944
yes
Evaluation Count:1257
evaluated: lookAhead2.isDigit()
TRUEFALSE
yes
Evaluation Count:49455
yes
Evaluation Count:35489
1257-84944
728 if (!is1ADigit && !is2ADigit)
evaluated: !is1ADigit
TRUEFALSE
yes
Evaluation Count:38536
yes
Evaluation Count:47665
evaluated: !is2ADigit
TRUEFALSE
yes
Evaluation Count:33981
yes
Evaluation Count:4555
4555-47665
729 break;
executed: break;
Execution Count:33981
33981
730 if (!is1ADigit)
evaluated: !is1ADigit
TRUEFALSE
yes
Evaluation Count:4555
yes
Evaluation Count:47665
4555-47665
731 return -1;
executed: return -1;
Execution Count:4555
4555
732 if (!is2ADigit)
evaluated: !is2ADigit
TRUEFALSE
yes
Evaluation Count:2765
yes
Evaluation Count:44900
2765-44900
733 return 1;
executed: return 1;
Execution Count:2765
2765
734 if (currentReturnValue == 0) {
evaluated: currentReturnValue == 0
TRUEFALSE
yes
Evaluation Count:40398
yes
Evaluation Count:4502
4502-40398
735 if (lookAhead1 < lookAhead2) {
evaluated: lookAhead1 < lookAhead2
TRUEFALSE
yes
Evaluation Count:8367
yes
Evaluation Count:32031
8367-32031
736 currentReturnValue = -1; -
737 } else if (lookAhead1 > lookAhead2) {
executed: }
Execution Count:8367
evaluated: lookAhead1 > lookAhead2
TRUEFALSE
yes
Evaluation Count:5404
yes
Evaluation Count:26627
5404-26627
738 currentReturnValue = 1; -
739 }
executed: }
Execution Count:5404
5404
740 } -
741 }
executed: }
Execution Count:44900
44900
742 if (currentReturnValue != 0)
evaluated: currentReturnValue != 0
TRUEFALSE
yes
Evaluation Count:9797
yes
Evaluation Count:24184
9797-24184
743 return currentReturnValue;
executed: return currentReturnValue;
Execution Count:9797
9797
744 }
executed: }
Execution Count:24184
24184
745 -
746 if (cs == Qt::CaseInsensitive) {
partially evaluated: cs == Qt::CaseInsensitive
TRUEFALSE
yes
Evaluation Count:912145
no
Evaluation Count:0
0-912145
747 if (!c1.isLower()) c1 = c1.toLower();
executed: c1 = c1.toLower();
Execution Count:121968
evaluated: !c1.isLower()
TRUEFALSE
yes
Evaluation Count:121968
yes
Evaluation Count:790177
121968-790177
748 if (!c2.isLower()) c2 = c2.toLower();
executed: c2 = c2.toLower();
Execution Count:117351
evaluated: !c2.isLower()
TRUEFALSE
yes
Evaluation Count:117351
yes
Evaluation Count:794794
117351-794794
749 }
executed: }
Execution Count:912145
912145
750 int r = QString::localeAwareCompare(c1, c2); -
751 if (r < 0)
evaluated: r < 0
TRUEFALSE
yes
Evaluation Count:123786
yes
Evaluation Count:788359
123786-788359
752 return -1;
executed: return -1;
Execution Count:123786
123786
753 if (r > 0)
evaluated: r > 0
TRUEFALSE
yes
Evaluation Count:74874
yes
Evaluation Count:713485
74874-713485
754 return 1;
executed: return 1;
Execution Count:74874
74874
755 }
executed: }
Execution Count:713485
713485
756 -
757 return QString::compare(s1, s2, cs);
executed: return QString::compare(s1, s2, cs);
Execution Count:2182
2182
758} -
759 -
760 -
761 -
762 -
763 -
764class QFileSystemModelSorter -
765{ -
766public: -
767 inline QFileSystemModelSorter(int column) : sortColumn(column) {}
executed: }
Execution Count:152
152
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:3656
yes
Evaluation Count:194311
3656-194311
779 return left;
executed: return left;
Execution Count:3656
3656
780 -
781 return QFileSystemModelPrivate::naturalCompare(l->fileName, 194311
782 r->fileName, Qt::CaseInsensitive) < 0;
executed: return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
Execution Count:194311
194311
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:587
yes
Evaluation Count:47695
587-47695
790 return left;
executed: return left;
Execution Count:587
587
791 -
792 qint64 sizeDifference = l->size() - r->size(); -
793 if (sizeDifference == 0)
evaluated: sizeDifference == 0
TRUEFALSE
yes
Evaluation Count:23634
yes
Evaluation Count:24061
23634-24061
794 return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
executed: return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
Execution Count:23634
23634
795 -
796 return sizeDifference < 0;
executed: return sizeDifference < 0;
Execution Count:24061
24061
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())
evaluated: l->lastModified() == r->lastModified()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:29
14-29
809 return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
executed: return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0;
Execution Count:14
14
810 -
811 return l->lastModified() < r->lastModified();
executed: return l->lastModified() < r->lastModified();
Execution Count:29
29
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:246292
246292
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:10054
yes
Evaluation Count:152
152-10054
839 return;
executed: return;
Execution Count:10054
10054
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:20395
yes
Evaluation Count:152
152-20395
845 if (filtersAcceptsNode(iterator.value())) {
evaluated: filtersAcceptsNode(iterator.value())
TRUEFALSE
yes
Evaluation Count:19756
yes
Evaluation Count:639
639-19756
846 values.append(QPair<QFileSystemModelPrivate::QFileSystemNode*, int>((iterator.value()), i)); -
847 } else {
executed: }
Execution Count:19756
19756
848 iterator.value()->isVisible = false; -
849 }
executed: }
Execution Count:639
639
850 i++; -
851 }
executed: }
Execution Count:20395
20395
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:19756
yes
Evaluation Count:152
152-19756
859 indexNode->visibleChildren.append(values.at(i).first->fileName); -
860 values.at(i).first->isVisible = true; -
861 }
executed: }
Execution Count:19756
19756
862 -
863 if (!disableRecursiveSort) {
evaluated: !disableRecursiveSort
TRUEFALSE
yes
Evaluation Count:91
yes
Evaluation Count:61
61-91
864 for (int i = 0; i < q->rowCount(parent); ++i) {
evaluated: i < q->rowCount(parent)
TRUEFALSE
yes
Evaluation Count:9742
yes
Evaluation Count:91
91-9742
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:9742
no
Evaluation Count:0
0-9742
869 sortChildren(column, childIndex);
executed: sortChildren(column, childIndex);
Execution Count:9742
9742
870 }
executed: }
Execution Count:9742
9742
871 }
executed: }
Execution Count:91
91
872}
executed: }
Execution Count:152
152
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:471
yes
Evaluation Count:15
evaluated: d->sortColumn == column
TRUEFALSE
yes
Evaluation Count:469
yes
Evaluation Count:2
evaluated: !d->forceSort
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:457
2-471
881 return;
executed: return;
Execution Count:12
12
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:192
yes
Evaluation Count:474
192-474
887 QPair<QFileSystemModelPrivate::QFileSystemNode*, int> pair(d->node(oldList.at(i)), oldList.at(i).column()); -
888 oldNodes.append(pair); -
889 }
executed: }
Execution Count:192
192
890 -
891 if (!(d->sortColumn == column && d->sortOrder != order && !d->forceSort)) {
evaluated: d->sortColumn == column
TRUEFALSE
yes
Evaluation Count:469
yes
Evaluation Count:5
evaluated: d->sortOrder != order
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:457
evaluated: !d->forceSort
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:2
2-469
892 -
893 d->sortChildren(column, index(rootPath())); -
894 d->sortColumn = column; -
895 d->forceSort = false; -
896 }
executed: }
Execution Count:464
464
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:192
yes
Evaluation Count:474
192-474
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:192
192
905 changePersistentIndexList(oldList, newList); -
906 layoutChanged(); -
907}
executed: }
Execution Count:474
474
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:5364
never evaluated: d->fileInfoGatherer.resolveSymlinks()
0-5364
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:5364
5364
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:344
yes
Evaluation Count:5020
344-5020
1001 return QString();
executed: return QString();
Execution Count:344
344
1002 qt_noop(); -
1003 -
1004 QStringList path; -
1005 QModelIndex idx = index; -
1006 while (idx.isValid()) {
evaluated: idx.isValid()
TRUEFALSE
yes
Evaluation Count:27852
yes
Evaluation Count:5020
5020-27852
1007 QFileSystemModelPrivate::QFileSystemNode *dirNode = node(idx); -
1008 if (dirNode)
partially evaluated: dirNode
TRUEFALSE
yes
Evaluation Count:27852
no
Evaluation Count:0
0-27852
1009 path.prepend(dirNode->fileName);
executed: path.prepend(dirNode->fileName);
Execution Count:27852
27852
1010 idx = idx.parent(); -
1011 }
executed: }
Execution Count:27852
27852
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:4597
yes
Evaluation Count:423
partially evaluated: fullPath[0] == QLatin1Char('/')
TRUEFALSE
yes
Evaluation Count:4597
no
Evaluation Count:0
partially evaluated: fullPath[1] == QLatin1Char('/')
TRUEFALSE
yes
Evaluation Count:4597
no
Evaluation Count:0
0-4597
1015 fullPath = fullPath.mid(1);
executed: fullPath = fullPath.mid(1);
Execution Count:4597
4597
1016 -
1017 -
1018 -
1019 -
1020 -
1021 return fullPath;
executed: return fullPath;
Execution Count:5020
5020
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:9
9
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:298
yes
Evaluation Count:3
3-298
1068 longNewPath = QDir::cleanPath(longNewPath); -
1069 newPathDir.setPath(longNewPath); -
1070 }
executed: }
Execution Count:298
298
1071 -
1072 d->setRootPath = true; -
1073 -
1074 -
1075 if (!newPath.isEmpty() && longNewPath.isEmpty())
evaluated: !newPath.isEmpty()
TRUEFALSE
yes
Evaluation Count:298
yes
Evaluation Count:3
partially evaluated: longNewPath.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:298
0-298
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:300
1-300
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:3
yes
Evaluation Count:297
partially evaluated: longNewPath == d->myComputer()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:297
0-297
1082 if (!showDrives && !newPathDir.exists())
evaluated: !showDrives
TRUEFALSE
yes
Evaluation Count:297
yes
Evaluation Count:3
evaluated: !newPathDir.exists()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:295
2-297
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:298
no
Evaluation Count:0
evaluated: rootPath() != QLatin1String(".")
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:246
0-298
1087 -
1088 d->fileInfoGatherer.removePath(rootPath()); -
1089 -
1090 -
1091 -
1092 d->node(rootPath())->populatedChildren = false; -
1093 }
executed: }
Execution Count:52
52
1094 -
1095 -
1096 d->rootDir = newPathDir; -
1097 QModelIndex newRootIndex; -
1098 if (showDrives) {
evaluated: showDrives
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:295
3-295
1099 -
1100 d->rootDir.setPath(QLatin1String("")); -
1101 } else {
executed: }
Execution Count:3
3
1102 newRootIndex = d->index(newPathDir.path()); -
1103 }
executed: }
Execution Count:295
295
1104 fetchMore(newRootIndex); -
1105 rootPathChanged(longNewPath); -
1106 d->forceSort = true; -
1107 d->delayedSort(); -
1108 return newRootIndex;
executed: return newRootIndex;
Execution Count:298
298
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:3182
3182
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:240
240
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:211
yes
Evaluation Count:33
33-211
1158 return;
executed: return;
Execution Count:211
211
1159 d->filters = filters; -
1160 -
1161 setNameFilters(nameFilters()); -
1162 d->forceSort = true; -
1163 d->delayedSort(); -
1164}
executed: }
Execution Count:33
33
1165QDir::Filters QFileSystemModel::filter() const -
1166{ -
1167 const QFileSystemModelPrivate * const d = d_func(); -
1168 return d->filters;
executed: return d->filters;
Execution Count:917
917
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:200
200
1186 -
1187bool QFileSystemModel::isReadOnly() const -
1188{ -
1189 const QFileSystemModelPrivate * const d = d_func(); -
1190 return d->readOnly;
executed: return d->readOnly;
Execution Count:11
11
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:206
0-206
1203 return;
never executed: return;
0
1204 d->nameFilterDisables = enable; -
1205 d->forceSort = true; -
1206 d->delayedSort(); -
1207}
executed: }
Execution Count:206
206
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:261
yes
Evaluation Count:3
3-261
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:261
yes
Evaluation Count:261
261
1231 QFileSystemModelPrivate::QFileSystemNode *node; -
1232 node = d->node(persistantList.at(i)); -
1233 while (node) {
evaluated: node
TRUEFALSE
yes
Evaluation Count:2614
yes
Evaluation Count:261
261-2614
1234 if (d->bypassFilters.contains(node))
partially evaluated: d->bypassFilters.contains(node)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2614
0-2614
1235 break;
never executed: break;
0
1236 if (node->isDir())
partially evaluated: node->isDir()
TRUEFALSE
yes
Evaluation Count:2614
no
Evaluation Count:0
0-2614
1237 d->bypassFilters[node] = true;
executed: d->bypassFilters[node] = true;
Execution Count:2614
2614
1238 node = node->parent; -
1239 }
executed: }
Execution Count:2614
2614
1240 }
executed: }
Execution Count:261
261
1241 }
executed: }
Execution Count:261
261
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:261
3-261
1246 for (int i = 0; i < filters.size(); ++i) {
evaluated: i < filters.size()
TRUEFALSE
yes
Evaluation Count:271
yes
Evaluation Count:264
264-271
1247 d->nameFilters << QRegExp(filters.at(i), caseSensitive, QRegExp::Wildcard); -
1248 }
executed: }
Execution Count:271
271
1249 d->forceSort = true; -
1250 d->delayedSort(); -
1251 -
1252}
executed: }
Execution Count:264
264
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:253
yes
Evaluation Count:274
253-274
1263 filters << d->nameFilters.at(i).pattern(); -
1264 }
executed: }
Execution Count:253
253
1265 -
1266 return filters;
executed: return filters;
Execution Count:274
274
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:698
0-698
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:698
698
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:84
yes
Evaluation Count:80
80-84
1300 return;
executed: return;
Execution Count:84
84
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:5561
yes
Evaluation Count:80
80-5561
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:34
yes
Evaluation Count:5527
34-5527
1310 toRemove.append(i.value()->fileName); -
1311 }
executed: }
Execution Count:34
34
1312 ++i; -
1313 }
executed: }
Execution Count:5561
5561
1314 for (int i = 0 ; i < toRemove.count() ; ++i )
evaluated: i < toRemove.count()
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:80
34-80
1315 removeNode(parentNode, toRemove[i]);
executed: removeNode(parentNode, toRemove[i]);
Execution Count:34
34
1316}
executed: }
Execution Count:80
80
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:24359
24359
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:17
yes
Evaluation Count:17
partially evaluated: !indexHidden
TRUEFALSE
yes
Evaluation Count:17
no
Evaluation Count:0
0-17
1334 q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation), 17
1335 translateVisibleLocation(parentNode, vLocation));
executed: q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation), translateVisibleLocation(parentNode, vLocation));
Execution Count:17
17
1336 QFileSystemNode * node = parentNode->children.take(name); -
1337 delete node; -
1338 -
1339 if (vLocation >= 0)
evaluated: vLocation >= 0
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:17
17
1340 parentNode->visibleChildren.removeAt(vLocation);
executed: parentNode->visibleChildren.removeAt(vLocation);
Execution Count:17
17
1341 if (vLocation >= 0 && !indexHidden)
evaluated: vLocation >= 0
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:17
partially evaluated: !indexHidden
TRUEFALSE
yes
Evaluation Count:17
no
Evaluation Count:0
0-17
1342 q->endRemoveRows();
executed: q->endRemoveRows();
Execution Count:17
17
1343}
executed: }
Execution Count:34
34
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:2567
no
Evaluation Count:0
0-2567
1370 q->beginInsertRows(parent, parentNode->visibleChildren.count() , parentNode->visibleChildren.count() + newFiles.count() - 1); -
1371 }
executed: }
Execution Count:2567
2567
1372 -
1373 if (parentNode->dirtyChildrenIndex == -1)
evaluated: parentNode->dirtyChildrenIndex == -1
TRUEFALSE
yes
Evaluation Count:2439
yes
Evaluation Count:128
128-2439
1374 parentNode->dirtyChildrenIndex = parentNode->visibleChildren.count();
executed: parentNode->dirtyChildrenIndex = parentNode->visibleChildren.count();
Execution Count:2439
2439
1375 -
1376 for (int i = 0; i < newFiles.count(); ++i) {
evaluated: i < newFiles.count()
TRUEFALSE
yes
Evaluation Count:23762
yes
Evaluation Count:2567
2567-23762
1377 parentNode->visibleChildren.append(newFiles.at(i)); -
1378 parentNode->children[newFiles.at(i)]->isVisible = true; -
1379 }
executed: }
Execution Count:23762
23762
1380 if (!indexHidden)
partially evaluated: !indexHidden
TRUEFALSE
yes
Evaluation Count:2567
no
Evaluation Count:0
0-2567
1381 q->endInsertRows();
executed: q->endInsertRows();
Execution Count:2567
2567
1382}
executed: }
Execution Count:2567
2567
1383void QFileSystemModelPrivate::removeVisibleFile(QFileSystemNode *parentNode, int vLocation) -
1384{ -
1385 QFileSystemModel * const q = q_func(); -
1386 if (vLocation == -1)
partially evaluated: vLocation == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1387 return;
never executed: return;
0
1388 QModelIndex parent = index(parentNode); -
1389 bool indexHidden = isHiddenByFilter(parentNode, parent); -
1390 if (!indexHidden)
partially evaluated: !indexHidden
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1391 q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation), 1
1392 translateVisibleLocation(parentNode, vLocation));
executed: q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation), translateVisibleLocation(parentNode, vLocation));
Execution Count:1
1
1393 parentNode->children[parentNode->visibleChildren.at(vLocation)]->isVisible = false; -
1394 parentNode->visibleChildren.removeAt(vLocation); -
1395 if (!indexHidden)
partially evaluated: !indexHidden
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1396 q->endRemoveRows();
executed: q->endRemoveRows();
Execution Count:1
1
1397}
executed: }
Execution Count:1
1
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:25964
yes
Evaluation Count:206
206-25964
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:21930
yes
Evaluation Count:4034
4034-21930
1418 addNode(parentNode, fileName, info.fileInfo()); -
1419 }
executed: }
Execution Count:21930
21930
1420 QFileSystemModelPrivate::QFileSystemNode * node = parentNode->children.value(fileName); -
1421 bool isCaseSensitive = parentNode->caseSensitive(); -
1422 if (isCaseSensitive) {
evaluated: isCaseSensitive
TRUEFALSE
yes
Evaluation Count:25940
yes
Evaluation Count:24
24-25940
1423 if (node->fileName != fileName)
partially evaluated: node->fileName != fileName
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25940
0-25940
1424 continue;
never executed: continue;
0
1425 } else {
executed: }
Execution Count:25940
25940
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:24
0-24
1427 continue;
never executed: continue;
0
1428 }
executed: }
Execution Count:24
24
1429 if (isCaseSensitive) {
evaluated: isCaseSensitive
TRUEFALSE
yes
Evaluation Count:25940
yes
Evaluation Count:24
24-25940
1430 qt_noop(); -
1431 } else {
executed: }
Execution Count:25940
25940
1432 node->fileName = fileName; -
1433 }
executed: }
Execution Count:24
24
1434 -
1435 if (info.size() == -1 && !info.isSymLink()) {
partially evaluated: info.size() == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25964
never evaluated: !info.isSymLink()
0-25964
1436 removeNode(parentNode, fileName); -
1437 continue;
never executed: continue;
0
1438 } -
1439 if (*node != info ) {
evaluated: *node != info
TRUEFALSE
yes
Evaluation Count:21965
yes
Evaluation Count:3999
3999-21965
1440 node->populate(info); -
1441 bypassFilters.remove(node); -
1442 -
1443 if (filtersAcceptsNode(node)) {
evaluated: filtersAcceptsNode(node)
TRUEFALSE
yes
Evaluation Count:21368
yes
Evaluation Count:597
597-21368
1444 if (!node->isVisible) {
evaluated: !node->isVisible
TRUEFALSE
yes
Evaluation Count:21334
yes
Evaluation Count:34
34-21334
1445 newFiles.append(fileName); -
1446 } else {
executed: }
Execution Count:21334
21334
1447 rowsToUpdate.append(fileName); -
1448 }
executed: }
Execution Count:34
34
1449 } else { -
1450 if (node->isVisible) {
evaluated: node->isVisible
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:596
1-596
1451 int visibleLocation = parentNode->visibleLocation(fileName); -
1452 removeVisibleFile(parentNode, visibleLocation); -
1453 } else {
executed: }
Execution Count:1
1
1454 -
1455 }
executed: }
Execution Count:596
596
1456 } -
1457 } -
1458 }
executed: }
Execution Count:25964
25964
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:34
yes
Evaluation Count:206
34-206
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:34
no
Evaluation Count:0
0-34
1471 && visibleMin < parentNode->visibleChildren.count()
partially evaluated: visibleMin < parentNode->visibleChildren.count()
TRUEFALSE
yes
Evaluation Count:34
no
Evaluation Count:0
0-34
1472 && parentNode->visibleChildren.at(visibleMin) == min
partially evaluated: parentNode->visibleChildren.at(visibleMin) == min
TRUEFALSE
yes
Evaluation Count:34
no
Evaluation Count:0
0-34
1473 && visibleMax >= 0) {
partially evaluated: visibleMax >= 0
TRUEFALSE
yes
Evaluation Count:34
no
Evaluation Count:0
0-34
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:34
34
1478 -
1479 -
1480 -
1481 }
executed: }
Execution Count:34
34
1482 -
1483 if (newFiles.count() > 0) {
evaluated: newFiles.count() > 0
TRUEFALSE
yes
Evaluation Count:139
yes
Evaluation Count:67
67-139
1484 addVisibleFiles(parentNode, newFiles); -
1485 }
executed: }
Execution Count:139
139
1486 -
1487 if (newFiles.count() > 0 || (sortColumn != 0 && rowsToUpdate.count() > 0)) {
evaluated: newFiles.count() > 0
TRUEFALSE
yes
Evaluation Count:139
yes
Evaluation Count:67
evaluated: sortColumn != 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:65
evaluated: rowsToUpdate.count() > 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1-139
1488 forceSort = true; -
1489 delayedSort(); -
1490 }
executed: }
Execution Count:140
140
1491}
executed: }
Execution Count:206
206
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:273
273
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:30
yes
Evaluation Count:42330
evaluated: bypassFilters.contains(node)
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:42311
19-42330
1527 return true;
executed: return true;
Execution Count:49
49
1528 -
1529 -
1530 if (!node->hasInformation())
partially evaluated: !node->hasInformation()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:42311
0-42311
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:42299
12-42299
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:42299
yes
Evaluation Count:12
partially evaluated: (filters & QDir::Readable)
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-42299
1538 const bool hideWritable = !(!filterPermissions || (filters & QDir::Writable));
evaluated: !filterPermissions
TRUEFALSE
yes
Evaluation Count:42299
yes
Evaluation Count:12
partially evaluated: (filters & QDir::Writable)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-42299
1539 const bool hideExecutable = !(!filterPermissions || (filters & QDir::Executable));
evaluated: !filterPermissions
TRUEFALSE
yes
Evaluation Count:42299
yes
Evaluation Count:12
partially evaluated: (filters & QDir::Executable)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-42299
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:34676
yes
Evaluation Count:7635
evaluated: isDot
TRUEFALSE
yes
Evaluation Count:214
yes
Evaluation Count:34462
evaluated: isDotDot
TRUEFALSE
yes
Evaluation Count:214
yes
Evaluation Count:34248
evaluated: node->isHidden()
TRUEFALSE
yes
Evaluation Count:709
yes
Evaluation Count:33539
214-34676
1550 || (hideSystem && node->isSystem())
evaluated: hideSystem
TRUEFALSE
yes
Evaluation Count:34059
yes
Evaluation Count:7543
evaluated: node->isSystem()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:34057
2-34059
1551 || (hideDirs && node->isDir())
evaluated: hideDirs
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:41572
evaluated: node->isDir()
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:17
11-41572
1552 || (hideFiles && node->isFile())
evaluated: hideFiles
TRUEFALSE
yes
Evaluation Count:97
yes
Evaluation Count:41492
evaluated: node->isFile()
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:60
37-41492
1553 || (hideSymlinks && node->isSymLink())
partially evaluated: hideSymlinks
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41552
never evaluated: node->isSymLink()
0-41552
1554 || (hideReadable && node->isReadable())
partially evaluated: hideReadable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41552
never evaluated: node->isReadable()
0-41552
1555 || (hideWritable && node->isWritable())
evaluated: hideWritable
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:41546
evaluated: node->isWritable()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4
2-41546
1556 || (hideExecutable && node->isExecutable())
evaluated: hideExecutable
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:41546
evaluated: node->isExecutable()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2-41546
1557 || (hideDot && isDot)
evaluated: hideDot
TRUEFALSE
yes
Evaluation Count:33955
yes
Evaluation Count:7593
evaluated: isDot
TRUEFALSE
yes
Evaluation Count:216
yes
Evaluation Count:33739
216-33955
1558 || (hideDotDot && isDotDot))
evaluated: hideDotDot
TRUEFALSE
yes
Evaluation Count:33743
yes
Evaluation Count:7589
evaluated: isDotDot
TRUEFALSE
yes
Evaluation Count:216
yes
Evaluation Count:33527
216-33743
1559 return false;
executed: return false;
Execution Count:1195
1195
1560 -
1561 return nameFilterDisables || passNameFilters(node);
executed: return nameFilterDisables || passNameFilters(node);
Execution Count:41116
41116
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:1518
yes
Evaluation Count:21792
1518-21792
1573 return true;
executed: return true;
Execution Count:1518
1518
1574 -
1575 -
1576 if (!(node->isDir() && (filters & QDir::AllDirs))) {
evaluated: node->isDir()
TRUEFALSE
yes
Evaluation Count:751
yes
Evaluation Count:21041
evaluated: (filters & QDir::AllDirs)
TRUEFALSE
yes
Evaluation Count:745
yes
Evaluation Count:6
6-21041
1577 for (int i = 0; i < nameFilters.size(); ++i) {
evaluated: i < nameFilters.size()
TRUEFALSE
yes
Evaluation Count:21065
yes
Evaluation Count:41
41-21065
1578 QRegExp copy = nameFilters.at(i); -
1579 if (copy.exactMatch(node->fileName))
evaluated: copy.exactMatch(node->fileName)
TRUEFALSE
yes
Evaluation Count:21006
yes
Evaluation Count:59
59-21006
1580 return true;
executed: return true;
Execution Count:21006
21006
1581 }
executed: }
Execution Count:59
59
1582 return false;
executed: return false;
Execution Count:41
41
1583 } -
1584 -
1585 return true;
executed: return true;
Execution Count:745
745
1586} -
1587 -
1588 -
1589 -
1590 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial