mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix unable to clear username/password in Fetch news dialog
This commit is contained in:
parent
a4e1bd8ab3
commit
85cf39ba16
@ -11,9 +11,9 @@ from datetime import timedelta
|
|||||||
import calendar, textwrap
|
import calendar, textwrap
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from PyQt4.Qt import QDialog, Qt, QTime, QObject, QMenu, QHBoxLayout, \
|
from PyQt4.Qt import (QDialog, Qt, QTime, QObject, QMenu, QHBoxLayout,
|
||||||
QAction, QIcon, QMutex, QTimer, pyqtSignal, QWidget, QGridLayout, \
|
QAction, QIcon, QMutex, QTimer, pyqtSignal, QWidget, QGridLayout,
|
||||||
QCheckBox, QTimeEdit, QLabel, QLineEdit, QDoubleSpinBox
|
QCheckBox, QTimeEdit, QLabel, QLineEdit, QDoubleSpinBox)
|
||||||
|
|
||||||
from calibre.gui2.dialogs.scheduler_ui import Ui_Dialog
|
from calibre.gui2.dialogs.scheduler_ui import Ui_Dialog
|
||||||
from calibre.gui2 import config as gconf, error_dialog
|
from calibre.gui2 import config as gconf, error_dialog
|
||||||
@ -317,6 +317,8 @@ class SchedulerDialog(QDialog, Ui_Dialog):
|
|||||||
return False
|
return False
|
||||||
if un or pw:
|
if un or pw:
|
||||||
self.recipe_model.set_account_info(urn, un, pw)
|
self.recipe_model.set_account_info(urn, un, pw)
|
||||||
|
else:
|
||||||
|
self.recipe_model.clear_account_info(urn)
|
||||||
|
|
||||||
if self.schedule.isChecked():
|
if self.schedule.isChecked():
|
||||||
schedule_type, schedule = \
|
schedule_type, schedule = \
|
||||||
|
@ -437,6 +437,14 @@ class SchedulerConfig(object):
|
|||||||
if x.get('id', False) == urn:
|
if x.get('id', False) == urn:
|
||||||
return x.get('username', ''), x.get('password', '')
|
return x.get('username', ''), x.get('password', '')
|
||||||
|
|
||||||
|
def clear_account_info(self, urn):
|
||||||
|
with self.lock:
|
||||||
|
for x in self.iter_accounts():
|
||||||
|
if x.get('id', False) == urn:
|
||||||
|
x.getparent().remove(x)
|
||||||
|
self.write_scheduler_file()
|
||||||
|
break
|
||||||
|
|
||||||
def get_customize_info(self, urn):
|
def get_customize_info(self, urn):
|
||||||
keep_issues = 0
|
keep_issues = 0
|
||||||
add_title_tag = True
|
add_title_tag = True
|
||||||
|
@ -354,6 +354,9 @@ class RecipeModel(QAbstractItemModel, SearchQueryParser):
|
|||||||
def set_account_info(self, urn, un, pw):
|
def set_account_info(self, urn, un, pw):
|
||||||
self.scheduler_config.set_account_info(urn, un, pw)
|
self.scheduler_config.set_account_info(urn, un, pw)
|
||||||
|
|
||||||
|
def clear_account_info(self, urn):
|
||||||
|
self.scheduler_config.clear_account_info(urn)
|
||||||
|
|
||||||
def get_account_info(self, urn):
|
def get_account_info(self, urn):
|
||||||
return self.scheduler_config.get_account_info(urn)
|
return self.scheduler_config.get_account_info(urn)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user