1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +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 d375f39dc6
commit 8b2721e85c
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)
{
if (!validIndex(index)) {
if (!validIndex(index) || m_isRestoring) {
return;
}
@ -358,7 +358,7 @@ void TabBar::contextMenuEvent(QContextMenuEvent* event)
void TabBar::hideCloseButton(int index)
{
if (!validIndex(index) || tabsClosable()) {
if (!validIndex(index) || tabsClosable() || m_isRestoring) {
return;
}
@ -730,4 +730,9 @@ void TabBar::dropEvent(QDropEvent* event)
}
}
void TabBar::setIsRestoring(bool restoring)
{
m_isRestoring = restoring;
}
#include "tabbar.moc"

View File

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

View File

@ -849,6 +849,8 @@ bool TabWidget::restoreState(const QVector<WebTab::SavedTab> &tabs, int currentT
return false;
}
m_tabBar->setIsRestoring(true);
QVector<QPair<WebTab*, QVector<int>>> childTabs;
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);
QTimer::singleShot(0, m_tabBar, SLOT(ensureVisible(int,int)));