From 1064880450a648696dfabdf698fdbeec095604e1 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Fri, 29 Jul 2022 18:48:04 +0300 Subject: [PATCH] Fix favorities indication when new tabs open in background --- mainwindow.cc | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index b0ca85c3..67dfe308 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -1821,21 +1821,25 @@ void MainWindow::titleChanged( ArticleView * view, QString const & title ) escaped.append( (ushort)0x202C ); // PDF, POP DIRECTIONAL FORMATTING } - ui.tabWidget->setTabText( ui.tabWidget->indexOf( view ), escaped ); + int index = ui.tabWidget->indexOf( view ); + ui.tabWidget->setTabText( index, escaped ); - // Set icon for "Add to Favorites" action - if( isWordPresentedInFavorites( title, cfg.lastMainGroupId ) ) + if( index == ui.tabWidget->currentIndex() ) { - addToFavorites->setIcon( blueStarIcon ); - addToFavorites->setToolTip( tr( "Remove current tab from Favorites" ) ); - } - else - { - addToFavorites->setIcon( starIcon ); - addToFavorites->setToolTip( tr( "Add current tab to Favorites" ) ); - } + // Set icon for "Add to Favorites" action + if( isWordPresentedInFavorites( title, cfg.lastMainGroupId ) ) + { + addToFavorites->setIcon( blueStarIcon ); + addToFavorites->setToolTip( tr( "Remove current tab from Favorites" ) ); + } + else + { + addToFavorites->setIcon( starIcon ); + addToFavorites->setToolTip( tr( "Add current tab to Favorites" ) ); + } - updateWindowTitle(); + updateWindowTitle(); + } } void MainWindow::iconChanged( ArticleView * view, QIcon const & icon )