Commit b324da9c authored by Martin Straka's avatar Martin Straka

Fixed saving location for iOS

parent 31b396b5
......@@ -365,10 +365,23 @@ void Files::saveAttachmentsToDisk(const QString &userName, qint64 msgId)
QString path = QFileDialog::getExistingDirectory(0,
tr("Select Directory"),
QString path = getBasePathBasedOnPlatform();
#if defined Q_OS_IOS
/* There is only one location where files or data can store
* permanently and share with Desktop.
* See:
path = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
/* Another platform can select destination for attachment saving. */
path = QFileDialog::getExistingDirectory(0,
tr("Select directory"), path,
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
foreach (const FileDb::FileData &file, filelist) {
QByteArray data = QByteArray::fromBase64(file.content.toUtf8());
......@@ -225,14 +225,19 @@ QString writeTemporaryFile(const QString &fileName, const QByteArray &data,
QString writeFileToDir(const QString &basePath, const QString &fileName,
qint64 msgId, const QByteArray &data, bool deleteOnError)
if (fileName.isEmpty() || basePath.isEmpty()) {
return QString();
return writeFile(basePath, fileName, data, deleteOnError);
QString filePath = basePath;
#if defined Q_OS_IOS
filePath = setFilePath(basePath, QString::number(msgId));
return writeFile(filePath, fileName, data, deleteOnError);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment