]> git.sur5r.net Git - minitube/blobdiff - src/downloadsettings.cpp
Upload 3.9.3-2 to unstable
[minitube] / src / downloadsettings.cpp
index d73182e73e543088087a30f898b6267699bb9883..c8b9d6c01a621cb93cea2b20d7cfc6ada1c69efd 100644 (file)
@@ -1,3 +1,23 @@
+/* $BEGIN_LICENSE
+
+This file is part of Minitube.
+Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
+
+Minitube is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Minitube is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Minitube.  If not, see <http://www.gnu.org/licenses/>.
+
+$END_LICENSE */
+
 #include "downloadsettings.h"
 #include "downloadmanager.h"
 #include "mainwindow.h"
@@ -36,17 +56,18 @@ void DownloadSettings::paintEvent(QPaintEvent * /*event*/) {
 }
 
 void DownloadSettings::changeFolder() {
-
+    const QString path = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
 #ifdef APP_MAC
     QFileDialog* dialog = new QFileDialog(this);
     dialog->setFileMode(QFileDialog::Directory);
     dialog->setOptions(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks | QFileDialog::ReadOnly);
-    dialog->setDirectory(QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
+    dialog->setDirectory(path);
     dialog->open(this, SLOT(folderChosen(const QString &)));
 #else
+
     QString folder = QFileDialog::getExistingDirectory(window(), tr("Choose the download location"),
-                                                    QDesktopServices::storageLocation(QDesktopServices::HomeLocation),
-                                                    QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks | QFileDialog::ReadOnly);
+                                                       path,
+                                                       QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks | QFileDialog::ReadOnly);
     folderChosen(folder);
 #endif
 }
@@ -64,12 +85,12 @@ void DownloadSettings::folderChosen(const QString &dir) {
 }
 
 void DownloadSettings::updateMessage() {
-    QString path = DownloadManager::instance()->currentDownloadFolder();
-    QString home = QDesktopServices::storageLocation(QDesktopServices::HomeLocation) + "/";
+    const QString path = DownloadManager::instance()->currentDownloadFolder();
+    const QString home = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
     QString displayPath = path;
-    displayPath = displayPath.remove(home);
+    displayPath = displayPath.remove(home + "/");
     message->setText(
-            tr("Downloading to: %1")
-            .arg("<a href='file://%1' style='text-decoration:none; color:palette(text); font-weight:bold'>%2</a>")
-            .arg(path, displayPath));
+                tr("Downloading to: %1")
+                .arg("<a href='file://%1' style='text-decoration:none; color:palette(text); font-weight:bold'>%2</a>")
+                .arg(path, displayPath));
 }