Made 'Erase' button and dialog optional to make email client compatible with non-windows CTK.
This commit is contained in:
parent
c0932be656
commit
de3142c0d4
@ -29,7 +29,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the Contiki desktop environment for the C64.
|
* This file is part of the Contiki desktop environment for the C64.
|
||||||
*
|
*
|
||||||
* $Id: email.c,v 1.5 2008/02/08 22:49:54 oliverschmidt Exp $
|
* $Id: email.c,v 1.6 2010/01/31 21:13:38 oliverschmidt Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -56,6 +56,12 @@
|
|||||||
#define MAIL_HEIGHT 17
|
#define MAIL_HEIGHT 17
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EMAIL_CONF_ERASE
|
||||||
|
#define MAIL_ERASE EMAIL_CONF_ERASE
|
||||||
|
#else
|
||||||
|
#define MAIL_ERASE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (MAIL_WIDTH - 9) < 39
|
#if (MAIL_WIDTH - 9) < 39
|
||||||
#define TEXTENTRY_WIDTH (MAIL_WIDTH - 9)
|
#define TEXTENTRY_WIDTH (MAIL_WIDTH - 9)
|
||||||
#else
|
#else
|
||||||
@ -97,9 +103,10 @@ struct ctk_textentry mailtextentry =
|
|||||||
{CTK_TEXTENTRY_INPUT(0, 3, MAIL_WIDTH - 1, MAIL_HEIGHT, mail, MAIL_WIDTH - 1, \
|
{CTK_TEXTENTRY_INPUT(0, 3, MAIL_WIDTH - 1, MAIL_HEIGHT, mail, MAIL_WIDTH - 1, \
|
||||||
ctk_textentry_multiline_input)};
|
ctk_textentry_multiline_input)};
|
||||||
|
|
||||||
|
|
||||||
static struct ctk_button sendbutton =
|
static struct ctk_button sendbutton =
|
||||||
{CTK_BUTTON(0, MAIL_HEIGHT + 4, 4, "Send")};
|
{CTK_BUTTON(0, MAIL_HEIGHT + 4, 4, "Send")};
|
||||||
|
|
||||||
|
#if MAIL_ERASE
|
||||||
static struct ctk_button erasebutton =
|
static struct ctk_button erasebutton =
|
||||||
{CTK_BUTTON(MAIL_WIDTH - 6, MAIL_HEIGHT + 4, 5, "Erase")};
|
{CTK_BUTTON(MAIL_WIDTH - 6, MAIL_HEIGHT + 4, 5, "Erase")};
|
||||||
|
|
||||||
@ -113,6 +120,7 @@ static struct ctk_button eraseyesbutton =
|
|||||||
{CTK_BUTTON(4, 4, 3, "Yes")};
|
{CTK_BUTTON(4, 4, 3, "Yes")};
|
||||||
static struct ctk_button erasenobutton =
|
static struct ctk_button erasenobutton =
|
||||||
{CTK_BUTTON(18, 4, 2, "No")};
|
{CTK_BUTTON(18, 4, 2, "No")};
|
||||||
|
#endif /* MAIL_ERASE */
|
||||||
|
|
||||||
/* The setup window. */
|
/* The setup window. */
|
||||||
static struct ctk_window setupwindow;
|
static struct ctk_window setupwindow;
|
||||||
@ -220,6 +228,7 @@ PROCESS_THREAD(email_process, ev, data)
|
|||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
|
#if MAIL_ERASE
|
||||||
/* Create the "Really erase message?" dialog. */
|
/* Create the "Really erase message?" dialog. */
|
||||||
ctk_dialog_new(&erasedialog, 26, 6);
|
ctk_dialog_new(&erasedialog, 26, 6);
|
||||||
CTK_WIDGET_ADD(&erasedialog, &erasedialoglabel1);
|
CTK_WIDGET_ADD(&erasedialog, &erasedialoglabel1);
|
||||||
@ -227,6 +236,7 @@ PROCESS_THREAD(email_process, ev, data)
|
|||||||
CTK_WIDGET_ADD(&erasedialog, &eraseyesbutton);
|
CTK_WIDGET_ADD(&erasedialog, &eraseyesbutton);
|
||||||
CTK_WIDGET_ADD(&erasedialog, &erasenobutton);
|
CTK_WIDGET_ADD(&erasedialog, &erasenobutton);
|
||||||
CTK_WIDGET_FOCUS(&erasedialog, &erasenobutton);
|
CTK_WIDGET_FOCUS(&erasedialog, &erasenobutton);
|
||||||
|
#endif /* MAIL_ERASE */
|
||||||
|
|
||||||
/* Create setup window. */
|
/* Create setup window. */
|
||||||
ctk_window_new(&setupwindow, 28, 16, "E-mail setup");
|
ctk_window_new(&setupwindow, 28, 16, "E-mail setup");
|
||||||
@ -247,7 +257,6 @@ PROCESS_THREAD(email_process, ev, data)
|
|||||||
|
|
||||||
|
|
||||||
/* Create compose window. */
|
/* Create compose window. */
|
||||||
|
|
||||||
ctk_window_new(&composewindow, MAIL_WIDTH + 1, MAIL_HEIGHT + 5, "Compose e-mail");
|
ctk_window_new(&composewindow, MAIL_WIDTH + 1, MAIL_HEIGHT + 5, "Compose e-mail");
|
||||||
|
|
||||||
CTK_WIDGET_ADD(&composewindow, &tolabel);
|
CTK_WIDGET_ADD(&composewindow, &tolabel);
|
||||||
@ -265,8 +274,10 @@ PROCESS_THREAD(email_process, ev, data)
|
|||||||
CTK_WIDGET_ADD(&composewindow, &statuslabel);
|
CTK_WIDGET_ADD(&composewindow, &statuslabel);
|
||||||
|
|
||||||
CTK_WIDGET_ADD(&composewindow, &sendbutton);
|
CTK_WIDGET_ADD(&composewindow, &sendbutton);
|
||||||
|
#if MAIL_ERASE
|
||||||
CTK_WIDGET_ADD(&composewindow, &erasebutton);
|
CTK_WIDGET_ADD(&composewindow, &erasebutton);
|
||||||
|
#endif /* MAIL_ERASE */
|
||||||
|
|
||||||
erase_message();
|
erase_message();
|
||||||
|
|
||||||
/* Create and add the menu */
|
/* Create and add the menu */
|
||||||
@ -292,6 +303,7 @@ PROCESS_THREAD(email_process, ev, data)
|
|||||||
smtp_send(to, cc, fromaddress, subject, mail, MAIL_WIDTH, MAIL_HEIGHT);
|
smtp_send(to, cc, fromaddress, subject, mail, MAIL_WIDTH, MAIL_HEIGHT);
|
||||||
ctk_label_set_text(&statuslabel, "Sending message...");
|
ctk_label_set_text(&statuslabel, "Sending message...");
|
||||||
CTK_WIDGET_REDRAW(&statuslabel);
|
CTK_WIDGET_REDRAW(&statuslabel);
|
||||||
|
#if MAIL_ERASE
|
||||||
} else if(w == (struct ctk_widget *)&erasebutton) {
|
} else if(w == (struct ctk_widget *)&erasebutton) {
|
||||||
ctk_dialog_open(&erasedialog);
|
ctk_dialog_open(&erasedialog);
|
||||||
} else if(w == (struct ctk_widget *)&eraseyesbutton) {
|
} else if(w == (struct ctk_widget *)&eraseyesbutton) {
|
||||||
@ -299,6 +311,7 @@ PROCESS_THREAD(email_process, ev, data)
|
|||||||
ctk_dialog_close();
|
ctk_dialog_close();
|
||||||
} else if(w == (struct ctk_widget *)&erasenobutton) {
|
} else if(w == (struct ctk_widget *)&erasenobutton) {
|
||||||
ctk_dialog_close();
|
ctk_dialog_close();
|
||||||
|
#endif /* MAIL_ERASE */
|
||||||
} else if(w == (struct ctk_widget *)&setupokbutton) {
|
} else if(w == (struct ctk_widget *)&setupokbutton) {
|
||||||
applyconfig();
|
applyconfig();
|
||||||
ctk_window_close(&setupwindow);
|
ctk_window_close(&setupwindow);
|
||||||
|
Loading…
Reference in New Issue
Block a user