mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 19:46:12 -04:00
Tidied up TabBar::closeTabsByZimId()
This commit is contained in:
parent
f62fc3b626
commit
caa6195caa
@ -256,12 +256,13 @@ void TabBar::triggerWebPageAction(QWebEnginePage::WebAction action, ZimView *wid
|
|||||||
|
|
||||||
void TabBar::closeTabsByZimId(const QString &id)
|
void TabBar::closeTabsByZimId(const QString &id)
|
||||||
{
|
{
|
||||||
// the last tab is + button, skip it
|
// 0th tab is always (unless this comment becomes outdated by the time you
|
||||||
for (int i = count() - 2 ; i >= 0 ; i--) {
|
// read it) the library tab, so iteration could start from 1, however we
|
||||||
|
// shouldn't try to save CPU cycles at the cost of the code breaking
|
||||||
|
// should this comment indeed become outdated ;)
|
||||||
|
for (int i = 0 ; i < realTabCount() ; ++i ) {
|
||||||
auto *zv = qobject_cast<ZimView*>(mp_stackedWidget->widget(i));
|
auto *zv = qobject_cast<ZimView*>(mp_stackedWidget->widget(i));
|
||||||
if (!zv)
|
if (zv && zv->getWebView()->zimId() == id) {
|
||||||
continue;
|
|
||||||
if (zv->getWebView()->zimId() == id) {
|
|
||||||
closeTab(i);
|
closeTab(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user