Below are a couple of small patches that I apply to Zhone, the
freesmartphone.org framework testing app. The first locks the phone
if you miss a call (To prevent accidental use whilst in your
pocket). The second patch alerts you to the fact that an SMS can't
be sent when your SIM card is full (Before you had no way of
knowing whether the message had been sent). It also displays a
message when your sim card is full. You can download the patch
here.
--- zhone 2009-01-13 15:01:54.000000000 +0000
+++ zhone 2009-01-13 19:59:46.000000000 +0000
@@ -249,6 +249,8 @@
def update_status(self, status):
self.part_text_set( "label_description", status )
+ if status == "release" and self.status == "incoming":
+ self.main.groups["lock"].activate()
if status == "outgoing":
self.part_text_set( "label_left", u"" )
self.part_text_set( "label_right", u"cancel" )
@@ -368,7 +370,9 @@
self.busy = True
def cbStoreError( self, e ):
- logger.warning( "error while storing message" )
+ logger.warning( "error while storing message - %s" % e.get_dbus_name() )
+ if e.get_dbus_name() == "org.freesmartphone.GSM.SIM.MemoryFull":
+ self.main.groups["error"].activate( "Failed to send message - SIM Memory Full", [("OK")] )
def cbSend1( self, selected, cb_data ):
self.main.groups["text_edit"].setup(
@@ -480,6 +484,10 @@
textblock_escape( message[3] ).replace( '\n', '<br>' )
)
)
+ if dbus_object.gsm_device_obj:
+ messagebookInfo = dbus_object.gsm_sim_iface.GetMessagebookInfo()
+ if messagebookInfo["used"] == messagebookInfo["last"]:
+ self.main.groups["error"].activate( "Warning: SIM Memory Full", [("OK")] )
def cbMessagebookError( self, e ):
logger.warning( "error while retrieving messagebook" )
@@ -1951,9 +1958,10 @@
def on_edje_signal_button_pressed( self, emission, source ):
id = int( source.split( "_", 1 )[1] )
self.deactivate()
- self.cb( self.part_text_get( "label_%i" % id ), self.cb_data )
+ if self.cb_data is not None:
+ self.cb( self.part_text_get( "label_%i" % id ), self.cb_data )
- def activate( self, description, buttons, cb_data, cb ):
+ def activate( self, description, buttons, cb_data = None, cb = None ):
self.buttons = buttons
self.cb_data = cb_data
self.cb = cb