Implement #1306 (More options for file type in File Selector when adding files)

This commit is contained in:
Kovid Goyal 2008-11-25 10:40:16 -08:00
parent ac1947f147
commit cda1d00b13
2 changed files with 13 additions and 2 deletions

View File

@ -285,7 +285,7 @@ class FileDialog(QObject):
self.fd.setFileMode(mode) self.fd.setFileMode(mode)
self.fd.setIconProvider(_file_icon_provider) self.fd.setIconProvider(_file_icon_provider)
self.fd.setModal(modal) self.fd.setModal(modal)
self.fd.setFilter(ftext) self.fd.setNameFilter(ftext)
self.fd.setWindowTitle(title) self.fd.setWindowTitle(title)
state = dynamic[self.dialog_name] state = dynamic[self.dialog_name]
if not state or not self.fd.restoreState(state): if not state or not self.fd.restoreState(state):

View File

@ -522,7 +522,18 @@ class Main(MainWindow, Ui_MainWindow):
Add books from the local filesystem to either the library or the device. Add books from the local filesystem to either the library or the device.
''' '''
books = choose_files(self, 'add books dialog dir', 'Select books', books = choose_files(self, 'add books dialog dir', 'Select books',
filters=[('Books', BOOK_EXTENSIONS)]) filters=[
(_('Books'), BOOK_EXTENSIONS),
(_('EPUB Books'), ['epub']),
(_('LRF Books'), ['lrf']),
(_('HTML Books'), ['htm', 'html', 'xhtm', 'xhtml']),
(_('LIT Books'), ['lit']),
(_('MOBI Books'), ['mobi', 'prc']),
(_('Text books'), ['txt', 'rtf']),
(_('PDF Books'), ['pdf']),
(_('Comics'), ['cbz', 'cbr']),
(_('Archives'), ['zip', 'rar']),
])
if not books: if not books:
return return
to_device = self.stack.currentIndex() != 0 to_device = self.stack.currentIndex() != 0