[SFOS4] Documents app can't access our files anymore, always use Downloads
This commit is contained in:
parent
5de6ea4f11
commit
3575e1674c
4 changed files with 17 additions and 9 deletions
|
@ -35,7 +35,7 @@ MessageContentFileInfoBase {
|
|||
onClicked: {
|
||||
if(file.isDownloadingCompleted) {
|
||||
// in this case, the MouseArea should take over
|
||||
tdLibWrapper.openFileOnDevice(file.path);
|
||||
tdLibWrapper.copyFileToDownloads(file.path, true);
|
||||
} else if(!file.isDownloadingActive) {
|
||||
file.load();
|
||||
} else {
|
||||
|
@ -76,7 +76,7 @@ MessageContentFileInfoBase {
|
|||
rightMargin: copyButton.width
|
||||
}
|
||||
onClicked: {
|
||||
tdLibWrapper.openFileOnDevice(file.path);
|
||||
tdLibWrapper.copyFileToDownloads(file.path, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1412,17 +1412,25 @@ QString TDLibWrapper::getOptionString(const QString &optionName)
|
|||
return this->options.value(optionName).toString();
|
||||
}
|
||||
|
||||
void TDLibWrapper::copyFileToDownloads(const QString &filePath)
|
||||
void TDLibWrapper::copyFileToDownloads(const QString &filePath, bool openAfterCopy)
|
||||
{
|
||||
LOG("Copy file to downloads" << filePath);
|
||||
LOG("Copy file to downloads" << filePath << openAfterCopy);
|
||||
QFileInfo fileInfo(filePath);
|
||||
if (fileInfo.exists()) {
|
||||
QString downloadFilePath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + "/" + fileInfo.fileName();
|
||||
if (QFile::exists(downloadFilePath)) {
|
||||
emit copyToDownloadsSuccessful(fileInfo.fileName(), downloadFilePath);
|
||||
if (openAfterCopy) {
|
||||
this->openFileOnDevice(downloadFilePath);
|
||||
} else {
|
||||
emit copyToDownloadsSuccessful(fileInfo.fileName(), downloadFilePath);
|
||||
}
|
||||
} else {
|
||||
if (QFile::copy(filePath, downloadFilePath)) {
|
||||
emit copyToDownloadsSuccessful(fileInfo.fileName(), downloadFilePath);
|
||||
if (openAfterCopy) {
|
||||
this->openFileOnDevice(downloadFilePath);
|
||||
} else {
|
||||
emit copyToDownloadsSuccessful(fileInfo.fileName(), downloadFilePath);
|
||||
}
|
||||
} else {
|
||||
emit copyToDownloadsError(fileInfo.fileName(), downloadFilePath);
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public:
|
|||
Q_INVOKABLE QVariantMap getChat(const QString &chatId);
|
||||
Q_INVOKABLE QVariantMap getSecretChatFromCache(qlonglong secretChatId);
|
||||
Q_INVOKABLE QString getOptionString(const QString &optionName);
|
||||
Q_INVOKABLE void copyFileToDownloads(const QString &filePath);
|
||||
Q_INVOKABLE void copyFileToDownloads(const QString &filePath, bool openAfterCopy = false);
|
||||
Q_INVOKABLE void openFileOnDevice(const QString &filePath);
|
||||
Q_INVOKABLE void controlScreenSaver(bool enabled);
|
||||
Q_INVOKABLE bool getJoinChatRequested();
|
||||
|
|
|
@ -1320,7 +1320,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Quiz Mode</source>
|
||||
<translation>Režim "kvíz"</translation>
|
||||
<translation>Režim "kvíz"</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Quizzes have one correct answer. Participants can't revoke their responses.</source>
|
||||
|
@ -1536,7 +1536,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Enable online-only mode</source>
|
||||
<translation>Povoliť režim "iba pripojený"</translation>
|
||||
<translation>Povoliť režim "iba pripojený"</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect.</source>
|
||||
|
|
Loading…
Reference in a new issue