@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014-2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -28,18 +28,17 @@
2828
2929#include <QDebug>
3030
31−void saveScreenshot(QImage screenshot, QString filename, QString format, int quality)
31+void saveScreenshot(QImage screenshot, const QString &filename, const QString &format, int quality)
3232{
3333 if (!screenshot.save(filename, format.toLatin1().data(), quality))
3434 qWarning() << "ScreenShotter: failed to save snapshot!";
3535}
3636
3737ScreenGrabber::ScreenGrabber(QObject *parent)
38− : QObject(parent),
39− screenshotQuality(0)
38+ : QObject(parent)
4039{
41− QDir screenshotsDir(QStandardPaths::displayName(QStandardPaths::PicturesLocation));
42− screenshotsDir.mkdir("Screenshots");
40+ QDir screenshotsDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
41+ screenshotsDir.mkpath("Screenshots");
4342 screenshotsDir.cd("Screenshots");
4443 if (screenshotsDir.exists())
4544 {
@@ -78,7 +77,7 @@ void ScreenGrabber::captureAndSave()
7877 QtConcurrent::run(saveScreenshot, screenshot, makeFileName(), getFormat(), screenshotQuality);
7978}
8079
81−QString ScreenGrabber::makeFileName()
80+QString ScreenGrabber::makeFileName() const
8281{
8382 QString fileName(fileNamePrefix);
8483 fileName.append(QDateTime::currentDateTime().toString("yyyyMMdd_hhmmsszzz"));
@@ -87,7 +86,7 @@ QString ScreenGrabber::makeFileName()
8786 return fileName;
8887}
8988
90−QString ScreenGrabber::getFormat()
89+QString ScreenGrabber::getFormat() const
9190{
9291 //TODO: This should be configurable (perhaps through gsettings?)
9392 return "png";