summaryrefslogtreecommitdiff
path: root/block/include/email-block.h
blob: 60d925ca25b26c0b0686925c8cb319ccb23170cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
/*
 * Copyright 2012  Samsung Electronics Co., Ltd
 *
 * Licensed under the Flora License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.tizenopensource.org/license
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __DEF_email_block_H_
#define __DEF_email_block_H_

#include <Edje.h>
#include <Elementary.h>
#include <appcore-efl.h>
#include <libintl.h>
#undef _
#include <ui-gadget-module.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <glib.h>
#include <glib-object.h>
#include <Ecore_IMF.h>

#include "email-api.h"
#include "email-types.h"

#include "email-engine.h"
#include "email-debug.h"
#include "email-locale.h"

#define _EDJ(o) elm_layout_edje_get(o)

#define MAX_RECIPIENT_ADDRESS_LEN 234
#define MAX_RECIPIENT_COUNT 50
#define MAX_RECENT_CNT 100
#define MAX_RECENT_MAIL_TO_RETRIEVE 10

#define ICON_PATH IMGDIR
#define EDJ_PATH EDJDIR
#define THEME_PATH EDJ_PATH"/email-setting-theme.edj"
#define EMAIL_BLOCK_THEME_PATH EDJ_PATH"/email-block-theme.edj"

typedef struct ug_data EmailBlockAppData;
struct ug_data {
	Evas *evas;
	Evas_Object *win_main;

	Evas_Object *layout_main;
	Evas_Object *layout_add;
	Evas_Object *layout_crt;
	Evas_Object *layout_edit;
	Evas_Object *timeout_popup;
	Evas_Object *bg;
	Elm_Theme *theme;
	int account_id;
	int mailbox_id;
	char *str_filter_name;

	ui_gadget_h ug;
	ui_gadget_h ug_contact;
	ui_gadget_h ug_group;
	struct ug_cbs cbs;

	Evas_Object *main_box;
	Evas_Object *gl_addrs;
	Evas_Object *gl_subject;
	Evas_Object *gl_string;
	Evas_Object *gl_edit;
	Evas_Object *gl_add_filter;
	Evas_Object *navi_bar;
	Evas_Object *control_bar;
	Evas_Object *control_bar_add;
	Evas_Object *control_bar_edit;
	Evas_Object *segment;
	Evas_Object *segment_layout;
	Evas_Object *noc;
	Evas_Object *noc_ly;
	Evas_Object *sub_ly;

	email_rule_t *rule_list;
	Elm_Genlist_Item_Class itc_block;
	Elm_Genlist_Item_Class itc_del;
	Elm_Genlist_Item_Class itc1;
	Elm_Genlist_Item_Class itc2;
	Elm_Genlist_Item_Class itc3;
	Elm_Genlist_Item_Class itc4;
	Elm_Genlist_Item_Class itc5;

	int match_crt;
	int update_filter_id;
	int delete_filter_id;

	Evas_Object *l_button;
	Evas_Object *r_button;
	Evas_Object *l_button2;
	Evas_Object *r_button2;
	Evas_Object *l_button3;
	Evas_Object *r_button3;
	Evas_Object *l_button4;
	Evas_Object *r_button4;
	Evas_Object *add_button;
	Evas_Object *edit_button;
	Evas_Object *del_button;
	Evas_Object *back_btn_add;
	Evas_Object *add_icon;
	Evas_Object *edit_icon;
	Evas_Object *del_icon;
	Evas_Object *select_all_layout;
	Evas_Object *select_all_checkbox;
	Evas_Object *recent_lbutton;

	Evas_Object *scr_add;
	Evas_Object *scr_crt;
	Evas_Object *filter_box;
	Evas_Object *box_crt;
	Evas_Object *dg_crt;
	Evas_Object *df_filter_name;
	Evas_Object *df_match;
	Evas_Object *ef_match;
	Evas_Object *ef_filter_name;
	Evas_Object *entry_filter_name;
	Evas_Object *di_btns;
	Evas_Object *layout_btn;
	Evas_Object *group_btn;
	Evas_Object *contact_btn;
	Evas_Object *recent_btn;
	Evas_Object *waiting_popup;
	email_mail_list_item_t *recent_mail_data;
	Ecore_Timer *recent_timer;
	Evas_Object *di_crt1;
	Evas_Object *di_crt2;
	Evas_Object *di_crt_rd1;
	Evas_Object *di_crt_rd2;
	Evas_Object *sp1;
	Evas_Object *sp2;
	Evas_Object *sp_crt;
	Evas_Object *popup_empty;
	Evas_Object *recent_genlist;
	Evas_Object *block_recent_select_all_layout;
	Evas_Object *recent_box;
	Evas_Object *block_recent_select_all_checkbox;
	Evas_Object *block_select_all_layout;
	Evas_Object *no_content;
	Evas_Object *recent_select_info;
	Evas_Object *edit_select_info;
	Evas_Object *recent_select_info_ly;
	Evas_Object *edit_select_info_ly;
	Eina_Bool block_recent_select_all_checked;

	int checked_count;
	int total_count;
	int mode;
	int block_type;
	int edit_filter_id;
	int address_rule_count;
	int subject_rule_count;
	int selected_segment;
	int view_type;
	int b_btn_layout_show;
	int edit_total_count;
	int edit_checked_count;
	Eina_Bool select_all_checked;

	Elm_Object_Item *selected_item;
	Elm_Object_Item * c_item[4];
	Elm_Object_Item * c_item_add[4];
	Elm_Object_Item * c_item_edit[4];
	Elm_Object_Item *del_btn_item;
	Elm_Object_Item *empty_btn_item;

	Elm_Object_Item *navi_main_it;
};

typedef struct {
	gchar email_addr[MAX_RECIPIENT_ADDRESS_LEN];
} EmailList;

typedef struct {
	int selected_email_idx;
	int email_cnt;
	bool is_contact_info;
	gchar *display_name;
	EmailList email_list[MAX_RECIPIENT_COUNT];
} EmailRecipientInfo;

typedef struct {
	email_rule_t *rule;
	Elm_Object_Item *it;
	Eina_Bool checked;
	Evas_Object *genlist;
} ListItemData;

enum {
	TYPE_BLOCK_ADDRESS = 1,
	TYPE_BLOCK_SUBJECT,
	TYPE_BLOCK_STRING,
	TYPE_BLOCK_MAX
};

enum {
	TYPE_MATCH_CRT_INC_ON = 1,
	TYPE_MATCH_CRT_WHOLE_ON,
	TYPE_MATCH_CRT_MAX
};

enum {
	BLOCK_MODE_ADD = 1,
	BLOCK_MODE_EDIT,
	BLOCK_MODE_MAX
};

enum {
	VIEW_BLOCK_MAIN = 1,
	VIEW_BLOCK_FILTER_DATA_SET,
	VIEW_BLOCK_CRITERIA_SET,
	VIEW_BLOCK_EDIT_FILTER_LIST,
	VIEW_BLOCK_RECENT_ADD,
	VIEW_BLOCK_CONTACT_ADD,
	VIEW_BLOCK_MAX
};

typedef struct _Item_Data Item_Data;
typedef struct _View_Data View_Data;

struct _View_Data {
	Evas_Object *select_all_layout;
	Evas_Object *select_all_checkbox;
	Eina_Bool select_all_checked;
	int total_count;
	int checked_count;
};

struct _Item_Data {
	Elm_Object_Item *it;	/* Genlist Item pointer */
	Eina_Bool checked;	/* Check status */
	char *address;
};

#endif	/* __DEF_email_block_H__ */

/* EOF */