| 1590 | } |
| 1591 | |
| 1592 | void |
| 1593 | FileGathererThread::gatheringKernel(const FileSystemItemPtr& item) |
| 1594 | { |
| 1595 | if (!item) { |
| 1596 | return; |
| 1597 | } |
| 1598 | QDir dir( item->absoluteFilePath() ); |
| 1599 | FileSystemModelPtr model = _imp->getModel(); |
| 1600 | if (!model) { |
| 1601 | return; |
| 1602 | } |
| 1603 | |
| 1604 | Qt::SortOrder viewOrder = model->sortIndicatorOrder(); |
| 1605 | FileSystemModel::Sections sortSection = (FileSystemModel::Sections)model->sortIndicatorSection(); |
| 1606 | QDir::SortFlags sort; |
| 1607 | switch (sortSection) { |
| 1608 | case FileSystemModel::Name: |
| 1609 | sort = QDir::Name; |
| 1610 | break; |
| 1611 | case FileSystemModel::Size: |
| 1612 | sort = QDir::Size; |
| 1613 | break; |
| 1614 | case FileSystemModel::Type: |
| 1615 | sort = QDir::Type; |
| 1616 | break; |
| 1617 | case FileSystemModel::DateModified: |
| 1618 | sort = QDir::Time; |
| 1619 | break; |
| 1620 | default: |
| 1621 | break; |
| 1622 | } |
| 1623 | sort |= QDir::IgnoreCase; |
| 1624 | sort |= QDir::DirsFirst; |
| 1625 | |
| 1626 | ///All entries in the directory |
| 1627 | QFileInfoList all = dir.entryInfoList(model->filter(), sort); |
| 1628 | |
| 1629 | ///List of all possible file sequences in the directory or directories |
| 1630 | FileSequences sequences; |
| 1631 | int start = 0; |
| 1632 | int end = 0; |
| 1633 | switch (viewOrder) { |
| 1634 | case Qt::AscendingOrder: |
| 1635 | start = 0; |
| 1636 | end = all.size(); |
| 1637 | break; |
| 1638 | case Qt::DescendingOrder: |
| 1639 | start = all.size() - 1; |
| 1640 | end = -1; |
| 1641 | break; |
| 1642 | } |
| 1643 | |
| 1644 | int i = start; |
| 1645 | while (i != end) { |
| 1646 | ///If we must abort we do it now |
| 1647 | if ( _imp->checkForAbort() ) { |
| 1648 | return; |
| 1649 | } |
nothing calls this directly
no test coverage detected