src/gui/dialogs/qfiledialog_mac.mm
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/src/gui/dialogs/qfiledialog_mac.mm	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/gui/dialogs/qfiledialog_mac.mm	Tue Feb 02 00:43:10 2010 +0200
@@ -399,9 +399,13 @@
 - (void)panelSelectionDidChange:(id)sender
 {
     Q_UNUSED(sender);
-    *mCurrentSelection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString([mSavePanel filename]));
-    if (mPriv)
-        mPriv->QNSOpenSavePanelDelegate_selectionChanged(*mCurrentSelection);
+    if (mPriv) {
+        QString selection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString([mSavePanel filename]));
+        if (selection != mCurrentSelection) {
+            *mCurrentSelection = selection;
+            mPriv->QNSOpenSavePanelDelegate_selectionChanged(selection);
+        }
+    }
 }
 
 - (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode  contextInfo:(void *)contextInfo
@@ -826,8 +830,8 @@
                     || mode == QFileDialog::ExistingFiles){
                 // When changing directory, the current selection is cleared if
                 // we are supposed to be selecting files only:
-                fileDialogPrivate->mCurrentSelectionList.clear();
                 if (!fileDialogPrivate->mCurrentSelection.isEmpty()){
+                    fileDialogPrivate->mCurrentSelectionList.clear();
                     fileDialogPrivate->mCurrentSelection.clear();
                     emit fileDialogPrivate->q_func()->currentChanged(fileDialogPrivate->mCurrentSelection);
                 }