mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-04 08:35:21 +00:00
Pass default download path in sandboxed environments.
This commit is contained in:
@@ -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 {
|
||||||
|
Reference in New Issue
Block a user