#include #include #include "tlmpmail.h" #include "tlmpmail.m" /* Return the file name specification of an attachement */ PUBLIC const char *ATTACHEMENT::getfname() const { return part.get(); } PUBLIC void ATTACHEMENT::setfname(const char *fname) { part.setfrom (fname); } PUBLIC void ATTACHEMENT::setdescription(const char *desc) { description.setfrom (desc); } PUBLIC void ATTACHEMENT::setmimetype (const char *type) { mimetype.setfrom (type); } PUBLIC const char *ATTACHEMENT::getmimetype() const { return mimetype.get(); } /* Set the official name presented in the mail */ PUBLIC void ATTACHEMENT::setname (const char *_name) { name.setfrom (_name); } /* Return the official name of the attachment (not its filename on disk) By default, return the filename if the user did not entered any name. */ PUBLIC const char *ATTACHEMENT::getname() const { return name.get(); } PUBLIC const char *ATTACHEMENT::getdescription() const { return description.get(); } PRIVATE void ATTACHEMENTS::setfields ( DIALOG &dia, ATTACHEMENT *a, PRIVATE_MESSAGE *msg) { dia.newf_str ("",a->part,40); dia.set_helpdia (*msg); dia.newf_str (NULL,a->name,20); dia.newline(); dia.newf_str (MSG_U(F_DESC,"Description"),a->description,60); dia.gui_dispolast (GUI_H_LEFT,3,GUI_V_CENTER,1); dia.newline(); } PUBLIC int ATTACHEMENTS::edit() { int ret = -1; { // Add few empty entries int nbempty = 0; for (int i=0; igetfname(); if (fname[0] == '\0') nbempty++; } for (; nbempty < 2; nbempty++) add (new ATTACHEMENT); } DIALOG dia; dia.set_formparms ("vtrigger=500 htrigger=800"); dia.newf_info ("",MSG_U(F_FILE,"File to attach")); dia.newf_info ("",MSG_U(F_ANAME,"Suggested name")); dia.newline(); PRIVATE_MESSAGES msgs; dia.settype (DIATYPE_POPUP); int field_attach = dia.getnb(); for (int i=0; isetfname(tb.getitem(0)->get()); dia.reload(field_attach+i*5); } break; } } } }else if (code ==MENU_ACCEPT){ ATTACHEMENTS tmpatt; mailsend_validattach (*this,tmpatt); ret = 0; break; } } for (int i=0; igetfname(); if (fname[0] == '\0'){ remove_del (a); i--; } } return ret; }