[graphics/krita/krita/5.0] libs: Fix inconsistency in preview visibility on AppImages
L. E. Segovia
null at kde.org
Tue Jan 4 17:00:36 GMT 2022
Git commit 428c7993e3de81739ab030c9556bb41ca25269d2 by L. E. Segovia.
Committed on 04/01/2022 at 17:00.
Pushed by lsegovia into branch 'krita/5.0'.
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 at kde.org
(cherry picked from commit ad416d3c2f73cacd0bce4ce8add9a2755d1b769a)
M +7 -0 libs/ui/dialogs/kis_dlg_preferences.cc
M +3 -1 libs/widgetutils/KisPreviewFileDialog.cpp
M +8 -1 libs/widgetutils/KoFileDialog.cpp
https://invent.kde.org/graphics/krita/commit/428c7993e3de81739ab030c9556bb41ca25269d2
diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.cc
index 94dbfcf01a..7c9bba5cfc 100644
--- a/libs/ui/dialogs/kis_dlg_preferences.cc
+++ b/libs/ui/dialogs/kis_dlg_preferences.cc
@@ -322,6 +322,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());
//
diff --git a/libs/widgetutils/KisPreviewFileDialog.cpp b/libs/widgetutils/KisPreviewFileDialog.cpp
index 4177ec54d4..c86ee581eb 100644
--- a/libs/widgetutils/KisPreviewFileDialog.cpp
+++ b/libs/widgetutils/KisPreviewFileDialog.cpp
@@ -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()));
diff --git a/libs/widgetutils/KoFileDialog.cpp b/libs/widgetutils/KoFileDialog.cpp
index 460350b5d0..70438ba777 100644
--- a/libs/widgetutils/KoFileDialog.cpp
+++ b/libs/widgetutils/KoFileDialog.cpp
@@ -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);
More information about the kimageshop
mailing list