diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ project(kolourpaint VERSION ${RELEASE_SERVICE_VERSION}) set(QT_MIN_VERSION "5.11.0") -set(KF5_MIN_VERSION "5.58.0") +set(KF5_MIN_VERSION "5.67.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) @@ -336,6 +336,7 @@ target_link_libraries(kolourpaint KF5::XmlGui + KF5::KIOFileWidgets KF5::TextWidgets Qt5::PrintSupport ${KSANE_LIBRARIES} diff --git a/mainWindow/kpMainWindow_File.cpp b/mainWindow/kpMainWindow_File.cpp --- a/mainWindow/kpMainWindow_File.cpp +++ b/mainWindow/kpMainWindow_File.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -881,27 +882,21 @@ docMetaInfo, this); - QFileDialog fd(this); - fd.setAcceptMode (QFileDialog::AcceptSave); - fd.setOption (QFileDialog::DontUseNativeDialog); - fd.setDirectoryUrl (QUrl (startURL)); + KFileCustomDialog fd (QUrl (startURL), this); + fd.setOperationMode (KFileWidget::Saving); fd.setWindowTitle (caption); - fd.setMimeTypeFilters (mimeTypes); - fd.selectMimeTypeFilter (fdSaveOptions.mimeType ()); + fd.setCustomWidget (saveOptionsWidget); + KFileWidget *fw = fd.fileWidget(); + fw->setConfirmOverwrite (true); + fw->setMimeFilter (mimeTypes, fdSaveOptions.mimeType ()); if (localOnly) { - fd.setSupportedSchemes ({QStringLiteral("file")}); + fw->setMode (KFile::File | KFile::LocalOnly); } - // insert the checkbox below the filter box - if (QGridLayout* gl = qobject_cast(fd.layout ())) { - gl->addWidget (saveOptionsWidget, gl->rowCount (), 0, 1, gl->columnCount ()); - } saveOptionsWidget->setVisualParent (&fd); - connect (&fd, &QFileDialog::filterSelected, - this, [saveOptionsWidget, &fd]() { - saveOptionsWidget->setMimeType(fd.selectedMimeTypeFilter()); - }); + connect (fw, &KFileWidget::filterChanged, + saveOptionsWidget, &kpDocumentSaveOptionsWidget::setMimeType); if ( fd.exec() == QDialog::Accepted ) { @@ -922,7 +917,7 @@ *chosenSaveOptions = newSaveOptions; } - const QList selectedUrls = fd.selectedUrls (); + const QList selectedUrls = fw->selectedUrls (); if (selectedUrls.isEmpty()) { // shouldn't happen return {}; }