src/gui/dialogs/qfiledialog_win.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   507     }
   507     }
   508     // Set other flags for the dialog.
   508     // Set other flags for the dialog.
   509     DWORD newOptions;
   509     DWORD newOptions;
   510     hr = pfd->GetOptions(&newOptions);
   510     hr = pfd->GetOptions(&newOptions);
   511     if (SUCCEEDED(hr)) {
   511     if (SUCCEEDED(hr)) {
   512         newOptions |= (FOS_NOCHANGEDIR | FOS_NOREADONLYRETURN);
   512         newOptions |= FOS_NOCHANGEDIR;
   513         if (mode == QFileDialog::ExistingFile ||
   513         if (mode == QFileDialog::ExistingFile ||
   514              mode == QFileDialog::ExistingFiles)
   514              mode == QFileDialog::ExistingFiles)
   515             newOptions |= (FOS_FILEMUSTEXIST | FOS_PATHMUSTEXIST);
   515             newOptions |= (FOS_FILEMUSTEXIST | FOS_PATHMUSTEXIST);
   516         if (mode == QFileDialog::ExistingFiles)
   516         if (mode == QFileDialog::ExistingFiles)
   517             newOptions |= FOS_ALLOWMULTISELECT;
   517             newOptions |= FOS_ALLOWMULTISELECT;
   532     QDialog modal_widget;
   532     QDialog modal_widget;
   533     modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
   533     modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
   534     modal_widget.setParent(args.parent, Qt::Window);
   534     modal_widget.setParent(args.parent, Qt::Window);
   535     QApplicationPrivate::enterModal(&modal_widget);
   535     QApplicationPrivate::enterModal(&modal_widget);
   536     // Multiple selection is allowed only in IFileOpenDialog.
   536     // Multiple selection is allowed only in IFileOpenDialog.
   537     IFileOpenDialog *pfd;
   537     IFileOpenDialog *pfd = 0;
   538     HRESULT hr = CoCreateInstance(CLSID_FileOpenDialog,
   538     HRESULT hr = CoCreateInstance(CLSID_FileOpenDialog,
   539                                   NULL,
   539                                   NULL,
   540                                   CLSCTX_INPROC_SERVER,
   540                                   CLSCTX_INPROC_SERVER,
   541                                   IID_PPV_ARGS(&pfd));
   541                                   IID_PPV_ARGS(&pfd));
   542 
   542 
   605                 // This is a one-based index, not zero-based.
   605                 // This is a one-based index, not zero-based.
   606                 *selectedFilter = filterList[filetype-1];
   606                 *selectedFilter = filterList[filetype-1];
   607             }
   607             }
   608         }
   608         }
   609     }
   609     }
       
   610     if (pfd)
       
   611         pfd->Release();
   610     return result;
   612     return result;
   611 }
   613 }
   612 
   614 
   613 #endif
   615 #endif
   614 
   616