From: Flavio Date: Sun, 1 Jan 2012 16:06:23 +0000 (+0100) Subject: Sheet dialog on the Mac X-Git-Tag: 1.7~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4a27e0c5dc2153c55dda3ad703079c81452115b6;p=minitube Sheet dialog on the Mac --- diff --git a/src/downloadsettings.cpp b/src/downloadsettings.cpp index 557a4e1..80b2763 100644 --- a/src/downloadsettings.cpp +++ b/src/downloadsettings.cpp @@ -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); diff --git a/src/downloadsettings.h b/src/downloadsettings.h index 6a60102..968c8aa 100644 --- a/src/downloadsettings.h +++ b/src/downloadsettings.h @@ -15,6 +15,7 @@ protected: private slots: void changeFolder(); + void folderChosen(const QString &folder); private: void updateMessage();