├── AUTHORS ├── CHANGELOG ├── CMakeLists.txt ├── LICENSE ├── README.md └── src ├── CMakeLists.txt ├── about.ui ├── archiver.cpp ├── archiver.h ├── archivererror.cpp ├── archivererror.h ├── archiveritem.cpp ├── archiveritem.h ├── archiverproxymodel.cpp ├── archiverproxymodel.h ├── core ├── CMakeLists.txt ├── config.h ├── file-data.c ├── file-data.h ├── file-utils.c ├── file-utils.h ├── fr-archive.c ├── fr-archive.h ├── fr-command-7z.c ├── fr-command-7z.h ├── fr-command-ace.c ├── fr-command-ace.h ├── fr-command-alz.c ├── fr-command-alz.h ├── fr-command-ar.c ├── fr-command-ar.h ├── fr-command-arj.c ├── fr-command-arj.h ├── fr-command-bsdtar.c ├── fr-command-bsdtar.h ├── fr-command-cfile.c ├── fr-command-cfile.h ├── fr-command-cpio.c ├── fr-command-cpio.h ├── fr-command-dpkg.c ├── fr-command-dpkg.h ├── fr-command-img.c ├── fr-command-img.h ├── fr-command-iso.c ├── fr-command-iso.h ├── fr-command-jar.c ├── fr-command-jar.h ├── fr-command-lha.c ├── fr-command-lha.h ├── fr-command-lrzip.c ├── fr-command-lrzip.h ├── fr-command-rar.c ├── fr-command-rar.h ├── fr-command-rpm.c ├── fr-command-rpm.h ├── fr-command-tar.c ├── fr-command-tar.h ├── fr-command-unarchiver.c ├── fr-command-unarchiver.h ├── fr-command-unstuff.c ├── fr-command-unstuff.h ├── fr-command-zip.c ├── fr-command-zip.h ├── fr-command-zoo.c ├── fr-command-zoo.h ├── fr-command.c ├── fr-command.h ├── fr-enum-types.c ├── fr-enum-types.h ├── fr-error.c ├── fr-error.h ├── fr-init.c ├── fr-init.h ├── fr-marshal.c ├── fr-marshal.h ├── fr-proc-error.c ├── fr-proc-error.h ├── fr-process.c ├── fr-process.h ├── fr-window.h ├── gio-utils.c ├── gio-utils.h ├── glib-utils.c ├── glib-utils.h ├── java-utils.c ├── java-utils.h ├── rar-utils.c ├── rar-utils.h ├── sh │ └── isoinfo.sh ├── tr-wrapper.c ├── tr-wrapper.h └── typedefs.h ├── corestrs.h ├── create.ui ├── createfiledialog.cpp ├── createfiledialog.h ├── dirtreeView.cpp ├── dirtreeView.h ├── dirtreeitem.cpp ├── dirtreeitem.h ├── extract.ui ├── extract_c_strs.py ├── extractfiledialog.cpp ├── extractfiledialog.h ├── filetreeView.cpp ├── filetreeView.h ├── icons └── lxqt-archiver.svg ├── lxqt-archiver.desktop.in ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── passworddialog.cpp ├── passworddialog.h ├── passworddialog.ui ├── progressdialog.cpp ├── progressdialog.h ├── progressdialog.ui └── translations ├── lxqt-archiver.desktop.yaml ├── lxqt-archiver.ts ├── lxqt-archiver_ar.desktop.yaml ├── lxqt-archiver_ar.ts ├── lxqt-archiver_arn.ts ├── lxqt-archiver_ast.ts ├── lxqt-archiver_bg.desktop.yaml ├── lxqt-archiver_bg.ts ├── lxqt-archiver_ca.desktop.yaml ├── lxqt-archiver_ca.ts ├── lxqt-archiver_cs.desktop.yaml ├── lxqt-archiver_cs.ts ├── lxqt-archiver_cy.ts ├── lxqt-archiver_da.desktop.yaml ├── lxqt-archiver_da.ts ├── lxqt-archiver_de.desktop.yaml ├── lxqt-archiver_de.ts ├── lxqt-archiver_el.desktop.yaml ├── lxqt-archiver_el.ts ├── lxqt-archiver_en_GB.desktop.yaml ├── lxqt-archiver_en_GB.ts ├── lxqt-archiver_es.desktop.yaml ├── lxqt-archiver_es.ts ├── lxqt-archiver_et.desktop.yaml ├── lxqt-archiver_et.ts ├── lxqt-archiver_eu.desktop.yaml ├── lxqt-archiver_fi.desktop.yaml ├── lxqt-archiver_fi.ts ├── lxqt-archiver_fr.desktop.yaml ├── lxqt-archiver_fr.ts ├── lxqt-archiver_fur.desktop.yaml ├── lxqt-archiver_fur.ts ├── lxqt-archiver_ga.desktop.yaml ├── lxqt-archiver_gl.desktop.yaml ├── lxqt-archiver_gl.ts ├── lxqt-archiver_he.desktop.yaml ├── lxqt-archiver_he.ts ├── lxqt-archiver_hi.desktop.yaml ├── lxqt-archiver_hr.desktop.yaml ├── lxqt-archiver_hr.ts ├── lxqt-archiver_hu.desktop.yaml ├── lxqt-archiver_hu.ts ├── lxqt-archiver_id.ts ├── lxqt-archiver_is.desktop.yaml ├── lxqt-archiver_it.desktop.yaml ├── lxqt-archiver_it.ts ├── lxqt-archiver_ja.desktop.yaml ├── lxqt-archiver_ja.ts ├── lxqt-archiver_ka.desktop.yaml ├── lxqt-archiver_ka.ts ├── lxqt-archiver_kab.desktop.yaml ├── lxqt-archiver_kab.ts ├── lxqt-archiver_ko.desktop.yaml ├── lxqt-archiver_ko.ts ├── lxqt-archiver_lg.desktop.yaml ├── lxqt-archiver_lg.ts ├── lxqt-archiver_lt.desktop.yaml ├── lxqt-archiver_lt.ts ├── lxqt-archiver_nb_NO.desktop.yaml ├── lxqt-archiver_nb_NO.ts ├── lxqt-archiver_nl.desktop.yaml ├── lxqt-archiver_nl.ts ├── lxqt-archiver_oc.desktop.yaml ├── lxqt-archiver_oc.ts ├── lxqt-archiver_pa.ts ├── lxqt-archiver_pl.desktop.yaml ├── lxqt-archiver_pl.ts ├── lxqt-archiver_pt.desktop.yaml ├── lxqt-archiver_pt.ts ├── lxqt-archiver_pt_BR.ts ├── lxqt-archiver_ru.desktop.yaml ├── lxqt-archiver_ru.ts ├── lxqt-archiver_si.desktop.yaml ├── lxqt-archiver_si.ts ├── lxqt-archiver_sk.desktop.yaml ├── lxqt-archiver_sk.ts ├── lxqt-archiver_sl.desktop.yaml ├── lxqt-archiver_sl.ts ├── lxqt-archiver_sv.ts ├── lxqt-archiver_tr.desktop.yaml ├── lxqt-archiver_tr.ts ├── lxqt-archiver_uk.desktop.yaml ├── lxqt-archiver_uk.ts ├── lxqt-archiver_vi.desktop.yaml ├── lxqt-archiver_vi.ts ├── lxqt-archiver_zh_CN.desktop.yaml ├── lxqt-archiver_zh_CN.ts ├── lxqt-archiver_zh_TW.desktop.yaml └── lxqt-archiver_zh_TW.ts /AUTHORS: -------------------------------------------------------------------------------- 1 | This is derived from the Qt port of engrampa, a gnome file-roller derivative. 2 | Engrampa: https://github.com/mate-desktop/engrampa/ 3 | File Roller: http://fileroller.sourceforge.net/ 4 | 5 | The original authors of engrampa and file-roller: 6 | 7 | MATE developers: 8 | Perberos 9 | Steve Zesch 10 | Stefano Karapetsas 11 | 12 | Main GNOME developers: 13 | Paolo Bacchilega 14 | 15 | GNOME Contributors: 16 | Claudio Bley Patch to cope with systems that 17 | do not have FNM_CASEFOLD 18 | defined. 19 | Shaun McCance Zoo archives support. 20 | Daniel Brodie ISO images support. 21 | 22 | The Qt port is done by LXQt developers: 23 | Copyright 2018 Hong Jen-Yee (PCMan) 24 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | lxqt-archiver-1.2.0 / 2025-04-17 2 | =================================== 3 | * Building is done with 7zip by default. 4 | * Use 7z to open rar archives. 5 | * Show password prompt with list-protected 7z archives. 6 | * Added dedicated support for bsdtar. 7 | * Show targets of link items. 8 | * Added some menu bar icons. 9 | * Added window titles to dialogs. 10 | 11 | lxqt-archiver-1.1.0 / 2024-11-05 12 | =================================== 13 | * Added `application/vnd.rar` to the supported mime types. 14 | * Add clear button to filter bar. 15 | * Silenced a compilation warning about `GList`. 16 | 17 | lxqt-archiver-1.0.0 / 2024-04-17 18 | =================================== 19 | * Ported to Qt6. 20 | 21 | lxqt-archiver-0.9.1 / 2024-02-21 22 | =================================== 23 | * Support the use of 7zip instead of p7zip with the new option `USE_7Z` (`OFF` by default), especially for Debian-based systems. 24 | * Updated to new mimetype names of shared-mime-info ≥ 2.3. 25 | * Fixed extraction of multiple archives. 26 | 27 | lxqt-archiver-0.9.0 / 2023-11-05 28 | =================================== 29 | * Ported away from deprecated time format. 30 | * Added appropriate fallback icons to toolbar and menu. 31 | 32 | lxqt-archiver-0.8.0 / 2023-04-15 33 | =================================== 34 | * Updated translations and dependencies and bumped the version. 35 | 36 | lxqt-archiver-0.7.0 / 2022-11-05 37 | =================================== 38 | * Removed the redundant function `n_fields()` from `glib-utils`. 39 | * Silenced some compilation warnings. 40 | 41 | lxqt-archiver-0.6.0 / 2022-04-15 42 | =================================== 43 | * Allow changing of view icon size. 44 | * Allow sorting by any column (but only sort by the first column at startup). 45 | * Forget previous password (if any) on reloading archive. 46 | * Fixed the link in About dialog. 47 | 48 | lxqt-archiver-0.5.0 / 2021-11-04 49 | =================================== 50 | * Bumped minimum required Qt version to 5.15. 51 | * Show password prompt for archives with encrypted lists. 52 | * Added milliseconds to name of temporary extraction folder. 53 | * Removed a duplicate assignment. 54 | * Fixed listing RAR archive contents with encrypted file list. 55 | 56 | lxqt-archiver-0.4.0 / 2021-04-15 57 | =================================== 58 | * Support opening and extracting of disk images. 59 | * Also, support xz-compressed disk images. 60 | * Added "application/vnd.debian.binary-package" to mimetypes list. 61 | * Made directory view horizontally scrollable. 62 | * Remember window settings. 63 | 64 | lxqt-archiver-0.3.0 / 2020-11-01 65 | =================================== 66 | * Avoid memory leak in "java-utils.c". 67 | * Fixed comparison of integer expressions of different signedness. 68 | * Removed "g_ptr_array_free_full" from "glib-utils.c" and used GLib's "g_ptr_array_free" instead. 69 | * Use bsdtar to handle RPM packages. 70 | 71 | lxqt-archiver-0.2.0 / 2020-05-16 72 | =================================== 73 | * Set json-glib dependency as required. 74 | * Added an icon for lxqt-archiver. 75 | * Prevent mixing extracted files with others if overwriting isn't chosen. 76 | * Added expand and collapse actions. 77 | * Fixed build with GCC 10. 78 | 79 | lxqt-archiver-0.1.1 / 2020-04-23 80 | =================================== 81 | * CMake: Used 'LIBEXECDIR' instead of 'LIBDIR' for executables. 82 | * CMake: Removed unused qtdbus dependency. 83 | * Removed comment about json-glib in CMakeLists. 84 | * Fixed handling of RPM archives. 85 | 86 | lxqt-archiver-0.1.0 / 2020-04-19 87 | =================================== 88 | 89 | * Supported viewing (launching) current item. 90 | * Supported opening archives by dropping. 91 | * File DND to other apps. 92 | * Remember window size and splitter position. 93 | * Open file dialog in work directory on compressing/extracting. 94 | * Fix infinite loop on extracting an already extracted archive. 95 | * Prevent dropping into self. 96 | * Fixed gzip mimetype. 97 | * Fixed crash on creating impossible archives. 98 | * Fixed a memory leak with archive creation. 99 | * Use qint64 for modification time. 100 | * Fixed item sorting. 101 | * Choose an appropriate name when creating archive with `--add`. 102 | * Made the toolbar unmovable. 103 | * Added support for Zstd (Zstandard-compressed). 104 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18.0 FATAL_ERROR) 2 | # CMP0000: Call the cmake_minimum_required() command at the beginning of the top-level 3 | # CMakeLists.txt file even before calling the project() command. 4 | # The cmake_minimum_required(VERSION) command implicitly invokes the cmake_policy(VERSION) 5 | # command to specify that the current project code is written for the given range of CMake 6 | # versions. 7 | project(lxqt-archiver) 8 | 9 | option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF) 10 | 11 | option(USE_7Z "Building with 7zip" ON) 12 | if(USE_7Z) 13 | add_definitions(-DUSE_7Z) 14 | endif() 15 | 16 | set(GLIB_MINIMUM_VERSION "2.50.0") 17 | set(LIBFMQT_MINIMUM_VERSION "2.2.0") 18 | set(LXQTBT_MINIMUM_VERSION "2.2.0") 19 | set(QT_MINIMUM_VERSION "6.6.0") 20 | 21 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") 22 | 23 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 24 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 25 | set(CMAKE_AUTOMOC ON) 26 | set(CMAKE_AUTOUIC ON) 27 | 28 | include(GNUInstallDirs) 29 | 30 | 31 | find_package(Qt6Widgets ${QT_MINIMUM_VERSION} REQUIRED) 32 | find_package(Qt6LinguistTools ${QT_MINIMUM_VERSION} REQUIRED) 33 | find_package(fm-qt6 ${LIBFMQT_MINIMUM_VERSION} REQUIRED) 34 | find_package(lxqt2-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED) 35 | 36 | find_package(GLIB ${GLIB_MINIMUM_VERSION} REQUIRED) 37 | find_package(PkgConfig REQUIRED) 38 | 39 | pkg_check_modules( 40 | GLIB_JSON 41 | json-glib-1.0 42 | REQUIRED 43 | ) 44 | 45 | set(LXQT_ARCHIVER_MAJOR_VERSION 1) 46 | set(LXQT_ARCHIVER_MINOR_VERSION 2) 47 | set(LXQT_ARCHIVER_PATCH_VERSION 0) 48 | set(LXQT_ARCHIVER_VERSION ${LXQT_ARCHIVER_MAJOR_VERSION}.${LXQT_ARCHIVER_MINOR_VERSION}.${LXQT_ARCHIVER_PATCH_VERSION}) 49 | add_definitions("-DLXQT_ARCHIVER_VERSION=\"${LXQT_ARCHIVER_VERSION}\"") 50 | 51 | include(LXQtPreventInSourceBuilds) 52 | include(LXQtCompilerSettings NO_POLICY_SCOPE) 53 | include(LXQtTranslate) 54 | 55 | add_subdirectory(src) 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LXQt Archiver 2 | 3 | ## Overview 4 | 5 | A simple & lightweight Qt file archiver. 6 | 7 | The core I/O functions are ported from Engrampa (a Gnome File Roller fork). 8 | * Git revision: c96c85f6d2ff939eeb295e24b699a32262c09151 (2018-06-20) 9 | 10 | This is only a front-end (a graphical interface) to archiving programs 11 | like tar and zip. The supported file types are : 12 | * 7-Zip Compressed File (.7z) 13 | * WinAce Compressed File (.ace) 14 | * ALZip Compressed File (.alz) 15 | * AIX Small Indexed Archive (.ar) 16 | * ARJ Compressed Archive (.arj) 17 | * Cabinet File (.cab) 18 | * UNIX CPIO Archive (.cpio) 19 | * Debian Linux Package (.deb) [Read-only mode] 20 | * ISO-9660 CD Disc Image (.iso) [Read-only mode] 21 | * Java Archive (.jar) 22 | * Java Enterprise archive (.ear) 23 | * Java Web Archive (.war) 24 | * LHA Archive (.lzh, .lha) 25 | * WinRAR Compressed Archive (.rar) 26 | * RAR Archived Comic Book (.cbr) 27 | * RPM Linux Package (.rpm) [Read-only mode] 28 | * Tape Archive File: 29 | * uncompressed (.tar) 30 | or compressed with: 31 | * gzip (.tar.gz , .tgz) 32 | * bzip (.tar.bz , .tbz) 33 | * bzip2 (.tar.bz2 , .tbz2) 34 | * compress (.tar.Z , .taz) 35 | * lrzip (.tar.lrz , .tlrz) 36 | * lzip (.tar.lz , .tlz) 37 | * lzop (.tar.lzo , .tzo) 38 | * 7zip (.tar.7z) 39 | * xz (.tar.xz) 40 | * Stuffit Archives (.bin, .sit) 41 | * ZIP Archive (.zip) 42 | * ZIP Archived Comic Book (.cbz) 43 | * ZOO Compressed Archive File (.zoo) 44 | * Single files compressed with gzip, bzip, bzip2, compress, lrzip, lzip, 45 | lzop, rzip, xz. 46 | 47 | ### Binary packages 48 | 49 | Official binary packages are provided by most major Linux and BSD distributions. 50 | Just use your package manager to search for string `lxqt-archiver`. 51 | 52 | ### Translation 53 | 54 | Translations can be done in [LXQt-Weblate](https://translate.lxqt-project.org/projects/lxqt-desktop/lxqt-archiver/) 55 | 56 | 57 | Translation status 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(core) 2 | 3 | include_directories( 4 | core 5 | ${GLIB_INCLUDE_DIRS} 6 | ${GLIB_JSON_INCLUDE_DIRS} 7 | ${CMAKE_BINARY_DIR} 8 | ${CMAKE_CURRENT_BINARY_DIR} 9 | ) 10 | 11 | set(lxqt-archiver_SRCS 12 | main.cpp 13 | mainwindow.cpp 14 | archiver.cpp 15 | archivererror.cpp 16 | archiveritem.cpp 17 | archiverproxymodel.cpp 18 | progressdialog.cpp 19 | passworddialog.cpp 20 | createfiledialog.cpp 21 | extractfiledialog.cpp 22 | filetreeView.cpp 23 | dirtreeView.cpp 24 | ) 25 | 26 | set(lxqt-archiver_UI 27 | mainwindow.ui 28 | progressdialog.ui 29 | passworddialog.ui 30 | create.ui 31 | extract.ui 32 | about.ui 33 | ) 34 | 35 | # Translations 36 | lxqt_translate_ts(lxqt-archiver_QM_FILES 37 | UPDATE_TRANSLATIONS 38 | ${UPDATE_TRANSLATIONS} 39 | SOURCES 40 | corestrs.h # translatable strings of src/core/*.c genreated using extract_c_strs.py 41 | ${lxqt-archiver_SRCS} 42 | ${lxqt-archiver_UI} 43 | INSTALL_DIR 44 | "${CMAKE_INSTALL_DATADIR}/lxqt-archiver/translations" 45 | ) 46 | 47 | lxqt_translate_desktop(DESKTOP_FILES 48 | SOURCES 49 | lxqt-archiver.desktop.in 50 | USE_YAML 51 | ) 52 | 53 | add_executable(lxqt-archiver 54 | ${lxqt-archiver_SRCS} 55 | ${lxqt-archiver_QM_FILES} 56 | ${lxqt-archiver_UI} 57 | ${DESKTOP_FILES} 58 | ) 59 | 60 | target_compile_definitions(lxqt-archiver 61 | PRIVATE 62 | LXQT_ARCHIVER_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/lxqt-archiver" 63 | LXQT_ARCHIVER_VERSION="${LXQT_ARCHIVER_VERSION}" 64 | QT_NO_FOREACH 65 | QT_NO_KEYWORDS 66 | ) 67 | 68 | target_link_libraries(lxqt-archiver 69 | Qt6::Widgets 70 | fm-qt6 71 | lxqt-archiver-core 72 | ${GLIB_LIBRARIES} 73 | ${GLIB_JSON_LDFLAGS} 74 | ) 75 | 76 | install(TARGETS 77 | lxqt-archiver 78 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" 79 | COMPONENT Runtime 80 | ) 81 | 82 | install(FILES 83 | ${DESKTOP_FILES} 84 | DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" 85 | COMPONENT Runtime 86 | ) 87 | 88 | install( 89 | FILES icons/lxqt-archiver.svg 90 | DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps" 91 | ) 92 | -------------------------------------------------------------------------------- /src/about.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AboutDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 430 10 | 381 11 | 12 | 13 | 14 | About 15 | 16 | 17 | 18 | .. 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Qt::AlignCenter 28 | 29 | 30 | 31 | 32 | 33 | 34 | <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">LXQt Archiver</span></p></body></html> 35 | 36 | 37 | Qt::RichText 38 | 39 | 40 | Qt::AlignCenter 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Qt::AlignCenter 51 | 52 | 53 | 54 | 55 | 56 | 57 | A simple and desktop-agnostic Qt file archiver 58 | 59 | 60 | Qt::AlignCenter 61 | 62 | 63 | 64 | 65 | 66 | 67 | <html><head/><body><p><a href="https://github.com/lxqt/lxqt-archiver">https://github.com/lxqt/lxqt-archiver</span></a></p></body></html> 68 | 69 | 70 | 71 | Qt::RichText 72 | 73 | 74 | Qt::AlignCenter 75 | 76 | 77 | true 78 | 79 | 80 | 81 | 82 | 83 | 84 | 0 85 | 86 | 87 | false 88 | 89 | 90 | 91 | Authors 92 | 93 | 94 | 95 | 96 | 97 | true 98 | 99 | 100 | Programming: 101 | * Hong Jen Yee (PCMan) <pcman.tw@gmail.com> 102 | 103 | LXQt Archiver is derived from the following programs: 104 | * Engrampa of MATE desktop 105 | * File Roller of Gnome desktop 106 | 107 | 108 | 109 | false 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | License 118 | 119 | 120 | 121 | 122 | 123 | true 124 | 125 | 126 | LXQt Archiver 127 | 128 | Copyright (C) 2020 the LXQt Team 129 | 130 | This program is free software; you can redistribute it and/or 131 | modify it under the terms of the GNU General Public License 132 | as published by the Free Software Foundation; either version 2 133 | of the License, or (at your option) any later version. 134 | 135 | This program is distributed in the hope that it will be useful, 136 | but WITHOUT ANY WARRANTY; without even the implied warranty of 137 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 138 | GNU General Public License for more details. 139 | 140 | You should have received a copy of the GNU General Public License 141 | along with this program; if not, write to the Free Software 142 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | Qt::Horizontal 154 | 155 | 156 | QDialogButtonBox::Close 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | buttonBox 166 | accepted() 167 | AboutDialog 168 | accept() 169 | 170 | 171 | 254 172 | 318 173 | 174 | 175 | 157 176 | 274 177 | 178 | 179 | 180 | 181 | buttonBox 182 | rejected() 183 | AboutDialog 184 | reject() 185 | 186 | 187 | 322 188 | 318 189 | 190 | 191 | 286 192 | 274 193 | 194 | 195 | 196 | 197 | 198 | -------------------------------------------------------------------------------- /src/archiver.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCHIVE_H 2 | #define ARCHIVE_H 3 | 4 | #include "core/fr-archive.h" 5 | #include "archivererror.h" 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | 18 | class ArchiverItem; 19 | 20 | class Archiver : public QObject { 21 | Q_OBJECT 22 | public: 23 | 24 | explicit Archiver(QObject* parent = nullptr); 25 | 26 | ~Archiver(); 27 | 28 | Fm::FilePath currentArchivePath() const; 29 | 30 | const char* currentArchiveContentType() const; 31 | 32 | bool createNewArchive(const char* uri); 33 | 34 | bool createNewArchive(const QUrl& uri); 35 | 36 | bool openArchive(const char* uri, const char* password); 37 | 38 | bool openArchive(const QUrl& uri, const char* password); 39 | 40 | void reloadArchive(const char* password); 41 | 42 | bool isLoaded() const; 43 | 44 | bool isBusy() const; 45 | 46 | void stopCurrentAction(); 47 | 48 | QUrl archiveUrl() const; 49 | 50 | QString archiveDisplayName() const; 51 | 52 | FrAction currentAction() const; 53 | 54 | ArchiverError lastError() const; 55 | 56 | std::vector flatFileList() const; 57 | 58 | const ArchiverItem* dirTreeRoot() const; 59 | 60 | const ArchiverItem* dirByPath(const char* path) const; 61 | 62 | const ArchiverItem* parentDir(const ArchiverItem* file) const; 63 | 64 | const ArchiverItem* itemByPath(const char* fullPath) const; 65 | 66 | bool isDir(const FileData* file) const; 67 | 68 | const FileData* fileDataByOriginalPath(const char* fullPath); 69 | 70 | void addFiles(GList* relativeFileNames, const char* srcDirUri, const char* destDirPath, 71 | bool onlyIfNewer, const char* password, bool encrypt_header, FrCompression compression, unsigned int volume_size); 72 | 73 | void addFiles(const Fm::FilePathList& srcPaths, const char* destDirPath, 74 | bool onlyIfNewer, const char* password, bool encrypt_header, FrCompression compression, unsigned int volume_size); 75 | 76 | void addDirectory(const char* directoryUri, const char* baseDirUri, const char* destDirPath, 77 | bool onlyIfNewer, const char* password, bool encrypt_header, FrCompression compression, unsigned int volume_size); 78 | 79 | void addDirectory(const Fm::FilePath& directory, const char* destDirPath, 80 | bool onlyIfNewer, const char* password, bool encrypt_header, FrCompression compression, unsigned int volume_size); 81 | 82 | /* 83 | void addWithWildcard(const char* include_files, const char* exclude_files, const char* exclude_folders, const char* base_dir, const char* dest_dir, bool update, bool follow_links, const char* password, bool encrypt_header, FrCompression compression, unsigned int volume_size); 84 | 85 | void addWithWildcard(const char* include_files, const char* exclude_files, const char* exclude_folders, const QUrl& base_dir, const QUrl& dest_dir, bool update, bool follow_links, const char* password, bool encrypt_header, FrCompression compression, unsigned int volume_size); 86 | 87 | */ 88 | 89 | void addDroppedItems(GList *item_list, const char *base_dir, const char *dest_dir, bool update, const char *password, bool encrypt_header, FrCompression compression, unsigned int volume_size); 90 | 91 | void addDroppedItems(const Fm::FilePathList& srcPaths, const char *base_dir, const char *dest_dir, bool update, const char *password, bool encrypt_header, FrCompression compression, unsigned int volume_size); 92 | 93 | void removeFiles(GList* fileNames, FrCompression compression); 94 | 95 | void removeFiles(const std::vector &files, FrCompression compression); 96 | 97 | void extractFiles(GList* fileNames, const char* destDirUri, const char* baseDirPath, bool skip_older, bool overwrite, bool junk_path, const char* password); 98 | 99 | void extractFiles(const std::vector& files, const Fm::FilePath& destDir, const char* baseDirPath, bool skip_older, bool overwrite, bool junk_path, const char* password); 100 | 101 | void extractAll(const char* destDirUri, bool skip_older, bool overwrite, bool junk_path, const char* password); 102 | 103 | bool extractHere(bool skip_older, bool overwrite, bool junk_path, const char* password); 104 | 105 | const char* lastExtractionDestination() const; 106 | 107 | void testArchiveIntegrity(const char* password); 108 | 109 | static QStringList supportedCreateMimeTypes(); 110 | 111 | static QStringList supportedCreateNameFilters(); 112 | 113 | static QStringList supportedOpenMimeTypes(); 114 | 115 | static QStringList supportedOpenNameFilters(); 116 | 117 | static QStringList supportedSaveMimeTypes(); 118 | 119 | static QStringList supportedSaveNameFilters(); 120 | 121 | bool isEncrypted() const; 122 | 123 | std::uint64_t uncompressedSize() const; 124 | 125 | Q_SIGNALS: 126 | 127 | void invalidateContent(); // after receiving this signal, all old FileData* pointers are invalidated 128 | 129 | void start(FrAction action); 130 | 131 | void finish(FrAction action, ArchiverError error); 132 | 133 | void progress(double fraction); 134 | 135 | void message(QString msg); 136 | 137 | void stoppableChanged(bool value); 138 | 139 | void workingArchive(QString filename); 140 | 141 | public Q_SLOTS: 142 | 143 | private: 144 | 145 | static std::string stripTrailingSlash(std::string dirPath); 146 | 147 | static void freeStrsGList(GList* strs); 148 | 149 | void rebuildDirTree(); 150 | 151 | static QStringList mimeDescToNameFilters(int *mimeDescIndexes); 152 | 153 | private: 154 | // GObject signal callbacks 155 | static void onStart(FrArchive*, FrAction action, Archiver* _this); 156 | 157 | static void onDone(FrArchive*, FrAction action, FrProcError* error, Archiver* _this); 158 | 159 | static void onProgress(FrArchive*, double fraction, Archiver* _this); 160 | 161 | static void onMessage(FrArchive*, const char* msg, Archiver* _this); 162 | 163 | static void onStoppable(FrArchive*, gboolean value, Archiver* _this); 164 | 165 | static void onWorkingArchive(FrCommand* comm, const char* filename, Archiver* _this); 166 | 167 | private: 168 | FrArchive* frArchive_; 169 | std::unordered_map dirMap_; 170 | std::vector> items_; 171 | ArchiverItem* rootItem_; 172 | bool busy_; 173 | bool isEncrypted_; 174 | std::uint64_t uncompressedSize_; 175 | }; 176 | 177 | Q_DECLARE_METATYPE(FrAction) 178 | 179 | #endif // ARCHIVE_H 180 | -------------------------------------------------------------------------------- /src/archivererror.cpp: -------------------------------------------------------------------------------- 1 | #include "archivererror.h" 2 | #include 3 | 4 | ArchiverError::ArchiverError(): 5 | type_{FR_PROC_ERROR_NONE}, 6 | status_{0}, 7 | domain_{0}, 8 | code_{0} { 9 | } 10 | 11 | ArchiverError::ArchiverError(FrProcError* err): ArchiverError{} { 12 | if(err) { 13 | type_ = err->type; 14 | status_ = err->status; 15 | if(err->gerror) { 16 | domain_ = err->gerror->domain; 17 | code_ = err->gerror->code; 18 | message_ = QString::fromUtf8(err->gerror->message); 19 | } 20 | 21 | if(message_.isEmpty()) { 22 | switch(type_) { 23 | case FR_PROC_ERROR_COMMAND_ERROR: 24 | case FR_PROC_ERROR_SPAWN: 25 | message_ = QCoreApplication::translate("ArchiverError", "Failed to execute the command."); 26 | break; 27 | case FR_PROC_ERROR_COMMAND_NOT_FOUND: 28 | message_ = QCoreApplication::translate("ArchiverError", "Command is not found."); 29 | break; 30 | case FR_PROC_ERROR_EXITED_ABNORMALLY: 31 | message_ = QCoreApplication::translate("ArchiverError", "The command exited abnormally."); 32 | break; 33 | case FR_PROC_ERROR_ASK_PASSWORD: 34 | message_ = QCoreApplication::translate("ArchiverError", "Password is required."); 35 | break; 36 | case FR_PROC_ERROR_MISSING_VOLUME: 37 | message_ = QCoreApplication::translate("ArchiverError", "Missing volume."); 38 | break; 39 | case FR_PROC_ERROR_BAD_CHARSET: 40 | message_ = QCoreApplication::translate("ArchiverError", "Bad charset."); 41 | break; 42 | case FR_PROC_ERROR_UNSUPPORTED_FORMAT: 43 | message_ = QCoreApplication::translate("ArchiverError", "Unsupported file format."); 44 | break; 45 | default: 46 | message_ = QCoreApplication::translate("ArchiverError", "Unknown errors happened."); 47 | break; 48 | } 49 | } 50 | } 51 | } 52 | 53 | bool ArchiverError::hasError() const { 54 | return type_ != FR_PROC_ERROR_NONE; 55 | } 56 | 57 | FrProcErrorType ArchiverError::type() const { 58 | return type_; 59 | } 60 | 61 | int ArchiverError::status() const { 62 | return status_; 63 | } 64 | 65 | GQuark ArchiverError::domain() const { 66 | return domain_; 67 | } 68 | 69 | int ArchiverError::code() const { 70 | return code_; 71 | } 72 | 73 | QString ArchiverError::message() const { 74 | return message_; 75 | } 76 | -------------------------------------------------------------------------------- /src/archivererror.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCHIVERERROR_H 2 | #define ARCHIVERERROR_H 3 | 4 | #include 5 | #include 6 | #include "core/fr-archive.h" 7 | 8 | class ArchiverError { 9 | public: 10 | ArchiverError(); 11 | 12 | ArchiverError(FrProcError* err); 13 | 14 | bool hasError() const; 15 | 16 | FrProcErrorType type() const; 17 | 18 | int status() const; 19 | 20 | GQuark domain() const; 21 | 22 | int code() const; 23 | 24 | QString message() const; 25 | 26 | private: 27 | FrProcErrorType type_; 28 | int status_; 29 | GQuark domain_; 30 | int code_; 31 | QString message_; 32 | }; 33 | 34 | 35 | Q_DECLARE_METATYPE(ArchiverError) 36 | 37 | 38 | #endif // ARCHIVERERROR_H 39 | -------------------------------------------------------------------------------- /src/archiveritem.cpp: -------------------------------------------------------------------------------- 1 | #include "archiveritem.h" 2 | 3 | ArchiverItem::ArchiverItem(): data_{nullptr}, ownData_{false} { 4 | } 5 | 6 | ArchiverItem::ArchiverItem(const FileData* data, bool ownData): 7 | data_{data}, ownData_{ownData} { 8 | } 9 | 10 | ArchiverItem::ArchiverItem(const ArchiverItem &other): 11 | data_{other.data_ ? file_data_copy(const_cast(other.data_)) : nullptr}, 12 | ownData_{true} { 13 | } 14 | 15 | ArchiverItem::~ArchiverItem() { 16 | if(ownData_ && data_) { 17 | file_data_free(const_cast(data_)); 18 | } 19 | } 20 | 21 | const char* ArchiverItem::name() const { 22 | return data_ ? data_->name : nullptr; 23 | } 24 | 25 | const char* ArchiverItem::contentType() const { 26 | if(data_) { 27 | return isDir() ? "inode/directory" : data_->content_type; 28 | } 29 | return nullptr; 30 | } 31 | 32 | const char *ArchiverItem::originalPath() const { 33 | return data_ ? data_->original_path : nullptr; 34 | } 35 | 36 | const char *ArchiverItem::fullPath() const { 37 | return data_ ? data_->full_path : nullptr; 38 | } 39 | 40 | const char *ArchiverItem::link() const { 41 | return data_ ? data_->link : nullptr; 42 | } 43 | 44 | qint64 ArchiverItem::modifiedTime() const { 45 | return data_ ? static_cast(data_->modified) : 0LL; // data_->modified is time_t 46 | } 47 | 48 | size_t ArchiverItem::size() const { 49 | return data_ ? data_->size : 0; 50 | } 51 | 52 | bool ArchiverItem::isEncrypted() const { 53 | return data_ ? data_->encrypted : 0; 54 | } 55 | 56 | bool ArchiverItem::isDir() const { 57 | return data_ ? file_data_is_dir(const_cast(data_)) : false; 58 | } 59 | 60 | bool ArchiverItem::hasChildren() const { 61 | return !children_.empty(); 62 | } 63 | 64 | const std::vector& ArchiverItem::children() const { 65 | return children_; 66 | } 67 | 68 | const FileData *ArchiverItem::data() const { 69 | return data_; 70 | } 71 | 72 | void ArchiverItem::setData(const FileData *data, bool ownData) { 73 | if(data_ && ownData_) { 74 | file_data_free(const_cast(data_)); 75 | } 76 | data_ = data; 77 | ownData_ = ownData; 78 | } 79 | 80 | void ArchiverItem::addChild(ArchiverItem *child) { 81 | children_.emplace_back(child); 82 | } 83 | 84 | void ArchiverItem::allChildren(std::vector& results) const { 85 | for(auto& child: children()) { 86 | results.emplace_back(child); 87 | if(child->isDir()) { 88 | child->allChildren(results); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/archiveritem.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCHIVERITEM_H 2 | #define ARCHIVERITEM_H 3 | 4 | #include "core/file-data.h" 5 | 6 | #include 7 | #include 8 | 9 | 10 | class ArchiverItem { 11 | public: 12 | ArchiverItem(); 13 | 14 | ArchiverItem(const FileData* data, bool ownData); 15 | 16 | ArchiverItem(const ArchiverItem& other); 17 | 18 | ~ArchiverItem(); 19 | 20 | const char* name() const; 21 | 22 | const char* contentType() const; 23 | 24 | const char* originalPath() const; 25 | 26 | const char* fullPath() const; 27 | 28 | const char* link() const; 29 | 30 | qint64 modifiedTime() const; 31 | 32 | size_t size() const; 33 | 34 | bool isEncrypted() const; 35 | 36 | bool isDir() const; 37 | 38 | bool hasChildren() const; 39 | 40 | const std::vector& children() const; 41 | 42 | const FileData *data() const; 43 | 44 | void setData(const FileData *data, bool ownData); 45 | 46 | void addChild(ArchiverItem* child); 47 | 48 | void allChildren(std::vector& results) const; 49 | 50 | private: 51 | std::vector children_; 52 | const FileData* data_; // data from FrArchiver (optional) 53 | bool ownData_; 54 | }; 55 | 56 | Q_DECLARE_METATYPE(const ArchiverItem*) 57 | 58 | 59 | #endif // ARCHIVERITEM_H 60 | -------------------------------------------------------------------------------- /src/archiverproxymodel.cpp: -------------------------------------------------------------------------------- 1 | #include "archiverproxymodel.h" 2 | 3 | // for MainWindow::ArchiverItemRole 4 | // FIXME: better to move this to its own module outside main window 5 | #include "mainwindow.h" 6 | #include "archiveritem.h" 7 | 8 | 9 | ArchiverProxyModel::ArchiverProxyModel(QObject *parent): 10 | QSortFilterProxyModel (parent), folderFirst_{true} { 11 | folderFirst_ = true; 12 | collator_.setNumericMode(true); 13 | } 14 | 15 | bool ArchiverProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const { 16 | auto leftFirstCol = source_left.sibling(source_left.row(), 0); 17 | auto rightFirstCol = source_right.sibling(source_right.row(), 0); 18 | if(leftFirstCol.isValid() && rightFirstCol.isValid()) { 19 | auto leftItem = leftFirstCol.data(MainWindow::ArchiverItemRole).value(); 20 | auto rightItem = rightFirstCol.data(MainWindow::ArchiverItemRole).value(); 21 | if(leftItem) { 22 | if(leftItem->isDir()) { 23 | if(folderFirst_ && !(rightItem && rightItem->isDir())) { 24 | // put folder before non-folder items 25 | return (sortOrder() == Qt::AscendingOrder); 26 | } 27 | else if(leftFirstCol.data().toString() == QStringLiteral("..")) { 28 | // the item ".." should always be the first 29 | return (sortOrder() == Qt::AscendingOrder); 30 | } 31 | } 32 | } 33 | if(rightItem) { 34 | if(rightItem->isDir()) { 35 | if(folderFirst_ && !(leftItem && leftItem->isDir())) { 36 | return (sortOrder() != Qt::AscendingOrder); 37 | } 38 | else if(rightFirstCol.data().toString() == QStringLiteral("..")) { 39 | return (sortOrder() != Qt::AscendingOrder); 40 | } 41 | } 42 | } 43 | // apply other sorting criteria, especially for the columns other than the first one 44 | if(sortColumn() != 0) { 45 | auto leftSortColumn = source_left.sibling(source_left.row(), sortColumn()); 46 | auto rightSortColumn = source_right.sibling(source_right.row(), sortColumn()); 47 | if(leftSortColumn.isValid() && rightSortColumn.isValid()) { 48 | if(leftItem && rightItem) { 49 | auto str = leftSortColumn.data(MainWindow::ArchiverItemRole).toString(); 50 | if(str == QStringLiteral("size")) { 51 | if(leftItem->size() != rightItem->size()) { 52 | return (leftItem->size() < rightItem->size()); 53 | } 54 | } 55 | else if(str == QStringLiteral("mTime")) { 56 | if(leftItem->modifiedTime() != rightItem->modifiedTime()) { 57 | return (leftItem->modifiedTime() < rightItem->modifiedTime()); 58 | } 59 | } 60 | else { 61 | // as the last resort, compare texts (e.g., types for the file type column) 62 | int comp = collator_.compare(leftSortColumn.data().toString(), 63 | rightSortColumn.data().toString()); 64 | if(comp != 0) { 65 | return comp < 0; 66 | } 67 | } 68 | } 69 | } 70 | } 71 | // fall back to the texts of the first column (usually, file names) 72 | return collator_.compare(leftFirstCol.data().toString(), rightFirstCol.data().toString()) < 0; 73 | } 74 | return QSortFilterProxyModel::lessThan(source_left, source_right); 75 | } 76 | 77 | bool ArchiverProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const { 78 | if(filterStr_.isEmpty()) { 79 | return true; 80 | } 81 | if(auto model = sourceModel()) { 82 | auto indx = model->index(source_row, 0, source_parent); 83 | if(indx.isValid()) { 84 | auto firstCol = indx.sibling(source_row, 0); 85 | if(const ArchiverItem* item = firstCol.data(MainWindow::ArchiverItemRole).value()) { 86 | if(QString::fromUtf8(item->name()).contains(filterStr_, Qt::CaseInsensitive)) { 87 | return true; 88 | } 89 | } 90 | } 91 | } 92 | return false; 93 | } 94 | 95 | void ArchiverProxyModel::setFilterStr(QString str) { 96 | if(filterStr_ != str) { 97 | filterStr_ = str; 98 | invalidate(); 99 | } 100 | } 101 | 102 | bool ArchiverProxyModel::folderFirst() const { 103 | return folderFirst_; 104 | } 105 | 106 | void ArchiverProxyModel::setFolderFirst(bool folderFirst) { 107 | folderFirst_ = folderFirst; 108 | invalidate(); 109 | } 110 | -------------------------------------------------------------------------------- /src/archiverproxymodel.h: -------------------------------------------------------------------------------- 1 | #ifndef ARCHIVERPROXYMODEL_H 2 | #define ARCHIVERPROXYMODEL_H 3 | 4 | #include 5 | #include 6 | 7 | class ArchiverProxyModel : public QSortFilterProxyModel { 8 | Q_OBJECT 9 | public: 10 | explicit ArchiverProxyModel(QObject *parent = nullptr); 11 | 12 | bool folderFirst() const; 13 | 14 | void setFolderFirst(bool folderFirst); 15 | 16 | void setFilterStr(QString str); 17 | 18 | protected: 19 | bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override; 20 | bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; 21 | 22 | private: 23 | bool folderFirst_; 24 | QString filterStr_; 25 | QCollator collator_; 26 | }; 27 | 28 | #endif // ARCHIVERPROXYMODEL_H 29 | -------------------------------------------------------------------------------- /src/core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${GLIB_INCLUDE_DIRS} 3 | ${GLIB_JSON_INCLUDE_DIRS} 4 | ${CMAKE_BINARY_DIR} 5 | ) 6 | 7 | add_library(lxqt-archiver-core STATIC 8 | tr-wrapper.c # our own wrapper for QTranslater 9 | file-data.c 10 | file-utils.c 11 | fr-archive.c 12 | fr-command-7z.c 13 | fr-command-ace.c 14 | fr-command-alz.c 15 | fr-command-ar.c 16 | fr-command-arj.c 17 | fr-command-bsdtar.c 18 | fr-command.c 19 | fr-command-cfile.c 20 | fr-command-cpio.c 21 | fr-command-dpkg.c 22 | fr-command-jar.c 23 | fr-command-lha.c 24 | fr-command-lrzip.c 25 | fr-command-rar.c 26 | fr-command-tar.c 27 | fr-command-unarchiver.c 28 | fr-command-unstuff.c 29 | fr-command-zip.c 30 | fr-command-zoo.c 31 | fr-enum-types.c 32 | fr-error.c 33 | fr-init.c 34 | fr-marshal.c 35 | fr-proc-error.c 36 | fr-process.c 37 | gio-utils.c 38 | glib-utils.c 39 | java-utils.c 40 | rar-utils.c 41 | ) 42 | 43 | target_link_libraries(lxqt-archiver-core 44 | ${GLIB_LIBRARIES} 45 | ${GLIB_JSON_LDFLAGS} 46 | ) 47 | 48 | install(FILES 49 | ${SCRIPT_FILES} 50 | DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/lxqt-archiver" 51 | COMPONENT Runtime 52 | ) 53 | -------------------------------------------------------------------------------- /src/core/config.h: -------------------------------------------------------------------------------- 1 | /* config.h. Generated from config.h.in by configure. */ 2 | /* config.h.in. Generated from configure.ac by autoheader. */ 3 | 4 | /* define to enable magic */ 5 | /* #undef ENABLE_MAGIC */ 6 | 7 | /* always defined to indicate that i18n is enabled */ 8 | #define ENABLE_NLS 1 9 | 10 | /* define to enable PackageKit installer */ 11 | #define ENABLE_PACKAGEKIT 1 12 | 13 | /* GetText Package */ 14 | #define GETTEXT_PACKAGE "engrampa" 15 | 16 | /* Define to 1 if you have the `bind_textdomain_codeset' function. */ 17 | #define HAVE_BIND_TEXTDOMAIN_CODESET 1 18 | 19 | /* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the 20 | CoreFoundation framework. */ 21 | /* #undef HAVE_CFLOCALECOPYCURRENT */ 22 | 23 | /* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in 24 | the CoreFoundation framework. */ 25 | /* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ 26 | 27 | /* Define to 1 if you have the `dcgettext' function. */ 28 | #define HAVE_DCGETTEXT 1 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #define HAVE_DLFCN_H 1 32 | 33 | /* Define if the GNU gettext() function is already present or preinstalled. */ 34 | #define HAVE_GETTEXT 1 35 | 36 | /* Define to 1 if you have the header file. */ 37 | #define HAVE_INTTYPES_H 1 38 | 39 | /* Define to 1 if json-glib support is included */ 40 | #define HAVE_JSON_GLIB 1 41 | 42 | /* Define if your file defines LC_MESSAGES. */ 43 | #define HAVE_LC_MESSAGES 1 44 | 45 | /* Define to 1 if you have the `m' library (-lm). */ 46 | #define HAVE_LIBM 1 47 | 48 | /* Define to 1 if you have the header file. */ 49 | #define HAVE_LOCALE_H 1 50 | 51 | /* Define to 1 if you have the header file. */ 52 | #define HAVE_MEMORY_H 1 53 | 54 | /* Have GlibC function to make temp dirs */ 55 | #define HAVE_MKDTEMP 1 56 | 57 | /* Define to 1 if you have the header file. */ 58 | #define HAVE_STDINT_H 1 59 | 60 | /* Define to 1 if you have the header file. */ 61 | #define HAVE_STDLIB_H 1 62 | 63 | /* Define to 1 if you have the header file. */ 64 | #define HAVE_STRINGS_H 1 65 | 66 | /* Define to 1 if you have the header file. */ 67 | #define HAVE_STRING_H 1 68 | 69 | /* Define to 1 if you have the header file. */ 70 | #define HAVE_SYS_STAT_H 1 71 | 72 | /* Define to 1 if you have the header file. */ 73 | #define HAVE_SYS_TYPES_H 1 74 | 75 | /* Define to 1 if you have the header file. */ 76 | #define HAVE_UNISTD_H 1 77 | 78 | /* Locale dir */ 79 | #define LOCALEDIR "/usr/local/share/locale" 80 | 81 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 82 | #define LT_OBJDIR ".libs/" 83 | 84 | /* Name of package */ 85 | #define PACKAGE "engrampa" 86 | 87 | /* Define to the address where bug reports for this package should be sent. */ 88 | #define PACKAGE_BUGREPORT "http://www.mate-desktop.org/" 89 | 90 | /* Define to the full name of this package. */ 91 | #define PACKAGE_NAME "engrampa" 92 | 93 | /* Define to the full name and version of this package. */ 94 | #define PACKAGE_STRING "engrampa 1.21.0" 95 | 96 | /* Define to the one symbol short name of this package. */ 97 | #define PACKAGE_TARNAME "engrampa" 98 | 99 | /* Define to the home page for this package. */ 100 | #define PACKAGE_URL "" 101 | 102 | /* Define to the version of this package. */ 103 | #define PACKAGE_VERSION "1.21.0" 104 | 105 | /* Define to 1 if you have the ANSI C header files. */ 106 | #define STDC_HEADERS 1 107 | 108 | /* Version number of package */ 109 | #define VERSION "1.21.0" 110 | -------------------------------------------------------------------------------- /src/core/file-data.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001-2006 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include 24 | #include "tr-wrapper.h" 25 | #include 26 | #include "glib-utils.h" 27 | #include "file-utils.h" 28 | #include "file-data.h" 29 | 30 | 31 | FileData * 32 | file_data_new (void) 33 | { 34 | FileData *fdata; 35 | 36 | fdata = g_new0 (FileData, 1); 37 | fdata->content_type = NULL; 38 | fdata->free_original_path = FALSE; 39 | fdata->dir_size = 0; 40 | 41 | return fdata; 42 | } 43 | 44 | 45 | void 46 | file_data_free (FileData *fdata) 47 | { 48 | if (fdata == NULL) 49 | return; 50 | if (fdata->free_original_path) 51 | g_free (fdata->original_path); 52 | g_free (fdata->full_path); 53 | g_free (fdata->name); 54 | g_free (fdata->path); 55 | g_free (fdata->link); 56 | g_free (fdata->list_name); 57 | g_free (fdata->sort_key); 58 | g_free (fdata); 59 | } 60 | 61 | 62 | FileData * 63 | file_data_copy (FileData *src) 64 | { 65 | FileData *fdata; 66 | 67 | fdata = g_new0 (FileData, 1); 68 | 69 | fdata->original_path = g_strdup (src->original_path); 70 | fdata->free_original_path = TRUE; 71 | 72 | fdata->full_path = g_strdup (src->full_path); 73 | fdata->link = g_strdup (src->link); 74 | fdata->size = src->size; 75 | fdata->modified = src->modified; 76 | fdata->name = g_strdup (src->name); 77 | fdata->path = g_strdup (src->path); 78 | fdata->content_type = src->content_type; 79 | fdata->encrypted = src->encrypted; 80 | fdata->dir = src->dir; 81 | fdata->dir_size = src->dir_size; 82 | 83 | fdata->list_dir = src->list_dir; 84 | fdata->list_name = g_strdup (src->list_name); 85 | fdata->sort_key = g_strdup (src->sort_key); 86 | 87 | return fdata; 88 | } 89 | 90 | 91 | GType 92 | file_data_get_type (void) 93 | { 94 | static GType type = 0; 95 | 96 | if (type == 0) 97 | type = g_boxed_type_register_static ("FRFileData", (GBoxedCopyFunc) file_data_copy, (GBoxedFreeFunc) file_data_free); 98 | 99 | return type; 100 | } 101 | 102 | 103 | void 104 | file_data_update_content_type (FileData *fdata) 105 | { 106 | if (fdata->dir) 107 | fdata->content_type = MIME_TYPE_DIRECTORY; 108 | else 109 | fdata->content_type = get_static_string (g_content_type_guess (fdata->full_path, NULL, 0, NULL)); 110 | } 111 | 112 | 113 | gboolean 114 | file_data_is_dir (FileData *fdata) 115 | { 116 | return fdata->dir || fdata->list_dir; 117 | } 118 | 119 | 120 | void 121 | file_data_set_list_name (FileData *fdata, 122 | const char *value) 123 | { 124 | g_free (fdata->list_name); 125 | fdata->list_name = g_strdup (value); 126 | 127 | g_free (fdata->sort_key); 128 | if (fdata->list_name != NULL) 129 | fdata->sort_key = g_utf8_collate_key_for_filename (fdata->list_name, -1); 130 | else 131 | fdata->sort_key = NULL; 132 | } 133 | 134 | 135 | int 136 | file_data_compare_by_path (gconstpointer a, 137 | gconstpointer b) 138 | { 139 | FileData *data_a = *((FileData **) a); 140 | FileData *data_b = *((FileData **) b); 141 | 142 | return strcmp (data_a->full_path, data_b->full_path); 143 | } 144 | 145 | 146 | int 147 | find_path_in_file_data_array (GPtrArray *array, 148 | const char *path) 149 | { 150 | int path_l; 151 | int left, right, p, cmp = -1; 152 | FileData *fd; 153 | 154 | if (path == NULL) 155 | return -1; 156 | 157 | path_l = strlen (path); 158 | left = 0; 159 | right = array->len; 160 | while (left < right) { 161 | p = left + ((right - left) / 2); 162 | fd = (FileData *) g_ptr_array_index (array, p); 163 | 164 | cmp = strcmp (path, fd->original_path); 165 | if (cmp != 0) { 166 | /* consider '/path/to/dir' and '/path/to/dir/' the same path */ 167 | 168 | int original_path_l = strlen (fd->original_path); 169 | if ((path_l == original_path_l - 1) && (fd->original_path[original_path_l - 1] == '/')) { 170 | int cmp2 = strncmp (path, fd->original_path, original_path_l - 1); 171 | if (cmp2 == 0) 172 | cmp = cmp2; 173 | } 174 | } 175 | 176 | if (cmp == 0) 177 | return p; 178 | else if (cmp < 0) 179 | right = p; 180 | else 181 | left = p + 1; 182 | } 183 | 184 | return -1; 185 | } 186 | -------------------------------------------------------------------------------- /src/core/file-data.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FILE_DATA_H 24 | #define FILE_DATA_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | G_BEGIN_DECLS 31 | 32 | typedef struct { 33 | char *original_path; /* path read from command line. */ 34 | char *full_path; /* "/" + original_path. */ 35 | char *link; 36 | goffset size; 37 | time_t modified; 38 | 39 | char *name; /* The file name. */ 40 | char *path; /* The directory. */ 41 | gboolean encrypted; /* Whether the file is encrypted. */ 42 | gboolean dir; /* Whether this is a directory listed in the archive */ 43 | goffset dir_size; 44 | const char *content_type; 45 | 46 | /* Additional data. */ 47 | 48 | gboolean list_dir; /* Whether this entry is used to show 49 | * a directory. */ 50 | char *list_name; /* The string visualized in the list 51 | * view. */ 52 | char *sort_key; 53 | 54 | /* Private data */ 55 | 56 | gboolean free_original_path; 57 | } FileData; 58 | 59 | #define FR_TYPE_FILE_DATA (file_data_get_type ()) 60 | 61 | GType file_data_get_type (void); 62 | FileData * file_data_new (void); 63 | FileData * file_data_copy (FileData *src); 64 | void file_data_free (FileData *fdata); 65 | void file_data_update_content_type (FileData *fdata); 66 | gboolean file_data_is_dir (FileData *fdata); 67 | void file_data_set_list_name (FileData *fdata, 68 | const char *value); 69 | int file_data_compare_by_path (gconstpointer a, 70 | gconstpointer b); 71 | int find_path_in_file_data_array (GPtrArray *array, 72 | const char *path); 73 | 74 | G_END_DECLS 75 | 76 | #endif /* FILE_DATA_H */ 77 | -------------------------------------------------------------------------------- /src/core/file-utils.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001, 2003 Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FILE_UTILS_H 24 | #define FILE_UTILS_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #define MIME_TYPE_DIRECTORY "folder" 32 | #define MIME_TYPE_ARCHIVE "application/x-archive" 33 | 34 | #define get_home_relative_path(x) \ 35 | g_strconcat (g_get_home_dir (), \ 36 | "/", \ 37 | (x), \ 38 | NULL) 39 | 40 | gboolean uri_exists (const char *uri); 41 | gboolean uri_is_file (const char *uri); 42 | gboolean uri_is_dir (const char *uri); 43 | gboolean path_is_dir (const char *path); 44 | gboolean uri_is_local (const char *uri); 45 | gboolean dir_is_empty (const char *uri); 46 | gboolean dir_contains_one_object (const char *uri); 47 | char * get_dir_content_if_unique (const char *uri); 48 | gboolean path_in_path (const char *path_src, 49 | const char *path_dest); 50 | goffset get_file_size (const char *uri); 51 | goffset get_file_size_for_path (const char *path); 52 | time_t get_file_mtime (const char *uri); 53 | time_t get_file_mtime_for_path (const char *path); 54 | time_t get_file_ctime (const char *uri); 55 | gboolean make_directory_tree (GFile *dir, 56 | mode_t mode, 57 | GError **error); 58 | gboolean ensure_dir_exists (const char *uri, 59 | mode_t mode, 60 | GError **error); 61 | gboolean make_directory_tree_from_path (const char *path, 62 | mode_t mode, 63 | GError **error); 64 | gboolean file_is_hidden (const char *name); 65 | const char* file_name_from_path(const char* path); 66 | char * dir_name_from_path (const char *path); 67 | char * remove_level_from_path (const char *path); 68 | char * remove_ending_separator (const char *path); 69 | char * build_uri (const char *base, ...); 70 | char * remove_extension_from_path (const char *path); 71 | const char * get_file_extension (const char *filename); 72 | gboolean file_extension_is (const char *filename, 73 | const char *ext); 74 | gboolean is_mime_type (const char *type, 75 | const char *pattern); 76 | const char* get_file_mime_type (const char *uri, 77 | gboolean fast_file_type); 78 | const char* get_file_mime_type_for_path (const char *filename, 79 | gboolean fast_file_type); 80 | guint64 get_dest_free_space (const char *path); 81 | gboolean remove_directory (const char *uri); 82 | gboolean remove_local_directory (const char *directory); 83 | char * get_temp_work_dir (const char *parent_folder); 84 | gboolean is_temp_work_dir (const char *dir); 85 | gboolean is_temp_dir (const char *dir); 86 | 87 | /* misc functions used to parse a command output lines. */ 88 | 89 | gboolean file_list__match_pattern (const char *line, 90 | const char *pattern); 91 | int file_list__get_index_from_pattern (const char *line, 92 | const char *pattern); 93 | char* file_list__get_next_field (const char *line, 94 | int start_from, 95 | int field_n); 96 | char* file_list__get_prev_field (const char *line, 97 | int start_from, 98 | int field_n); 99 | gboolean check_permissions (const char *path, 100 | int mode); 101 | gboolean check_file_permissions (GFile *file, 102 | int mode); 103 | gboolean is_program_in_path (const char *filename); 104 | gboolean is_program_available (const char *filename, 105 | gboolean check); 106 | 107 | /* URI utils */ 108 | 109 | const char * get_home_uri (void); 110 | char * get_home_relative_uri (const char *partial_uri); 111 | GFile * get_home_relative_file (const char *partial_uri); 112 | GFile * get_user_config_subdirectory (const char *child_name, 113 | gboolean create_); 114 | const char * remove_host_from_uri (const char *uri); 115 | char * get_uri_host (const char *uri); 116 | char * get_uri_root (const char *uri); 117 | int uricmp (const char *uri1, 118 | const char *uri2); 119 | char * get_alternative_uri (const char *folder, 120 | const char *name); 121 | char * get_alternative_uri_for_uri (const char *uri); 122 | 123 | void path_list_free (GList *path_list); 124 | GList * path_list_dup (GList *path_list); 125 | 126 | GList * gio_file_list_dup (GList *l); 127 | void gio_file_list_free (GList *l); 128 | GList * gio_file_list_new_from_uri_list (GList *uris); 129 | void g_key_file_save (GKeyFile *key_file, 130 | GFile *file); 131 | 132 | #endif /* FILE_UTILS_H */ 133 | -------------------------------------------------------------------------------- /src/core/fr-command-7z.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2004 Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_7Z_H 24 | #define FR_COMMAND_7Z_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | 30 | #define FR_TYPE_COMMAND_7Z (fr_command_7z_get_type ()) 31 | #define FR_COMMAND_7Z(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_7Z, FrCommand7z)) 32 | #define FR_COMMAND_7Z_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_7Z, FrCommand7zClass)) 33 | #define FR_IS_COMMAND_7Z(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_7Z)) 34 | #define FR_IS_COMMAND_7Z_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_7Z)) 35 | #define FR_COMMAND_7Z_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_7Z, FrCommand7zClass)) 36 | 37 | typedef struct _FrCommand7z FrCommand7z; 38 | typedef struct _FrCommand7zClass FrCommand7zClass; 39 | 40 | struct _FrCommand7z 41 | { 42 | FrCommand __parent; 43 | gboolean list_started; 44 | gboolean old_style; 45 | FileData *fdata; 46 | }; 47 | 48 | struct _FrCommand7zClass 49 | { 50 | FrCommandClass __parent_class; 51 | }; 52 | 53 | GType fr_command_7z_get_type (void); 54 | 55 | #endif /* FR_COMMAND_7Z_H */ 56 | -------------------------------------------------------------------------------- /src/core/fr-command-ace.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2006 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_ACE_H 24 | #define FR_COMMAND_ACE_H 25 | 26 | #include 27 | #include "file-data.h" 28 | #include "fr-command.h" 29 | #include "fr-process.h" 30 | 31 | #define FR_TYPE_COMMAND_ACE (fr_command_ace_get_type ()) 32 | #define FR_COMMAND_ACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_ACE, FrCommandAce)) 33 | #define FR_COMMAND_ACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_ACE, FrCommandAceClass)) 34 | #define FR_IS_COMMAND_ACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_ACE)) 35 | #define FR_IS_COMMAND_ACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_ACE)) 36 | #define FR_COMMAND_ACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_ACE, FrCommandAceClass)) 37 | 38 | typedef enum { 39 | FR_ACE_COMMAND_UNKNOWN = 0, 40 | FR_ACE_COMMAND_PUBLIC, 41 | FR_ACE_COMMAND_NONFREE 42 | } FrAceCommand; 43 | 44 | typedef struct _FrCommandAce FrCommandAce; 45 | typedef struct _FrCommandAceClass FrCommandAceClass; 46 | 47 | struct _FrCommandAce 48 | { 49 | FrCommand __parent; 50 | 51 | gboolean list_started; 52 | FrAceCommand command_type; 53 | }; 54 | 55 | struct _FrCommandAceClass 56 | { 57 | FrCommandClass __parent_class; 58 | }; 59 | 60 | GType fr_command_ace_get_type (void); 61 | 62 | #endif /* FR_COMMAND_ACE_H */ 63 | -------------------------------------------------------------------------------- /src/core/fr-command-alz.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_ALZ_H 24 | #define FR_COMMAND_ALZ_H 25 | 26 | #include 27 | #include "file-data.h" 28 | #include "fr-command.h" 29 | #include "fr-process.h" 30 | 31 | #define FR_TYPE_COMMAND_ALZ (fr_command_alz_get_type ()) 32 | #define FR_COMMAND_ALZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_ALZ, FrCommandAlz)) 33 | #define FR_COMMAND_ALZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_ALZ, FrCommandAlzClass)) 34 | #define FR_IS_COMMAND_ALZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_ALZ)) 35 | #define FR_IS_COMMAND_ALZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_ALZ)) 36 | #define FR_COMMAND_ALZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_ALZ, FrCommandAlzClass)) 37 | 38 | typedef struct _FrCommandAlz FrCommandAlz; 39 | typedef struct _FrCommandAlzClass FrCommandAlzClass; 40 | 41 | struct _FrCommandAlz 42 | { 43 | FrCommand __parent; 44 | 45 | gboolean extract_none; 46 | gboolean invalid_password; 47 | gboolean list_started; 48 | }; 49 | 50 | struct _FrCommandAlzClass 51 | { 52 | FrCommandClass __parent_class; 53 | }; 54 | 55 | GType fr_command_alz_get_type (void); 56 | 57 | #endif /* FR_COMMAND_ALZ_H */ 58 | -------------------------------------------------------------------------------- /src/core/fr-command-ar.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_AR_H 24 | #define FR_COMMAND_AR_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | 30 | #define FR_TYPE_COMMAND_AR (fr_command_ar_get_type ()) 31 | #define FR_COMMAND_AR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_AR, FrCommandAr)) 32 | #define FR_COMMAND_AR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_AR, FrCommandArClass)) 33 | #define FR_IS_COMMAND_AR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_AR)) 34 | #define FR_IS_COMMAND_AR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_AR)) 35 | #define FR_COMMAND_AR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_AR, FrCommandArClass)) 36 | 37 | typedef struct _FrCommandAr FrCommandAr; 38 | typedef struct _FrCommandArClass FrCommandArClass; 39 | 40 | struct _FrCommandAr 41 | { 42 | FrCommand __parent; 43 | }; 44 | 45 | struct _FrCommandArClass 46 | { 47 | FrCommandClass __parent_class; 48 | }; 49 | 50 | GType fr_command_ar_get_type (void); 51 | 52 | #endif /* FR_COMMAND_AR_H */ 53 | -------------------------------------------------------------------------------- /src/core/fr-command-arj.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001, 2003 Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_ARJ_H 24 | #define FR_COMMAND_ARJ_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | 30 | #define FR_TYPE_COMMAND_ARJ (fr_command_arj_get_type ()) 31 | #define FR_COMMAND_ARJ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_ARJ, FrCommandArj)) 32 | #define FR_COMMAND_ARJ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_ARJ, FrCommandArjClass)) 33 | #define FR_IS_COMMAND_ARJ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_ARJ)) 34 | #define FR_IS_COMMAND_ARJ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_ARJ)) 35 | #define FR_COMMAND_ARJ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_ARJ, FrCommandArjClass)) 36 | 37 | typedef struct _FrCommandArj FrCommandArj; 38 | typedef struct _FrCommandArjClass FrCommandArjClass; 39 | 40 | struct _FrCommandArj 41 | { 42 | FrCommand __parent; 43 | 44 | gboolean list_started; 45 | int line_no; 46 | FileData *fdata; 47 | GRegex *filename_line_regex; 48 | }; 49 | 50 | struct _FrCommandArjClass 51 | { 52 | FrCommandClass __parent_class; 53 | }; 54 | 55 | GType fr_command_arj_get_type (void); 56 | 57 | #endif /* FR_COMMAND_ARJ_H */ 58 | -------------------------------------------------------------------------------- /src/core/fr-command-bsdtar.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * LXQt Archiver 5 | * Copyright (C) 2025 The LXQt team. 6 | */ 7 | 8 | /* 9 | * Copyright (C) 2001 The Free Software Foundation, Inc. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 24 | */ 25 | 26 | #ifndef FR_COMMAND_BSDTAR_H 27 | #define FR_COMMAND_BSDTAR_H 28 | 29 | #include 30 | #include "fr-command.h" 31 | #include "fr-process.h" 32 | 33 | #define FR_TYPE_COMMAND_BSDTAR (fr_command_bsdtar_get_type ()) 34 | #define FR_COMMAND_BSDTAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_BSDTAR, FrCommandBsdtar)) 35 | #define FR_COMMAND_BSDTAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_BSDTAR, FrCommandBsdtarClass)) 36 | #define FR_IS_COMMAND_BSDTAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_BSDTAR)) 37 | #define FR_IS_COMMAND_BSDTAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_BSDTAR)) 38 | #define FR_COMMAND_BSDTAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_BSDTAR, FrCommandBsdtarClass)) 39 | 40 | typedef struct _FrCommandBsdtar FrCommandBsdtar; 41 | typedef struct _FrCommandBsdtarClass FrCommandBsdtarClass; 42 | 43 | struct _FrCommandBsdtar 44 | { 45 | FrCommand __parent; 46 | gboolean is_empty; 47 | }; 48 | 49 | struct _FrCommandBsdtarClass 50 | { 51 | FrCommandClass __parent_class; 52 | }; 53 | 54 | GType fr_command_bsdtar_get_type (void); 55 | 56 | #endif /* FR_COMMAND_BSDTAR_H */ 57 | -------------------------------------------------------------------------------- /src/core/fr-command-cfile.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_CFILE_H 24 | #define FR_COMMAND_CFILE_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "typedefs.h" 29 | 30 | #define FR_TYPE_COMMAND_CFILE (fr_command_cfile_get_type ()) 31 | #define FR_COMMAND_CFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_CFILE, FrCommandCFile)) 32 | #define FR_COMMAND_CFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_CFILE, FrCommandCFileClass)) 33 | #define FR_IS_COMMAND_CFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_CFILE)) 34 | #define FR_IS_COMMAND_CFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_CFILE)) 35 | #define FR_COMMAND_CFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_CFILE, FrCommandCFileClass)) 36 | 37 | typedef struct _FrCommandCFile FrCommandCFile; 38 | typedef struct _FrCommandCFileClass FrCommandCFileClass; 39 | 40 | struct _FrCommandCFile 41 | { 42 | FrCommand __parent; 43 | 44 | /**/ 45 | 46 | FrProcError error; 47 | }; 48 | 49 | struct _FrCommandCFileClass 50 | { 51 | FrCommandClass __parent_class; 52 | }; 53 | 54 | GType fr_command_cfile_get_type (void); 55 | 56 | #endif /* FR_COMMAND_CFILE_H */ 57 | -------------------------------------------------------------------------------- /src/core/fr-command-cpio.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2006 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_CPIO_H 24 | #define FR_COMMAND_CPIO_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | 30 | #define FR_TYPE_COMMAND_CPIO (fr_command_cpio_get_type ()) 31 | #define FR_COMMAND_CPIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_CPIO, FrCommandCpio)) 32 | #define FR_COMMAND_CPIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_CPIO, FrCommandCpioClass)) 33 | #define FR_IS_COMMAND_CPIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_CPIO)) 34 | #define FR_IS_COMMAND_CPIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_CPIO)) 35 | #define FR_COMMAND_CPIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_CPIO, FrCommandCpioClass)) 36 | 37 | typedef struct _FrCommandCpio FrCommandCpio; 38 | typedef struct _FrCommandCpioClass FrCommandCpioClass; 39 | 40 | struct _FrCommandCpio 41 | { 42 | FrCommand __parent; 43 | gboolean is_empty; 44 | }; 45 | 46 | struct _FrCommandCpioClass 47 | { 48 | FrCommandClass __parent_class; 49 | }; 50 | 51 | GType fr_command_cpio_get_type (void); 52 | 53 | #endif /* FR_COMMAND_CPIO_H */ 54 | -------------------------------------------------------------------------------- /src/core/fr-command-dpkg.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_DPKG_H 24 | #define FR_COMMAND_DPKG_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | 30 | #define FR_TYPE_COMMAND_DPKG (fr_command_dpkg_get_type ()) 31 | #define FR_COMMAND_DPKG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_DPKG, FrCommandDpkg)) 32 | #define FR_COMMAND_DPKG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_DPKG, FrCommandDpkgClass)) 33 | #define FR_IS_COMMAND_DPKG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_DPKG)) 34 | #define FR_IS_COMMAND_DPKG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_DPKG)) 35 | #define FR_COMMAND_DPKG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_DPKG, FrCommandDpkgClass)) 36 | 37 | typedef struct _FrCommandDpkg FrCommandDpkg; 38 | typedef struct _FrCommandDpkgClass FrCommandDpkgClass; 39 | 40 | struct _FrCommandDpkg 41 | { 42 | FrCommand __parent; 43 | gboolean is_empty; 44 | }; 45 | 46 | struct _FrCommandDpkgClass 47 | { 48 | FrCommandClass __parent_class; 49 | }; 50 | 51 | GType fr_command_dpkg_get_type (void); 52 | 53 | #endif /* FR_COMMAND_DPKG_H */ 54 | -------------------------------------------------------------------------------- /src/core/fr-command-img.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_IMG_H 24 | #define FR_COMMAND_IMG_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | 30 | #define FR_TYPE_COMMAND_IMG (fr_command_img_get_type ()) 31 | #define FR_COMMAND_IMG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_IMG, FrCommandImg)) 32 | #define FR_COMMAND_IMG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_IMG, FrCommandImgClass)) 33 | #define FR_IS_COMMAND_IMG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_IMG)) 34 | #define FR_IS_COMMAND_IMG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_IMG)) 35 | #define FR_COMMAND_IMG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_IMG, FrCommandImgClass)) 36 | 37 | typedef struct _FrCommandImg FrCommandImg; 38 | typedef struct _FrCommandImgClass FrCommandImgClass; 39 | 40 | struct _FrCommandImg 41 | { 42 | FrCommand __parent; 43 | char *cur_path; 44 | gboolean joliet; 45 | }; 46 | 47 | struct _FrCommandImgClass 48 | { 49 | FrCommandClass __parent_class; 50 | }; 51 | 52 | GType fr_command_img_get_type (void); 53 | 54 | #endif /* FR_COMMAND_IMG_H */ 55 | -------------------------------------------------------------------------------- /src/core/fr-command-iso.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_ISO_H 24 | #define FR_COMMAND_ISO_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | 30 | #define FR_TYPE_COMMAND_ISO (fr_command_iso_get_type ()) 31 | #define FR_COMMAND_ISO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_ISO, FrCommandIso)) 32 | #define FR_COMMAND_ISO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_ISO, FrCommandIsoClass)) 33 | #define FR_IS_COMMAND_ISO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_ISO)) 34 | #define FR_IS_COMMAND_ISO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_ISO)) 35 | #define FR_COMMAND_ISO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_ISO, FrCommandIsoClass)) 36 | 37 | typedef struct _FrCommandIso FrCommandIso; 38 | typedef struct _FrCommandIsoClass FrCommandIsoClass; 39 | 40 | struct _FrCommandIso 41 | { 42 | FrCommand __parent; 43 | char *cur_path; 44 | gboolean joliet; 45 | }; 46 | 47 | struct _FrCommandIsoClass 48 | { 49 | FrCommandClass __parent_class; 50 | }; 51 | 52 | GType fr_command_iso_get_type (void); 53 | 54 | #endif /* FR_COMMAND_ISO_H */ 55 | -------------------------------------------------------------------------------- /src/core/fr-command-jar.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2006 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "file-utils.h" 29 | #include "fr-command.h" 30 | #include "fr-command-zip.h" 31 | #include "fr-command-jar.h" 32 | #include "java-utils.h" 33 | 34 | 35 | typedef struct { 36 | char *filename; 37 | char *rel_path; 38 | char *package_minus_one_level; 39 | char *link_name; /* package dir = package_minus_one_level + '/' + link_name */ 40 | } JarData; 41 | 42 | 43 | static void fr_command_jar_class_init (FrCommandJarClass *class); 44 | static void fr_command_jar_init (FrCommand *afile); 45 | static void fr_command_jar_finalize (GObject *object); 46 | 47 | 48 | static FrCommandClass *parent_class = NULL; 49 | 50 | 51 | static void 52 | fr_command_jar_add (FrCommand *comm, 53 | const char *from_file, 54 | GList *file_list, 55 | const char *base_dir, 56 | gboolean update, 57 | gboolean recursive) 58 | { 59 | FrProcess *proc = comm->process; 60 | GList *zip_list = NULL, *jardata_list = NULL, *jar_list = NULL; 61 | GList *scan; 62 | char *tmp_dir; 63 | 64 | for (scan = file_list; scan; scan = scan->next) { 65 | char *filename = scan->data; 66 | char *path = build_uri (base_dir, filename, NULL); 67 | char *package = NULL; 68 | 69 | if (file_extension_is (filename, ".java")) 70 | package = get_package_name_from_java_file (path); 71 | else if (file_extension_is (filename, ".class")) 72 | package = get_package_name_from_class_file (path); 73 | 74 | if ((package == NULL) || (strlen (package) == 0)) 75 | zip_list = g_list_append (zip_list, g_strdup (filename)); 76 | else { 77 | JarData *newdata = g_new0 (JarData, 1); 78 | 79 | newdata->package_minus_one_level = remove_level_from_path (package); 80 | newdata->link_name = g_strdup (file_name_from_path (package)); 81 | newdata->rel_path = remove_level_from_path (filename); 82 | newdata->filename = g_strdup (file_name_from_path (filename)); 83 | jardata_list = g_list_append (jardata_list, newdata); 84 | } 85 | 86 | g_free (package); 87 | g_free (path); 88 | } 89 | 90 | tmp_dir = get_temp_work_dir (NULL); 91 | for (scan = jardata_list; scan ; scan = scan->next) { 92 | JarData *jdata = scan->data; 93 | char *pack_path; 94 | char *old_link; 95 | char *link_name; 96 | int retval; 97 | 98 | pack_path = build_uri (tmp_dir, jdata->package_minus_one_level, NULL); 99 | if (! make_directory_tree_from_path (pack_path, 0755, NULL)) { 100 | g_free (pack_path); 101 | continue; 102 | } 103 | 104 | old_link = build_uri (base_dir, jdata->rel_path, NULL); 105 | link_name = g_build_filename (pack_path, jdata->link_name, NULL); 106 | 107 | retval = symlink (old_link, link_name); 108 | if ((retval != -1) || (errno == EEXIST)) 109 | jar_list = g_list_append (jar_list, 110 | g_build_filename (jdata->package_minus_one_level, 111 | jdata->link_name, 112 | jdata->filename, 113 | NULL)); 114 | 115 | g_free (link_name); 116 | g_free (old_link); 117 | g_free (pack_path); 118 | } 119 | 120 | if (zip_list != NULL) 121 | parent_class->add (comm, NULL, zip_list, base_dir, update, FALSE); 122 | 123 | if (jar_list != NULL) 124 | parent_class->add (comm, NULL, jar_list, tmp_dir, update, FALSE); 125 | 126 | fr_process_begin_command (proc, "rm"); 127 | fr_process_set_working_dir (proc, "/"); 128 | fr_process_add_arg (proc, "-r"); 129 | fr_process_add_arg (proc, "-f"); 130 | fr_process_add_arg (proc, tmp_dir); 131 | fr_process_end_command (proc); 132 | fr_process_set_sticky (proc, TRUE); 133 | 134 | for (scan = jardata_list; scan ; scan = scan->next) { 135 | JarData *jdata = scan->data; 136 | g_free (jdata->filename); 137 | g_free (jdata->package_minus_one_level); 138 | g_free (jdata->link_name); 139 | g_free (jdata->rel_path); 140 | } 141 | 142 | path_list_free (jardata_list); 143 | path_list_free (jar_list); 144 | path_list_free (zip_list); 145 | g_free (tmp_dir); 146 | } 147 | 148 | 149 | const char *jar_mime_type[] = { "application/x-java-archive", 150 | NULL }; 151 | 152 | 153 | static const char ** 154 | fr_command_jar_get_mime_types (FrCommand *comm) 155 | { 156 | return jar_mime_type; 157 | } 158 | 159 | 160 | static FrCommandCap 161 | fr_command_jar_get_capabilities (FrCommand *comm, 162 | const char *mime_type, 163 | gboolean check_command) 164 | { 165 | FrCommandCap capabilities; 166 | 167 | capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES; 168 | if (is_program_available ("zip", check_command)) 169 | capabilities |= FR_COMMAND_CAN_READ_WRITE; 170 | 171 | return capabilities; 172 | } 173 | 174 | 175 | static const char * 176 | fr_command_jar_get_packages (FrCommand *comm, 177 | const char *mime_type) 178 | { 179 | return PACKAGES ("zip,unzip"); 180 | } 181 | 182 | 183 | static void 184 | fr_command_jar_class_init (FrCommandJarClass *class) 185 | { 186 | GObjectClass *gobject_class = G_OBJECT_CLASS(class); 187 | FrCommandClass *afc = FR_COMMAND_CLASS (class); 188 | 189 | parent_class = g_type_class_peek_parent (class); 190 | 191 | gobject_class->finalize = fr_command_jar_finalize; 192 | 193 | afc->add = fr_command_jar_add; 194 | afc->get_mime_types = fr_command_jar_get_mime_types; 195 | afc->get_capabilities = fr_command_jar_get_capabilities; 196 | afc->get_packages = fr_command_jar_get_packages; 197 | } 198 | 199 | 200 | static void 201 | fr_command_jar_init (FrCommand *comm) 202 | { 203 | } 204 | 205 | 206 | static void 207 | fr_command_jar_finalize (GObject *object) 208 | { 209 | g_return_if_fail (object != NULL); 210 | g_return_if_fail (FR_IS_COMMAND_JAR (object)); 211 | 212 | /* Chain up */ 213 | if (G_OBJECT_CLASS (parent_class)->finalize) 214 | G_OBJECT_CLASS (parent_class)->finalize (object); 215 | } 216 | 217 | 218 | GType 219 | fr_command_jar_get_type () 220 | { 221 | static GType type = 0; 222 | 223 | if (! type) { 224 | GTypeInfo type_info = { 225 | sizeof (FrCommandJarClass), 226 | NULL, 227 | NULL, 228 | (GClassInitFunc) fr_command_jar_class_init, 229 | NULL, 230 | NULL, 231 | sizeof (FrCommandJar), 232 | 0, 233 | (GInstanceInitFunc) fr_command_jar_init 234 | }; 235 | 236 | type = g_type_register_static (FR_TYPE_COMMAND_ZIP, 237 | "FRCommandJar", 238 | &type_info, 239 | 0); 240 | } 241 | 242 | return type; 243 | } 244 | -------------------------------------------------------------------------------- /src/core/fr-command-jar.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2006 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_JAR_H 24 | #define FR_COMMAND_JAR_H 25 | 26 | #include 27 | #include "fr-command-zip.h" 28 | 29 | #define FR_TYPE_COMMAND_JAR (fr_command_jar_get_type ()) 30 | #define FR_COMMAND_JAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_JAR, FrCommandJar)) 31 | #define FR_COMMAND_JAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_JAR, FrCommandJarClass)) 32 | #define FR_IS_COMMAND_JAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_JAR)) 33 | #define FR_IS_COMMAND_JAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_JAR)) 34 | #define FR_COMMAND_JAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_JAR, FrCommandJarClass)) 35 | 36 | typedef struct _FrCommandJar FrCommandJar; 37 | typedef struct _FrCommandJarClass FrCommandJarClass; 38 | 39 | struct _FrCommandJar 40 | { 41 | FrCommandZip __parent; 42 | }; 43 | 44 | struct _FrCommandJarClass 45 | { 46 | FrCommandZipClass __parent_class; 47 | }; 48 | 49 | GType fr_command_jar_get_type (void); 50 | 51 | #endif /* FR_COMMAND_JAR_H */ 52 | -------------------------------------------------------------------------------- /src/core/fr-command-lha.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_LHA_H 24 | #define FR_COMMAND_LHA_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | 30 | #define FR_TYPE_COMMAND_LHA (fr_command_lha_get_type ()) 31 | #define FR_COMMAND_LHA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_LHA, FrCommandLha)) 32 | #define FR_COMMAND_LHA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_LHA, FrCommandLhaClass)) 33 | #define FR_IS_COMMAND_LHA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_LHA)) 34 | #define FR_IS_COMMAND_LHA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_LHA)) 35 | #define FR_COMMAND_LHA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_LHA, FrCommandLhaClass)) 36 | 37 | typedef struct _FrCommandLha FrCommandLha; 38 | typedef struct _FrCommandLhaClass FrCommandLhaClass; 39 | 40 | struct _FrCommandLha 41 | { 42 | FrCommand __parent; 43 | }; 44 | 45 | struct _FrCommandLhaClass 46 | { 47 | FrCommandClass __parent_class; 48 | }; 49 | 50 | GType fr_command_lha_get_type (void); 51 | 52 | #endif /* FR_COMMAND_LHA_H */ 53 | -------------------------------------------------------------------------------- /src/core/fr-command-lrzip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fr-command-lrzip.h 3 | * 4 | * Created on: 10.04.2010 5 | * Author: Alexander Saprykin 6 | */ 7 | 8 | #ifndef FRCOMMANDLRZIP_H_ 9 | #define FRCOMMANDLRZIP_H_ 10 | 11 | #include 12 | #include "fr-command.h" 13 | #include "fr-process.h" 14 | 15 | #define FR_TYPE_COMMAND_LRZIP (fr_command_lrzip_get_type ()) 16 | #define FR_COMMAND_LRZIP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_LRZIP, FrCommandLrzip)) 17 | #define FR_COMMAND_LRZIP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_LRZIP, FrCommandLrzipClass)) 18 | #define FR_IS_COMMAND_LRZIP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_LRZIP)) 19 | #define FR_IS_COMMAND_LRZIP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_LRZIP)) 20 | #define FR_COMMAND_LRZIP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_LRZIP, FrCommandLrzipClass)) 21 | 22 | typedef struct _FrCommandLrzip FrCommandLrzip; 23 | typedef struct _FrCommandLrzipClass FrCommandLrzipClass; 24 | 25 | struct _FrCommandLrzip 26 | { 27 | FrCommand __parent; 28 | }; 29 | 30 | struct _FrCommandLrzipClass 31 | { 32 | FrCommandClass __parent_class; 33 | }; 34 | 35 | GType fr_command_lrzip_get_type (void); 36 | 37 | #endif /* FRCOMMANDLRZIP_H_ */ 38 | -------------------------------------------------------------------------------- /src/core/fr-command-rar.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_RAR_H 24 | #define FR_COMMAND_RAR_H 25 | 26 | #include 27 | #include "file-data.h" 28 | #include "fr-command.h" 29 | #include "fr-process.h" 30 | 31 | #define FR_TYPE_COMMAND_RAR (fr_command_rar_get_type ()) 32 | #define FR_COMMAND_RAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_RAR, FrCommandRar)) 33 | #define FR_COMMAND_RAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_RAR, FrCommandRarClass)) 34 | #define FR_IS_COMMAND_RAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_RAR)) 35 | #define FR_IS_COMMAND_RAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_RAR)) 36 | #define FR_COMMAND_RAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_RAR, FrCommandRarClass)) 37 | 38 | typedef struct _FrCommandRar FrCommandRar; 39 | typedef struct _FrCommandRarClass FrCommandRarClass; 40 | 41 | struct _FrCommandRar 42 | { 43 | FrCommand __parent; 44 | 45 | gboolean list_started; 46 | gboolean rar4_odd_line; 47 | gboolean rar5; 48 | FileData *fdata; 49 | }; 50 | 51 | struct _FrCommandRarClass 52 | { 53 | FrCommandClass __parent_class; 54 | }; 55 | 56 | GType fr_command_rar_get_type (void); 57 | 58 | #endif /* FR_COMMAND_RAR_H */ 59 | -------------------------------------------------------------------------------- /src/core/fr-command-rpm.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_RPM_H 24 | #define FR_COMMAND_RPM_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | 30 | #define FR_TYPE_COMMAND_RPM (fr_command_rpm_get_type ()) 31 | #define FR_COMMAND_RPM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_RPM, FrCommandRpm)) 32 | #define FR_COMMAND_RPM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_RPM, FrCommandRpmClass)) 33 | #define FR_IS_COMMAND_RPM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_RPM)) 34 | #define FR_IS_COMMAND_RPM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_RPM)) 35 | #define FR_COMMAND_RPM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_RPM, FrCommandRpmClass)) 36 | 37 | typedef struct _FrCommandRpm FrCommandRpm; 38 | typedef struct _FrCommandRpmClass FrCommandRpmClass; 39 | 40 | struct _FrCommandRpm 41 | { 42 | FrCommand __parent; 43 | gboolean is_empty; 44 | }; 45 | 46 | struct _FrCommandRpmClass 47 | { 48 | FrCommandClass __parent_class; 49 | }; 50 | 51 | GType fr_command_rpm_get_type (void); 52 | 53 | #endif /* FR_COMMAND_RPM_H */ 54 | -------------------------------------------------------------------------------- /src/core/fr-command-tar.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_TAR_H 24 | #define FR_COMMAND_TAR_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | #include "typedefs.h" 30 | 31 | #define FR_TYPE_COMMAND_TAR (fr_command_tar_get_type ()) 32 | #define FR_COMMAND_TAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_TAR, FrCommandTar)) 33 | #define FR_COMMAND_TAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_TAR, FrCommandTarClass)) 34 | #define FR_IS_COMMAND_TAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_TAR)) 35 | #define FR_IS_COMMAND_TAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_TAR)) 36 | #define FR_COMMAND_TAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_TAR, FrCommandTarClass)) 37 | 38 | typedef struct _FrCommandTar FrCommandTar; 39 | typedef struct _FrCommandTarClass FrCommandTarClass; 40 | 41 | struct _FrCommandTar 42 | { 43 | FrCommand __parent; 44 | 45 | /**/ 46 | 47 | char *uncomp_filename; 48 | gboolean name_modified; 49 | char *compress_command; 50 | 51 | char *msg; 52 | }; 53 | 54 | struct _FrCommandTarClass 55 | { 56 | FrCommandClass __parent_class; 57 | }; 58 | 59 | GType fr_command_tar_get_type (void); 60 | 61 | #endif /* FR_COMMAND_TAR_H */ 62 | -------------------------------------------------------------------------------- /src/core/fr-command-unarchiver.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * File-Roller 5 | * 6 | * Copyright (C) 2012 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #ifndef FR_COMMAND_UNARCHIVER_H 23 | #define FR_COMMAND_UNARCHIVER_H 24 | 25 | #include 26 | #include "file-data.h" 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | 30 | #define FR_TYPE_COMMAND_UNARCHIVER (fr_command_unarchiver_get_type ()) 31 | #define FR_COMMAND_UNARCHIVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_UNARCHIVER, FrCommandUnarchiver)) 32 | #define FR_COMMAND_UNARCHIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_UNARCHIVER, FrCommandUnarchiverClass)) 33 | #define FR_IS_COMMAND_UNARCHIVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_UNARCHIVER)) 34 | #define FR_IS_COMMAND_UNARCHIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_UNARCHIVER)) 35 | #define FR_COMMAND_UNARCHIVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_UNARCHIVER, FrCommandUnarchiverClass)) 36 | 37 | typedef struct _FrCommandUnarchiver FrCommandUnarchiver; 38 | typedef struct _FrCommandUnarchiverClass FrCommandUnarchiverClass; 39 | 40 | struct _FrCommandUnarchiver 41 | { 42 | FrCommand __parent; 43 | 44 | GInputStream *stream; 45 | int n_line; 46 | }; 47 | 48 | struct _FrCommandUnarchiverClass 49 | { 50 | FrCommandClass __parent_class; 51 | }; 52 | 53 | GType fr_command_unarchiver_get_type (void); 54 | 55 | #endif /* FR_COMMAND_UNARCHIVER_H */ 56 | -------------------------------------------------------------------------------- /src/core/fr-command-unstuff.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_UNSTUFF_H 24 | #define FR_COMMAND_UNSTUFF_H 25 | 26 | #include 27 | #include "file-data.h" 28 | #include "fr-command.h" 29 | #include "fr-process.h" 30 | 31 | #define FR_TYPE_COMMAND_UNSTUFF (fr_command_unstuff_get_type ()) 32 | #define FR_COMMAND_UNSTUFF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_UNSTUFF, FrCommandUnstuff)) 33 | #define FR_COMMAND_UNSTUFF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_UNSTUFF, FrCommandUnstuffClass)) 34 | #define FR_IS_COMMAND_UNSTUFF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_UNSTUFF)) 35 | #define FR_IS_COMMAND_UNSTUFF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_UNSTUFF)) 36 | #define FR_COMMAND_UNSTUFF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_UNSTUFF, FrCommandUnstuffClass)) 37 | 38 | typedef struct _FrCommandUnstuff FrCommandUnstuff; 39 | typedef struct _FrCommandUnstuffClass FrCommandUnstuffClass; 40 | 41 | struct _FrCommandUnstuff 42 | { 43 | FrCommand __parent; 44 | 45 | char *target_dir; 46 | FileData *fdata; 47 | }; 48 | 49 | struct _FrCommandUnstuffClass 50 | { 51 | FrCommandClass __parent_class; 52 | }; 53 | 54 | GType fr_command_unstuff_get_type (void); 55 | 56 | #endif /* FR_COMMAND_UNSTUFF_H */ 57 | -------------------------------------------------------------------------------- /src/core/fr-command-zip.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_ZIP_H 24 | #define FR_COMMAND_ZIP_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | 30 | #define FR_TYPE_COMMAND_ZIP (fr_command_zip_get_type ()) 31 | #define FR_COMMAND_ZIP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_ZIP, FrCommandZip)) 32 | #define FR_COMMAND_ZIP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_ZIP, FrCommandZipClass)) 33 | #define FR_IS_COMMAND_ZIP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_ZIP)) 34 | #define FR_IS_COMMAND_ZIP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_ZIP)) 35 | #define FR_COMMAND_ZIP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_ZIP, FrCommandZipClass)) 36 | 37 | typedef struct _FrCommandZip FrCommandZip; 38 | typedef struct _FrCommandZipClass FrCommandZipClass; 39 | 40 | struct _FrCommandZip 41 | { 42 | FrCommand __parent; 43 | gboolean is_empty; 44 | }; 45 | 46 | struct _FrCommandZipClass 47 | { 48 | FrCommandClass __parent_class; 49 | }; 50 | 51 | GType fr_command_zip_get_type (void); 52 | 53 | #endif /* FR_COMMAND_ZIP_H */ 54 | -------------------------------------------------------------------------------- /src/core/fr-command-zoo.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2003 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_COMMAND_ZOO_H 24 | #define FR_COMMAND_ZOO_H 25 | 26 | #include 27 | #include "fr-command.h" 28 | #include "fr-process.h" 29 | #include "typedefs.h" 30 | 31 | #define FR_TYPE_COMMAND_ZOO (fr_command_zoo_get_type ()) 32 | #define FR_COMMAND_ZOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND_ZOO, FrCommandZoo)) 33 | #define FR_COMMAND_ZOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND_ZOO, FrCommandZooClass)) 34 | #define FR_IS_COMMAND_ZOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND_ZOO)) 35 | #define FR_IS_COMMAND_ZOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND_ZOO)) 36 | #define FR_COMMAND_ZOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND_ZOO, FrCommandZooClass)) 37 | 38 | typedef struct _FrCommandZoo FrCommandZoo; 39 | typedef struct _FrCommandZooClass FrCommandZooClass; 40 | 41 | struct _FrCommandZoo 42 | { 43 | FrCommand __parent; 44 | }; 45 | 46 | struct _FrCommandZooClass 47 | { 48 | FrCommandClass __parent_class; 49 | }; 50 | 51 | GType fr_command_zoo_get_type (void); 52 | 53 | #endif /* FR_COMMAND_ZOO_H */ 54 | -------------------------------------------------------------------------------- /src/core/fr-enum-types.c: -------------------------------------------------------------------------------- 1 | 2 | /* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ 3 | 4 | #include 5 | 6 | /* enumerations from "typedefs.h" */ 7 | #include "typedefs.h" 8 | GType 9 | fr_compression_get_type (void) 10 | { 11 | static GType etype = 0; 12 | if (etype == 0) { 13 | static const GEnumValue values[] = { 14 | { FR_COMPRESSION_VERY_FAST, "FR_COMPRESSION_VERY_FAST", "very-fast" }, 15 | { FR_COMPRESSION_FAST, "FR_COMPRESSION_FAST", "fast" }, 16 | { FR_COMPRESSION_NORMAL, "FR_COMPRESSION_NORMAL", "normal" }, 17 | { FR_COMPRESSION_MAXIMUM, "FR_COMPRESSION_MAXIMUM", "maximum" }, 18 | { 0, NULL, NULL } 19 | }; 20 | etype = g_enum_register_static ("FrCompression", values); 21 | } 22 | return etype; 23 | } 24 | GType 25 | fr_overwrite_get_type (void) 26 | { 27 | static GType etype = 0; 28 | if (etype == 0) { 29 | static const GEnumValue values[] = { 30 | { FR_OVERWRITE_YES, "FR_OVERWRITE_YES", "yes" }, 31 | { FR_OVERWRITE_NO, "FR_OVERWRITE_NO", "no" }, 32 | { FR_OVERWRITE_ASK, "FR_OVERWRITE_ASK", "ask" }, 33 | { 0, NULL, NULL } 34 | }; 35 | etype = g_enum_register_static ("FrOverwrite", values); 36 | } 37 | return etype; 38 | } 39 | 40 | /* Generated data ends here */ 41 | 42 | -------------------------------------------------------------------------------- /src/core/fr-enum-types.h: -------------------------------------------------------------------------------- 1 | 2 | /* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ 3 | 4 | #ifndef FR_ENUM_TYPES_H 5 | #define FR_ENUM_TYPES_H 6 | 7 | #include 8 | 9 | G_BEGIN_DECLS 10 | /* enumerations from "typedefs.h" */ 11 | GType fr_compression_get_type (void); 12 | #define FR_TYPE_COMPRESSION (fr_compression_get_type()) 13 | GType fr_overwrite_get_type (void); 14 | #define FR_TYPE_OVERWRITE (fr_overwrite_get_type()) 15 | G_END_DECLS 16 | 17 | #endif /* FR_ENUM_TYPES_H */ 18 | 19 | /* Generated data ends here */ 20 | 21 | -------------------------------------------------------------------------------- /src/core/fr-error.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2003 Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | 24 | #include "fr-error.h" 25 | 26 | 27 | GQuark 28 | fr_error_quark (void) 29 | { 30 | static GQuark quark; 31 | 32 | if (!quark) 33 | quark = g_quark_from_static_string ("engrampa-error"); 34 | 35 | return quark; 36 | } 37 | -------------------------------------------------------------------------------- /src/core/fr-error.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2003 Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __FR_ERROR_H__ 24 | #define __FR_ERROR_H__ 25 | 26 | #include 27 | 28 | #define FR_ERROR fr_error_quark () 29 | GQuark fr_error_quark (void); 30 | 31 | 32 | #endif /* __FR_ERROR_H__ */ 33 | -------------------------------------------------------------------------------- /src/core/fr-init.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2010 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #ifndef FR_INIT_H 23 | #define FR_INIT_H 24 | 25 | #include 26 | 27 | /* #include "preferences.h" */ 28 | #include "fr-process.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | typedef struct { 33 | // FrWindow *window; 34 | FrProcess *process; 35 | char *filename; 36 | char *e_filename; 37 | char *temp_dir; 38 | } ViewerData; 39 | 40 | typedef struct { 41 | // FrWindow *window; 42 | FrProcess *process; 43 | char *command; 44 | GAppInfo *app; 45 | GList *file_list; 46 | char *temp_dir; 47 | } CommandData; 48 | 49 | extern GList *CommandList; 50 | extern gint ForceDirectoryCreation; 51 | extern GHashTable *ProgramsCache; 52 | extern GPtrArray *Registered_Commands; 53 | extern FrMimeTypeDescription mime_type_desc[]; 54 | extern FrExtensionType file_ext_type[]; 55 | extern int single_file_save_type[]; /* File types that can be saved when 56 | * a single file is selected. 57 | * Includes single file compressors 58 | * such as gzip, compress, etc. */ 59 | extern int save_type[]; /* File types that can be saved. */ 60 | extern int open_type[]; /* File types that can be opened. */ 61 | extern int create_type[]; /* File types that can be created. */ 62 | 63 | GType get_command_type_from_mime_type (const char *mime_type, 64 | FrCommandCaps requested_capabilities); 65 | GType get_preferred_command_for_mime_type (const char *mime_type, 66 | FrCommandCaps requested_capabilities); 67 | void update_registered_commands_capabilities (void); 68 | const char * get_mime_type_from_extension (const char *ext); 69 | const char * get_archive_filename_extension (const char *uri); 70 | int get_mime_type_index (const char *mime_type); 71 | void sort_mime_types_by_extension (int *a); 72 | void sort_mime_types_by_description (int *a); 73 | void initialize_data (void); 74 | void release_data (void); 75 | 76 | G_END_DECLS 77 | 78 | #endif /* FR_INIT_H */ 79 | -------------------------------------------------------------------------------- /src/core/fr-marshal.c: -------------------------------------------------------------------------------- 1 | #include "fr-marshal.h" 2 | /* This file is generated by glib-genmarshal, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ 3 | #include 4 | 5 | #ifdef G_ENABLE_DEBUG 6 | #define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) 7 | #define g_marshal_value_peek_char(v) g_value_get_schar (v) 8 | #define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) 9 | #define g_marshal_value_peek_int(v) g_value_get_int (v) 10 | #define g_marshal_value_peek_uint(v) g_value_get_uint (v) 11 | #define g_marshal_value_peek_long(v) g_value_get_long (v) 12 | #define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) 13 | #define g_marshal_value_peek_int64(v) g_value_get_int64 (v) 14 | #define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) 15 | #define g_marshal_value_peek_enum(v) g_value_get_enum (v) 16 | #define g_marshal_value_peek_flags(v) g_value_get_flags (v) 17 | #define g_marshal_value_peek_float(v) g_value_get_float (v) 18 | #define g_marshal_value_peek_double(v) g_value_get_double (v) 19 | #define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) 20 | #define g_marshal_value_peek_param(v) g_value_get_param (v) 21 | #define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) 22 | #define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) 23 | #define g_marshal_value_peek_object(v) g_value_get_object (v) 24 | #define g_marshal_value_peek_variant(v) g_value_get_variant (v) 25 | #else /* !G_ENABLE_DEBUG */ 26 | /* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. 27 | * Do not access GValues directly in your code. Instead, use the 28 | * g_value_get_*() functions 29 | */ 30 | #define g_marshal_value_peek_boolean(v) (v)->data[0].v_int 31 | #define g_marshal_value_peek_char(v) (v)->data[0].v_int 32 | #define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint 33 | #define g_marshal_value_peek_int(v) (v)->data[0].v_int 34 | #define g_marshal_value_peek_uint(v) (v)->data[0].v_uint 35 | #define g_marshal_value_peek_long(v) (v)->data[0].v_long 36 | #define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong 37 | #define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 38 | #define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 39 | #define g_marshal_value_peek_enum(v) (v)->data[0].v_long 40 | #define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong 41 | #define g_marshal_value_peek_float(v) (v)->data[0].v_float 42 | #define g_marshal_value_peek_double(v) (v)->data[0].v_double 43 | #define g_marshal_value_peek_string(v) (v)->data[0].v_pointer 44 | #define g_marshal_value_peek_param(v) (v)->data[0].v_pointer 45 | #define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer 46 | #define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer 47 | #define g_marshal_value_peek_object(v) (v)->data[0].v_pointer 48 | #define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer 49 | #endif /* !G_ENABLE_DEBUG */ 50 | 51 | /* VOID:INT,INT (fr-marshal.list:2) */ 52 | void 53 | fr_marshal_VOID__INT_INT (GClosure *closure, 54 | GValue *return_value G_GNUC_UNUSED, 55 | guint n_param_values, 56 | const GValue *param_values, 57 | gpointer invocation_hint G_GNUC_UNUSED, 58 | gpointer marshal_data) 59 | { 60 | typedef void (*GMarshalFunc_VOID__INT_INT) (gpointer data1, 61 | gint arg1, 62 | gint arg2, 63 | gpointer data2); 64 | GCClosure *cc = (GCClosure *) closure; 65 | gpointer data1, data2; 66 | GMarshalFunc_VOID__INT_INT callback; 67 | 68 | g_return_if_fail (n_param_values == 3); 69 | 70 | if (G_CCLOSURE_SWAP_DATA (closure)) 71 | { 72 | data1 = closure->data; 73 | data2 = g_value_peek_pointer (param_values + 0); 74 | } 75 | else 76 | { 77 | data1 = g_value_peek_pointer (param_values + 0); 78 | data2 = closure->data; 79 | } 80 | callback = (GMarshalFunc_VOID__INT_INT) (marshal_data ? marshal_data : cc->callback); 81 | 82 | callback (data1, 83 | g_marshal_value_peek_int (param_values + 1), 84 | g_marshal_value_peek_int (param_values + 2), 85 | data2); 86 | } 87 | 88 | /* VOID:INT,BOXED (fr-marshal.list:3) */ 89 | void 90 | fr_marshal_VOID__INT_BOXED (GClosure *closure, 91 | GValue *return_value G_GNUC_UNUSED, 92 | guint n_param_values, 93 | const GValue *param_values, 94 | gpointer invocation_hint G_GNUC_UNUSED, 95 | gpointer marshal_data) 96 | { 97 | typedef void (*GMarshalFunc_VOID__INT_BOXED) (gpointer data1, 98 | gint arg1, 99 | gpointer arg2, 100 | gpointer data2); 101 | GCClosure *cc = (GCClosure *) closure; 102 | gpointer data1, data2; 103 | GMarshalFunc_VOID__INT_BOXED callback; 104 | 105 | g_return_if_fail (n_param_values == 3); 106 | 107 | if (G_CCLOSURE_SWAP_DATA (closure)) 108 | { 109 | data1 = closure->data; 110 | data2 = g_value_peek_pointer (param_values + 0); 111 | } 112 | else 113 | { 114 | data1 = g_value_peek_pointer (param_values + 0); 115 | data2 = closure->data; 116 | } 117 | callback = (GMarshalFunc_VOID__INT_BOXED) (marshal_data ? marshal_data : cc->callback); 118 | 119 | callback (data1, 120 | g_marshal_value_peek_int (param_values + 1), 121 | g_marshal_value_peek_boxed (param_values + 2), 122 | data2); 123 | } 124 | 125 | /* VOID:DOUBLE,STRING (fr-marshal.list:7) */ 126 | void 127 | fr_marshal_VOID__DOUBLE_STRING (GClosure *closure, 128 | GValue *return_value G_GNUC_UNUSED, 129 | guint n_param_values, 130 | const GValue *param_values, 131 | gpointer invocation_hint G_GNUC_UNUSED, 132 | gpointer marshal_data) 133 | { 134 | typedef void (*GMarshalFunc_VOID__DOUBLE_STRING) (gpointer data1, 135 | gdouble arg1, 136 | gpointer arg2, 137 | gpointer data2); 138 | GCClosure *cc = (GCClosure *) closure; 139 | gpointer data1, data2; 140 | GMarshalFunc_VOID__DOUBLE_STRING callback; 141 | 142 | g_return_if_fail (n_param_values == 3); 143 | 144 | if (G_CCLOSURE_SWAP_DATA (closure)) 145 | { 146 | data1 = closure->data; 147 | data2 = g_value_peek_pointer (param_values + 0); 148 | } 149 | else 150 | { 151 | data1 = g_value_peek_pointer (param_values + 0); 152 | data2 = closure->data; 153 | } 154 | callback = (GMarshalFunc_VOID__DOUBLE_STRING) (marshal_data ? marshal_data : cc->callback); 155 | 156 | callback (data1, 157 | g_marshal_value_peek_double (param_values + 1), 158 | g_marshal_value_peek_string (param_values + 2), 159 | data2); 160 | } 161 | 162 | -------------------------------------------------------------------------------- /src/core/fr-marshal.h: -------------------------------------------------------------------------------- 1 | /* This file is generated by glib-genmarshal, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ 2 | #ifndef __FR_MARSHAL_MARSHAL_H__ 3 | #define __FR_MARSHAL_MARSHAL_H__ 4 | 5 | #include 6 | 7 | G_BEGIN_DECLS 8 | 9 | /* VOID:INT (fr-marshal.list:1) */ 10 | #define fr_marshal_VOID__INT g_cclosure_marshal_VOID__INT 11 | 12 | /* VOID:INT,INT (fr-marshal.list:2) */ 13 | extern 14 | void fr_marshal_VOID__INT_INT (GClosure *closure, 15 | GValue *return_value, 16 | guint n_param_values, 17 | const GValue *param_values, 18 | gpointer invocation_hint, 19 | gpointer marshal_data); 20 | 21 | /* VOID:INT,BOXED (fr-marshal.list:3) */ 22 | extern 23 | void fr_marshal_VOID__INT_BOXED (GClosure *closure, 24 | GValue *return_value, 25 | guint n_param_values, 26 | const GValue *param_values, 27 | gpointer invocation_hint, 28 | gpointer marshal_data); 29 | 30 | /* VOID:POINTER (fr-marshal.list:4) */ 31 | #define fr_marshal_VOID__POINTER g_cclosure_marshal_VOID__POINTER 32 | 33 | /* VOID:VOID (fr-marshal.list:5) */ 34 | #define fr_marshal_VOID__VOID g_cclosure_marshal_VOID__VOID 35 | 36 | /* VOID:DOUBLE (fr-marshal.list:6) */ 37 | #define fr_marshal_VOID__DOUBLE g_cclosure_marshal_VOID__DOUBLE 38 | 39 | /* VOID:DOUBLE,STRING (fr-marshal.list:7) */ 40 | extern 41 | void fr_marshal_VOID__DOUBLE_STRING (GClosure *closure, 42 | GValue *return_value, 43 | guint n_param_values, 44 | const GValue *param_values, 45 | gpointer invocation_hint, 46 | gpointer marshal_data); 47 | 48 | /* VOID:STRING (fr-marshal.list:8) */ 49 | #define fr_marshal_VOID__STRING g_cclosure_marshal_VOID__STRING 50 | 51 | /* VOID:BOOL (fr-marshal.list:9) */ 52 | #define fr_marshal_VOID__BOOLEAN g_cclosure_marshal_VOID__BOOLEAN 53 | 54 | #define fr_marshal_VOID__BOOL fr_marshal_VOID__BOOLEAN 55 | 56 | /* VOID:BOXED (fr-marshal.list:10) */ 57 | #define fr_marshal_VOID__BOXED g_cclosure_marshal_VOID__BOXED 58 | 59 | 60 | G_END_DECLS 61 | 62 | #endif /* __FR_MARSHAL_MARSHAL_H__ */ 63 | -------------------------------------------------------------------------------- /src/core/fr-proc-error.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * File-Roller 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include "fr-proc-error.h" 24 | 25 | 26 | static gpointer 27 | fr_proc_error_copy (gpointer boxed) 28 | { 29 | FrProcError *old_error = boxed; 30 | FrProcError *new_error; 31 | 32 | new_error = g_new (FrProcError, 1); 33 | new_error->type = old_error->type; 34 | new_error->status = old_error->status; 35 | new_error->gerror = (old_error->gerror != NULL) ? g_error_copy (old_error->gerror) : NULL; 36 | 37 | return new_error; 38 | } 39 | 40 | 41 | static void 42 | fr_proc_error_free (gpointer boxed) 43 | { 44 | FrProcError *error = boxed; 45 | 46 | if (error->gerror != NULL) 47 | g_error_free (error->gerror); 48 | g_free (error); 49 | } 50 | 51 | 52 | G_DEFINE_BOXED_TYPE (FrProcError, 53 | fr_proc_error, 54 | fr_proc_error_copy, 55 | fr_proc_error_free) 56 | -------------------------------------------------------------------------------- /src/core/fr-proc-error.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * File-Roller 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #ifndef FR_PROC_ERROR_H 23 | #define FR_PROC_ERROR_H 24 | 25 | #include "typedefs.h" 26 | 27 | #define FR_TYPE_PROC_ERROR (fr_proc_error_get_type ()) 28 | 29 | GType fr_proc_error_get_type (void); 30 | 31 | #endif /* FR_PROC_ERROR_H */ 32 | -------------------------------------------------------------------------------- /src/core/fr-process.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001, 2003, 2008 Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef FR_PROCESS_H 24 | #define FR_PROCESS_H 25 | 26 | #include 27 | #include 28 | #include "typedefs.h" 29 | 30 | #define FR_TYPE_PROCESS (fr_process_get_type ()) 31 | #define FR_PROCESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_PROCESS, FrProcess)) 32 | #define FR_PROCESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_PROCESS, FrProcessClass)) 33 | #define FR_IS_PROCESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_PROCESS)) 34 | #define FR_IS_PROCESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_PROCESS)) 35 | #define FR_PROCESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_PROCESS, FrProcessClass)) 36 | 37 | typedef struct _FrProcess FrProcess; 38 | typedef struct _FrProcessClass FrProcessClass; 39 | typedef struct _FrProcessPrivate FrProcessPrivate; 40 | 41 | typedef void (*ProcFunc) (gpointer data); 42 | typedef gboolean (*ContinueFunc) (gpointer data); 43 | typedef void (*LineFunc) (char *line, gpointer data); 44 | 45 | typedef struct { 46 | GIOChannel *source; 47 | GList *raw; 48 | LineFunc line_func; 49 | gpointer line_data; 50 | GIOStatus status; 51 | GError *error; 52 | } FrChannelData; 53 | 54 | struct _FrProcess { 55 | GObject __parent; 56 | 57 | /*< public >*/ 58 | 59 | gboolean term_on_stop; /* whether we must terminate the 60 | * command when calling 61 | * fr_process_stop. */ 62 | 63 | /*< public read-only >*/ 64 | 65 | FrChannelData out; 66 | FrChannelData err; 67 | FrProcError error; 68 | 69 | /*< protected >*/ 70 | 71 | gboolean restart; /* whether to restart the process 72 | * after an error. */ 73 | 74 | FrProcessPrivate *priv; 75 | }; 76 | 77 | struct _FrProcessClass { 78 | GObjectClass __parent_class; 79 | 80 | /* -- Signals -- */ 81 | 82 | void (* start) (FrProcess *fr_proc); 83 | void (* done) (FrProcess *fr_proc, 84 | FrProcError *error); 85 | void (* sticky_only) (FrProcess *fr_proc); 86 | }; 87 | 88 | GType fr_process_get_type (void); 89 | FrProcess * fr_process_new (void); 90 | void fr_process_clear (FrProcess *fr_proc); 91 | void fr_process_begin_command (FrProcess *fr_proc, 92 | const char *arg); 93 | void fr_process_begin_command_at (FrProcess *fr_proc, 94 | const char *arg, 95 | int index); 96 | void fr_process_add_arg (FrProcess *fr_proc, 97 | const char *arg); 98 | void fr_process_add_arg_concat (FrProcess *fr_proc, 99 | const char *arg, 100 | ...) G_GNUC_NULL_TERMINATED; 101 | void fr_process_add_arg_printf (FrProcess *fr_proc, 102 | const char *format, 103 | ...) G_GNUC_PRINTF (2, 3); 104 | void fr_process_set_arg_at (FrProcess *fr_proc, 105 | int n_comm, 106 | int n_arg, 107 | const char *arg); 108 | void fr_process_set_begin_func (FrProcess *fr_proc, 109 | ProcFunc func, 110 | gpointer func_data); 111 | void fr_process_set_end_func (FrProcess *fr_proc, 112 | ProcFunc func, 113 | gpointer func_data); 114 | void fr_process_set_continue_func (FrProcess *fr_proc, 115 | ContinueFunc func, 116 | gpointer func_data); 117 | void fr_process_end_command (FrProcess *fr_proc); 118 | void fr_process_set_working_dir (FrProcess *fr_proc, 119 | const char *arg); 120 | void fr_process_set_sticky (FrProcess *fr_proc, 121 | gboolean sticky); 122 | void fr_process_set_ignore_error (FrProcess *fr_proc, 123 | gboolean ignore_error); 124 | void fr_process_use_standard_locale (FrProcess *fr_proc, 125 | gboolean use_stand_locale); 126 | void fr_process_set_out_line_func (FrProcess *fr_proc, 127 | LineFunc func, 128 | gpointer func_data); 129 | void fr_process_set_err_line_func (FrProcess *fr_proc, 130 | LineFunc func, 131 | gpointer func_data); 132 | void fr_process_start (FrProcess *fr_proc); 133 | void fr_process_stop (FrProcess *fr_proc); 134 | 135 | #endif /* FR_PROCESS_H */ 136 | -------------------------------------------------------------------------------- /src/core/gio-utils.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2008 Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef _GIO_UTILS_H 24 | #define _GIO_UTILS_H 25 | 26 | #include 27 | #include 28 | 29 | /* callback types */ 30 | 31 | typedef enum { 32 | DIR_OP_CONTINUE, 33 | DIR_OP_SKIP, 34 | DIR_OP_STOP 35 | } DirOp; 36 | 37 | typedef DirOp (*StartDirCallback) (const char *uri, 38 | GError **error, 39 | gpointer user_data); 40 | typedef void (*ForEachChildCallback) (const char *uri, 41 | GFileInfo *info, 42 | gpointer user_data); 43 | typedef void (*ForEachDoneCallback) (GError *error, 44 | gpointer data); 45 | typedef void (*ListReadyCallback) (GList *files, 46 | GList *dirs, 47 | GError *error, 48 | gpointer user_data); 49 | typedef void (*CopyProgressCallback) (goffset current_file, 50 | goffset total_files, 51 | GFile *source, 52 | GFile *destination, 53 | goffset current_num_bytes, 54 | goffset total_num_bytes, 55 | gpointer user_data); 56 | typedef void (*CopyDoneCallback) (GError *error, 57 | gpointer user_data); 58 | 59 | /* asynchronous recursive list functions */ 60 | 61 | void g_directory_foreach_child (GFile *directory, 62 | gboolean recursive, 63 | gboolean follow_links, 64 | GCancellable *cancellable, 65 | StartDirCallback start_dir_func, 66 | ForEachChildCallback for_each_file_func, 67 | ForEachDoneCallback done_func, 68 | gpointer user_data); 69 | void g_directory_list_async (const char *directory, 70 | const char *base_dir, 71 | gboolean recursive, 72 | gboolean follow_links, 73 | gboolean no_backup_files, 74 | gboolean no_dot_files, 75 | const char *include_files, 76 | const char *exclude_files, 77 | const char *exclude_folders, 78 | gboolean ignorecase, 79 | GCancellable *cancellable, 80 | ListReadyCallback done_func, 81 | gpointer done_data); 82 | void g_list_items_async (GList *items, 83 | const char *base_dir, 84 | GCancellable *cancellable, 85 | ListReadyCallback done_func, 86 | gpointer done_data); 87 | 88 | /* asynchronous copy functions */ 89 | 90 | void g_copy_files_async (GList *sources, 91 | GList *destinations, 92 | GFileCopyFlags flags, 93 | int io_priority, 94 | GCancellable *cancellable, 95 | CopyProgressCallback progress_callback, 96 | gpointer progress_callback_data, 97 | CopyDoneCallback callback, 98 | gpointer user_data); 99 | /*void g_copy_uris_async (GList *sources, 100 | GList *destinations, 101 | GFileCopyFlags flags, 102 | int io_priority, 103 | GCancellable *cancellable, 104 | CopyProgressCallback progress_callback, 105 | gpointer progress_callback_data, 106 | CopyDoneCallback callback, 107 | gpointer user_data);*/ 108 | void g_copy_file_async (GFile *source, 109 | GFile *destination, 110 | GFileCopyFlags flags, 111 | int io_priority, 112 | GCancellable *cancellable, 113 | CopyProgressCallback progress_callback, 114 | gpointer progress_callback_data, 115 | CopyDoneCallback callback, 116 | gpointer user_data); 117 | /*void g_copy_uri_async (const char *source, 118 | const char *destination, 119 | GFileCopyFlags flags, 120 | int io_priority, 121 | GCancellable *cancellable, 122 | CopyProgressCallback progress_callback, 123 | gpointer progress_callback_data, 124 | CopyDoneCallback callback, 125 | gpointer user_data);*/ 126 | void g_directory_copy_async (const char *source, 127 | const char *destination, 128 | GFileCopyFlags flags, 129 | int io_priority, 130 | GCancellable *cancellable, 131 | CopyProgressCallback progress_callback, 132 | gpointer progress_callback_data, 133 | CopyDoneCallback callback, 134 | gpointer user_data); 135 | gboolean g_load_file_in_buffer (GFile *file, 136 | void *buffer, 137 | gsize size, 138 | GError **error); 139 | 140 | /* convenience macros */ 141 | 142 | /** 143 | * g_directory_list_all_async: 144 | * @directory: 145 | * @base_dir: 146 | * @recursive: 147 | * @cancellable: 148 | * @done_func: 149 | * @done_data: 150 | * 151 | */ 152 | #define g_directory_list_all_async(directory, base_dir, recursive, cancellable, done_func, done_data) \ 153 | g_directory_list_async ((directory), (base_dir), (recursive), TRUE, FALSE, FALSE, NULL, NULL, NULL, FALSE, (cancellable), (done_func), (done_data)) 154 | 155 | #endif /* _GIO_UTILS_H */ 156 | -------------------------------------------------------------------------------- /src/core/glib-utils.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2005 Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef _GLIB_UTILS_H 24 | #define _GLIB_UTILS_H 25 | 26 | #include 27 | 28 | #define g_signal_handlers_disconnect_by_data(instance, data) \ 29 | g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, \ 30 | 0, 0, NULL, NULL, (data)) 31 | 32 | /* gobject utils */ 33 | 34 | gpointer _g_object_ref (gpointer object); 35 | void _g_object_unref (gpointer object); 36 | 37 | /* string utils */ 38 | 39 | gboolean strchrs (const char *str, 40 | const char *chars); 41 | char * str_substitute (const char *str, 42 | const char *from_str, 43 | const char *to_str); 44 | int strcmp_null_tolerant (const char *s1, const char *s2); 45 | char* escape_str_common (const char *str, 46 | const char *meta_chars, 47 | const char prefix, 48 | const char postfix); 49 | char* escape_str (const char *str, 50 | const char *meta_chars); 51 | gchar * shell_escape (const gchar *filename); 52 | gboolean match_regexps (GRegex **regexps, 53 | const char *string, 54 | GRegexMatchFlags match_options); 55 | char ** search_util_get_patterns (const char *pattern_string); 56 | GRegex ** search_util_get_regexps (const char *pattern_string, 57 | GRegexCompileFlags compile_options); 58 | void free_regexps (GRegex **regexps); 59 | /*char * _g_strdup_with_max_size (const char *s, 60 | int max_size);*/ 61 | const char * eat_spaces (const char *line); 62 | const char * eat_void_chars (const char *line); 63 | char ** split_line (const char *line, 64 | int n_fields); 65 | const char * get_last_field (const char *line, 66 | int last_field); 67 | char * get_time_string (time_t time); 68 | /*GPtrArray * g_ptr_array_copy (GPtrArray *array);*/ 69 | /*void g_ptr_array_reverse (GPtrArray *array); 70 | int g_ptr_array_binary_search (GPtrArray *array, 71 | gpointer value, 72 | GCompareFunc func);*/ 73 | const char * get_static_string (const char *s); 74 | /*char* g_uri_display_basename (const char *uri); 75 | char ** _g_strv_prepend (char **str_array, 76 | const char *str); 77 | gboolean _g_strv_remove (char **str_array, 78 | const char *str);*/ 79 | 80 | /* path filename */ 81 | 82 | /*const char * _g_path_get_file_name (const char *path); 83 | const char * _g_path_get_base_name (const char *path, 84 | const char *base_dir, 85 | gboolean junk_paths);*/ 86 | 87 | /**/ 88 | 89 | #ifndef __GNUC__ 90 | #define __FUNCTION__ "" 91 | #endif 92 | 93 | #define DEBUG_INFO __FILE__, __LINE__, __FUNCTION__ 94 | 95 | void debug (const char *file, 96 | int line, 97 | const char *function, 98 | const char *format, ...); 99 | 100 | #endif /* _GLIB_UTILS_H */ 101 | -------------------------------------------------------------------------------- /src/core/java-utils.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2006 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef JAVA_UTILS_H 24 | #define JAVA_UTILS_H 25 | 26 | 27 | char* get_package_name_from_class_file (char *fname); 28 | char* get_package_name_from_java_file (char *fname); 29 | 30 | 31 | #endif /* JAVA_UTILS_H */ 32 | -------------------------------------------------------------------------------- /src/core/rar-utils.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * File-Roller 5 | * 6 | * Copyright (C) 2011 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | 23 | #include 24 | #include 25 | #include "file-utils.h" 26 | #include "fr-command.h" 27 | #include "gio-utils.h" 28 | #include "rar-utils.h" 29 | 30 | 31 | typedef enum { 32 | FIRST_VOLUME_IS_000, 33 | FIRST_VOLUME_IS_001, 34 | FIRST_VOLUME_IS_RAR 35 | } FirstVolumeExtension; 36 | 37 | 38 | static char * 39 | get_first_volume_name (const char *name, 40 | const char *pattern, 41 | FirstVolumeExtension extension_type) 42 | { 43 | char *volume_name = NULL; 44 | GRegex *re; 45 | 46 | re = g_regex_new (pattern, G_REGEX_CASELESS, 0, NULL); 47 | if (g_regex_match (re, name, 0, NULL)) { 48 | char **parts; 49 | int l, i; 50 | 51 | parts = g_regex_split (re, name, 0); 52 | l = strlen (parts[2]); 53 | switch (extension_type) { 54 | case FIRST_VOLUME_IS_000: 55 | for (i = 0; i < l; i++) 56 | parts[2][i] = '0'; 57 | break; 58 | 59 | case FIRST_VOLUME_IS_001: 60 | for (i = 0; i < l; i++) 61 | parts[2][i] = (i < l - 1) ? '0' : '1'; 62 | break; 63 | 64 | case FIRST_VOLUME_IS_RAR: 65 | if (g_str_has_suffix (parts[1], "r")) { 66 | parts[2][0] = 'a'; 67 | parts[2][1] = 'r'; 68 | } 69 | else { 70 | parts[2][0] = 'A'; 71 | parts[2][1] = 'R'; 72 | } 73 | break; 74 | } 75 | 76 | volume_name = g_strjoinv ("", parts); 77 | 78 | g_strfreev (parts); 79 | } 80 | g_regex_unref (re); 81 | 82 | if (volume_name != NULL) { 83 | char *tmp; 84 | 85 | tmp = volume_name; 86 | volume_name = g_filename_from_utf8 (tmp, -1, NULL, NULL, NULL); 87 | g_free (tmp); 88 | } 89 | 90 | return volume_name; 91 | } 92 | 93 | 94 | void 95 | rar_check_multi_volume (FrCommand *comm) 96 | { 97 | GFile *file; 98 | char buffer[11]; 99 | 100 | file = g_file_new_for_path (comm->filename); 101 | if (! g_load_file_in_buffer (file, buffer, 11, NULL)) { 102 | g_object_unref (file); 103 | return; 104 | } 105 | 106 | if (memcmp (buffer, "Rar!", 4) != 0) 107 | return; 108 | 109 | if ((buffer[10] & 0x01) == 0x01) { 110 | char *volume_name = NULL; 111 | char *name; 112 | 113 | name = g_filename_to_utf8 (file_name_from_path (comm->filename), -1, NULL, NULL, NULL); 114 | 115 | volume_name = get_first_volume_name (name, "^(.*\\.part)([0-9]+)(\\.rar)$", FIRST_VOLUME_IS_001); 116 | if (volume_name == NULL) 117 | volume_name = get_first_volume_name (name, "^(.*\\.r)([0-9]+)$", FIRST_VOLUME_IS_RAR); 118 | if (volume_name == NULL) 119 | volume_name = get_first_volume_name (name, "^(.*\\.)([0-9]+)$", FIRST_VOLUME_IS_001); 120 | 121 | if (volume_name != NULL) { 122 | GFile *parent; 123 | GFile *volume_file; 124 | 125 | parent = g_file_get_parent (file); 126 | volume_file = g_file_get_child (parent, volume_name); 127 | fr_command_set_multi_volume (comm, volume_file); 128 | 129 | g_object_unref (volume_file); 130 | g_object_unref (parent); 131 | } 132 | 133 | g_free (name); 134 | } 135 | 136 | g_object_unref (file); 137 | } 138 | -------------------------------------------------------------------------------- /src/core/rar-utils.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * File-Roller 5 | * 6 | * Copyright (C) 2011 Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #ifndef RAR_UTILS_H 23 | #define RAR_UTILS_H 24 | 25 | 26 | #include "fr-command.h" 27 | 28 | void rar_check_multi_volume (FrCommand *comm); 29 | 30 | #endif /* RAR_UTILS_H */ 31 | -------------------------------------------------------------------------------- /src/core/sh/isoinfo.sh: -------------------------------------------------------------------------------- 1 | filename=$2 2 | 3 | JOLIET=true 4 | ROCK_RIDGE=true 5 | 6 | ISOINFO=`isoinfo -d -i "$filename"` 7 | if echo $ISOINFO | grep "NO Joliet present" >/dev/null 2>&1; then 8 | JOLIET=false 9 | fi 10 | if echo $ISOINFO | grep "NO Rock Ridge present" >/dev/null 2>&1; then 11 | ROCK_RIDGE=false 12 | fi 13 | 14 | iso_extensions="" 15 | if test $ROCK_RIDGE = true; then 16 | iso_extensions="-R" 17 | elif test $JOLIET = true; then 18 | iso_extensions="-J" 19 | fi 20 | 21 | if test "x$3" = x-x; then 22 | file_to_extract=$4 23 | outfile=$5 24 | isoinfo $iso_extensions -i "$filename" -x "$file_to_extract" > "$outfile" 25 | else 26 | isoinfo $iso_extensions -i "$filename" -l 27 | fi 28 | -------------------------------------------------------------------------------- /src/core/tr-wrapper.c: -------------------------------------------------------------------------------- 1 | #include "tr-wrapper.h" 2 | 3 | const char* (*qt_gettext)(const char* msg) = 0; 4 | -------------------------------------------------------------------------------- /src/core/tr-wrapper.h: -------------------------------------------------------------------------------- 1 | #ifndef TR_WRAPPER_H 2 | #define TR_WRAPPER_H 3 | 4 | #include 5 | #include 6 | 7 | G_BEGIN_DECLS 8 | 9 | /* This is a function pointer point to a gettext replacement which 10 | * wraps QTraslator and calls QApplication::translate() internally. */ 11 | 12 | extern const char* (*qt_gettext)(const char* msg); 13 | 14 | #undef _ 15 | #undef N_ 16 | 17 | #define _(x) qt_gettext(x) 18 | #define N_(x) (x) 19 | 20 | G_END_DECLS 21 | 22 | #endif /* TR_WRAPPER_H */ 23 | -------------------------------------------------------------------------------- /src/core/typedefs.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 | 3 | /* 4 | * Engrampa 5 | * 6 | * Copyright (C) 2001 The Free Software Foundation, Inc. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Street #330, Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef TYPEDEFS_H 24 | #define TYPEDEFS_H 25 | 26 | #include 27 | #include 28 | 29 | #define MEGABYTE (1024 * 1024) 30 | 31 | #define ADD_FOLDER_OPTIONS_DIR "engrampa/options" 32 | 33 | typedef enum { /*< skip >*/ 34 | FR_WINDOW_SORT_BY_NAME = 0, 35 | FR_WINDOW_SORT_BY_SIZE = 1, 36 | FR_WINDOW_SORT_BY_TYPE = 2, 37 | FR_WINDOW_SORT_BY_TIME = 3, 38 | FR_WINDOW_SORT_BY_PATH = 4 39 | } FrWindowSortMethod; 40 | 41 | typedef enum { /*< skip >*/ 42 | FR_WINDOW_LIST_MODE_FLAT, 43 | FR_WINDOW_LIST_MODE_AS_DIR 44 | } FrWindowListMode; 45 | 46 | typedef enum { 47 | FR_COMPRESSION_VERY_FAST, 48 | FR_COMPRESSION_FAST, 49 | FR_COMPRESSION_NORMAL, 50 | FR_COMPRESSION_MAXIMUM 51 | } FrCompression; 52 | 53 | typedef enum { 54 | FR_OVERWRITE_YES, 55 | FR_OVERWRITE_NO, 56 | FR_OVERWRITE_ASK 57 | } FrOverwrite; 58 | 59 | typedef enum { /*< skip >*/ 60 | FR_PROC_ERROR_NONE, 61 | FR_PROC_ERROR_GENERIC, 62 | FR_PROC_ERROR_COMMAND_ERROR, 63 | FR_PROC_ERROR_COMMAND_NOT_FOUND, 64 | FR_PROC_ERROR_EXITED_ABNORMALLY, 65 | FR_PROC_ERROR_SPAWN, 66 | FR_PROC_ERROR_STOPPED, 67 | FR_PROC_ERROR_ASK_PASSWORD, 68 | FR_PROC_ERROR_MISSING_VOLUME, 69 | FR_PROC_ERROR_IO_CHANNEL, 70 | FR_PROC_ERROR_BAD_CHARSET, 71 | FR_PROC_ERROR_UNSUPPORTED_FORMAT 72 | } FrProcErrorType; 73 | 74 | typedef struct { 75 | FrProcErrorType type; 76 | int status; 77 | GError *gerror; 78 | } FrProcError; 79 | 80 | typedef enum { /*< skip >*/ 81 | FR_COMMAND_CAN_DO_NOTHING = 0, 82 | FR_COMMAND_CAN_READ = 1 << 0, 83 | FR_COMMAND_CAN_WRITE = 1 << 1, 84 | FR_COMMAND_CAN_ARCHIVE_MANY_FILES = 1 << 2, 85 | FR_COMMAND_CAN_ENCRYPT = 1 << 3, 86 | FR_COMMAND_CAN_ENCRYPT_HEADER = 1 << 4, 87 | FR_COMMAND_CAN_CREATE_VOLUMES = 1 << 5 88 | } FrCommandCap; 89 | 90 | #define FR_COMMAND_CAN_READ_WRITE (FR_COMMAND_CAN_READ | FR_COMMAND_CAN_WRITE) 91 | 92 | typedef guint8 FrCommandCaps; 93 | 94 | typedef struct { 95 | const char *mime_type; 96 | FrCommandCaps current_capabilities; 97 | FrCommandCaps potential_capabilities; 98 | } FrMimeTypeCap; 99 | 100 | typedef struct { 101 | const char *mime_type; 102 | const char *packages; 103 | } FrMimeTypePackages; 104 | 105 | typedef struct { 106 | int ref; 107 | GType type; 108 | GPtrArray *caps; /* array of FrMimeTypeCap */ 109 | GPtrArray *packages; /* array of FrMimeTypePackages */ 110 | } FrRegisteredCommand; 111 | 112 | typedef struct { 113 | const char *mime_type; 114 | char *default_ext; 115 | char *name; 116 | FrCommandCaps capabilities; 117 | } FrMimeTypeDescription; 118 | 119 | typedef struct { 120 | char *ext; 121 | const char *mime_type; 122 | } FrExtensionType; 123 | 124 | #endif /* TYPEDEFS_H */ 125 | -------------------------------------------------------------------------------- /src/corestrs.h: -------------------------------------------------------------------------------- 1 | // Generated by extract_c_strs.py. Do not edit!!! 2 | #if 0 3 | #include 4 | 5 | // ./src/core/fr-init.c 6 | QObject::tr("7-Zip (.7z)"); 7 | QObject::tr("Tar compressed with 7z (.tar.7z)"); 8 | QObject::tr("Ace (.ace)"); 9 | QObject::tr("Ar (.a)"); 10 | QObject::tr("Ar (.ar)"); 11 | QObject::tr("Arj (.arj)"); 12 | QObject::tr("Tar compressed with bzip2 (.tar.bz2)"); 13 | QObject::tr("Tar compressed with bzip (.tar.bz)"); 14 | QObject::tr("Cabinet (.cab)"); 15 | QObject::tr("Rar Archived Comic Book (.cbr)"); 16 | QObject::tr("Zip Archived Comic Book (.cbz)"); 17 | QObject::tr("Tar compressed with gzip (.tar.gz)"); 18 | QObject::tr("Ear (.ear)"); 19 | QObject::tr("Self-extracting zip (.exe)"); 20 | QObject::tr("Jar (.jar)"); 21 | QObject::tr("Lha (.lzh)"); 22 | QObject::tr("Lrzip (.lrz)"); 23 | QObject::tr("Tar compressed with lrzip (.tar.lrz)"); 24 | QObject::tr("Tar compressed with lzip (.tar.lz)"); 25 | QObject::tr("Tar compressed with lzma (.tar.lzma)"); 26 | QObject::tr("Tar compressed with lzop (.tar.lzo)"); 27 | QObject::tr("Windows Imaging Format (.wim)"); 28 | QObject::tr("Rar (.rar)"); 29 | QObject::tr("Tar uncompressed (.tar)"); 30 | QObject::tr("Tar compressed with compress (.tar.Z)"); 31 | QObject::tr("War (.war)"); 32 | QObject::tr("Xz (.xz)"); 33 | QObject::tr("Tar compressed with xz (.tar.xz)"); 34 | QObject::tr("Tar compressed with zstd (.tar.zst)"); 35 | QObject::tr("Zoo (.zoo)"); 36 | QObject::tr("Zip (.zip)"); 37 | 38 | // ./src/core/fr-command-7z.c 39 | QObject::tr("Adding file: "); 40 | QObject::tr("Extracting file: "); 41 | 42 | // ./src/core/glib-utils.c 43 | QObject::tr("%d %B %Y, %H:%M"); 44 | 45 | // ./src/core/fr-command-tar.c 46 | QObject::tr("Adding file: "); 47 | QObject::tr("Removing file: "); 48 | QObject::tr("Deleting files from archive"); 49 | QObject::tr("Extracting file: "); 50 | QObject::tr("Recompressing archive"); 51 | QObject::tr("Decompressing archive"); 52 | 53 | // ./src/core/fr-archive.c 54 | QObject::tr("File not found."); 55 | QObject::tr("Archive type not supported."); 56 | QObject::tr("Archive not found"); 57 | QObject::tr("You don't have the right permissions."); 58 | QObject::tr("This archive type cannot be modified"); 59 | QObject::tr("You can't add an archive to itself."); 60 | 61 | // ./src/core/fr-command-rar.c 62 | QObject::tr("Adding file: "); 63 | QObject::tr("Removing file: "); 64 | QObject::tr("Extracting file: "); 65 | QObject::tr("Could not find the volume: %s"); 66 | 67 | 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /src/create.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CreateArchiveExtraWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 429 10 | 113 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 22 | 23 | false 24 | 25 | 26 | MiB 27 | 28 | 29 | 1000 30 | 31 | 32 | 33 | 34 | 35 | 36 | Split into volumes of 37 | 38 | 39 | 40 | 41 | 42 | 43 | Password: 44 | 45 | 46 | 47 | 48 | 49 | 50 | Encrypt the file list too 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 0 59 | 0 60 | 61 | 62 | 63 | 64 | 250 65 | 0 66 | 67 | 68 | 69 | QLineEdit::Password 70 | 71 | 72 | 73 | 74 | 75 | 76 | Qt::Horizontal 77 | 78 | 79 | 80 | 0 81 | 20 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | splitVolumes 92 | toggled(bool) 93 | volumeSize 94 | setEnabled(bool) 95 | 96 | 97 | 82 98 | 84 99 | 100 | 101 | 231 102 | 100 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /src/createfiledialog.cpp: -------------------------------------------------------------------------------- 1 | #include "createfiledialog.h" 2 | #include "archiver.h" 3 | #include "ui_create.h" 4 | 5 | #include 6 | 7 | 8 | CreateFileDialog::CreateFileDialog(QWidget *parent, Fm::FilePath path): 9 | Fm::FileDialog{parent, std::move(path)}, 10 | ui_{new Ui::CreateArchiveExtraWidget{}} { 11 | 12 | setWindowTitle(tr("Create Archive")); 13 | setAcceptMode(QFileDialog::AcceptSave); 14 | setNameFilters(Archiver::supportedCreateNameFilters() << tr("All files (*)")); 15 | 16 | // extra options 17 | auto extraWidget = new QWidget{this}; 18 | ui_->setupUi(extraWidget); 19 | auto boxLayout = qobject_cast(layout()); 20 | if(boxLayout) { 21 | boxLayout->addWidget(extraWidget); 22 | } 23 | 24 | // default to 10 MB 25 | ui_->volumeSize->setValue(10); 26 | } 27 | 28 | CreateFileDialog::~CreateFileDialog() { 29 | } 30 | 31 | QString CreateFileDialog::password() const { 32 | return ui_->password->text(); 33 | } 34 | 35 | bool CreateFileDialog::encryptFileList() const { 36 | return ui_->encryptFileList->isChecked(); 37 | } 38 | 39 | bool CreateFileDialog::splitVolumes() const { 40 | return ui_->splitVolumes->isChecked(); 41 | } 42 | 43 | unsigned int CreateFileDialog::volumeSize() const { 44 | return ui_->volumeSize->value(); 45 | } 46 | -------------------------------------------------------------------------------- /src/createfiledialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CREATEFILEDIALOG_H 2 | #define CREATEFILEDIALOG_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class CreateArchiveExtraWidget; 9 | } 10 | 11 | class CreateFileDialog : public Fm::FileDialog { 12 | public: 13 | CreateFileDialog(QWidget *parent = 0, Fm::FilePath path = Fm::FilePath::homeDir()); 14 | ~CreateFileDialog(); 15 | 16 | QString password() const; 17 | 18 | bool encryptFileList() const; 19 | 20 | bool splitVolumes() const; 21 | 22 | unsigned int volumeSize() const; 23 | 24 | private: 25 | std::unique_ptr ui_; 26 | }; 27 | 28 | 29 | #endif // CREATEFILEDIALOG_H 30 | -------------------------------------------------------------------------------- /src/dirtreeView.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "dirtreeView.h" 6 | 7 | DirTreeView::DirTreeView(QWidget* parent) : QTreeView(parent) { 8 | header()->setOffset(0); 9 | setHeaderHidden(true); 10 | // show the horizontal scrollbar if needed 11 | header()->setStretchLastSection(false); 12 | header()->setSectionResizeMode(QHeaderView::ResizeToContents); 13 | } 14 | 15 | // Ensure that the item is visible horizontally too (Qt's default behavior is buggy). 16 | void DirTreeView::scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint) { 17 | QTreeView::scrollTo (index, hint); 18 | if (index.isValid()) 19 | { 20 | int viewportWidth = viewport()->width(); 21 | QRect vr = visualRect (index); 22 | int itemWidth = vr.width() + indentation(); 23 | int hPos; 24 | if (QApplication::layoutDirection() == Qt::RightToLeft) { 25 | hPos = viewportWidth - vr.x() - vr.width() - indentation(); // horizontally mirrored 26 | } 27 | else { 28 | hPos = vr.x() - indentation(); 29 | } 30 | if (hPos < 0 || itemWidth > viewportWidth) { 31 | horizontalScrollBar()->setValue (hPos); 32 | } 33 | else if (hPos + itemWidth > viewportWidth) { 34 | horizontalScrollBar()->setValue (hPos + itemWidth - viewportWidth); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/dirtreeView.h: -------------------------------------------------------------------------------- 1 | #ifndef DIRTREEVIEW_H 2 | #define DIRTREEVIEW_H 3 | 4 | #include 5 | 6 | class DirTreeView : public QTreeView { 7 | Q_OBJECT 8 | 9 | public: 10 | explicit DirTreeView(QWidget* parent = nullptr); 11 | 12 | void scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible) override; 13 | }; 14 | 15 | #endif // DIRTREEVIEW_H 16 | -------------------------------------------------------------------------------- /src/dirtreeitem.cpp: -------------------------------------------------------------------------------- 1 | #include "dirtreeitem.h" 2 | 3 | DirTreeItem::DirTreeItem() { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/dirtreeitem.h: -------------------------------------------------------------------------------- 1 | #ifndef DIRTREEITEM_H 2 | #define DIRTREEITEM_H 3 | 4 | #include "core/file-data.h" 5 | #include 6 | #include 7 | 8 | class DirTreeItem { 9 | public: 10 | DirTreeItem(); 11 | 12 | private: 13 | FileData* data_; 14 | char* name_; 15 | 16 | }; 17 | 18 | #endif // DIRTREEITEM_H 19 | -------------------------------------------------------------------------------- /src/extract.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ExtractArchiveExtraWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 496 10 | 142 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 22 | 23 | Extract 24 | 25 | 26 | 27 | 28 | 29 | E&xtract all files 30 | 31 | 32 | 33 | 34 | 35 | 36 | Ex&tract selected files 37 | 38 | 39 | 40 | 41 | 42 | 43 | Qt::Vertical 44 | 45 | 46 | 47 | 20 48 | 0 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | Actions 60 | 61 | 62 | 63 | 64 | 65 | Re-create folders 66 | 67 | 68 | true 69 | 70 | 71 | 72 | 73 | 74 | 75 | Overwrite existing files 76 | 77 | 78 | 79 | 80 | 81 | 82 | Do not extract older files 83 | 84 | 85 | 86 | 87 | 88 | 89 | Qt::Vertical 90 | 91 | 92 | 93 | 20 94 | 0 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /src/extract_c_strs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # extract all C gettext strings and convert them to tr() so lupdate can handle them. 3 | 4 | import os 5 | import re 6 | 7 | gettext_re = re.compile(r''' 8 | N?_ # gettext marker 9 | \( # left paren 10 | \s* # spaces 11 | (".*?[^\\]") # quoted string (the char before the ending " cannot be \) 12 | \s* # spaces 13 | \) # right paren 14 | ''', re.DOTALL|re.VERBOSE) 15 | 16 | print("""// Generated by extract_c_strs.py. Do not edit!!! 17 | #if 0 18 | #include 19 | """) 20 | 21 | dirname = "./core" 22 | for fn in os.listdir(dirname): 23 | if not fn.endswith(".c"): 24 | continue 25 | fpath = os.path.join(dirname, fn) 26 | with open(fpath, 'r') as f: 27 | code = f.read() 28 | strs = gettext_re.findall(code) 29 | if strs: 30 | print("// {}".format(fpath)) 31 | for s in strs: 32 | print('QObject::tr({});'.format(s)) 33 | print() 34 | print(""" 35 | #endif 36 | """) 37 | -------------------------------------------------------------------------------- /src/extractfiledialog.cpp: -------------------------------------------------------------------------------- 1 | #include "extractfiledialog.h" 2 | #include "ui_extract.h" 3 | 4 | #include 5 | 6 | 7 | ExtractFileDialog::ExtractFileDialog(QWidget *parent, Fm::FilePath path): 8 | Fm::FileDialog{parent, std::move(path)}, 9 | ui_{new Ui::ExtractArchiveExtraWidget{}} { 10 | 11 | setWindowTitle(tr("Extract")); 12 | setOptions(QFileDialog::ShowDirsOnly | QFileDialog::HideNameFilterDetails); 13 | setNameFilters(QStringList{} << tr("All files (*)")); 14 | setAcceptMode(QFileDialog::AcceptOpen); 15 | setFileMode(QFileDialog::Directory); 16 | 17 | // add extra options 18 | QWidget* extraWidget = new QWidget(this); 19 | ui_->setupUi(extraWidget); 20 | auto boxLayout = qobject_cast(layout()); 21 | if(boxLayout) { 22 | boxLayout->addWidget(extraWidget); 23 | } 24 | } 25 | 26 | ExtractFileDialog::~ExtractFileDialog() { 27 | } 28 | 29 | bool ExtractFileDialog::skipOlder() const { 30 | return ui_->skipOlder->isChecked(); 31 | } 32 | 33 | bool ExtractFileDialog::overwrite() const { 34 | return ui_->overwriteExisting->isChecked(); 35 | } 36 | 37 | bool ExtractFileDialog::reCreateFolders() const { 38 | return ui_->reCreateFolders->isChecked(); 39 | } 40 | 41 | bool ExtractFileDialog::extractAll() const { 42 | return ui_->extractAll->isChecked(); 43 | } 44 | 45 | void ExtractFileDialog::setExtractAll(bool value){ 46 | ui_->extractAll->setChecked(value); 47 | } 48 | 49 | void ExtractFileDialog::setExtractSelected(bool value){ 50 | ui_->extractSelected->setChecked(value); 51 | } 52 | 53 | void ExtractFileDialog::setExtractAllEnabled(bool enabled) 54 | { 55 | ui_->extractAll->setEnabled(enabled); 56 | } 57 | 58 | void ExtractFileDialog::setExtractSelectedEnabled(bool enabled) { 59 | ui_->extractSelected->setEnabled(enabled); 60 | } 61 | -------------------------------------------------------------------------------- /src/extractfiledialog.h: -------------------------------------------------------------------------------- 1 | #ifndef EXTRACTFILEDIALOG_H 2 | #define EXTRACTFILEDIALOG_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class ExtractArchiveExtraWidget; 9 | } 10 | 11 | 12 | class ExtractFileDialog : public Fm::FileDialog { 13 | public: 14 | explicit ExtractFileDialog(QWidget *parent = 0, Fm::FilePath path = Fm::FilePath::homeDir()); 15 | 16 | ~ExtractFileDialog(); 17 | 18 | bool skipOlder() const; 19 | 20 | bool overwrite() const; 21 | 22 | bool reCreateFolders() const; 23 | 24 | bool extractAll() const; 25 | 26 | void setExtractAll(bool value); 27 | 28 | void setExtractSelected(bool value); 29 | 30 | void setExtractAllEnabled(bool enabled); 31 | 32 | void setExtractSelectedEnabled(bool enabled); 33 | 34 | private: 35 | std::unique_ptr ui_; 36 | }; 37 | 38 | #endif // EXTRACTFILEDIALOG_H 39 | -------------------------------------------------------------------------------- /src/filetreeView.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "filetreeView.h" 6 | 7 | FileTreeView::FileTreeView(QWidget* parent) : QTreeView(parent) { 8 | dragStarted_ = false; 9 | setSelectionMode(QAbstractItemView::ExtendedSelection); 10 | setRootIsDecorated(false); 11 | setDragDropMode(QAbstractItemView::DragOnly); 12 | setSortingEnabled(true); 13 | header()->setSortIndicatorShown(true); 14 | header()->setStretchLastSection(false); 15 | header()->setSortIndicatorShown(true); 16 | header()->setSortIndicator(0, Qt::AscendingOrder); 17 | // NOTE:This not only enables optimizations, but it also prevents wrong 18 | // heights if the view is scrolled while the first column is not visible. 19 | setUniformRowHeights(true); 20 | } 21 | 22 | void FileTreeView::mousePressEvent(QMouseEvent* event) { 23 | QTreeView::mousePressEvent(event); 24 | if (event->button() == Qt::LeftButton && indexAt(event->pos()).isValid()) { 25 | dragStartPosition_ = event->pos(); 26 | } 27 | else { 28 | dragStartPosition_ = QPoint(); 29 | } 30 | dragStarted_ = false; 31 | } 32 | 33 | void FileTreeView::mouseMoveEvent(QMouseEvent* event) { 34 | if(dragStartPosition_.isNull()) { 35 | QTreeView::mouseMoveEvent(event); 36 | return; 37 | } 38 | if(!dragStarted_ 39 | && (event->buttons() & Qt::LeftButton) 40 | && (event->pos() - dragStartPosition_).manhattanLength() >= qMax(16, QApplication::startDragDistance())) { 41 | dragStarted_ = true; 42 | if(selectionModel() && !selectionModel()->selectedRows().isEmpty()) { 43 | Q_EMIT dragStarted(); 44 | } 45 | event->accept(); 46 | } 47 | } 48 | 49 | void FileTreeView::keyPressEvent(QKeyEvent* event) { 50 | if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) { 51 | if(currentIndex().isValid()) { 52 | // instead of AbstractItemView::activated(), emit our signal, 53 | // which works with Enter and Return alike 54 | Q_EMIT enterPressed(); 55 | event->accept(); 56 | return; 57 | } 58 | } 59 | QTreeView::keyPressEvent(event); 60 | } 61 | -------------------------------------------------------------------------------- /src/filetreeView.h: -------------------------------------------------------------------------------- 1 | #ifndef FILETREEVIEW_H 2 | #define FILETREEVIEW_H 3 | 4 | #include 5 | 6 | class FileTreeView : public QTreeView { 7 | Q_OBJECT 8 | 9 | public: 10 | explicit FileTreeView(QWidget* parent = nullptr); 11 | 12 | Q_SIGNALS: 13 | void dragStarted(); 14 | void enterPressed(); 15 | 16 | protected: 17 | void mousePressEvent(QMouseEvent* event) override; 18 | void mouseMoveEvent(QMouseEvent* event) override; 19 | void keyPressEvent(QKeyEvent* event) override; 20 | 21 | private: 22 | QPoint dragStartPosition_; 23 | bool dragStarted_; 24 | }; 25 | 26 | #endif // FILETREEVIEW_H 27 | -------------------------------------------------------------------------------- /src/icons/lxqt-archiver.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/lxqt-archiver.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Exec=lxqt-archiver %U 4 | Icon=lxqt-archiver 5 | StartupNotify=true 6 | Type=Application 7 | Categories=Qt;Utility;Archiving;Compression; 8 | MimeType=application/x-7z-compressed;application/x-7z-compressed-tar;application/x-ace;application/x-alz;application/x-ar;application/x-arj;application/x-bzip2-compressed-tar;application/x-bzip1;application/x-bzip1-compressed-tar;application/x-cabinet;application/x-cbr;application/x-cbz;application/vnd.efi.iso;application/x-compress;application/x-compressed-tar;application/x-cpio;application/x-deb;application/vnd.debian.binary-package;application/x-ear;application/x-ms-dos-executable;application/x-gtar;application/gzip;application/x-gzpostscript;application/x-java-archive;application/x-lha;application/x-lhz;application/x-lrzip;application/x-lrzip-compressed-tar;application/x-lzip;application/x-lzip-compressed-tar;application/x-lzma;application/x-lzma-compressed-tar;application/x-lzop;application/x-lzop-compressed-tar;application/x-ms-wim;application/x-rar;application/x-rar-compressed;application/vnd.rar;application/vnd.efi.img;application/x-rpm;application/x-rzip;application/x-tar;application/x-tarz;application/x-stuffit;application/x-war;application/x-xz;application/x-xz-compressed-tar;application/zstd;application/x-zstd-compressed-tar;application/x-zip;application/x-zip-compressed;application/x-zoo;application/zip;application/x-archive;application/vnd.ms-cab-compressed; 9 | Keywords=archive;manager;compression; 10 | -------------------------------------------------------------------------------- /src/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "archiver.h" 11 | 12 | namespace Ui { 13 | class MainWindow; 14 | } 15 | 16 | class QProgressBar; 17 | class QComboBox; 18 | class QStandardItemModel; 19 | class QStandardItem; 20 | class QItemSelection; 21 | class QLineEdit; 22 | class QMenu; 23 | class ArchiverProxyModel; 24 | 25 | 26 | class MainWindow : public QMainWindow { 27 | Q_OBJECT 28 | public: 29 | 30 | enum { 31 | ArchiverItemRole = Qt::UserRole + 1 32 | }; 33 | 34 | enum class ViewMode { 35 | DirTree, 36 | FlatList 37 | }; 38 | 39 | explicit MainWindow(QWidget* parent = nullptr); 40 | 41 | ~MainWindow(); 42 | 43 | void loadFile(const Fm::FilePath& file); 44 | 45 | std::shared_ptr archiver() const; 46 | 47 | ViewMode viewMode() const; 48 | 49 | void setViewMode(ViewMode viewMode); 50 | 51 | const std::string& currentDirPath() const; 52 | 53 | void chdir(std::string dirPath); 54 | 55 | void chdir(const ArchiverItem* dir); 56 | 57 | protected: 58 | virtual void dropEvent(QDropEvent* event) override; 59 | virtual void dragEnterEvent(QDragEnterEvent* event) override; 60 | 61 | private Q_SLOTS: 62 | // action slots 63 | void on_actionCreateNew_triggered(bool checked); 64 | 65 | void on_actionOpen_triggered(bool checked); 66 | 67 | void on_actionArchiveProperties_triggered(bool checked); 68 | 69 | void on_actionAddFiles_triggered(bool checked); 70 | 71 | void on_actionAddFolder_triggered(bool checked); 72 | 73 | void on_actionDelete_triggered(bool checked); 74 | 75 | void on_actionSelectAll_triggered(bool checked); 76 | 77 | void on_actionExtract_triggered(bool checked); 78 | 79 | void on_actionView_triggered(bool checked); 80 | 81 | void on_actionTest_triggered(bool checked); 82 | 83 | void on_actionPassword_triggered(bool checked); 84 | 85 | void on_actionDirTree_toggled(bool checked); 86 | 87 | void on_actionDirTreeMode_toggled(bool checked); 88 | 89 | void on_actionFlatListMode_toggled(bool checked); 90 | 91 | void on_actionExpand_triggered(bool checked); 92 | 93 | void on_actionCollapse_triggered(bool checked); 94 | 95 | void on_actionReload_triggered(bool checked); 96 | 97 | void on_actionStop_triggered(bool checked); 98 | 99 | void on_actionAbout_triggered(bool checked); 100 | 101 | void on_actionFilter_triggered(bool checked); 102 | 103 | void onDirTreeSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); 104 | 105 | void onFileListSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); 106 | 107 | void onFileListContextMenu(const QPoint &pos); 108 | 109 | void onFileListDoubleClicked(const QModelIndex &index); 110 | 111 | void onFileListActivated(const QModelIndex &index); 112 | 113 | void onFileListEnterPressed(); 114 | 115 | void onViewsIconSizeTtriggered(QAction *action); 116 | 117 | void filter(const QString& text); 118 | 119 | private Q_SLOTS: 120 | // Archiver slots 121 | 122 | void onInvalidateContent(); 123 | 124 | void onActionStarted(FrAction action); 125 | 126 | void onActionProgress(double fraction); 127 | 128 | void onActionFinished(FrAction action, ArchiverError err); 129 | 130 | void onMessage(QString message); 131 | 132 | void onStoppableChanged(bool stoppable); 133 | 134 | void onPropertiesFileInfoJobFinished(); 135 | 136 | void onDragStarted(); 137 | 138 | private: 139 | void loadSettings(); 140 | 141 | void saveSettings(); 142 | 143 | void setFileName(const QString& fileName); 144 | 145 | QList createFileListRow(const ArchiverItem* file); 146 | 147 | void showFileList(const std::vector& files); 148 | 149 | void showFlatFileList(); 150 | 151 | void showCurrentDirList(); 152 | 153 | void setBusyState(bool busy); 154 | 155 | void updateDirTree(); 156 | 157 | void buildDirTree(QStandardItem *parent, const ArchiverItem *root); 158 | 159 | void updateUiStates(); 160 | 161 | void setViewsIconSize(const int &size); 162 | 163 | void fitFileViewColumns(); 164 | 165 | std::vector selectedFiles(bool recursive); 166 | 167 | const ArchiverItem* itemFromIndex(const QModelIndex& index); 168 | 169 | QModelIndex indexFromItem(const QModelIndex& parent, const ArchiverItem* item); 170 | 171 | void viewSelectedFiles(); 172 | 173 | bool isExtracted(const ArchiverItem* item); 174 | 175 | private: 176 | std::unique_ptr ui_; 177 | std::shared_ptr archiver_; 178 | QProgressBar* progressBar_; 179 | QLineEdit* currentPathEdit_; 180 | QMenu* popupMenu_; 181 | ArchiverProxyModel* proxyModel_; 182 | 183 | std::string currentDirPath_; 184 | ViewMode viewMode_; 185 | const ArchiverItem* currentDirItem_; 186 | std::string password_; 187 | bool encryptHeader_; 188 | bool splitVolumes_; 189 | unsigned int volumeSize_; 190 | 191 | QString tempDir_; 192 | QStringList launchPaths_; 193 | QUrl lasrDir_; 194 | 195 | int splitterPos_; 196 | }; 197 | 198 | #endif // MAINWINDOW_H 199 | -------------------------------------------------------------------------------- /src/passworddialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2018 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #include "passworddialog.h" 21 | #include "ui_passworddialog.h" 22 | #include 23 | 24 | 25 | PasswordDialog::PasswordDialog(QWidget* parent): 26 | QDialog{parent}, 27 | ui_{new Ui::PasswordDialog} { 28 | 29 | ui_->setupUi(this); 30 | connect(ui_->showPassword, &QCheckBox::toggled, this, &PasswordDialog::onTogglePassword); 31 | } 32 | 33 | PasswordDialog::~PasswordDialog() { 34 | } 35 | 36 | QString PasswordDialog::password() const { 37 | return ui_->passwordEdit->text(); 38 | } 39 | 40 | void PasswordDialog::setPassword(const QString& password) { 41 | ui_->passwordEdit->setText(password); 42 | } 43 | 44 | void PasswordDialog::setEncryptFileList(bool value) { 45 | ui_->encryptFileList->setChecked(value); 46 | } 47 | 48 | bool PasswordDialog::encryptFileList() const { 49 | return ui_->encryptFileList->isChecked(); 50 | } 51 | 52 | 53 | void PasswordDialog::onTogglePassword(bool toggled) { 54 | ui_->passwordEdit->setEchoMode(toggled ? QLineEdit::Normal : QLineEdit::Password); 55 | } 56 | 57 | // static 58 | QString PasswordDialog::askPassword(QWidget* parent) { 59 | QInputDialog dlg; 60 | return QInputDialog::getText(parent, tr("Password"), tr("Password:"), QLineEdit::Password); 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/passworddialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2018 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #ifndef PASSWORDDIALOG_H 21 | #define PASSWORDDIALOG_H 22 | 23 | #include 24 | #include 25 | 26 | 27 | namespace Ui 28 | { 29 | class PasswordDialog; 30 | } 31 | 32 | 33 | class PasswordDialog : public QDialog { 34 | Q_OBJECT 35 | 36 | public: 37 | 38 | PasswordDialog(QWidget* parent = nullptr); 39 | 40 | ~PasswordDialog(); 41 | 42 | QString password() const; 43 | 44 | void setPassword(const QString& password); 45 | 46 | void setEncryptFileList(bool value); 47 | 48 | bool encryptFileList() const; 49 | 50 | static QString askPassword(QWidget* parent = nullptr); 51 | 52 | private Q_SLOTS: 53 | void onTogglePassword(bool toggled); 54 | 55 | private: 56 | std::unique_ptr ui_; 57 | }; 58 | 59 | #endif // PASSWORDDIALOG_H 60 | -------------------------------------------------------------------------------- /src/passworddialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | PasswordDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 476 10 | 264 11 | 12 | 13 | 14 | Password 15 | 16 | 17 | 18 | 19 | 20 | Encrypt the file list 21 | 22 | 23 | 24 | 25 | 26 | 27 | QLineEdit::Password 28 | 29 | 30 | 31 | 32 | 33 | 34 | Show password 35 | 36 | 37 | 38 | 39 | 40 | 41 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 42 | 43 | 44 | 45 | 46 | 47 | 48 | Password: 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 0 57 | 0 58 | 59 | 60 | 61 | <i><b>Note:</b> the password will be used to encrypt files you add to the current archive, and to decrypt files you extract from the current archive. When the archive is closed the password will be deleted.</i> 62 | 63 | 64 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop 65 | 66 | 67 | true 68 | 69 | 70 | 71 | 72 | 73 | 74 | passwordEdit 75 | showPassword 76 | encryptFileList 77 | 78 | 79 | 80 | 81 | buttonBox 82 | accepted() 83 | PasswordDialog 84 | accept() 85 | 86 | 87 | 273 88 | 178 89 | 90 | 91 | 410 92 | 11 93 | 94 | 95 | 96 | 97 | buttonBox 98 | rejected() 99 | PasswordDialog 100 | reject() 101 | 102 | 103 | 123 104 | 176 105 | 106 | 107 | 409 108 | 47 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /src/progressdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "progressdialog.h" 2 | 3 | #include "ui_progressdialog.h" 4 | #include "archiver.h" 5 | 6 | 7 | ProgressDialog::ProgressDialog(QWidget* parent) : 8 | QDialog(parent), 9 | ui_{new Ui::ProgressDialog{}}, 10 | archiver_{nullptr} { 11 | 12 | ui_->setupUi(this); 13 | 14 | ui_->progressBar->setValue(0); 15 | ui_->progressBar->show(); 16 | ui_->progressBar->setFormat(tr("%p %")); 17 | } 18 | 19 | ProgressDialog::~ProgressDialog() { 20 | } 21 | 22 | void ProgressDialog::setArchiver(Archiver* archiver) { 23 | if(archiver_) { 24 | archiver_->disconnect(this); 25 | } 26 | archiver_ = archiver; 27 | connect(archiver, &Archiver::progress, this, &ProgressDialog::onProgress); 28 | connect(archiver, &Archiver::message, this, &ProgressDialog::onMessage); 29 | connect(archiver, &Archiver::workingArchive, this, &ProgressDialog::onWorkingArchive); 30 | } 31 | 32 | void ProgressDialog::setOperation(const QString& operation) { 33 | ui_->operation->setText(operation); 34 | } 35 | 36 | void ProgressDialog::setMessage(const QString& msg) { 37 | ui_->message->setText(msg); 38 | } 39 | 40 | void ProgressDialog::reject() { 41 | QDialog::reject(); 42 | if(archiver_) { 43 | archiver_->stopCurrentAction(); 44 | } 45 | } 46 | 47 | void ProgressDialog::onProgress(double fraction) { 48 | //qDebug("progress: %lf", fraction); 49 | if(fraction < 0.0) { 50 | // negative progress indicates that progress is unknown 51 | ui_->progressBar->setRange(0, 0); // set it to undertermined state 52 | } 53 | else { 54 | ui_->progressBar->setRange(0, 100); 55 | ui_->progressBar->setValue(int(100 * fraction)); 56 | } 57 | } 58 | 59 | void ProgressDialog::onFinished(FrAction /*action*/, ArchiverError /*error*/) { 60 | } 61 | 62 | void ProgressDialog::onMessage(QString msg) { 63 | //qDebug("progress: %s", msg.toUtf8().constData()); 64 | ui_->message->setText(msg); 65 | } 66 | 67 | void ProgressDialog::onStoppableChanged(bool /*value*/) { 68 | 69 | } 70 | 71 | void ProgressDialog::onWorkingArchive(QString filename) { 72 | //qDebug("progress: %s", filename.toUtf8().constData()); 73 | ui_->currentFile->setText(filename); 74 | } 75 | 76 | -------------------------------------------------------------------------------- /src/progressdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef PROGRESSDIALOG_H 2 | #define PROGRESSDIALOG_H 3 | 4 | #include 5 | #include 6 | 7 | #include "archiver.h" 8 | 9 | namespace Ui { 10 | class ProgressDialog; 11 | } 12 | 13 | 14 | class ProgressDialog : public QDialog { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit ProgressDialog(QWidget* parent = 0); 19 | 20 | ~ProgressDialog(); 21 | 22 | void setArchiver(Archiver* archiver); 23 | 24 | FrAction finishAction() const; 25 | 26 | void setOperation(const QString& operation); 27 | 28 | void setMessage(const QString& msg); 29 | 30 | void reject() override; 31 | 32 | private Q_SLOTS: 33 | void onProgress(double fraction); 34 | 35 | void onFinished(FrAction action, ArchiverError error); 36 | 37 | void onMessage(QString msg); 38 | 39 | void onStoppableChanged(bool value); 40 | 41 | void onWorkingArchive(QString filename); 42 | 43 | private: 44 | std::unique_ptr ui_; 45 | Archiver* archiver_; 46 | }; 47 | 48 | #endif // PROGRESSDIALOG_H 49 | -------------------------------------------------------------------------------- /src/progressdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ProgressDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 455 10 | 155 11 | 12 | 13 | 14 | Progress 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | true 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 24 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Qt::Horizontal 52 | 53 | 54 | QDialogButtonBox::Cancel 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | buttonBox 64 | accepted() 65 | ProgressDialog 66 | accept() 67 | 68 | 69 | 248 70 | 254 71 | 72 | 73 | 157 74 | 274 75 | 76 | 77 | 78 | 79 | buttonBox 80 | rejected() 81 | ProgressDialog 82 | reject() 83 | 84 | 85 | 316 86 | 260 87 | 88 | 89 | 286 90 | 274 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt File Archiver" 2 | Desktop Entry/GenericName: "File Archiver" 3 | Desktop Entry/Comment: "File Archiver for the LXQt Desktop" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_ar.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "مؤرشف LXQt للملفات" 2 | Desktop Entry/GenericName: "مؤرشف ملفات" 3 | Desktop Entry/Comment: "أرشيفي الملفات لسطح المكتب LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_bg.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Архивиране на файлове" 2 | Desktop Entry/GenericName: "LXQt File Archiver" 3 | Desktop Entry/Comment: "Програма за работа с файлови архиви" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_ca.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Arxivador de fitxers de LXQt" 2 | Desktop Entry/GenericName: "Arxivador de fitxers" 3 | Desktop Entry/Comment: "Arxivador de fitxers per a l'escriptori LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_cs.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt správce archivů" 2 | Desktop Entry/GenericName: "Správce archivů" 3 | Desktop Entry/Comment: "Správce archivů pro LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_da.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt Arkivhåndtering" 2 | Desktop Entry/GenericName: "Arkivhåndtering" 3 | Desktop Entry/Comment: "Arkivhåndtering for LXQt Skrivebordsmiljøet" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_de.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt Archiver" 2 | Desktop Entry/GenericName: "Archivprogramm" 3 | Desktop Entry/Comment: "Arbeiten mit Dateiarchiven" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_el.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Αρχειοθέτης LXQt" 2 | Desktop Entry/GenericName: "Αρχειοθέτης" 3 | Desktop Entry/Comment: "Αρχειοθέτης για το περιβάλλον εργασίας LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_en_GB.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt File Archiver" 2 | Desktop Entry/GenericName: "File Archiver" 3 | Desktop Entry/Comment: "File Archiver for the LXQt Desktop" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_es.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Compresor de archivos de LXQt" 2 | Desktop Entry/GenericName: "Compresor de archivos" 3 | Desktop Entry/Comment: "Compresor de archivos para el escritorio LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_et.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt arhiivifailide haldaja" 2 | Desktop Entry/GenericName: "Arhiivifailide haldaja" 3 | Desktop Entry/Comment: "Arhiivifailide haldaja LXQt töölauakeskkonna jaoks" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_eu.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt Fitxategi Artxibatzailea" 2 | Desktop Entry/GenericName: "Fitxategi artxibatzailea" 3 | Desktop Entry/Comment: "LXQt mahaigainerako fitxategi artxibatzailea" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_fi.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt:n tiedostopakkaaja" 2 | Desktop Entry/GenericName: "Tiedostopakkaaja" 3 | Desktop Entry/Comment: "LXQt-työpöydän tiedostopakkaaja" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_fr.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt File Archiver" 2 | Desktop Entry/GenericName: "Gestionnaire d'archives" 3 | Desktop Entry/Comment: "Gestionnaire d'archives pour le bureau LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_fur.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Gjestôr Archivis di LXQt" 2 | Desktop Entry/GenericName: "Gjestôr archivis" 3 | Desktop Entry/Comment: "Gjestôr di archivis pal scritori LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_ga.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Cartlannaí Comhad LXQt" 2 | Desktop Entry/GenericName: "Cartlannaí Comhad" 3 | Desktop Entry/Comment: "Cartlannaí Comhad don Deasc LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_gl.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Arquivador de ficheiros" 2 | Desktop Entry/GenericName: "Arquivador de ficheiros para o LXQt" 3 | Desktop Entry/Comment: "Arquivador de ficheiros en Qt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_he.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "מנהל הארכיונים של LXQt" 2 | Desktop Entry/GenericName: "מנהל ארכיונים" 3 | Desktop Entry/Comment: "מנהל ארכיונים לסביבת שולחן העבודה LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_hi.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt फ़ाइल आरकाइवर" 2 | Desktop Entry/GenericName: "फ़ाइल आरकाइवर" 3 | Desktop Entry/Comment: "LXQt डेस्कटॉप के लिए फ़ाइल आरकाइवर" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_hr.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt arhiviranje datoteka" 2 | Desktop Entry/GenericName: "Arhiviranje datoteka" 3 | Desktop Entry/Comment: "Program za arhiviranje datoteka za LXQT okruženje" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_hu.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt Archiváló" 2 | Desktop Entry/GenericName: "Fájltömörítő" 3 | Desktop Entry/Comment: "Egy fájltömörítő Qt-ban" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_is.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt Skráasöfn" 2 | Desktop Entry/GenericName: "Skráasafnstjóri" 3 | Desktop Entry/Comment: "Skráasafnstjóri fyrir LXQt Skjáborð" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_it.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt Archiver" 2 | Desktop Entry/GenericName: "Strumento di archiviazione" 3 | Desktop Entry/Comment: "Strumento di archiviazione per il Desktop LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_ja.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt ファイルアーカイバー" 2 | Desktop Entry/GenericName: "ファイルアーカイバー" 3 | Desktop Entry/Comment: "LXQt デスクトップ環境のファイル圧縮展開ソフトです" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_ka.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt-ის ფაილების დაარქივება" 2 | Desktop Entry/GenericName: "ფაილების დამაარქივებელი" 3 | Desktop Entry/Comment: "ფაილების დამაარქივებელი სამუშაო მაგიდისთვის LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_kab.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "" 2 | Desktop Entry/GenericName: "" 3 | Desktop Entry/Comment: "" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_ko.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt 파일 압축 프로그램" 2 | Desktop Entry/GenericName: "파일 압축 프로그램" 3 | Desktop Entry/Comment: "LXQt 데스크탑용 파일 압축 프로그램" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_lg.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Puloguramu ey'okupakira fayiro eya LXQt" 2 | Desktop Entry/GenericName: "Puloguramu ey'okupakira fayiro" 3 | Desktop Entry/Comment: "Puloguramu ey'okupakira fayiro eyakolebwa awakolerwa awa LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_lt.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt failų archyvavimo programa" 2 | Desktop Entry/GenericName: "Failų archyvavimo programa" 3 | Desktop Entry/Comment: "Failų archyvavimo programa, skirta LXQt darbalaukiui" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_nb_NO.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt-filarkivprogram" 2 | Desktop Entry/GenericName: "Filarkivprogram" 3 | Desktop Entry/Comment: "Filarkivprogram for LXQt-skrivebordet" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_nl.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt-archiefbeheer" 2 | Desktop Entry/GenericName: "Archiefbeheer" 3 | Desktop Entry/Comment: "Archiefbeheerder voor de LXQt-werkomgeving" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_oc.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Gestionari d’archius LXQt" 2 | Desktop Entry/GenericName: "Gestionari d’archius" 3 | Desktop Entry/Comment: "Gestionari d’archius per LXQt Desktop" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_pl.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Archiwizator plików LXQt" 2 | Desktop Entry/GenericName: "Archiwizator plików" 3 | Desktop Entry/Comment: "Archiwizator plików dla pulpitu LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_pt.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Arquivador de ficheiros" 2 | Desktop Entry/GenericName: "Arquivador de ficheiros para o LXQt" 3 | Desktop Entry/Comment: "Arquivador de ficheiros em Qt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_ru.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Архиватор файлов LXQt" 2 | Desktop Entry/GenericName: "Архиватор файлов" 3 | Desktop Entry/Comment: "Архиватор файлов для окружения LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_si.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "" 2 | Desktop Entry/GenericName: "" 3 | Desktop Entry/Comment: "" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_sk.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt správca archívov" 2 | Desktop Entry/GenericName: "Správca archívov" 3 | Desktop Entry/Comment: "Správca archívov pre prostredie LXQT" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_sl.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Arhivsko orodje LXQt" 2 | Desktop Entry/GenericName: "Arhivsko orodje" 3 | Desktop Entry/Comment: "Arhivsko orodje" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_tr.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt Dosya Arşivleyici" 2 | Desktop Entry/GenericName: "Dosya Arşivleyici" 3 | Desktop Entry/Comment: "Dosya Arşivleyici" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_uk.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt Стискач файлів" 2 | Desktop Entry/GenericName: "Стискач файлів" 3 | Desktop Entry/Comment: "Стискач файлів для стільниці LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_vi.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "Quản lí lưu trữ Tập tin LXQt" 2 | Desktop Entry/GenericName: "Quản lí lưu trữ Tập tin" 3 | Desktop Entry/Comment: "Quản lí lưu trữ Tập tin cho Desktop LXQt" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_zh_CN.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt 归档管理器" 2 | Desktop Entry/GenericName: "归档管理器" 3 | Desktop Entry/Comment: "用于LXQt桌面环境的归档管理器" 4 | -------------------------------------------------------------------------------- /src/translations/lxqt-archiver_zh_TW.desktop.yaml: -------------------------------------------------------------------------------- 1 | Desktop Entry/Name: "LXQt 檔案歸檔器" 2 | Desktop Entry/GenericName: "檔案歸檔" 3 | Desktop Entry/Comment: "檔案歸檔用於 LXQt 桌面" 4 | --------------------------------------------------------------------------------