From 55a6522c795df1eefc84f217b88a60e1c05cd161 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 29 Jun 2007 18:14:47 +0200 Subject: [PATCH] Add support for 7-Zip archives --- src/imgarchivesink.cpp | 30 ++++++++++++++++++++++++++++++ src/imgarchivesink.h | 14 ++++++++------ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/imgarchivesink.cpp b/src/imgarchivesink.cpp index 26ded20..90bc6d1 100644 --- a/src/imgarchivesink.cpp +++ b/src/imgarchivesink.cpp @@ -456,6 +456,35 @@ void ImgArchiveSink::autoconfTAR() archinfo.append(inf); } +void ImgArchiveSink::autoconf7Z() +{ + ArchiveTypeInfo inf; + inf.type = SEVENZIP_ARCHIVE; + inf.name = "7-zip"; + inf.extensions.append(".7z"); + inf.extensions.append(".cb7"); + if (which("7z") != QString::null) + { + inf.extractopts.append("7z"); + inf.extractopts.append("x"); + inf.extractopts.append("-y"); + inf.listopts.append("7z"); + inf.listopts.append("l"); + inf.listopts.append("-y"); + inf.reading = true; + } else if (which("7za") != QString::null) + { + inf.extractopts.append("7za"); + inf.extractopts.append("x"); + inf.extractopts.append("-y"); + inf.listopts.append("7za"); + inf.listopts.append("l"); + inf.listopts.append("-y"); + inf.reading = true; + } + archinfo.append(inf); +} + void ImgArchiveSink::autoconfArchivers() { autoconfRAR(); @@ -464,6 +493,7 @@ void ImgArchiveSink::autoconfArchivers() autoconfTARGZ(); autoconfTARBZ2(); autoconfTAR(); + autoconf7Z(); openext = saveext = QString::null; diff --git a/src/imgarchivesink.h b/src/imgarchivesink.h index 334e143..fa4613a 100644 --- a/src/imgarchivesink.h +++ b/src/imgarchivesink.h @@ -35,12 +35,13 @@ namespace QComicBook public: enum ArchiveType { RAR_ARCHIVE = 1, - ZIP_ARCHIVE = 2, - ACE_ARCHIVE = 4, - TARGZ_ARCHIVE = 8, - TARBZ2_ARCHIVE = 16, - TAR_ARCHIVE = 24, - UNKNOWN_ARCHIVE = 2<<31 + ZIP_ARCHIVE, + ACE_ARCHIVE, + TARGZ_ARCHIVE, + TARBZ2_ARCHIVE, + TAR_ARCHIVE, + SEVENZIP_ARCHIVE, + UNKNOWN_ARCHIVE }; struct ArchiveTypeInfo @@ -81,6 +82,7 @@ namespace QComicBook static void autoconfTARGZ(); static void autoconfTARBZ2(); static void autoconfTAR(); + static void autoconf7Z(); //! Determines archive type /*! Determines archive type basing on filename extension. As a last effort, if -- 2.32.0.93.g670b81a890