Commit 606f9b06 authored by Karel Slaný's avatar Karel Slaný

Modified file saving failure notification.

parent 8f66ce70
......@@ -64,19 +64,6 @@ Files::Files(QObject *parent)
{
}
void Files::attachmentSavingNotification(const QString &destPath)
{
QFileInfo fi(destPath);
Dialogues::errorMessage(
!destPath.isEmpty() ? Dialogues::INFORMATION : Dialogues::CRITICAL,
tr("Attachment saving"),
!destPath.isEmpty() ? tr("Attachments have been saved.") :
tr("Attachments have not been saved!"),
!destPath.isEmpty() ?
tr("Path: '%1'").arg(fi.absolutePath()) : QString());
}
void Files::deleteExpiredFilesFromDbs(int days)
{
debugFuncCall();
......@@ -744,7 +731,7 @@ void Files::saveMsgFilesToDisk(const QString &userName,
}
#ifndef Q_OS_IOS
attachmentSavingNotification(destFilePath);
fileSavingNotification(destFilePath);
#else
exportFilesiOS(destFilePaths, joinDirs(userName, msgIdStr));
#endif
......@@ -785,7 +772,7 @@ void Files::saveAttachmentsToDiskZfo(const QVariant &attachModelVariant,
}
#ifndef Q_OS_IOS
attachmentSavingNotification(destFilePath);
fileSavingNotification(destFilePath);
#else
exportFilesiOS(destFilePaths, msgIdStr);
#endif
......@@ -801,6 +788,20 @@ void Files::deleteTmpFileFromStorage(const QString &filePath)
#endif
}
void Files::fileSavingNotification(const QString &destPath)
{
if (!destPath.isEmpty()) {
const QFileInfo fi(destPath);
Dialogues::errorMessage(Dialogues::INFORMATION,
tr("Saving Successful"), tr("Files have been saved."),
tr("Path: '%1'").arg(fi.absolutePath()));
} else {
Dialogues::errorMessage(Dialogues::CRITICAL,
tr("Saving Failed"), tr("Files have not been saved."),
tr("Please check whether the application has permissions to access the storage."));
}
}
bool Files::parseXmlData(enum MsgInfo::ZfoType *type, QString *idStr,
QString *annotation, QString *msgDescrHtml, FileListModel *attachModel,
QString *emailBody, QByteArray xmlData)
......
......@@ -71,15 +71,6 @@ public:
*/
explicit Files(QObject *parent = Q_NULLPTR);
/*!
* @brief Generates a notification dialogue about the
* result of attachment saving.
*
* @param[in] destPath Path to which the attachment was saved.
*/
static
void attachmentSavingNotification(const QString &destPath);
/*!
* @brief Delete files from all databases where file lifetime expired.
*
......@@ -287,6 +278,15 @@ signals:
void statusBarTextChanged(QString txt, bool busy);
private:
/*!
* @brief Generates a notification dialogue about the result of the file
* saving.
*
* @param[in] destPath Path to which the attachment was saved,
* failure notification is generated when path is empty.
*/
static
void fileSavingNotification(const QString &destPath);
/*!
* @brief Open attachment from path in default application.
......
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