Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Error 800 2015-01-06 16:20:35 +01:00
commit c4619874e6
9 changed files with 87 additions and 23 deletions

View File

@ -127,6 +127,7 @@ Contributors, sorted by the number of commits in descending order:
* Florian Bruhin * Florian Bruhin
* Claude * Claude
* John ShaggyTwoDope Jenkins * John ShaggyTwoDope Jenkins
* Peter Vilim
* rikn00 * rikn00
* Martin Zimmermann * Martin Zimmermann
* Joel Torstensson * Joel Torstensson
@ -135,10 +136,11 @@ Contributors, sorted by the number of commits in descending order:
* Regina Hug * Regina Hug
* Mathias Fussenegger * Mathias Fussenegger
* Larry Hynes * Larry Hynes
* Peter Vilim * Thiago Barroso Perrotta
* Matthias Lisin * Matthias Lisin
* Helen Sherwood-Taylor * Helen Sherwood-Taylor
* HalosGhost * HalosGhost
* Error 800
// QUTE_AUTHORS_END // QUTE_AUTHORS_END
The following people have contributed graphics: The following people have contributed graphics:

View File

@ -39,7 +39,7 @@ your `$PATH` (e.g. `/usr/local/bin/qutebrowser` or `~/bin/qutebrowser`):
---- ----
#!/bin/bash #!/bin/bash
~/path/to/qutebrowser/.venv/bin/python3 -m qutebrowser ~/path/to/qutebrowser/.venv/bin/python3 -m qutebrowser "$@"
---- ----
On Archlinux On Archlinux

View File

@ -390,6 +390,7 @@ Valid values:
* +always+: Always show a confirmation. * +always+: Always show a confirmation.
* +multiple-tabs+: Show a confirmation if multiple tabs are opened. * +multiple-tabs+: Show a confirmation if multiple tabs are opened.
* +downloads+: Show a confirmation if downloads are running
* +never+: Never show a confirmation. * +never+: Never show a confirmation.
Default: +pass:[never]+ Default: +pass:[never]+

View File

@ -270,8 +270,11 @@ class CommandRunner(QObject):
maxsplit=maxsplit) maxsplit=maxsplit)
for s in args: for s in args:
# remove quotes and replace \" by " # remove quotes and replace \" by "
s = re.sub(r"""(^|[^\\])["']""", r'\1', s) if s == '""' or s == "''":
s = re.sub(r"""\\(["'])""", r'\1', s) s = ''
else:
s = re.sub(r"""(^|[^\\])["']""", r'\1', s)
s = re.sub(r"""\\(["'])""", r'\1', s)
self._args.append(s) self._args.append(s)
break break
else: else:

View File

@ -940,8 +940,8 @@ KEY_DATA = collections.OrderedDict([
('tab-move', ['gm']), ('tab-move', ['gm']),
('tab-move -', ['gl']), ('tab-move -', ['gl']),
('tab-move +', ['gr']), ('tab-move +', ['gr']),
('tab-next', ['J']), ('tab-next', ['J', 'gt']),
('tab-prev', ['K']), ('tab-prev', ['K', 'gT']),
('tab-clone', ['gC']), ('tab-clone', ['gC']),
('reload', ['r']), ('reload', ['r']),
('reload -f', ['R']), ('reload -f', ['R']),

View File

@ -25,6 +25,7 @@ import base64
import codecs import codecs
import os.path import os.path
import sre_constants import sre_constants
import itertools
from PyQt5.QtCore import QUrl from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QColor, QFont from PyQt5.QtGui import QColor, QFont
@ -1223,14 +1224,55 @@ class AcceptCookies(BaseType):
('never', "Don't accept cookies at all.")) ('never', "Don't accept cookies at all."))
class ConfirmQuit(BaseType): class ConfirmQuit(List):
"""Whether to display a confirmation when the window is closed.""" """Whether to display a confirmation when the window is closed."""
typestr = 'string-list'
valid_values = ValidValues(('always', "Always show a confirmation."), valid_values = ValidValues(('always', "Always show a confirmation."),
('multiple-tabs', "Show a confirmation if " ('multiple-tabs', "Show a confirmation if "
"multiple tabs are opened."), "multiple tabs are opened."),
('downloads', "Show a confirmation if "
"downloads are running"),
('never', "Never show a confirmation.")) ('never', "Never show a confirmation."))
# Values that can be combined with commas
combinable_values = ('multiple-tabs', 'downloads')
def validate(self, value):
values = self.transform(value)
# Never can't be set with other options
if 'never' in values and len(values) > 1:
raise configexc.ValidationError(
value, "List cannot contain never!")
# Always can't be set with other options
elif 'always' in values and len(values) > 1:
raise configexc.ValidationError(
value, "List cannot contain always!")
# Values have to be valid
elif not set(values).issubset(set(self.valid_values.values)):
raise configexc.ValidationError(
value, "List contains invalid values!")
# List can't have duplicates
elif len(set(values)) != len(values):
raise configexc.ValidationError(
value, "List contains duplicate values!")
def complete(self):
combinations = []
# Generate combinations of the options that can be combined
for size in range(2, len(self.combinable_values) + 1):
combinations += list(
itertools.combinations(self.combinable_values, size))
out = []
# Add valid single values
for val in self.valid_values:
out.append((val, self.valid_values.descriptions[val]))
# Add combinations to list of options
for val in combinations:
desc = ''
out.append((','.join(val), desc))
return out
class ForwardUnboundKeys(BaseType): class ForwardUnboundKeys(BaseType):

View File

@ -327,18 +327,32 @@ class MainWindow(QWidget):
def closeEvent(self, e): def closeEvent(self, e):
"""Override closeEvent to display a confirmation if needed.""" """Override closeEvent to display a confirmation if needed."""
confirm_quit = config.get('ui', 'confirm-quit') confirm_quit = config.get('ui', 'confirm-quit')
count = self._tabbed_browser.count() tab_count = self._tabbed_browser.count()
if confirm_quit == 'never': download_manager = objreg.get('download-manager', scope='window',
window=self.win_id)
download_count = download_manager.rowCount()
quit_texts = []
# Close if set to never ask for confirmation
if 'never' in confirm_quit:
pass pass
elif confirm_quit == 'multiple-tabs' and count <= 1: # Ask if multiple-tabs are open
pass if 'multiple-tabs' in confirm_quit and tab_count > 1:
else: quit_texts.append("{} {} open.".format(
text = "Close {} {}?".format( tab_count, "tab is" if tab_count == 1 else "tabs are"))
count, "tab" if count == 1 else "tabs") # Ask if multiple downloads running
if 'downloads' in confirm_quit and download_count > 0:
quit_texts.append("{} {} running.".format(
tab_count,
"download is" if tab_count == 1 else "downloads are"))
# Process all quit messages that user must confirm
if quit_texts or 'always' in confirm_quit:
text = '\n'.join(['Really quit?'] + quit_texts)
confirmed = message.ask(self.win_id, text, confirmed = message.ask(self.win_id, text,
usertypes.PromptMode.yesno, default=True) usertypes.PromptMode.yesno,
default=True)
# Stop asking if the user cancels
if not confirmed: if not confirmed:
log.destroy.debug("Cancelling losing of window {}".format( log.destroy.debug("Cancelling closing of window {}".format(
self.win_id)) self.win_id))
e.ignore() e.ignore()
return return

View File

@ -34,6 +34,7 @@ from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QPushButton,
from qutebrowser.utils import version, log, utils, objreg from qutebrowser.utils import version, log, utils, objreg
from qutebrowser.misc import miscwidgets from qutebrowser.misc import miscwidgets
from qutebrowser.browser.network import pastebin from qutebrowser.browser.network import pastebin
from qutebrowser.config import config
class _CrashDialog(QDialog): class _CrashDialog(QDialog):
@ -298,6 +299,11 @@ class ExceptionCrashDialog(_CrashDialog):
if debug: if debug:
self._chk_log.setChecked(False) self._chk_log.setChecked(False)
self._chk_log.setEnabled(False) self._chk_log.setEnabled(False)
try:
if config.get('general', 'private-browsing'):
self._chk_log.setChecked(False)
except Exception:
log.misc.exception("Error while checking private browsing mode")
self._chk_log.toggled.connect(self._set_crash_info) self._chk_log.toggled.connect(self._set_crash_info)
self._vbox.addWidget(self._chk_log) self._vbox.addWidget(self._chk_log)
info_label = QLabel("<i>This makes it a lot easier to diagnose the " info_label = QLabel("<i>This makes it a lot easier to diagnose the "

View File

@ -125,14 +125,10 @@ def link_pyqt():
if not globbed_sip: if not globbed_sip:
print("Did not find sip in {}!".format(sys_path), file=sys.stderr) print("Did not find sip in {}!".format(sys_path), file=sys.stderr)
sys.exit(1) sys.exit(1)
elif len(globbed_sip) != 1: files = [
print("Found multiple sip installations: {}!".format(globbed_sip),
file=sys.stderr)
sys.exit(1)
files = (
'PyQt5', 'PyQt5',
os.path.basename(globbed_sip[0]), ]
) files += [os.path.basename(e) for e in globbed_sip]
for fn in files: for fn in files:
source = os.path.join(sys_path, fn) source = os.path.join(sys_path, fn)
link_name = os.path.join(venv_path, fn) link_name = os.path.join(venv_path, fn)