This file is indexed.

/usr/lib/python2.7/dist-packages/penguintv/AddFeedDialog.py is in penguintv 4.2.0-0ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# Written by Owen Williams
# see LICENSE for license information

import gtk
#import urllib , urlparse loaded as needed
import socket
import gettext
import os.path
import traceback
import sys
import logging

#loaded as needed
#import feedparser
import HTMLParser 

import utils
import AddFeedUtils
from ptvDB import FF_NOAUTODOWNLOAD, FF_NOSEARCH, FF_NOAUTOEXPIRE, \
                  FF_NOTIFYUPDATES, FF_ADDNEWLINES, FF_MARKASREAD, \
                  FF_NOKEEPDELETED
import LoginDialog
if utils.HAS_PYXML:
	import itunes

_=gettext.gettext

class AddFeedDialog:
	def __init__(self,xml,app):
		self._xml = xml
		self._app = app
		
		self._window = xml.get_widget("window_add_feed")
		if not utils.RUNNING_SUGAR and not utils.RUNNING_HILDON:
			self._window.set_transient_for(self._app.main_window.get_parent())
		for key in dir(self.__class__):
			if key[:3] == 'on_':
				self._xml.signal_connect(key, getattr(self,key))
		
		if not utils.RUNNING_SUGAR:
			self._edit_tags_widget = self._xml.get_widget("edit_tags_widget")
			self._feed_url_widget = self._xml.get_widget("feed_url")
		else:
			combo = self._xml.get_widget("feed_combo")
			self._feed_url_widget = combo.child
			combo.connect('changed', self.on_sugar_combo_changed)
			self._edit_tags_widget = None
		
	def extract_content(self):
		box = self._xml.get_widget('add_feed_box')
		box.unparent()
		box.show_all()
			
		self._window = None
		return box
				
	def show(self, autolocation=True):
		if utils.RUNNING_HILDON:
			self._window.resize(650,300)
			self._window.show_all()
			
		self._feed_url_widget.grab_focus()
		if self._window:
			self._window.show()
		self._feed_url_widget.set_text("")
		if autolocation:
			self.set_location_automatically()
		
		self._edit_tags_widget.set_text("")
		#if not utils.USE_TAGGING:
		#	l = self._xml.get_widget("add_feed_label")
		#	l.set_text(_("Please enter the URL of the feed you would like to add:"))
		#	self._xml.get_widget("tag_hbox").hide()
			
		if not utils.HAS_SEARCH:
			self._xml.get_widget('b_search').hide()
		if utils.RUNNING_SUGAR or not utils.HAS_STATUS_ICON:
			self._xml.get_widget('b_notifyupdates').hide()
	
	#ripped from straw
	def set_location_automatically(self):
		def _clipboard_cb(cboard, text, data=None):
			if text:
				if text.upper().startswith("FEED:") or \
				   text.upper().startswith("HTTP"):
					self._feed_url_widget.set_text(text)
					        	
		clipboard = gtk.clipboard_get(selection="CLIPBOARD")
		clipboard.request_text(_clipboard_cb, None)
	
	def set_location(self, url=""):
		self._feed_url_widget.set_text(url)
		
	#(olpc) Sugar-only
	def set_existing_feeds(self, existing_list):
		assert utils.RUNNING_SUGAR
		
		model = gtk.ListStore(int, str, str) #id, title, url
		
		combo = self._xml.get_widget("feed_combo")
		old_model = combo.get_model()
		
		for feed_id, title, url in existing_list:
			model.append([feed_id, title, url])
			
		combo.set_model(model)
		combo.set_text_column(1)
		
		del old_model
		
		
	def on_window_add_feed_delete_event(self, widget, event):
		if self._window:
			return self._window.hide_on_delete()
		
	def hide(self):
		self._feed_url_widget.set_text("")
		if self._window:
			self._window.hide()
		
	def finish(self):
		flags = 0
		if not utils.RUNNING_SUGAR:
			#reversed
			if not self._xml.get_widget('b_download').get_active():
				flags += FF_NOAUTODOWNLOAD
			#reversed
			if not self._xml.get_widget('b_search').get_active():
				flags += FF_NOSEARCH
			if self._xml.get_widget('b_notifyupdates').get_active():
				flags += FF_NOTIFYUPDATES
			if self._xml.get_widget('b_noautoexpire').get_active():
				flags += FF_NOAUTOEXPIRE
			if self._xml.get_widget('b_addnewlines').get_active():
				flags += FF_ADDNEWLINES
			if self._xml.get_widget('b_markasread').get_active():
				flags += FF_MARKASREAD
			if self._xml.get_widget('b_nokeepdeleted').get_active():
				flags += FF_NOKEEPDELETED
	
		tags=[]
		if len(self._edit_tags_widget.get_text()) > 0:
			for tag in self._edit_tags_widget.get_text().split(','):
				tags.append(tag.strip())
		url = self._feed_url_widget.get_text()
		if self._window:
			self._window.set_sensitive(False)
		while gtk.events_pending(): #make sure the sensitivity change goes through
			gtk.main_iteration()
		try:
			logging.debug("getting corrected url:")
			url,title = AddFeedUtils.correct_url(url, utils.get_glade_prefix())
			logging.debug("got: %s %s" % (url, title))
			if url is None:
				if self._window:
					self._window.set_sensitive(True)
				return
			feed_id = self._app.add_feed(url, title, tags)
			self._app.db.set_flags_for_feed(feed_id, flags)
		except AddFeedUtils.AuthorizationFailed:
			dialog = gtk.Dialog(title=_("Authorization Required"), parent=None, flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
			label = gtk.Label(_("You must specify a valid username and password in order to add this feed."))
			dialog.vbox.pack_start(label, True, True, 0)
			label.show()
			response = dialog.run()
			dialog.hide()
			del dialog
			if self._window:
				self._window.set_sensitive(True)
			return
		except AddFeedUtils.AuthorizationCancelled:
			if self._window:
				self._window.set_sensitive(True)
			return
		except AddFeedUtils.BadFeedURL, e:
			logging.error(str(e))
			dialog = gtk.Dialog(title=_("No Feed in Page"), parent=None, flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
			label = gtk.Label(_("PenguinTV couldn't find a feed in the web page you provided.\nYou will need to find the RSS feed link in the web page yourself.  Sorry."))
			dialog.vbox.pack_start(label, True, True, 0)
			label.show()
			response = dialog.run()
			dialog.hide()
			del dialog
			if self._window:
				self._window.set_sensitive(True)
			return
		#except:
		#	self._window.set_sensitive(True)
		#	return 

		if self._window:
			self._window.set_sensitive(True)
		if feed_id == -1:
			return #don't hide, give them a chance to try again.
		
		self.hide()
		
	def on_help_button_clicked(self, event):
 		dialog = gtk.Dialog(title=_("Add Feed Help"), parent=None, flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
		hbox = gtk.HBox()
		hbox.set_spacing(12)
		image = gtk.image_new_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_DIALOG)
		hbox.pack_start(image, False, False, 12)
		label = gtk.Label(_("""Please enter the URL of the feed you would like to add.  Also enter any tags you would like to apply to this feed, separated by commas"""))
		label.set_line_wrap(True)
		hbox.pack_start(label, True, True, 0)
		dialog.vbox.pack_start(hbox, True, True, 0)
		dialog.show_all()
		dialog.resize(400,-1)
		response = dialog.run()
		dialog.hide()
		del dialog
				
	def on_button_ok_clicked(self,event):
		self.finish()
		
	def on_feed_url_activate(self, event):
		self.finish()
		
	def on_edit_tags_widget_activate(self, event):
		self.finish()
	
	def on_button_cancel_clicked(self,event):
		self.hide()
		
	def on_sugar_combo_changed(self, combo):
		model = combo.get_model()
		active = combo.get_active()
		
		if active == -1:
			return
		
		self._feed_url_widget.set_text(model[active][2])