Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F112324
D200.1732293689.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D200.1732293689.diff
View Options
diff --git a/src/kazv-io-job.hpp b/src/kazv-io-job.hpp
--- a/src/kazv-io-job.hpp
+++ b/src/kazv-io-job.hpp
@@ -119,7 +119,7 @@
public:
KazvIODownloadJob(const QString &hash, std::optional<Kazv::AES256CTRDesc> aes = std::nullopt, QObject *parent = 0);
- KazvIODownloadJob(const QString &fileName, const QUrl &serverUrl, const QString &hash,
+ KazvIODownloadJob(const QString &fileName, const QUrl &serverUrl, const bool showProgressBar, const QString &hash,
std::optional<Kazv::AES256CTRDesc> aes = std::nullopt, QObject *parent = 0);
~KazvIODownloadJob();
@@ -147,7 +147,8 @@
KazvIOUploadJob(std::optional<Kazv::AES256CTRDesc> aes = std::nullopt,
const QString &relType = QStringLiteral(""),
const QString &relatedTo = QStringLiteral(""), QObject *parent = 0);
- KazvIOUploadJob(const QString fileName, const QUrl serverUrl, MatrixRoomList *roomList,
+ KazvIOUploadJob(const QString fileName, const QUrl serverUrl,
+ const bool showProgressBar, MatrixRoomList *roomList,
const QString &roomId, const QString token,
std::optional<Kazv::AES256CTRDesc> aes = std::nullopt,
const QString &relType = QStringLiteral(""),
diff --git a/src/kazv-io-job.cpp b/src/kazv-io-job.cpp
--- a/src/kazv-io-job.cpp
+++ b/src/kazv-io-job.cpp
@@ -164,13 +164,14 @@
m_d->hash = hash;
}
-KazvIODownloadJob::KazvIODownloadJob(const QString &fileName, const QUrl &serverUrl,
+KazvIODownloadJob::KazvIODownloadJob(const QString &fileName, const QUrl &serverUrl, bool showProgressBar,
const QString &hash, std::optional<Kazv::AES256CTRDesc> aes, QObject *parent)
: KazvIOBaseJob(aes, parent)
, m_d(new KazvIODownloadJobPrivate)
{
if (setFile(fileName)) {
- setJob(KIO::get(serverUrl));
+ auto flag = showProgressBar ? KIO::DefaultFlags : KIO::HideProgressInfo;
+ setJob(KIO::get(serverUrl, KIO::NoReload, flag));
}
m_d->hash = hash;
}
@@ -254,8 +255,8 @@
}
KazvIOUploadJob::KazvIOUploadJob(const QString fileName, const QUrl serverUrl,
- MatrixRoomList *roomList, const QString &roomId, const QString token,
- std::optional<Kazv::AES256CTRDesc> aes,
+ const bool showProgressBar, MatrixRoomList *roomList, const QString &roomId,
+ const QString token, std::optional<Kazv::AES256CTRDesc> aes,
const QString &relType, const QString &relatedTo, QObject *parent)
: KazvIOBaseJob(aes, parent)
, m_d(new KazvIOUploadJobPrivate)
@@ -265,7 +266,10 @@
if (setFile(fileName)) {
auto kazvUploadJob = Kazv::Api::UploadContentJob(serverUrl.toString().toStdString(),
token.toStdString(), Kazv::FileDesc(std::string()));
- auto job = KIO::http_post(QUrl(QString::fromStdString(kazvUploadJob.url())), m_d->file.data());
+ auto jobFlag = showProgressBar ? KIO::DefaultFlags : KIO::HideProgressInfo;
+ auto job = KIO::http_post(
+ QUrl(QString::fromStdString(kazvUploadJob.url())),
+ m_d->file.data(), jobFlag);
job->addMetaData(u"customHTTPHeader"_s, QStringLiteral("Authorization: ")
.append(QString::fromStdString(kazvUploadJob.requestHeader()->at("Authorization"))));
job->addMetaData(u"PropagateHttpHeader"_s, u"true"_s);
diff --git a/src/kazv-io-manager.hpp b/src/kazv-io-manager.hpp
--- a/src/kazv-io-manager.hpp
+++ b/src/kazv-io-manager.hpp
@@ -33,7 +33,8 @@
Q_PROPERTY(QString cacheDirectory READ cacheDirectory WRITE setCacheDirectory NOTIFY cacheDirectoryChanged)
QPointer<KazvIODownloadJob> makeDownloadJob(
- const QUrl &serverUrl, const QUrl &localFileUrl, const QString &hash,
+ const QUrl &serverUrl, const QUrl &localFileUrl,
+ const bool showPrograssBar, const QString &hash,
const QString &key = QStringLiteral(""),
const QString &iv = QStringLiteral("")) const;
diff --git a/src/kazv-io-manager.cpp b/src/kazv-io-manager.cpp
--- a/src/kazv-io-manager.cpp
+++ b/src/kazv-io-manager.cpp
@@ -60,15 +60,18 @@
KazvIOManager::~KazvIOManager() = default;
QPointer<KazvIODownloadJob> KazvIOManager::makeDownloadJob(
- const QUrl &serverUrl, const QUrl &localFileUrl, const QString &hash,
+ const QUrl &serverUrl, const QUrl &localFileUrl,
+ const bool showPrograssBar, const QString &hash,
const QString &key, const QString &iv) const
{
QPointer<KazvIODownloadJob> job{};
if (key.isEmpty()) {
- job = new KazvIODownloadJob{localFileUrl.toLocalFile(), serverUrl, hash, std::nullopt};
+ job = new KazvIODownloadJob{localFileUrl.toLocalFile(),
+ serverUrl, showPrograssBar, hash, std::nullopt};
} else {
auto aes = Kazv::AES256CTRDesc{key.toStdString(), iv.toStdString()};
- job = new KazvIODownloadJob{localFileUrl.toLocalFile(), serverUrl, hash, aes};
+ job = new KazvIODownloadJob{localFileUrl.toLocalFile(),
+ serverUrl, showPrograssBar, hash, aes};
}
return job;
}
@@ -79,7 +82,9 @@
const QString filePath = m_d->cacheDir.filePath(id);
QDir dir(m_d->cacheDir.path());
if (!dir.exists(id) && this->getCacheJob(id) == nullptr) {
- auto job = this->makeDownloadJob(fileUrl, QUrl::fromLocalFile(filePath), hash, key, iv);
+ auto job = this->makeDownloadJob(fileUrl,
+ QUrl::fromLocalFile(filePath),
+ /* showProgressBar = */ false, hash, key, iv);
m_d->cacheJobs[id] = job;
connect(job, &KazvIOBaseJob::result, this, [this, id](auto /* result */) {
m_d->cacheJobs[id]->deleteLater();
@@ -92,7 +97,8 @@
KazvIOBaseJob *KazvIOManager::startNewDownloadJob(const QUrl &serverUrl, const QUrl &localFileUrl,
const QString &jobId, const QString &hash, const QString &key, const QString &iv)
{
- auto downloadJob = this->makeDownloadJob(serverUrl, localFileUrl, hash, key, iv);
+ auto downloadJob = this->makeDownloadJob(serverUrl, localFileUrl,
+ /* showProgressBar = */ true, hash, key, iv);
m_d->downloadJobs[jobId].reset(downloadJob);
QQmlEngine::setObjectOwnership(downloadJob.data(), QQmlEngine::CppOwnership);
@@ -109,10 +115,10 @@
auto aes = Kazv::AES256CTRDesc::fromRandom(
m_d->randomGenerator.generateRange<Kazv::RandomData>(Kazv::AES256CTRDesc::randomSize));
uploadJob = new KazvIOUploadJob(localFileUrl.toLocalFile(), serverUrl,
- roomList, roomId, token, aes, relType, relatedTo);
+ /* showProgressBar = */ true, roomList, roomId, token, aes, relType, relatedTo);
} else {
uploadJob = new KazvIOUploadJob(localFileUrl.toLocalFile(), serverUrl,
- roomList, roomId, token, std::nullopt, relType, relatedTo);
+ /* showProgressBar = */ true, roomList, roomId, token, std::nullopt, relType, relatedTo);
}
if (!m_d->uploadJobs.contains(roomId) || m_d->uploadJobs[roomId].isNull()) {
m_d->uploadJobs[roomId].reset(new UploadJobModel());
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 8:41 AM (1 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38366
Default Alt Text
D200.1732293689.diff (6 KB)
Attached To
Mode
D200: Disable show KIO status notification when cache files
Attached
Detach File
Event Timeline
Log In to Comment