Fix #1857263 [[Enhancement] Choose last used SSL keys and certicate files](https://bugs.launchpad.net/calibre/+bug/1857263)

This commit is contained in:
Kovid Goyal 2019-12-23 09:18:51 +05:30
parent 4028327645
commit d61038d0d1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -26,6 +26,7 @@ from calibre.gui2 import (
open_url, warning_dialog open_url, warning_dialog
) )
from calibre.gui2.preferences import AbortCommit, ConfigWidgetBase, test_widget from calibre.gui2.preferences import AbortCommit, ConfigWidgetBase, test_widget
from calibre.gui2.widgets import HistoryLineEdit
from calibre.srv.code import custom_list_template as default_custom_list_template from calibre.srv.code import custom_list_template as default_custom_list_template
from calibre.srv.embedded import custom_list_template, search_the_net_urls from calibre.srv.embedded import custom_list_template, search_the_net_urls
from calibre.srv.library_broker import load_gui_libraries from calibre.srv.library_broker import load_gui_libraries
@ -33,9 +34,9 @@ from calibre.srv.opts import change_settings, options, server_config
from calibre.srv.users import ( from calibre.srv.users import (
UserManager, create_user_data, validate_password, validate_username UserManager, create_user_data, validate_password, validate_username
) )
from calibre.utils.shared_file import share_open
from calibre.utils.icu import primary_sort_key from calibre.utils.icu import primary_sort_key
from polyglot.builtins import unicode_type, as_bytes from calibre.utils.shared_file import share_open
from polyglot.builtins import as_bytes, unicode_type
try: try:
from PyQt5 import sip from PyQt5 import sip
@ -186,9 +187,10 @@ class Path(QWidget):
opt = options[name] opt = options[name]
self.l = l = QHBoxLayout(self) self.l = l = QHBoxLayout(self)
l.setContentsMargins(0, 0, 0, 0) l.setContentsMargins(0, 0, 0, 0)
self.text = t = QLineEdit(self) self.text = t = HistoryLineEdit(self)
t.initialize('server-opts-{}'.format(name))
t.setClearButtonEnabled(True) t.setClearButtonEnabled(True)
t.textChanged.connect(self.changed_signal.emit) t.currentTextChanged.connect(self.changed_signal.emit)
l.addWidget(t) l.addWidget(t)
self.b = b = QToolButton(self) self.b = b = QToolButton(self)
@ -208,6 +210,7 @@ class Path(QWidget):
ans = choose_files(self, 'choose_path_srv_opts_' + self.dname, _('Choose a file'), select_only_single_file=True) ans = choose_files(self, 'choose_path_srv_opts_' + self.dname, _('Choose a file'), select_only_single_file=True)
if ans: if ans:
self.set(ans[0]) self.set(ans[0])
self.save_history()
class Choices(QComboBox): class Choices(QComboBox):