📄 sendwinc.c
字号:
priv->bodyText->AddStringEnriched("</excerpt>"); priv->bodyText->CheckFroms(False); priv->bodyText->Defer(False); } // End if we want to display the body priv->msgList.removeAll(); priv->msgList.add(msg); type = SEND_REPLY; Show(); changed = True;//// Move the cursor to the to field// XmProcessTraversal(priv->toText->TextArea(), XmTRAVERSE_CURRENT); BusyCursor(False);} // End Reply/*--------------------------------------------------------------- * Method to forward one or more messages */voidSendWinC::Forward(MsgListC& msgList, Boolean encapsulate){ BusyCursor(True); priv->SetField(priv->toText, NULL); priv->SetField(priv->ccText, NULL); priv->SetField(priv->bccText, NULL); SetOther("");//// Display the subject of the first message// MsgC *msg = msgList[0]; HeaderValC *val = msg->Subject(); StringC text; if ( val ) {//// See if there is an alternate character set. If there is, this header was// RFC1522 encoded.// if ( val->charset ) {//// If the alternate charset is compatible with the text field, display the// decoded value. If the charset is not compatible, display the encoded// value.// if ( CharsetOk(val->charset, priv->subText->Charset()) ) val->GetValueText(text); else text = val->full; } // End if there is an alternate charset else text = val->full;//// Add the (fwd) text if not already present// if ( !text.Contains("(fwd)", IGNORE_CASE) ) { text.Trim(); text += " (fwd)"; } } // End if there is a subject priv->subText->SetString(text);//// Add the messages to the body// priv->bodyText->Defer(True); priv->bodyText->SetTextType(TT_PLAIN); priv->bodyText->Clear();#if 0//// Make this window a digest if we're encapsulating// priv->containerType = encapsulate ? CT_DIGEST : CT_MIXED;#endif//// Add messages to the window// u_int count = msgList.size(); int i=0; for (i=0; i<count; i++) { MsgC *msg = msgList[i]; if ( encapsulate ) priv->ForwardMsgEncap(msg); else priv->ForwardMsgInline(msg); priv->bodyText->AddStringPlain("\n\n"); } // End for each message to be forwarded priv->bodyText->Defer(False);//// Remember these messages// priv->msgList = msgList; type = SEND_FORWARD; Show(); changed = True;//// Move the cursor to the to field// XmProcessTraversal(priv->toText->TextArea(), XmTRAVERSE_CURRENT); BusyCursor(False);} // End Forward/*--------------------------------------------------------------- * Method to resend one or more messages */voidSendWinC::Resend(MsgListC& msgList){ BusyCursor(True); priv->SetField(priv->toText, NULL); priv->SetField(priv->ccText, NULL); priv->SetField(priv->bccText, NULL); SetOther("");//// Display the subject of the first message// MsgC *msg = msgList[0]; HeaderValC *val = msg->Subject(); StringC text; if ( val ) {//// See if there is an alternate character set. If there is, this header was// RFC1522 encoded.// if ( val->charset ) {//// If the alternate charset is compatible with the text field, display the// decoded value. If the charset is not compatible, display the encoded// value.// if ( CharsetOk(val->charset, priv->subText->Charset()) ) val->GetValueText(text); else text = val->full; } // End if there is an alternate charset else text = val->full; } // End if there is a subject priv->subText->SetString(text);//// Remember these messages. Create temporary files for the resend.// priv->msgList = msgList; type = SEND_RESEND; StringC file; u_int count = msgList.size(); int i; for (i=0; i<count; i++) { char *cs = tempnam(NULL, "rsnd."); file = cs; free(cs); MsgC *msg = msgList[i]; if ( msg->WriteFile(file, /*copyHead=*/True, /*allHead=*/True, /*statHead=*/False, /*addBlank=*/True, /*protectFroms=*/False) ) priv->resendFileList.add(file); }//// Display the window and move the cursor to the to field// Show();//// Turn off unnecessary fields. Have to do this after shown to get window// the correct size.// priv->SetResendMode(True); changed = True; XmProcessTraversal(priv->toText->TextArea(), XmTRAVERSE_CURRENT); BusyCursor(False);} // End Resend/*--------------------------------------------------------------- * Determine if this window or any child windows have changed */BooleanSendWinC::Changed(){ if ( changed && !IsEmpty() ) return True;//// See if there are any open edit windows with changes// unsigned count = priv->editWinList.size(); int i=0; for (i=0; i<count; i++) { SendWinC *editWin = (SendWinC *)*priv->editWinList[i]; if ( editWin->IsShown() && editWin->Changed() ) return True; } return False;} // End Changed/*--------------------------------------------------------------- * Method to return body text pointer */MimeRichTextC*SendWinC::BodyText(){ return priv->bodyText;}/*--------------------------------------------------------------- * Method to return current description template */StringC&SendWinC::DescTemplate(){ return priv->descTemplate;}/*--------------------------------------------------------------- * Method to initialize the window from a message file */BooleanSendWinC::LoadFile(const char *name){//// Make sure name is not a directory// if ( IsDir((char*)name) ) { StringC errmsg = name; errmsg += " is a directory."; PopupMessage(errmsg); return False; }//// If the file does not exist, that's bad// if ( access(name, F_OK) != 0 ) { StringC errmsg = name; errmsg += " does not exist."; PopupMessage(errmsg); return False; }//// If the file can't be read, that's bad// if ( access(name, R_OK) != 0 ) { StringC errmsg = name; errmsg += " is not readable."; PopupMessage(errmsg); return False; } BusyCursor(True);//// If clears are not confirmed, clear now.// if ( !ishApp->confPrefs->confirmClearSend ) priv->DoClear(NULL, priv, NULL);//// Create a message from the file// FileMsgC *msg = new FileMsgC(name, 0, -1, False);//// Load the header fields// HeaderC *head = msg->Headers(); HeaderC *fccHead = NULL; Boolean showCc = ishApp->compPrefs->showCc; Boolean showBcc = ishApp->compPrefs->showBcc; Boolean showFcc = ishApp->compPrefs->showFcc; Boolean showOther = ishApp->compPrefs->showOther; while ( head ) { CharC key = head->key; CharC val = head->value->full; if ( key.Equals("Subject", IGNORE_CASE) ) priv->subText->SetString(val); else if ( key.Equals("To", IGNORE_CASE) ) { if ( !priv->toText->IsEmpty() ) priv->toText->AddString(", "); priv->toText->AddString(val); } else if ( key.Equals("Cc", IGNORE_CASE) ) { if ( !priv->ccText->IsEmpty() ) priv->ccText->AddString(", "); priv->ccText->AddString(val); showCc = True; } else if ( key.Equals("Bcc", IGNORE_CASE) ) { if ( !priv->bccText->IsEmpty() ) priv->bccText->AddString(", "); priv->bccText->AddString(val); showBcc = True; } else if ( key.Equals("Fcc", IGNORE_CASE) ) { fccHead = head; // Do this later. Must be done after others } else if ( !key.Equals("Date", IGNORE_CASE) && !key.Equals("X-Mailer", IGNORE_CASE) && !key.Equals("MIME-Version", IGNORE_CASE) && !key.StartsWith("Resent-", IGNORE_CASE) && !key.StartsWith("Content-", IGNORE_CASE) ) { if ( !priv->otherText->IsEmpty() ) priv->otherText->AddString("\n"); priv->otherText->AddString(head->full); showOther = True; } head = head->next; } // End for each header if ( fccHead ) { priv->fccText->SetString(fccHead->value->full); showFcc = True; } XmToggleButtonSetState(priv->optCcTB, showCc, True); XmToggleButtonSetState(priv->optBccTB, showBcc, True); XmToggleButtonSetState(priv->optFccTB, showFcc, True); XmToggleButtonSetState(priv->optOtherTB, showOther, True);//// Display the body// MsgPartC *tree = msg->Body(); priv->AddBodyTree(tree); delete msg; BusyCursor(False); return True;} // End LoadFile/*--------------------------------------------------------------- * Method to set the name of the auto-save file */voidSendWinC::SetAutoSaveFile(const char *name){ if ( priv->autoSaveFile.size() > 0 ) unlink(priv->autoSaveFile); priv->autoSaveFile = name;}/*--------------------------------------------------------------- * Method to edit a message with no delivery intended */voidSendWinC::EditMsg(MsgC *msg, Boolean editText, CallbackFn *doneFn, void *userData){ if ( !IsEditOnly() ) return; BusyCursor(True); priv->editDoneCall.Set(doneFn, userData); priv->editMsg = msg; priv->editMsgText = editText;//// Turn on the header text field// XtManageChild(priv->headText->MainWidget()); StringC title; msg->GetSubjectText(title); XtVaSetValues(*this, XmNtitle, (char*)title, NULL);//// Show the headers// StringC textStr; msg->GetHeaderText(textStr); priv->headText->SetString(textStr);//// Show the body// priv->DisplayBody(msg, editText); priv->UpdateEditButtons(); BusyCursor(False);} // End EditMsg/*--------------------------------------------------------------- * Method to receive notice that a message has been deleted */voidSendWinC::MessageDeleted(MsgC *msg){ if ( priv->msgList.includes(msg) ) priv->msgList.remove(msg);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -