Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove transfer when privateMode is set #1057

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/core/downloadmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void DownloadManager::recvObserve(const QString message, const QVariant data)
QString msg = dataMap.value(QStringLiteral("msg")).toString();
QString targetPath = dataMap.value(QStringLiteral("targetPath")).toString();
bool isSaveAsPdf = dataMap.value(QStringLiteral("saveAsPdf")).toBool();
bool isPrivateMode = dataMap.value(QStringLiteral("privateMode")).toBool();
qulonglong downloadId(dataMap.value(QStringLiteral("id")).toULongLong());
bool needPlatformTransfersUpdate = this->needPlatformTransfersUpdate(targetPath);

Expand Down Expand Up @@ -132,6 +133,9 @@ void DownloadManager::recvObserve(const QString message, const QVariant data)
} else if (isMyApp(targetPath)) {
finishMyAppDownload(targetPath);
}
if (isPrivateMode) {
m_transferClient->clearTransfer(m_download2transferMap.value(downloadId));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small downloads disappear now really quickly. I doubt that people find downloaded files from the file system. Instead of immediately clearing, I think it would be nicer to gather a list of completed private downloadIds over here. Then upon clearing of PrivateTabModel (tab count reaching zero and destruction of the model) clear also private downloads from the DownloadManager. How do you see this?

Briefly chatted this with @pvuorela as well.

checkAllTransfers();
} else if (msg == QLatin1Literal("dl-fail")) {
if (needPlatformTransfersUpdate) {
Expand All @@ -140,6 +144,9 @@ void DownloadManager::recvObserve(const QString message, const QVariant data)
QString("browser failure"));
emit downloadStatusChanged(downloadId, DownloadStatus::Failed, data);
}
if (isPrivateMode) {
m_transferClient->clearTransfer(m_download2transferMap.value(downloadId));
}
checkAllTransfers();
} else if (msg == QLatin1Literal("dl-cancel")) {
if (needPlatformTransfersUpdate) {
Expand All @@ -148,6 +155,9 @@ void DownloadManager::recvObserve(const QString message, const QVariant data)
QString("download canceled"));
emit downloadStatusChanged(downloadId, DownloadStatus::Canceled, data);
}
if (isPrivateMode) {
m_transferClient->clearTransfer(m_download2transferMap.value(downloadId));
}
checkAllTransfers();
}
}
Expand Down