mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Pass default download path in sandboxed environments.
This commit is contained in:
parent
bff641c217
commit
a2b0c551c2
1 changed files with 7 additions and 6 deletions
|
@ -173,6 +173,11 @@ QString DefaultDownloadPathFolder(not_null<Main::Session*> session) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DefaultDownloadPath(not_null<Main::Session*> session) {
|
QString DefaultDownloadPath(not_null<Main::Session*> session) {
|
||||||
|
const auto realDefaultPath = QStandardPaths::writableLocation(
|
||||||
|
QStandardPaths::DownloadLocation)
|
||||||
|
+ '/'
|
||||||
|
+ DefaultDownloadPathFolder(session)
|
||||||
|
+ '/';
|
||||||
if (KSandbox::isInside() && Core::App().settings().downloadPath().isEmpty()) {
|
if (KSandbox::isInside() && Core::App().settings().downloadPath().isEmpty()) {
|
||||||
QStringList files;
|
QStringList files;
|
||||||
QByteArray remoteContent;
|
QByteArray remoteContent;
|
||||||
|
@ -183,7 +188,7 @@ QString DefaultDownloadPath(not_null<Main::Session*> session) {
|
||||||
tr::lng_download_path_choose(tr::now),
|
tr::lng_download_path_choose(tr::now),
|
||||||
QString(),
|
QString(),
|
||||||
FileDialog::internal::Type::ReadFolder,
|
FileDialog::internal::Type::ReadFolder,
|
||||||
QString());
|
realDefaultPath);
|
||||||
if (success && !files.isEmpty() && !files[0].isEmpty()) {
|
if (success && !files.isEmpty() && !files[0].isEmpty()) {
|
||||||
const auto result = files[0].endsWith('/') ? files[0] : (files[0] + '/');
|
const auto result = files[0].endsWith('/') ? files[0] : (files[0] + '/');
|
||||||
Core::App().settings().setDownloadPath(result);
|
Core::App().settings().setDownloadPath(result);
|
||||||
|
@ -191,11 +196,7 @@ QString DefaultDownloadPath(not_null<Main::Session*> session) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QStandardPaths::writableLocation(
|
return realDefaultPath;
|
||||||
QStandardPaths::DownloadLocation)
|
|
||||||
+ '/'
|
|
||||||
+ DefaultDownloadPathFolder(session)
|
|
||||||
+ '/';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
Loading…
Add table
Reference in a new issue