mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Fix #1924878 ["Undo" in Review Downloaded Metadata doesn't work after overwriting](https://bugs.launchpad.net/calibre/+bug/1924878)
This commit is contained in:
parent
5f927e2ea0
commit
ce0898ca53
@ -93,6 +93,11 @@ class LineEdit(EditWithComplete):
|
|||||||
self.setText(val)
|
self.setText(val)
|
||||||
self.setCursorPosition(0)
|
self.setCursorPosition(0)
|
||||||
|
|
||||||
|
def set_undoable(self, val):
|
||||||
|
self.selectAll()
|
||||||
|
self.insert(val)
|
||||||
|
self.setCursorPosition(0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_blank(self):
|
def is_blank(self):
|
||||||
val = self.current_val.strip()
|
val = self.current_val.strip()
|
||||||
@ -138,6 +143,9 @@ class LanguagesEdit(LE):
|
|||||||
def same_as(self, other):
|
def same_as(self, other):
|
||||||
return self.current_val == other.current_val
|
return self.current_val == other.current_val
|
||||||
|
|
||||||
|
def set_undoable(self, val):
|
||||||
|
self.set_lang_codes(val, True)
|
||||||
|
|
||||||
|
|
||||||
class RatingsEdit(RatingEdit):
|
class RatingsEdit(RatingEdit):
|
||||||
|
|
||||||
@ -191,6 +199,9 @@ class DateEdit(PubdateEdit):
|
|||||||
def same_as(self, other):
|
def same_as(self, other):
|
||||||
return self.text() == other.text()
|
return self.text() == other.text()
|
||||||
|
|
||||||
|
def set_undoable(self, val):
|
||||||
|
self.set_value(val)
|
||||||
|
|
||||||
|
|
||||||
class SeriesEdit(LineEdit):
|
class SeriesEdit(LineEdit):
|
||||||
|
|
||||||
@ -274,6 +285,10 @@ class CommentsEdit(Editor):
|
|||||||
self.html = val or ''
|
self.html = val or ''
|
||||||
self.changed.emit()
|
self.changed.emit()
|
||||||
|
|
||||||
|
def set_undoable(self, val):
|
||||||
|
self.set_html(val, allow_undo=True)
|
||||||
|
self.changed.emit()
|
||||||
|
|
||||||
def from_mi(self, mi):
|
def from_mi(self, mi):
|
||||||
val = mi.get(self.field, default='')
|
val = mi.get(self.field, default='')
|
||||||
self.current_val = val
|
self.current_val = val
|
||||||
@ -486,7 +501,10 @@ class CompareSingle(QWidget):
|
|||||||
def revert(self, field):
|
def revert(self, field):
|
||||||
widgets = self.widgets[field]
|
widgets = self.widgets[field]
|
||||||
neww, oldw = widgets[:2]
|
neww, oldw = widgets[:2]
|
||||||
neww.current_val = oldw.current_val
|
if hasattr(neww, 'set_undoable'):
|
||||||
|
neww.set_undoable(oldw.current_val)
|
||||||
|
else:
|
||||||
|
neww.current_val = oldw.current_val
|
||||||
|
|
||||||
def merge_identifiers(self):
|
def merge_identifiers(self):
|
||||||
widgets = self.widgets['identifiers']
|
widgets = self.widgets['identifiers']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user