diff --git a/src/calibre/devices/android/driver.py b/src/calibre/devices/android/driver.py index 73de6e1200..44d9bc1e49 100644 --- a/src/calibre/devices/android/driver.py +++ b/src/calibre/devices/android/driver.py @@ -55,7 +55,7 @@ class ANDROID(USBMS): }, # Viewsonic - 0x0489 : { 0xc001 : [0x0226] }, + 0x0489 : { 0xc001 : [0x0226], 0xc004 : [0x0226], }, # Acer 0x502 : { 0x3203 : [0x0100]}, diff --git a/src/calibre/gui2/dialogs/saved_search_editor.ui b/src/calibre/gui2/dialogs/saved_search_editor.ui index 99672b5b8e..af6d6f4d55 100644 --- a/src/calibre/gui2/dialogs/saved_search_editor.ui +++ b/src/calibre/gui2/dialogs/saved_search_editor.ui @@ -90,7 +90,7 @@ - :/images/minus.png:/images/minus.png + :/images/trash.png:/images/trash.png diff --git a/src/calibre/gui2/dialogs/tag_categories.ui b/src/calibre/gui2/dialogs/tag_categories.ui index 0b17ccac05..e6fedf9bde 100644 --- a/src/calibre/gui2/dialogs/tag_categories.ui +++ b/src/calibre/gui2/dialogs/tag_categories.ui @@ -79,7 +79,7 @@ - :/images/minus.png:/images/minus.png + :/images/trash.png:/images/trash.png diff --git a/src/calibre/gui2/layout.py b/src/calibre/gui2/layout.py index 390c266019..246fa168a0 100644 --- a/src/calibre/gui2/layout.py +++ b/src/calibre/gui2/layout.py @@ -225,13 +225,6 @@ class SearchBar(QWidget): # {{{ l.addWidget(x) x.setToolTip(_("Save current search under the name shown in the box")) - x = parent.delete_search_button = QToolButton(self) - x.setIcon(QIcon(I("search_delete_saved.png"))) - x.setObjectName("delete_search_button") - l.addWidget(x) - x.setToolTip(_("Delete current saved search")) - - # }}} class Spacer(QWidget): # {{{ diff --git a/src/calibre/gui2/preferences/columns.ui b/src/calibre/gui2/preferences/columns.ui index a9d82530ec..423d5dd106 100644 --- a/src/calibre/gui2/preferences/columns.ui +++ b/src/calibre/gui2/preferences/columns.ui @@ -79,7 +79,7 @@ - :/images/minus.png:/images/minus.png + :/images/trash.png:/images/trash.png diff --git a/src/calibre/gui2/search_box.py b/src/calibre/gui2/search_box.py index 359cb0b2f6..f5b3649e27 100644 --- a/src/calibre/gui2/search_box.py +++ b/src/calibre/gui2/search_box.py @@ -13,7 +13,6 @@ from PyQt4.Qt import QComboBox, Qt, QLineEdit, QStringList, pyqtSlot, QDialog, \ QString, QIcon from calibre.gui2 import config -from calibre.gui2.dialogs.confirm_delete import confirm from calibre.gui2.dialogs.saved_search_editor import SavedSearchEditor from calibre.gui2.dialogs.search import SearchDialog from calibre.utils.search_query_parser import saved_searches @@ -316,23 +315,6 @@ class SavedSearchBox(QComboBox): # {{{ self.addItems(qnames) self.setCurrentIndex(-1) - # SIGNALed from the main UI - def delete_search_button_clicked(self): - if not confirm('

'+_('The selected search will be ' - 'permanently deleted. Are you sure?') - +'

', 'saved_search_delete', self): - return - idx = self.currentIndex - if idx < 0: - return - ss = saved_searches().lookup(unicode(self.currentText())) - if ss is None: - return - saved_searches().delete(unicode(self.currentText())) - self.clear() - self.search_box.clear() - self.changed.emit() - # SIGNALed from the main UI def save_search_button_clicked(self): name = unicode(self.currentText()) @@ -438,8 +420,6 @@ class SavedSearchBoxMixin(object): # {{{ self.clear_button.clicked.connect(self.saved_search.clear) self.save_search_button.clicked.connect( self.saved_search.save_search_button_clicked) - self.delete_search_button.clicked.connect( - self.saved_search.delete_search_button_clicked) self.copy_search_button.clicked.connect( self.saved_search.copy_search_button_clicked) self.saved_searches_changed() @@ -448,7 +428,7 @@ class SavedSearchBoxMixin(object): # {{{ self.saved_search.setToolTip( _('Choose saved search or enter name for new saved search')) self.saved_search.setStatusTip(self.saved_search.toolTip()) - for x in ('copy', 'save', 'delete'): + for x in ('copy', 'save'): b = getattr(self, x+'_search_button') b.setStatusTip(b.toolTip()) diff --git a/src/calibre/gui2/tag_view.py b/src/calibre/gui2/tag_view.py index 6ad6f053cb..f3d5cf3c85 100644 --- a/src/calibre/gui2/tag_view.py +++ b/src/calibre/gui2/tag_view.py @@ -12,11 +12,11 @@ import traceback, copy, cPickle from itertools import izip, repeat from functools import partial -from PyQt4.Qt import Qt, QTreeView, QApplication, pyqtSignal, QFont, QSize, \ - QIcon, QPoint, QVBoxLayout, QHBoxLayout, QComboBox, QTimer,\ - QAbstractItemModel, QVariant, QModelIndex, QMenu, QFrame,\ - QPushButton, QWidget, QItemDelegate, QString, QLabel, \ - QShortcut, QKeySequence, SIGNAL, QMimeData, QToolButton +from PyQt4.Qt import (Qt, QTreeView, QApplication, pyqtSignal, QFont, QSize, + QIcon, QPoint, QVBoxLayout, QHBoxLayout, QComboBox, QTimer, + QAbstractItemModel, QVariant, QModelIndex, QMenu, QFrame, + QWidget, QItemDelegate, QString, QLabel, QAction, + QShortcut, QKeySequence, SIGNAL, QMimeData, QToolButton) from calibre.ebooks.metadata import title_sort from calibre.gui2 import config, NONE, gprefs @@ -1809,6 +1809,9 @@ class TagsModel(QAbstractItemModel): # {{{ # }}} +category_managers = ( + ) + class TagBrowserMixin(object): # {{{ def __init__(self, db): @@ -1829,8 +1832,23 @@ class TagBrowserMixin(object): # {{{ self.tags_view.drag_drop_finished.connect(self.drag_drop_finished) self.tags_view.restriction_error.connect(self.do_restriction_error, type=Qt.QueuedConnection) - self.edit_categories.clicked.connect(lambda x: - self.do_edit_user_categories()) + + for text, func, args in ( + (_('Manage Authors'), self.do_author_sort_edit, (self, + None)), + (_('Manage Series'), self.do_tags_list_edit, (None, + 'series')), + (_('Manage Publishers'), self.do_tags_list_edit, (None, + 'publisher')), + (_('Manage Tags'), self.do_tags_list_edit, (None, 'tags')), + (_('Manage User Categories'), + self.do_edit_user_categories, (None,)), + (_('Manage Saved Searches'), self.do_saved_search_edit, + (None,)) + ): + ac = QAction(text, self) + ac.triggered.connect(partial(func, *args)) + self.manage_items_button.menu().addAction(ac) def do_restriction_error(self): error_dialog(self.tags_view, _('Invalid search restriction'), @@ -2149,11 +2167,17 @@ class TagBrowserWidget(QWidget): # {{{ 'match any or all of them')) parent.tag_match.setStatusTip(parent.tag_match.toolTip()) - parent.edit_categories = QPushButton(_('Manage &user categories'), parent) - self._layout.addWidget(parent.edit_categories) - parent.edit_categories.setToolTip( - _('Add your own categories to the Tag Browser')) - parent.edit_categories.setStatusTip(parent.edit_categories.toolTip()) + + l = parent.manage_items_button = QToolButton(self) + l.setIcon(QIcon(I('tags.png'))) + l.setText(_('Manage authors, tags, etc')) + l.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) + l.setPopupMode(l.InstantPopup) + l.setToolTip(_('All of these category_managers are available by right-clicking ' + 'on items in the tag browser above')) + l.m = QMenu() + l.setMenu(l.m) + self._layout.addWidget(l) # self.leak_test_timer = QTimer(self) # self.leak_test_timer.timeout.connect(self.test_for_leak)