예제 #1
0
bool PlaylistTabBar::event(QEvent* e) {
  switch (e->type()) {
    case QEvent::ToolTip: {
      QHelpEvent* he = static_cast<QHelpEvent*>(e);

      QRect displayed_tab;
      QSize real_tab;
      bool is_elided = false;

      real_tab = tabSizeHint(tabAt(he->pos()));
      displayed_tab = tabRect(tabAt(he->pos()));
      // Check whether the tab is elided or not
      is_elided = displayed_tab.width() < real_tab.width();
      if (!is_elided) {
        // If it's not elided, don't show the tooltip
        QToolTip::hideText();
      } else {
        QToolTip::showText(he->globalPos(), tabToolTip(tabAt(he->pos())));
      }
      return true;
    }
    default:
      return QTabBar::event(e);
  }
}
예제 #2
0
void TabBar::mousePressEvent(QMouseEvent *event)
{
    switch(event->button())
    {
        case Qt::LeftButton:
            m_startDragPos = event->pos();
            PlusTabBar::mousePressEvent(event);
            break;
        case Qt::MidButton:
        {
            int tab = tabAt(event->pos());

            if(tab != -1)
                emit tabCloseRequested(tab);
            break;
        }
        case Qt::RightButton:
        {
            int tab = tabAt(event->pos());
            if(tab == -1 || tabData(tab) == HOME_TAB)
                break;

            m_cur_menu_tab = tab;

            m_menu->exec(event->globalPos());
            break;
        }
        default:
            PlusTabBar::mousePressEvent(event);
            break;
    }
}
예제 #3
0
void TabBarWidget::mousePressEvent(QMouseEvent *event)
{
	if (event->button() == Qt::LeftButton && event->modifiers().testFlag(Qt::ShiftModifier))
	{
		const int tab = tabAt(event->pos());

		if (tab >= 0)
		{
			emit requestedClose(tab);

			return;
		}
	}

	QTabBar::mousePressEvent(event);

	if (event->button() == Qt::MiddleButton)
	{
		const int tab = tabAt(event->pos());

		if (tab < 0)
		{
			ActionsManager::triggerAction(ActionsManager::NewTabAction, this);
		}
		else if (SettingsManager::getValue(QLatin1String("TabBar/CloseOnMiddleClick")).toBool())
		{
			emit requestedClose(tab);
		}
	}

	hidePreview();
}
예제 #4
0
파일: tabbar.cpp 프로젝트: agnelterry/arora
void TabBar::dropEvent(QDropEvent *event)
{
    int fromIndex = tabAt(m_dragStartPos);
    int toIndex = tabAt(event->pos());
    if (fromIndex != toIndex) {
        emit tabMoveRequested(fromIndex, toIndex);
        event->acceptProposedAction();
    }
    QTabBar::dropEvent(event);
}
예제 #5
0
void DolphinTabBar::contextMenuEvent(QContextMenuEvent* event)
{
    const int index = tabAt(event->pos());

    if (index >= 0) {
        // Tab context menu
        KMenu menu(this);

        QAction* newTabAction = menu.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab"));
        QAction* detachTabAction = menu.addAction(KIcon("tab-detach"), i18nc("@action:inmenu", "Detach Tab"));
        QAction* closeOtherTabsAction = menu.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
        QAction* closeTabAction = menu.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab"));

        QAction* selectedAction = menu.exec(event->globalPos());
        if (selectedAction == newTabAction) {
            emit openNewActivatedTab(index);
        } else if (selectedAction == detachTabAction) {
            emit tabDetachRequested(index);
        } else if (selectedAction == closeOtherTabsAction) {
            const int tabCount = count();
            for (int i = 0; i < index; i++) {
                emit tabCloseRequested(0);
            }
            for (int i = index + 1; i < tabCount; i++) {
                emit tabCloseRequested(1);
            }
        } else if (selectedAction == closeTabAction) {
            emit tabCloseRequested(index);
        }

        return;
    }

    QTabBar::contextMenuEvent(event);
}
예제 #6
0
void PanelTabBar::mousePressEvent(QMouseEvent* e)
{
    int clickedTab = tabAt(e->pos());

    if (-1 == clickedTab) { // clicked on nothing ...
        QTabBar::mousePressEvent(e);
        return;
    }

    _tabClicked = true;

    setCurrentIndex(clickedTab);

    ListPanel *p =  getPanel(clickedTab);
    if(p)
        p->slotFocusOnMe();

    if (e->button() == Qt::RightButton) {
        // show the popup menu
        _panelActionMenu->menu()->popup(e->globalPos());
    } else {
        if (e->button() == Qt::MidButton)// close the current tab
            emit closeCurrentTab();
    }

    QTabBar::mousePressEvent(e);
}
예제 #7
0
void TabBar::updateDropMarker(const QPoint& pos)
{
    int idx = tabAt(pos);
    if(idx == -1)
    {
        m_drag_idx = -1;
        if(m_drag_insert)
            m_drag_insert->hide();
        return;
    }

    const int ARROW_SIZE = 32;
    if(!m_drag_insert)
    {
        m_drag_insert = new QLabel(parentWidget());
        m_drag_insert->resize(ARROW_SIZE, ARROW_SIZE);
        m_drag_insert->setAttribute(Qt::WA_TransparentForMouseEvents);
        m_drag_insert->setPixmap(QIcon(":/icons/arrow-down").pixmap(ARROW_SIZE, ARROW_SIZE));
    }

    QPoint p;
    QRect rect = tabRect(idx);
    if(pos.x() - rect.left() >= rect.width()/2)
    {
        m_drag_idx = idx+1;
        p = mapToParent(rect.topRight());
    }
    else
    {
        m_drag_idx = idx;
        p = mapToParent(rect.topLeft());
    }
    m_drag_insert->move(p - QPoint(ARROW_SIZE/2, ARROW_SIZE/2));
    m_drag_insert->show();
}
예제 #8
0
파일: tabbar.cpp 프로젝트: 593in/qupzilla
bool TabBar::event(QEvent* event)
{
    switch (event->type()) {
    case QEvent::ToolTip:
        if (!m_showTabPreviews && !isDragInProgress()) {
            QHelpEvent* ev = static_cast<QHelpEvent*>(event);
            int index = tabAt(ev->pos());

            if (index >= 0) {
                QToolTip::showText(mapToGlobal(ev->pos()), tabToolTip(index));
            }
        }
        break;

    case QEvent::Leave:
        if (!rect().contains(mapFromGlobal(QCursor::pos()))) {
            hideTabPreview();
        }
        break;

    case QEvent::Wheel:
        hideTabPreview(false);
        break;

    default:
        break;
    }

    return ComboTabBar::event(event);
}
예제 #9
0
파일: tabbar.cpp 프로젝트: 593in/qupzilla
void TabBar::showTabPreview(bool delayed)
{
    if (!m_showTabPreviews) {
        return;
    }

    if (delayed) {
        int index = tabAt(mapFromGlobal(QCursor::pos()));
        if (index == -1 || QApplication::mouseButtons() != Qt::NoButton) {
            return;
        }

        m_tabPreview->setPreviewIndex(index);
        m_tabPreviewShowTimer->stop();
    }

    WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_tabPreview->previewIndex()));
    if (!webTab) {
        return;
    }

    m_tabPreviewHideTimer->stop();
    m_tabPreview->setWebTab(webTab, m_tabPreview->previewIndex() == currentIndex());

    QRect r(tabRect(m_tabPreview->previewIndex()));
    r.setTopLeft(mapTo(m_window, r.topLeft()));
    r.setBottomRight(mapTo(m_window, r.bottomRight()));

    m_tabPreview->showOnRect(r);
}
예제 #10
0
void TabBar::mouseMoveEvent (QMouseEvent *event)
{
    QTabBar::mouseMoveEvent (event);
    int index = tabAt (event->pos());
    if (index != -1)
        QToolTip::showText (event->globalPos(), tabToolTip (index));
}
예제 #11
0
/** Redefined to display an editable area. */
void TabBar::mouseDoubleClickEvent(QMouseEvent *event)
{
	int tabIndex = tabAt(event->pos());
	int c = currentIndex();
	if (-1 < tabIndex && tabIndex < count() && c == tabIndex) {
		QRect visualRect = tabRect(tabIndex);
		SettingsPrivate *settings = SettingsPrivate::instance();
		if (settings->isRectTabs()) {
			visualRect.setLeft(visualRect.left() + 1);
			visualRect.setRight(visualRect.right() - 1);
		} else {
			visualRect.setLeft(visualRect.left() + 3 + settings->tabsOverlappingLength() * 1.25 + height() / 2);
			visualRect.setRight(visualRect.right() - settings->tabsOverlappingLength());
		}
		visualRect.setTop(visualRect.top() + 1);

		// Disable close buttons in case of unfortunate click
		for (int t = 0; t < count(); t++) {
			QWidget *button = tabButton(t, QTabBar::RightSide);
			if (button && t != tabIndex) {
				button->setEnabled(false);
			}
		}

		// Feed the QLineEdit with current tab text
		lineEdit->setText(tabText(tabIndex));
		lineEdit->selectAll();
		lineEdit->setFocus();
		lineEdit->setGeometry(visualRect);
		lineEdit->setVisible(true);
		lineEdit->grabMouse();
	}
	QTabBar::mouseDoubleClickEvent(event);
}
예제 #12
0
void QtDNDTabBar::dropEvent(QDropEvent* dropEvent) {
	QtDNDTabBar* sourceTabBar = dynamic_cast<QtDNDTabBar*>(dropEvent->source());
	if (sourceTabBar && dropEvent->mimeData() && dropEvent->mimeData()->data("action") == QByteArray("application/tab-detach")) {
		QtDNDTabBar* source = dynamic_cast<QtDNDTabBar*>(dropEvent->source());

		int targetTabIndex = tabAt(dropEvent->pos());
		QRect rect = tabRect(targetTabIndex);
		if (targetTabIndex >= 0 && (dropEvent->pos().x() - rect.left() - rect.width()/2 > 0)) {
			targetTabIndex++;
		}

		QWidget* tab = source->getDragWidget();
		assert(tab);
		QTabWidget* targetTabWidget = dynamic_cast<QTabWidget*>(parentWidget());

		QString tabText = source->getDragText();

		/*
		 * When you add a widget to an empty QTabWidget, it's automatically made the current widget.
		 * Making the widget the current widget, widget->show() is called for the widget. Directly reacting
		 * to that event, and adding the widget again to the QTabWidget results in undefined behavior. For
		 * example the tab label is shown but the widget is neither has the old nor in the new QTabWidget as
		 * parent. Blocking signals on the QWidget to be added to a QTabWidget prevents this behavior.
		 */
		targetTabWidget->setUpdatesEnabled(false);
		tab->blockSignals(true);
		targetTabWidget->insertTab(targetTabIndex, tab, tabText);
		dropEvent->acceptProposedAction();
		tab->blockSignals(false);
		targetTabWidget->setUpdatesEnabled(true);
		onDropSucceeded();
	}
}
예제 #13
0
void TabBarWidget::mouseReleaseEvent(QMouseEvent *event)
{
	QTabBar::mouseReleaseEvent(event);

	if (event->button() == Qt::MidButton && SettingsManager::getValue(QLatin1String("TabBar/CloseOnMiddleClick")).toBool())
	{
		const int tab = tabAt(event->pos());

		if (tab >= 0)
		{
			emit requestedClose(tab);
		}
	}

	if (m_previewWidget && m_previewWidget->isVisible())
	{
		m_previewWidget->hide();
	}

	if (m_previewTimer > 0)
	{
		killTimer(m_previewTimer);

		m_previewTimer = 0;
	}
}
예제 #14
0
void CallWindow::contextMenuRequested(const QPoint &location)
{
	controller->removeEmptyWindows();
	auto tabBar = tabWidget->getTabBar();
	int tabIndex = tabBar->tabAt(location);
	if (tabIndex == tabOffset - 1)
		return;
	QMenu *menu = new QMenu(this);
	connect(menu, SIGNAL(triggered(QAction *)), this,
	        SLOT(contextMenuAction(QAction *)));
	auto windows = controller->getTabWindows();
	menu->addAction(new QAction("Remove call", this));
	menu->addAction(new QAction("Close tab", this));
	menu->addAction(new QAction("Open in new window", this));
	for (auto window : windows)
	{
		if (window->getId() != id)
		{
			menu->addAction(new QAction(
			    QString("Open in '%1'").arg(window->windowTitle()),
			    this));
		}
	}
	currentContextMenuTabId = getCallTabIdByTabIndex(tabIndex);
	menu->popup(tabBar->mapToGlobal(location));
}
예제 #15
0
파일: tabbar.cpp 프로젝트: ff2000/qupzilla
void TabBar::mouseReleaseEvent(QMouseEvent* event)
{
    m_dragStartPosition = QPoint();

    if (mApp->plugins()->processMouseRelease(Qz::ON_TabBar, this, event)) {
        return;
    }

    if (m_tabWidget->buttonAddTab()->isHidden()) {
        QTimer::singleShot(500, m_tabWidget->buttonAddTab(), SLOT(show()));
    }

    if (!rect().contains(event->pos())) {
        QTabBar::mouseReleaseEvent(event);
        return;
    }

    int id = tabAt(event->pos());
    if (id != -1 && event->button() == Qt::MiddleButton) {
        m_tabWidget->closeTab(id);
        return;
    }
    if (id == -1 && event->button() == Qt::MiddleButton) {
        m_tabWidget->addView(QUrl(), Qz::NT_SelectedTabAtTheEnd, true);
        return;
    }

    QTabBar::mouseReleaseEvent(event);
}
예제 #16
0
파일: tabbar.cpp 프로젝트: ff2000/qupzilla
void TabBar::mouseMoveEvent(QMouseEvent* event)
{
    if (mApp->plugins()->processMouseMove(Qz::ON_TabBar, this, event)) {
        return;
    }

    if (!m_dragStartPosition.isNull() && m_tabWidget->buttonAddTab()->isVisible()) {
        int manhattanLength = (event->pos() - m_dragStartPosition).manhattanLength();
        if (manhattanLength > QApplication::startDragDistance()) {
            m_tabWidget->buttonAddTab()->hide();
            hideTabPreview();
        }
    }

    //Tab Preview

    const int tab = tabAt(event->pos());

    if (tab != -1 && tab != m_tabPreview->previewIndex() && event->buttons() == Qt::NoButton && m_dragStartPosition.isNull()) {
        m_tabPreview->setPreviewIndex(tab);
        if (m_tabPreview->isVisible()) {
            showTabPreview();
        }
    }

    QTabBar::mouseMoveEvent(event);
}
예제 #17
0
void WBTabBar::contextMenuRequested(const QPoint &position)
{
    QMenu menu;
    menu.addAction(tr("New &Tab"), this, SIGNAL(newTab()), QKeySequence::AddTab);
    int index = tabAt(position);
    if (-1 != index) {
        QAction *action = menu.addAction(tr("Clone Tab"), this, SLOT(cloneTab()));
        action->setData(index);

        menu.addSeparator();

        action = menu.addAction(tr("&Close Tab"), this, SLOT(closeTab()), QKeySequence::Close);
        action->setData(index);

        action = menu.addAction(tr("Close &Other Tabs"), this, SLOT(closeOtherTabs()));
        action->setData(index);

        menu.addSeparator();

        action = menu.addAction(tr("Reload Tab"), this, SLOT(reloadTab()), QKeySequence::Refresh);
        action->setData(index);
    }
    else {
        menu.addSeparator();
    }
    menu.addAction(tr("Reload All Tabs"), this, SIGNAL(reloadAllTabs()));
    menu.exec(QCursor::pos());
}
예제 #18
0
void pTabBar::mousePressEvent( QMouseEvent* event )
{
    // reset drag position
    dragStartPosition = QPoint();
    
    // get tab under cursor
    int i = tabAt( event->pos() );
    
    // if tab
    if ( i != -1 )
    {
        // emit left button pressed
        if ( event->button() == Qt::LeftButton )
            emit leftButtonPressed( i, event->globalPos() );
        
        // emit mid button pressed
        if ( event->button() == Qt::MidButton )
            emit midButtonPressed( i, event->globalPos() );
        
        // emit right button pressed and drag position
        if ( event->button() == Qt::RightButton )
        {
            emit rightButtonPressed( i, event->globalPos() );
            dragStartPosition = event->pos();
        }
    }
    
    // default event
    QTabBar::mousePressEvent( event );
}
예제 #19
0
void TabBar::dragMoveEvent(QDragMoveEvent *AEvent)
{
    QPoint dragItemCenter = mapFromGlobal(QCursor::pos()) - FDragCenterDistance;
    FLayout->moveItem(FPressedIndex, tabAt(dragItemCenter));
    AEvent->acceptProposedAction();
    QFrame::dragMoveEvent(AEvent);
}
예제 #20
0
void pTabBar::paintEvent( QPaintEvent* event )
{
    // draw tabs
    QTabBar::paintEvent( event );
    
    // update button close
    if ( !aToggleTabsHaveCloseButton->isChecked() )
        return;
    
    // get tab
    int i = tabAt( mapFromGlobal( QCursor::pos() ) );
    if ( i != -1 )
    {
        // get close button rect
        QRect ir = iconRectForTab( i );
        
        // if mouse in close button rect
        if ( ir.contains( mapFromGlobal( QCursor::pos() ) ) )
        {
            // draw button
            QPainter p( this );
            p.drawPixmap( ir.topLeft(), QIcon( ":/file/icons/file/closeall.png" ).pixmap( iconSize(), QIcon::Active, isTabEnabled( i ) ? QIcon::On : QIcon::Off ) );
        }
    }
}
예제 #21
0
bool ComboTabBar::event(QEvent *event)
{
    switch (event->type()) {
    case QEvent::ToolTip:
        if (!isDragInProgress() && !isScrollInProgress()) {
            int index = tabAt(mapFromGlobal(QCursor::pos()));
            if (index >= 0)
                QToolTip::showText(QCursor::pos(), tabToolTip(index));
        }
        break;

    case QEvent::Resize:
        ensureVisible();
        break;

    case QEvent::Show:
        if (!event->spontaneous())
            QTimer::singleShot(0, this, &ComboTabBar::setUpLayout);
        break;

    case QEvent::Enter:
    case QEvent::Leave:
        // Make sure tabs are painted with correct mouseover state
        QTimer::singleShot(100, this, &ComboTabBar::updateTabBars);
        break;

    default:
        break;
    }

    return QWidget::event(event);
}
예제 #22
0
bool ComboTabBar::emptyArea(const QPoint &pos) const
{
    if (tabAt(pos) != -1)
        return false;

    return qobject_cast<TabBarHelper*>(QApplication::widgetAt(mapToGlobal(pos)));
}
예제 #23
0
파일: tabbar.cpp 프로젝트: agnelterry/arora
void TabBar::mouseMoveEvent(QMouseEvent *event)
{
    if (event->buttons() == Qt::LeftButton) {
#if QT_VERSION >= 0x040500
        int diffX = event->pos().x() - m_dragStartPos.x();
        int diffY = event->pos().y() - m_dragStartPos.y();
#endif
        if ((event->pos() - m_dragStartPos).manhattanLength() > QApplication::startDragDistance()
#if QT_VERSION >= 0x040500
            && diffX < 3 && diffX > -3
            && diffY < -10
#endif
            ) {
            QDrag *drag = new QDrag(this);
            QMimeData *mimeData = new QMimeData;
            QList<QUrl> urls;
            int index = tabAt(event->pos());
            QUrl url = tabData(index).toUrl();
            urls.append(url);
            mimeData->setUrls(urls);
            mimeData->setText(tabText(index));
            mimeData->setData(QLatin1String("action"), "tab-reordering");
            drag->setMimeData(mimeData);
            drag->exec();
        }
    }
    QTabBar::mouseMoveEvent(event);
}
예제 #24
0
	void SeparateTabBar::mouseReleaseEvent (QMouseEvent *event)
	{
		int index = tabAt (event->pos ());
		if (index == count () - 1 &&
				event->button () == Qt::LeftButton &&
				IsLastTab_)
		{
			emit addDefaultTab ();
			return;
		}

		if (InMove_)
		{
			emit releasedMouseAfterMove (currentIndex ());
			InMove_ = false;
			emit currentChanged (currentIndex ());
		}
		else if (index != -1 &&
				event->button () == Qt::MidButton &&
				index != count () - 1)
		{
			auto rootWM = Core::Instance ().GetRootWindowsManager ();
			auto tm = rootWM->GetTabManager (Window_);
			tm->remove (index);
		}

		QTabBar::mouseReleaseEvent (event);
	}
예제 #25
0
void TabBarWidget::removeTab(int index)
{
	if (underMouse())
	{
		const QSize size = tabSizeHint(count() - 1);

		m_tabSize = size.width();
	}

	Window *window = getWindow(index);

	if (window)
	{
		window->deleteLater();
	}

	QTabBar::removeTab(index);

	if (underMouse() && tabAt(mapFromGlobal(QCursor::pos())) < 0)
	{
		m_tabSize = 0;

		updateGeometry();
		adjustSize();
	}
}
예제 #26
0
파일: tabbar.cpp 프로젝트: abenea/fubar
void TabBar::dragMoveEvent(QDragMoveEvent *event)
{
    int index = tabAt(event->pos());
    if (index == -1)
        emit newTabRequested();
    else
        emit setCurrentRequested(index);
}
예제 #27
0
void PlayListTabBar::mouseDoubleClickEvent(QMouseEvent *event){
// 	qDebug() << this << "mouseDoubleClickEvent()";
	int index=tabAt(event->pos());
	if(index!=-1)
		createRenameLine(index);
	else
		emit(newPlayList());
}
예제 #28
0
    /**
     * @brief Handles middle-mouse release event in order to close tab.
     */
    void WorkAreaTabBar::middleMouseReleaseEvent(QMouseEvent *event)
    {
        int tabIndex = tabAt(event->pos());
        if (tabIndex < 0)
            return;

        emit tabCloseRequested(tabIndex);
    }
예제 #29
0
파일: yttabbar.cpp 프로젝트: pder/smtube
void YTTabBar::mousePressEvent(QMouseEvent *m)
{    
    pressedIndex = tabAt(m->pos());
    if(pressedIndex == currentIndex())
        pressedIndex = -1;
    QTabBar::mousePressEvent(m);
    update();
}
예제 #30
0
void TabBar::contextMenuEvent(QContextMenuEvent* event)
{
    int index = tabAt(event->pos());
    m_clickedTab = index;

    QMenu menu;
    menu.addAction(IconProvider::newTabIcon(), tr("&New tab"), m_window, SLOT(addTab()));
    menu.addSeparator();
    if (index != -1) {
        WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_clickedTab));
        if (!webTab) {
            return;
        }

        if (m_window->weView(m_clickedTab)->isLoading()) {
            menu.addAction(QIcon::fromTheme(QSL("process-stop")), tr("&Stop Tab"), this, SLOT(stopTab()));
        }
        else {
            menu.addAction(QIcon::fromTheme(QSL("view-refresh")), tr("&Reload Tab"), this, SLOT(reloadTab()));
        }

        menu.addAction(QIcon::fromTheme("tab-duplicate"), tr("&Duplicate Tab"), this, SLOT(duplicateTab()));

        if (count() > 1 && !webTab->isPinned()) {
            menu.addAction(QIcon::fromTheme("tab-detach"), tr("D&etach Tab"), this, SLOT(detachTab()));
        }

        menu.addAction(webTab->isPinned() ? tr("Un&pin Tab") : tr("&Pin Tab"), this, SLOT(pinTab()));
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
        menu.addAction(webTab->isMuted() ? tr("Un&mute Tab") : tr("&Mute Tab"), this, SLOT(muteTab()));
#endif
        menu.addSeparator();
        menu.addAction(tr("Re&load All Tabs"), m_tabWidget, SLOT(reloadAllTabs()));
        menu.addAction(tr("&Bookmark This Tab"), this, SLOT(bookmarkTab()));
        menu.addAction(tr("Bookmark &All Tabs"), m_window, SLOT(bookmarkAllTabs()));
        menu.addSeparator();
        menu.addAction(m_window->action(QSL("Other/RestoreClosedTab")));
        menu.addSeparator();
        menu.addAction(tr("Close Ot&her Tabs"), this, SLOT(closeAllButCurrent()));
        menu.addAction(QIcon::fromTheme("window-close"), tr("Cl&ose"), this, SLOT(closeTab()));
        menu.addSeparator();
    }
    else {
        menu.addAction(tr("Reloa&d All Tabs"), m_tabWidget, SLOT(reloadAllTabs()));
        menu.addAction(tr("Bookmark &All Tabs"), m_window, SLOT(bookmarkAllTabs()));
        menu.addSeparator();
        menu.addAction(m_window->action(QSL("Other/RestoreClosedTab")));
    }

    m_window->action(QSL("Other/RestoreClosedTab"))->setEnabled(m_tabWidget->canRestoreTab());

    // Prevent choosing first option with double rightclick
    const QPoint pos = event->globalPos();
    QPoint p(pos.x(), pos.y() + 1);
    menu.exec(p);

    m_window->action(QSL("Other/RestoreClosedTab"))->setEnabled(true);
}