Bug 177036 - [PATCH] Moving tabs messes up the title of the tab we just replaced
Summary: [PATCH] Moving tabs messes up the title of the tab we just replaced
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdeui (show other bugs)
Version: SVN
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 172135 181630 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-12-06 05:53 UTC by Ingmar Vanhassel
Modified: 2009-02-06 19:50 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Fix moving tabs in KTabWidget (652 bytes, patch)
2008-12-06 09:08 UTC, Drew Fisher
Details
Fix moving tabs in KTabWidget, v2 (860 bytes, patch)
2008-12-07 06:13 UTC, Drew Fisher
Details
Fix moving tabs in KTabWidget, v3 (864 bytes, patch)
2008-12-07 07:08 UTC, Drew Fisher
Details
unittest for moving tabs (1.35 KB, patch)
2008-12-14 20:11 UTC, Tommi Tervo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ingmar Vanhassel 2008-12-06 05:53:23 UTC
Version:            (using Devel)
Compiler:          GCC 4.3.2 
OS:                Linux
Installed from:    Compiled sources

When I move a tab left, using ctrl-shift-left, then tab we just replaced gets the same title as the tab we just moved. Icons are preserved properly.
Moving tabs to the right doesn't show this behaviour.

I can reproduce this on both the latest stable KDE 4.1.3, and the current snapshot (4.1.81).

-Ingmar
Comment 1 Drew Fisher 2008-12-06 06:29:22 UTC
Definitely present in trunk r891451.

I experience further unusual behavior.  While moving a tab to the left, the tab replaced does get the same title as the one we moved, but in addition, moving a tab to the right makes the tab one to the right of the one we just replaced match the one we just moved.  Looks like a KTabWidget issue.
Comment 2 Ingmar Vanhassel 2008-12-06 06:56:14 UTC
You're right, I see both here too. :)
Comment 3 Drew Fisher 2008-12-06 09:08:57 UTC
Created attachment 29087 [details]
Fix moving tabs in KTabWidget

For some reason, KTabWidget adds another string to m_tabNames every time you move a tab.  There's a comment about it being a workaround for kmdi behavior, which I don't think exists in KDE4.

Removing the extra string insertion fixed this bug for me in trunk, so I hope I'm not missing something.  Can a dev review and commit this patch?
Comment 4 Drew Fisher 2008-12-06 09:11:34 UTC
Reassigning to kdelibs
Comment 5 Drew Fisher 2008-12-07 06:13:12 UTC
Created attachment 29107 [details]
Fix moving tabs in KTabWidget, v2

I needed to add a resizeTabs() call, otherwise tabs with shortened titles would wind up putting the full title in the tab, making very unevenly-sized tabs.
Comment 6 Drew Fisher 2008-12-07 07:08:23 UTC
Created attachment 29108 [details]
Fix moving tabs in KTabWidget, v3

Specifically, resize the tab we just added, or else the same issue persists.
Comment 7 FiNeX 2008-12-07 21:36:28 UTC
I've tested the patch from comment #6 and it works well.
Comment 8 Tommi Tervo 2008-12-08 12:30:45 UTC
David comments:
< dfaure> looks good
< dfaure> (would look better with an addition to the unit test :)
Comment 9 Tommi Tervo 2008-12-14 20:11:06 UTC
Created attachment 29337 [details]
unittest for moving tabs

Patch seems to work fine but I tried to create an unittest and it fails.
Test case moves first tab from left to right which works fine but when moving it back one tab title disappears. Any ideas?
Comment 10 Drew Fisher 2008-12-16 08:39:49 UTC
Curious, the new unittest passed in my builds, and looking at the debug info, did not produce null strings.  Are you sure the unit test linked against the newly patched libkdeui?
Comment 11 Tommi Tervo 2008-12-16 09:09:44 UTC
Unbelievable. I was 100% sure that I had fresh libkdeui.so but after rm && make, ktabwidget_unittest works fine. Go a head and commit your fix (and remove my kDebug line from UT).

PASS   : KTabWidget_UnitTest::testMoveTab()
Comment 12 Drew Fisher 2008-12-16 21:23:35 UTC
I don't have commit access (and don't do enough dev work to merit it yet); could one of you apply the patch and (quieted) unittest?  Thanks.
Comment 13 David Faure 2008-12-18 12:29:41 UTC
SVN commit 898491 by dfaure:

Apply patch from Drew Fisher and unit test from Tommi Tervo, to fix the tab title mess-up when moving a tab.
I love it when bug reports contain patch + unit test... perfect ;-)
BUG: 177036


 M  +26 -0     tests/ktabwidget_unittest.cpp  
 M  +3 -8      widgets/ktabwidget.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=898491
Comment 14 David Faure 2009-01-22 23:53:30 UTC
*** Bug 181630 has been marked as a duplicate of this bug. ***
Comment 15 David Faure 2009-02-06 19:50:29 UTC
*** Bug 172135 has been marked as a duplicate of this bug. ***