diff options
author | Andy Shaw <andy.shaw@qt.io> | 2017-02-20 08:49:15 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2017-02-21 14:07:39 +0000 |
commit | a76bd6a26d846e36142efd06a67dd97966d10ced (patch) | |
tree | a8951557c9b47dab59904cf046f4903ea2df5e24 | |
parent | f2627ef19b92eeef3b836e1b5012fd14e3a8a88f (diff) | |
download | qtquickcontrols-a76bd6a26d846e36142efd06a67dd97966d10ced.tar.gz |
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 <mitch.curtis@qt.io>
-rw-r--r-- | src/dialogs/qquickplatformfiledialog.cpp | 7 | ||||
-rw-r--r-- | src/dialogs/qquickplatformfiledialog_p.h | 1 |
2 files changed, 7 insertions, 1 deletions
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) }; |