This commit is contained in:
Kovid Goyal 2011-04-21 19:09:43 -06:00
commit 23e63bd895
3 changed files with 43 additions and 32 deletions

View File

@ -24,11 +24,16 @@ class Dialog(QDialog, Ui_Dialog):
dynamic[confirm_config_name(self.name)] = self.again.isChecked()
def confirm(msg, name, parent=None, pixmap='dialog_warning.png'):
def confirm(msg, name, parent=None, pixmap='dialog_warning.png', title=None,
show_cancel_button=True):
if not dynamic.get(confirm_config_name(name), True):
return True
d = Dialog(msg, name, parent)
d.label.setPixmap(QPixmap(I(pixmap)))
d.setWindowIcon(QIcon(I(pixmap)))
if title is not None:
d.setWindowTitle(title)
if not show_cancel_button:
d.buttonBox.button(d.buttonBox.Cancel).setVisible(False)
d.resize(d.sizeHint())
return d.exec_() == d.Accepted

View File

@ -97,12 +97,12 @@ class MobileReadStore(BasicStoreConfig, StorePlugin):
if not raw_data:
return
# Turn books listed in the HTML file into BookRef's.
# Turn books listed in the HTML file into SearchResults's.
books = []
try:
data = html.fromstring(raw_data)
for book_data in data.xpath('//ul/li'):
book = BookRef()
book = SearchResult()
book.detail_item = ''.join(book_data.xpath('.//a/@href'))
book.formats = ''.join(book_data.xpath('.//i/text()'))
book.formats = book.formats.strip()
@ -126,12 +126,6 @@ class MobileReadStore(BasicStoreConfig, StorePlugin):
return self.config.get(self.name + '_book_list', [])
class BookRef(SearchResult):
def __init__(self):
SearchResult.__init__(self)
class MobeReadStoreDialog(QDialog, Ui_Dialog):
def __init__(self, plugin, *args):

View File

@ -68,6 +68,18 @@ class NPWebView(QWebView):
filename = get_download_filename(url, cf)
ext = os.path.splitext(filename)[1][1:].lower()
if ext not in BOOK_EXTENSIONS:
if ext == 'acsm':
from calibre.gui2.dialogs.confirm_delete import confirm
confirm('<p>' + _('This ebook is a DRMed EPUB file. '
'You will be prompted to save this file to your '
'computer. Once it is saved, open it with '
'<a href="http://www.adobe.com/products/digitaleditions/">'
'Adobe Digital Editions</a> (ADE).<p>ADE, in turn '
'will download the actual ebook, which will be a '
'.epub file. You can add this book to calibre '
'using "Add Books" and selecting the file from '
'the ADE library folder.'),
'acsm_download', self)
home = os.path.expanduser('~')
name = QFileDialog.getSaveFileName(self,
_('File is not a supported ebook type. Save to disk?'),