]> git.sur5r.net Git - minitube/commitdiff
Sheet dialog on the Mac
authorFlavio <flavio@odisseo.local>
Sun, 1 Jan 2012 16:06:23 +0000 (17:06 +0100)
committerFlavio <flavio@odisseo.local>
Sun, 1 Jan 2012 16:06:23 +0000 (17:06 +0100)
src/downloadsettings.cpp
src/downloadsettings.h

index 557a4e13c5fb31e75e1b280a261af115cd7efe96..80b276313b7a390286dc9f4c32c4a4e7f17811a1 100644 (file)
@@ -35,10 +35,22 @@ void DownloadSettings::paintEvent(QPaintEvent * /*event*/) {
 }
 
 void DownloadSettings::changeFolder() {
-    QString dir = QFileDialog::getExistingDirectory(this, tr("Choose the download location"),
+
+#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->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::ShowDirsOnly | QFileDialog::DontResolveSymlinks | QFileDialog::ReadOnly);
+    folderChosen(folder);
+#endif
+}
 
+void DownloadSettings::folderChosen(const QString &dir) {
     if (!dir.isEmpty()) {
         QSettings settings;
         settings.setValue("downloadFolder", dir);
index 6a60102a8d17a6c1f81d65cd8b45e12a04f3f3a4..968c8aa9e4d13981d3b29c28577a8bed324b1882 100644 (file)
@@ -15,6 +15,7 @@ protected:
 
 private slots:
     void changeFolder();
+    void folderChosen(const QString &folder);
 
 private:
     void updateMessage();