diff --git a/ark/CMakeLists.txt b/ark/CMakeLists.txt index 50e26e18..b725b75d 100644 --- a/ark/CMakeLists.txt +++ b/ark/CMakeLists.txt @@ -21,7 +21,7 @@ endif() include( MacroLibrary ) list(APPEND CMAKE_MODULE_PATH ${ark_SOURCE_DIR}/cmake/modules) -macro_optional_find_package(LibArchive) +macro_optional_find_package(LibArchive 3.0.2) macro_log_feature(LIBARCHIVE_FOUND "LibArchive" "A library for dealing with a wide variety of archive file formats" "http://code.google.com/p/libarchive/" FALSE "" "Required for among others tar, tar.gz, tar.bz2 formats in Ark.") configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) diff --git a/ark/cmake/modules/FindLibArchive.cmake b/ark/cmake/modules/FindLibArchive.cmake index db14d7b2..06b9198f 100644 --- a/ark/cmake/modules/FindLibArchive.cmake +++ b/ark/cmake/modules/FindLibArchive.cmake @@ -31,12 +31,12 @@ else (LIBARCHIVE_LIBRARY AND LIBARCHIVE_INCLUDE_DIR) ) if (LIBARCHIVE_LIBRARY) - check_library_exists(${LIBARCHIVE_LIBRARY} archive_write_set_compression_gzip "" HAVE_LIBARCHIVE_GZIP_SUPPORT) - check_library_exists(${LIBARCHIVE_LIBRARY} archive_write_set_compression_lzma "" HAVE_LIBARCHIVE_LZMA_SUPPORT) - check_library_exists(${LIBARCHIVE_LIBRARY} archive_write_set_compression_xz "" HAVE_LIBARCHIVE_XZ_SUPPORT) - check_library_exists(${LIBARCHIVE_LIBRARY} archive_read_support_compression_rpm "" HAVE_LIBARCHIVE_RPM_SUPPORT) - check_library_exists(${LIBARCHIVE_LIBRARY} archive_read_disk_entry_from_file "" HAVE_LIBARCHIVE_READ_DISK_API) - check_library_exists(${LIBARCHIVE_LIBRARY} archive_read_support_format_cab "" HAVE_LIBARCHIVE_CAB_SUPPORT) + check_library_exists(${LIBARCHIVE_LIBRARY} archive_write_add_filter_gzip "" HAVE_LIBARCHIVE_GZIP_SUPPORT) + check_library_exists(${LIBARCHIVE_LIBRARY} archive_write_add_filter_bzip2 "" HAVE_LIBARCHIVE_BZIP2_SUPPORT) + check_library_exists(${LIBARCHIVE_LIBRARY} archive_write_add_filter_lzma "" HAVE_LIBARCHIVE_LZMA_SUPPORT) + check_library_exists(${LIBARCHIVE_LIBRARY} archive_write_add_filter_xz "" HAVE_LIBARCHIVE_XZ_SUPPORT) + check_library_exists(${LIBARCHIVE_LIBRARY} archive_read_support_filter_rpm "" HAVE_LIBARCHIVE_RPM_SUPPORT) + check_library_exists(${LIBARCHIVE_LIBRARY} archive_read_support_format_cab "" HAVE_LIBARCHIVE_CAB_SUPPORT) endif (LIBARCHIVE_LIBRARY) include(FindPackageHandleStandardArgs) diff --git a/ark/plugins/CMakeLists.txt b/ark/plugins/CMakeLists.txt index 36194128..308ec4d0 100644 --- a/ark/plugins/CMakeLists.txt +++ b/ark/plugins/CMakeLists.txt @@ -1,27 +1,19 @@ if (LIBARCHIVE_FOUND) - if( HAVE_LIBARCHIVE_READ_DISK_API ) - if( NOT HAVE_LIBARCHIVE_LZMA_SUPPORT OR NOT HAVE_LIBARCHIVE_XZ_SUPPORT ) - message(STATUS "Your libarchive does not have support for lzma and/or xz archives. libarchive >= 2.7.0 is recommended.") - endif( NOT HAVE_LIBARCHIVE_LZMA_SUPPORT OR NOT HAVE_LIBARCHIVE_XZ_SUPPORT ) - if( NOT HAVE_LIBARCHIVE_RPM_SUPPORT ) + if( NOT HAVE_LIBARCHIVE_LZMA_SUPPORT OR NOT HAVE_LIBARCHIVE_XZ_SUPPORT ) + message(STATUS "Your libarchive does not have support for lzma and/or xz archives. libarchive >= 2.7.0 is recommended.") + endif( NOT HAVE_LIBARCHIVE_LZMA_SUPPORT OR NOT HAVE_LIBARCHIVE_XZ_SUPPORT ) + if( NOT HAVE_LIBARCHIVE_RPM_SUPPORT ) message(STATUS "Your libarchive does not have support for rpm archives. libarchive >= 2.8.0 is required for this.") - endif( NOT HAVE_LIBARCHIVE_RPM_SUPPORT ) - if( NOT HAVE_LIBARCHIVE_CAB_SUPPORT ) - message(STATUS "Your libarchive does not have support for cab archives. libarchive >= 3.0.0 is required for this.") - endif( NOT HAVE_LIBARCHIVE_CAB_SUPPORT ) - add_subdirectory( libarchive ) - else( HAVE_LIBARCHIVE_READ_DISK_API ) - # Remove the cached variables from FindLibArchive.cmake - unset( LIBARCHIVE_FOUND ) - unset( LIBARCHIVE_INCLUDE_DIR ) - unset( LIBARCHIVE_LIBRARY ) - message(STATUS "Your libarchive does not have support for archive_read_disk api. libarchive >= 2.6.0 is needed.") - endif( HAVE_LIBARCHIVE_READ_DISK_API ) + endif( NOT HAVE_LIBARCHIVE_RPM_SUPPORT ) + if( NOT HAVE_LIBARCHIVE_CAB_SUPPORT ) + message(STATUS "Your libarchive does not have support for cab archives. libarchive >= 3.0.0 is required for this.") + endif( NOT HAVE_LIBARCHIVE_CAB_SUPPORT ) + add_subdirectory( libarchive ) + + # message(STATUS "Your libarchive does not have support for archive_read_disk api. libarchive >= 2.6.0 is needed.") endif (LIBARCHIVE_FOUND) add_subdirectory( clirarplugin ) -add_subdirectory( cli7zplugin ) -add_subdirectory( clizipplugin ) add_subdirectory( libsinglefileplugin ) add_subdirectory( clilhaplugin ) diff --git a/ark/plugins/cli7zplugin/CMakeLists.txt b/ark/plugins/cli7zplugin/CMakeLists.txt deleted file mode 100644 index da56df20..00000000 --- a/ark/plugins/cli7zplugin/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -########### next target ############### - -set(SUPPORTED_CLI7Z_MIMETYPES "application/x-7z-compressed;") - -set(kerfuffle_cli7z_SRCS cliplugin.cpp) - -kde4_add_plugin(kerfuffle_cli7z ${kerfuffle_cli7z_SRCS}) - -target_link_libraries(kerfuffle_cli7z ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} kerfuffle ) - -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/kerfuffle_cli7z.desktop.cmake - ${CMAKE_CURRENT_BINARY_DIR}/kerfuffle_cli7z.desktop -) - -########### install files ############### - -install(TARGETS kerfuffle_cli7z DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kerfuffle_cli7z.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - -set(SUPPORTED_ARK_MIMETYPES "${SUPPORTED_ARK_MIMETYPES}${SUPPORTED_CLI7Z_MIMETYPES}" PARENT_SCOPE) diff --git a/ark/plugins/cli7zplugin/cliplugin.cpp b/ark/plugins/cli7zplugin/cliplugin.cpp deleted file mode 100644 index 500f121d..00000000 --- a/ark/plugins/cli7zplugin/cliplugin.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* - * ark -- archiver for the KDE project - * - * Copyright (C) 2009 Harald Hvaal - * Copyright (C) 2009-2011 Raphael Kubo da Costa - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "cliplugin.h" -#include "kerfuffle/cliinterface.h" -#include "kerfuffle/kerfuffle_export.h" - -#include -#include -#include -#include - -#include - -using namespace Kerfuffle; - -CliPlugin::CliPlugin(QObject *parent, const QVariantList & args) - : CliInterface(parent, args) - , m_archiveType(ArchiveType7z) - , m_state(ReadStateHeader) -{ -} - -CliPlugin::~CliPlugin() -{ -} - -ParameterList CliPlugin::parameterList() const -{ - static ParameterList p; - - if (p.isEmpty()) { - //p[CaptureProgress] = true; - p[ListProgram] = p[ExtractProgram] = p[DeleteProgram] = p[AddProgram] = QStringList() << QLatin1String( "7z" ) << QLatin1String( "7za" ) << QLatin1String( "7zr" ); - - p[ListArgs] = QStringList() << QLatin1String( "l" ) << QLatin1String( "-slt" ) << QLatin1String( "$Archive" ); - p[ExtractArgs] = QStringList() << QLatin1String( "$PreservePathSwitch" ) << QLatin1String( "$PasswordSwitch" ) << QLatin1String( "$Archive" ) << QLatin1String( "$Files" ); - p[PreservePathSwitch] = QStringList() << QLatin1String( "x" ) << QLatin1String( "e" ); - p[PasswordSwitch] = QStringList() << QLatin1String( "-p$Password" ); - p[FileExistsExpression] = QLatin1String( "already exists. Overwrite with" ); - p[WrongPasswordPatterns] = QStringList() << QLatin1String( "Wrong password" ); - p[AddArgs] = QStringList() << QLatin1String( "a" ) << QLatin1String( "$Archive" ) << QLatin1String( "$Files" ); - p[DeleteArgs] = QStringList() << QLatin1String( "d" ) << QLatin1String( "$Archive" ) << QLatin1String( "$Files" ); - - p[FileExistsInput] = QStringList() - << QLatin1String( "Y" ) //overwrite - << QLatin1String( "N" )//skip - << QLatin1String( "A" ) //overwrite all - << QLatin1String( "S" ) //autoskip - << QLatin1String( "Q" ) //cancel - ; - - p[PasswordPromptPattern] = QLatin1String("Enter password \\(will not be echoed\\) :"); - } - - return p; -} - -bool CliPlugin::readListLine(const QString& line) -{ - static const QLatin1String archiveInfoDelimiter1("--"); // 7z 9.13+ - static const QLatin1String archiveInfoDelimiter2("----"); // 7z 9.04 - static const QLatin1String entryInfoDelimiter("----------"); - - switch (m_state) { - case ReadStateHeader: - if (line.startsWith(QLatin1String("Listing archive:"))) { - kDebug() << "Archive name: " - << line.right(line.size() - 16).trimmed(); - } else if ((line == archiveInfoDelimiter1) || - (line == archiveInfoDelimiter2)) { - m_state = ReadStateArchiveInformation; - } else if (line.contains(QLatin1String( "Error:" ))) { - kDebug() << line.mid(6); - } - break; - - case ReadStateArchiveInformation: - if (line == entryInfoDelimiter) { - m_state = ReadStateEntryInformation; - } else if (line.startsWith(QLatin1String("Type ="))) { - const QString type = line.mid(7).trimmed(); - kDebug() << "Archive type: " << type; - - if (type == QLatin1String("7z")) { - m_archiveType = ArchiveType7z; - } else if (type == QLatin1String("BZip2")) { - m_archiveType = ArchiveTypeBZip2; - } else if (type == QLatin1String("GZip")) { - m_archiveType = ArchiveTypeGZip; - } else if (type == QLatin1String("Tar")) { - m_archiveType = ArchiveTypeTar; - } else if (type == QLatin1String("Zip")) { - m_archiveType = ArchiveTypeZip; - } else { - // Should not happen - kWarning() << "Unsupported archive type"; - return false; - } - } - - break; - - case ReadStateEntryInformation: - if (line.startsWith(QLatin1String("Path ="))) { - const QString entryFilename = - QDir::fromNativeSeparators(line.mid(6).trimmed()); - m_currentArchiveEntry.clear(); - m_currentArchiveEntry[FileName] = entryFilename; - m_currentArchiveEntry[InternalID] = entryFilename; - } else if (line.startsWith(QLatin1String("Size = "))) { - m_currentArchiveEntry[ Size ] = line.mid(7).trimmed(); - } else if (line.startsWith(QLatin1String("Packed Size = "))) { - // #236696: 7z files only show a single Packed Size value - // corresponding to the whole archive. - if (m_archiveType != ArchiveType7z) { - m_currentArchiveEntry[CompressedSize] = line.mid(14).trimmed(); - } - } else if (line.startsWith(QLatin1String("Modified = "))) { - m_currentArchiveEntry[ Timestamp ] = - QDateTime::fromString(line.mid(11).trimmed(), - QLatin1String( "yyyy-MM-dd hh:mm:ss" )); - } else if (line.startsWith(QLatin1String("Attributes = "))) { - const QString attributes = line.mid(13).trimmed(); - - const bool isDirectory = attributes.startsWith(QLatin1Char( 'D' )); - m_currentArchiveEntry[ IsDirectory ] = isDirectory; - if (isDirectory) { - const QString directoryName = - m_currentArchiveEntry[FileName].toString(); - if (!directoryName.endsWith(QLatin1Char( '/' ))) { - const bool isPasswordProtected = (line.at(12) == QLatin1Char( '+' )); - m_currentArchiveEntry[FileName] = - m_currentArchiveEntry[InternalID] = QString(directoryName + QLatin1Char( '/' )); - m_currentArchiveEntry[ IsPasswordProtected ] = - isPasswordProtected; - } - } - - m_currentArchiveEntry[ Permissions ] = attributes.mid(1); - } else if (line.startsWith(QLatin1String("CRC = "))) { - m_currentArchiveEntry[ CRC ] = line.mid(6).trimmed(); - } else if (line.startsWith(QLatin1String("Method = "))) { - m_currentArchiveEntry[ Method ] = line.mid(9).trimmed(); - } else if (line.startsWith(QLatin1String("Encrypted = ")) && - line.size() >= 13) { - m_currentArchiveEntry[ IsPasswordProtected ] = (line.at(12) == QLatin1Char( '+' )); - } else if (line.startsWith(QLatin1String("Block = "))) { - if (m_currentArchiveEntry.contains(FileName)) { - emit entry(m_currentArchiveEntry); - } - } - break; - } - - return true; -} - -KERFUFFLE_EXPORT_PLUGIN(CliPlugin) - -#include "cliplugin.moc" diff --git a/ark/plugins/cli7zplugin/cliplugin.h b/ark/plugins/cli7zplugin/cliplugin.h deleted file mode 100644 index 9f122e4a..00000000 --- a/ark/plugins/cli7zplugin/cliplugin.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * ark -- archiver for the KDE project - * - * Copyright (C) 2009 Harald Hvaal - * Copyright (C) 2009-2010 Raphael Kubo da Costa - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - - -#ifndef CLIPLUGIN_H -#define CLIPLUGIN_H - -#include "kerfuffle/cliinterface.h" - -class CliPlugin : public Kerfuffle::CliInterface -{ - Q_OBJECT - -public: - explicit CliPlugin(QObject *parent, const QVariantList & args); - virtual ~CliPlugin(); - -protected: - virtual Kerfuffle::ParameterList parameterList() const; - virtual bool readListLine(const QString &line); - -private: - enum ArchiveType { - ArchiveType7z = 0, - ArchiveTypeBZip2, - ArchiveTypeGZip, - ArchiveTypeTar, - ArchiveTypeZip - }; - - enum ReadState { - ReadStateHeader = 0, - ReadStateArchiveInformation, - ReadStateEntryInformation - }; - - ArchiveType m_archiveType; - Kerfuffle::ArchiveEntry m_currentArchiveEntry; - ReadState m_state; -}; - -#endif // CLIPLUGIN_H diff --git a/ark/plugins/cli7zplugin/kerfuffle_cli7z.desktop.cmake b/ark/plugins/cli7zplugin/kerfuffle_cli7z.desktop.cmake deleted file mode 100644 index 29b355af..00000000 --- a/ark/plugins/cli7zplugin/kerfuffle_cli7z.desktop.cmake +++ /dev/null @@ -1,69 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=Kerfuffle/Plugin -X-KDE-Library=kerfuffle_cli7z -X-KDE-PluginInfo-Author=Harald Hvaal -X-KDE-PluginInfo-Email=haraldhv@stud.ntnu.no -X-KDE-PluginInfo-Name=kerfuffle_7z -X-KDE-PluginInfo-Version=0.0.1 -X-KDE-PluginInfo-Website=http://www.kde.org -X-KDE-PluginInfo-License=GPLv2+ -X-KDE-Priority=120 -X-KDE-Kerfuffle-APIRevision=1 -X-KDE-Kerfuffle-ReadWrite=true -Name=7zip archive plugin -Name[ar]=ملحق أرشيف 7zip -Name[ast]=Complementu d'archivu comprimíu 7zip -Name[bg]=Приставка за архиви 7zip -Name[bs]=Priključak 7z arhiva -Name[ca]=Connector per arxius 7zip -Name[ca@valencia]=Connector per arxius 7zip -Name[cs]=Modul pro archiv 7zip -Name[da]=Plugin til 7zip-arkiver -Name[de]=7zip-Archiv-Modul -Name[el]=Πρόσθετο αρχειοθήκης 7zip -Name[en_GB]=7zip archive plugin -Name[es]=Complemento de archivo comprimido 7zip -Name[et]=7zip arhiivi plugin -Name[eu]=7zip artxiboen plugina -Name[fi]=7zip-pakkaustuki -Name[fr]=Module externe pour archive « 7zip » -Name[ga]=Breiseán cartlainne 7zip -Name[gl]=Extensión de arquivo de 7zip -Name[hr]=Arhivni priključak 7zip -Name[hu]=7zip modul -Name[ia]=Plugin de archivar 7zip -Name[id]=Pengaya arsip 7zip -Name[it]=estensione per archivi 7zip -Name[ja]=7zip アーカイブ用プラグイン -Name[kk]=7zip архив плагині -Name[km]=កម្មវិធី​ជំនួយ​ប័ណ្ណសារ 7zip -Name[ko]=7zip 압축 플러그인 -Name[lt]=7zip archyvo priedas -Name[lv]=7zip arhīvu spraudnis -Name[mr]=7ZIP संग्रह प्लगइन -Name[nb]=Programtillegg for 7zip-arkiv -Name[nds]=7zip-Archievmoduul -Name[nl]=7zip-archiefplug-in -Name[nn]=7zip-arkivtillegg -Name[pa]=7zip ਅਕਾਇਵ ਪਲੱਗਇਨ -Name[pl]=Wtyczka archiwów 7zip -Name[pt]='Plugin' de pacotes '7zip' -Name[pt_BR]=Plugin de arquivos 7zip -Name[ro]=Modul de arhivă 7zip -Name[ru]=Поддержка архивов 7zip -Name[sk]=Modul 7zip archívu -Name[sl]=Vstavek za arhive 7zip -Name[sq]=7zip arkiv plugin -Name[sr]=Прикључак 7зип архива -Name[sr@ijekavian]=Прикључак 7зип архива -Name[sr@ijekavianlatin]=Priključak 7zip arhiva -Name[sr@latin]=Priključak 7zip arhiva -Name[sv]=Insticksprogram för 7zip arkiv -Name[th]=ส่วนเสริมการจัดการแฟ้มจัดเก็บแบบ 7zip -Name[tr]=7zip arşivi eklentisi -Name[uk]=Додаток для архівів 7zip -Name[x-test]=xx7zip archive pluginxx -Name[zh_CN]=7zip 归档插件 -Name[zh_TW]=7zip 壓縮檔外掛程式 -MimeType=@SUPPORTED_CLI7Z_MIMETYPES@ diff --git a/ark/plugins/clizipplugin/CMakeLists.txt b/ark/plugins/clizipplugin/CMakeLists.txt deleted file mode 100644 index 5e180fb9..00000000 --- a/ark/plugins/clizipplugin/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -########### next target ############### - -set(SUPPORTED_CLIZIP_MIMETYPES "application/x-java-archive;application/zip;") - -set(kerfuffle_clizip_SRCS cliplugin.cpp) - -kde4_add_plugin(kerfuffle_clizip ${kerfuffle_clizip_SRCS}) - -target_link_libraries(kerfuffle_clizip ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} kerfuffle ) - -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/kerfuffle_clizip.desktop.cmake - ${CMAKE_CURRENT_BINARY_DIR}/kerfuffle_clizip.desktop -) - -########### install files ############### - -install(TARGETS kerfuffle_clizip DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kerfuffle_clizip.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - -set(SUPPORTED_ARK_MIMETYPES "${SUPPORTED_ARK_MIMETYPES}${SUPPORTED_CLIZIP_MIMETYPES}" PARENT_SCOPE) diff --git a/ark/plugins/clizipplugin/cliplugin.cpp b/ark/plugins/clizipplugin/cliplugin.cpp deleted file mode 100644 index 1be2a10f..00000000 --- a/ark/plugins/clizipplugin/cliplugin.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * ark -- archiver for the KDE project - * - * Copyright (C) 2009 Harald Hvaal - * Copyright (C) 2009-2011 Raphael Kubo da Costa - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "cliplugin.h" -#include "kerfuffle/cliinterface.h" -#include "kerfuffle/kerfuffle_export.h" - -#include - -#include -#include -#include -#include -#include -#include - -using namespace Kerfuffle; - -CliPlugin::CliPlugin(QObject *parent, const QVariantList & args) - : CliInterface(parent, args) - , m_status(Header) -{ -} - -CliPlugin::~CliPlugin() -{ -} - -// #208091: infozip applies special meanings to some characters, so we -// need to escape them with backslashes.see match.c in -// infozip's source code -QString CliPlugin::escapeFileName(const QString &fileName) const -{ - const QString escapedCharacters(QLatin1String("[]*?^-\\!")); - - QString quoted; - const int len = fileName.length(); - const QLatin1Char backslash('\\'); - quoted.reserve(len * 2); - - for (int i = 0; i < len; ++i) { - if (escapedCharacters.contains(fileName.at(i))) { - quoted.append(backslash); - } - - quoted.append(fileName.at(i)); - } - - return quoted; -} - -ParameterList CliPlugin::parameterList() const -{ - static ParameterList p; - - if (p.isEmpty()) { - p[CaptureProgress] = false; - p[ListProgram] = QStringList() << QLatin1String( "zipinfo" ); - p[ExtractProgram] = QStringList() << QLatin1String( "unzip" ); - p[DeleteProgram] = p[AddProgram] = QStringList() << QLatin1String( "zip" ); - - p[ListArgs] = QStringList() << QLatin1String( "-l" ) << QLatin1String( "-T" ) << QLatin1String( "$Archive" ); - p[ExtractArgs] = QStringList() << QLatin1String( "$PreservePathSwitch" ) << QLatin1String( "$PasswordSwitch" ) << QLatin1String( "$Archive" ) << QLatin1String( "$Files" ); - p[PreservePathSwitch] = QStringList() << QLatin1String( "" ) << QLatin1String( "-j" ); - p[PasswordSwitch] = QStringList() << QLatin1String( "-P$Password" ); - - p[DeleteArgs] = QStringList() << QLatin1String( "-d" ) << QLatin1String( "$Archive" ) << QLatin1String( "$Files" ); - - p[FileExistsExpression] = QLatin1String( "^replace (.+)\\?" ); - p[FileExistsInput] = QStringList() - << QLatin1String( "y" ) //overwrite - << QLatin1String( "n" ) //skip - << QLatin1String( "A" ) //overwrite all - << QLatin1String( "N" ) //autoskip - ; - - p[AddArgs] = QStringList() << QLatin1String( "-r" ) << QLatin1String( "$Archive" ) << QLatin1String( "$Files" ); - - p[PasswordPromptPattern] = QLatin1String(" password: "); - p[WrongPasswordPatterns] = QStringList() << QLatin1String( "incorrect password" ); - //p[ExtractionFailedPatterns] = QStringList() << "CRC failed"; - } - return p; -} - -bool CliPlugin::readListLine(const QString &line) -{ - static const QRegExp entryPattern(QLatin1String( - "^(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\d{8}).(\\d{6})\\s+(.+)$") ); - - switch (m_status) { - case Header: - m_status = Entry; - break; - case Entry: - if (entryPattern.indexIn(line) != -1) { - ArchiveEntry e; - e[Permissions] = entryPattern.cap(1); - - // #280354: infozip may not show the right attributes for a given directory, so an entry - // ending with '/' is actually more reliable than 'd' bein in the attributes. - e[IsDirectory] = entryPattern.cap(10).endsWith(QLatin1Char('/')); - - e[Size] = entryPattern.cap(4).toInt(); - QString status = entryPattern.cap(5); - if (status[0].isUpper()) { - e[IsPasswordProtected] = true; - } - e[CompressedSize] = entryPattern.cap(6).toInt(); - - const QDateTime ts(QDate::fromString(entryPattern.cap(8), QLatin1String( "yyyyMMdd" )), - QTime::fromString(entryPattern.cap(9), QLatin1String( "hhmmss" ))); - e[Timestamp] = ts; - - e[FileName] = e[InternalID] = entryPattern.cap(10); - emit entry(e); - } - break; - } - - return true; -} - -KERFUFFLE_EXPORT_PLUGIN(CliPlugin) - diff --git a/ark/plugins/clizipplugin/cliplugin.h b/ark/plugins/clizipplugin/cliplugin.h deleted file mode 100644 index 3a310e0a..00000000 --- a/ark/plugins/clizipplugin/cliplugin.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * ark -- archiver for the KDE project - * - * Copyright (C) 2011 Raphael Kubo da Costa - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef CLIPLUGIN_H -#define CLIPLUGIN_H - -#include "kerfuffle/cliinterface.h" - -class CliPlugin : public Kerfuffle::CliInterface -{ - Q_OBJECT - -public: - explicit CliPlugin(QObject *parent, const QVariantList &args); - virtual ~CliPlugin(); - - virtual QString escapeFileName(const QString &fileName) const; - - virtual Kerfuffle::ParameterList parameterList() const; - - virtual bool readListLine(const QString &line); - -private: - enum { - Header = 0, - Entry - } m_status; -}; - -#endif // CLIPLUGIN_H diff --git a/ark/plugins/clizipplugin/kerfuffle_clizip.desktop.cmake b/ark/plugins/clizipplugin/kerfuffle_clizip.desktop.cmake deleted file mode 100644 index 32ceced7..00000000 --- a/ark/plugins/clizipplugin/kerfuffle_clizip.desktop.cmake +++ /dev/null @@ -1,69 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=Kerfuffle/Plugin -X-KDE-Library=kerfuffle_clizip -X-KDE-PluginInfo-Author=Harald Hvaal -X-KDE-PluginInfo-Email=haraldhv@stud.ntnu.no -X-KDE-PluginInfo-Name=kerfuffle_clizip -X-KDE-PluginInfo-Version=0.0.1 -X-KDE-PluginInfo-Website=http://www.kde.org -X-KDE-PluginInfo-License=GPLv2+ -X-KDE-Priority=160 -X-KDE-Kerfuffle-APIRevision=1 -X-KDE-Kerfuffle-ReadWrite=true -Name=ZIP archive plugin -Name[ar]=ملحق أرشيف ZIP -Name[ast]=Complementu d'archivu comprimíu ZIP -Name[bg]=Приставка за архиви ZIP -Name[bs]=Priključak ZIP arhiva -Name[ca]=Connector per arxius ZIP -Name[ca@valencia]=Connector per arxius ZIP -Name[cs]=Modul pro archiv ZIP -Name[da]=Plugin til ZIP-arkiver -Name[de]=ZIP-Archiv-Modul -Name[el]=Πρόσθετο αρχειοθήκης ZIP -Name[en_GB]=ZIP archive plugin -Name[es]=Complemento de archivo comprimido ZIP -Name[et]=ZIP-arhiivi plugin -Name[eu]=ZIP artxiboen plugina -Name[fi]=Zip-pakkaustuki -Name[fr]=Module externe d'archive « ZIP » -Name[ga]=Breiseán cartlainne ZIP -Name[gl]=Extensión de arquivo ZIP -Name[hr]=Arhivni priključak ZIP -Name[hu]=ZIP modul -Name[ia]=Plugin de archivar zip -Name[id]=Pengaya arsip ZIP -Name[it]=estensione per archivi ZIP -Name[ja]=ZIP アーカイブ用プラグイン -Name[kk]=ZIP архив плагині -Name[km]=កម្មវិធី​ជំនួយ​ប័ណ្ណសារ ZIP -Name[ko]=ZIP 압축 플러그인 -Name[lt]=ZIP archyvo priedas -Name[lv]=ZIP arhīvu spraudnis -Name[mr]=ZIP संग्रह प्लगइन -Name[nb]=Programtillegg for ZIP-arkiv -Name[nds]=Zip-Archievmoduul -Name[nl]=ZIP-archiefplug-in -Name[nn]=ZIP-arkivtillegg -Name[pa]=ਜ਼ਿੱਪ ਅਕਾਇਵ ਪਲੱਗਇਨ -Name[pl]=Wtyczka archiwów ZIP -Name[pt]='Plugin' de pacotes ZIP -Name[pt_BR]=Plugin de arquivos ZIP -Name[ro]=Modul de arhivă ZIP -Name[ru]=Поддержка архивов ZIP -Name[sk]=Modul ZIP archívu -Name[sl]=Vstavek za arhive ZIP -Name[sq]=ZIP arkiv plugin -Name[sr]=Прикључак ЗИП архива -Name[sr@ijekavian]=Прикључак ЗИП архива -Name[sr@ijekavianlatin]=Priključak ZIP arhiva -Name[sr@latin]=Priključak ZIP arhiva -Name[sv]=Insticksprogram för ZIP-arkiv -Name[th]=ส่วนเสริมการจัดการแฟ้มจัดเก็บบีบอัดแบบ ZIP -Name[tr]=ZIP arşivi eklentisi -Name[uk]=Додаток для архівів ZIP -Name[x-test]=xxZIP archive pluginxx -Name[zh_CN]=ZIP 归档插件 -Name[zh_TW]=ZIP 壓縮檔外掛程式 -MimeType=@SUPPORTED_CLIZIP_MIMETYPES@ diff --git a/ark/plugins/libarchive/CMakeLists.txt b/ark/plugins/libarchive/CMakeLists.txt index 5d6d0096..59a77e28 100644 --- a/ark/plugins/libarchive/CMakeLists.txt +++ b/ark/plugins/libarchive/CMakeLists.txt @@ -10,6 +10,10 @@ if(HAVE_LIBARCHIVE_CAB_SUPPORT) set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "${SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES}application/vnd.ms-cab-compressed;") endif(HAVE_LIBARCHIVE_CAB_SUPPORT) +# zip and 7z +set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "${SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES}application/x-java-archive;application/zip;") +set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "${SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES}application/x-7z-compressed;") + # This MIME type was originally set in ark.desktop but is not mentioned anywhere else. # Assuming that, if it were supported, it would be here. set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "${SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES}application/x-servicepack;")