comparison MainWindow.py @ 155:a05719a6175e

move common functionality into an abstract backend class, have both backends inherit from it. Implement enough of the couchdb backend that reading feeds (and marking feed entries as read) is possible
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sat, 27 Aug 2011 08:52:03 +0200
parents 65c4bb6d5add
children c345a26febc2
comparison
equal deleted inserted replaced
154:2682db280be0 155:a05719a6175e
72 def feedEntrySelected(self, index): 72 def feedEntrySelected(self, index):
73 self.ui.menuArticle.setEnabled(True) 73 self.ui.menuArticle.setEnabled(True)
74 self.ui.actionOpenLink.setEnabled(True) 74 self.ui.actionOpenLink.setEnabled(True)
75 75
76 row = index.row() 76 row = index.row()
77 feedEntry = self.backend.selectFeedEntry(row) 77 self.backend.selectFeedEntry(row)
78 78
79 # TODO this is not compatible with the couchdb backend 79 if self.backend.selectedFeed.auto_load_entry_link:
80 if feedEntry.feed.auto_load_entry_link:
81 self.openLinkFromSelectedEntry() 80 self.openLinkFromSelectedEntry()
82 else: 81 else:
83 self.openSummaryFromSelectedEntry() 82 self.openSummaryFromSelectedEntry()
84 83
85 def feedEntryDoubleClicked(self, index): 84 def feedEntryDoubleClicked(self, index):
91 feedEntry = self.backend.selectedFeedEntry 90 feedEntry = self.backend.selectedFeedEntry
92 baseUrl = QUrl(feedEntry.link) 91 baseUrl = QUrl(feedEntry.link)
93 self.ui.webView.setHtml(feedEntry.summary, baseUrl) 92 self.ui.webView.setHtml(feedEntry.summary, baseUrl)
94 93
95 def openLinkFromSelectedEntry(self): 94 def openLinkFromSelectedEntry(self):
96 feedEntry = self.backend.selectedFeedEntry 95 if self.backend.selectedFeed.always_open_in_browser:
97 # TODO this is not compatible with the couchdb backend
98 if feedEntry.feed.always_open_in_browser:
99 self.openSelectedEntryInBrowser() 96 self.openSelectedEntryInBrowser()
100 else: 97 else:
101 self.openSelectedEntryInWebView() 98 self.openSelectedEntryInWebView()
102 99
103 def openSelectedEntryInWebView(self): 100 def openSelectedEntryInWebView(self):