Changeset View
Changeset View
Standalone View
Standalone View
kerfuffle/jobs.cpp
Show First 20 Lines • Show All 639 Lines • ▼ Show 20 Line(s) | 638 | if (!globalWorkDir.isEmpty()) { | |||
---|---|---|---|---|---|
640 | m_oldWorkingDir = QDir::currentPath(); | 640 | m_oldWorkingDir = QDir::currentPath(); | ||
641 | QDir::setCurrent(globalWorkDir); | 641 | QDir::setCurrent(globalWorkDir); | ||
642 | } | 642 | } | ||
643 | 643 | | |||
644 | // Count total number of entries to be added. | 644 | // Count total number of entries to be added. | ||
645 | uint totalCount = 0; | 645 | uint totalCount = 0; | ||
646 | QElapsedTimer timer; | 646 | QElapsedTimer timer; | ||
647 | timer.start(); | 647 | timer.start(); | ||
648 | foreach (const Archive::Entry* entry, m_entries) { | 648 | for (const Archive::Entry* entry : qAsConst(m_entries)) { | ||
649 | totalCount++; | 649 | totalCount++; | ||
650 | if (QFileInfo(entry->fullPath()).isDir()) { | 650 | if (QFileInfo(entry->fullPath()).isDir()) { | ||
651 | QDirIterator it(entry->fullPath(), QDir::AllEntries | QDir::Readable | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); | 651 | QDirIterator it(entry->fullPath(), QDir::AllEntries | QDir::Readable | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); | ||
652 | while (it.hasNext()) { | 652 | while (it.hasNext()) { | ||
653 | it.next(); | 653 | it.next(); | ||
654 | totalCount++; | 654 | totalCount++; | ||
655 | } | 655 | } | ||
656 | } | 656 | } | ||
657 | } | 657 | } | ||
658 | 658 | | |||
659 | qCDebug(ARK) << "Going to add" << totalCount << "entries, counted in" << timer.elapsed() << "ms"; | 659 | qCDebug(ARK) << "Going to add" << totalCount << "entries, counted in" << timer.elapsed() << "ms"; | ||
660 | 660 | | |||
661 | const QString desc = i18np("Compressing a file", "Compressing %1 files", totalCount); | 661 | const QString desc = i18np("Compressing a file", "Compressing %1 files", totalCount); | ||
662 | emit description(this, desc, qMakePair(i18n("Archive"), archiveInterface()->filename())); | 662 | emit description(this, desc, qMakePair(i18n("Archive"), archiveInterface()->filename())); | ||
663 | 663 | | |||
664 | ReadWriteArchiveInterface *m_writeInterface = | 664 | ReadWriteArchiveInterface *m_writeInterface = | ||
665 | qobject_cast<ReadWriteArchiveInterface*>(archiveInterface()); | 665 | qobject_cast<ReadWriteArchiveInterface*>(archiveInterface()); | ||
666 | 666 | | |||
667 | Q_ASSERT(m_writeInterface); | 667 | Q_ASSERT(m_writeInterface); | ||
668 | 668 | | |||
669 | // The file paths must be relative to GlobalWorkDir. | 669 | // The file paths must be relative to GlobalWorkDir. | ||
670 | foreach (Archive::Entry *entry, m_entries) { | 670 | for (Archive::Entry *entry : qAsConst(m_entries)) { | ||
671 | // #191821: workDir must be used instead of QDir::current() | 671 | // #191821: workDir must be used instead of QDir::current() | ||
672 | // so that symlinks aren't resolved automatically | 672 | // so that symlinks aren't resolved automatically | ||
673 | const QString &fullPath = entry->fullPath(); | 673 | const QString &fullPath = entry->fullPath(); | ||
674 | QString relativePath = workDir.relativeFilePath(fullPath); | 674 | QString relativePath = workDir.relativeFilePath(fullPath); | ||
675 | 675 | | |||
676 | if (fullPath.endsWith(QLatin1Char('/'))) { | 676 | if (fullPath.endsWith(QLatin1Char('/'))) { | ||
677 | relativePath += QLatin1Char('/'); | 677 | relativePath += QLatin1Char('/'); | ||
678 | } | 678 | } | ||
▲ Show 20 Lines • Show All 179 Lines • Show Last 20 Lines |