View Single Post
Posts: 75 | Thanked: 269 times | Joined on Aug 2012
#4
I did some more investigation and the reason why it silently failed was because there was no translation for :
Code:
'To retrieve the MMS your active connection you need to connect to the internet, proceed?'
The closet thing I could find was :
Code:
'To retrieve the MMS your active connection will need to change. Switch connection?'
I thought it might be useful to remove the attempted translation and add a setting for fMMS to either "Prompt" or "Ignore" the above dialog.

Since it doesn't seem as though I can pm peterleinchen, here is the patch:
Code:
Index: connectors.py
===================================================================
--- connectors.py	(revision 1)
+++ connectors.py	(working copy)
@@ -19,6 +19,7 @@
 CONNMODE_ICDSWITCH = 2                                                         
 CONNMODE_FORCESWITCH = 3                                                       
 CONNMODE_NULL = 10
+ROAMMODE_IGNORE = 2
 
 class MasterConnector:
 	""" handles setting up and (might) take down connection(s) """
@@ -39,14 +40,16 @@
 		phoneobj = bus.get_object('com.nokia.phone.net', '/com/nokia/phone/net')
 		phoneif = dbus.Interface(phoneobj, 'Phone.Net')
 		statusarr = phoneif.get_registration_status()[0]
-		if statusarr != 0:
-			log.info("not in home network, not downloading..")
+		if (self.config.get_roammode() == ROAMMODE_IGNORE) and statusarr != 0:
 			if self.cont.ui:
 				if not self.cont.continue_download_roaming():
 					log.info("user declined to download while roaming")
 					raise Exception('User is roaming, not downloading')
-					return	
+					return
+				else:
+					log.info("user accepted to download while roaming")
 			else:
+				log.info("not in home network, not downloading..")
 				self.connector = None
 				raise Exception('User is roaming, not downloading')
 				#return
Index: controller_gtk.py
===================================================================
--- controller_gtk.py	(revision 1)
+++ controller_gtk.py	(working copy)
@@ -186,7 +186,7 @@
 		dialog = gtk.Dialog()
 		dialog.set_title(gettext.ldgettext('osso-connectivity-ui', 'conn_fi_phone_network_data_roam'))
 		#dialog.set_transient_for(self.window)
-		label = gtk.Label(_("To retrieve the MMS your active connection you need to connect to the internet, proceed?"))
+		label = gtk.Label("To retrieve the MMS your active connection will use data roaming, proceed?")
 		label.set_line_wrap(True)
 		dialog.vbox.add(label)
 		dialog.add_button(gtk.STOCK_YES, 1)
Index: fmms_config.py
===================================================================
--- fmms_config.py	(revision 1)
+++ fmms_config.py	(working copy)
@@ -19,6 +19,8 @@
 CONNMODE_ICDSWITCH = 2
 CONNMODE_FORCESWITCH = 3
 CONNMODE_NULL = 10
+ROAMMODE_PROMPT = 1
+ROAMMODE_IGNORE = 2
 
 class fMMS_config:
 
@@ -61,6 +63,8 @@
 			self.set_version("Unknown")
 		if self.get_connmode() == None:
 			self.set_connmode(CONNMODE_FORCESWITCH)
+		if self.get_roammode() == None:
+			self.set_roammode(ROAMMODE_PROMPT)
 		if self.get_db_path() == None:
 			self.set_db_path("/home/user/.fmms/mms.db")
 		if not self.get_useragent():
@@ -82,6 +86,7 @@
 			self.set_firstlaunch(1)
 			self.set_img_resize_width(240)
 			self.set_connmode(CONNMODE_FORCESWITCH)
+			self.set_roammode(ROAMMODE_PROMPT)
 
 	def get_old_mmsc(self):
 		return self.client.get_string(self._fmmsdir + 'mmsc')
@@ -98,6 +103,12 @@
 	def get_connmode(self):
 		return self.client.get_int(self._fmmsdir + "connmode")
 		
+	def set_roammode(self, val):
+		self.client.set_int(self._fmmsdir + "roammode", int(val))
+		
+	def get_roammode(self):
+		return self.client.get_int(self._fmmsdir + "roammode")
+		
 	def get_last_ui_dir(self):
 		return self.client.get_string(self._fmmsdir + "lastuidir")
 		
Index: fmms_config_dialog.py
===================================================================
--- fmms_config_dialog.py	(revision 1)
+++ fmms_config_dialog.py	(working copy)
@@ -76,7 +76,22 @@
 		self.icdbutton = hildon.GtkToggleButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
 		self.icdbutton.set_label(_("Polite"))
 		self.icdsignal = self.icdbutton.connect('toggled', self.conn_mode_toggled)
+
+		expRBox = gtk.HBox()
+		exp_label2 = gtk.Label("Roaming Mode")
+		exp_label2.set_width_chars(labelwidth)
+		exp_label2.set_line_wrap(True)
+		exp_label2.set_alignment(0, 0.5)
 		
+		rbox = gtk.HButtonBox()
+		rbox.set_property("name", "GtkHBox2")
+		self.promptbutton = hildon.GtkToggleButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
+		self.promptbutton.set_label(_("Prompt"))
+		self.promptsignal = self.promptbutton.connect('toggled', self.roam_mode_toggled)
+		self.ignorebutton = hildon.GtkToggleButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
+		self.ignorebutton.set_label(_("Ignore"))
+		self.ignoresignal = self.ignorebutton.connect('toggled', self.roam_mode_toggled)
+		
 		# Set the correct button to be active
 		self.connmode_setactive()
 		
@@ -90,9 +105,22 @@
 		expHBox.pack_start(exp_label, False, True, 0)
 		expHBox.pack_start(alignment, False, True, 0)
 
+		# Set the correct button to be active
+		self.roammode_setactive()
+
+		rbox.pack_start(self.promptbutton, True, False, 0)
+		rbox.pack_start(self.ignorebutton, True, False, 0)
+
+		alignment = gtk.Alignment(0.5, 0.5, 0, 0)
+		alignment.add(rbox)
+
+		expRBox.pack_start(exp_label2, False, True, 0)
+		expRBox.pack_start(alignment, False, True, 0)
+
 		allVBox.pack_start(apnHBox, False, False, 2)
 		#allVBox.pack_start(numberHBox, False, False, 2)
 		allVBox.pack_start(imgwidthHBox, False, False, 2)
+		allVBox.pack_end(expRBox, False, False, 2)
 		allVBox.pack_end(expHBox, False, False, 2)
 
 		allVBox.show_all()
@@ -163,6 +191,34 @@
 		elif self.config.get_connmode() == fMMSconf.CONNMODE_FORCESWITCH:
 			self.rudebutton.set_active(True)
 
+	def roam_mode_toggled(self, widget):
+		""" Ugly hack used since its ToggleButtons """
+		self.promptbutton.handler_block(self.promptsignal)
+		self.ignorebutton.handler_block(self.ignoresignal)
+		if self.promptbutton == widget:
+			self.promptbutton.set_active(True)
+			self.ignorebutton.set_active(False)
+		elif self.rudebutton == widget:
+			self.promptcbutton.set_active(False)
+			self.ignorebutton.set_active(True)
+		self.promptbutton.handler_unblock(self.promptsignal)
+		self.ignorebutton.handler_unblock(self.ignoresignal)
+		return True
+
+	def roammode_option(self):
+		""" Returns which 'Roaming Mode' button is active. """
+		if self.promptbutton.get_active():
+			return fMMSconf.ROAMMODE_PROMPT
+		elif self.ignorebutton.get_active():
+			return fMMSconf.ROAMMODE_IGNORE
+
+	def roammode_setactive(self):
+		""" Activate one of the 'Roaming Mode' buttons. """
+		if self.config.get_roammode() == fMMSconf.ROAMMODE_PROMPT:
+			self.promptbutton.set_active(True)
+		elif self.config.get_connmode() == fMMSconf.ROAMMODE_IGNORE:
+			self.ignorebutton.set_active(True)
+
 	def config_menu_button_clicked(self, action):
 		""" Checks if we should save the Configuration options. """
 		if action == 1:
@@ -175,7 +231,9 @@
 			self.config.set_img_resize_width(size)
 			log.info("Set image width to %s" % size)
 			self.config.set_connmode(self.connmode_option())
-			log.info("Set connection mode %s" % self.connmode_option())				
+			log.info("Set connection mode %s" % self.connmode_option())	
+			self.config.set_roammode(self.roammode_option())
+			log.info("Set roaming mode %s" % self.roammode_option())				
 			banner = hildon.hildon_banner_show_information(self.window, "", \
 				 gettext.ldgettext('osso-connectivity-ui', "conn_ib_settings_saved"))
 			return 0
Cheers,
Ilew.
Attached Files
File Type: zip fmms-1.3.6.zip (133.8 KB, 189 views)
 

The Following 2 Users Say Thank You to Ilew For This Useful Post: