comparison 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
comparison
equal deleted inserted replaced
46:03358c113170 47:a8442c3487b5
37 self.ui.feedEntryList.itemDelegate().entries = self.sortedEntries 37 self.ui.feedEntryList.itemDelegate().entries = self.sortedEntries
38 self.ui.feedEntryList.update() 38 self.ui.feedEntryList.update()
39 39
40 def feedEntrySelected(self, index): 40 def feedEntrySelected(self, index):
41 self.ui.menuArticle.setEnabled(True) 41 self.ui.menuArticle.setEnabled(True)
42
42 row = index.row() 43 row = index.row()
43 self.selectedEntry = self.sortedEntries[row] 44 self.selectedEntry = self.sortedEntries[row]
44 baseUrl = QUrl(self.selectedEntry.link) # TODO this is the wrong base url, figure out the correct one 45
46 if self.selectedEntry.feed.auto_load_entry_link:
47 self.openLinkFromSelectedEntry()
48 else:
49 self.openSummaryFromSelectedEntry()
50
51 def openSummaryFromSelectedEntry(self):
52 # TODO this is the wrong base url, figure out the correct one
53 baseUrl = QUrl(self.selectedEntry.link)
45 self.ui.webView.setHtml(self.selectedEntry.summary, baseUrl) 54 self.ui.webView.setHtml(self.selectedEntry.summary, baseUrl)
55
56 def openLinkFromSelectedEntry(self):
57 url = QUrl(self.selectedEntry.link)
58 self.ui.webView.load(url)
59 self.ui.webView.show()
46 60
47 def toggleReadOnSelectedEntry(self): 61 def toggleReadOnSelectedEntry(self):
48 self.selectedEntry.toggleRead() 62 self.selectedEntry.toggleRead()
49 self.session.commit() 63 self.session.commit()
50 self.ui.feedList.update() 64 self.ui.feedList.update()
60 74
61 def openSelectedEntryInBrowser(self): 75 def openSelectedEntryInBrowser(self):
62 # TODO make browser configurable 76 # TODO make browser configurable
63 browser = "/usr/local/bin/opera" 77 browser = "/usr/local/bin/opera"
64 subprocess.Popen([browser, self.selectedEntry.link]) 78 subprocess.Popen([browser, self.selectedEntry.link])
65 79
66 def openLinkFromSelectedEntry(self):
67 url = QUrl(self.selectedEntry.link)
68 self.ui.webView.load(url)
69 self.ui.webView.show()
70
71 def showPreferences(self): 80 def showPreferences(self):
72 preferences = PreferencesDialog(self.session) 81 preferences = PreferencesDialog(self.session)
73 preferences.exec_() 82 preferences.exec_()
74 83
75 84