Changeset View
Changeset View
Standalone View
Standalone View
src/konqtabs.cpp
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 77 | if (m_permanentCloseButtons) { | |||
---|---|---|---|---|---|
78 | setTabsClosable(true); | 78 | setTabsClosable(true); | ||
79 | } | 79 | } | ||
80 | tabBar()->setSelectionBehaviorOnRemove( | 80 | tabBar()->setSelectionBehaviorOnRemove( | ||
81 | KonqSettings::tabCloseActivatePrevious() ? QTabBar::SelectPreviousTab : QTabBar::SelectRightTab); | 81 | KonqSettings::tabCloseActivatePrevious() ? QTabBar::SelectPreviousTab : QTabBar::SelectRightTab); | ||
82 | 82 | | |||
83 | if (KonqSettings::tabPosition() == QLatin1String("Bottom")) { | 83 | if (KonqSettings::tabPosition() == QLatin1String("Bottom")) { | ||
84 | setTabPosition(QTabWidget::South); | 84 | setTabPosition(QTabWidget::South); | ||
85 | } | 85 | } | ||
86 | connect(this, SIGNAL(closeRequest(QWidget*)), SLOT(slotCloseRequest(QWidget*))); | 86 | connect(this, &KonqFrameTabs::tabCloseRequested, this, &KonqFrameTabs::slotCloseRequest); | ||
87 | connect(this, SIGNAL(removeTabPopup()), | 87 | connect(this, SIGNAL(removeTabPopup()), | ||
88 | m_pViewManager->mainWindow(), SLOT(slotRemoveTabPopup())); | 88 | m_pViewManager->mainWindow(), SLOT(slotRemoveTabPopup())); | ||
89 | 89 | | |||
90 | if (KonqSettings::addTabButton()) { | 90 | if (KonqSettings::addTabButton()) { | ||
91 | m_leftWidget = new NewTabToolButton(this); | 91 | m_leftWidget = new NewTabToolButton(this); | ||
92 | connect(m_leftWidget, SIGNAL(clicked()), | 92 | connect(m_leftWidget, SIGNAL(clicked()), | ||
93 | m_pViewManager->mainWindow(), SLOT(slotAddTab())); | 93 | m_pViewManager->mainWindow(), SLOT(slotAddTab())); | ||
94 | connect(m_leftWidget, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)), | 94 | connect(m_leftWidget, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)), | ||
▲ Show 20 Lines • Show All 252 Lines • ▼ Show 20 Line(s) | 323 | { | |||
347 | m_popupActions[QStringLiteral("closeothertabs")] = | 347 | m_popupActions[QStringLiteral("closeothertabs")] = | ||
348 | m_pSubPopupMenuTab->addAction(QIcon::fromTheme(QStringLiteral("tab-close-other")), | 348 | m_pSubPopupMenuTab->addAction(QIcon::fromTheme(QStringLiteral("tab-close-other")), | ||
349 | i18n("Close &Other Tabs"), | 349 | i18n("Close &Other Tabs"), | ||
350 | m_pViewManager->mainWindow(), | 350 | m_pViewManager->mainWindow(), | ||
351 | SLOT(slotRemoveOtherTabsPopup()), | 351 | SLOT(slotRemoveOtherTabsPopup()), | ||
352 | m_pViewManager->mainWindow()->action("removeothertabs")->shortcut()); | 352 | m_pViewManager->mainWindow()->action("removeothertabs")->shortcut()); | ||
353 | } | 353 | } | ||
354 | 354 | | |||
355 | void KonqFrameTabs::slotCloseRequest(QWidget *w) | 355 | void KonqFrameTabs::slotCloseRequest(int idx) | ||
356 | { | 356 | { | ||
357 | m_pViewManager->mainWindow()->setWorkingTab(indexOf(w)); | 357 | m_pViewManager->mainWindow()->setWorkingTab(idx); | ||
358 | emit removeTabPopup(); | 358 | emit removeTabPopup(); | ||
359 | } | 359 | } | ||
360 | 360 | | |||
361 | void KonqFrameTabs::slotSubPopupMenuTabActivated(QAction *action) | 361 | void KonqFrameTabs::slotSubPopupMenuTabActivated(QAction *action) | ||
362 | { | 362 | { | ||
363 | setCurrentIndex(action->data().toInt()); | 363 | setCurrentIndex(action->data().toInt()); | ||
364 | } | 364 | } | ||
365 | 365 | | |||
▲ Show 20 Lines • Show All 243 Lines • ▼ Show 20 Line(s) | 608 | if (KonqSettings::mouseMiddleClickClosesTab()) { | |||
609 | QTabBar *bar = tabBar(); | 609 | QTabBar *bar = tabBar(); | ||
610 | if (watched == bar && | 610 | if (watched == bar && | ||
611 | (event->type() == QEvent::MouseButtonPress || | 611 | (event->type() == QEvent::MouseButtonPress || | ||
612 | event->type() == QEvent::MouseButtonRelease)) { | 612 | event->type() == QEvent::MouseButtonRelease)) { | ||
613 | QMouseEvent *e = static_cast<QMouseEvent *>(event); | 613 | QMouseEvent *e = static_cast<QMouseEvent *>(event); | ||
614 | if (e->button() == Qt::MidButton) { | 614 | if (e->button() == Qt::MidButton) { | ||
615 | if (event->type() == QEvent::MouseButtonRelease) { | 615 | if (event->type() == QEvent::MouseButtonRelease) { | ||
616 | const int index = bar->tabAt(e->pos()); | 616 | const int index = bar->tabAt(e->pos()); | ||
617 | slotCloseRequest(widget(index)); | 617 | slotCloseRequest(index); | ||
618 | } | 618 | } | ||
619 | e->accept(); | 619 | e->accept(); | ||
620 | return true; | 620 | return true; | ||
621 | } | 621 | } | ||
622 | } | 622 | } | ||
623 | } | 623 | } | ||
624 | return KTabWidget::eventFilter(watched, event); | 624 | return KTabWidget::eventFilter(watched, event); | ||
625 | } | 625 | } | ||
626 | 626 | |