Commit c70f5e5a authored by Nicolas Fella's avatar Nicolas Fella Committed by Nate Graham
Browse files

[compress action] Enable fancy "job finished" notification

This way when compressing is finished, we always get a job finished notification
with the filename and the usual actions (open, share, etc).
parent 86f59b1f
Pipeline #137333 passed with stage
in 3 minutes and 52 seconds
......@@ -102,6 +102,7 @@ QAction *CompressFileItemAction::createAction(const QIcon& icon, const QString&
connect(action, &QAction::triggered, this, [fileExtension, urls, name, parent, this]() {
auto *addToArchiveJob = new AddToArchive(parent);
addToArchiveJob->setImmediateProgressReporting(true);
addToArchiveJob->setChangeToFirstPath(true);
for (const QUrl &url : urls) {
addToArchiveJob->addInput(url);
......
......@@ -169,6 +169,9 @@ void AddToArchive::slotStartJob()
m_createJob = Archive::create(m_filename, m_mimeType, m_entries, m_options, this);
m_createJob->setProperty("immediateProgressReporting", m_immediateProgressReporting);
m_createJob->setProperty("destUrl", QUrl::fromLocalFile(m_filename));
if (!m_password.isEmpty()) {
m_createJob->enableEncryption(m_password, m_enableHeaderEncryption);
}
......@@ -260,4 +263,9 @@ QString AddToArchive::getBaseName(const QString &url, const int size)
return base;
}
void AddToArchive::setImmediateProgressReporting(bool immediateProgressReporting)
{
m_immediateProgressReporting = immediateProgressReporting;
}
}
......@@ -41,6 +41,7 @@ public:
void setChangeToFirstPath(bool value);
QString detectBaseName(const QVector<Archive::Entry*> &entries) const;
static QString getFileName(const QList<QUrl> &entries);
void setImmediateProgressReporting(bool immediateProgressReporting);
QString fileName() const
{
......@@ -80,6 +81,7 @@ private:
QVector<Archive::Entry*> m_entries;
bool m_changeToFirstPath;
bool m_enableHeaderEncryption;
bool m_immediateProgressReporting;
};
}
......
......@@ -450,6 +450,7 @@ CreateJob::CreateJob(Archive *archive, const QVector<Archive::Entry*> &entries,
, m_options(options)
{
qCDebug(ARK) << "Created job instance";
setTotalAmount(Files, 1);
}
CreateJob::~CreateJob()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment