summaryrefslogtreecommitdiff
path: root/qutebrowser/mainwindow/tabbedbrowser.py
diff options
context:
space:
mode:
authorJimmy <jimmy@spalge.com>2019-05-25 20:49:14 +1200
committerJimmy <jimmy@spalge.com>2020-07-13 13:14:48 +1200
commit976f5215d972cc14b1d278a5effbcca8b2ab094b (patch)
treed63bb81a99ba4f5ee5b6037d0197dd8b21e31be7 /qutebrowser/mainwindow/tabbedbrowser.py
parent19ccaba0b96f0a9702a80b1728dedb2ea08a7535 (diff)
downloadqutebrowser-976f5215d972cc14b1d278a5effbcca8b2ab094b.tar.gz
qutebrowser-976f5215d972cc14b1d278a5effbcca8b2ab094b.zip
Add prototype window close undo command.
Adds a shutting_down signal to TabbedBrowser. Application listens for that signal and hoards the closing browser's undo stack. A new command is added to make a new window and give it a undo stack. Only the first tab on the undo stack is popped. We don't know how many were open when the window was closed. Since the only way to close a window(?) is with :close though the easiest way to get that would be to have `TabbedBrowser.shutdown()` clear the undo stack before closing the tabs. Then change the window undoer to undo all the tabs, or flatten the entries into one list. Still needs to remember the page geometry and privatness and be wired into the existing :undo command.
Diffstat (limited to 'qutebrowser/mainwindow/tabbedbrowser.py')
-rw-r--r--qutebrowser/mainwindow/tabbedbrowser.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py
index 7387fcecc..2220bd377 100644
--- a/qutebrowser/mainwindow/tabbedbrowser.py
+++ b/qutebrowser/mainwindow/tabbedbrowser.py
@@ -182,6 +182,7 @@ class TabbedBrowser(QWidget):
arg: The new size.
current_tab_changed: The current tab changed to the emitted tab.
new_tab: Emits the new WebView and its index when a new tab is opened.
+ shutting_down: This TabbedBrowser will be deleted soon.
"""
cur_progress = pyqtSignal(int)
@@ -197,6 +198,7 @@ class TabbedBrowser(QWidget):
resized = pyqtSignal('QRect')
current_tab_changed = pyqtSignal(browsertab.AbstractTab)
new_tab = pyqtSignal(browsertab.AbstractTab, int)
+ shutting_down = pyqtSignal()
def __init__(self, *, win_id, private, parent=None):
if private:
@@ -386,7 +388,8 @@ class TabbedBrowser(QWidget):
# Removing first causes [2..-1] to be recomputed
# Removing the last causes nothing to be recomputed
for tab in reversed(self.widgets()):
- self._remove_tab(tab, add_undo=False)
+ self._remove_tab(tab)
+ self.shutting_down.emit()
def tab_close_prompt_if_pinned(
self, tab, force, yes_action,