Index: src/kio/kfiledialog.cpp =================================================================== --- src/kio/kfiledialog.cpp +++ src/kio/kfiledialog.cpp @@ -326,8 +326,6 @@ void KFileDialog::setMimeFilter(const QStringList &mimeTypes, const QString &defaultType) { - d->w->setMimeFilter(mimeTypes, defaultType); - if (d->native) { QString allExtensions; QStringList filters = mime2KdeFilter(mimeTypes, &allExtensions); @@ -335,7 +333,9 @@ filters.prepend(allExtensions + QLatin1Char('|') + i18n("All Supported Files")); } d->native->filter = filters.join(QLatin1String("\n")); + return; } + d->w->setMimeFilter(mimeTypes, defaultType); } void KFileDialog::clearFilter() @@ -385,6 +385,9 @@ // This is only used for the initial size when no configuration has been saved QSize KFileDialog::sizeHint() const { + if (d->native) { + return QSize(); + } return d->w->dialogSizeHint(); } @@ -601,7 +604,7 @@ void KFileDialog::setConfirmOverwrite(bool enable) { - if (operationMode() == KFileDialog::Saving) { + if (d->w && operationMode() == KFileDialog::Saving) { d->w->setConfirmOverwrite(enable); } } @@ -869,43 +872,57 @@ QPushButton *KFileDialog::okButton() const { - return d->w->okButton(); + if (d->w) { + return d->w->okButton(); + } + return nullptr; } QPushButton *KFileDialog::cancelButton() const { - return d->w->cancelButton(); + if (d->w) { + return d->w->cancelButton(); + } + return nullptr; } KUrlComboBox *KFileDialog::locationEdit() const { - return d->w->locationEdit(); + if (d->w) { + return d->w->locationEdit(); + } + return nullptr; } KFileFilterCombo *KFileDialog::filterWidget() const { - return d->w->filterWidget(); + if (d->w) { + return d->w->filterWidget(); + } + return nullptr; } KActionCollection *KFileDialog::actionCollection() const { - return d->w->actionCollection(); + if (d->w) { + return d->w->actionCollection(); + } + return nullptr; } void KFileDialog::setKeepLocation(bool keep) { - if (d->native) { - return; + if (d->w) { + d->w->setKeepLocation(keep); } - d->w->setKeepLocation(keep); } bool KFileDialog::keepsLocation() const { - if (d->native) { - return false; + if (d->w) { + return d->w->keepsLocation(); } - return d->w->keepsLocation(); + return false; } void KFileDialog::setOperationMode(OperationMode mode) @@ -927,27 +944,23 @@ void KFileDialog::keyPressEvent(QKeyEvent *e) { - if (d->native) { - return; - } - - if (e->key() == Qt::Key_Escape) { - e->accept(); - d->w->cancelButton()->animateClick(); - } else { - QDialog::keyPressEvent(e); + if (d->w) { + if (e->key() == Qt::Key_Escape) { + e->accept(); + d->w->cancelButton()->animateClick(); + } else { + QDialog::keyPressEvent(e); + } } } void KFileDialog::hideEvent(QHideEvent *e) { - if (d->native) { - return; - } + if (d->w) { + KWindowConfig::saveWindowSize(windowHandle(), d->cfgGroup, KConfigBase::Persistent); - KWindowConfig::saveWindowSize(windowHandle(), d->cfgGroup, KConfigBase::Persistent); - - QDialog::hideEvent(e); + QDialog::hideEvent(e); + } } // static @@ -967,7 +980,10 @@ KToolBar *KFileDialog::toolBar() const { - return d->w->toolBar(); + if (d->w) { + return d->w->toolBar(); + } + return nullptr; } KFileWidget *KFileDialog::fileWidget()