📄 sendinc.c
字号:
/* * $Id: SendInc.C,v 1.4 2000/05/07 12:26:12 fnevgeny Exp $ * * Copyright (c) 1994 HAL Computer Systems International, Ltd. * * HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. * 1315 Dell Avenue * Campbell, CA 95008 * * Author: Greg Hilton * Contributors: Tom Lang, Frank Bieser, and others * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * http://www.gnu.org/copyleft/gpl.html * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#include <config.h>#include "IshAppC.h"#include "SendWinP.h"#include "SendWinC.h"#include "SigPrefC.h"#include "SendIconC.h"#include "MainWinC.h"#include "FolderC.h"#include "MsgC.h"#include "FileChooserWinC.h"#include "QuotedP.h"#include "Base64.h"#include "MimeEncode.h"#include "IncludeWinC.h"#include "Misc.h"#include "FileMisc.h"#include <hgl/MimeRichTextC.h>#include <hgl/WArgList.h>#include <hgl/rsrc.h>#include <hgl/SysErr.h>#include <Xm/SelectioB.h>#include <Xm/Frame.h>#include <Xm/RowColumn.h>#include <Xm/ToggleB.h>#include <errno.h>/*--------------------------------------------------------------- * Callbacks to handle include signature */voidSendWinP::DoIncludeExtPSig(Widget, SendWinP *This, XtPointer){ StringC sigStr = ishApp->sigPrefs->Sig(); This->bodyText->SetTextType(TT_PLAIN); This->bodyText->InsertString(sigStr); This->bodyText->SetTextType(TT_ENRICHED);}voidSendWinP::DoIncludeExtESig(Widget, SendWinP *This, XtPointer){ StringC sigStr = ishApp->sigPrefs->EnrichedSig(); This->bodyText->SetTextType(TT_ENRICHED); This->bodyText->InsertString(sigStr);}voidSendWinP::DoIncludeIntPSig(Widget, SendWinP *This, XtPointer){ StringC sigStr = ishApp->sigPrefs->InternalSig(); This->bodyText->SetTextType(TT_PLAIN); This->bodyText->InsertString(sigStr); This->bodyText->SetTextType(TT_ENRICHED);}voidSendWinP::DoIncludeIntESig(Widget, SendWinP *This, XtPointer){ StringC sigStr = ishApp->sigPrefs->InternalEnrichedSig(); This->bodyText->SetTextType(TT_ENRICHED); This->bodyText->InsertString(sigStr);}/*----------------------------------------------------------------------- * Callbacks used to add multipart containers */voidSendWinP::DoAddAlt(Widget, SendWinP *This, XtPointer){ This->AddContainer(CT_ALTERNATIVE);}voidSendWinP::DoAddDigest(Widget, SendWinP *This, XtPointer){ This->AddContainer(CT_DIGEST);}voidSendWinP::DoAddParallel(Widget, SendWinP *This, XtPointer){ This->AddContainer(CT_PARALLEL);}voidSendWinP::DoAddMixed(Widget, SendWinP *This, XtPointer){ This->AddContainer(CT_MIXED);}/*----------------------------------------------------------------------- * Method used to add a multipart container */voidSendWinP::AddContainer(MimeContentType contType){//// Create a multipart graphic for this container// char *ct; if ( contType == CT_ALTERNATIVE ) ct = "multipart/alternative"; else if ( contType == CT_DIGEST ) ct = "multipart/digest"; else if ( contType == CT_PARALLEL ) ct = "multipart/parallel"; else ct = "multipart/mixed"; SendIconC *icon = new SendIconC(pub, ct); icon->AddDoubleClickCallback((CallbackFn*)OpenPart, this); icon->AddMenuCallback ((CallbackFn*)PostPartMenu, this); bodyText->InsertGraphic(icon);} // End AddContainer/*--------------------------------------------------------------- * Callback to handle include message */voidSendWinP::DoIncludeMsg(Widget, SendWinP *This, XtPointer){//// Prompt for message number// if ( !This->incMsgWin ) { WArgList args; args.Reset(); args.DialogStyle(XmDIALOG_FULL_APPLICATION_MODAL); args.AutoUnmanage(False); This->incMsgWin = XmCreatePromptDialog(*This->pub, "includeMsgWin",ARGS); XtAddCallback(This->incMsgWin, XmNokCallback, (XtCallbackProc)IncludeMsgOk, (XtPointer)This); XtAddCallback(This->incMsgWin, XmNcancelCallback, (XtCallbackProc)IncludeMsgCancel, (XtPointer)This); XtAddCallback(This->incMsgWin, XmNhelpCallback, (XtCallbackProc)HalAppC::DoHelp, (char *) "helpcard");//// Create toggle buttons to choose in-line/icon// Widget frame = XmCreateFrame(This->incMsgWin, "typeFrame", 0,0); Widget radio = XmCreateRadioBox(frame, "typeRadio", 0,0); This->incMsgAsTextTB = XmCreateToggleButton(radio, "incMsgAsTextTB", 0,0); This->incMsgAsIconTB = XmCreateToggleButton(radio, "incMsgAsIconTB", 0,0); XtManageChild(This->incMsgAsTextTB); XtManageChild(This->incMsgAsIconTB); XtManageChild(radio); XtManageChild(frame); XmToggleButtonSetState(This->incMsgAsIconTB, True, True); } // End if dialog needed//// Show the dialog// PopupOver(This->incMsgWin, *This->pub);} // End DoIncludeMsg/*--------------------------------------------------------------- * Callback to finish include message */voidSendWinP::IncludeMsgOk(Widget, SendWinP *This, XtPointer){//// Read number from text field// XmString xmstr; XtVaGetValues(This->incMsgWin, XmNtextString, &xmstr, NULL); char *cs; XmStringGetLtoR(xmstr, XmFONTLIST_DEFAULT_TAG, &cs); StringC numStr(cs); XtFree(cs);//// See if a number was entered// if ( numStr.size() == 0 ) { Widget w = XmSelectionBoxGetChild(This->incMsgWin, XmDIALOG_TEXT); set_invalid(w, True, True); This->pub->PopupMessage("Please enter a message number."); return; }//// Get list of message numbers// StringListC numList; ExtractList(numStr, numList); Boolean error = False; MsgListC& msgList = *ishApp->mainWin->curFolder->msgList; u_int msgCount = msgList.size(); u_int numCount = numList.size(); for (int n=0; n<numCount; n++) {//// See if we can find the message in the current folder// int num = atoi(*numList[n]); MsgC *numMsg = NULL; for (int i=0; !numMsg && i<msgCount; i++) { MsgC *msg = msgList[i]; if ( num == msg->Number() ) numMsg = msg; } if ( !numMsg ) { Widget w = XmSelectionBoxGetChild(This->incMsgWin, XmDIALOG_TEXT); set_invalid(w, True, True); StringC msgStr("Message \""); msgStr += numStr; msgStr += "\" does not exist in the current folder."; This->pub->PopupMessage(msgStr); error = True; } else if ( XmToggleButtonGetState(This->incMsgAsTextTB) ) {//// Read in the text// This->bodyText->SetTextType(TT_PLAIN); StringC body; numMsg->GetBodyText(body); This->bodyText->InsertString(body); This->bodyText->SetTextType(TT_ENRICHED); } // End if message to be included as plain text else {//// Create an icon for this message// SendIconC *icon = new SendIconC(This->pub, numMsg); icon->AddDoubleClickCallback((CallbackFn*)OpenPart, This); icon->AddMenuCallback ((CallbackFn*)PostPartMenu, This); This->bodyText->InsertGraphic(icon); } // End if file not included as plain text } // End for each listed message if ( !error ) XtUnmanageChild(This->incMsgWin);} // End IncludeMsgOk/*--------------------------------------------------------------- * Callback to cancel include message */voidSendWinP::IncludeMsgCancel(Widget, SendWinP *This, XtPointer){ XtUnmanageChild(This->incMsgWin);}/*-----------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -