⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plxmms_box.c

📁 mtk wap和mms代码。。适应mtk 25。26平台
💻 C
📖 第 1 页 / 共 5 页
字号:
/***************************************************************************
 *
 *                      Pollex Mobile Platform
 *
 * Copyright (c) 2004 by Pollex Mobile Software Co., Ltd. 
 *                       All Rights Reserved 
 *
 * Module   : 
 *
 * Purpose  : 
 *
\**************************************************************************/
#include "PlxMms_Box.h"
#include "PlxMms_Util.h"
#include "PlxMms_Edit.h"
#include "PlxMms_Obj.h"
#include "DateTimeType.h"
#include "Wgui_status_icons.h"
#include "MessagesMiscell.h"
#include "SettingProfile.h"

/***************************************************************************
* 	                                macro
\**************************************************************************/
//string id
#define MMS_BOX_STR_NOSUB           STR_ID_PLX_MMS_BOX_NOSUB
#define MMS_BOX_STR_NONUM           STR_ID_PLX_MMS_BOX_NONUM

#define MMS_BOX_STR_VIEW            STR_ID_PLX_MMS_BOX_VIEW 
#define MMS_BOX_STR_OBJ             STR_ID_PLX_MMS_BOX_OBJ 
#define MMS_BOX_STR_INFO            STR_ID_PLX_MMS_BOX_INFO
#define MMS_BOX_STR_NUM             STR_ID_PLX_MMS_BOX_NUM
#define MMS_BOX_STR_MMSREPLY        STR_ID_PLX_MMS_BOX_MMSREPLY
#define MMS_BOX_STR_SENDER          STR_ID_PLX_MMS_BOX_SENDER
#define MMS_BOX_STR_ALL             STR_ID_PLX_MMS_BOX_ALL
#define MMS_BOX_STR_SMSREPLY        STR_ID_PLX_MMS_BOX_SMSREPLY
#define MMS_BOX_STR_TRANS           STR_ID_PLX_MMS_BOX_FORWARD
#define MMS_BOX_STR_RECV            STR_ID_PLX_MMS_BOX_RECV
#define MMS_BOX_STR_CANCEL          STR_ID_PLX_MMS_BOX_CANCEL
#define MMS_BOX_STR_DEL             STR_ID_PLX_MMS_BOX_DEL
#define MMS_BOX_STR_DELALL          STR_ID_PLX_MMS_BOX_DELALL
#define MMS_BOX_STR_SEND            STR_ID_PLX_MMS_BOX_SEND
#define MMS_BOX_STR_EDIT            STR_ID_PLX_MMS_BOX_EDIT
#define MMS_BOX_STR_SAVEADDR        STR_ID_PLX_MMS_BOX_SAVEADDR

#define MMS_BOX_STR_VIEWFAIL        STR_ID_PLX_MMS_BOX_OPENFAIL
#define MMS_BOX_STR_DELETED         STR_ID_PLX_MMS_BOX_DELOK
#define MMS_BOX_STR_SENDING         STR_ID_PLX_MMS_BOX_SENDING
#define MMS_BOX_STR_SENDOK          STR_ID_PLX_MMS_BOX_SENDOK
#define MMS_BOX_STR_SENDFAIL        STR_ID_PLX_MMS_BOX_SENDFAILE
#define MMS_BOX_STR_RECVING         STR_ID_PLX_MMS_BOX_RECVING
#define MMS_BOX_STR_RECVFAIL        STR_ID_PLX_MMS_BOX_RECVFAIL
#define MMS_BOX_STR_RECVOK          STR_ID_PLX_MMS_BOX_RECVOK
#define MMS_BOX_STR_FWERR           STR_ID_PLX_MMS_BOX_FWERR
#define MMS_BOX_STR_CANCELFAIL      STR_ID_PLX_MMS_BOX_CANCELFAIL
#define MMS_BOX_STR_DELFAIL         STR_ID_PLX_MMS_BOX_DELFAIL
#define MMS_BOX_STR_REPLYFAIL       STR_ID_PLX_MMS_BOX_REPLYFAIL
#define MMS_BOX_STR_READREPLYFAIL   STR_ID_PLX_MMS_BOX_READREPLYFAIL
#define MMS_BOX_STR_NEWMSG          STR_ID_PLX_MMS_BOX_NEWCOME
#define MMS_BOX_STR_READREPORTFAIL  STR_ID_PLX_MMS_BOX_READREPORTFAIL
#define MMS_BOX_STR_IFSENDREADREPLY STR_ID_PLX_MMS_BOX_IFSENDREADREPLY

#define MMS_BOX_STR_MSGTOOLARGE     STR_ID_PLX_MMS_BOX_MSGTOOLARGE
#define MMS_BOX_STR_EXPIRE          STR_ID_PLX_MMS_BOX_EXPIRE
#define MMS_BOX_STR_NOSPACE         STR_ID_PLX_MMS_BOX_NOSPACE

//id
#define MMS_BOX_MENU_VIEW			0
#define MMS_BOX_MENU_OBJ			1
#define MMS_BOX_MENU_INFO			2
#define MMS_BOX_MENU_NUM			3

#define MMS_BOX_MENU_TRANS			4
#define MMS_BOX_MENU_RECV			5
#define MMS_BOX_MENU_CANCEL			6
#define MMS_BOX_MENU_DEL			7
#define MMS_BOX_MENU_DELALL			8
#define MMS_BOX_MENU_SEND			9
#define MMS_BOX_MENU_EDIT			10

#define MMS_BOX_MENU_MMSREPALL		11
#define MMS_BOX_MENU_MMSREPSENDER	12
#define MMS_BOX_MENU_SMSREPALL		13
#define MMS_BOX_MENU_SMSREPSENDER	14

#define MMS_BOX_MENU_MMSREPLY		15

#define MMS_BOX_MENU_SMSREPLY		16
//#define MMS_BOX_MENU_SAVEADDR		13
//#define MMS_BOX_MENU_SENDER
//#define MMS_BOX_MENU_ALL			1006

//box id
typedef enum
{
    MMS_BOX_INBOX = 1,
    MMS_BOX_OUTBOX,
    MMS_BOX_SENT,
    MMS_BOX_DRAFT,
    MMS_BOX_COUNT
}MMSBOXINDEX;

/***************************************************************************
* 	                            struct
\**************************************************************************/
//struct for message list node
typedef struct tagMmsBoxItem
{
    U8     num[MAX_TO_LEN*2];   //number
    U8     sub[MMS_MAX_SUB_LEN];  //subject
    long   id;                  //message id
    int    status;              //message status
    U16    icon;                //status icon
    BOOL   bEMail;              //the number if a email or a phone number
    struct tagMmsBoxItem* next; //next
}MmsBoxItem;

//struct for box menu handler
typedef struct tagMmsBoxEntryItem
{
    U8             id;      //menu item id
    U16            string;  //menu item string
    U16            icon;    //menu item icon
    PlxMmsEntryPtr entry;   //menu item handler
}MmsBoxEntryItem;

//struct for box menu handler entry table item
typedef struct tagMmsBoxTableItem
{
    U8 index;               //index
    MmsBoxEntryItem* table; //
}MmsBoxTableItem;

//
typedef struct tagMmsBoxCallbackItem
{
    U8 id;
    PlxMmsEntryPtr entry;
}MmsBoxCallbackItem;

//global data for box
typedef struct tagMmsBoxData
{
    void*           mmse;           //mmse handle
    const char*     folder;         //folder name
    
    HDMENU          hMenu;          //box menu
    HDMENU          hMmsMenu;       //submenu for mms reply
//    HDMENU hSmsMenu;
    HDMENU          hReportMenu;    //box menu for delivery report
    MmsBoxEntryItem* cur_menu_entry_table;

    MmsBoxItem*     info_table[MAX_MMS_MESSAGE_COUNT]; //buffer for list
    int             info_count;     //message count
    int             cur_info_index; //selected message index
    MmsBoxItem*     cur_info_item;  //selected message node
    
//    long            id_to_report;   //delivery report id

    //for pubcall
    BOOL bPubCall;
    U16  back_screen;
}MmsBoxData;



static long g_id_to_report = -1;
char g_msg_info_buf[MSG_INFO_BUF_LEN];

/***************************************************************************
* 	                            global
\**************************************************************************/
static MmsBoxData g_box_data;

/***************************************************************************
* 	                        private functions
\**************************************************************************/
static void EnterBoxView(void);
static void EnterBoxObj(void);
static void EnterBoxInfo(void);
static void EnterBoxNum(void);
static void EnterBoxMmsReply(void);
//static void EnterBoxSmsReply(void);
static void EnterBoxTrans(void);
static void EnterBoxRecv(void);
static void EnterBoxCancel(void);
static void EnterBoxDel(void);
static void EnterBoxDelAll(void);
static void EnterBoxSend(void);
//static void EnterBoxSaveAddr(void);
static void EnterBoxEdit(void);
//static void EnterReplySender(void);
//static void EnterReplyAll(void);
//static void EnterReplyMenu(void);
static void EnterMmsReplySender(void);
static void EnterMmsReplyAll(void);
static void EnterSmsReplySender(void);
static void EnterSmsReplyAll(void);

//table for inbox
#if (defined MT6217) || (defined MT6218B) //no sms reply
static const MmsBoxEntryItem g_in_box_entry_table[9] = 
{
    {MMS_BOX_MENU_VIEW,     MMS_BOX_STR_VIEW,       IMG_GLOBAL_L1, EnterBoxView},
    {MMS_BOX_MENU_INFO,     MMS_BOX_STR_INFO,       IMG_GLOBAL_L2, EnterBoxInfo},
    {MMS_BOX_MENU_NUM,      MMS_BOX_STR_NUM,        IMG_GLOBAL_L3, EnterBoxNum},
    {MMS_BOX_MENU_MMSREPLY, MMS_BOX_STR_MMSREPLY,   IMG_GLOBAL_L4, EnterBoxMmsReply},
//    {MMS_BOX_MENU_SMSREPSENDER, MMS_BOX_STR_SMSREPLY,   IMG_GLOBAL_L5, EnterSmsReplySender},
    {MMS_BOX_MENU_TRANS,    MMS_BOX_STR_TRANS,      IMG_GLOBAL_L5, EnterBoxTrans},
    {MMS_BOX_MENU_RECV,     MMS_BOX_STR_RECV,       IMG_GLOBAL_L6, EnterBoxRecv},
    {MMS_BOX_MENU_CANCEL,   MMS_BOX_STR_CANCEL,     IMG_GLOBAL_L7, EnterBoxCancel},
    {MMS_BOX_MENU_DEL,      MMS_BOX_STR_DEL,        IMG_GLOBAL_L8, EnterBoxDel},
    {MMS_BOX_MENU_DELALL,   MMS_BOX_STR_DELALL,     IMG_GLOBAL_L9, EnterBoxDelAll}
};
#else
static const MmsBoxEntryItem g_in_box_entry_table[10] = 
{
    {MMS_BOX_MENU_VIEW,     MMS_BOX_STR_VIEW,       IMG_GLOBAL_L1, EnterBoxView},
    {MMS_BOX_MENU_INFO,     MMS_BOX_STR_INFO,       IMG_GLOBAL_L2, EnterBoxInfo},
    {MMS_BOX_MENU_NUM,      MMS_BOX_STR_NUM,        IMG_GLOBAL_L3, EnterBoxNum},
    {MMS_BOX_MENU_MMSREPLY, MMS_BOX_STR_MMSREPLY,   IMG_GLOBAL_L4, EnterBoxMmsReply},
    {MMS_BOX_MENU_SMSREPSENDER, MMS_BOX_STR_SMSREPLY,   IMG_GLOBAL_L5, EnterSmsReplySender},
    {MMS_BOX_MENU_TRANS,    MMS_BOX_STR_TRANS,      IMG_GLOBAL_L6, EnterBoxTrans},
    {MMS_BOX_MENU_RECV,     MMS_BOX_STR_RECV,       IMG_GLOBAL_L7, EnterBoxRecv},
    {MMS_BOX_MENU_CANCEL,   MMS_BOX_STR_CANCEL,     IMG_GLOBAL_L8, EnterBoxCancel},
    {MMS_BOX_MENU_DEL,      MMS_BOX_STR_DEL,        IMG_GLOBAL_L9, EnterBoxDel},
    {MMS_BOX_MENU_DELALL,   MMS_BOX_STR_DELALL,     IMG_GLOBAL_L10, EnterBoxDelAll}
};
#endif

//table for delivery report
static const MmsBoxEntryItem g_deliveryreport_entry_table[10] = 
{
    {MMS_BOX_MENU_VIEW,     MMS_BOX_STR_VIEW,       IMG_GLOBAL_L1, EnterBoxView},
    {MMS_BOX_MENU_DEL,      MMS_BOX_STR_DEL,        IMG_GLOBAL_L2, EnterBoxDel},
    {MMS_BOX_MENU_DELALL,   MMS_BOX_STR_DELALL,     IMG_GLOBAL_L3, EnterBoxDelAll}
};

//table for outbox
static const MmsBoxEntryItem g_out_box_entry_table[7] =
{
    {MMS_BOX_MENU_VIEW,     MMS_BOX_STR_VIEW,   IMG_GLOBAL_L1, EnterBoxView},
    {MMS_BOX_MENU_INFO,     MMS_BOX_STR_INFO,   IMG_GLOBAL_L2, EnterBoxInfo},
    {MMS_BOX_MENU_TRANS,    MMS_BOX_STR_TRANS,  IMG_GLOBAL_L3, EnterBoxTrans},
    {MMS_BOX_MENU_SEND,     MMS_BOX_STR_SEND,   IMG_GLOBAL_L4, EnterBoxSend},
    {MMS_BOX_MENU_CANCEL,   MMS_BOX_STR_CANCEL, IMG_GLOBAL_L5, EnterBoxCancel},
    {MMS_BOX_MENU_DEL,      MMS_BOX_STR_DEL,    IMG_GLOBAL_L6, EnterBoxDel},
    {MMS_BOX_MENU_DELALL,   MMS_BOX_STR_DELALL, IMG_GLOBAL_L7, EnterBoxDelAll}
};

//table for sentbox
static const MmsBoxEntryItem g_sent_box_entry_table[5] =
{
    {MMS_BOX_MENU_VIEW,     MMS_BOX_STR_VIEW,   IMG_GLOBAL_L1, EnterBoxView},
    {MMS_BOX_MENU_INFO,     MMS_BOX_STR_INFO,   IMG_GLOBAL_L2, EnterBoxInfo},
    {MMS_BOX_MENU_TRANS,    MMS_BOX_STR_TRANS,  IMG_GLOBAL_L3, EnterBoxTrans},
    {MMS_BOX_MENU_DEL,      MMS_BOX_STR_DEL,    IMG_GLOBAL_L4, EnterBoxDel},
    {MMS_BOX_MENU_DELALL,   MMS_BOX_STR_DELALL, IMG_GLOBAL_L5, EnterBoxDelAll}
};

//table draft
static const MmsBoxEntryItem g_draft_box_entry_table[6] =
{
    {MMS_BOX_MENU_VIEW,     MMS_BOX_STR_VIEW,   IMG_GLOBAL_L1, EnterBoxView},
    {MMS_BOX_MENU_INFO,     MMS_BOX_STR_INFO,   IMG_GLOBAL_L2, EnterBoxInfo},
    {MMS_BOX_MENU_EDIT,     MMS_BOX_STR_EDIT,   IMG_GLOBAL_L3, EnterBoxEdit},
    {MMS_BOX_MENU_SEND,     MMS_BOX_STR_SEND,   IMG_GLOBAL_L4, EnterBoxSend},
    {MMS_BOX_MENU_DEL,      MMS_BOX_STR_DEL,    IMG_GLOBAL_L5, EnterBoxDel},
    {MMS_BOX_MENU_DELALL,   MMS_BOX_STR_DELALL, IMG_GLOBAL_L6, EnterBoxDelAll}
};

//table for mms reply
static const MmsBoxEntryItem g_mmsrep_entry_table[2] = 
{
    {MMS_BOX_MENU_MMSREPSENDER, MMS_BOX_STR_SENDER, IMG_GLOBAL_L1, EnterMmsReplySender},
    {MMS_BOX_MENU_MMSREPALL,    MMS_BOX_STR_ALL,    IMG_GLOBAL_L2, EnterMmsReplyAll}
};
/*
//table for sms reply
static const MmsBoxEntryItem g_smsrep_entry_table[2] = 
{
    {MMS_BOX_MENU_SMSREPSENDER, MMS_BOX_STR_SENDER, IMG_GLOBAL_L1, EnterSmsReplySender},
    {MMS_BOX_MENU_SMSREPALL,    MMS_BOX_STR_ALL,    IMG_GLOBAL_L2, EnterSmsReplyAll}
};
*/
/*
static const MmsBoxTableItem g_box_table[MMS_BOX_COUNT] = 
{
    {MMS_BOX_INBOX,     (MmsBoxEntryItem*)g_in_box_entry_table},
    {MMS_BOX_OUTBOX,    (MmsBoxEntryItem*)g_out_box_entry_table},
    {MMS_BOX_SENT,      (MmsBoxEntryItem*)g_sent_box_entry_table},
    {MMS_BOX_DRAFT,     (MmsBoxEntryItem*)g_draft_box_entry_table}
};
*/
//table for menu handler
static const MmsBoxCallbackItem g_box_menu_callback_table[17] = 
{
    {MMS_BOX_MENU_VIEW,         EnterBoxView},
    {MMS_BOX_MENU_OBJ ,         EnterBoxObj},
    {MMS_BOX_MENU_INFO,         EnterBoxInfo},
    {MMS_BOX_MENU_NUM ,         EnterBoxNum},
    {MMS_BOX_MENU_TRANS,        EnterBoxTrans},
    {MMS_BOX_MENU_RECV,         EnterBoxRecv},
    {MMS_BOX_MENU_CANCEL,       EnterBoxCancel},
    {MMS_BOX_MENU_DEL,          EnterBoxDel},
    {MMS_BOX_MENU_DELALL,       EnterBoxDelAll},
    {MMS_BOX_MENU_SEND,         EnterBoxSend},
    {MMS_BOX_MENU_EDIT,         EnterBoxEdit},
    {MMS_BOX_MENU_MMSREPALL,    EnterMmsReplyAll},
    {MMS_BOX_MENU_MMSREPSENDER, EnterMmsReplySender},
    {MMS_BOX_MENU_SMSREPALL,    EnterSmsReplyAll},
    {MMS_BOX_MENU_SMSREPSENDER, EnterSmsReplySender},
    {MMS_BOX_MENU_MMSREPLY,     NULL},
    {MMS_BOX_MENU_SMSREPLY,     EnterSmsReplySender}
};

void SetNewMsgViewIntoInbox(void);

static void         EnterMmsBox(void);
static void         ExitMmsBoxList(void);
static BOOL         GetMmsInfoList(void);
static BOOL         AddListItem(MmsBoxItem* node, BOOL bAtHead);
static void         DelListItem(int index);
static MmsBoxItem*  GetListItem(int index);
static void         ClearList(void);
static void         MmsBoxListHiliteHandler(S32 index);
static S32          MmsBoxListGetItemHint(S32 item_index, UI_string_type *hint_array);
static pBOOL        MmsBoxListGetItemText(S32 item_index, UI_string_type str_buff, 
                                          UI_image_type* img_buff_p, U8 str_img_mask);
static void         EnterMmsBoxListMenu(void);
//static void         ExitMmsBoxListMenu(void);
//static void         MmsReplyHiliteHandler(S32 index);
static void         SendReadReply(void);
static BOOL         WillSendReadReply(void);
static BOOL         CreateBoxMenu(void);

static void         IfSendReadReplyCallback(PLIBEVENT event);
static void         IfDelAllCallback(PLIBEVENT event);
static void         IfDelCallback(PLIBEVENT event);
static void         EmptyMenuEntry(void);
static void			EmptyReportMenuEntry(void);

static int          MmsBoxMenuCallback(HDMENU hDmenu, 
                                       unsigned long id, unsigned long event);
static void         MmsBoxEditCallback(long id);
static BOOL			IsDraftMessageCanSend(long id);


//extern
//extern int          PlxMmsWideCharToUTF8(const char* lpWideCharStr, int cWideCharLen, 
//	                                char* lpUtf8Str, int cUtf8Len);
//extern int          PlxMmsUTF8ToWideChar(const char* lpUtf8Str, int cUtf8Len,
//	                                char* lpWideCharStr, int cWideCharLen);
extern void         RedrawCategory184Screen(void);
extern void         TurnOnBacklight(U8 TimerFlag);
extern void         HideStatusIcon(s16 icon_ID);
extern void         BlinkStatusIcon(s16 icon_ID);
extern U16          GetTotalCallCount(void);
extern void         UpdateStatusIcons(void);
extern void         ShowStatusIcon(s16 icon_ID);
extern void         playRequestedTone(U8 playtone);
extern void         PlxResetNewMmsInd(void);
extern long         PlxGetNewMmsId(void);
extern U8           PlxMmsDelHistoryHdlr(void* in_param);

/***************************************************************************
* 	                        public functions
\**************************************************************************/
/***************************************************************************
* Function	InitMmsBox
* Purpose	Reset global data for box
* Params	
* Return	
* Remarks	
\**************************************************************************/
void InitMmsBox(void)
{
    MMS_Memset((void*)&g_box_data, 0, sizeof(MmsBoxData));
    g_id_to_report = -1;
}

/***************************************************************************
* Function	CreateMmsBox
* Purpose	Entry of Mms box
* Params	mmse   : mmse handle
*           folder : folder name
* Return	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -