fix build break
[apps/core/preloaded/email.git] / composer / include / email-composer-type.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *    http://www.tizenopensource.org/license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __DEF_email_composer_type_H_
18 #define __DEF_email_composer_type_H_
19
20 #include <stdio.h>
21 #include <string.h>
22 #include <stdbool.h>
23 #include <glib-object.h>
24 #include <Elementary.h>
25 #include <Evas.h>
26 #include <Edje.h>
27 #include <Eina.h>
28 #include <E_DBus.h>
29 #include <Efreet_Mime.h>
30 #include <Ecore_IMF.h>
31 #include <Ecore_File.h>
32 #include <vconf.h>
33 #include <email-api.h>
34 #include <contacts-svc.h>
35 #include "email-debug.h"
36
37 #define MYFILE_IMGE_PATH "/opt/apps/org.tizen.myfile/res/images"
38 #define UG_MYFILE_PATH "/opt/media/"
39 #define COMPOSER_EDJ_NAME EDJDIR"/email-composer-view.edj"
40
41 #define EMAIL_TMP_FOLDER "/tmp/email/"
42 #define EMAIL_TMP_FOLDER_PERMISSION 0755
43 #define SAVE_HTML_FILE_NAME "mail.html"
44 #define SAVE_URI EMAIL_TMP_FOLDER"mail.txt"
45 #define THUMBNAIL_SIZE 80
46
47 #define COMPOSER_ORINGIN_HTML_STR N_("Original mail.htm")
48
49 #define MAX_STR_LEN                             1024
50
51 #define MAX_ACCOUNT                             10
52 #define MAX_ACCOUNT_NAME_LEN            64
53
54 #define MAX_RECIPIENT_ADDRESS_LEN       234
55 #define MAX_RECIPIENT_COUNT             100
56 #define MAX_RECIPIENT_ADDRESSES_LEN     (MAX_RECIPIENT_ADDRESS_LEN * MAX_RECIPIENT_COUNT)
57 #define MAX_SUBJECT_LEN                 1024
58
59 #define MAX_BODY_SIZE                           32763
60 #define MAX_ATTACHMENT_ITEM             100
61 #define MAX_ATTACHMENT_SIZE             50 * 1024 * 1024
62 #define MAX_ATTACHMENT_FILE_LEN 1024
63
64 #define CONV_THUMB_WIDTH        250
65 #define CONV_THUMB_HEIGHT 170
66
67 #define ATTACHMENT_MEDIA_FOLDER_NAME    "media"
68 #define ATTACHMENT_MMC_FOLDER_NAME      "storage"
69
70 #define ATTACHMENT_MEDIA_IMAGE          "image"
71 #define ATTACHMENT_MEDIA_VIDEO          "video"
72 #define ATTACHMENT_MEDIA_AUDIO          "audio"
73 #define ATTACHMENT_MEDIA_VCARD          "vcf"
74 #define ATTACHMENT_MEDIA_VCALENDAR      "vcs"
75
76 #define ATTACHMENT_IMAGE_FILE_PATH              IMGDIR"/composer_attachment_image.png"
77 #define ATTACHMENT_AUDIO_FILE_PATH              IMGDIR"/composer_attachment_sound.png"
78 #define ATTACHMENT_VIDEO_FILE_PATH              IMGDIR"/composer_attachment_video.png"
79 #define ATTACHMENT_ETC_FILE_PATH                IMGDIR"/composer_attachment_etc.png"
80 #define ATTACHMENT_VCARD_FILE_PATH              IMGDIR"/composer_attachment_vcard.png"
81 #define ATTACHMENT_VCALENDAR_FILE_PATH          IMGDIR"/composer_attachment_vcalender.png"
82
83 #define EMAIL_THEME_TIZEN_BLACK         "tizen-black"
84 #define EMAIL_THEME_TIZEN_BLACK_HD              "tizen-black-hd"
85 #define EMAIL_THEME_TIZEN_WHITE         "tizen"
86 #define EMAIL_THEME_TIZEN_WHITE_HD              "tizen-hd"
87
88 typedef struct {
89         gchar email_addr[MAX_RECIPIENT_ADDRESS_LEN];    /* Specific email address of recipient */
90         int email_type;
91 } EmailList;
92
93 typedef struct {
94         int selected_email_idx;
95         int email_cnt;
96         bool is_contact_info;
97         bool is_always_bcc;
98         bool is_from_addr;
99         gchar *display_name;    /* Specific display name of recipient */
100         EmailList email_list[MAX_RECIPIENT_COUNT];
101 } EmailRecpInfo;
102
103 typedef enum {
104         EMAIL_THEME_BLACK,
105         EMAIL_THEME_WHITE,
106         EMAIL_THEME_MAX
107 } EmailThemeType;
108
109 typedef enum {
110         EMAIL_COMPOSER_LAUNCH_INLINE_IMAGE,
111         EMAIL_COMPOSER_LAUNCH_GALLERY,
112         EMAIL_COMPOSER_LAUNCH_TAKE_PHOTO,
113         EMAIL_COMPOSER_LAUNCH_RECORD_VIDEO,
114         EMAIL_COMPOSER_LAUNCH_VOICE_RECORDER,
115         EMAIL_COMPOSER_LAUNCH_FILE,
116         EMAIL_COMPOSER_LAUNCH_NAMECARD,
117         EMAIL_COMPOSER_LAUNCH_CALENDAR,
118         EMAIL_COMPOSER_LAUNCH_MEMO,
119         EMAIL_COMPOSER_LAUNCH_MESSAGE_COMPOSER,
120         EMAIL_COMPOSER_LAUNCH_MAX,
121 } EmailComposerLaunchType;
122
123 typedef enum {
124         COMPOSER_ATTACHMENT_ITEM_IMAGE,
125         COMPOSER_ATTACHMENT_ITEM_SOUND,
126         COMPOSER_ATTACHMENT_ITEM_VIDEO,
127         COMPOSER_ATTACHMENT_ITEM_ETC,
128 } EmailComposerAttachmentType;
129
130 typedef enum {
131         COMPOSER_ERROR_NONE = 0,
132
133         COMPOSER_ERROR_FAIL = -1,
134         COMPOSER_ERROR_SEND_FAIL = -2,
135         COMPOSER_ERROR_NULL_POINTER = -3,
136         COMPOSER_ERROR_INVALID_ARG = -4,
137         COMPOSER_ERROR_SERVICE_INIT_FAIL = -5,
138
139         COMPOSER_ERROR_NO_DEFAULT_ACCOUNT = -6,
140         COMPOSER_ERROR_NO_ACCOUNT = -7,
141         COMPOSER_ERROR_NO_ACCOUNT_LIST = -8,
142         COMPOSER_ERROR_INVALID_FILE = -9,
143         COMPOSER_ERROR_INVALID_FILE_SIZE = -10,
144         COMPOSER_ERROR_ETHUMB_FAIL = -11,
145
146         COMPOSER_ERROR_GET_DATA_FAIL = -12,
147         COMPOSER_ERROR_MAKE_MAIL_FAIL= -13,
148         COMPOSER_ERROR_UNKOWN_TYPE = -14,
149         COMPOSER_ERROR_DBUS_FAIL = -15,
150         COMPOSER_ERROR_RECIPIENT_DUPLICATED = -16,
151         COMPOSER_ERROR_ENGINE_INIT_FAILED = -17,
152 } COMPOSER_ERROR_TYPE_E;
153
154 typedef enum {
155         COMPOSER_FOCUS_STATUS_NONE = 1 << 0,
156         COMPOSER_FOCUS_STATUS_SELECTED = 1 << 1,
157         COMPOSER_FOCUS_STATUS_ON_PAUSE = 1 << 2,
158         COMPOSER_FOCUS_STATUS_MAX = 1 << 3,
159 } COMPOSER_FOCUS_STATUS_TYPE;
160
161 typedef struct _EmailComposerAccount EmailComposerAccount;
162 typedef struct _EmailComposerMailbox EmailComposerMailbox;
163 typedef struct _EmailComposerMail EmailComposerMail;
164
165 struct _EmailComposerAccount {
166         int account_id;
167         int account_count;
168         int account_type;
169         char *account_name;
170         Evas_Object *account_rdg;
171         Evas_Object *account_rd[MAX_ACCOUNT];
172         email_account_t *account_list;
173         email_account_t *account;
174 };
175
176 struct _EmailComposerMailbox {
177         int mailbox_id;
178         email_mailbox_t *mail_box;
179 };
180
181 struct _EmailComposerMail {
182         email_mail_data_t *mail_data;
183         email_attachment_data_t *attachment_list;
184 };
185
186 typedef struct {
187         int storage_type;       /* the storage_type */
188         int contact_index;      /* the contact_index */
189         int phone_index;        /* the phone_index */
190         char name[256];         /* the name */
191         char phone_number[41];  /* the phone_number */
192         char email[129];        /* the default_email */
193 } contactui_info_t;
194
195 #undef STR_VALID
196 #define STR_VALID(str) \
197                 ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
198
199 #undef STR_INVALID
200 #define STR_INVALID(str) \
201                 ((str == NULL || strlen(str) == 0) ? TRUE : FALSE)
202
203 #undef STR_LEN
204 #define STR_LEN(str)    ({ char *s = str; (s) ? strlen(s) : 0; })
205
206 #undef STR_CMP
207 #define STR_CMP(s1, s2) \
208                 (((s1) == NULL || (s2) == NULL) ? FALSE : (g_ascii_strcasecmp(s1, s2) == 0 ? TRUE : FALSE))
209
210 #undef STR_CMP0
211 #define STR_CMP0(s1, s2) \
212                 (g_strcmp0(s1, s2) == 0 ? TRUE : FALSE)
213
214 #undef STR_NCMP
215 #define STR_NCMP(s1, s2, n) \
216                 (g_ascii_strncasecmp(s1, s2, (gsize)n) == 0 ? TRUE : FALSE)
217
218 #undef STR_CPY
219 #define STR_CPY(dest, src) \
220                 g_stpcpy(dest, src)
221
222 #undef STR_NCPY
223 #define STR_NCPY(dest, src, n) \
224                 strncpy(dest, src, n)
225
226 #undef STR_LCPY
227 #define STR_LCPY(dest, src, n) \
228                 g_strlcpy(dest, src, n)
229
230 #undef STR_CAT
231 #define STR_CAT(dest, src) \
232                 strcat(dest, src)
233
234 #undef STR_NCAT
235 #define STR_NCAT(dest, src, n) \
236                 strncat(dest, src, n)
237
238 #undef STR_LCAT
239 #define STR_LCAT(dest, src, n) \
240                 g_strlcat(dest, src, n)
241
242 #endif                          /* __DEF_email_composer_type_H__ */