Merge pull request #4986 from santigl/master

Save mood file as hidden on Windows
This commit is contained in:
John Maguire 2015-08-11 19:27:32 +01:00
commit e9b8dae2df
1 changed files with 13 additions and 0 deletions

View File

@ -34,6 +34,10 @@
#include "core/qhash_qurl.h" #include "core/qhash_qurl.h"
#include "core/utilities.h" #include "core/utilities.h"
#ifdef Q_OS_WIN32
#include <windows.h>
#endif
MoodbarLoader::MoodbarLoader(Application* app, QObject* parent) MoodbarLoader::MoodbarLoader(Application* app, QObject* parent)
: QObject(parent), : QObject(parent),
cache_(new QNetworkDiskCache(this)), cache_(new QNetworkDiskCache(this)),
@ -167,6 +171,15 @@ void MoodbarLoader::RequestFinished(MoodbarPipeline* request, const QUrl& url) {
QFile mood_file(mood_filename); QFile mood_file(mood_filename);
if (mood_file.open(QIODevice::WriteOnly)) { if (mood_file.open(QIODevice::WriteOnly)) {
mood_file.write(request->data()); mood_file.write(request->data());
#ifdef Q_OS_WIN32
if (!SetFileAttributes((LPCTSTR)mood_filename.utf16(),
FILE_ATTRIBUTE_HIDDEN)) {
qLog(Warning) << "Error setting hidden attribute for file"
<< mood_filename;
}
#endif
} else { } else {
qLog(Warning) << "Error opening mood file for writing" << mood_filename; qLog(Warning) << "Error opening mood file for writing" << mood_filename;
} }