Fix enabling move tab left/right in tab popup menu in konqueror

This resolves Bug 1067
pull/2/head
Michele Calgaro 12 years ago committed by Slávek Banko
parent 36ba7f5345
commit dd68da828b

@ -22,6 +22,8 @@
Additional changes:
- 2013/10/16 Michele Calgaro
add "scroll tabs on mouse wheel event" functionality
- 2013/10/18 Michele Calgaro
correctly enable/disable 'move tab left/right' in the tab popup menu
*/
#include "konq_tabs.h"
@ -386,12 +388,32 @@ void KonqFrameTabs::slotContextMenu( const TQPoint &p )
m_pPopupMenu->setItemEnabled( RELOAD_ID, false );
m_pPopupMenu->setItemEnabled( DUPLICATE_ID, false );
m_pPopupMenu->setItemEnabled( BREAKOFF_ID, false );
m_pPopupMenu->setItemEnabled( MOVE_LEFT_ID, false );
// The following line fails to build. Adapted from konq_mainwindow.cc: 4243. Help!
// m_pPopupMenu->setItemEnabled( MOVE_LEFT_ID, m_pViewManager->mainWindow()->currentView() ? m_pViewManager->mainWindow()->currentView()->frame()!=(TQApplication::reverseLayout() ? childFrameList->last() : childFrameList->first()) : false );
m_pPopupMenu->setItemEnabled( MOVE_RIGHT_ID, false );
// The following line fails to build. Adapted from konq_mainwindow.cc: 4245. Help!
// m_pPopupMenu->setItemEnabled( MOVE_RIGHT_ID, m_pViewManager->mainWindow()->currentView() ? m_pViewManager->mainWindow()->currentView()->frame()!=(TQApplication::reverseLayout() ? childFrameList->first() : childFrameList->last()) : false );
uint tabCount = m_pChildFrameList->count();
KonqView *kview = m_pViewManager->mainWindow()->currentView();
if (tabCount>1 && kview)
{
// Move tab left
bool left_enable = false, right_enable = false;
if (TQApplication::reverseLayout())
{
left_enable = (kview->frame() != m_pChildFrameList->last());
right_enable= (kview->frame() != m_pChildFrameList->first());
}
else
{
left_enable = (kview->frame() != m_pChildFrameList->first());
right_enable= (kview->frame() != m_pChildFrameList->last());
}
m_pPopupMenu->setItemEnabled( MOVE_LEFT_ID, left_enable);
m_pPopupMenu->setItemEnabled( MOVE_RIGHT_ID, right_enable);
}
else
{
m_pPopupMenu->setItemEnabled(MOVE_LEFT_ID, false);
m_pPopupMenu->setItemEnabled(MOVE_RIGHT_ID, false);
}
m_pPopupMenu->setItemEnabled( CLOSETAB_ID, false );
m_pPopupMenu->setItemEnabled( OTHERTABS_ID, true );
m_pSubPopupMenuTab->setItemEnabled( m_closeOtherTabsId, false );
@ -407,8 +429,31 @@ void KonqFrameTabs::slotContextMenu( TQWidget *w, const TQPoint &p )
m_pPopupMenu->setItemEnabled( RELOAD_ID, true );
m_pPopupMenu->setItemEnabled( DUPLICATE_ID, true );
m_pPopupMenu->setItemEnabled( BREAKOFF_ID, tabCount>1 );
m_pPopupMenu->setItemEnabled( MOVE_LEFT_ID, tabCount>1 );
m_pPopupMenu->setItemEnabled( MOVE_RIGHT_ID, tabCount>1 );
KonqView *kview = m_pViewManager->mainWindow()->currentView();
if (tabCount>1 && kview)
{
// Move tab left
bool left_enable = false, right_enable = false;
if (TQApplication::reverseLayout())
{
left_enable = (kview->frame() != m_pChildFrameList->last());
right_enable= (kview->frame() != m_pChildFrameList->first());
}
else
{
left_enable = (kview->frame() != m_pChildFrameList->first());
right_enable= (kview->frame() != m_pChildFrameList->last());
}
m_pPopupMenu->setItemEnabled( MOVE_LEFT_ID, left_enable);
m_pPopupMenu->setItemEnabled( MOVE_RIGHT_ID, right_enable);
}
else
{
m_pPopupMenu->setItemEnabled(MOVE_LEFT_ID, false);
m_pPopupMenu->setItemEnabled(MOVE_RIGHT_ID, false);
}
m_pPopupMenu->setItemEnabled( CLOSETAB_ID, tabCount>1 );
m_pPopupMenu->setItemEnabled( OTHERTABS_ID, tabCount>1 );
m_pSubPopupMenuTab->setItemEnabled( m_closeOtherTabsId, true );

Loading…
Cancel
Save