2006-10-20 Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
authorMichael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
Fri, 20 Oct 2006 11:36:37 +0000 (11:36 +0000)
committerMichael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
Fri, 20 Oct 2006 11:36:37 +0000 (11:36 +0000)
* hildon-widgets/hildon-time-editor.c:
(hildon_time_editor_entry_keypress): Added check for not allowed keys.
Fixes NB#43926.

* hildon-widgets/hildon-time-editor.h:
Added INVALID_CHAR to HildonTimeEditorErrorType enumeration.

ChangeLog
hildon-widgets/hildon-time-editor.c
hildon-widgets/hildon-time-editor.h

index d880c8c..f14d806 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-10-20  Michael Dominic Kostrzewa  <michael.kostrzewa@nokia.com>
+
+       * hildon-widgets/hildon-time-editor.c:
+       (hildon_time_editor_entry_keypress): Added check for not allowed keys.
+       Fixes NB#43926.
+
+       * hildon-widgets/hildon-time-editor.h:
+       Added INVALID_CHAR to HildonTimeEditorErrorType enumeration.
+
 2006-10-20  Michael Dominic Kostrzewa  <michael.kostrzewa@nokia.com> 
 
        * hildon-widgets/hildon-find-toolbar.c: Do not grab focus but just
index 29107d6..4b6191e 100644 (file)
@@ -1710,6 +1710,7 @@ static gboolean hildon_time_editor_entry_keypress(GtkWidget * widget,
     HildonTimeEditor *editor;
     HildonTimeEditorPrivate *priv;
     gint cursor_pos;
+    gboolean r;
 
     g_assert(GTK_IS_ENTRY(widget));
     g_assert(event != NULL);
@@ -1719,6 +1720,14 @@ static gboolean hildon_time_editor_entry_keypress(GtkWidget * widget,
     priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
     cursor_pos = gtk_editable_get_position(GTK_EDITABLE(widget));
 
+    /* Show error message in case the key pressed is not allowed 
+       (only digits and control characters are allowed )*/
+    if (!g_unichar_isdigit(event->keyval) && !(event->keyval & 0xF000)) {
+        g_signal_emit(editor, time_editor_signals[TIME_ERROR], 0, INVALID_CHAR, &r);
+        hildon_banner_show_information(widget, NULL, _("ckct_ib_illegal_character"));
+        return TRUE;
+    }
+
     switch (event->keyval)
     {
         case GDK_Return:
index 86209ac..7169fa0 100644 (file)
@@ -52,7 +52,8 @@ typedef enum
   EMPTY_SECS,
   MIN_DUR,
   MAX_DUR,
-  INVALID_TIME
+  INVALID_TIME,
+  INVALID_CHAR
 } HildonTimeEditorErrorType;
 
 typedef struct _HildonTimeEditor      HildonTimeEditor;