Bug 181124

Summary: konqueror removes highlighting of new tab, when closing a new tab next to it
Product: [Unmaintained] kdelibs Reporter: Panagiotis Papadopoulos <pano_90>
Component: kdeuiAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: andresbajotierra, jonas.vejlin, uwolfer
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Proposed patch

Description Panagiotis Papadopoulos 2009-01-18 01:46:38 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

1. Start Konqueror and load a website
2. On the loaded website, open two links as tabs
3. switch the view to the last tab (in other words click on the last tab)
4. Close the just activated tab (the view jumps back to the first tab)
5. The "highlighting" of the second tab is "gone" :-)

I have ticked all checkboxes in the "Tabbed Browsing Settings" (the first page that appears when opening konquerors Settings), except "Open new tab after current tab"

I know it's nothing big, but I thought it would be good mentioning it ;-)

thanks
Comment 1 Panagiotis Papadopoulos 2009-05-02 02:02:34 UTC
Update:

In KDE trunk it is still present
Comment 2 Jonas Vejlin 2009-06-20 09:33:37 UTC
When I tries to do those 5 steps it jumps to the 2. tabs when closing the 3 tabs. It does not jump back to tab 1.

And it is konq 4.2.4 on debian sid
Comment 3 Panagiotis Papadopoulos 2009-06-20 18:08:44 UTC
Did you enable (at least) the last checkbox in Konquerors settings?
"Activate previously used tab when closing the current tab"
Comment 4 Jonas Vejlin 2009-06-21 08:27:54 UTC
Nope I was using default settings.
When I change "Activate previously used tab when closing the current tab" it behave like descriped.
Comment 5 Panagiotis Papadopoulos 2009-06-27 21:30:54 UTC
This bug is also present in Konversation, so this probably is some kind of "general" KDE bug.
Can someone please assign it to the correct "product"?

Thanks!
Comment 6 Panagiotis Papadopoulos 2009-06-27 23:03:52 UTC
A little "Howto reproduce this bug" for Konversation:

1. Open at least 3 channels
2. Activate the firt tab (by clicking on it), and then switch to the third one (by clicking on it :-P)
3. Now wait until there is some activity in tab 2, so that the tab gets "highlighted"
4. Now close the third tab

Something I noticed:

When closing tabs in Konqueror you can see (in the windowtitle for example), that konqueror is switching the view for a very short time to the left tab next to it, before jumping to the last activated tab.
This might explain why the highlighting gets removed from the tabs...
Comment 7 Dario Andres 2009-06-27 23:19:15 UTC
Here using:

Qt: 4.5.2 (KDE-Qt git commit 46a247a2c9a8c0c4456a02f6a0922d859d88fe76
        Date:   Fri Jun 26 13:45:37 2009 +0200)
KDE: 4.3.60 (KDE 4.3.60 (KDE 4.4 >= 20090624))
kdelibs svn rev. 987857 / kdebase svn rev. 987857
on ArchLinux i686 - Kernel 2.6.30

If I open more than two links from the first page, then click the last tab (at the right) and close it, only the one next to it loses the "unread highlight". The other ones between the first and the last-1 keep it.

I should look on the ktabbar code and check if this "activate previously opened" option is a global one or if it is implemented at Konqueror (and Konversation borrowed the same code).

It looks like this options is only faking the "active previously opened", so it first shows the tab on the left, and then quickly switches to the last active one. That would explain why the tab "closed-1" lost its highlight
Comment 8 Dario Andres 2009-06-27 23:28:38 UTC
Indeed, KTabBar handles the code for "activate previously opened tab on close", so it is a kdelibs/kdeui issue. Reassigning
Comment 9 Dario Andres 2009-06-27 23:52:12 UTC
Created attachment 34871 [details]
Proposed patch

The current code, first removes the current tab and the sets the index to the previous active one. This causes this bug as removing the current tab will force the index-1 tab to be activated too, and then the previously activated one will be set.

Proposed patch: first set the current index to the "previously active tab", and then remove the "current" (or the index of the tab which was the current one when we middleclicked it)
Comment 10 Dario Andres 2009-06-27 23:52:52 UTC
@Urs: could you check the patch? Thanks
Comment 11 Urs Wolfer 2009-06-28 18:23:43 UTC
The patch looks okay to me; probably you want to add a testcase to the KTabWidget test app? Just an idea if you like...
Comment 12 Dario Andres 2009-06-30 20:30:05 UTC
It seems the new Qt api superseeds this: "Use QTabBar::setSelectionBehaviorOnRemove() instead.". (QTabBar::SelectPreviousTab)
Should KTabBar ported to use this feature ?
Comment 13 Urs Wolfer 2009-06-30 21:53:27 UTC
Dario: I think we should use as much as possible from QTabBar. I have not looked into that new feature yet, but if you think we can replace it with this new feature, please prepare a patch.
Comment 14 Panagiotis Papadopoulos 2009-10-02 23:19:38 UTC
any update?
:-)
Comment 15 Dario Andres 2009-10-10 18:53:24 UTC
I didn't had the time to look into this yet.. sorry
Comment 16 Dario Andres 2009-10-11 17:24:06 UTC
Patch proposed at http://reviewboard.kde.org/r/1823/ . Regards
Comment 17 Dario Andres 2009-11-14 02:30:55 UTC
SVN commit 1048848 by darioandres:

- Update KTabBar and KTabWidget to use the Qt "setSelectionBehaviorOnRemove" implementation
  - Implements http://reviewboard.kde.org/r/1823/

BUG: 181124
BUG: 207747


 M  +2 -4      ktabbar.cpp  
 M  +3 -21     ktabwidget.cpp  
 M  +4 -1      ktabwidget.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1048848