⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readpart.c

📁 linux下的E_MAIL客户端源码
💻 C
📖 第 1 页 / 共 3 页
字号:
      else	 statmsg += "\" has arrived.";      if ( This->pub->IsShown() )	 This->pub->PopupMessage(statmsg);      else	 halApp->PopupMessage(statmsg);   } // End if reading window is no longer visible or message has changed//// Save the file name if necessary//   if ( !part->IsMail() && status == 0 ) {      part->dataFile    = data->file;      part->delDataFile = True;//// See if there is a call to make now.  This could be a display or save.//      if ( found ) {	 CallbackC	dummy(NULL, (void*)This);	 if ( data->postFetchCall != dummy )	    data->postFetchCall(icon);	 else	    icon->Unhighlight();      }   }   else if ( found )      icon->Unhighlight();   delete data;   return;} // End FetchDone/*--------------------------------------------------------------- *  Method to display a dialog when there's no mailcap entry for a specified *     type. */voidReadWinP::NoMailcap(ReadIconC *icon){   MsgPartC	*part = icon->part;   static Widget	noMailcapWin = NULL;   if ( !noMailcapWin ) {      pub->BusyCursor(True);      WArgList	args;      args.DialogStyle(XmDIALOG_FULL_APPLICATION_MODAL);      if ( halApp->questionPM ) args.SymbolPixmap(halApp->questionPM);      noMailcapWin = XmCreateQuestionDialog(*pub, "noMailcapWin", ARGS);      Widget textPB = XmCreatePushButton(noMailcapWin, "textPB", 0,0);      XtManageChild(textPB);      XtAddCallback(noMailcapWin, XmNokCallback, (XtCallbackProc)NoMailcapSave,		    (XtPointer)this);      XtAddCallback(noMailcapWin, XmNcancelCallback,		    (XtCallbackProc)NoMailcapCancel, (XtPointer)this);      XtAddCallback(textPB, XmNactivateCallback, (XtCallbackProc)NoMailcapText,		    (XtPointer)this);      XtAddCallback(noMailcapWin, XmNhelpCallback,		    (XtCallbackProc)HalAppC::DoHelp, (char *) "helpcard");      pub->BusyCursor(False);   } // End if dialog not created   noMailcapIcon = icon;//// Build the message string//   StringC	errmsg = "I could not find a mailcap entry for: ";   errmsg += part->conStr;   errmsg += "\nWould you like to save it to a file or display it as text?";   WXmString    wstr = (char *)errmsg;   XtVaSetValues(noMailcapWin, XmNmessageString, (XmString)wstr, NULL);//// Show the dialog//   PopupOver(noMailcapWin, *pub);} // End NoMailcap/*--------------------------------------------------------------- *  Callback to save body part to file when there's no mailcap entry */voidReadWinP::NoMailcapSave(Widget, ReadWinP *This, XtPointer){   This->noMailcapIcon->Unhighlight();   This->popupIcon = This->noMailcapIcon;   DoSavePart(NULL, This, NULL);}/*--------------------------------------------------------------- *  Callback to display body part as text when there's no mailcap entry */voidReadWinP::NoMailcapText(Widget, ReadWinP *This, XtPointer){   This->ShowText(This->noMailcapIcon);}/*--------------------------------------------------------------- *  Callback to cancel body part save when there's no mailcap entry */voidReadWinP::NoMailcapCancel(Widget, ReadWinP *This, XtPointer){   This->noMailcapIcon->Unhighlight();}/*--------------------------------------------------------------- *  Method to query user to see if part should be retrieved */BooleanReadWinP::OkToGet(MsgPartC *part, char *messageString){   static QueryAnswerT	answer;   static Widget	getQueryWin = NULL;//// Create the dialog if necessary//   if ( !getQueryWin ) {      pub->BusyCursor(True);      WArgList	args;      args.DialogStyle(XmDIALOG_FULL_APPLICATION_MODAL);      if ( halApp->questionPM ) args.SymbolPixmap(halApp->questionPM);      Widget	w = XmCreateQuestionDialog(*pub, "getQueryWin", ARGS);      XtAddCallback(w, XmNokCallback, (XtCallbackProc)AnswerQuery,				      (XtPointer)&answer);      XtAddCallback(w, XmNcancelCallback, (XtCallbackProc)AnswerQuery,					  (XtPointer)&answer);      XtAddCallback(w, XmNhelpCallback, (XtCallbackProc)HalAppC::DoHelp,		    (char *) "helpcard");//// Trap window manager close function//      XmAddWMProtocolCallback(XtParent(w), halApp->delWinAtom,			      (XtCallbackProc)WmClose,			      (caddr_t)&answer);      getQueryWin = w;      pub->BusyCursor(False);   } // End if dialog not created//// Insert the file name//   StringC	str = get_string(getQueryWin, messageString, "Retrieve $NAME?");   StringC	name;   part->GetFileName(name);   str.Replace("$NAME", name);   WXmString	wxmstr = (char*)str;   XtVaSetValues(getQueryWin, XmNmessageString, (XmString)wxmstr, NULL);//// Show the dialog//   PopupOver(getQueryWin, *pub);//// Simulate the main event loop and wait for the answer//   answer = QUERY_NONE;   while ( answer == QUERY_NONE ) {      XtAppProcessEvent(halApp->context, XtIMXEvent);      XSync(halApp->display, False);   }   XtUnmanageChild(getQueryWin);   XSync(halApp->display, False);   XmUpdateDisplay(getQueryWin);//// Set state based on user's answer//   return (answer == QUERY_YES);} // End OkToGet/*--------------------------------------------------------------- *  Method to query user to see if mail-server message should be sent */BooleanReadWinP::OkToSend(MsgPartC *part){   static QueryAnswerT	answer;   static Widget	sendQueryWin = NULL;//// Create the dialog if necessary//   if ( !sendQueryWin ) {      pub->BusyCursor(True);      WArgList	args;      args.DialogStyle(XmDIALOG_FULL_APPLICATION_MODAL);      if ( halApp->questionPM ) args.SymbolPixmap(halApp->questionPM);      Widget	w = XmCreateQuestionDialog(*pub, "sendQueryWin", ARGS);      XtAddCallback(w, XmNokCallback, (XtCallbackProc)AnswerQuery,				      (XtPointer)&answer);      XtAddCallback(w, XmNcancelCallback, (XtCallbackProc)AnswerQuery,					  (XtPointer)&answer);      XtAddCallback(w, XmNhelpCallback, (XtCallbackProc)HalAppC::DoHelp,					(char *) "helpcard");//// Trap window manager close function//      XmAddWMProtocolCallback(XtParent(w), halApp->delWinAtom,			      (XtCallbackProc)WmClose,			      (caddr_t)&answer);      sendQueryWin = w;      pub->BusyCursor(False);   } // End if dialog not created//// Add the recipient name//   StringC	label = get_string(sendQueryWin, "messageString",			"Send following message to \"$SERVER\".\n\n$MESSAGE");   ParamC	*server = part->Param("server");   if ( !server ) {      label = "There is no mail server specified for this body part.";      pub->PopupMessage(label);      return False;   }   label.Replace("$SERVER", server->val);//// Add the body//   StringC	body;   part->GetText(body);   int	pos = label.PosOf("$MESSAGE");   if ( pos < 0 ) {      while ( !label.EndsWith("\n\n") ) label += '\n';      label += body;   }   else      label(pos, 8) = body;   WXmString	wxmstr = (char*)label;   XtVaSetValues(sendQueryWin, XmNmessageString, (XmString)wxmstr, NULL);//// Show the dialog//   PopupOver(sendQueryWin, *pub);//// Simulate the main event loop and wait for the answer//   answer = QUERY_NONE;   while ( answer == QUERY_NONE ) {      XtAppProcessEvent(halApp->context, XtIMXEvent);      XSync(halApp->display, False);   }   XtUnmanageChild(sendQueryWin);   XSync(halApp->display, False);   XmUpdateDisplay(sendQueryWin);//// Set state based on user's answer//   return (answer == QUERY_YES);} // End OkToSend/*--------------------------------------------------------------- *  Method to load pixmaps used for file retrieval animation */voidReadWinP::LoadFetchPixmaps(ReadIconC *icon){   if ( fetchPixmaps->size() > 0 ) return;   Window       win = RootWindowOfScreen(halApp->screen);   if ( !win ) return;   StringC	names;   StringListC	nameList;   nameList.AllowDuplicates(TRUE);   names = get_string(*pub, "retrievalPixmaps", "retrieval-0.xbm" );   ExtractList(names, nameList);;   u_int	count = nameList.size();   for (int i=0; i<count; i++) {      StringC	*name = nameList[i];      PixmapC	*pm   = new PixmapC(*name, icon->regFgColor, icon->regBgColor,      					   icon->invFgColor, icon->invBgColor,					   halApp->screen, win);      void	*tmp = (void*)pm;      fetchPixmaps->add(tmp);   }} // End LoadFetchPixmaps/*--------------------------------------------------------------- *  Method to load pixmaps used for part display animation */voidReadWinP::LoadDisplayPixmaps(ReadIconC *icon){   if ( displayPixmaps->size() > 0 ) return;   Window       win = RootWindowOfScreen(halApp->screen);   if ( !win ) return;   StringC	names;   StringListC	nameList;   nameList.AllowDuplicates(TRUE);   names = get_string(*pub, "displayPixmaps", "display-0.xbm" );   ExtractList(names, nameList);;   u_int	count = nameList.size();   for (int i=0; i<count; i++) {      StringC	*name = nameList[i];      PixmapC	*pm   = new PixmapC(*name, icon->regFgColor, icon->regBgColor,      					   icon->invFgColor, icon->invBgColor,					   halApp->screen, win);      void	*tmp = (void*)pm;      displayPixmaps->add(tmp);   }} // End LoadDisplayPixmaps/*--------------------------------------------------------------- *  Method to determine if a fetch is in progress for the specified part */FetchDataT*ReadWinP::FetchData(MsgPartC *part){   u_int	count = fetchDataList->size();   for (int i=0; i<count; i++) {      FetchDataT	*data = (FetchDataT*)*(*fetchDataList)[i];      if ( data->part == part ) return data;   }   return NULL;}/*--------------------------------------------------------------- *  Method to determine if a display is in progress for the specified icon */DisplayDataT*ReadWinP::DisplayData(ReadIconC *icon){   u_int	count = displayDataList.size();   for (int i=0; i<count; i++) {      DisplayDataT	*data = (DisplayDataT*)*displayDataList[i];      if ( data->icon == icon ) return data;   }   return NULL;}/*--------------------------------------------------------------- *  Method to display the next message for a child rfc822 window. */voidReadWinP::ShowNext822(ReadWinC *win){   ReadIconC	*thisIcon = IconWithWin(win);   ReadIconC	*nextIcon = NextReadableIcon(win);   if ( !nextIcon ) return;   if ( thisIcon ) {      thisIcon->msgWin = NULL;      thisIcon->AnimationOff();      thisIcon->Unhighlight();   }   nextIcon->msgWin = win;   nextIcon->Animate(displayPixmaps);   nextIcon->Highlight();   FileMsgC		*msg = nextIcon->part->ChildMsg();   win->SetMessage(msg);} // End ShowNext822/*--------------------------------------------------------------- *  Method to display the previous message for a child rfc822 window. */voidReadWinP::ShowPrev822(ReadWinC *win){   ReadIconC	*thisIcon = IconWithWin(win);   ReadIconC	*prevIcon = PrevReadableIcon(win);   if ( !prevIcon ) return;   if ( thisIcon ) {      thisIcon->msgWin = NULL;      thisIcon->AnimationOff();      thisIcon->Unhighlight();   }   prevIcon->msgWin = win;   prevIcon->Animate(displayPixmaps);   prevIcon->Highlight();   FileMsgC		*msg = prevIcon->part->ChildMsg();   win->SetMessage(msg);} // End ShowPrev822/*--------------------------------------------------------------- *  Method to find the next readable message icon for a child rfc822 window. */ReadIconC*ReadWinP::NextReadableIcon(ReadWinC *win){   ReadIconC	*icon = IconWithWin(win);   if ( !icon ) return NULL;//// Find the next rfc822 part that doesn't have a message window//   MsgPartC	*nextPart = icon->part->next;   ReadIconC	*nextIcon = NULL;   while ( nextPart ) {      if ( nextPart->Is822() ) {	 nextIcon = IconWithPart(nextPart);	 if ( nextIcon && nextIcon->msgWin == NULL )	    return nextIcon;      }      nextPart = nextPart->next;   } // End for each part   return NULL;} // End NextReadableIcon/*--------------------------------------------------------------- *  Method to find the previous readable message icon for a child rfc822 window. */ReadIconC*ReadWinP::PrevReadableIcon(ReadWinC *win){   ReadIconC	*icon = IconWithWin(win);   if ( !icon ) return NULL;//// Find the previous rfc822 part that doesn't have a message window//   MsgPartC	*prevPart = icon->part->prev;   ReadIconC	*prevIcon = NULL;   while ( prevPart ) {      if ( prevPart->Is822() ) {	 prevIcon = IconWithPart(prevPart);	 if ( prevIcon && prevIcon->msgWin == NULL )	    return prevIcon;      }      prevPart = prevPart->prev;   } // End for each part   return NULL;} // End PrevReadableIcon/*--------------------------------------------------------------- *  Method to find the icon that is associated with the given *     reading window */ReadIconC*ReadWinP::IconWithWin(ReadWinC *win){   PtrListC&	list  = msgBodyText->GraphicList();   u_int	count = list.size();   for (int i=0; i<count; i++) {      ReadIconC	*icon  = (ReadIconC*)*list[i];      if ( icon->msgWin == win ) return icon;   }   return NULL;} // End IconWithWin/*--------------------------------------------------------------- *  Method to find the icon that is associated with the given message part */ReadIconC*ReadWinP::IconWithPart(MsgPartC *part){   PtrListC&	list  = msgBodyText->GraphicList();   u_int	count = list.size();   for (int i=0; i<count; i++) {      ReadIconC	*icon  = (ReadIconC*)*list[i];      if ( icon->part == part ) return icon;   }   return NULL;} // End IconWithPart

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -