Use a QScopedPointer to keep only one Archive instance alive at a time.
Even though having more than one Archive instance around is harmless, it wastes resources with no purpose. We thus guard the Archive pointer in Part::openFile() with a QScopedPointer so that if one is trying to create an archive whose type is read-only for Ark (ie. .gz files) and then chooses another mimetype, the first created instance is deleted right away, and not when ArchiveModel is destroyed. ArchiveModel::m_archive is now also a QScopedPointer, so that we do not need to manually delete the current archive when ArchiveModel::setArchive() is called.
Showing with 11 additions and 8 deletions