Small clipboard cleanup
This commit is contained in:
parent
118d3e03cd
commit
fe81e46f7c
@ -339,10 +339,9 @@ class CommandDispatcher(QObject):
|
|||||||
Args:
|
Args:
|
||||||
sel: True to use primary selection, False to use clipboard
|
sel: True to use primary selection, False to use clipboard
|
||||||
"""
|
"""
|
||||||
clip = QApplication.clipboard()
|
|
||||||
url = urlutils.urlstring(self._tabs.currentWidget().url())
|
url = urlutils.urlstring(self._tabs.currentWidget().url())
|
||||||
mode = QClipboard.Selection if sel else QClipboard.Clipboard
|
mode = QClipboard.Selection if sel else QClipboard.Clipboard
|
||||||
clip.setText(url, mode)
|
QApplication.clipboard().setText(url, mode)
|
||||||
message.info("URL yanked to {}".format("primary selection" if sel
|
message.info("URL yanked to {}".format("primary selection" if sel
|
||||||
else "clipboard"))
|
else "clipboard"))
|
||||||
|
|
||||||
@ -353,10 +352,9 @@ class CommandDispatcher(QObject):
|
|||||||
Args:
|
Args:
|
||||||
sel: True to use primary selection, False to use clipboard
|
sel: True to use primary selection, False to use clipboard
|
||||||
"""
|
"""
|
||||||
clip = QApplication.clipboard()
|
|
||||||
title = self._tabs.tabText(self._tabs.currentIndex())
|
title = self._tabs.tabText(self._tabs.currentIndex())
|
||||||
mode = QClipboard.Selection if sel else QClipboard.Clipboard
|
mode = QClipboard.Selection if sel else QClipboard.Clipboard
|
||||||
clip.setText(title, mode)
|
QApplication.clipboard().setText(title, mode)
|
||||||
message.info("Title yanked to {}".format("primary selection" if sel
|
message.info("Title yanked to {}".format("primary selection" if sel
|
||||||
else "clipboard"))
|
else "clipboard"))
|
||||||
|
|
||||||
@ -476,9 +474,8 @@ class CommandDispatcher(QObject):
|
|||||||
sel: True to use primary selection, False to use clipboard
|
sel: True to use primary selection, False to use clipboard
|
||||||
tab: True to open in a new tab.
|
tab: True to open in a new tab.
|
||||||
"""
|
"""
|
||||||
clip = QApplication.clipboard()
|
|
||||||
mode = QClipboard.Selection if sel else QClipboard.Clipboard
|
mode = QClipboard.Selection if sel else QClipboard.Clipboard
|
||||||
url = clip.text(mode)
|
url = QApplication.clipboard().text(mode)
|
||||||
if not url:
|
if not url:
|
||||||
raise CommandError("Clipboard is empty.")
|
raise CommandError("Clipboard is empty.")
|
||||||
logging.debug("Clipboard contained: '{}'".format(url))
|
logging.debug("Clipboard contained: '{}'".format(url))
|
||||||
|
Loading…
Reference in New Issue
Block a user