Subversion Repositories Kolibri OS

Rev

Rev 3368 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3368 leency 1
//Leency & SoUrcerer, LGPL
2
 
3
#define CUSTOM 0
4
#define MANUAL 1
5
char checked[3] = { 1, 0 };
6
int use_iconv = 1;
7
 
8
char *text1[] = {"POP server adress:", "POP server port:", "SMTP server adress:", "SMTP server port:", '\0'};
9
 
10
dword mouse_opt;
11
unsigned char POP_server1[128]="pop.server.com";
12
unsigned char POP_server_port1[5]="110";
13
unsigned char SMTP_server1[128]="smtp.server.com";
14
unsigned char SMTP_server_port1[5]="25";
15
edit_box POP_server_box        = {210,190,90 ,0xffffff,0x94AECE,0xffc90E,0xffffff,0,sizeof(POP_server1),#POP_server1,#mouse_opt,0};
16
edit_box POP_server_port_box   = {210,190,115,0xffffff,0x94AECE,0xffc90E,0xffffff,0,5,#POP_server_port1,#mouse_opt,0b1000000000000000};
17
edit_box SMTP_server_box       = {210,190,140,0xffffff,0x94AECE,0xffc90E,0xffffff,0,sizeof(SMTP_server1),#SMTP_server1,#mouse_opt,0};
18
edit_box SMTP_server_port_box  = {210,190,165,0xffffff,0x94AECE,0xffc90E,0xffffff,0,5,#SMTP_server_port1,#mouse_opt,0b1000000000000000};
19
 
20
 
4164 leency 21
void SettingsDialog()
3368 leency 22
{
23
	int key, id;
24
 
25
	POP_server_box.size = strlen(#POP_server1);
26
	POP_server_port_box.size = strlen(#POP_server_port1);
27
	SMTP_server_box.size = strlen(#SMTP_server1);
28
	SMTP_server_port_box.size = strlen(#SMTP_server_port1);
29
 
30
	goto _OPT_WIN;
31
 
32
	loop()
33
	{
34
		switch(WaitEvent())
35
		{
36
			case evMouse:
37
				IF (GetProcessSlot(Form.ID)-GetActiveProcess()!=0) break;
38
				if (checked[1]==0) break;
39
				edit_box_mouse stdcall(#POP_server_box);
40
				edit_box_mouse stdcall(#POP_server_port_box);
41
				edit_box_mouse stdcall(#SMTP_server_box);
42
				edit_box_mouse stdcall(#SMTP_server_port_box);
43
				break;
44
 
45
			case evButton:
46
				id = GetButtonID();
47
				if (id==1) SaveAndExit();
48
				if (id==19) LoginBoxLoop();
49
				if (id==17) || (id==18)
50
				{
51
					if (checked[id-17]==1) break;
52
					checked[0]>
53
					if (checked[1]) POP_server_box.flags = 0b10;
54
					OptionsWindow();
55
				}
56
				if (id==20)
57
				{
58
					if (use_iconv==2) break;
59
					if (use_iconv==1) use_iconv=0; else use_iconv=1;
60
					OptionsWindow();
61
				}
62
				break;
63
 
64
			case evKey:
65
				key = GetKey();
66
 
67
				if (checked[1]==0) break;
68
				if (key==9)
69
				{
70
					if (POP_server_box.flags & 0b10)       { POP_server_box.flags -= 0b10;         POP_server_port_box.flags += 0b10;  } else
71
					if (POP_server_port_box.flags & 0b10)  { POP_server_port_box.flags -= 0b10;    SMTP_server_box.flags += 0b10;      } else
72
					if (SMTP_server_box.flags & 0b10)      { SMTP_server_box.flags -= 0b10;        SMTP_server_port_box.flags += 0b10; } else
73
					if (SMTP_server_port_box.flags & 0b10) { SMTP_server_port_box.flags -= 0b10;   POP_server_box.flags += 0b10;       } else
74
					                                         POP_server_box.flags = 0b10;
75
					OptionsWindow();
76
				}
77
 
78
				EAX=key<<8;
79
				edit_box_key stdcall(#POP_server_box);
80
				edit_box_key stdcall(#POP_server_port_box);
81
				edit_box_key stdcall(#SMTP_server_box);
82
				edit_box_key stdcall(#SMTP_server_port_box);
83
				break;
84
 
85
			case evReDraw: _OPT_WIN:
86
				if !(DefineWindow(OPTIONS_HEADER)) break;
87
				DrawBar(0,0, Form.cwidth, Form.cheight, sc.work);
88
				OptionsWindow();
89
				break;
90
		}
91
	}
92
}
93
 
94
void OptionsWindow()
95
{
96
	#define ELEM_X 25
97
	int i;
98
	DrawBar(0, Form.cheight - 40, Form.cwidth, 1, sc.work_graph);
99
	DrawBar(0, Form.cheight - 40+1, Form.cwidth, 1, LBUMP);
100
	DrawCaptButton(Form.cwidth-79, Form.cheight-32, 70, 25, 19, sc.work_button, sc.work_button_text,"Apply");
101
 
102
	WriteTextB(ELEM_X, 20, 0x90, sc.work_text, "Network settings");
103
	CheckBox(ELEM_X, 45, 12, 12, 17, "Use custom settings", sc.work_graph, sc.work_text, checked[0]);
104
	CheckBox(ELEM_X, 65, 12, 12, 18, "Manual configuration", sc.work_graph, sc.work_text, checked[1]);
105
	for (i=0; i<4; i++)
106
	{
107
		WriteText(ELEM_X+40, i*25+4+POP_server_box.top, 0x80, sc.work_text, text1[i]);
108
		DrawRectangle(POP_server_box.left-1, i*25+POP_server_box.top-1, POP_server_box.width+2, 16, sc.work_graph);
109
	}
110
	edit_box_draw stdcall(#POP_server_box);
111
	edit_box_draw stdcall(#POP_server_port_box);
112
	edit_box_draw stdcall(#SMTP_server_box);
113
	edit_box_draw stdcall(#SMTP_server_port_box);
114
 
115
	WriteTextB(ELEM_X, 205, 0x90, sc.work_text, "MailBox settings");
116
	CheckBox(ELEM_X, 230,12, 12, 20, "Use iconv library for converting text charsets", sc.work_graph, sc.work_text, use_iconv);
117
}