From a76bd6a26d846e36142efd06a67dd97966d10ced Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 20 Feb 2017 08:49:15 +0100 Subject: Only remember the folder for the next time if the dialog is accepted If the dialog is not accepted then it should not remember the last folder that was used. This should only happen if the user clicks on OK. [ChangeLog][FileDialogs] Remember the folder only when the file dialog is accepted. Change-Id: I69957e56e887affcab9933562274013fee686063 Reviewed-by: Mitch Curtis --- src/dialogs/qquickplatformfiledialog.cpp | 7 ++++++- src/dialogs/qquickplatformfiledialog_p.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dialogs/qquickplatformfiledialog.cpp b/src/dialogs/qquickplatformfiledialog.cpp index 2d99ae1e..ab228d1f 100644 --- a/src/dialogs/qquickplatformfiledialog.cpp +++ b/src/dialogs/qquickplatformfiledialog.cpp @@ -213,7 +213,6 @@ QPlatformFileDialogHelper *QQuickPlatformFileDialog::helper() if (!m_dlgHelper) return m_dlgHelper; m_dlgHelper->setOptions(m_options); - connect(m_dlgHelper, SIGNAL(directoryEntered(QUrl)), this, SLOT(updateFolder(QUrl))); connect(m_dlgHelper, SIGNAL(filterSelected(QString)), this, SIGNAL(filterSelected())); connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept())); connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject())); @@ -222,6 +221,12 @@ QPlatformFileDialogHelper *QQuickPlatformFileDialog::helper() return m_dlgHelper; } +void QQuickPlatformFileDialog::accept() +{ + updateFolder(folder()); + QQuickFileDialog::accept(); +} + /*! \qmlproperty bool FileDialog::visible diff --git a/src/dialogs/qquickplatformfiledialog_p.h b/src/dialogs/qquickplatformfiledialog_p.h index 42e59332..419843f4 100644 --- a/src/dialogs/qquickplatformfiledialog_p.h +++ b/src/dialogs/qquickplatformfiledialog_p.h @@ -67,6 +67,7 @@ public: protected: QPlatformFileDialogHelper *helper() Q_DECL_OVERRIDE; + virtual void accept() override; Q_DISABLE_COPY(QQuickPlatformFileDialog) }; -- cgit v1.2.1