r961 - trunk/src/target/OM-2007/applications/openmoko-dialer/src
tony_guan at sita.openmoko.org
tony_guan at sita.openmoko.org
Mon Feb 12 10:17:24 CET 2007
Author: tony_guan
Date: 2007-02-12 10:17:15 +0100 (Mon, 12 Feb 2007)
New Revision: 961
Modified:
trunk/src/target/OM-2007/applications/openmoko-dialer/src/contacts.c
trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialergsm.c
trunk/src/target/OM-2007/applications/openmoko-dialer/src/history.c
trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-declares.h
trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.c
trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.h
trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-dialer.c
trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-outgoing.c
trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-pin.c
Log:
pin input.
Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/contacts.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/contacts.c 2007-02-12 09:14:50 UTC (rev 960)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/contacts.c 2007-02-12 09:17:15 UTC (rev 961)
@@ -212,11 +212,11 @@
nextcontact = (DIALER_CONTACT *) calloc (1, sizeof (DIALER_CONTACT));
nextcontact->ID = 0;
nextcontact->name = (char *) calloc (1, 30);
- strcpy (nextcontact->name, name);
+ g_stpcpy (nextcontact->name, name);
nextcontact->name[29] = '\0';
nextcontact->ID = (char *) calloc (1, 255);
- strcpy (nextcontact->ID, id);
+ g_stpcpy (nextcontact->ID, id);
nextcontact->ID[254] = '\0';
return nextcontact;
}
@@ -249,10 +249,10 @@
nextentry =
(DIALER_CONTACT_ENTRY *) calloc (1, sizeof (DIALER_CONTACT_ENTRY));
nextentry->desc = (char *) calloc (1, 30);
- strcpy (nextentry->desc, desc);
+ g_stpcpy (nextentry->desc, desc);
nextentry->desc[29] = '\0';
nextentry->content = (char *) calloc (1, 30);
- strcpy (nextentry->content, content);
+ g_stpcpy (nextentry->content, content);
nextentry->content[29] = '\0';
nextentry->next = contact->entry;
@@ -425,8 +425,8 @@
{
- strcpy (name, "");
- strcpy (picpath, MOKO_DIALER_DEFAULT_PERSON_IMAGE_PATH);
+ g_stpcpy (name, "");
+ g_stpcpy (picpath, MOKO_DIALER_DEFAULT_PERSON_IMAGE_PATH);
if (number == 0)
return 0;
if (strlen (number) == 0)
@@ -447,8 +447,8 @@
if (strcmp (entry->content, number) == 0)
{
- strcpy (picpath, contacts->picpath);
- strcpy (name, contacts->name);
+ g_stpcpy (picpath, contacts->picpath);
+ g_stpcpy (name, contacts->name);
// DBG_MESSAGE("Yeah, we know the owner is %s.",name);
return 1;
@@ -642,9 +642,9 @@
if(photo)
if (photo)
- // gdk_pixbuf_loader_write (loader, photo->data.inlined.data,
- // photo->data.inlined.length, NULL);
- gdk_pixbuf_loader_write (loader, photo->data, photo->length, NULL); //just temporaly modified.
+ gdk_pixbuf_loader_write (loader, photo->data.inlined.data,
+ photo->data.inlined.length, NULL);
+ //gdk_pixbuf_loader_write (loader, photo->data, photo->length, NULL); //just temporaly modified.
gdk_pixbuf_loader_close (loader, NULL);
Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialergsm.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialergsm.c 2007-02-12 09:14:50 UTC (rev 960)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialergsm.c 2007-02-12 09:17:15 UTC (rev 961)
@@ -297,8 +297,6 @@
printf ("EVENT: PIN request (type=%u) ", aux->u.pin.type);
- /* FIXME: read pin from STDIN and send it back via lgsm_pin */
-
gsm_pin_require(lh);
Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/history.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/history.c 2007-02-12 09:14:50 UTC (rev 960)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/history.c 2007-02-12 09:17:15 UTC (rev 961)
@@ -177,7 +177,7 @@
if (name && strlen (name) > 0)
{
pentry->name = (char *) calloc (1, strlen (name) + 1);
- strcpy (pentry->name, name);
+ g_stpcpy (pentry->name, name);
pentry->hasname = 1;
}
else
@@ -189,7 +189,7 @@
if (number && strlen (number) > 0)
{
pentry->number = (char *) calloc (1, strlen (number) + 1);
- strcpy (pentry->number, number);
+ g_stpcpy (pentry->number, number);
}
else
{
@@ -203,12 +203,12 @@
if (id && strlen (id) > 0)
{
pentry->ID = (char *) calloc (1, strlen (id) + 1);
- strcpy (pentry->ID, id);
+ g_stpcpy (pentry->ID, id);
}
if (time && strlen (time) > 0)
{
pentry->time = (char *) calloc (1, strlen (time) + 1);
- strcpy (pentry->time, time);
+ g_stpcpy (pentry->time, time);
}
pentry->durationsec = durationsec;
Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-declares.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-declares.h 2007-02-12 09:14:50 UTC (rev 960)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-declares.h 2007-02-12 09:17:15 UTC (rev 961)
@@ -19,6 +19,7 @@
#define _MOKO_DIALER_DECLARES_H_
#define MOKO_DIALER_MAX_TIME_STATUS_LEN (128) ///<TO HOLD THE STRINGS LIKE "CALL...(00:00:30)
#define MOKO_DIALER_MAX_NUMBER_LEN (64) ///<TO HOLD THE PHONE NUMBERS
+#define MOKO_DIALER_MAX_PIN_LEN (64) ///<TO HOLD THE PHONE NUMBERS
#define MOKO_DIALER_MAX_DISP_NAME_LEN (20) ///<THE MAXIMUM LENGTH OF THE DISPLAYED CONTACT NAME
#define MOKO_DIALER_MAX_PATH_LEN (128) ///<THE MAX PATH LEN
//MAXDISPNAMENUM MUST >=1 & <=9!
Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.c 2007-02-12 09:14:50 UTC (rev 960)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.c 2007-02-12 09:17:15 UTC (rev 961)
@@ -80,14 +80,14 @@
if(end>1)while(number[end-1]=='\"'&&start<end)end--;
DBG_MESSAGE("START=%d,END=%d",start,end);
-strcpy(temp,number+start);
+g_stpcpy(temp,number+start);
temp[end-1]=0;
DBG_MESSAGE("%s",temp);
//got the number;
-strcpy(appdata->g_peer_info.number,temp);
+g_stpcpy(appdata->g_peer_info.number,temp);
//retrieve the contact information if any.
contact_get_peer_info_from_number(appdata->g_contactlist.contacts , &(appdata->g_peer_info));
@@ -288,12 +288,14 @@
window_outgoing_init(p_dialer_data);
window_history_init(p_dialer_data);
+
DBG_WARN("\nusage: \"openmoko-dialer\" will not show any GUI initialy until you reactivate the app using another \"openmoko-dialer\" command");
//from now on we will not use multithreads.
gsm_lgsm_start(mainloop);
+ //gtk_widget_show(p_dialer_data->window_pin);
//start a timer to monitor incoming calls
//gtk_timeout_add(100,incoming_calls,0);
Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.h 2007-02-12 09:14:50 UTC (rev 960)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.h 2007-02-12 09:17:15 UTC (rev 961)
@@ -37,6 +37,8 @@
GMainLoop *mainloop;
+ char str_sim_pin[MOKO_DIALER_MAX_PIN_LEN+1];
+ gint int_sim_pin_end_point;
MokoDialerTextview *moko_dialer_text_view; ///<the textview for the dialer window
MokoDialerTextview *moko_dtmf_text_view; ///<the textview for the dtmf window
Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-dialer.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-dialer.c 2007-02-12 09:14:50 UTC (rev 960)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-dialer.c 2007-02-12 09:17:15 UTC (rev 961)
@@ -112,7 +112,8 @@
moko_dialer_autolist_hide_all_tips (appdata->moko_dialer_autolist);
//got the number;//FIXME:which function should I use if not g_strdup. & strcpy.
- strcpy(appdata->g_peer_info.number, codesinput );
+ //strcpy(appdata->g_peer_info.number, codesinput );
+ g_stpcpy(appdata->g_peer_info.number, codesinput );
//retrieve the contact information if any.
contact_get_peer_info_from_number (appdata->g_contactlist.contacts,
Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-outgoing.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-outgoing.c 2007-02-12 09:14:50 UTC (rev 960)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-outgoing.c 2007-02-12 09:17:15 UTC (rev 961)
@@ -117,7 +117,8 @@
moko_dialer_status_set_person_name (appdata->status_outgoing, "");
}
- strcpy (appdata->g_state.lastnumber, appdata->g_peer_info.number);
+// strcpy (appdata->g_state.lastnumber, appdata->g_peer_info.number);
+ g_stpcpy (appdata->g_state.lastnumber, appdata->g_peer_info.number);
DBG_LEAVE ();
}
Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-pin.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-pin.c 2007-02-12 09:14:50 UTC (rev 960)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-pin.c 2007-02-12 09:17:15 UTC (rev 961)
@@ -31,26 +31,35 @@
void
pin_delete_button_clicked (GtkButton * button, MOKO_DIALER_APP_DATA * appdata)
{
-moko_dialer_textview_delete (appdata->moko_pin_text_view);
+if(appdata->int_sim_pin_end_point)
+{
+ moko_dialer_textview_delete (appdata->moko_pin_text_view);
+ appdata->int_sim_pin_end_point--;
+ appdata->str_sim_pin[appdata->int_sim_pin_end_point]=0;
+}
+
}
void
pin_ok_button_clicked (GtkButton * button, MOKO_DIALER_APP_DATA * appdata)
{
- gchar *codesinput;
- codesinput =g_strdup(moko_dialer_textview_get_input (appdata->moko_pin_text_view, TRUE));
+ // gchar *codesinput;
+// codesinput =g_strdup(moko_dialer_textview_get_input (appdata->moko_pin_text_view, TRUE));
- if (g_utf8_strlen (codesinput, -1) <1)
+ if (g_utf8_strlen (appdata->str_sim_pin, -1) <1)
{
- //user didn't input anything, maybe it's a redial
+ //user didn't input anything
DBG_MESSAGE("no input for pin");
}
else
{//here send the pin codes and hide our window.
- DBG_MESSAGE("here we send the pin:%s",codesinput);
- lgsm_pin (appdata->lh, codesinput);
+ DBG_MESSAGE("here we send the pin:%s",appdata->str_sim_pin);
+ //FIXME:why this call will cause segment fault?
+ lgsm_pin (appdata->lh, appdata->str_sim_pin);
+ //lgsm_pin (appdata->lh, "1234");
+ DBG_MESSAGE("pin:%s sent",appdata->str_sim_pin);
gtk_widget_hide(appdata->window_pin);
}
@@ -66,13 +75,21 @@
char input[2];
input[0] = parac;
input[1] = 0;
-
+
//DBG_TRACE();
MOKO_DIALER_APP_DATA *appdata = (MOKO_DIALER_APP_DATA *) user_data;
MokoDialerTextview *moko_pin_text_view = appdata->moko_pin_text_view;
-
-
- moko_dialer_textview_insert (moko_pin_text_view, input);
+if(appdata->int_sim_pin_end_point<MOKO_DIALER_MAX_NUMBER_LEN)
+{
+ appdata->str_sim_pin[appdata->int_sim_pin_end_point]=parac;
+ appdata->int_sim_pin_end_point++;
+ moko_dialer_textview_insert (moko_pin_text_view, "*");
+}
+else
+{
+ appdata->str_sim_pin[0]=parac;
+ appdata->int_sim_pin_end_point=1;
+}
//DBG_TRACE();
}
@@ -91,6 +108,7 @@
{
DBG_ENTER();
appdata->window_present=widget;
+
DBG_LEAVE();
}
@@ -104,6 +122,8 @@
if (!p_dialer_data->window_pin)
{
+ g_stpcpy(p_dialer_data->str_sim_pin,"");
+ p_dialer_data->int_sim_pin_end_point=0;
GdkColor color;
gdk_color_parse ("black", &color);
@@ -132,6 +152,7 @@
MokoDialerTextview *mokotextview = moko_dialer_textview_new ();
p_dialer_data->moko_pin_text_view = mokotextview;
+// moko_dialer_textview_fill_it(mokotextview , "Please input the pin:");
gtk_container_add (GTK_CONTAINER (eventbox1), mokotextview);
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (eventbox1), FALSE, FALSE,
@@ -187,8 +208,6 @@
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), TRUE, TRUE, 5);
-
-
moko_finger_window_set_contents (window, GTK_WIDGET (vbox));
More information about the commitlog
mailing list