drop use cli plugins for 7z and zip as libarchive v3.x.x support them and adjust cmake files to check for new API to be used in v4.x.x

This commit is contained in:
Ivailo Monev 2014-12-11 14:03:50 +00:00
parent 6ca13390d6
commit 70f6c32634
12 changed files with 22 additions and 637 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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 )

View file

@ -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)

View file

@ -1,180 +0,0 @@
/*
* ark -- archiver for the KDE project
*
* Copyright (C) 2009 Harald Hvaal <haraldhv@stud.ntnu.no>
* Copyright (C) 2009-2011 Raphael Kubo da Costa <rakuco@FreeBSD.org>
*
* 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 <QDateTime>
#include <QDir>
#include <QLatin1String>
#include <QString>
#include <KDebug>
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"

View file

@ -1,61 +0,0 @@
/*
* ark -- archiver for the KDE project
*
* Copyright (C) 2009 Harald Hvaal <haraldhv@stud.ntnu.no>
* Copyright (C) 2009-2010 Raphael Kubo da Costa <rakuco@FreeBSD.org>
*
* 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

View file

@ -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@

View file

@ -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)

View file

@ -1,143 +0,0 @@
/*
* ark -- archiver for the KDE project
*
* Copyright (C) 2009 Harald Hvaal <haraldhv@stud.ntnu.no>
* Copyright (C) 2009-2011 Raphael Kubo da Costa <rakuco@FreeBSD.org>
*
* 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 <KDebug>
#include <QDateTime>
#include <QDir>
#include <QLatin1String>
#include <QRegExp>
#include <QString>
#include <QStringList>
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)

View file

@ -1,47 +0,0 @@
/*
* ark -- archiver for the KDE project
*
* Copyright (C) 2011 Raphael Kubo da Costa <rakuco@FreeBSD.org>
*
* 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

View file

@ -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@

View file

@ -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;")