📄 email_numchr.cxx
字号:
#include "Email_numchr.h"
static void cb_Mnb_pp_but(Fl_Button *, void *)
{
Mnb_chr_window->hide();
Email_passport_window(PORT_SET);
}
static void cb_Mnb_sp_but(Fl_Button *, void *)
{
Mnb_chr_window->hide();
Email_passport_window(PORT_SET);
}
static void cb_Mnb_rmbpas_chkbut(Fl_Check_Button *, void *)
{
if (Mnb_rmbpas_chkbut->value() == 0)
numset.ifrempass = 0;
else
numset.ifrempass = 1;
}
static void cb_Mnb_delser_chkbut(Fl_Check_Button *, void *)
{
if (Mnb_delser_chkbut->value() == 0)
numset.ifemptyserver = 0;
else
numset.ifemptyserver = 1;
}
static void cb_Mnb_onlytpc_chkbut(Fl_Check_Button *, void *)
{
}
static void cb_Mnb_con_but(Fl_Button *, void *)
{
int i, n, current, db_num;
int null_flag = NON_EMPTY;
char buf[100];
struct numberset *temp;
temp = (struct numberset *) malloc(MAXCHRNUM);
if (strlen(Mnb_name_in->value()) == 0)
null_flag = EMPTY_ERROR;
else
strcpy(numset.user, Mnb_name_in->value());
if (strlen(Mnb_addr_in->value()) == 0)
null_flag = EMPTY_ERROR;
else
strcpy(numset.maddr, Mnb_addr_in->value());
if (strlen(Mnb_pop_in->value()) == 0)
null_flag = EMPTY_ERROR;
else
strcpy(numset.pop3, Mnb_pop_in->value());
if (strlen(Mnb_smtp_in->value()) == 0)
null_flag = EMPTY_ERROR;
else
strcpy(numset.smtp, Mnb_smtp_in->value());
if (strlen(Mnb_num_in->value()) == 0)
null_flag = EMPTY_ERROR;
else
strcpy(numset.mnum, Mnb_num_in->value());
if (strlen(Mnb_pass_in->value()) == 0)
null_flag = EMPTY_ERROR;
else
strcpy(numset.passwd, Mnb_pass_in->value());
if (null_flag == EMPTY_ERROR) {
fl_alert("请填写所有帐号资料!\n");
return;
}
if (strlen(numset.pop3port) == 0)
strcpy(numset.pop3port, POP3_PORT_NUMBER);
if (strlen(numset.smtpport) == 0)
strcpy(numset.smtpport, SMTP_PORT_NUMBER);
// add by posaidong
if (numset.ifrempass != 1)
numset.ifrempass = 0;
if (numset.ifemptyserver != 1)
numset.ifemptyserver = 0;
db_num = get_the_datanum(setnum_id);
if (db_num == -1) {
printf("get the record num error!\n");
return;
}
if (char_set_flag == CHAR_SET) {
for (i = 0, current = 0; i < db_num; i++) {
db_change_current_pos(setnum_id, i);
n = db_get_current_pos(setnum_id, temp);
printf("Current position is %d\n", n);
if (!strcmp(temp->user, USERNAME)) {
current++;
}
if (current == Mnb_browser->value()) {
numset.chr_num = i;
n = db_modify_current(setnum_id, &numset, MAXCHRNUM);
if (n)
printf("modify success\n");
else
printf("modify failed\n");
sprintf(buf, "%s\t%s\t", numset.user, numset.maddr);
Mnb_browser->remove(current);
Mnb_browser->insert(current, buf);
Mnb_browser->redraw();
break;
}
}
} else {
numset.chr_num = db_num++;
if (add_numchr2db(&numset, setnum_id) == -1) {
printf("--------------------create database error!\n");
return;
} else
printf("create data base success!\n");
sprintf(buf, "%s\t%s\t", numset.user, numset.maddr);
Mnb_browser->insert(++user_account, buf);
Mnb_browser->redraw();
}
free(temp);
Mnb_chr_window->hide();
Email_numset();
}
static void cb_Mnb_canc_but(Fl_Button *, void *)
{
Mnb_chr_window->hide();
Email_numset();
}
void create_numchr_window()
{
Fl_Color c1 = (Fl_Color) atoi("100");
Fl_Color c2 = (Fl_Color) atoi("200");
Fl::set_color(c1, 204, 255, 204);
Fl::set_color(c2, 153, 255, 153);
Fl_Window *w;
{
Fl_Window *o = Mnb_chr_window = new Fl_Window(0, 40, CHW_W, CHW_H);
w = o;
o->color(c1);
{
Fl_Group *o = Mnb_chr_gp = new Fl_Group(0, 0, CHW_W, CHW_H);
o->color(c1);
{
Fl_Input *o = Mnb_name_in =
new Fl_Input(3 * CHW_W / 10, 0, CHW_W / 2, CHW_H / 10,
"用户名 ");
o->color(255);
o->box(FL_BORDER_BOX);
o->labelsize(10);
o->value(USERNAME);
o->deactivate();
}
{
Fl_Input *o = Mnb_addr_in =
new Fl_Input(3 * CHW_W / 10, CHW_H / 10 + CHW_H / 50,
CHW_W * 3 / 5, CHW_H / 10,
"邮件地址 ");
o->color(255);
o->box(FL_BORDER_BOX);
o->labelsize(10);
}
{
Fl_Input *o = Mnb_pop_in =
new Fl_Input(3 * CHW_W / 10, CHW_H / 5 + CHW_H / 25,
CHW_W / 2,
CHW_H / 10,
"pop3服务器 ");
o->color(255);
o->box(FL_BORDER_BOX);
o->labelsize(10);
}
{
Fl_Input *o = Mnb_smtp_in = new Fl_Input(3 * CHW_W / 10,
CHW_H * 3 / 10 +
CHW_H * 3 / 50,
CHW_W / 2,
CHW_H / 10,
"smtp服务器 ");
o->color(255);
o->box(FL_BORDER_BOX);
o->labelsize(10);
}
{
Fl_Button *o = Mnb_pp_but =
new Fl_Button(CHW_W * 4 / 5, CHW_H / 5 + CHW_H / 25,
CHW_W / 5,
CHW_H / 10, "\266\313\277\332");
o->color(c2);
o->selection_color(c2);
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback *) cb_Mnb_pp_but);
}
{
Fl_Button *o = Mnb_sp_but = new Fl_Button(CHW_W * 4 / 5,
CHW_H * 3 / 10 +
CHW_H * 3 / 50,
CHW_W / 5,
CHW_H / 10,
"\266\313\277\332");
o->color(c2);
o->selection_color(c2);
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback *) cb_Mnb_sp_but);
}
{
Fl_Input *o = Mnb_num_in = new Fl_Input(3 * CHW_W / 10,
CHW_H * 2 / 5 +
CHW_H * 2 / 25,
CHW_W * 3 / 5,
CHW_H / 10,
"邮件帐号 ");
o->color(255);
o->box(FL_BORDER_BOX);
o->labelsize(10);
}
{
Fl_Input *o = Mnb_pass_in =
new Fl_Secret_Input(3 * CHW_W / 10,
CHW_H / 2 + CHW_H / 10,
CHW_W * 3 / 5, CHW_H / 10,
"密码 ");
o->color(255);
o->box(FL_BORDER_BOX);
o->labelsize(10);
}
{
Fl_Check_Button *o = Mnb_rmbpas_chkbut =
new Fl_Check_Button(CHW_W / 10,
CHW_H * 3 / 5 + CHW_H * 3 / 25,
CHW_W / 10, CHW_W / 10,
"\274\307\327\241\303\334\302\353");
o->color(c1);
o->down_box(FL_DIAMOND_DOWN_BOX);
o->callback((Fl_Callback *) cb_Mnb_rmbpas_chkbut);
}
{
Fl_Check_Button *o = Mnb_delser_chkbut =
new Fl_Check_Button(CHW_W / 2,
CHW_H * 3 / 5 + CHW_H * 3 / 25,
CHW_W / 10, CHW_W / 10,
"\307\345\277\325\267\376\316\361\306\367");
o->color(c1);
o->down_box(FL_DIAMOND_DOWN_BOX);
o->callback((Fl_Callback *) cb_Mnb_delser_chkbut);
}
{
Fl_Check_Button *o = Mnb_onlytpc_chkbut =
new Fl_Check_Button(CHW_W / 10,
CHW_H * 7 / 10 + CHW_H * 3 / 25,
CHW_W / 10, CHW_W / 10,
"\326\273\275\323\312\334\323\312\274\376\261\352\314\342");
o->color(c1);
o->down_box(FL_DIAMOND_DOWN_BOX);
o->callback((Fl_Callback *) cb_Mnb_onlytpc_chkbut);
}
{
Fl_Button *o = Mnb_con_but = new Fl_Button(CHW_W / 15,
CHW_H * 4 / 5 +
CHW_H * 3 / 25,
CHW_W * 2 / 5,
CHW_W * 2 / 25,
"\310\267\310\317");
o->color(c2);
o->selection_color(c2);
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback *) cb_Mnb_con_but);
}
{
Fl_Button *o = Mnb_canc_but = new Fl_Button(CHW_W * 8 / 15,
CHW_H * 4 / 5 +
CHW_H * 3 / 25,
CHW_W * 2 / 5,
CHW_W * 2 / 25,
"\310\241\317\373");
o->color(c2);
o->selection_color(c2);
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback *) cb_Mnb_canc_but);
}
o->end();
}
o->end();
}
w->show();
}
void char_set_begin()
{
Mnb_name_in->value(numset.user);
Mnb_name_in->redraw();
Mnb_name_in->deactivate();
Mnb_addr_in->value(numset.maddr);
Mnb_addr_in->redraw();
Mnb_pop_in->value(numset.pop3);
Mnb_pop_in->redraw();
Mnb_smtp_in->value(numset.smtp);
Mnb_smtp_in->redraw();
Mnb_num_in->value(numset.mnum);
Mnb_num_in->redraw();
Mnb_pass_in->value(numset.passwd);
Mnb_pass_in->redraw();
if (numset.ifrempass == 1)
Mnb_rmbpas_chkbut->value(1);
if (numset.ifemptyserver == 1)
Mnb_delser_chkbut->value(1);
}
int Email_numchr_window(uchar char_set)
{
char_set_flag = char_set;
create_numchr_window();
if (char_set == CHAR_SET) {
char_set_begin();
}
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -