# HG changeset patch # User Dirk Olmes # Date 1273990387 -7200 # Node ID a8442c3487b56901eb36c573af3206122ecc6171 # Parent 03358c1131703e9bb0ac13b2b83a0770df822f6f add an option to Feed that allows loading an entry's link right away instead of displaying a feed's summary diff -r 03358c113170 -r a8442c3487b5 Feed.py --- a/Feed.py Sun May 16 07:54:24 2010 +0200 +++ b/Feed.py Sun May 16 08:13:07 2010 +0200 @@ -13,6 +13,7 @@ # default: update every 60 minutes self.update_interval = 60 self.incrementNextUpdateDate() + self.auto_load_entry_link = False def __repr__(self): return "" % (self.pk, self.title) diff -r 03358c113170 -r a8442c3487b5 MainWindow.py --- 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_() diff -r 03358c113170 -r a8442c3487b5 Mapping.py --- a/Mapping.py Sun May 16 07:54:24 2010 +0200 +++ b/Mapping.py Sun May 16 08:13:07 2010 +0200 @@ -2,6 +2,7 @@ from Feed import Feed from FeedEntry import FeedEntry from Preference import Preference +from sqlalchemy import Boolean from sqlalchemy import Column from sqlalchemy import DateTime from sqlalchemy import ForeignKey @@ -31,7 +32,10 @@ Column("title", String(255), nullable=False), Column("rss_url", String(255), nullable=False), Column("update_interval", Integer, nullable=False), - Column("next_update", DateTime, nullable=False) + 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) ) feedEntryTable = Table("feed_entry", metadata,