2 * Copyright 2012 Samsung Electronics Co., Ltd
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
8 * http://www.tizenopensource.org/license
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.
17 #ifndef __DEF_email_composer_type_H_
18 #define __DEF_email_composer_type_H_
23 #include <glib-object.h>
24 #include <Elementary.h>
29 #include <Efreet_Mime.h>
30 #include <Ecore_IMF.h>
31 #include <Ecore_File.h>
33 #include <email-api.h>
35 #include "email-debug.h"
37 #define MYFILE_IMGE_PATH "/usr/apps/org.tizen.myfile/res/images"
38 #define UG_MYFILE_PATH DIR_DEFAULT_MEDIA_PHONE
39 #define COMPOSER_EDJ_NAME EDJDIR"/email-composer-view.edj"
41 #define EMAIL_TMP_FOLDER DIR_TMP_PREFIX"/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
47 #define COMPOSER_ORINGIN_HTML_STR N_("Original mail.htm")
49 #define MAX_STR_LEN 1024
51 #define MAX_ACCOUNT 10
52 #define MAX_ACCOUNT_NAME_LEN 64
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
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
64 #define CONV_THUMB_WIDTH 250
65 #define CONV_THUMB_HEIGHT 170
67 #define ATTACHMENT_MEDIA_FOLDER_NAME "media"
68 #define ATTACHMENT_MMC_FOLDER_NAME "storage"
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"
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"
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"
89 gchar email_addr[MAX_RECIPIENT_ADDRESS_LEN]; /* Specific email address of recipient */
94 int selected_email_idx;
99 gchar *display_name; /* Specific display name of recipient */
100 EmailList email_list[MAX_RECIPIENT_COUNT];
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;
124 COMPOSER_ATTACHMENT_ITEM_IMAGE,
125 COMPOSER_ATTACHMENT_ITEM_SOUND,
126 COMPOSER_ATTACHMENT_ITEM_VIDEO,
127 COMPOSER_ATTACHMENT_ITEM_ETC,
128 } EmailComposerAttachmentType;
131 COMPOSER_ERROR_NONE = 0,
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,
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,
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_STORAGE_FULL = -18,
153 } COMPOSER_ERROR_TYPE_E;
156 COMPOSER_FOCUS_STATUS_NONE = 1 << 0,
157 COMPOSER_FOCUS_STATUS_SELECTED = 1 << 1,
158 COMPOSER_FOCUS_STATUS_ON_PAUSE = 1 << 2,
159 COMPOSER_FOCUS_STATUS_MAX = 1 << 3,
160 } COMPOSER_FOCUS_STATUS_TYPE;
162 typedef struct _EmailComposerAccount EmailComposerAccount;
163 typedef struct _EmailComposerMailbox EmailComposerMailbox;
164 typedef struct _EmailComposerMail EmailComposerMail;
166 struct _EmailComposerAccount {
171 Evas_Object *account_rdg;
172 Evas_Object *account_rd[MAX_ACCOUNT];
173 email_account_t *account_list;
174 email_account_t *account;
177 struct _EmailComposerMailbox {
179 email_mailbox_t *mail_box;
182 struct _EmailComposerMail {
183 email_mail_data_t *mail_data;
184 email_attachment_data_t *attachment_list;
188 int storage_type; /* the storage_type */
189 int contact_index; /* the contact_index */
190 int phone_index; /* the phone_index */
191 char name[256]; /* the name */
192 char phone_number[41]; /* the phone_number */
193 char email[129]; /* the default_email */
197 #define STR_VALID(str) \
198 ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
201 #define STR_INVALID(str) \
202 ((str == NULL || strlen(str) == 0) ? TRUE : FALSE)
205 #define STR_LEN(str) ({ char *s = str; (s) ? strlen(s) : 0; })
208 #define STR_CMP(s1, s2) \
209 (((s1) == NULL || (s2) == NULL) ? FALSE : (g_ascii_strcasecmp(s1, s2) == 0 ? TRUE : FALSE))
212 #define STR_CMP0(s1, s2) \
213 (g_strcmp0(s1, s2) == 0 ? TRUE : FALSE)
216 #define STR_NCMP(s1, s2, n) \
217 (g_ascii_strncasecmp(s1, s2, (gsize)n) == 0 ? TRUE : FALSE)
220 #define STR_CPY(dest, src) \
224 #define STR_NCPY(dest, src, n) \
225 strncpy(dest, src, n)
228 #define STR_LCPY(dest, src, n) \
229 g_strlcpy(dest, src, n)
232 #define STR_CAT(dest, src) \
236 #define STR_NCAT(dest, src, n) \
237 strncat(dest, src, n)
240 #define STR_LCAT(dest, src, n) \
241 g_strlcat(dest, src, n)
243 #endif /* __DEF_email_composer_type_H__ */