Пример #1
0
void TabBar::contextMenu(int tab, const QPoint &pos)
{
    KActionMenu *closedTabsMenu = setupHistoryActions();

    m_actualIndex = tab;

    KMenu menu;
    MainWindow *mainWindow = rApp->mainWindow();

    menu.addAction(mainWindow->actionByName(QL1S("new_tab")));
    menu.addAction(mainWindow->actionByName(QL1S("clone_tab")));
    if (count() > 1)
    {
        menu.addAction(mainWindow->actionByName(QL1S("detach_tab")));
    }
    menu.addAction(mainWindow->actionByName(QL1S("open_last_closed_tab")));
    menu.addAction(closedTabsMenu);
    menu.addSeparator();
    menu.addAction(mainWindow->actionByName(QL1S("close_tab")));
    if (count() > 1)
    {
        menu.addAction(mainWindow->actionByName(QL1S("close_other_tabs")));
    }
    menu.addSeparator();
    menu.addAction(mainWindow->actionByName(QL1S("reload_tab")));
    if (count() > 1)
    {
        menu.addAction(mainWindow->actionByName(QL1S("reload_all_tabs")));
    }
    menu.exec(pos);
}
Пример #2
0
void TabBar::emptyAreaContextMenu(const QPoint &pos)
{
    setupHistoryActions();

    KMenu menu;
    MainWindow *mainWindow = Application::instance()->mainWindow();

    menu.addAction(mainWindow->actionByName( QL1S("new_tab") ));
    menu.addAction(mainWindow->actionByName( QL1S("open_last_closed_tab") ));
    menu.addAction(mainWindow->actionByName( QL1S("closed_tab_menu") ));
    menu.addSeparator();
    menu.addAction(mainWindow->actionByName( QL1S("reload_all_tabs") ));

    KToolBar *mainBar = mainWindow->toolBar("mainToolBar");
    if(!mainBar->isVisible())
    {
        menu.addAction( mainBar->toggleViewAction() );
    }

    menu.exec(pos);
}