summaryrefslogtreecommitdiffstats
path: root/examples/qtmail/emailcomposer.cpp
diff options
context:
space:
mode:
authorPekka Vuorela <pvuorela@iki.fi>2025-11-04 13:20:10 +0200
committerPekka Vuorela <pvuorela@iki.fi>2025-11-12 13:19:15 +0200
commitcbe4896d8017f27dd30333fe229dcaa440e2e147 (patch)
tree96bd9df8f0586d48e87f8f4f4055da8418060421 /examples/qtmail/emailcomposer.cpp
parentec2e17f3ccc122d6c47ca42c8c8c28bcb3952acd (diff)
Use more standard paths for user data, remove QMail::tempPath()
Avoid data root directly in home directory, rather use QStandardPaths. For backwards compatibility the old path is still used if it's there and the new one doesn't exist. QMail::tempPath() got removed. Evidently it's not much needed and shouldn't really exist. The qmfclient doesn't use it al all and generally apps should store their temporary things in their own places. It's rarely wanted that there would be a common place to store such. On the contrary, apps should play mostly in their own sandboxes. TempPath was used on the server side but mostly either wrong or unnecessary: - requests file is messageserver app specific, shouldn't be visible to others. - QMailMessageSource was using it wrong. New messages are added to database, not temp path. - LongStream with public cleanupTempFiles() could be dangerous if it was called by multiple processes and having a common directory. (Another story whether such an api should even exist though) - SMTP, IMAP and LongStream can live with more generic locations. The generic locations for the last ones are borderline whether it should be TempLocation or CacheLocation. For side: interestingly the usage is mostly storing content in files to save memory while Linux world with /tmp as tmpfs has moved to storing files in memory to make them faster. For now made smtp use temp location as that's a quite simple usage, while imap and longstream in cache dir as they do have some more complicated detaches and append usages, and they were earlier out of the actual /tmp. Did some simplifications to LongStream and a proper error case handling to smtp client out of space error while at it. Change-Id: If52de231082085d804939002371f5a407cd0fecd Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
Diffstat (limited to 'examples/qtmail/emailcomposer.cpp')
-rw-r--r--examples/qtmail/emailcomposer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/qtmail/emailcomposer.cpp b/examples/qtmail/emailcomposer.cpp
index a8dc1a66..be8b471c 100644
--- a/examples/qtmail/emailcomposer.cpp
+++ b/examples/qtmail/emailcomposer.cpp
@@ -977,7 +977,7 @@ void EmailComposerInterface::create(const QMailMessage& sourceMail)
} else {
if (!localFile) {
// We need to create a temporary copy of this part's data to link to
- QString fileName(part.writeBodyTo(QMail::tempPath()));
+ QString fileName(part.writeBodyTo(QDir::tempPath()));
if (fileName.isEmpty()) {
qWarning() << "Unable to save part to temporary file!";
continue;