diff options
author | Saptak S <saptak013@gmail.com> | 2023-04-09 19:26:57 +0530 |
---|---|---|
committer | Saptak S <saptak013@gmail.com> | 2023-05-26 17:24:57 +0530 |
commit | 8c50b4ad6748a2e131e28a11275b61b1f578d10f (patch) | |
tree | 657265c247d12bf5aa70074ba4a31068a5796de1 | |
parent | 4208d04ed25912631491368fc71c3da2dbd539b4 (diff) | |
download | onionshare-8c50b4ad6748a2e131e28a11275b61b1f578d10f.tar.gz onionshare-8c50b4ad6748a2e131e28a11275b61b1f578d10f.zip |
Check current index tab for autoconnectfix-autoconnect-with-persistent-tabs
Currently, we were testing the first tab for autoconnect. However, in
case of persistent tabs, that doesn't work. Since autoconnect is the
last tab that gets added in that case. So we need to check the current
active tab
-rw-r--r-- | desktop/onionshare/tab_widget.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/desktop/onionshare/tab_widget.py b/desktop/onionshare/tab_widget.py index 749dd790..2a867ba5 100644 --- a/desktop/onionshare/tab_widget.py +++ b/desktop/onionshare/tab_widget.py @@ -169,8 +169,19 @@ class TabWidget(QtWidgets.QTabWidget): self.open_connection_tab() def check_autoconnect_tab(self): - if type(self.tabs[0]) is AutoConnectTab: - self.tabs[0].check_autoconnect() + tab = self.widget(self.currentIndex()) + if not tab: + self.common.log( + "TabWidget", + "check_autoconnect", + f"tab at index {self.currentIndex()} does not exist", + ) + return + + tab_id = tab.tab_id + self.common.log("TabWidget", "check_autoconnect", f"Tab to check autoconnect: {tab_id}") + if type(self.tabs[tab_id]) is AutoConnectTab: + self.tabs[tab_id].check_autoconnect() def load_tab(self, mode_settings_id): # Load the tab's mode settings |