From af9d22fa52897b64380fd172184f35365c722b3e Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 11 Mar 2011 11:27:33 -0500 Subject: [PATCH 1/5] Allow empty username and password for SMTP server --- src/calibre/gui2/wizard/send_email.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/wizard/send_email.py b/src/calibre/gui2/wizard/send_email.py index 5785f52276..9ac540e087 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,11 +205,19 @@ 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): + if host and ((username and not password) or (not username and password)): error_dialog(self, _('Bad configuration'), - _('You must set the username and password for ' - 'the mail server.')).exec_() + _('You must either set the username and password for ' + 'the mail server or no username and no password at all.')).exec_() return False + elif host and not (username and password) and self.relay_ssl.isChecked(): + error_dialog(self, _('Bad configuration'), + _('Please enter username and password for SSL encryption. ')).exec_() + return False + elif host and not (username and password) and not question_dialog(self, + _('Are you sure?'), + _('No username and password set for mailserver. Continue anyways?')): + return False conf = smtp_prefs() conf.set('from_', from_) conf.set('relay_host', host if host else None) From 6dcdd98ef4fa639c7395157a778f2d445d20661f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 12 Mar 2011 09:49:46 -0700 Subject: [PATCH 2/5] Allow icons to be loaded in the toolbar preferences for external plugins --- src/calibre/gui2/preferences/toolbar.py | 4 ++++ 1 file changed, 4 insertions(+) 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' From c82eebd09e9fd924c1b15992ee6d9bf1a13138d3 Mon Sep 17 00:00:00 2001 From: John Schember Date: Sat, 12 Mar 2011 11:59:32 -0500 Subject: [PATCH 3/5] Don't strip spaces when getting conversion option values in the GUI. --- src/calibre/gui2/convert/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/convert/__init__.py b/src/calibre/gui2/convert/__init__.py index 925fecd693..cddf0ecd7b 100644 --- a/src/calibre/gui2/convert/__init__.py +++ b/src/calibre/gui2/convert/__init__.py @@ -136,7 +136,7 @@ class Widget(QWidget): return g.value() elif isinstance(g, (QLineEdit, QTextEdit)): func = getattr(g, 'toPlainText', getattr(g, 'text', None))() - ans = unicode(func).strip() + ans = unicode(func) if not ans: ans = None return ans From 89bc79edddbcef381d39d28ebfae0bf91ac09250 Mon Sep 17 00:00:00 2001 From: John Schember Date: Sat, 12 Mar 2011 12:21:19 -0500 Subject: [PATCH 4/5] Only prevent stripping of white space in S&R widget. --- src/calibre/gui2/convert/__init__.py | 2 +- src/calibre/gui2/convert/search_and_replace.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/convert/__init__.py b/src/calibre/gui2/convert/__init__.py index cddf0ecd7b..925fecd693 100644 --- a/src/calibre/gui2/convert/__init__.py +++ b/src/calibre/gui2/convert/__init__.py @@ -136,7 +136,7 @@ class Widget(QWidget): return g.value() elif isinstance(g, (QLineEdit, QTextEdit)): func = getattr(g, 'toPlainText', getattr(g, 'text', None))() - ans = unicode(func) + ans = unicode(func).strip() if not ans: ans = None return ans 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) From b9d90b43fb0b2c7a72fc4a6980ce644c00ffaac8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 12 Mar 2011 10:32:20 -0700 Subject: [PATCH 5/5] ... --- resources/recipes/instapaper.recipe | 34 +++++------------------------ 1 file changed, 6 insertions(+), 28 deletions(-) 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) -