]> git.sur5r.net Git - minitube/blobdiff - src/temporary.cpp
Imported Upstream version 2.5.1
[minitube] / src / temporary.cpp
index 40bd5427efcd481659665ac4573f31fc4f35ff05..913d2446aa954c6c5dee6b535ff2bee7bb19d42d 100644 (file)
@@ -20,24 +20,21 @@ $END_LICENSE */
 
 #include "temporary.h"
 #include "constants.h"
+#include "compatibility/pathsservice.h"
 
 static QList<QString> paths;
-#ifdef Q_OS_LINUX
+#ifdef APP_LINUX
 static QString userName;
 #endif
 
 Temporary::Temporary() { }
 
 QString Temporary::filename() {
-#if QT_VERSION >= 0x050000
-    static const QString tempDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
-#else
-    static const QString tempDir = QDesktopServices::storageLocation(QDesktopServices::TempLocation);
-#endif
+    static const QString tempDir = Paths::getTempLocation();
 
     QString tempFile = tempDir + "/" + Constants::UNIX_NAME + "-" + QString::number(qrand());
 
-#ifdef Q_OS_LINUX
+#ifdef APP_LINUX
     if (userName.isNull()) {
         userName = QString(getenv("USERNAME"));
         if (userName.isEmpty())
@@ -67,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;
         }