Skip to content

Commit

Permalink
Merge branch 'jb52525' into 'master'
Browse files Browse the repository at this point in the history
[libcommhistory] Use commhistory specific tmp directory for outgoing MMS. JB#52525

See merge request mer-core/libcommhistory!50
  • Loading branch information
rainemak committed Dec 17, 2020
2 parents 88f398a + f0c349b commit 01d3dfa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion declarative/src/mmshelper.cpp
Expand Up @@ -74,7 +74,16 @@ class MmsHelper::TempDir : public QObject {
Q_OBJECT

public:
TempDir() { m_tempDir.setAutoRemove(true); }
TempDir(QObject *parent = nullptr)
: QObject(parent)
, m_tempDir(TempDir::basePath() + "/mms")
{
}

static QString basePath() {
return QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QStringLiteral("/commhistory-tmp");
}

bool isValid() const { return m_tempDir.isValid(); }
QString path() const { return m_tempDir.path(); }

Expand Down Expand Up @@ -197,6 +206,8 @@ bool MmsHelper::sendMessage(const QStringList &to, const QStringList &cc, const
bool MmsHelper::sendMessage(const QString &imsi, const QStringList &to, const QStringList &cc,
const QStringList &bcc, const QString &subject, const QVariantList &parts)
{
QDir dir;
dir.mkpath(TempDir::basePath());
TempDir *tempDir = new TempDir;
QDBusPendingCallWatcher *call = sendMessage(*tempDir, imsi, to, cc, bcc, subject, parts);
if (call) {
Expand Down

0 comments on commit 01d3dfa

Please sign in to comment.