home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / dlghtmmq.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.7 KB  |  166 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. // dlghtmmq.cpp : implementation file
  20. //
  21.  
  22. #include "stdafx.h"
  23. #include "msgcom.h"
  24. #include "dlghtmmq.h"
  25. #include "mailmisc.h"
  26. #include "nethelp.h"
  27. #include "xp_help.h"
  28.  
  29.  
  30. #ifdef _DEBUG
  31. #define new DEBUG_NEW
  32. #undef THIS_FILE
  33. static char THIS_FILE[] = __FILE__;
  34. #endif
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CHtmlMailQuestionDlg dialog
  38.  
  39.  
  40. CHtmlMailQuestionDlg::CHtmlMailQuestionDlg(MSG_Pane* pComposePane, CWnd* pParent /*=NULL*/)
  41.     : CDialog(CHtmlMailQuestionDlg::IDD, pParent)
  42. {
  43.     //{{AFX_DATA_INIT(CHtmlMailQuestionDlg)
  44.     m_nRadioValue = -1;
  45.     //}}AFX_DATA_INIT
  46.     m_pComposePane = pComposePane;
  47. }
  48.  
  49.  
  50. void CHtmlMailQuestionDlg::DoDataExchange(CDataExchange* pDX)
  51. {
  52.     CDialog::DoDataExchange(pDX);
  53.     //{{AFX_DATA_MAP(CHtmlMailQuestionDlg)
  54.     DDX_Radio(pDX, IDC_RADIO1, m_nRadioValue);
  55.     //}}AFX_DATA_MAP
  56. }
  57.  
  58.  
  59. BEGIN_MESSAGE_MAP(CHtmlMailQuestionDlg, CDialog)
  60.     //{{AFX_MSG_MAP(CHtmlMailQuestionDlg)
  61.     ON_BN_CLICKED(IDC_BTN_RECIPIENTS, OnBtnRecipients)
  62.     ON_BN_CLICKED(IDC_HELP_HTMLOK, OnHelp)
  63.     //}}AFX_MSG_MAP
  64. END_MESSAGE_MAP()
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CHtmlMailQuestionDlg message handlers
  68.  
  69. BOOL CHtmlMailQuestionDlg::OnInitDialog() 
  70. {
  71.     CDialog::OnInitDialog();
  72.     m_HTMLComposeAction = MSG_GetHTMLAction(m_pComposePane);
  73.  
  74.     switch(m_HTMLComposeAction)
  75.     {
  76.         case MSG_HTMLUseMultipartAlternative:
  77.             m_nRadioValue = 0;
  78.             break;
  79.  
  80.         case MSG_HTMLConvertToPlaintext:
  81.             m_nRadioValue = 1;
  82.             break;
  83.  
  84.         case MSG_HTMLSendAsHTML:
  85.             m_nRadioValue =2; 
  86.             break;
  87.  
  88.         default://give them the choice to send both up front.
  89.             m_nRadioValue = 0;
  90.  
  91.     }
  92.     
  93.     UpdateData(FALSE);
  94.     return TRUE;  
  95.  
  96. }
  97.  
  98. void CHtmlMailQuestionDlg::OnBtnRecipients() 
  99. {
  100.     MSG_PutUpRecipientsDialog(m_pComposePane,this);
  101. }
  102.  
  103. void CHtmlMailQuestionDlg::OnOK() 
  104. {
  105.     UpdateData();
  106.     //assign the new setting
  107.     switch(m_nRadioValue)
  108.     {
  109.         case 0:
  110.             m_HTMLComposeAction = MSG_HTMLUseMultipartAlternative;
  111.             break;
  112.  
  113.         case 1:
  114.             m_HTMLComposeAction = MSG_HTMLConvertToPlaintext;
  115.             break;
  116.  
  117.         case 2:
  118.             m_HTMLComposeAction = MSG_HTMLSendAsHTML;
  119.             break;
  120.  
  121.         default:
  122.             m_HTMLComposeAction = MSG_HTMLUseMultipartAlternative;
  123.     }
  124.  
  125.     MSG_SetHTMLAction(m_pComposePane, m_HTMLComposeAction);
  126.  
  127.     CDialog::OnOK();
  128. }
  129.  
  130. void CHtmlMailQuestionDlg::OnCancel() 
  131. {
  132.     // TODO: Add extra cleanup here
  133.     
  134.     CDialog::OnCancel();
  135.  
  136. }
  137.  
  138.  
  139. void CHtmlMailQuestionDlg::OnHelp() 
  140. {
  141.     NetHelp(HELP_HTML_MAIL_QUESTION);
  142. }
  143.  
  144.  
  145. int CreateAskHTMLDialog (MSG_Pane* composepane, void* closure)
  146. {
  147.     // TODO: Add your control notification handler code here
  148.     if (!composepane) 
  149.         return 0;
  150.     CWnd *pWnd = NULL;
  151.  
  152.     pWnd = (CWnd*)MSG_GetFEData( composepane );
  153.     CHtmlMailQuestionDlg rHtmlMQDlg(composepane,pWnd);
  154.  
  155.     int ret = rHtmlMQDlg.DoModal();
  156.     
  157.     if (ret == IDOK)
  158.     {
  159.         //do this only if the user clicked the Send button
  160.         return(0);        // return success
  161.     }              
  162.     
  163.     return 1;        // cancel
  164. }
  165.  
  166.