Commit ad416d3c authored by Amy spark's avatar Amy spark 👉
Browse files

Fix inconsistency in preview visibility on AppImages

In AppImages, the Qt file picker will always be used regardless of the
value of QFileDialog::DontUseNativeDialog. This commit ensures the
preview is shown if there's a layout() present when the checkbox isn't
ticked, and disables the checkbox altogether on AppImages.

BUG: 447806
CCMAIL: kimageshop@kde.org
parent 60141f1b
Pipeline #118539 skipped with stage
......@@ -325,6 +325,13 @@ GeneralTab::GeneralTab(QWidget *_parent, const char *_name)
#endif
m_chkNativeFileDialog->setChecked(!group.readEntry("DontUseNativeFileDialog", dontUseNative));
if (!qEnvironmentVariable("APPIMAGE").isEmpty()) {
// AppImages don't have access to platform plugins. BUG: 447805
// Setting the checkbox to false is
m_chkNativeFileDialog->setChecked(false);
m_chkNativeFileDialog->setEnabled(false);
}
intMaxBrushSize->setValue(KisImageConfig(true).maxBrushSize());
//
......
......@@ -83,7 +83,9 @@ void KisPreviewFileDialog::resetIconProvider()
void KisPreviewFileDialog::onCurrentChanged(const QString &path)
{
// Generate the preview only if we're not using the native dialog.
if (testOption(QFileDialog::DontUseNativeDialog) && m_preview) {
// In AppImages, the platform plugins are inaccessible,
// so we check the existance of a widget layout instead.
if ((testOption(QFileDialog::DontUseNativeDialog) || layout()) && m_preview) {
QIcon icon;
if (s_iconCreator && s_iconCreator->createFileIcon(path, icon, devicePixelRatioF(), QSize(512, 512), true)) {
m_preview->setPixmap(icon.pixmap(m_preview->width(), m_preview->height()));
......
......@@ -161,7 +161,14 @@ void KoFileDialog::createFileDialog()
dontUseNative = false;
#endif
bool optionDontUseNative = group.readEntry("DontUseNativeFileDialog", dontUseNative);
bool optionDontUseNative;
if (!qEnvironmentVariable("APPIMAGE").isEmpty()) {
// AppImages don't have access to platform plugins. BUG: 447805
optionDontUseNative = false;
} else {
optionDontUseNative = group.readEntry("DontUseNativeFileDialog", dontUseNative);
}
d->fileDialog->setOption(QFileDialog::DontUseNativeDialog, optionDontUseNative);
d->fileDialog->setOption(QFileDialog::DontConfirmOverwrite, false);
d->fileDialog->setOption(QFileDialog::HideNameFilterDetails, dontUseNative ? true : false);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment