Commit 7445eda0 authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin

Transfert

parent 91fa93b5
......@@ -257,11 +257,17 @@ sflphone_current( call_t * c )
}
void
sflphone_transfert( call_t * c, gchar * to )
sflphone_set_transfert()
{
screen_clear();
update_call_tree_remove(c);
update_menus();
call_t * c = call_get_selected();
if(c)
{
c->state = CALL_STATE_TRANSFERT;
c->to = g_strdup("");
screen_set_call(c);
update_call_tree(c);
update_menus();
}
}
void
......@@ -301,8 +307,11 @@ void process_dialing(call_t * c, guint keyval, gchar * key)
g_free(before);
g_print("TO: %s\n", c->to);
g_free(c->from);
c->from = g_strconcat("\"\" <", c->to, ">", NULL);
if(c->state == CALL_STATE_DIALING)
{
g_free(c->from);
c->from = g_strconcat("\"\" <", c->to, ">", NULL);
}
screen_set_call(c);
update_call_tree(c);
}
......@@ -326,8 +335,11 @@ void process_dialing(call_t * c, guint keyval, gchar * key)
g_free(before);
g_print("TO: %s\n", c->to);
g_free(c->from);
c->from = g_strconcat("\"\" <", c->to, ">", NULL);
if(c->state == CALL_STATE_DIALING)
{
g_free(c->from);
c->from = g_strconcat("\"\" <", c->to, ">", NULL);
}
screen_set_call(c);
update_call_tree(c);
}
......@@ -401,6 +413,21 @@ sflphone_keypad( guint keyval, gchar * key)
break;
}
break;
case CALL_STATE_TRANSFERT:
switch (keyval)
{
case 65293: /* ENTER */
case 65421: /* ENTER numpad */
dbus_transfert(c);
break;
case 65307: /* ESCAPE */
sflphone_current(c); // Quit transfert
break;
default: // When a call is on transfert, typing new numbers will add it to c->to
process_dialing(c, keyval, key);
break;
}
break;
case CALL_STATE_HOLD:
switch (keyval)
{
......
......@@ -51,17 +51,12 @@ void sflphone_on_hold ();
void sflphone_off_hold ();
call_t * sflphone_new_call();
void sflphone_notify_voice_mail (guint count);
void sflphone_set_transfert();
/**
* Accept / dial the current call
*/
void sflphone_pick_up ();
/**
* Transfert the call
*/
void sflphone_transfert ( call_t * c, gchar * to );
/**
* Put the call on hold state
*/
......
......@@ -44,7 +44,9 @@ typedef enum
/** Call has failed */
CALL_STATE_FAILURE,
/** Call is busy */
CALL_STATE_BUSY
CALL_STATE_BUSY,
/** Call is being transfert. During this state, the user can enter the new number. */
CALL_STATE_TRANSFERT
} call_state_t;
......
......@@ -75,11 +75,7 @@ hold( GtkWidget *widget, gpointer data )
static void
transfert( GtkWidget *widget, gpointer data )
{
call_t * c = (call_t*) call_list_get_by_state (CALL_STATE_CURRENT);
if(c)
{
dbus_transfert(c,"124");
}
sflphone_set_transfert();
}
/**
......@@ -135,7 +131,7 @@ update_buttons ()
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
break;
default:
g_error("Should not happen!");
g_warning("Should not happen!");
break;
}
}
......@@ -189,7 +185,7 @@ void row_activated(GtkTreeView *tree_view,
sflphone_place_call (selectedCall);
break;
default:
g_error("Should not happen!");
g_warning("Should not happen!");
break;
}
}
......@@ -363,10 +359,22 @@ update_call_tree (call_t * c)
{
// Existing call in the list
gchar * markup;
markup = g_markup_printf_escaped("<b>%s</b>\n"
if(c->state == CALL_STATE_TRANSFERT)
{
markup = g_markup_printf_escaped("<b>%s</b>\n"
"%s\n<i>Transfert to:</i> %s",
call_get_name(c),
call_get_number(c),
c->to);
}
else
{
markup = g_markup_printf_escaped("<b>%s</b>\n"
"%s",
call_get_name(c),
call_get_number(c));
}
switch(c->state)
{
......@@ -388,8 +396,11 @@ update_call_tree (call_t * c)
case CALL_STATE_BUSY:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/busy.svg", NULL);
break;
case CALL_STATE_TRANSFERT:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/transfert.svg", NULL);
break;
default:
g_error("Should not happen!");
g_warning("Should not happen!");
}
//Resize it
if(pixbuf)
......@@ -444,7 +455,7 @@ update_call_tree_add (call_t * c)
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/ring.svg", NULL);
break;
default:
g_error("Should not happen!");
g_warning("Should not happen!");
}
//Resize it
......
......@@ -295,10 +295,10 @@ dbus_hang_up (const call_t * c)
}
void
dbus_transfert (const call_t * c, gchar * to )
dbus_transfert (const call_t * c)
{
GError *error = NULL;
org_sflphone_SFLphone_CallManager_transfert ( callManagerProxy, c->callID, to, &error);
org_sflphone_SFLphone_CallManager_transfert ( callManagerProxy, c->callID, c->to, &error);
if (error)
{
g_printerr ("Failed to call transfert() on CallManager: %s\n",
......
......@@ -35,7 +35,7 @@ void dbus_clean ();
void dbus_hold (const call_t * c );
void dbus_unhold (const call_t * c );
void dbus_hang_up (const call_t * c );
void dbus_transfert (const call_t * c, gchar * to );
void dbus_transfert (const call_t * c);
void dbus_accept (const call_t * c);
void dbus_refuse (const call_t * c);
void dbus_place_call (const call_t * c);
......
......@@ -75,7 +75,7 @@ void update_menus()
gtk_widget_set_sensitive( GTK_WIDGET(hangUpMenu), TRUE);
break;
default:
g_error("Should not happen!");
g_warning("Should not happen!");
break;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment