diff --git a/resources/recipes/instapaper.recipe b/resources/recipes/instapaper.recipe index 73c32d08a7..0eb5cf0f09 100644 --- a/resources/recipes/instapaper.recipe +++ b/resources/recipes/instapaper.recipe @@ -1,23 +1,12 @@ -__license__ = 'GPL v3' -__copyright__ = '2009-2010, Darko Miletic ' -''' -www.instapaper.com -''' - -import urllib from calibre import strftime from calibre.web.feeds.news import BasicNewsRecipe -class Instapaper(BasicNewsRecipe): - title = 'Instapaper.com' +class AdvancedUserRecipe1299694372(BasicNewsRecipe): + title = u'Instapaper' __author__ = 'Darko Miletic' - description = '''Personalized news feeds. Go to instapaper.com to - setup up your news. Fill in your instapaper - username, and leave the password field - below blank.''' publisher = 'Instapaper.com' - category = 'news, custom' - oldest_article = 7 + category = 'info, custom, Instapaper' + oldest_article = 365 max_articles_per_feed = 100 no_stylesheets = True use_embedded_content = False @@ -25,16 +14,9 @@ class Instapaper(BasicNewsRecipe): INDEX = u'http://www.instapaper.com' LOGIN = INDEX + u'/user/login' - conversion_options = { - 'comment' : description - , 'tags' : category - , 'publisher' : publisher - } - feeds = [ - (u'Unread articles' , INDEX + u'/u' ) - ,(u'Starred articles', INDEX + u'/starred') - ] + + feeds = [(u'Instapaper Unread', u'http://www.instapaper.com/u'), (u'Instapaper Starred', u'http://www.instapaper.com/starred')] def get_browser(self): br = BasicNewsRecipe.get_browser() @@ -70,7 +52,3 @@ class Instapaper(BasicNewsRecipe): }) totalfeeds.append((feedtitle, articles)) return totalfeeds - - def print_version(self, url): - return self.INDEX + '/text?u=' + urllib.quote(url) - diff --git a/src/calibre/gui2/convert/search_and_replace.py b/src/calibre/gui2/convert/search_and_replace.py index 88446344ec..c2241ff8eb 100644 --- a/src/calibre/gui2/convert/search_and_replace.py +++ b/src/calibre/gui2/convert/search_and_replace.py @@ -6,6 +6,8 @@ __docformat__ = 'restructuredtext en' import re +from PyQt4.Qt import QLineEdit, QTextEdit + from calibre.gui2.convert.search_and_replace_ui import Ui_Form from calibre.gui2.convert import Widget from calibre.gui2 import error_dialog @@ -72,3 +74,13 @@ class SearchAndReplaceWidget(Widget, Ui_Form): _('Invalid regular expression: %s')%err, show=True) return False return True + + def get_vaule(self, g): + if isinstance(g, (QLineEdit, QTextEdit)): + func = getattr(g, 'toPlainText', getattr(g, 'text', None))() + ans = unicode(func) + if not ans: + ans = None + return ans + else: + return Widget.get_value(self, g) diff --git a/src/calibre/gui2/preferences/toolbar.py b/src/calibre/gui2/preferences/toolbar.py index 26cdea19d3..a0d48f3910 100644 --- a/src/calibre/gui2/preferences/toolbar.py +++ b/src/calibre/gui2/preferences/toolbar.py @@ -55,6 +55,10 @@ class BaseModel(QAbstractListModel): text = _('Choose library') return QVariant(text) if role == Qt.DecorationRole: + if hasattr(self._data[row], 'qaction'): + icon = self._data[row].qaction.icon() + if not icon.isNull(): + return QVariant(icon) ic = action[1] if ic is None: ic = 'blank.png' diff --git a/src/calibre/gui2/wizard/send_email.py b/src/calibre/gui2/wizard/send_email.py index 5785f52276..44cd8dd2e4 100644 --- a/src/calibre/gui2/wizard/send_email.py +++ b/src/calibre/gui2/wizard/send_email.py @@ -92,7 +92,8 @@ class SendEmail(QWidget, Ui_Form): pa = self.preferred_to_address() to_set = pa is not None if self.set_email_settings(to_set): - if question_dialog(self, _('OK to proceed?'), + opts = smtp_prefs().parse() + if not opts.relay_password or question_dialog(self, _('OK to proceed?'), _('This will display your email password on the screen' '. Is it OK to proceed?'), show_copy_button=False): TestEmail(pa, self).exec_() @@ -204,19 +205,32 @@ class SendEmail(QWidget, Ui_Form): username = unicode(self.relay_username.text()).strip() password = unicode(self.relay_password.text()).strip() host = unicode(self.relay_host.text()).strip() - if host and not (username and password): - error_dialog(self, _('Bad configuration'), - _('You must set the username and password for ' - 'the mail server.')).exec_() - return False + enc_method = ('TLS' if self.relay_tls.isChecked() else 'SSL' + if self.relay_ssl.isChecked() else 'NONE') + if host: + # Validate input + if ((username and not password) or (not username and password)): + error_dialog(self, _('Bad configuration'), + _('You must either set both the username and password for ' + 'the mail server or no username and no password at all.')).exec_() + return False + if not username and not password and enc_method != 'NONE': + error_dialog(self, _('Bad configuration'), + _('Please enter a username and password or set' + ' encryption to None ')).exec_() + return False + if not (username and password) and not question_dialog(self, + _('Are you sure?'), + _('No username and password set for mailserver. Most ' + ' mailservers need a username and password. Are you sure?')): + return False conf = smtp_prefs() conf.set('from_', from_) conf.set('relay_host', host if host else None) conf.set('relay_port', self.relay_port.value()) conf.set('relay_username', username if username else None) conf.set('relay_password', hexlify(password)) - conf.set('encryption', 'TLS' if self.relay_tls.isChecked() else 'SSL' - if self.relay_ssl.isChecked() else 'NONE') + conf.set('encryption', enc_method) return True