1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Skip show/hide close button when restoring session

BUG: 455012

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2023-04-16 15:02:55 +02:00
parent 9313820c28
commit b3b413c660
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
3 changed files with 15 additions and 2 deletions

View File

@ -326,7 +326,7 @@ WebTab* TabBar::webTab(int index) const
void TabBar::showCloseButton(int index) void TabBar::showCloseButton(int index)
{ {
if (!validIndex(index)) { if (!validIndex(index) || m_isRestoring) {
return; return;
} }
@ -358,7 +358,7 @@ void TabBar::contextMenuEvent(QContextMenuEvent* event)
void TabBar::hideCloseButton(int index) void TabBar::hideCloseButton(int index)
{ {
if (!validIndex(index) || tabsClosable()) { if (!validIndex(index) || tabsClosable() || m_isRestoring) {
return; return;
} }
@ -730,4 +730,9 @@ void TabBar::dropEvent(QDropEvent* event)
} }
} }
void TabBar::setIsRestoring(bool restoring)
{
m_isRestoring = restoring;
}
#include "tabbar.moc" #include "tabbar.moc"

View File

@ -43,6 +43,8 @@ public:
void wheelEvent(QWheelEvent* event) override; void wheelEvent(QWheelEvent* event) override;
void setIsRestoring(bool restoring);
Q_SIGNALS: Q_SIGNALS:
void moveAddTabButton(int posX); void moveAddTabButton(int posX);
@ -90,6 +92,8 @@ private:
bool m_forceHidden; bool m_forceHidden;
QPointer<WebTab> m_lastTab; QPointer<WebTab> m_lastTab;
bool m_isRestoring = false;
}; };
#endif // TABBAR_H #endif // TABBAR_H

View File

@ -849,6 +849,8 @@ bool TabWidget::restoreState(const QVector<WebTab::SavedTab> &tabs, int currentT
return false; return false;
} }
m_tabBar->setIsRestoring(true);
QVector<QPair<WebTab*, QVector<int>>> childTabs; QVector<QPair<WebTab*, QVector<int>>> childTabs;
for (int i = 0; i < tabs.size(); ++i) { for (int i = 0; i < tabs.size(); ++i) {
@ -870,6 +872,8 @@ bool TabWidget::restoreState(const QVector<WebTab::SavedTab> &tabs, int currentT
} }
} }
m_tabBar->setIsRestoring(false);
setCurrentIndex(currentTab); setCurrentIndex(currentTab);
QTimer::singleShot(0, m_tabBar, SLOT(ensureVisible(int,int))); QTimer::singleShot(0, m_tabBar, SLOT(ensureVisible(int,int)));