Ensure the native filedialog starts up with the right directory

On Mac it was not starting the dialog with the specified directory when
one was present. If a filename was given as well then it would start up
fine.

Task-number: QTBUG-28161
Change-Id: I7cce0d065dd57e6433ce62380d4263d6e20b6e7c
Reviewed-by: Liang Qi <liang.qi@digia.com>
This commit is contained in:
Andy Shaw 2012-12-08 01:55:11 +01:00 committed by The Qt Project
parent 0c3cfdba45
commit d75d86190b

View File

@ -223,7 +223,7 @@ static QString strippedText(QString s)
- (void)showModelessPanel
{
if (mOpenPanel){
QFileInfo info(*mCurrentSelection);
QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir));
NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath());
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
@ -241,7 +241,7 @@ static QString strippedText(QString s)
- (BOOL)runApplicationModalPanel
{
QFileInfo info(*mCurrentSelection);
QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir));
NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath());
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
@ -266,7 +266,7 @@ static QString strippedText(QString s)
- (void)showWindowModalSheet:(QWindow *)parent
{
QFileInfo info(*mCurrentSelection);
QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir));
NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath());
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];