]> git.sur5r.net Git - minitube/blobdiff - src/temporary.cpp
Merge tag 'upstream/2.5.1'
[minitube] / src / temporary.cpp
index 3f29d70acc2a230675258c9f8d668c20a60102e4..913d2446aa954c6c5dee6b535ff2bee7bb19d42d 100644 (file)
@@ -20,21 +20,21 @@ $END_LICENSE */
 
 #include "temporary.h"
 #include "constants.h"
+#include "compatibility/pathsservice.h"
 
 static QList<QString> paths;
-#ifdef Q_WS_X11
+#ifdef APP_LINUX
 static QString userName;
 #endif
 
 Temporary::Temporary() { }
 
 QString Temporary::filename() {
-
-    static const QString tempDir = QDesktopServices::storageLocation(QDesktopServices::TempLocation);
+    static const QString tempDir = Paths::getTempLocation();
 
     QString tempFile = tempDir + "/" + Constants::UNIX_NAME + "-" + QString::number(qrand());
 
-#ifdef Q_WS_X11
+#ifdef APP_LINUX
     if (userName.isNull()) {
         userName = QString(getenv("USERNAME"));
         if (userName.isEmpty())
@@ -64,7 +64,7 @@ QString Temporary::filename() {
 }
 
 void Temporary::deleteAll() {
-    foreach(QString path, paths) {
+    foreach(const QString &path, paths) {
         if (QFile::exists(path) && !QFile::remove(path)) {
             qDebug() << "Cannot remove temp file" << path;
         }