Mercurial > hg > Feedworm
diff MainWindow.py @ 47:a8442c3487b5
add an option to Feed that allows loading an entry's link right away instead of displaying a feed's summary
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sun, 16 May 2010 08:13:07 +0200 |
parents | 0c0d1760b737 |
children | 6e5219e05625 |
line wrap: on
line diff
--- a/MainWindow.py Sun May 16 07:54:24 2010 +0200 +++ b/MainWindow.py Sun May 16 08:13:07 2010 +0200 @@ -39,10 +39,24 @@ def feedEntrySelected(self, index): self.ui.menuArticle.setEnabled(True) + row = index.row() self.selectedEntry = self.sortedEntries[row] - baseUrl = QUrl(self.selectedEntry.link) # TODO this is the wrong base url, figure out the correct one + + if self.selectedEntry.feed.auto_load_entry_link: + self.openLinkFromSelectedEntry() + else: + self.openSummaryFromSelectedEntry() + + def openSummaryFromSelectedEntry(self): + # TODO this is the wrong base url, figure out the correct one + baseUrl = QUrl(self.selectedEntry.link) self.ui.webView.setHtml(self.selectedEntry.summary, baseUrl) + + def openLinkFromSelectedEntry(self): + url = QUrl(self.selectedEntry.link) + self.ui.webView.load(url) + self.ui.webView.show() def toggleReadOnSelectedEntry(self): self.selectedEntry.toggleRead() @@ -62,12 +76,7 @@ # TODO make browser configurable browser = "/usr/local/bin/opera" subprocess.Popen([browser, self.selectedEntry.link]) - - def openLinkFromSelectedEntry(self): - url = QUrl(self.selectedEntry.link) - self.ui.webView.load(url) - self.ui.webView.show() - + def showPreferences(self): preferences = PreferencesDialog(self.session) preferences.exec_()