1. 10 Jun, 2016 1 commit
    • Elvis Angelaccio's avatar
      Add new jobs to preview/open a file · 41b25127
      Elvis Angelaccio authored
      The goal of task T916 is to stop disabling the Part UI while extracting an
      entry. To do so, we need first to make sure that no race condition would occur
      if extracting two or more entries in parallel.
      A race condition might occur in Part::slotOpenExtractedEntry(), where
      m_openFileMode is a global member that could be accessed concurrently between
      different threads. We can stop using this variable if we introduce dedicated
      jobs for preview/opening of files. This way we can simply do a dynamic_cast on
      the local job variable, to check whether the user wants to open or open-with
      the file.
      Preview is totally unrelated so it can be moved into a different slot. We can
      also make sure that the PreviewJob deletes the temporary directory upon
      Differential Revision: D1749
  2. 05 Jun, 2016 1 commit
    • Elvis Angelaccio's avatar
      Fix opening of files whose mimetype inherits from a supported mimetype · 8b9cd300
      Elvis Angelaccio authored
      Before 16.04 Ark used to be able to open files whose mimetype is not directly
      registered with Ark, but inherits from a mimetype that is supported by Ark.
      Examples are .odt and .epub files that both inherits from application/zip.
      Since we don't use anymore KMimeTypeTrader (since 16.04), we need to manually
      do this check while loading our plugins.
      BUG: 363717
      FIXED-IN: 16.04.2
      Differential Revision: D1725
  3. 02 Jun, 2016 1 commit
    • Elvis Angelaccio's avatar
      Cache the detected archive mimetype · 65895fc6
      Elvis Angelaccio authored
      Archive::mimeType() is frequently called (i.e. every time that in the view the selected
      entry changes), so this saves some computation and reduces the amount of noisy
      debug output.
  4. 06 May, 2016 1 commit
    • Elvis Angelaccio's avatar
      Make jobs parent-less · 268ad34f
      Elvis Angelaccio authored
      KJobs autodelete themselves using deleteLater(), when they are done.
      So there is no reason to have them as children of Archive.
      This fixes a crash when canceling a ListJob with header-encrypted archives
      (see task T2225).
      Differential Revision: D1525
  5. 03 May, 2016 1 commit
    • Ragnar Thomsen's avatar
      Add basic test functionality · 13d70a48
      Ragnar Thomsen authored
      Add a TestJob and associated action in Part. Test functionality is
      enabled in plugin json files, currently for clizip, clirar and cli7z.
      Test results are displayed simply as success/failure in a KMessageBox.
      Testing password-protected archives will currently result in an
      errorbox, due to these archives potentially having different passwords
      for each file and hence multiple password prompts might pop up.
      Libarchive does not support testing archives.
      FEATURE: 140492
      FIXED-IN: 16.08.0
      Differential Revision: D1516
  6. 30 Apr, 2016 2 commits
    • Ragnar Thomsen's avatar
      Add support for editing/adding archive comments · 04d56afa
      Ragnar Thomsen authored
      Support was added for editing comments in supported archive types
      (currently only RAR). A new bool was added to plugin json files
      ("SupportsWriteComment") to indicate support. A new action was added and
      is found in Archive menu. The editing of comment is done in the same
      QPlainTextEdit used to display comments before. When user modifies
      comment, a KMessageWidget pops up with a "Save" button. Actual saving of
      comment to archive is achieved by a new job type: CommentJob.
      FEATURE: 357594
      FIXED-IN: 16.08.0
      Differential Revision: D1493
    • Ragnar Thomsen's avatar
      Ask password when adding files to protected archive · cbea04af
      Ragnar Thomsen authored
      Previously, when opening a non-headerencrypted password protected
      archive and adding files to it, the files would be added unprotected.
      This commit checks if archive is password-protected and if stored
      password is empty. If that's the case, the user is queried for a
      password. Currently, it is not possible to check if the entered password
      is the same as the one used to create the archive originally, so there
      exists a possibility for individual files in the archive having
      different passwords. This will be addressed in a separate patch.
      Differential Revision: D1508
  7. 28 Apr, 2016 1 commit
    • Elvis Angelaccio's avatar
      Auto delete ListJobs · 72a46a21
      Elvis Angelaccio authored
      Commit 8c21ca3a broke the preview/opening of files. This is actually due to
      ListJobs not autodeleting themeselves upon completion. This was introduced by
      commit 4b67603d to fix bug 217836, which doesn't seem reproducible nowadays.
      Even if it was, we would need a better fix, because this line is causing also
      different issues on master (where we now run CliInterface from the main
      CCBUG: 217836
      Task: T2374
  8. 27 Apr, 2016 1 commit
    • Elvis Angelaccio's avatar
      Use PluginManager to load plugins in the Archive class · fc7c6ded
      Elvis Angelaccio authored
      The Archive class now uses internally the PluginManager class, when loading the
      plugins. This means that it's now possible to disable a specific plugin in the
      arkrc configuration file. For example, the following will disable the clirar
      Differential Revision: D1477
  9. 29 Mar, 2016 1 commit
  10. 20 Mar, 2016 1 commit
    • Elvis Angelaccio's avatar
      Fix potential crashes in Archive class · 55f22477
      Elvis Angelaccio authored
      Invalid instances of the Archive class don't have a valid m_iface pointer, so
      this needs to be checked in all the relevant Archive's methods.
      Differential Revision: D1183
  11. 16 Mar, 2016 2 commits
    • Elvis Angelaccio's avatar
      Add unit tests for AddToArchive · 9823866b
      Elvis Angelaccio authored
      This also fixes a couple of issues with the Archive properties.
      Differential Revision: D1157
    • Ragnar Thomsen's avatar
      Improve handling of supported mimetypes · 01fd1abe
      Ragnar Thomsen authored
      Move mimetype-handling functions from archive-kerfuffle.cpp to own file
      In MainWindow::openArchive() set filter using
      QFileDialog::setMimeTypeFilters() instead of using
      QFileDialog::setNameFilters(). This fixes sorting of filters in the
      "Open Archive" dialog with KF 5.20.0. Frameworkintegration 5.20.0 broke
      the old sorting with commit 415ad2ed48356c3065c937813888fa1bd2742789.
      Now we get the "All Supported Files" filter automatically.
      Differential Revision: D1144
  12. 14 Mar, 2016 1 commit
    • Elvis Angelaccio's avatar
      Add runtime check for available CLI plugins · 59b5fe45
      Elvis Angelaccio authored
      Currently we collect the supported mimetypes by iterating over the list of
      plugin metadata. This patch adds the cli executables to the json metadata,
      in order to check at runtime whether we can actually advertise support for the
      mimetypes associated to every cliplugin.
      Differential Revision: D1139
  13. 12 Mar, 2016 6 commits
    • Elvis Angelaccio's avatar
      Don't list non-existing archives · 496b7686
      Elvis Angelaccio authored
      This issue was supposed to be fixed by commit e5fcaedc,
      but actually that patch only addressed the Archive::list() issued by the Part/ArchiveModel.
      This patch generalizes the check for the "private" Archive::list() calls as well.
      This slightly changes the expected values in the unit test for the properties of
      a non-existing archive.
      Differential Revision: D1133
    • Ragnar Thomsen's avatar
      Add mimetype tests and fix .tar.Z support in libarchive · 67e2c12c
      Ragnar Thomsen authored
      Mimetype tests were added for several tar-based formats. Adding the
      tests revealed that creating/modifying .tar.Z archives was broken even
      though we advertise readwrite support for this format in libarchive
      plugin. This is now fixed.
    • Elvis Angelaccio's avatar
      Refactor Archive::create() · 736b2a59
      Elvis Angelaccio authored
      This introduces another create() overloaded function, which accepts a single
      KPLuginMetaData object.
      This new function paves the way to load a specific plugin in the unit tests,
      or (in the future) a plugin chosen by the user through some dedicated GUI.
      Differential Revision: D1131
    • Ragnar Thomsen's avatar
      Add support for lrzipped tar archives · 1b58d4db
      Ragnar Thomsen authored
      Enable readwrite support for lrzipped tar archives in libarchiveplugin.
      Libarchive currently uses the lrzip executable to handle this
      compression type, so we remove the archive type from filter list in
      "Open Archive" and "New Archive" dialogs if the executable is not found
      in path.
      BUG: 356253
      FIXED-IN: 16.04.0
      Differential Revision: D1132
    • Elvis Angelaccio's avatar
    • Elvis Angelaccio's avatar
      Improve password-protection status in the properties dialog · 2dd4b816
      Elvis Angelaccio authored
      An archive could be just password-protected but also header-encrypted.
      This is now displayed to the user in the properties dialog.
      Differential Revision: D1124
  14. 11 Mar, 2016 3 commits
    • Ragnar Thomsen's avatar
      Add support for lzop-compressed tar archives · 17df27da
      Ragnar Thomsen authored
      Enable readwrite support for lzop-compressed tar archives in libarchive
      This bumps the required version of libarchive to 3.1.0.
      BUG: 211669
      FIXED-IN: 16.04.0
      Differential Revision: D1123
    • Elvis Angelaccio's avatar
      Improve Archive properties · 3ff03538
      Elvis Angelaccio authored
      This patch adds new properties to the Archive class. We also now use the
      keyword CONSTANT to mark the properties that are not supposed to change during
      the archive lifetime.
      Differential Revision: D1119
    • Elvis Angelaccio's avatar
      Fix bug in Archive::setPassword() · 578fc875
      Elvis Angelaccio authored
      If we encrypt the archive, we need to update the isPasswordProtected property
      as well.
  15. 09 Mar, 2016 2 commits
    • Elvis Angelaccio's avatar
      Simplify mimetypes handling · 7595cd79
      Elvis Angelaccio authored
      Now that we have the Archive::mimeType() function, we can use it to return
      directly a QMimeType object, which simplifies a lot many places in the code.
      This also adds the QMimeType::comment() in the properties dialog, since it's
      more user-friendly.
      Differential Revision: D1096
    • Ragnar Thomsen's avatar
      Add properties dialog · 5552a4c9
      Ragnar Thomsen authored
      A properties dialog was added which displays information about the
      archive. The dialog can be accessed through the Archive menu or hotkey
      Differential Revision: D1076
  16. 08 Mar, 2016 1 commit
    • Elvis Angelaccio's avatar
      Port plugins loading to KPluginLoader · 060d23f0
      Elvis Angelaccio authored
      The ark plugins are now ported to the new KPluingLoader loading mechanism.
      The main advantage is that we now save a call to the Syscoca service trader,
      since the plugins are installed in a private 'kerfuffle' subdirectory of the
      system plugins folder.
      In order to be found by KPluginLoader, a plugin has to embed its metadata
      defined in a .json file. We convert the existing .desktop files to .json at build time, when possible.
      Otherwise we use directly .json metadata files (e.g. for clirar or cliunarchiver).
      The libarchive plugin had to be split in two different plugins, one for the
      read-only mimetypes and another one for the read-write ones. This is because
      the old plugin was using two .desktop files, but the new plugins can only embed
      a single .json file.
      For more details, see task T923 on phabricator.
  17. 23 Feb, 2016 1 commit
    • Elvis Angelaccio's avatar
      Introduce and test Archive::completeBaseName() · c5b1a8c1
      Elvis Angelaccio authored
      This tests the code used to detected a subfolder name if the archive is not
      single folder.
      We test this new function in place of fileName(), which is an absolute path and so almost
      useless to test anyway.
  18. 21 Jan, 2016 1 commit
    • Elvis Angelaccio's avatar
      Fix opening of ISO files detected as text/plain. · 1587a9f9
      Elvis Angelaccio authored
      The workaround in commit b10430b0 was partly reverted by commit 3906648d and is
      now restored by this patch.
      Some ISO file may be detected-by-content as text/plain, so this case is not catched
      by comparing with application/octect-stream.
      The new autotest would have catched the regression, and will prevent it from
      happening again.
      CCBUG: 354344
  19. 23 Dec, 2015 1 commit
    • Elvis Angelaccio's avatar
      Fallback to read-only mode if there are no read-write executables · 087e5aab
      Elvis Angelaccio authored
      Commit 2d000a07 introduced executables check when loading a plugin. However the
      current behavior is too restrictive: if one wants only to open a rar or a
      zip archive, there is no need to require also the rar or zip program to be
      installed. Plus, some distributions (e.g. Archlinux) ship only unrar in their
      official repositories.
      With this commit, Ark is able to understand that e.g. unrar is installed but
      rar is not. In this case, Ark can and should fallback to read-only mode,
      to disable the Add/Delete actions in the toolbar.
      BUG: 357057
      FIXED-IN: 15.12.1
      CC: rthomsen6@gmail.com
  20. 09 Dec, 2015 1 commit
  21. 08 Dec, 2015 1 commit
    • Elvis Angelaccio's avatar
      Fix opening of archives whose mimetype cannot be detected-by-content · 3906648d
      Elvis Angelaccio authored
      shared-mime-info 1.5 (and thus QMimeDatabase) cannot
      detect-by-content tar archives created with the --format=v7 flag.
      Instead of adding another exception (like we did for ISO files), let's just use
      the mimetype detected from the extension if the one from content could not be
      BUG: 355955
      FIXED-IN: 15.12.0
  22. 28 Nov, 2015 1 commit
  23. 18 Nov, 2015 1 commit
  24. 31 Oct, 2015 1 commit
  25. 27 Oct, 2015 1 commit
  26. 26 Oct, 2015 1 commit
    • Ragnar Thomsen's avatar
      Add support for reading archive comments · 3a22bbd5
      Ragnar Thomsen authored
      Add support for reading comments in CLI-based plugins such as rar and
      zip. The comment is parsed from the output of ListJob. The comment is
      displayed below the file view in a read-only QPlainTextEdit with
      monospace font. A QSplitter is used so the user can resize the comment
      Support is added to clirar, clizip and cli7z plugins. The 7z-format
      doesn't support comments, but the cli7z-plugin supports reading comments
      in e.g. zip archives.
      BUG: 328790
      FIXED-IN: 15.12.0
      REVIEW: 124468
  27. 25 Oct, 2015 2 commits
    • Elvis Angelaccio's avatar
      Fix opening of ISO files · b10430b0
      Elvis Angelaccio authored
      Opening an ISO file was not possible anymore, due to a regression between
      shared-mime-info 1.2 and 1.3 which makes application/x-cd-image not detectable
      by content. This workaround fix the issue, until we are not sure that
      all major distribution ship a fixed shared-mime-info.
      BUG: 354344
      FIXED-IN: 15.08.3
      Differential Review: D453
    • Ragnar Thomsen's avatar
      Improve error handling when loading plugins · 3fcd8425
      Ragnar Thomsen authored
      Previously, if Archive::create() failed to load a plugin, a QInputDialog
      was shown where the user could choose the mimetype of the archive. This
      was not suitable anymore, since mimetype detection is much better now
      and because we now try all registered plugins for a mimetype.
      New behavior: When a plugin fails to load, two different error messages
      can be shown:
      1. No suitable plugin was found.
      2. All suitable plugins failed to load.
      Because we (potentially) try to load different plugins, which can fail
      for different reasons (missing executables, broken plugin, etc.), error
      message 2 can not be made more specific.
      This was implemented by adding an alternative constructor for Archive
      which takes an error code. Part::openFile() then checks if an error
      message is found before continuing to load the interface, and if that is
      the case displays one of the the error messages.
      Differential Revision: D408
  28. 21 Oct, 2015 1 commit
    • Elvis Angelaccio's avatar
      Fix opening of compressed tar archives with special characters in the extension · 9e160755
      Elvis Angelaccio authored
      Compressed tar archives are detected as singlefile
      archives when detecting the mimetype by content.
      This means that we cannot rely on it to correctly
      open such an archive with special characters in
      the extension, as we do for the other plugins.
      This patch performs input validation on the
      filename extension of compressed tar archives.
      Non-alpha characters are removed from the extension,
      excluding periods, before detecting the mimetype by name.
      BUG: 328815
      FIXED-IN: 15.08.3
      Differential Revision: D432
  29. 20 Oct, 2015 1 commit
    • Elvis Angelaccio's avatar
      Introduce unit test for mimetypes detection · 11c94a48
      Elvis Angelaccio authored
      The static function determineMimeType() defined in archive_kerfuffle.cpp is a good candidate to be unit tested.
      To do so, we need to make it visible from the outside.
      Differential Revision: D431