1. 13 Mar, 2017 1 commit
    • Elvis Angelaccio's avatar
      Improve AddJob description · 957cb17f
      Elvis Angelaccio authored
      'Adding a file' is too generic, 'Compressing a file' is what is actually
      going on.
      CCBUG: 377471
      Differential Revision: D5027
  2. 08 Jan, 2017 1 commit
    • Elvis Angelaccio's avatar
      Properly kill AddToArchive jobs · e777831f
      Elvis Angelaccio authored
      Both AddToArchive and CreateJob are wrapper jobs, they need to implement
      doKill() and call kill() on the actual jobs that are doing the work.
      BUG: 374433
      FIXED-IN: 16.12.1
      Differential Revision: D4000
  3. 22 Dec, 2016 1 commit
  4. 27 Nov, 2016 2 commits
    • Elvis Angelaccio's avatar
      Properly kill BatchExtract jobs · 864d77f1
      Elvis Angelaccio authored
      We need to reimplement `KJob::doKill()` both in `BatchExtract` and
      `BatchExtractJob`. In the latter class we use an enum to keep track of which
      sub-job we are running and kill it when necessary.
      Differential Revision: https://phabricator.kde.org/D3521
    • Elvis Angelaccio's avatar
      Don't show two progress bars with batch extractions · 660076c4
      Elvis Angelaccio authored
      BatchExtractJob runs a LoadJob first and an ExtractJob after, which results in two
      different progress bars in the notification tray. This patch changes how the
      percentage is computed: the first 50% is from the LoadJob, the 2nd 50% from the
      ExtractJob. This ensures that only one progress bar shows up while the wrapper job
      is running. This will only work if the interface is able to report progress for
      both LoadJobs and ExtractJobs (currently only libarchive and clirar).
      Differential Revision: D3518
  5. 26 Nov, 2016 1 commit
    • Elvis Angelaccio's avatar
      Fix percentage progress in batch extractions · 32439e4d
      Elvis Angelaccio authored
      The new BatchExtractJob needs to forward the progress() signal (emitted
      when the underlying ExtractJob runs) to its own onProgress() slot. This
      works because the archiveInterface() instance is the same for both jobs.
  6. 15 Nov, 2016 1 commit
  7. 05 Nov, 2016 1 commit
    • Elvis Angelaccio's avatar
      Simplify Query usage in CLI plugins · 9f3e8511
      Elvis Angelaccio authored
      The Query was still assuming that all plugins run from a secondary
      Since CliInterface-based plugins run from the main thread, there is no need to
      emit the `userQuery` signal and then call `Query::waitForResponse()`.
      They can directly call `Query::execute()` instead.
      Differential Revision: D3217
  8. 20 Oct, 2016 2 commits
    • Elvis Angelaccio's avatar
      Fix race condition in LoadJob · 1121db92
      Elvis Angelaccio authored
      Currently `extracttest` has random failures when we check properties
      with the libarchive plugin.
      This happens because there is a race condition between
      `LoadJob::onFinished()` (where we read some `LoadJob` members) and
      `LoadJob::onNewEntry()` (where we write those members).
      `onFinished()` is called when `list()` returns, in `LoadJob::doWork()`.
      But that might happen before `onNewEntry()` is called, since they are executed
      in two different threads.
      This patch puts the `onFinished()` call in the event queue, just like the
      single-thread case does (where we emit the `finished` signal from `CliInterface`).
      Differential Revision: D3111
    • Elvis Angelaccio's avatar
      GIT_SILENT Fix debug messages · 5b7544ba
      Elvis Angelaccio authored
      Jobs are not started when created.
  9. 17 Oct, 2016 3 commits
    • Elvis Angelaccio's avatar
      Move entryRemoved signal to the read-write interface · 768117e6
      Elvis Angelaccio authored
      Read-only interfaces cannot remove entries, so they should never emit this signal.
      Differential Revision: D3090
    • Ragnar Thomsen's avatar
      Show progress in percentage for all job types in LibarchivePlugin · ef1753b4
      Ragnar Thomsen authored
      Progress is now also shown in percentage for Addjob, CopyJob, DeleteJob
      and MoveJob for archives handled by LibarchivePlugin. This was a bit
      tricky due to libarchive always iterating the whole archive and means
      that the plugin needs to know the total number of existing archive
      A new member variable m_numberOfEntries was added to
      ReadOnlyArchiveInterface, which holds the total number of entries in the
      archive. The variable is kept up-to-date by incrementing/decrementing it
      whenever the entry and entryRemoved signals are emitted by a plugin.
      This necessitated a slight rework of the handling of MoveJob and CopyJob
      by LibarchivePlugin because these emitted entry when iterating over the
      old entries. The new approach should also be more efficient.
      The two Archive members m_numberOfFiles and m_numberOfFolders were
      ReadOnlyArchiveInterface::addFiles() got an additional argument of type
      uint that holds the number of entries to be added.
      Differential Revision: D3072
    • Elvis Angelaccio's avatar
      Add missing Q_OBJECT macros · 8aaf9693
      Elvis Angelaccio authored
  10. 15 Oct, 2016 1 commit
    • Elvis Angelaccio's avatar
      Turn extraction/compression options into classes · 89a7b5bb
      Elvis Angelaccio authored
      Currently CompressionOptions and ExtractionOprions are both QHash typedefs,
      which means they are the same thing for the compiler.
      Currently we even pass CompressionOptions objects where ExtractionOptions objects are expected.
      Both types are changed into proper classes, so that the compiler can
      detect this class of bugs.
      While at it:
      - The default value for the `PreservePaths` option was false, now is true because it's
        the more common case.
      - The `RemoveRootNode` option was redundant, it was only used together with the
        `DragAndDrop` one.
      - The `FollowExtractionDialogSettings` was only set but never read, so we can drop it.
      Differential Revision: D3039
      Task: T2137
  11. 11 Oct, 2016 1 commit
  12. 08 Oct, 2016 1 commit
  13. 05 Oct, 2016 2 commits
    • Ragnar Thomsen's avatar
      Register jobs in KIO's jobtracker · e7a74d59
      Ragnar Thomsen authored
      This makes all of Ark's job types show up in system tray of Plasma. The
      progress of the jobs is then visible in system tray and they can also be
      stopped from system tray. Additionally, the user gets a notification
      when jobs complete.
      Ellipsis were removed from description of LoadJob ("Loading archive...")
      to be consistent with description of the other jobs.
    • Elvis Angelaccio's avatar
      BacthExtractJob: fix forwarding of errors · 6db65d75
      Elvis Angelaccio authored
      Now ark shows again the error dialog when a wrong password is provided
      upon batch-extracting header-encrypted archives.
      Task: 1877
  14. 02 Oct, 2016 1 commit
    • Elvis Angelaccio's avatar
      Refactor archive loading · 88acd303
      Elvis Angelaccio authored
      Ark currently loads an archive by using `Archive *Archive::create()` first
      and then `ListJob *archive->list()`. If an archive property is read
      *before* list() is called, the archive is listed in the background with
      This design is responsible for a lot or problems (see T1877, T3296 and T330).
      This commit refactors ListJob in a new LoadJob class. Is not possible
      anymore to create an archive and then list() it. Instead, a LoadJob is
      started first and then the archive can be retrieved at the end of the
      Differential Revision: D2811
  15. 29 Sep, 2016 1 commit
  16. 14 Sep, 2016 1 commit
    • Elvis Angelaccio's avatar
      Fix race condition when killing jobs · 8ad610bf
      Elvis Angelaccio authored
      The `m_abortOperation` global variable was set by the main thread and read
      by the secondary thread, i.e. undefined behavior.
      QThread::requestInterruption() and isInterruptionRequest() are instead
      safe because they use a QMutexLocker.
      Tested only with ListJobs, are other type of jobs are currently broken
      (see e.g. bugs #365869 and #365870).
      Closes T3598
  17. 13 Sep, 2016 1 commit
    • Elvis Angelaccio's avatar
      Drop unused event loop code · 0fffb964
      Elvis Angelaccio authored
      The event loop in the QThread's run() method was only necessary when
      CliInterface was running in another thread, but this is no longer
      happening. This event loop does not even start because when doWork()
      returns, `result` has already been emitted, resulting in q->isRunning()
      being false.
      This also means that we can drop m_isRunning, removing a possible
      source of race conditions.
  18. 15 Aug, 2016 1 commit
  19. 11 Aug, 2016 1 commit
    • Ragnar Thomsen's avatar
      AddJob: Count number of entries to be added · 41e3d16e
      Ragnar Thomsen authored
      Count the total number of entries to be added using QDirIterator. We can
      then use the number to display a correct string in statusbar when adding
      files. Also pass the number to AddFiles() so interfaces/plugins can use
      it for showing progress in %.
      Differential Revision: D2397
  20. 08 Aug, 2016 1 commit
  21. 22 Jul, 2016 1 commit
    • Elvis Angelaccio's avatar
      Fix preview of nested archives · 8be8fe5b
      Elvis Angelaccio authored
      The assumption that a PreviewJob can remove its temp dir when it's done (commit 41b25127)
      was wrong, at least with nested archives.
      If we remove the extracted file too soon, there is no way to preview a nested archive or,
      worse, a "double-nested" archive.
      This patch just delays the cleanup to the Part destructor.
      Differential Revision: D2265
  22. 19 Jul, 2016 1 commit
  23. 17 Jul, 2016 1 commit
  24. 21 Jun, 2016 1 commit
  25. 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
  26. 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
  27. 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
  28. 02 May, 2016 1 commit
    • Elvis Angelaccio's avatar
      Drop CliInterface::isCliBased() · c090e935
      Elvis Angelaccio authored
      The only reason why we needed to know whether an interface is CLI-based was to
      check whether the executables needed by the cliplugins were available.
      This check is now done in the Plugin class, so we can drop this function.
  29. 30 Apr, 2016 1 commit
    • 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
  30. 23 Apr, 2016 1 commit
    • Elvis Angelaccio's avatar
      libarchive: properly stop all jobs · 8c21ca3a
      Elvis Angelaccio authored
      We use the m_abortOperation flag in the same way ListJob does (see commit
      We also need to remove the disconnect() in the Job destructor, which makes Ark
      crash if we stop an AddToArchive job. This disconnect() looks like a relic of the
      past (see e.g. commit 15fce6f5) and doesn't seem really necessary.
      Note that the CliInterface jobs still need to be fixed. So do batch extract
      jobs, which are KCompositeJobs and currently ignore the kill button in the
      CCBUG: 222392
      Differential Revision: D1466
  31. 16 Apr, 2016 1 commit
    • Elvis Angelaccio's avatar
      Move GlobalWorkDir logic to AddJob::doWork() · 4320f587
      Elvis Angelaccio authored
      When adding files, we now change the working dir to GlobalWorkDir at the AddJob level.
      This way is easier to restore the old working dir, and we also merge
      some duplicated code between cliinterface and libarchiveplugin.
      Differential Revision: D1369
  32. 06 Apr, 2016 1 commit
    • Elvis Angelaccio's avatar
      Run CliInterface from the main thread · a537c5ee
      Elvis Angelaccio authored
      CLI-based plugins run their jobs in another process, so we can avoid to also
      run them in another thread. This also fixes a race condition with the unit
      Differential Revision: D1229
  33. 23 Feb, 2016 3 commits
    • Elvis Angelaccio's avatar
      Fix subfolder detection of RPM archives · e1fca1f8
      Elvis Angelaccio authored
      Filenames in a RPM archive start with the ./ prefix.
      This means that "." is detected as the subfolder name by the ListJob.
      We now remove this prefix to prevent this meaningless string to show up in the extraction dialog,
      as the value of the subfolder QLineEdit. An autotest is added as well to assert
      this behavior.
      See also https://git.reviewboard.kde.org/r/126756/
      CC: rdieter@math.unl.edu
    • Elvis Angelaccio's avatar
      Fix subfolder name of archives with single files · a89e1799
      Elvis Angelaccio authored
      Archives which are not single folder should not suggest a subfolder name.
      Otherwise archives which contain only a single file would report that file's
      name as the subfolder name.
      The archivetest is now updated to assert this.
    • Elvis Angelaccio's avatar
      Fix archives with single files detected as single folder · bb76f994
      Elvis Angelaccio authored
      If an archive contains only one file, there is no folder in it and
      thus is wrong to claim that it is a single folder archive.
      If the archive instead contains only one empty folder, we can and should say that it's
      single folder.
      The unit tests are updated to assert this.