Add a ui -> prompt-filebrowser option

See #2104
This commit is contained in:
Florian Bruhin 2016-12-07 12:33:44 +01:00
parent 57adcea587
commit e5ddb281f4
2 changed files with 14 additions and 3 deletions

View File

@ -392,6 +392,10 @@ def data(readonly=False):
SettingValue(typ.Int(minval=0), '8'),
"The rounding radius for the edges of prompts."),
('prompt-filebrowser',
SettingValue(typ.Bool(), 'true'),
"Show a filebrowser in upload/download prompts."),
readonly=readonly
)),

View File

@ -30,7 +30,7 @@ from PyQt5.QtWidgets import (QWidget, QGridLayout, QVBoxLayout, QLineEdit,
QLabel, QFileSystemModel, QTreeView, QSizePolicy)
from qutebrowser.browser import downloads
from qutebrowser.config import style
from qutebrowser.config import style, config
from qutebrowser.utils import usertypes, log, utils, qtutils, objreg, message
from qutebrowser.keyinput import modeman
from qutebrowser.commands import cmdutils, cmdexc
@ -564,7 +564,9 @@ class FilenamePrompt(_BasePrompt):
self.setFocusProxy(self._lineedit)
self._init_key_label()
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
if config.get('ui', 'prompt-filebrowser'):
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
@pyqtSlot(str)
def _set_fileview_root(self, path, *, tabbed=False):
@ -624,7 +626,12 @@ class FilenamePrompt(_BasePrompt):
self._file_model = QFileSystemModel(self)
self._file_view.setModel(self._file_model)
self._file_view.clicked.connect(self._insert_path)
self._vbox.addWidget(self._file_view)
if config.get('ui', 'prompt-filebrowser'):
self._vbox.addWidget(self._file_view)
else:
self._file_view.hide()
# Only show name
self._file_view.setHeaderHidden(True)
for col in range(1, 4):