1. 25 Feb, 2018 2 commits
    • Elvis Angelaccio's avatar
      Stop emitting result() after doKill() · 79219339
      Elvis Angelaccio authored
      Whether the job emits the `result()` signal should depend on the
      argument passed to `KJob::killed()`. From the Ark side we always call
      `kill()` which uses the default argument `Quietly`.
      However, KUiServerJobTracker (called from the plasma systrat applet)
      calls `kill(KJob::EmitResult)`. This means that the result signal will
      be emitted twice: one from `KJob::finishJob()` and another one when the
      Ark jobs return and we go to `Job::onFinished()`.
      This means that from the Ark side we need to emit `result()` only when
      we didn't kill the job quietly, i.e. when we didn't call `doKill()`
      (which sends the request interruption to the secondary threads).
      This patch does that but it's quite an hack. A better long-term solution
      would be to refactor the interface functions so that they return an enum
      rather than a boolean (see T8084).
      Task: T8081
    • Elvis Angelaccio's avatar
      Mark canceled extractions as killed jobs · 92fe1c13
      Elvis Angelaccio authored
      If the user canceled an OverwriteQuery dialog, we should not claim the
      extraction finished. By emitting the canceled() signal, the extraction
      jobs will set the KilledJobError error and the plasma applet will not
      show the "Finished" string in the notification.
      BUG: 382601
      FIXED-IN: 17.12.3
      Task: T6707
  2. 03 Jan, 2018 1 commit
    • Elvis Angelaccio's avatar
      Fix threading issue · d5fdd114
      Elvis Angelaccio authored
      `CreateJob::doWork()` might be executed in another thread (if we are
      using the libarchive or libzip plugin), so any QObject created there
      cannot use `this` as parent (since the CreateJob had been created
      in the main thread).
      We don't actually need to create an Entry object here, since all the
      interfaces have checks for null destination entries.
      Fixes T7206
  3. 18 Nov, 2017 1 commit
    • Elvis Angelaccio's avatar
      ExtractJob: set destination URL in the job description · 52cbbd80
      Elvis Angelaccio authored
      The plasma notification applet looks for it for the "Open" button within
      the notification. If it doesn't find it, it falls back to the archive
      URL which is not what one would expect.
      BUG: 385043
      FIXED-IN: 17.11.90
      Differential Revision: D8861
  4. 08 Nov, 2017 1 commit
  5. 19 Apr, 2017 1 commit
    • Xuetian Weng's avatar
      Fix a I18n problem caused by using i18n and i18np in two places. · 29f9fc8d
      Xuetian Weng authored
      There are two entries with "Extracting one file". The one is called with
      i18n and the other is called with i18np. Thus it confuses the translation
      to use "Extracting %1 files" in i18n() version which is a problem for
      languages with "Plural-Forms: nplurals=1; plural=0;". The actual result
      before this fix will be using the "%1" without arguments.
      Test Plan: Manually tested.
      Reviewers: rthomsen, elvisangelaccio
      Reviewed By: elvisangelaccio
      Subscribers: kde-utils-devel, #ark
      Tags: #ark
      Differential Revision: https://phabricator.kde.org/D5511
  6. 19 Mar, 2017 4 commits
  7. 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
  8. 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
  9. 22 Dec, 2016 1 commit
  10. 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
  11. 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.
  12. 15 Nov, 2016 1 commit
  13. 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
  14. 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.
  15. 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
  16. 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
  17. 11 Oct, 2016 1 commit
  18. 08 Oct, 2016 1 commit
  19. 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
  20. 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
  21. 29 Sep, 2016 1 commit
  22. 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
  23. 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.
  24. 15 Aug, 2016 1 commit
  25. 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
  26. 08 Aug, 2016 1 commit
  27. 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
  28. 19 Jul, 2016 1 commit
  29. 17 Jul, 2016 1 commit
  30. 21 Jun, 2016 1 commit
  31. 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