diff --git a/qutebrowser/app.py b/qutebrowser/app.py index f2f8e5c34..e9759c319 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -49,6 +49,11 @@ def main(): cmds['tabclose'].signal.connect(mw.tabs.close_act) cmds['tabprev'].signal.connect(mw.tabs.switch_prev) cmds['tabnext'].signal.connect(mw.tabs.switch_next) + cmds['reload'].signal.connect(mw.tabs.reload_act) + cmds['stop'].signal.connect(mw.tabs.stop_act) + cmds['back'].signal.connect(mw.tabs.back_act) + cmds['forward'].signal.connect(mw.tabs.forward_act) + cmds['print'].signal.connect(mw.tabs.print_act) kp.from_cmd_dict(cmds) mw.show() diff --git a/qutebrowser/commands/commands.py b/qutebrowser/commands/commands.py index d2aafdfd2..439087e96 100644 --- a/qutebrowser/commands/commands.py +++ b/qutebrowser/commands/commands.py @@ -29,3 +29,26 @@ class TabPrev(Command): class Quit(Command): nargs = 0 signal = pyqtSignal() + +class Reload(Command): + nargs = 0 + key = 'r' + signal = pyqtSignal() + +class Stop(Command): + nargs = 0 + signal = pyqtSignal() + +class Back(Command): + nargs = 0 + key = 'Shift+H' + signal = pyqtSignal() + +class Forward(Command): + nargs = 0 + key = 'Shift+L' + signal = pyqtSignal() + +class Print(Command): + nargs = 0 + signal = pyqtSignal() diff --git a/qutebrowser/widgets/browser.py b/qutebrowser/widgets/browser.py index 46b56d01c..ae373872c 100644 --- a/qutebrowser/widgets/browser.py +++ b/qutebrowser/widgets/browser.py @@ -1,4 +1,5 @@ from PyQt5.QtCore import QObject, pyqtSlot, QUrl, pyqtSignal +from PyQt5.QtPrintSupport import QPrintPreviewDialog from PyQt5.QtWebKitWidgets import QWebView from qutebrowser.widgets.tabbar import TabWidget import logging @@ -37,6 +38,31 @@ class TabbedBrowser(TabWidget): # FIXME pass + @pyqtSlot() + def reload_act(self): + self.currentWidget().reload() + + @pyqtSlot() + def stop_act(self): + self.currentWidget().stop() + + @pyqtSlot() + def print_act(self): + # FIXME that does not what I expect + preview = QPrintPreviewDialog() + preview.paintRequested.connect(self.currentWidget().print) + preview.exec_() + + @pyqtSlot() + def back_act(self): + # FIXME display warning if beginning of history + self.currentWidget().back() + + @pyqtSlot() + def forward_act(self): + # FIXME display warning if end of history + self.currentWidget().forward() + @pyqtSlot() def switch_prev(self): idx = self.currentIndex()