mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
SessionRestore: Set tab title after at the end
This change saves a lot of recalculations which is done after each tab is added. Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
parent
b3b413c660
commit
24e6fe3d38
@ -326,7 +326,7 @@ WebTab* TabBar::webTab(int index) const
|
||||
|
||||
void TabBar::showCloseButton(int index)
|
||||
{
|
||||
if (!validIndex(index) || m_isRestoring) {
|
||||
if (!validIndex(index)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ void TabBar::contextMenuEvent(QContextMenuEvent* event)
|
||||
|
||||
void TabBar::hideCloseButton(int index)
|
||||
{
|
||||
if (!validIndex(index) || tabsClosable() || m_isRestoring) {
|
||||
if (!validIndex(index) || tabsClosable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ void TabBar::currentTabChanged(int index)
|
||||
}
|
||||
|
||||
// Don't hide close buttons when dragging tabs
|
||||
if (m_dragStartPosition.isNull()) {
|
||||
if (m_dragStartPosition.isNull() && !m_isRestoring) {
|
||||
showCloseButton(index);
|
||||
if (m_lastTab) {
|
||||
hideCloseButton(m_lastTab->tabIndex());
|
||||
@ -436,6 +436,10 @@ void TabBar::currentTabChanged(int index)
|
||||
|
||||
void TabBar::setTabText(int index, const QString &text)
|
||||
{
|
||||
if (m_isRestoring) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString tabText = text;
|
||||
|
||||
// Avoid Alt+letter shortcuts
|
||||
@ -735,4 +739,9 @@ void TabBar::setIsRestoring(bool restoring)
|
||||
m_isRestoring = restoring;
|
||||
}
|
||||
|
||||
bool TabBar::isRestoring()
|
||||
{
|
||||
return m_isRestoring;
|
||||
}
|
||||
|
||||
#include "tabbar.moc"
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
|
||||
void setIsRestoring(bool restoring);
|
||||
bool isRestoring();
|
||||
|
||||
Q_SIGNALS:
|
||||
void moveAddTabButton(int posX);
|
||||
|
@ -507,17 +507,19 @@ void TabWidget::currentTabChanged(int index)
|
||||
m_lastBackgroundTab = nullptr;
|
||||
m_currentTabFresh = false;
|
||||
|
||||
WebTab* webTab = weTab(index);
|
||||
webTab->tabActivated();
|
||||
if (!m_tabBar->isRestoring()) {
|
||||
WebTab* webTab = weTab(index);
|
||||
webTab->tabActivated();
|
||||
|
||||
LocationBar* locBar = webTab->locationBar();
|
||||
LocationBar* locBar = webTab->locationBar();
|
||||
|
||||
if (locBar && m_locationBars->indexOf(locBar) != -1) {
|
||||
m_locationBars->setCurrentWidget(locBar);
|
||||
if (locBar && m_locationBars->indexOf(locBar) != -1) {
|
||||
m_locationBars->setCurrentWidget(locBar);
|
||||
}
|
||||
|
||||
m_window->currentTabChanged();
|
||||
}
|
||||
|
||||
m_window->currentTabChanged();
|
||||
|
||||
Q_EMIT changed();
|
||||
}
|
||||
|
||||
@ -874,6 +876,11 @@ bool TabWidget::restoreState(const QVector<WebTab::SavedTab> &tabs, int currentT
|
||||
|
||||
m_tabBar->setIsRestoring(false);
|
||||
|
||||
auto const l_allTabs = allTabs();
|
||||
for (const WebTab* tab : l_allTabs) {
|
||||
m_tabBar->setTabText(tab->tabIndex(), tab->title());
|
||||
}
|
||||
|
||||
setCurrentIndex(currentTab);
|
||||
QTimer::singleShot(0, m_tabBar, SLOT(ensureVisible(int,int)));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user