Fix #9323 (selection lost when editing metadata on device)

This commit is contained in:
Kovid Goyal 2011-03-08 08:26:32 -07:00
commit ce0d32185f
4 changed files with 23 additions and 8 deletions

View File

@ -1160,6 +1160,14 @@ class DeviceMixin(object): # {{{
), bad)
d.exec_()
def upload_dirtied_booklists(self):
'''
Upload metadata to device.
'''
plugboards = self.library_view.model().db.prefs.get('plugboards', {})
self.device_manager.sync_booklists(Dispatcher(lambda x: x),
self.booklists(), plugboards)
def upload_booklists(self):
'''
Upload metadata to device.

View File

@ -396,7 +396,10 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog):
ident_types = sorted(self.db.get_all_identifier_types(), key=sort_key)
self.s_r_dst_ident.setCompleter(QCompleter(ident_types))
ident_types.insert(0, '')
try:
self.s_r_dst_ident.setPlaceholderText(_('Enter an identifier type'))
except:
pass
self.s_r_src_ident.addItems(ident_types)
self.main_heading = _(
@ -644,6 +647,10 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog):
dest = src
dest_mode = self.replace_mode.currentIndex()
if self.destination_field_fm['is_csp']:
if not unicode(self.s_r_dst_ident.text()):
raise Exception(_('You must specify a destination identifier type'))
if self.destination_field_fm['is_multiple']:
if self.comma_separated.isChecked():
if dest == 'authors':

View File

@ -735,7 +735,7 @@ Future conversion of these books will use the default settings.</string>
<item row="5" column="0">
<widget class="QLabel" name="s_r_src_ident_label">
<property name="text">
<string>Identifier:</string>
<string>Identifier type:</string>
</property>
<property name="buddy">
<cstring>s_r_src_ident</cstring>
@ -751,7 +751,7 @@ Future conversion of these books will use the default settings.</string>
</sizepolicy>
</property>
<property name="toolTip">
<string>Choose which identifier to operate upon</string>
<string>Choose which identifier type to operate upon</string>
</property>
</widget>
</item>
@ -936,7 +936,7 @@ not multiple and the destination field is multiple</string>
<item row="9" column="0">
<widget class="QLabel" name="s_r_dst_ident_label">
<property name="text">
<string>Identifier:</string>
<string>Identifier type:</string>
</property>
<property name="buddy">
<cstring>s_r_dst_ident</cstring>
@ -952,7 +952,7 @@ not multiple and the destination field is multiple</string>
</sizepolicy>
</property>
<property name="toolTip">
<string>Choose which identifier to operate upon</string>
<string>Choose which identifier type to operate upon</string>
</property>
</widget>
</item>

View File

@ -44,13 +44,13 @@ class LibraryViewMixin(object): # {{{
for view in (self.library_view, self.memory_view, self.card_a_view, self.card_b_view):
getattr(view, func)(*args)
self.memory_view.connect_dirtied_signal(self.upload_booklists)
self.memory_view.connect_dirtied_signal(self.upload_dirtied_booklists)
self.memory_view.connect_upload_collections_signal(
func=self.upload_collections, oncard=None)
self.card_a_view.connect_dirtied_signal(self.upload_booklists)
self.card_a_view.connect_dirtied_signal(self.upload_dirtied_booklists)
self.card_a_view.connect_upload_collections_signal(
func=self.upload_collections, oncard='carda')
self.card_b_view.connect_dirtied_signal(self.upload_booklists)
self.card_b_view.connect_dirtied_signal(self.upload_dirtied_booklists)
self.card_b_view.connect_upload_collections_signal(
func=self.upload_collections, oncard='cardb')
self.book_on_device(None, reset=True)