mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 15:17:07 +02:00
Don't autodownload files if sandbox prevents it.
Partially fixes #25308.
This commit is contained in:
parent
ab5792f59f
commit
092923fe6e
4 changed files with 9 additions and 2 deletions
Telegram/SourceFiles
|
@ -587,6 +587,12 @@ void Application::saveSettings() {
|
|||
Local::writeSettings();
|
||||
}
|
||||
|
||||
bool Application::canSaveFileWithoutAskingForPath() const {
|
||||
return !Core::App().settings().askDownloadPath()
|
||||
&& (!KSandbox::isInside()
|
||||
|| !Core::App().settings().downloadPath().isEmpty());
|
||||
}
|
||||
|
||||
MTP::Config &Application::fallbackProductionConfig() const {
|
||||
if (!_fallbackProductionConfig) {
|
||||
_fallbackProductionConfig = std::make_unique<MTP::Config>(
|
||||
|
|
|
@ -178,6 +178,7 @@ public:
|
|||
[[nodiscard]] Settings &settings();
|
||||
void saveSettingsDelayed(crl::time delay = kDefaultSaveDelay);
|
||||
void saveSettings();
|
||||
[[nodiscard]] bool canSaveFileWithoutAskingForPath() const;
|
||||
|
||||
// Fallback config and proxy.
|
||||
[[nodiscard]] MTP::Config &fallbackProductionConfig() const;
|
||||
|
|
|
@ -1118,7 +1118,7 @@ bool DocumentData::saveFromData() {
|
|||
|
||||
bool DocumentData::saveFromDataSilent() {
|
||||
return !filepath(true).isEmpty()
|
||||
|| (!Core::App().settings().askDownloadPath()
|
||||
|| (Core::App().canSaveFileWithoutAskingForPath()
|
||||
&& saveFromDataChecked());
|
||||
}
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ void DocumentMedia::automaticLoad(
|
|||
return;
|
||||
}
|
||||
const auto toCache = _owner->saveToCache();
|
||||
if (!toCache && Core::App().settings().askDownloadPath()) {
|
||||
if (!toCache && !Core::App().canSaveFileWithoutAskingForPath()) {
|
||||
// We need a filename, but we're supposed to ask user for it.
|
||||
// No automatic download in this case.
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue