Bug 193097

Summary: wrong KMessageBox resizing in detailedError()
Product: [Frameworks and Libraries] kdelibs Reporter: Konstantinos Smanis <konstantinos.smanis>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: alvarenga, andresbajotierra, cfeck, konstantinos.smanis, lueck, ogoffart
Priority: NOR    
Version: 4.2   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: The wrongly-sized messagebox.
The correctly-sized messagebox (how it should be by default).

Description Konstantinos Smanis 2009-05-18 11:57:32 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

When using KMessageBox::detailedError() it sometimes doesn't resize properly to show all the text. This doesn't occur when using KMessageBox::error() with the same text so it has to be an issue with the details.

I suppose the bug occurs somewhere around here: http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/kmessagebox_8cpp-source.html#l00288

Unfortunately compiling kdelibs would be quite time-consuming for me, so I just reported this bug and hopefully someone else (more experienced) will take care of it.

Screenshots illustrating the problem are attached.
Comment 1 Konstantinos Smanis 2009-05-18 12:00:57 UTC
Created attachment 33795 [details]
The wrongly-sized messagebox.
Comment 2 Konstantinos Smanis 2009-05-18 12:01:45 UTC
Created attachment 33796 [details]
The correctly-sized messagebox (how it should be by default).
Comment 3 Konstantinos Smanis 2009-05-18 12:06:32 UTC
Just a note: as I mentioned, if KMessageBox::error() is used instead with the identical text, the dialog defaults to the screenshot #2 (https://bugs.kde.org/attachment.cgi?id=33796) but it has fixed size (because we fall into the first case as can be seen here: http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/kmessagebox_8cpp-source.html#l00288).

Screenshot #2 was created by clicking twice on the "Details" button (this seems to resize the messagebox properly)
Comment 4 Dario Andres 2009-06-21 16:12:04 UTC
Here using:

Qt: 4.5.1 (qt-copy  971295)
KDE: 4.2.92 (KDE 4.2.92 (KDE 4.3 >= 20090617))
kdelibs svn rev. 984425 / kdebase svn rev. 984427
on ArchLinux i686 - Kernel 2.6.29.4

I can reproduce this bug.
Comment 5 Dario Andres 2009-06-21 18:09:02 UTC
It seems the "bug" is inside "KDialog::setDetailsWidgetVisible"
When the dialog is created and it will show details, this functions is called with "false" as parameter. Therefore an "adjustSize()" call is done, even when the layout may be still not valid (delayed layouting) causing the dialog to resize to a bad minimum.

KDialog minimum sizes seems to be weird and layouts not being honored.

A rather simple patch, only call adjustSize() if there is a valid layout():

Index: kdialog.cpp
===================================================================
--- kdialog.cpp (revision 984425)
+++ kdialog.cpp (working copy)
@@ -826,10 +826,11 @@
     if ( d->mDetailsWidget )
       d->mDetailsWidget->hide();

-    if ( layout() )
+    if ( layout() ) {
       layout()->activate();
+      adjustSize();
+    }

-    adjustSize();
   }

   d->mSettingDetails = false;



---

This will not avoid the dialog to be resized to minimum (even hiding the text), but it will show the dialog properly the first time.
I still think some better patch/fix to the whole situation should be done.

@Olivier: what do you think? 

Regards
Comment 6 Kurt Hindenburg 2009-10-27 06:46:44 UTC
Can we get this in for KDE 4.4 please?  The current dialog window for all the detailed* is terrible.
Comment 7 Konstantinos Smanis 2011-04-29 00:55:27 UTC
I tested and can confirm Dario's patch to be working as explained:

"This will not avoid the dialog to be resized to minimum (even hiding the text),
but it will show the dialog properly the first time."

Can we push it for 4.7 please?
Comment 8 Burkhard Lück 2011-06-22 09:27:58 UTC
@ Dario:
Tested your patch, it shows the dialog properly the first time 

Please file a Review Request, thanks.
Comment 9 Dario Andres 2011-07-11 22:16:30 UTC
Can someone else create the review ? I don't have a devel environment to recreate and test the patch. Thanks
Comment 10 Burkhard Lück 2011-07-16 07:14:51 UTC
*** Bug 277873 has been marked as a duplicate of this bug. ***
Comment 11 Burkhard Lück 2011-08-03 15:06:50 UTC
Git commit bd953f345b2413a4437340d7b9b414e61afba23f by Burkhard Lück.
Committed on 03/08/2011 at 17:05.
Pushed by lueck into branch 'KDE/4.7'.

Resize KMessageBox::detailedError at start to display all text

Quoting the BR:
'When using KMessageBox::detailedError() it sometimes doesn't resize properly to
show all the text'

commit this on behalf of Dario Andres (https://bugs.kde.org/show_bug.cgi?id=193097#c9)

CCBUG:193097
REVIEW:101931
(cherry picked from commit 370d3ed6e5153fc61b774cf2640acc72d334033d)

M  +3    -2    kdeui/dialogs/kdialog.cpp

http://commits.kde.org/kdelibs/bd953f345b2413a4437340d7b9b414e61afba23f
Comment 12 Burkhard Lück 2011-08-03 15:06:59 UTC
Git commit 370d3ed6e5153fc61b774cf2640acc72d334033d by Burkhard Lück.
Committed on 03/08/2011 at 17:05.
Pushed by lueck into branch 'master'.

Resize KMessageBox::detailedError at start to display all text

Quoting the BR:
'When using KMessageBox::detailedError() it sometimes doesn't resize properly to
show all the text'

commit this on behalf of Dario Andres (https://bugs.kde.org/show_bug.cgi?id=193097#c9)

BUG:193097
REVIEW:101931

M  +3    -2    kdeui/dialogs/kdialog.cpp

http://commits.kde.org/kdelibs/370d3ed6e5153fc61b774cf2640acc72d334033d