[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: {
|
onClicked: {
|
||||||
if(file.isDownloadingCompleted) {
|
if(file.isDownloadingCompleted) {
|
||||||
// in this case, the MouseArea should take over
|
// in this case, the MouseArea should take over
|
||||||
tdLibWrapper.openFileOnDevice(file.path);
|
tdLibWrapper.copyFileToDownloads(file.path, true);
|
||||||
} else if(!file.isDownloadingActive) {
|
} else if(!file.isDownloadingActive) {
|
||||||
file.load();
|
file.load();
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,7 +76,7 @@ MessageContentFileInfoBase {
|
||||||
rightMargin: copyButton.width
|
rightMargin: copyButton.width
|
||||||
}
|
}
|
||||||
onClicked: {
|
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();
|
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);
|
QFileInfo fileInfo(filePath);
|
||||||
if (fileInfo.exists()) {
|
if (fileInfo.exists()) {
|
||||||
QString downloadFilePath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + "/" + fileInfo.fileName();
|
QString downloadFilePath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + "/" + fileInfo.fileName();
|
||||||
if (QFile::exists(downloadFilePath)) {
|
if (QFile::exists(downloadFilePath)) {
|
||||||
emit copyToDownloadsSuccessful(fileInfo.fileName(), downloadFilePath);
|
if (openAfterCopy) {
|
||||||
|
this->openFileOnDevice(downloadFilePath);
|
||||||
|
} else {
|
||||||
|
emit copyToDownloadsSuccessful(fileInfo.fileName(), downloadFilePath);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (QFile::copy(filePath, downloadFilePath)) {
|
if (QFile::copy(filePath, downloadFilePath)) {
|
||||||
emit copyToDownloadsSuccessful(fileInfo.fileName(), downloadFilePath);
|
if (openAfterCopy) {
|
||||||
|
this->openFileOnDevice(downloadFilePath);
|
||||||
|
} else {
|
||||||
|
emit copyToDownloadsSuccessful(fileInfo.fileName(), downloadFilePath);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
emit copyToDownloadsError(fileInfo.fileName(), downloadFilePath);
|
emit copyToDownloadsError(fileInfo.fileName(), downloadFilePath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ public:
|
||||||
Q_INVOKABLE QVariantMap getChat(const QString &chatId);
|
Q_INVOKABLE QVariantMap getChat(const QString &chatId);
|
||||||
Q_INVOKABLE QVariantMap getSecretChatFromCache(qlonglong secretChatId);
|
Q_INVOKABLE QVariantMap getSecretChatFromCache(qlonglong secretChatId);
|
||||||
Q_INVOKABLE QString getOptionString(const QString &optionName);
|
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 openFileOnDevice(const QString &filePath);
|
||||||
Q_INVOKABLE void controlScreenSaver(bool enabled);
|
Q_INVOKABLE void controlScreenSaver(bool enabled);
|
||||||
Q_INVOKABLE bool getJoinChatRequested();
|
Q_INVOKABLE bool getJoinChatRequested();
|
||||||
|
|
|
@ -1320,7 +1320,7 @@
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Quiz Mode</source>
|
<source>Quiz Mode</source>
|
||||||
<translation>Režim "kvíz"</translation>
|
<translation>Režim "kvíz"</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Quizzes have one correct answer. Participants can't revoke their responses.</source>
|
<source>Quizzes have one correct answer. Participants can't revoke their responses.</source>
|
||||||
|
@ -1536,7 +1536,7 @@
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Enable online-only mode</source>
|
<source>Enable online-only mode</source>
|
||||||
<translation>Povoliť režim "iba pripojený"</translation>
|
<translation>Povoliť režim "iba pripojený"</translation>
|
||||||
</message>
|
</message>
|
||||||
<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>
|
<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