From ef2c1a7312b22fee13421166cdabd67da708ea6d Mon Sep 17 00:00:00 2001 From: fgau Date: Sat, 27 Dec 2008 20:53:06 +0000 Subject: [PATCH] fix some sms handling bugs git-svn-id: http://www.neo1973-germany.de/svn@219 46df4e5c-bc4e-4628-a0fc-830ba316316d --- epydial/data/themes/blackwhite/hon_screen.edc | 19 ++++++++++--------- epydial/epydial.py | 8 ++++++++ epydial/sms_detail.py | 11 ++++++++++- epydial/sms_screen.py | 12 ++++++++++++ 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/epydial/data/themes/blackwhite/hon_screen.edc b/epydial/data/themes/blackwhite/hon_screen.edc index 5f8deb6..212edcd 100644 --- a/epydial/data/themes/blackwhite/hon_screen.edc +++ b/epydial/data/themes/blackwhite/hon_screen.edc @@ -156,20 +156,21 @@ collections { } part { name: "hon_caption"; - type: TEXTBLOCK; + type: TEXT; mouse_events: 0; description { + state: "default" 0; color_class: "button_inactive"; - align: 0.5 0.5; - fixed: 1 1; - rel1 { relative: 0 3/20; } - rel2 { relative: 1 10/20; } - text { - text: "file:"; - style: "textblock_style"; + rel1 { relative: 1/20 3/20;} + rel2 { relative: 19/20 4/20; } + text { + text: "nick: ???"; + size: 10; + font: "Vera"; + fit: 1 1; } } - } /* end hon_caption */ + } part { name: "icon"; mouse_events: 0; diff --git a/epydial/epydial.py b/epydial/epydial.py index ac6971c..eeae188 100755 --- a/epydial/epydial.py +++ b/epydial/epydial.py @@ -502,6 +502,14 @@ class PyneoController(object): def show_sms_screen_detail(class_): class_.notify_callbacks("show_sms_screen_detail") + @classmethod + def vibrate_start(class_): + class_.pwr.Vibrate(10, 3, 1, dbus_interface=DIN_POWER) + + @classmethod + def vibrate_stop(class_): + class_.pwr.Vibrate(0, 0, 0, dbus_interface=DIN_POWER) + from dialer_screen import * from incall_screen import * diff --git a/epydial/sms_detail.py b/epydial/sms_detail.py index 4c27668..6a89384 100644 --- a/epydial/sms_detail.py +++ b/epydial/sms_detail.py @@ -15,12 +15,21 @@ class SmsDetail(EdjeGroup): def register_pyneo_callbacks(self): PyneoController.register_callback("show_sms_detail", self.on_show_sms_detail) + def mark_sms_read(self, sms_time): + connection = connect(DB_FILE_PATH) + cursor = connection.cursor() + cursor.execute("UPDATE sms SET status='REC READ' WHERE time='%s'" %(sms_time)) + connection.commit() + def on_show_sms_detail(self, sms_number): connection = connect(DB_FILE_PATH) cursor = connection.cursor() cursor.execute("SELECT * FROM sms WHERE status='%s' ORDER BY time DESC LIMIT 1 OFFSET %s" %('REC UNREAD', sms_number)) for row in cursor: - self.part_text_set("sms_text_1", row[3]) + self.part_text_set("sms_text_1", row[2] + '
' + row[1] + '
' + row[3]) + + if row[0] == 'REC UNREAD': + self.mark_sms_read(row[2]) @edje.decorators.signal_callback("mouse,up,1", "*") def on_edje_signal_dialer_status_triggered(self, emission, source): diff --git a/epydial/sms_screen.py b/epydial/sms_screen.py index 24bb500..ae5ecaf 100644 --- a/epydial/sms_screen.py +++ b/epydial/sms_screen.py @@ -14,6 +14,10 @@ class SmsScreen(EdjeGroup): def __init__(self, screen_manager): EdjeGroup.__init__(self, screen_manager, SMS_SCREEN_NAME) + if self.check_for_unread() == 0: + self.sorted_by = 'REC READ' + elif self.check_for_unread() <> 0: + self.sorted_by = 'REC UNREAD' self.show_sms() def del_displayed_sms(self): @@ -24,6 +28,14 @@ class SmsScreen(EdjeGroup): self.part_text_set("sms_text_%s" %x, "") x += 1 + def check_for_unread(self): + connection = connect(DB_FILE_PATH) + cursor = connection.cursor() + cursor.execute("SELECT COUNT(*) FROM sms WHERE status='REC UNREAD'") + for row in cursor: + print 'Count: ', row[0] + return row[0] + def show_sms(self): x = 1 self.detail = False