diff --git a/archive/CMakeLists.txt b/archive/CMakeLists.txt index fee845c8..5b9eb026 100644 --- a/archive/CMakeLists.txt +++ b/archive/CMakeLists.txt @@ -1,74 +1,73 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kio5_archive\") if(BUILD_TESTING) add_subdirectory(autotests) endif() set(LIBKIOARCHIVE_VERSION "5.97.0") set(LIBKIOARCHIVE_SOVERSION "5") include(ECMSetupVersion) ecm_setup_version(${LIBKIOARCHIVE_VERSION} VARIABLE_PREFIX "KIOARCHIVE" VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kioarchive_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KioArchiveConfigVersion.cmake" SOVERSION ${LIBKIOARCHIVE_SOVERSION}) set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KioArchive") configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KioArchiveConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KioArchiveConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KioArchiveConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KioArchiveConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) install(EXPORT KioArchiveTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KioArchiveTargets.cmake ) install(FILES kio_archivebase.h ${CMAKE_CURRENT_BINARY_DIR}/libkioarchive_export.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel ) ############### ArchiveProtocolBase library ########### add_library(kioarchive kio_archivebase.cpp kio_archive_debug.cpp) include(GenerateExportHeader) generate_export_header(kioarchive BASE_NAME libkioarchive EXPORT_FILE_NAME libkioarchive_export.h) target_link_libraries(kioarchive PUBLIC KF5::Archive KF5::KIOCore PRIVATE KF5::I18n Qt5::Network Qt5::DBus ) set_target_properties(kioarchive PROPERTIES VERSION ${KIOARCHIVE_VERSION_STRING} SOVERSION ${KIOARCHIVE_SOVERSION} EXPORT_NAME KioArchive ) install(TARGETS kioarchive EXPORT KioArchiveTargets LIBRARY NAMELINK_SKIP ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) ############### Archive KIOslave ###################### add_library(kio_archive MODULE kio_archive.cpp kio_archive_debug.cpp) target_link_libraries(kio_archive KF5::KIOCore KF5::Archive kioarchive Qt5::Network) set_target_properties(kio_archive PROPERTIES OUTPUT_NAME "archive") install(TARGETS kio_archive DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio) -install(FILES tar.protocol ar.protocol zip.protocol sevenz.protocol DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) diff --git a/archive/ar.protocol b/archive/ar.protocol deleted file mode 100644 index 70db371d..00000000 --- a/archive/ar.protocol +++ /dev/null @@ -1,11 +0,0 @@ -[Protocol] -exec=kf5/kio/archive -protocol=ar -archiveMimetype=application/x-archive -input=filesystem -output=filesystem -listing=Name,Type,Size,Date,Access,Owner,Group,Link -reading=true -source=true -Icon=package-x-generic -Class=:local diff --git a/archive/archive.json b/archive/archive.json new file mode 100644 index 00000000..93068681 --- /dev/null +++ b/archive/archive.json @@ -0,0 +1,116 @@ +{ + "KDE-KIO-Protocols": { + "ar": { + "protocol": "ar", + "archiveMimetype": ["application/x-archive"], + "source": true, + "exec": "kf5/kio/archive", + "Icon": "package-x-generic", + "Class":"local", + "listing": [ + "Name", + "Type", + "Size", + "Date", + "Access", + "Owner", + "Group", + "Link" + ], + "copyFromFile": false, + "copyToFile": true, + "deleting": false, + "linking": false, + "makedir": false, + "moving": false, + "reading": true, + "writing": false + }, + "tar": { + "protocol": "tar", + "archiveMimetype": [ + "application/x-tar", + "application/x-compressed-tar", + "application/x-bzip-compressed-tar", + "application/x-webarchive", + "application/x-lzma-compressed-tar", + "application/x-xz-compressed-tar" + ], + "X-DocPath": "kioslave5/tar/index.html", + "source": true, + "exec": "kf5/kio/archive", + "Icon": "package-x-generic", + "Class":"local", + "listing": [ + "Name", + "Type", + "Size", + "Date", + "Access", + "Owner", + "Group", + "Link" + ], + "copyFromFile": false, + "copyToFile": true, + "deleting": false, + "linking": false, + "makedir": false, + "moving": false, + "reading": true, + "writing": false + }, + "sevenz": { + "protocol": "sevenz", + "archiveMimetype": ["application/x-7z-compressed"], + "source": true, + "exec": "kf5/kio/archive", + "Icon": "package-x-generic", + "Class":"local", + "listing": [ + "Name", + "Type", + "Size", + "Date", + "Access", + "Owner", + "Group", + "Link" + ], + "copyFromFile": false, + "copyToFile": true, + "deleting": false, + "linking": false, + "makedir": false, + "moving": false, + "reading": true, + "writing": false + }, + "zip": { + "protocol": "zip", + "archiveMimetype": ["application/zip"], + "source": true, + "exec": "kf5/kio/archive", + "Icon": "package-x-generic", + "Class":"local", + "listing": [ + "Name", + "Type", + "Size", + "Date", + "Access", + "Owner", + "Group", + "Link" + ], + "copyFromFile": false, + "copyToFile": true, + "deleting": false, + "linking": false, + "makedir": false, + "moving": false, + "reading": true, + "writing": false + } + } +} diff --git a/archive/kio_archive.cpp b/archive/kio_archive.cpp index b19bc45b..397cb7f5 100644 --- a/archive/kio_archive.cpp +++ b/archive/kio_archive.cpp @@ -1,87 +1,97 @@ /* This file is part of the KDE libraries Copyright (C) 2000 David Faure This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kio_archive.h" #include #include #include #include #include #include #include "kio_archive_debug.h" +// Pseudo plugin class to embed meta data +class KIOPluginForMetaData : public QObject +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.kde.kio.slave.archive" FILE "archive.json") +}; + using namespace KIO; extern "C" { int Q_DECL_EXPORT kdemain(int argc, char **argv); } int kdemain( int argc, char **argv ) { QCoreApplication app(argc, argv); app.setApplicationName(QLatin1String("kio_archive")); qCDebug(KIO_ARCHIVE_LOG) << "Starting" << QCoreApplication::applicationPid(); if (argc != 4) { fprintf(stderr, "Usage: kio_archive protocol domain-socket1 domain-socket2\n"); exit(-1); } ArchiveProtocol slave( argv[1], argv[2], argv[3]); slave.dispatchLoop(); qCDebug(KIO_ARCHIVE_LOG) << "Done"; return 0; } ArchiveProtocol::ArchiveProtocol( const QByteArray &proto, const QByteArray &pool, const QByteArray &app ) : ArchiveProtocolBase( proto, pool, app ) { qCDebug(KIO_ARCHIVE_LOG); } KArchive *ArchiveProtocol::createArchive( const QString & proto, const QString & archiveFile ) { if ( proto == "ar" ) { qCDebug(KIO_ARCHIVE_LOG) << "Opening KAr on " << archiveFile; return new KAr( archiveFile ); } else if ( proto == "tar" ) { qCDebug(KIO_ARCHIVE_LOG) << "Opening KTar on " << archiveFile; return new KTar( archiveFile ); } else if ( proto == "zip" ) { qCDebug(KIO_ARCHIVE_LOG) << "Opening KZip on " << archiveFile; return new KZip( archiveFile ); } else if ( proto == "sevenz" ) { qCDebug(KIO_ARCHIVE_LOG) << "Opening K7Zip on " << archiveFile; return new K7Zip( archiveFile ); } else { qCWarning(KIO_ARCHIVE_LOG) << "Protocol" << proto << "not supported by this IOSlave" ; return nullptr; } } +// needed for JSON file embedding +#include "kio_archive.moc" + // kate: space-indent on; indent-width 4; replace-tabs on; diff --git a/archive/sevenz.protocol b/archive/sevenz.protocol deleted file mode 100644 index 4ff7d620..00000000 --- a/archive/sevenz.protocol +++ /dev/null @@ -1,11 +0,0 @@ -[Protocol] -exec=kf5/kio/archive -protocol=sevenz -archiveMimetype=application/x-7z-compressed -input=filesystem -output=filesystem -listing=Name,Type,Size,Date,Access,Owner,Group,Link -reading=true -source=true -Icon=package-x-generic -Class=:local diff --git a/archive/tar.protocol b/archive/tar.protocol deleted file mode 100644 index c713eac5..00000000 --- a/archive/tar.protocol +++ /dev/null @@ -1,12 +0,0 @@ -[Protocol] -exec=kf5/kio/archive -protocol=tar -archiveMimetype=application/x-tar,application/x-compressed-tar,application/x-bzip-compressed-tar,application/x-webarchive,application/x-lzma-compressed-tar,application/x-xz-compressed-tar -input=filesystem -output=filesystem -listing=Name,Type,Size,Date,Access,Owner,Group,Link -reading=true -source=true -X-DocPath=kioslave5/tar/index.html -Icon=package-x-generic -Class=:local diff --git a/archive/zip.protocol b/archive/zip.protocol deleted file mode 100644 index 78310e6c..00000000 --- a/archive/zip.protocol +++ /dev/null @@ -1,12 +0,0 @@ -[Protocol] -exec=kf5/kio/archive -protocol=zip -archiveMimetype=application/zip -input=filesystem -output=filesystem -listing=Name,Type,Size,Date,Access,Owner,Group,Link -reading=true -source=true -#DocPath=kioslave/zip/index.html -Icon=package-x-generic -Class=:local