| 714 | |
| 715 | template<typename TFileInfo> |
| 716 | bool QuaZipPrivate::getFileInfoList(QList<TFileInfo> *result) const |
| 717 | { |
| 718 | QuaZipPrivate *fakeThis=const_cast<QuaZipPrivate*>(this); |
| 719 | fakeThis->zipError=UNZ_OK; |
| 720 | if (mode!=QuaZip::mdUnzip) { |
| 721 | qWarning("QuaZip::getFileNameList/getFileInfoList(): " |
| 722 | "ZIP is not open in mdUnzip mode"); |
| 723 | return false; |
| 724 | } |
| 725 | QString currentFile; |
| 726 | if (q->hasCurrentFile()) { |
| 727 | currentFile = q->getCurrentFileName(); |
| 728 | } |
| 729 | if (q->goToFirstFile()) { |
| 730 | do { |
| 731 | bool ok; |
| 732 | result->append(QuaZip_getFileInfo<TFileInfo>(q, &ok)); |
| 733 | if (!ok) |
| 734 | return false; |
| 735 | } while (q->goToNextFile()); |
| 736 | } |
| 737 | if (zipError != UNZ_OK) |
| 738 | return false; |
| 739 | if (currentFile.isEmpty()) { |
| 740 | if (!q->goToFirstFile()) |
| 741 | return false; |
| 742 | } else { |
| 743 | if (!q->setCurrentFile(currentFile)) |
| 744 | return false; |
| 745 | } |
| 746 | return true; |
| 747 | } |
| 748 | |
| 749 | QStringList QuaZip::getFileNameList() const |
| 750 | { |