|
Lines 20-27
Link Here
|
| 20 |
|
20 |
|
| 21 |
-------------------------------------------------------------- |
21 |
-------------------------------------------------------------- |
| 22 |
Additional changes: |
22 |
Additional changes: |
| 23 |
- 2013/10/16 Michele Calgaro: |
23 |
- 2013/10/16 Michele Calgaro |
| 24 |
add "scroll tabs on mouse wheel event" functionality |
24 |
add "scroll tabs on mouse wheel event" functionality |
|
|
25 |
- 2013/10/18 Michele Calgaro |
| 26 |
correctly enable/disable 'move tab left/right' in the tab popup menu |
| 25 |
*/ |
27 |
*/ |
| 26 |
|
28 |
|
| 27 |
#include "konq_tabs.h" |
29 |
#include "konq_tabs.h" |
|
Lines 52-63
Link Here
|
| 52 |
#include <tqwhatsthis.h> |
54 |
#include <tqwhatsthis.h> |
| 53 |
#include <tqstyle.h> |
55 |
#include <tqstyle.h> |
| 54 |
|
56 |
|
| 55 |
#define DUPLICATE_ID 3 |
57 |
#define DUPLICATE_ID 3 |
| 56 |
#define RELOAD_ID 4 |
58 |
#define RELOAD_ID 4 |
| 57 |
#define BREAKOFF_ID 5 |
59 |
#define BREAKOFF_ID 5 |
| 58 |
#define CLOSETAB_ID 6 |
60 |
#define CLOSETAB_ID 6 |
| 59 |
#define OTHERTABS_ID 7 |
61 |
#define OTHERTABS_ID 7 |
| 60 |
#define MOVE_LEFT_ID 8 |
62 |
#define MOVE_LEFT_ID 8 |
| 61 |
#define MOVE_RIGHT_ID 9 |
63 |
#define MOVE_RIGHT_ID 9 |
| 62 |
|
64 |
|
| 63 |
//################################################################### |
65 |
//################################################################### |
|
Lines 121-127
Link Here
|
| 121 |
m_pViewManager->mainWindow(), |
123 |
m_pViewManager->mainWindow(), |
| 122 |
TQT_SLOT( slotMoveTabRight() ), |
124 |
TQT_SLOT( slotMoveTabRight() ), |
| 123 |
m_pViewManager->mainWindow()->action("tab_move_right")->shortcut(), |
125 |
m_pViewManager->mainWindow()->action("tab_move_right")->shortcut(), |
| 124 |
MOVE_RIGHT_ID ); |
126 |
MOVE_RIGHT_ID ); |
| 125 |
m_pPopupMenu->insertSeparator(); |
127 |
m_pPopupMenu->insertSeparator(); |
| 126 |
m_pSubPopupMenuTab = new TQPopupMenu( this ); |
128 |
m_pSubPopupMenuTab = new TQPopupMenu( this ); |
| 127 |
m_pPopupMenu->insertItem( i18n("Other Tabs" ), m_pSubPopupMenuTab, OTHERTABS_ID ); |
129 |
m_pPopupMenu->insertItem( i18n("Other Tabs" ), m_pSubPopupMenuTab, OTHERTABS_ID ); |
|
Lines 386-397
Link Here
|
| 386 |
m_pPopupMenu->setItemEnabled( RELOAD_ID, false ); |
388 |
m_pPopupMenu->setItemEnabled( RELOAD_ID, false ); |
| 387 |
m_pPopupMenu->setItemEnabled( DUPLICATE_ID, false ); |
389 |
m_pPopupMenu->setItemEnabled( DUPLICATE_ID, false ); |
| 388 |
m_pPopupMenu->setItemEnabled( BREAKOFF_ID, false ); |
390 |
m_pPopupMenu->setItemEnabled( BREAKOFF_ID, false ); |
| 389 |
m_pPopupMenu->setItemEnabled( MOVE_LEFT_ID, false ); |
391 |
|
| 390 |
// The following line fails to build. Adapted from konq_mainwindow.cc: 4243. Help! |
392 |
uint tabCount = m_pChildFrameList->count(); |
| 391 |
// m_pPopupMenu->setItemEnabled( MOVE_LEFT_ID, m_pViewManager->mainWindow()->currentView() ? m_pViewManager->mainWindow()->currentView()->frame()!=(TQApplication::reverseLayout() ? childFrameList->last() : childFrameList->first()) : false ); |
393 |
KonqView *kview = m_pViewManager->mainWindow()->currentView(); |
| 392 |
m_pPopupMenu->setItemEnabled( MOVE_RIGHT_ID, false ); |
394 |
if (tabCount>1 && kview) |
| 393 |
// The following line fails to build. Adapted from konq_mainwindow.cc: 4245. Help! |
395 |
{ |
| 394 |
// m_pPopupMenu->setItemEnabled( MOVE_RIGHT_ID, m_pViewManager->mainWindow()->currentView() ? m_pViewManager->mainWindow()->currentView()->frame()!=(TQApplication::reverseLayout() ? childFrameList->first() : childFrameList->last()) : false ); |
396 |
// Move tab left |
|
|
397 |
bool left_enable = false, right_enable = false; |
| 398 |
if (TQApplication::reverseLayout()) |
| 399 |
{ |
| 400 |
left_enable = (kview->frame() != m_pChildFrameList->last()); |
| 401 |
right_enable= (kview->frame() != m_pChildFrameList->first()); |
| 402 |
} |
| 403 |
else |
| 404 |
{ |
| 405 |
left_enable = (kview->frame() != m_pChildFrameList->first()); |
| 406 |
right_enable= (kview->frame() != m_pChildFrameList->last()); |
| 407 |
} |
| 408 |
m_pPopupMenu->setItemEnabled( MOVE_LEFT_ID, left_enable); |
| 409 |
m_pPopupMenu->setItemEnabled( MOVE_RIGHT_ID, right_enable); |
| 410 |
} |
| 411 |
else |
| 412 |
{ |
| 413 |
m_pPopupMenu->setItemEnabled(MOVE_LEFT_ID, false); |
| 414 |
m_pPopupMenu->setItemEnabled(MOVE_RIGHT_ID, false); |
| 415 |
} |
| 416 |
|
| 395 |
m_pPopupMenu->setItemEnabled( CLOSETAB_ID, false ); |
417 |
m_pPopupMenu->setItemEnabled( CLOSETAB_ID, false ); |
| 396 |
m_pPopupMenu->setItemEnabled( OTHERTABS_ID, true ); |
418 |
m_pPopupMenu->setItemEnabled( OTHERTABS_ID, true ); |
| 397 |
m_pSubPopupMenuTab->setItemEnabled( m_closeOtherTabsId, false ); |
419 |
m_pSubPopupMenuTab->setItemEnabled( m_closeOtherTabsId, false ); |
|
Lines 407-414
Link Here
|
| 407 |
m_pPopupMenu->setItemEnabled( RELOAD_ID, true ); |
429 |
m_pPopupMenu->setItemEnabled( RELOAD_ID, true ); |
| 408 |
m_pPopupMenu->setItemEnabled( DUPLICATE_ID, true ); |
430 |
m_pPopupMenu->setItemEnabled( DUPLICATE_ID, true ); |
| 409 |
m_pPopupMenu->setItemEnabled( BREAKOFF_ID, tabCount>1 ); |
431 |
m_pPopupMenu->setItemEnabled( BREAKOFF_ID, tabCount>1 ); |
| 410 |
m_pPopupMenu->setItemEnabled( MOVE_LEFT_ID, tabCount>1 ); |
432 |
|
| 411 |
m_pPopupMenu->setItemEnabled( MOVE_RIGHT_ID, tabCount>1 ); |
433 |
KonqView *kview = m_pViewManager->mainWindow()->currentView(); |
|
|
434 |
if (tabCount>1 && kview) |
| 435 |
{ |
| 436 |
// Move tab left |
| 437 |
bool left_enable = false, right_enable = false; |
| 438 |
if (TQApplication::reverseLayout()) |
| 439 |
{ |
| 440 |
left_enable = (kview->frame() != m_pChildFrameList->last()); |
| 441 |
right_enable= (kview->frame() != m_pChildFrameList->first()); |
| 442 |
} |
| 443 |
else |
| 444 |
{ |
| 445 |
left_enable = (kview->frame() != m_pChildFrameList->first()); |
| 446 |
right_enable= (kview->frame() != m_pChildFrameList->last()); |
| 447 |
} |
| 448 |
m_pPopupMenu->setItemEnabled( MOVE_LEFT_ID, left_enable); |
| 449 |
m_pPopupMenu->setItemEnabled( MOVE_RIGHT_ID, right_enable); |
| 450 |
} |
| 451 |
else |
| 452 |
{ |
| 453 |
m_pPopupMenu->setItemEnabled(MOVE_LEFT_ID, false); |
| 454 |
m_pPopupMenu->setItemEnabled(MOVE_RIGHT_ID, false); |
| 455 |
} |
| 456 |
|
| 412 |
m_pPopupMenu->setItemEnabled( CLOSETAB_ID, tabCount>1 ); |
457 |
m_pPopupMenu->setItemEnabled( CLOSETAB_ID, tabCount>1 ); |
| 413 |
m_pPopupMenu->setItemEnabled( OTHERTABS_ID, tabCount>1 ); |
458 |
m_pPopupMenu->setItemEnabled( OTHERTABS_ID, tabCount>1 ); |
| 414 |
m_pSubPopupMenuTab->setItemEnabled( m_closeOtherTabsId, true ); |
459 |
m_pSubPopupMenuTab->setItemEnabled( m_closeOtherTabsId, true ); |