//AB/ Project Send New Email dialog //AB/ Object prj is a Dialog_Project //AB/ Set ProjectName to "Send New Email dialog" //AB/ Set ProjectFileName to "SendMail.Dg" // Project Object Structure // oSendNewEmailDialog is a ModalPanel // oTabDialog is a TabDialog // oSubjectTabPage is a TabPage // oSubjectForm is a Form // oEditorLabel is a Textbox // oMessageText is a Edit // oMapiDialogCheckbox is a CheckBox // oMapiReturnReceiptCheckbox is a CheckBox // oAddresseeTabPage is a TabPage // oReceiversGrid is a cEntryGrid // oEntryIds is a cEntryIdsArray // oDeleteRowButton is a Button // oNewRowButton is a Button // oResolveNamesButton is a Button // oAttachmentsTabPage is a TabPage // oAttachedFilesGrid is a cAttachFilesGrid // oOpenFileDialog is a OpenDialog // oDeleteRowButton is a Button (Duplicate object name) // oNewRowButton is a Button (Duplicate object name) // oAddFileButton is a Button // oSendButton is a Button // Register all objects Register_Object oAddFileButton Register_Object oAddresseeTabPage Register_Object oAttachedFilesGrid Register_Object oAttachmentsTabPage Register_Object oDeleteRowButton Register_Object oEditorLabel Register_Object oEntryIds Register_Object oMapiDialogCheckbox Register_Object oMapiReturnReceiptCheckbox Register_Object oMessageText Register_Object oNewRowButton Register_Object oOpenFileDialog Register_Object oReceiversGrid Register_Object oResolveNamesButton Register_Object oSendButton Register_Object oSendNewEmailDialog Register_Object oSubjectForm Register_Object oSubjectTabPage Register_Object oTabDialog //AB-StoreTopStart Use ParseFn.Pkg Use MapiSession.Pkg Use cEntryIdsArray.Pkg Use SendNewMail.pkg //AB-StoreTopEnd //AB-IgnoreStart Use DFAllEnt.pkg Use cEntryGrid.pkg Use cAttachFilesGrid.pkg //AB-IgnoreEnd Object oSendNewEmailDialog is a ModalPanel //AB-StoreTopStart Property Handle phoSubject 0 Property Handle phoText 0 Set Extended_Window_Style To WS_EX_TOOLWINDOW False Set Extended_Window_Style To WS_EX_DLGMODALFRAME True //AB-StoreTopEnd Set Label to "Send new mail" Set Size to 242 300 Set Location to 1 1 //AB-DDOStart //AB-DDOEnd Object oTabDialog is a TabDialog Set Size to 202 286 Set Location to 5 5 Object oSubjectTabPage is a TabPage Set Label to "Subject" Set Tab_ToolTip_Value to "Subject and body" Object oSubjectForm is a Form //AB-StoreTopStart Delegate Set phoSubject To Self //AB-StoreTopEnd Set Label to "Subject:" Set Size to 13 244 Set Location to 5 33 Set Label_Col_Offset to 2 Set Label_Justification_Mode to jMode_Right //AB-StoreStart Set Oem_Translate_State To False //**************************************************************************** // Description // This method will erase existing data. // // $Rev History // 21/09/98 VO Module header created //**************************************************************************** Procedure DoEraseAllContents //Set Value Item 0 To "" End_Procedure // DoEraseAllContents //AB-StoreEnd End_Object // oSubjectForm Object oEditorLabel is a Textbox Set Label to "Text:" Set Location to 21 5 Set Size to 10 17 Set TypeFace to "MS Sans Serif" End_Object // oEditorLabel Object oMessageText is a Edit //AB-StoreTopStart Delegate Set phoText To Self //AB-StoreTopEnd Set Size to 135 273 Set Location to 31 5 Set Label_Col_Offset to 2 //AB-StoreStart Set Oem_Translate_State To False Set Text_Limit To 32000 Property String psEditorTextValue Public "" //**************************************************************************** // Description // This method will erase existing data. // // $Rev History // 21/09/98 VO Module header created //**************************************************************************** Procedure DoEraseAllContents // Send Delete_Data // Set psEditorTextValue To "" End_Procedure // DoEraseAllContents //**************************************************************************** // Description // This function will use the Windows API function to copy the data from // the editor window into a DataFlex string. // // $Rev History // 04/25/00 VO Module header created //**************************************************************************** Function EditWindowText Returns String Integer iTextLen iRetval Handle hWnd String sFullText Pointer lpsFullText Get Window_Handle To hWnd If (hWnd <> 0) Begin Move (SendMessage (hWnd, WM_GETTEXTLENGTH, 0, 0)) To iTextLen If (iTextLen <> 0) Begin Increment iTextLen ZeroString iTextLen To sFullText GetAddress Of sFullText To lpsFullText Move (SendMessage (hWnd, WM_GETTEXT, iTextLen, lpsFullText)) To iRetval End End Function_Return sFullText End_Function // EditWindowText //**************************************************************************** // Description // On Deactivating, set property, psEditorTextValue, to DataFlex string // containing actual text of message. // // $Rev History // 04/25/00 VO Module header created //**************************************************************************** Procedure Deactivating String sFullText Handle hWnd Get Window_Handle To hWnd If (hWnd <> 0) Begin Get EditWindowText To sFullText End Set psEditorTextValue To sFullText Forward Send Deactivating End_Procedure // Deactivating //**************************************************************************** // Description // This function will either return the real window contents or the earlier // copied data from the property psEditorTextValue. When the window is // paged we expect the value in the property to be false. // // $Rev History // 05/31/99 VO Module header created //**************************************************************************** Function EditorValue Returns String String sFullText Handle hWnd Get Window_Handle To hWnd If (hWnd <> 0) Begin Get EditWindowText To sFullText End Else Begin Get psEditorTextValue To sFullText End Function_Return sFullText End_Function // EditorValue //AB-StoreEnd End_Object // oMessageText Object oMapiDialogCheckbox is a CheckBox Set Label to "Corrections possible" Set Size to 10 79 Set Location to 170 5 End_Object // oMapiDialogCheckbox Object oMapiReturnReceiptCheckbox is a CheckBox Set Label to "Return receipt" Set Size to 10 61 Set Location to 170 100 End_Object // oMapiReturnReceiptCheckbox //AB-StoreStart //**************************************************************************** // Description // This method will unselect the checkboxes for return receipt and // corrections. // // $Rev History // 06/02/99 VO Module header created //**************************************************************************** Procedure DoEraseAllContents Set Checked_State Of oMapiDialogCheckbox To False Set Checked_State Of oMapiReturnReceiptCheckbox To False End_Procedure // DoEraseAllContents //**************************************************************************** // Description // This message will add the value of the subject form to the current mail // message. // // $Rev History // 12/14/99 VO Module header created //**************************************************************************** Procedure DoAddMessageSubjectToMapiHandler Integer hoMapiSession String sSubject Get Value Of oSubjectForm To sSubject Set psMessageSubject Of hoMapiSession To sSubject End_Procedure // DoAddMessageSubjectToMapiHandler //**************************************************************************** // Description // This message will add the value of the message text property to the // current mail message. // // $Rev History // 12/14/99 VO Module header created //**************************************************************************** Procedure DoAddMessageTextToMapiHandler Integer hoMapiSession String sMessageText Get EditorValue Of oMessageText To sMessageText Set psMessageText Of hoMapiSession To sMessageText End_Procedure // DoAddMessageTextToMapiHandler //**************************************************************************** // Description // This function returns MAPI_DIALOG when the user wants to have the // default MAPI dialog to interact. // // $Rev History // 12/14/99 VO Module header created //**************************************************************************** Function MapiDialogRequested Returns Integer Integer iFlags bMapiDialogChecked Get Checked_State Of oMapiDialogCheckbox To bMapiDialogChecked If (bMapiDialogChecked = Dftrue) Begin Move MAPI_DIALOG To iFlags End Function_Return iFlags End_Function // MapiDialogRequested //**************************************************************************** // Description // This method will set the pbMapiMessageReturnRequest property of the // mapisession object when the checkbox is checked. // // $Rev History // 12/14/99 VO Module header created //**************************************************************************** Procedure DoAddReturnRequestToMapiHandler Integer hoMapiSession Integer bMapiReturnReceiptCheckbox Get Checked_State Of oMapiReturnReceiptCheckbox To bMapiReturnReceiptCheckbox Set pbMapiMessageReturnRequest Of hoMapiSession To bMapiReturnReceiptCheckbox End_Procedure // DoAddReturnRequestToMapiHandler //AB-StoreEnd End_Object // oSubjectTabPage Object oAddresseeTabPage is a TabPage Set Label to "Addressee" Set Tab_ToolTip_Value to "Addressee" Object oReceiversGrid is a cEntryGrid //AB-StoreTopStart Use AddresseeType.Dg //AB-StoreTopEnd Set CurrentCellColor to clYellow Set CurrentRowColor to clLime Set Size to 166 270 Set Location to 5 5 Set Line_Width to 3 0 Set Form_Width item 0 to 111 Set Header_Label item 0 to "Name >>" Set Form_Width item 1 to 110 Set Header_Label item 1 to "E-mail address" Set Form_Width item 2 to 42 Set Header_Label item 2 to "Type >>" //AB-StoreStart Set Select_Mode To No_Select Set Search_Mode To No_Search //**************************************************************************** // Description // This object stores the entry id of each address // // $Rev History // 06/01/99 VO Module header created //**************************************************************************** Object oEntryIds Is A cEntryIdsArray End_Object // oEntryIds //**************************************************************************** // Description // When the user changes something in the first two cells of the grid the // resolved flag (in aux_value of the first column item) is set to false. // // $Rev History // 01/11/99 Cancel underline when changes are detected // 05/31/99 VO Module header created //**************************************************************************** Procedure OnChange Integer iCurrentItem iBaseItem iColumns iEntryIdsItem Get Current_Item To iCurrentItem Get ColumnCount To iColumns If (Mod (iCurrentItem, iColumns) <> 2) Begin Move (iCurrentItem / iColumns) To iBaseItem Get Aux_Value Item iBaseItem To iEntryIdsItem If (iEntryIdsItem <> 0) Begin Send DoDeleteEntryId To oEntryIds iEntryIdsItem Set NameIsResolved Item iBaseItem To -1 End End End_Procedure // OnChange //**************************************************************************** // Description // Flag the current line as resolved or not // // $Rev History // 24/04/00 VO Not longer store status (true/false) but item to the // entryids childobject. // 01-11-99 VO Module header created //**************************************************************************** Procedure Set NameIsResolved Integer iItem Integer iEntryIdsItem If (Aux_Value (Self, iItem) <> iEntryIdsItem Or iEntryIdsItem = 0) Begin Set Aux_Value Item iItem To iEntryIdsItem Set Form_FontUnderline Item iItem To (iEntryIdsItem >= 0) Set Enabled_State Of oSendButton To True End End_Procedure // Set NameIsResolved //**************************************************************************** // Description // This function checks all rows whether they are marked as resolved. It // will return dffalse if not all rows are marked as resolved. // // $Rev History // 04/24/00 VO Module header created //**************************************************************************** Function AllNamesResolved Returns Integer Integer iItems iItem iEntryIdsItem Move (Item_Count (Self) - 1) To iItem For iItem From 0 To iItems Get Aux_Value Item iItem To iEntryIdsItem If (iEntryIdsItem = -1) Begin Function_Return Dffalse End Move (iItem + 2) To iItem Loop Function_Return Dftrue End_Function // AllNamesResolved //**************************************************************************** // Description // This method will popup a list of addressee types when clicked. It will // set Aux_Value of current Addressee to the chosen type and update the cell // with the corresponding value. // // $Rev History // 24/04/00 VO Show the text of the type instead of the type // 17/09/98 VO Module header created //**************************************************************************** Procedure DoSelectAddresseeType Integer iType iCurrentItem hoAddresseeTypePanel Move oAddresseeTypePanel To hoAddresseeTypePanel Send Activate_Column 2 Get Current_Item To iCurrentItem Get Aux_Value Item iCurrentItem To iType Send DoUserSelectType To hoAddresseeTypePanel iType Get ChosenType Of hoAddresseeTypePanel To iType If (iType > 0) Begin Set Aux_Value Item iCurrentItem To iType Case Begin Case (iType = MAPI_TO) Set Value Item iCurrentItem To "TO" Case Break Case (iType = MAPI_CC) Set Value Item iCurrentItem To "CC" Case Break Case (iType = MAPI_BCC) Set Value Item iCurrentItem To "BCC" Case Break Case End End End_Procedure // DoSelectAddresseeType //**************************************************************************** // Description // This method will instruct the grid to either popup the addressbook or // instruct to popup a list of addressee types. // // $Rev History // 17/09/98 VO Module header created //**************************************************************************** Procedure Header_Mouse_Click Integer iItem If (iItem < 2) Begin Send DoSelectReceivers End Else Begin If (iItem = 2) Begin Send DoSelectAddresseeType End End End_Procedure // Header_Mouse_Click //**************************************************************************** // Description // This method will erase existing data in the grid. // // $Rev History // 24/04/00 VO Send delete_data also to the entryids child object // 21/09/98 VO Module header created //**************************************************************************** Procedure DoEraseAllContents Send Delete_Data To oEntryIds Send Delete_Data End_Procedure // DoEraseAllContents //**************************************************************************** // Description // When a row is added to the grid we will default the messagetype to 1. // // $Rev History // 24/04/00 VO Display "TO" instead of "1" // 05/31/99 VO Module header created //**************************************************************************** Procedure DoAddRow Forward Send DoAddRow Set Value Item (Item_Count (Self) - 1) To "TO" Set Aux_Value Item (Item_Count (Self) - 1) To MAPI_TO End_Procedure // DoAddRow //**************************************************************************** // Description // This method will show the VO as resolved. This is done by picking up // VO and address from the properties in oMapiSession and setting the // attributes of the grid cell. // // $Rev History // 01-11-99 VO Module header created //**************************************************************************** Procedure DoShowResolvedName Integer iItem Integer hoMapiSession String sName sAddress sEntryId Integer iEntryIdsItem iLength Get psResolvedName Of hoMapiSession To sName Get psResolvedAddress Of hoMapiSession To sAddress Get psResolvedEntryID Of hoMapiSession To sEntryId Get piResolvedEntryIDLength Of hoMapiSession To iLength Get AddRecipientId Of oEntryIds sEntryId iLength To iEntryIdsItem Set Value Item iItem To sName Set Value Item (iItem + 1) To sAddress Set NameIsResolved Item iItem To iEntryIdsItem End_Procedure // DoShowResolvedName //**************************************************************************** // Description // This method will process each line and check if the VO is a correct // name. // // $Rev History // 05/31/99 VO Module header created //**************************************************************************** Procedure DoResolveNames Integer iItem iItems iRetval bResolved hoMapiSession String sName sAddress Move oMapiSession To hoMapiSession Move (Item_Count (Self) - 1) To iItems For iItem From 0 To iItems Get Aux_Value Item iItem To bResolved If (bResolved = Dffalse) Begin Get Value Item iItem To sName If (sName <> "") Begin Get ResolveName Of hoMapiSession sName 0 To iRetval If (iRetval = SUCCESS_SUCCESS) Begin Send DoShowResolvedName iItem hoMapiSession End Else Begin Get ResolveName Of hoMapiSession sName MAPI_DIALOG To iRetval If (iRetval = SUCCESS_SUCCESS) Begin Send DoShowResolvedName iItem hoMapiSession End Else Begin Set NameIsResolved Item iItem To -1 Get Value Item (iItem + 1) To sAddress Send Stop_Box ("The following entry could not be resolved\n" + sName + "\n" + sAddress) "Resolve names error" End End End End Move (iItem + 2) To iItem Loop End_Procedure // DoResolveNames //AB-StoreEnd End_Object // oReceiversGrid Object oDeleteRowButton is a Button Set Label to "&Delete row" Set Size to 14 60 Set Location to 170 90 //AB-StoreStart //**************************************************************************** // Description // This method will cause the current row to be deleted. // // $Rev History // 05/31/99 VO Module header created //**************************************************************************** Procedure OnClick Send DoDeleteCurrentRow To oReceiversGrid End_Procedure // OnClick //AB-StoreEnd End_Object // oDeleteRowButton Object oNewRowButton is a Button Set Label to "&New row" Set Size to 14 60 Set Location to 170 152 //AB-StoreStart //**************************************************************************** // Description // This method will create a new row at the end of the grid. // // $Rev History // 05/31/99 VO Module header created //**************************************************************************** Procedure OnClick Integer iItems iColumns hoReceiversGrid Move oReceiversGrid To hoReceiversGrid Send DoAddRow To hoReceiversGrid Move (Item_Count (hoReceiversGrid)) To iItems Get ColumnCount Of hoReceiversGrid To iColumns Set Current_Item Of hoReceiversGrid To (iItems - iColumns) End_Procedure // OnClick //AB-StoreEnd End_Object // oNewRowButton Object oResolveNamesButton is a Button Set Label to "&Resolve names" Set Size to 14 60 Set Location to 170 215 //AB-StoreStart //**************************************************************************** // Description // // $Rev History // 05/31/99 VO Module header created //**************************************************************************** Procedure OnClick Send DoResolveNames To oReceiversGrid End_Procedure // OnClick //AB-StoreEnd End_Object // oResolveNamesButton //AB-StoreStart On_Key Key_Ctrl+Key_D Send KeyAction To oDeleteRowButton On_Key Key_Ctrl+Key_N Send KeyAction To oNewRowButton On_Key Key_Ctrl+Key_R Send KeyAction To oResolveNamesButton //**************************************************************************** // Description // This method will add all receivers from the current grid to the // addressbook. // // $Rev History // 23/02/00 Query on resolve question was wrong. Name retrieve should have // been done after resolve again. Done now. // 01/11/99 Resolve names changed // 21/09/98 VO Module header created //**************************************************************************** Procedure DoAddCurrentReceiversToAddressBook Integer hoMapiSession Integer hoReceiversGrid Integer iItems iItem iReceiverType iRetval iEntryIdsItem bResolveNames Integer bAllNamesResolved hoEntryIds iLength String sReceiverName sReceiverAddress sEntryId Send DoClearReceiversList To hoMapiSession Move (Item_Count (hoReceiversGrid) - 1) To iItems If (iItems > 0) Begin Move (oEntryIds (hoReceiversGrid)) To hoEntryIds Get AllNamesResolved Of hoReceiversGrid To bAllNamesResolved If (bAllNamesResolved = Dffalse) Begin Get YesNo_Box "Resolve names?" "Question" MB_DEFBUTTON1 To bResolveNames End For iItem From 0 To iItems Get Value Of hoReceiversGrid Item iItem To sReceiverName Get Aux_Value Of hoReceiversGrid Item iItem To iEntryIdsItem Get Value Of hoReceiversGrid Item (iItem + 1) To sReceiverAddress Get Aux_Value Of hoReceiversGrid Item (iItem + 2) To iReceiverType If (sReceiverName <> "") Begin If (bResolveNames = MBR_YES And iEntryIdsItem = 0) Begin Get ResolveName Of hoMapiSession sReceiverName 0 To iRetval If (iRetval = SUCCESS_SUCCESS) Begin Send DoShowResolvedName To hoReceiversGrid iItem hoMapiSession End Else Begin Get ResolveName Of hoMapiSession sReceiverName MAPI_DIALOG To iRetval If (iRetval = SUCCESS_SUCCESS) Begin Send DoShowResolvedName To hoReceiversGrid iItem hoMapiSession End Else Begin Set NameIsResolved Of hoReceiversGrid Item iItem To -1 Get Value Of hoReceiversGrid Item (iItem + 1) To sReceiverAddress Send Stop_Box ("The following entry could not be resolved\n" + sReceiverName + "\n" + sReceiverAddress) "Resolve names error" End End End Get Value Of hoReceiversGrid Item iItem To sReceiverName Get Value Of hoReceiversGrid Item (iItem + 1) To sReceiverAddress Get ReceiverEntryId Of hoEntryIds Item iEntryIdsItem To sEntryId Get Integer_Value Of hoEntryIds Item (iEntryIdsItem + 1) To iLength Send DoAddReceiver To hoMapiSession iReceiverType sReceiverName sReceiverAddress sEntryId iLength End Move (iItem + 2) To iItem Loop End End_Procedure // DoAddCurrentReceiversToAddressBook //**************************************************************************** // Description // This method makes it possible to select one or more receivers from the // addressbook and add them to the grid. // // $Rev History // 24/04/00 VO Place the text of addresseetype in the column type // instead of the numeric representation. // 18/09/98 VO Module header created //**************************************************************************** Procedure DoSelectReceivers Integer iRetval iReceivers iReceiver iReceiverType iItem hoEntryIds Integer hoMapiSession hoReceiversGrid hoReceiversArray iLength iEntryIdsItem String sReceiverName sReceiverAddress sEntryId Move oMapiSession To hoMapiSession Move oReceiversGrid To hoReceiversGrid Send DoAddCurrentReceiversToAddressBook hoMapiSession hoReceiversGrid Get AddressBook Of hoMapiSession "Select one or more receivers" To iRetval If (iRetval = SUCCESS_SUCCESS) Begin Move (oReceiversArray (hoMapiSession)) To hoReceiversArray Get ReceiverCount Of hoReceiversArray To iReceivers Send DoEraseAllContents To hoReceiversGrid Move (oEntryIds (hoReceiversGrid)) To hoEntryIds For iReceiver From 1 To iReceivers Get ReceiverType Of hoReceiversArray iReceiver To iReceiverType Get ReceiverName Of hoReceiversArray iReceiver To sReceiverName Get ReceiverAddress Of hoReceiversArray iReceiver To sReceiverAddress Get ReceiverEntryId Of hoReceiversArray iReceiver To sEntryId Get ReceiverLength Of hoReceiversArray iReceiver To iLength Get AddRecipientId Of hoEntryIds sEntryId iLength To iEntryIdsItem Send Add_Item To hoReceiversGrid Msg_None sReceiverName Move (Item_Count (hoReceiversGrid) - 1) To iItem Set NameIsResolved Of hoReceiversGrid iItem To iEntryIdsItem Send Add_Item To hoReceiversGrid Msg_None sReceiverAddress Case Begin Case (iReceiverType = MAPI_TO) Send Add_Item To hoReceiversGrid Msg_None "TO" Case Break Case (iReceiverType = MAPI_CC) Send Add_Item To hoReceiversGrid Msg_None "CC" Case Break Case (iReceiverType = MAPI_BCC) Send Add_Item To hoReceiversGrid Msg_None "BCC" Case Break Case End Move (Item_Count (hoReceiversGrid) - 1) To iItem Set Aux_Value Of hoReceiversGrid Item iItem To iReceiverType Set Entry_State Of hoReceiversGrid Item iItem To False Loop Send DoDeleteEmptyRows To hoReceiversGrid Set Dynamic_Update_State Of hoReceiversGrid To True End Else Begin If (iRetval <> MAPI_USER_ABORT) Begin Send Stop_Box ("Error encountered by accessing the MAPI Addressbook, errorcode=" * String (iRetval)) "MAPI Error!" End End End_Procedure // DoSelectReceivers //**************************************************************************** // Description // This method will add the listed receivers to the current mail message. // // $Rev History // 14/09/98 VO Module header created //**************************************************************************** Procedure DoAddReceiversToMapiHandler Integer hoMapiSession Send DoAddCurrentReceiversToAddressBook hoMapiSession (oReceiversGrid (Self)) End_Procedure // DoAddReceiversToMapiHandler //**************************************************************************** // Description // The passed email address will be placed in the list of addressees // // $Rev History // 15-09-99 VO Module header created //**************************************************************************** Procedure DoInitAddresseeList String sEmailName String sEmailAddress Integer iItem hoReceiversGrid Move oReceiversGrid To hoReceiversGrid Send OnClick To oNewRowButton Get Current_Item Of hoReceiversGrid To iItem Set Value Of hoReceiversGrid Item iItem To sEmailName Set Value Of hoReceiversGrid Item (iItem + 1) To sEmailAddress End_Procedure // DoInitAddresseeList //AB-StoreEnd End_Object // oAddresseeTabPage Object oAttachmentsTabPage is a TabPage Set Label to "Attachments" Set Tab_ToolTip_Value to "Attachments" Object oAttachedFilesGrid is a cAttachFilesGrid Set CurrentCellColor to clYellow Set CurrentRowColor to clLime Set Size to 161 270 Set Location to 5 5 Set Line_Width to 2 0 Set Form_Width item 0 to 131 Set Header_Label item 0 to "Files" Set Form_Width item 1 to 131 Set Header_Label item 1 to "Paths" End_Object // oAttachedFilesGrid Object oOpenFileDialog is a OpenDialog Set Dialog_Caption to "Select file(s) to enclose" Set Filter_Index to 2 Set Filter_String to "Zip files|*.zip|All Files|*.*" Set NoChangeDir_State to TRUE End_Object // oOpenFileDialog Object oDeleteRowButton is a Button Set Label to "&Delete row" Set Size to 14 60 Set Location to 170 92 //AB-StoreStart //**************************************************************************** // Description // This method will cause the current row to be deleted // // $Rev History // 05/31/99 VO Module header created //**************************************************************************** Procedure OnClick Send DoDeleteCurrentRow To oAttachedFilesGrid End_Procedure // OnClick //AB-StoreEnd End_Object // oDeleteRowButton Object oNewRowButton is a Button Set Label to "&New row" Set Size to 14 60 Set Location to 170 154 //AB-StoreStart //**************************************************************************** // Description // This method will create a new row at the end of the grid // // $Rev History // 05/31/99 VO Module header created //**************************************************************************** Procedure OnClick Integer iItems iColumns hoAttachedFilesGrid Move oAttachedFilesGrid To hoAttachedFilesGrid Send DoAddRow To hoAttachedFilesGrid Move (Item_Count (hoAttachedFilesGrid)) To iItems Get ColumnCount Of hoAttachedFilesGrid To iColumns Set Current_Item Of hoAttachedFilesGrid To (iItems - iColumns) End_Procedure // OnClick //AB-StoreEnd End_Object // oNewRowButton Object oAddFileButton is a Button Set Label to "&Select file" Set Size to 14 60 Set Location to 170 216 //AB-StoreStart //**************************************************************************** // Description // When the user clicks the button we will open the Windows Common File // dialog and let them select one file. The result is copied into the list // of file(s) to be attached. // // $Rev History // 18/09/98 VO Module header created //**************************************************************************** Procedure OnClick Integer bOpen hoOpenFileDialog hoAttachedFilesGrid String sFileName sDrive sPath Move oOpenFileDialog To hoOpenFileDialog Get Show_Dialog Of hoOpenFileDialog To bOpen If (bOpen = Dftrue) Begin Get File_Name Of hoOpenFileDialog To sFileName If (sFileName <> "") Begin Move oAttachedFilesGrid To hoAttachedFilesGrid Get Parse_Path sFileName To sPath Get Parse_Drive sFileName To sDrive Get Parse_File sFileName To sFileName Send Add_Item To hoAttachedFilesGrid Msg_None sFileName Send Add_Item To hoAttachedFilesGrid Msg_None (sDrive - sPath) Send DoDeleteEmptyRows To hoAttachedFilesGrid Set Dynamic_Update_State Of hoAttachedFilesGrid To True End End End_Procedure // OnClick //AB-StoreEnd End_Object // oAddFileButton //AB-StoreStart //**************************************************************************** // Description // Erases the data from the grid. // // $Rev History // 06/02/99 VO Module header created //**************************************************************************** Procedure DoEraseAllContents Send Delete_Data To oAttachedFilesGrid End_Procedure // DoEraseAllContents On_Key Key_Ctrl+Key_D Send KeyAction To oDeleteRowButton On_Key Key_Ctrl+Key_N Send KeyAction To oNewRowButton On_Key Key_Ctrl+Key_S Send KeyAction To oAddFileButton //**************************************************************************** // Description // This method will add the current list of attachments to the current mail // message. // // $Rev History // 18/09/98 VO Module header created //**************************************************************************** Procedure DoCopyAttachmentsToMapiHandler Integer hoMapiSession Integer iItems iItem iRetval hoAttachedFilesGrid String sFilePath sFileName Move oAttachedFilesGrid To hoAttachedFilesGrid Send DoClearAttachmentsList To hoMapiSession Move (Item_Count (hoAttachedFilesGrid) - 1) To iItems For iItem From 0 To iItems Get Value Of hoAttachedFilesGrid Item iItem To sFileName Increment iItem Get Value Of hoAttachedFilesGrid Item iItem To sFilePath If (sFileName <> "" And sFilePath <> "") Begin If (Right (sFilePath, 1)) Ne (SysConf (Sysconf_Dir_Separator)) Begin Move (sFilePath + SysConf (Sysconf_Dir_Separator)) To sFilePath End Send DoAddAttachment To hoMapiSession (sFilePath - sFileName) sFileName End Loop End_Procedure // DoCopyAttachmentsToMapiHandler //AB-StoreEnd End_Object // oAttachmentsTabPage //AB-StoreStart //**************************************************************************** // Description // This method must be used to collect the data from the tabpages and make // it ready for the new mail message. // // $Rev History // 18/09/98 VO Module header created //**************************************************************************** Procedure DoSendMail Integer bSendDirect Integer iFlags iRetval hoMapiSession hoSubjectTabPage Move oMapiSession To hoMapiSession Move oSubjectTabPage To hoSubjectTabPage If (hoMapiSession = 0) Begin Send Stop_Box "No MAPI session present!" "MAPI Send ERROR!" Procedure_Return End Send DoInit To hoMapiSession Send DoAddMessageSubjectToMapiHandler To hoSubjectTabPage hoMapiSession Send DoAddMessageTextToMapiHandler To hoSubjectTabPage hoMapiSession Send DoAddReceiversToMapiHandler To oAddresseeTabPage hoMapiSession Send DoCopyAttachmentsToMapiHandler To oAttachmentsTabPage hoMapiSession Send DoAddReturnRequestToMapiHandler To hoSubjectTabPage hoMapiSession Get MapiDialogRequested Of hoSubjectTabPage To iFlags Get SendMail Of hoMapiSession iFlags bSendDirect To iRetval If (iRetval <> SUCCESS_SUCCESS) Begin Send Stop_Box ("Mail send failure, errorcode=" * String (iRetval)) "MAPI Send ERROR!" End Else Begin Send Close_Panel End End_Procedure // DoSendMail //**************************************************************************** // Description // This method does forward itself to the oAddresseeTabPage object in which // the addressee is listed. // // $Rev History // 15-09-99 VO Module header created //**************************************************************************** Procedure DoInitAddresseeList String sEmailName String sEmailAddress Send DoInitAddresseeList To oAddresseeTabPage sEmailName sEmailAddress End_Procedure // DoInitAddresseeList //AB-StoreEnd End_Object // oTabDialog Object oSendButton is a Button Set Label to "Send" Set Size to 14 54 Set Location to 210 237 //AB-StoreStart Set Enabled_State To False //**************************************************************************** // Description // Clicking the button results in this message which is passed to the // tabdialog that contains the message information. // // $Rev History // 18/09/98 VO Module header created //**************************************************************************** Procedure OnClick Integer hoMapiSession Move (oMapiSession(Self)) To hoMapiSession If (hoMapiSession > 0) Begin Send DoInit Of hoMapiSession Send DoSendMail Of oTabDialog Dftrue End // If (hoMapiSession > 0) Begin End_Procedure // OnClick //AB-StoreEnd End_Object // oSendButton //AB-StoreStart Set Locate_Mode To Center_On_Parent On_Key kCancel Send Close_Panel //**************************************************************************** // Description // This method can be used to initialize the addresseelist with a // receipient address. //**************************************************************************** Procedure DoInitAddressee String sEmailName String sEmailAddress If (sEmailName <> "" Or sEmailAddress <> "") Begin Send DoInitAddresseeList To oTabDialog sEmailName sEmailAddress End End_Procedure // DoInitAddressee //**************************************************************************** // Description // This method can be called to erase the contents of the whole dialog //**************************************************************************** Procedure DoEraseAllContents Broadcast Recursive Send DoEraseAllContents To oTabDialog Set Enabled_State Of oSendButton To False End_Procedure // DoEraseAllContents //AB-StoreEnd End_Object // oSendNewEmailDialog //AB/ End_Object // prj