comparison MainWindow.py @ 77:d292ab61ed6f

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.
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sat, 14 Aug 2010 02:53:49 +0200
parents a8a4cf131a02
children 2dd6e6894772
comparison
equal deleted inserted replaced
76:f909550683b0 77:d292ab61ed6f
70 # TODO this is the wrong base url, figure out the correct one 70 # TODO this is the wrong base url, figure out the correct one
71 baseUrl = QUrl(self.selectedEntry.link) 71 baseUrl = QUrl(self.selectedEntry.link)
72 self.ui.webView.setHtml(self.selectedEntry.summary, baseUrl) 72 self.ui.webView.setHtml(self.selectedEntry.summary, baseUrl)
73 73
74 def openLinkFromSelectedEntry(self): 74 def openLinkFromSelectedEntry(self):
75 if self.selectedEntry.feed.always_open_in_browser:
76 self.openSelectedEntryInBrowser()
77 else:
78 self.openSelectedEntryInWebView()
79
80 def openSelectedEntryInWebView(self):
75 url = QUrl(self.selectedEntry.link) 81 url = QUrl(self.selectedEntry.link)
76 self.ui.webView.load(url) 82 self.ui.webView.load(url)
77 self.ui.webView.show() 83 self.ui.webView.show()
78 84
85 def openSelectedEntryInBrowser(self):
86 # TODO make browser configurable
87 browser = "/usr/local/bin/opera"
88 subprocess.Popen([browser, self.selectedEntry.link])
89
79 def toggleReadOnSelectedEntry(self): 90 def toggleReadOnSelectedEntry(self):
80 self.selectedEntry.toggleRead() 91 self.selectedEntry.toggleRead()
81 self.session.commit() 92 self.session.commit()
82 self.ui.feedEntryList.doItemsLayout() 93 self.ui.feedEntryList.doItemsLayout()
83 94
96 message = "Error while adding feed: " + str(addFeed.exception) 107 message = "Error while adding feed: " + str(addFeed.exception)
97 self.ui.statusbar.showMessage(message, STATUS_MESSAGE_DISPLAY_MILLIS) 108 self.ui.statusbar.showMessage(message, STATUS_MESSAGE_DISPLAY_MILLIS)
98 else: 109 else:
99 self.session.commit() 110 self.session.commit()
100 self.updateFeedList() 111 self.updateFeedList()
101
102 def openSelectedEntryInBrowser(self):
103 # TODO make browser configurable
104 browser = "/usr/local/bin/opera"
105 subprocess.Popen([browser, self.selectedEntry.link])
106 112
107 def showPreferences(self): 113 def showPreferences(self):
108 preferences = PreferencesDialog(self.session) 114 preferences = PreferencesDialog(self.session)
109 preferences.exec_() 115 preferences.exec_()
110 116