# HG changeset patch # User Dirk Olmes # Date 1281747229 -7200 # Node ID d292ab61ed6ff703caeac5955c09393400c3f124 # Parent f909550683b07f8df05fca41d4dfc653532c2623 Add another setting to feed: when opening a feed entry in browser, you can force opening it in an external browser now. This is because some sites just crash the QWebView. diff -r f909550683b0 -r d292ab61ed6f Feed.py --- a/Feed.py Wed Aug 11 03:59:33 2010 +0200 +++ b/Feed.py Sat Aug 14 02:53:49 2010 +0200 @@ -14,6 +14,7 @@ self.update_interval = 60 self.incrementNextUpdateDate() self.auto_load_entry_link = False + self.always_open_in_browser = False def __repr__(self): return "" % (self.pk, self.title) diff -r f909550683b0 -r d292ab61ed6f FeedSettings.py --- a/FeedSettings.py Wed Aug 11 03:59:33 2010 +0200 +++ b/FeedSettings.py Sat Aug 14 02:53:49 2010 +0200 @@ -14,6 +14,11 @@ def initUi(self): self.ui.feedTitle.setText(self.feed.title) self.ui.autoLoadArticle.setChecked(self.feed.auto_load_entry_link) + self.ui.alwaysOpenInBrowser.setChecked(self.feed.always_open_in_browser) + + def editingTitleFinished(self): + title = str(self.ui.feedTitle.text()) + self.feed.title = title def autoLoadArticleChanged(self, change): if change: @@ -21,6 +26,12 @@ else: self.feed.auto_load_entry_link = False + def alwaysOpenInExternalBrowser(self, change): + if change: + self.feed.always_open_in_browser = True + else: + self.feed.always_open_in_browser = False + def accept(self): self.session.commit() QtGui.QDialog.accept(self) @@ -28,7 +39,3 @@ def reject(self): self.session.rollback() QtGui.QDialog.reject(self) - - def editingTitleFinished(self): - title = str(self.ui.feedTitle.text()) - self.feed.title = title diff -r f909550683b0 -r d292ab61ed6f MainWindow.py --- a/MainWindow.py Wed Aug 11 03:59:33 2010 +0200 +++ b/MainWindow.py Sat Aug 14 02:53:49 2010 +0200 @@ -72,10 +72,21 @@ self.ui.webView.setHtml(self.selectedEntry.summary, baseUrl) def openLinkFromSelectedEntry(self): + if self.selectedEntry.feed.always_open_in_browser: + self.openSelectedEntryInBrowser() + else: + self.openSelectedEntryInWebView() + + def openSelectedEntryInWebView(self): url = QUrl(self.selectedEntry.link) self.ui.webView.load(url) self.ui.webView.show() - + + def openSelectedEntryInBrowser(self): + # TODO make browser configurable + browser = "/usr/local/bin/opera" + subprocess.Popen([browser, self.selectedEntry.link]) + def toggleReadOnSelectedEntry(self): self.selectedEntry.toggleRead() self.session.commit() @@ -98,11 +109,6 @@ else: self.session.commit() self.updateFeedList() - - def openSelectedEntryInBrowser(self): - # TODO make browser configurable - browser = "/usr/local/bin/opera" - subprocess.Popen([browser, self.selectedEntry.link]) def showPreferences(self): preferences = PreferencesDialog(self.session) diff -r f909550683b0 -r d292ab61ed6f Mapping.py --- a/Mapping.py Wed Aug 11 03:59:33 2010 +0200 +++ b/Mapping.py Sat Aug 14 02:53:49 2010 +0200 @@ -37,7 +37,10 @@ Column("next_update", DateTime, nullable=False), # when displaying an entry of this feed, do not display the summary but rather load # the link directly - Column("auto_load_entry_link", Boolean, nullable=False) + Column("auto_load_entry_link", Boolean, nullable=False), + # this is actually a hack: when opening some sites in the QWebView it just crashes. + # This setting forces to open an entry's link in the external browser + Column("always_open_in_browser", Boolean, nullable=False) ) global feedEntryTable diff -r f909550683b0 -r d292ab61ed6f Ui_FeedSettings.ui --- a/Ui_FeedSettings.ui Wed Aug 11 03:59:33 2010 +0200 +++ b/Ui_FeedSettings.ui Sat Aug 14 02:53:49 2010 +0200 @@ -7,7 +7,7 @@ 0 0 400 - 126 + 140 @@ -21,7 +21,7 @@ 20 - 80 + 100 341 32 @@ -69,6 +69,19 @@ Title + + + + 10 + 70 + 371 + 22 + + + + when loading article's url, always use external browser + + @@ -138,9 +151,26 @@ + + alwaysOpenInBrowser + stateChanged(int) + FeedSettings + alwaysOpenInExternalBrowser() + + + 195 + 80 + + + 199 + 69 + + + autoLoadArticleChanged() editingTitleFinished() + alwaysOpenInExternalBrowser()