mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Move last tab tracking from TabWidget to TabBar
This commit is contained in:
parent
0f2728e49e
commit
71f5d72a65
@ -26,6 +26,7 @@
|
|||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
#include "tabcontextmenu.h"
|
#include "tabcontextmenu.h"
|
||||||
#include "searchenginesmanager.h"
|
#include "searchenginesmanager.h"
|
||||||
|
#include "tabmrumodel.h"
|
||||||
|
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
@ -425,11 +426,13 @@ void TabBar::currentTabChanged(int index)
|
|||||||
// Don't hide close buttons when dragging tabs
|
// Don't hide close buttons when dragging tabs
|
||||||
if (m_dragStartPosition.isNull()) {
|
if (m_dragStartPosition.isNull()) {
|
||||||
showCloseButton(index);
|
showCloseButton(index);
|
||||||
hideCloseButton(m_tabWidget->lastTabIndex());
|
if (m_lastTab) {
|
||||||
|
hideCloseButton(m_lastTab->tabIndex());
|
||||||
|
}
|
||||||
QTimer::singleShot(100, this, [this]() { ensureVisible(); });
|
QTimer::singleShot(100, this, [this]() { ensureVisible(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_lastTab = webTab(index);
|
||||||
m_tabWidget->currentTabChanged(index);
|
m_tabWidget->currentTabChanged(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,9 @@
|
|||||||
#ifndef TABBAR_H
|
#ifndef TABBAR_H
|
||||||
#define TABBAR_H
|
#define TABBAR_H
|
||||||
|
|
||||||
#include "combotabbar.h"
|
#include <QPointer>
|
||||||
|
|
||||||
|
#include "combotabbar.h"
|
||||||
#include "qzcommon.h"
|
#include "qzcommon.h"
|
||||||
|
|
||||||
class BrowserWindow;
|
class BrowserWindow;
|
||||||
@ -88,6 +89,7 @@ private:
|
|||||||
QPoint m_dragStartPosition;
|
QPoint m_dragStartPosition;
|
||||||
|
|
||||||
bool m_forceHidden;
|
bool m_forceHidden;
|
||||||
|
QPointer<WebTab> m_lastTab;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TABBAR_H
|
#endif // TABBAR_H
|
||||||
|
@ -321,7 +321,6 @@ int TabWidget::addView(const LoadRequest &req, const Qz::NewTabPositionFlags &op
|
|||||||
int TabWidget::addView(const LoadRequest &req, const QString &title, const Qz::NewTabPositionFlags &openFlags, bool selectLine, int position, bool pinned)
|
int TabWidget::addView(const LoadRequest &req, const QString &title, const Qz::NewTabPositionFlags &openFlags, bool selectLine, int position, bool pinned)
|
||||||
{
|
{
|
||||||
QUrl url = req.url();
|
QUrl url = req.url();
|
||||||
m_lastTab = weTab();
|
|
||||||
m_currentTabFresh = false;
|
m_currentTabFresh = false;
|
||||||
|
|
||||||
if (url.isEmpty() && !(openFlags & Qz::NT_CleanTab)) {
|
if (url.isEmpty() && !(openFlags & Qz::NT_CleanTab)) {
|
||||||
@ -512,7 +511,6 @@ void TabWidget::currentTabChanged(int index)
|
|||||||
|
|
||||||
WebTab* webTab = weTab(index);
|
WebTab* webTab = weTab(index);
|
||||||
webTab->tabActivated();
|
webTab->tabActivated();
|
||||||
m_lastTab = webTab;
|
|
||||||
|
|
||||||
LocationBar* locBar = webTab->locationBar();
|
LocationBar* locBar = webTab->locationBar();
|
||||||
|
|
||||||
@ -535,8 +533,6 @@ void TabWidget::tabWasMoved(int before, int after)
|
|||||||
|
|
||||||
void TabWidget::setCurrentIndex(int index)
|
void TabWidget::setCurrentIndex(int index)
|
||||||
{
|
{
|
||||||
m_lastTab = weTab();
|
|
||||||
|
|
||||||
TabStackedWidget::setCurrentIndex(index);
|
TabStackedWidget::setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,16 +572,6 @@ WebTab *TabWidget::webTab(int index) const
|
|||||||
return index < 0 ? weTab() : weTab(index);
|
return index < 0 ? weTab() : weTab(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebTab *TabWidget::lastTab() const
|
|
||||||
{
|
|
||||||
return m_lastTab;
|
|
||||||
}
|
|
||||||
|
|
||||||
int TabWidget::lastTabIndex() const
|
|
||||||
{
|
|
||||||
return m_lastTab ? m_lastTab->tabIndex() : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int TabWidget::extraReservedWidth() const
|
int TabWidget::extraReservedWidth() const
|
||||||
{
|
{
|
||||||
return m_buttonAddTab->width();
|
return m_buttonAddTab->width();
|
||||||
|
@ -85,9 +85,6 @@ public:
|
|||||||
|
|
||||||
WebTab *webTab(int index = -1) const;
|
WebTab *webTab(int index = -1) const;
|
||||||
|
|
||||||
WebTab *lastTab() const;
|
|
||||||
int lastTabIndex() const;
|
|
||||||
|
|
||||||
TabBar* tabBar() const;
|
TabBar* tabBar() const;
|
||||||
ClosedTabsManager* closedTabsManager() const;
|
ClosedTabsManager* closedTabsManager() const;
|
||||||
QList<WebTab*> allTabs(bool withPinned = true);
|
QList<WebTab*> allTabs(bool withPinned = true);
|
||||||
@ -172,7 +169,6 @@ private:
|
|||||||
AddTabButton* m_buttonAddTab;
|
AddTabButton* m_buttonAddTab;
|
||||||
AddTabButton* m_buttonAddTab2;
|
AddTabButton* m_buttonAddTab2;
|
||||||
|
|
||||||
QPointer<WebTab> m_lastTab;
|
|
||||||
QPointer<WebTab> m_lastBackgroundTab;
|
QPointer<WebTab> m_lastBackgroundTab;
|
||||||
|
|
||||||
bool m_dontCloseWithOneTab;
|
bool m_dontCloseWithOneTab;
|
||||||
|
Loading…
Reference in New Issue
Block a user