case TABMODE_THREADVIEW: setXMLFile( "threadtabwidgetui.rc" ); break;
}
- setTabBar( new KitaThreadTabBar( this ) );
-
connectSignals();
setupActions();
/*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*/
-
-
-KitaThreadTabBar::KitaThreadTabBar( QWidget* parent, const char* name ) : KTabBar( parent, name ) {
- connect( this, SIGNAL( contextMenu( int, const QPoint& ) ),
- SLOT( showPopupMenu( int, const QPoint& ) ) );
-}
-
-KitaThreadTabBar::~KitaThreadTabBar() {
-}
-
-/* private */ /* virtual */
-void KitaThreadTabBar::showPopupMenu( int idx, const QPoint& global )
-{
- enum{
- MENU_CLOSE,
- MENU_CLOSEOTHER,
- MENU_CLOSELEFT,
- MENU_CLOSERIGHT,
- MENU_OPENBROWSER,
- MENU_COPYURL,
- MENU_COPYTITLE
- };
-
- KitaThreadTabWidget* tabwidget = static_cast<KitaThreadTabWidget*>( parentWidget() );
- KActionCollection * collection = tabwidget->actionCollection();
-
- KPopupMenu* popup = new KPopupMenu( this );
- popup->clear();
-
- popup->insertItem( i18n( "Close this tab" ) , MENU_CLOSE );
- collection->action( "tab_prevtab" ) ->plug( popup );
- collection->action( "tab_nexttab" ) ->plug( popup );
- popup->insertSeparator();
-
- popup->insertItem( i18n( "Close Other Tabs" ) , MENU_CLOSEOTHER );
- popup->insertItem( i18n( "Close right tabs" ) , MENU_CLOSERIGHT );
- popup->insertItem( i18n( "Close left tabs" ) , MENU_CLOSELEFT );
- collection->action( "tab_closealltab" ) ->plug( popup );
-
- popup->insertSeparator();
-
- popup->insertItem( i18n( "Open with Web Browser" ) , MENU_OPENBROWSER );
- popup->insertItem( i18n( "Copy URL" ) , MENU_COPYURL );
- popup->insertItem( i18n( "Copy title and URL" ) , MENU_COPYTITLE );
-
- popup->insertSeparator();
- collection->action( "tab_configkeys" ) ->plug( popup );
-
-
- int ret = popup->exec( global );
- delete popup;
-
- switch ( ret ) {
- case MENU_CLOSE: tabwidget->slotCloseTab( idx ); break;
- case MENU_CLOSEOTHER: tabwidget->slotCloseOtherTab( idx ); break;
- case MENU_CLOSERIGHT: tabwidget->slotCloseRightTab( idx ); break;
- case MENU_CLOSELEFT: tabwidget->slotCloseLeftTab( idx ); break;
- case MENU_OPENBROWSER: tabwidget->slotOpenBrowser( idx ); break;
- case MENU_COPYURL: tabwidget->slotCopyURL( idx ); break;
- case MENU_COPYTITLE: tabwidget->slotCopyTitleURL( idx ); break;
- }
-
-}
-
-
-
/*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*/