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

📄 mainmsg.c

📁 linux下的E_MAIL客户端源码
💻 C
📖 第 1 页 / 共 3 页
字号:
/* *  $Id: MainMsg.C,v 1.6 2000/09/19 16:42:02 evgeny 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 "MainWinC.h"#include "MainWinP.h"#include "IshAppC.h"#include "QuickMenu.h"#include "SaveMgrC.h"#include "AppPrefC.h"#include "MsgC.h"#include "MsgItemC.h"#include "MsgStatus.h"#include "UndelWinC.h"#include "FolderC.h"#include "SortMgrC.h"#include "FolderPrefC.h"#include "MsgFindWinC.h"#include "PipeWinC.h"#include "PrintWinC.h"#include "SendWinC.h"#include "MsgListC.h"#include <hgl/WXmString.h>#include <hgl/VBoxC.h>#include <hgl/TBoxC.h>#include <sys/stat.h>/*--------------------------------------------------------------- *  Callbacks to handle message-save */voidMainWinP::DoMsgSave(Widget, MainWinP *This, XtPointer){   ishApp->saveMgr->SaveMsgsToFolder(This->msgVBox->SelItems(),   				     ishApp->saveMgr->curSaveFolder,				     ishApp->appPrefs->deleteSaved);}voidMainWinP::DoMsgPUSave(Widget, MainWinP *This, XtPointer){   if ( This->pub->popupOnSelected )      ishApp->saveMgr->SaveMsgsToFolder(This->msgVBox->SelItems(),					ishApp->saveMgr->curSaveFolder,					ishApp->appPrefs->deleteSaved);   else if ( This->pub->popupMsg )      ishApp->saveMgr->SaveMsgToFolder(This->pub->popupMsg,				       ishApp->saveMgr->curSaveFolder,				       ishApp->appPrefs->deleteSaved);}/*--------------------------------------------------------------- *  Callbacks to handle message-save-to-pattern */voidMainWinP::DoMsgSavePat(Widget, MainWinP *This, XtPointer){   StringC	curSaveFolder = ishApp->saveMgr->curSaveFolder;//// Loop through selected messages and save to the default folder for each//   VItemListC&	list	      = This->msgVBox->SelItems();   u_int	count	      = list.size();   for (int i=0; i<count; i++) {      MsgItemC	*item = (MsgItemC*)list[i];      ishApp->saveMgr->UpdateSaveFolder(item->msg);      ishApp->saveMgr->SaveMsgToFolder(item->msg,				       ishApp->saveMgr->curSaveFolder, False);   }   ishApp->saveMgr->curSaveFolder = curSaveFolder;   if ( ishApp->appPrefs->deleteSaved )      This->pub->DeleteItems(list);} // End DoMsgSavePatvoidMainWinP::DoMsgPUSavePat(Widget, MainWinP *This, XtPointer){   if ( This->pub->popupOnSelected )      DoMsgSavePat(NULL, This, NULL);   else if ( This->pub->popupMsg )      ishApp->saveMgr->SaveMsgToFolder(This->pub->popupMsg,				       ishApp->saveMgr->curSaveFolder,				       ishApp->appPrefs->deleteSaved);}/*--------------------------------------------------------------- *  Callback to handle message-save-to-selected */voidMainWinP::DoMsgSaveSel(Widget, MainWinP *This, XtPointer){//// Temporarily postpone changes to the recent folders menu//   This->deferRecentMenu = True;//// Loop through folders//   Boolean	del    = False;	// Don't delete until last folder   VItemListC&	slist  = This->folderVBox->SelItems();   u_int	scount = slist.size();   for (int s=0; s<scount; s++) {      if ( s == scount-1 ) del = ishApp->appPrefs->deleteSaved;      VItemC	*item = slist[s];//// Find the folder that contains this view item//      Boolean		saved  = False;      FolderListC&	flist = ishApp->folderPrefs->OpenFolders();      u_int		fcount = flist.size();      for (int f=0; !saved && f<fcount; f++) {//// If this folder is selected, save to it//	 FolderC	*folder = flist[f];	 if ( folder->icon == item ) {	    ishApp->saveMgr->SaveMsgsToFolder(This->msgVBox->SelItems(),					      folder, del);	    saved = True;	 }      } // End for each open folder   } // End for each selected folder//// Update recent folder menus now//   This->deferRecentMenu = False;   if ( ishApp->appPrefs->recentFolderTime > This->recentMenuTime )      This->BuildRecentFolderMenus();} // End DoMsgSaveSelvoidMainWinP::DoMsgPUSaveSel(Widget, MainWinP *This, XtPointer){//// Save selected messages to selected folders//   if ( This->pub->popupOnSelected )      DoMsgSaveSel(NULL, This, NULL);   else if ( This->pub->popupMsg ) {//// Temporarily postpone changes to the recent folders menu//      This->deferRecentMenu = True;//// Loop through folders//      Boolean		del    = False;	// Don't delete until last folder      VItemListC&	slist  = This->folderVBox->SelItems();      u_int		scount = slist.size();      for (int s=0; s<scount; s++) {	 if ( s == scount-1 ) del = ishApp->appPrefs->deleteSaved;	 VItemC	*item = slist[s];//// Find the folder that contains this view item//	 Boolean		saved  = False;	 FolderListC&	flist  = ishApp->folderPrefs->OpenFolders();	 u_int		fcount = flist.size();	 for (int f=0; !saved && f<fcount; f++) {//// If this folder is selected, save to it//	    FolderC	*folder = flist[f];	    if ( folder->icon == item ) {	       ishApp->saveMgr->SaveMsgToFolder(This->pub->popupMsg, folder,	       					del);	       saved = True;	    }	 } // End for each open folder      } // End for each selected folder//// Update recent folder menus now//      This->deferRecentMenu = False;      if ( ishApp->appPrefs->recentFolderTime > This->recentMenuTime )	 This->BuildRecentFolderMenus();   } // End if saving popup message} // End DoMsgPUSaveSel/*--------------------------------------------------------------- *  Callback to handle message-save-to */voidMainWinP::DoMsgSaveTo(Widget, MainWinP *This, XtPointer){   ishApp->saveMgr->SaveMsgsToFolder(This->msgVBox->SelItems(), *This->pub,   				     This->pub->curFolder->writable);}voidMainWinP::DoMsgPUSaveTo(Widget, MainWinP *This, XtPointer){   if ( This->pub->popupOnSelected )      ishApp->saveMgr->SaveMsgsToFolder(This->msgVBox->SelItems(), *This->pub,					This->pub->curFolder->writable);   else if ( This->pub->popupMsg )      ishApp->saveMgr->SaveMsgToFolder(This->pub->popupMsg, *This->pub,				       This->pub->curFolder->writable);}voidMainWinP::DoMsgSaveToFile(Widget, MainWinP *This, XtPointer){   ishApp->saveMgr->SaveMsgsToFile(This->msgVBox->SelItems(), *This->pub,				   This->pub->curFolder->writable);}voidMainWinP::DoMsgPUSaveToFile(Widget, MainWinP *This, XtPointer){   if ( This->pub->popupOnSelected )      ishApp->saveMgr->SaveMsgsToFile(This->msgVBox->SelItems(), *This->pub,				      This->pub->curFolder->writable);   else if ( This->pub->popupMsg )      ishApp->saveMgr->SaveMsgToFile(This->pub->popupMsg, *This->pub,				     This->pub->curFolder->writable);}/*--------------------------------------------------------------- *  Callback to handle display of message->save quick pulldown */voidMainWinP::PrepareSaveQuickMenu(Widget cb, MainWinP *This, XtPointer){//// Get the record associated with this cascade button//   QuickInfoT	*data;   XtVaGetValues(cb, XmNuserData, &data, NULL);//// See if the directory has changed since the menu was last built//   struct stat	dstats;   if ( stat(data->dir, &dstats) != 0 || dstats.st_mtime > data->menuTime )      BuildQuickFolderMenu(data, (XtCallbackProc)DoMsgSaveToButton,      			   (XtCallbackProc)PrepareSaveQuickMenu, This);} // End PrepareSaveQuickMenu/*--------------------------------------------------------------- *  Callback to handle display of message->save quick popup */voidMainWinP::PreparePUSaveQuickMenu(Widget cb, MainWinP *This, XtPointer){//// Get the record associated with this cascade button//   QuickInfoT	*data;   XtVaGetValues(cb, XmNuserData, &data, NULL);//// See if the directory has changed since the menu was last built//   struct stat	dstats;   if ( stat(data->dir, &dstats) != 0 || dstats.st_mtime > data->menuTime )      BuildQuickFolderMenu(data, (XtCallbackProc)DoMsgPUSaveToButton,      			   (XtCallbackProc)PreparePUSaveQuickMenu, This);} // End PreparePUSaveQuickMenu/*--------------------------------------------------------------- *  Callbacks to handle message-save recent and quick */voidMainWinP::DoMsgSaveToButton(Widget w, MainWinP *This, XtPointer){//// Get the folder name from the button label//   XmString	xstr;   XtVaGetValues(w, XmNlabelString, &xstr, NULL);   WXmString	wstr(xstr);   char		*cs = wstr;//// If this is a quick-save, we need to build the full pathname//   StringC	name = XtName(w);   if ( name == "quickPB" ) {      QuickInfoT	*cbData;      XtVaGetValues(w, XmNuserData, &cbData, NULL);      name = cbData->dir;      if ( name.size() > 0 ) name += '/';      name += cs;   }   else {      name = cs;   }   ishApp->saveMgr->SaveMsgsToFolder(This->msgVBox->SelItems(), name,				     ishApp->appPrefs->deleteSaved);   XtFree(cs);   XmStringFree(xstr);} // End DoMsgSaveToButtonvoidMainWinP::DoMsgPUSaveToButton(Widget w, MainWinP *This, XtPointer){//// Get the folder name from the button label//   XmString	xstr;   XtVaGetValues(w, XmNlabelString, &xstr, NULL);   WXmString	wstr(xstr);   char		*cs = wstr;//// If this is a quick-save, we need to build the full pathname//   StringC	name = XtName(w);   if ( name == "quickPB" ) {      QuickInfoT	*cbData;      XtVaGetValues(w, XmNuserData, &cbData, NULL);      name = cbData->dir;      if ( name.size() > 0 ) name += '/';      name += cs;   }   else {      name = cs;   }   if ( This->pub->popupOnSelected )      ishApp->saveMgr->SaveMsgsToFolder(This->msgVBox->SelItems(), name,					ishApp->appPrefs->deleteSaved);   else if ( This->pub->popupMsg )      ishApp->saveMgr->SaveMsgToFolder(This->pub->popupMsg, name,				       ishApp->appPrefs->deleteSaved);   XtFree(cs);   XmStringFree(xstr);} // End DoMsgPUSaveToButton/*--------------------------------------------------------------- *  Callbacks to handle message-delete */voidMainWinP::DoMsgDel(Widget, MainWinP *This, XtPointer){   This->pub->DeleteItems(This->msgVBox->SelItems());}voidMainWinP::DoMsgPUDel(Widget, MainWinP *This, XtPointer){   if ( This->pub->popupOnSelected )      This->pub->DeleteItems(This->msgVBox->SelItems());   else if ( This->pub->popupMsg ) {      This->pub->DeleteMsg(This->pub->popupMsg);   }}/*--------------------------------------------------------------- *  Callback to handle message-undelete last */voidMainWinP::DoMsgUndelLast(Widget, MainWinP *This, XtPointer){   This->pub->BusyCursor(True);   This->pub->UndeleteItems(*This->lastDelList);   This->lastDelList->removeAll();   This->pub->Refresh();   This->pub->BusyCursor(False);}/*--------------------------------------------------------------- *  Callback to handle selected-message-undelete */voidMainWinP::DoMsgUndelSel(Widget, MainWinP *This, XtPointer){   This->UndeleteVisible();}/*--------------------------------------------------------------- *  Callback to handle message-undelete from list */voidMainWinP::DoMsgUndelList(Widget, MainWinP *This, XtPointer){   This->UndeleteHidden();}/*--------------------------------------------------------------- *  Callback to handle message-undelete popup */voidMainWinP::DoMsgPUUndel(Widget, MainWinP *This, XtPointer){   if ( This->pub->popupOnSelected ) {      This->UndeleteVisible();   }   else if ( This->pub->popupMsg ) {      This->pub->UndeleteMsg(This->pub->popupMsg);      This->lastDelList->removeAll();      This->pub->Refresh();   }}/*--------------------------------------------------------------- *  Method to undelete selected items */voidMainWinP::UndeleteVisible(){   pub->BusyCursor(True);   ishApp->Broadcast("");//// Update status//   VItemListC&	list = msgVBox->SelItems();   u_int	count = list.size();   for (int i=0; i<count; i++) {      MsgItemC	*item = (MsgItemC*)list[i];      item->msg->ClearDeleted();   }      pub->Refresh();   lastDelList->removeAll();   ishApp->Broadcast("Message(s) restored");   pub->BusyCursor(False);} // End UndeleteVisible/*--------------------------------------------------------------- *  Method to undelete from list */voidMainWinP::UndeleteHidden(){   pub->BusyCursor(True);   ishApp->Broadcast("");//// Create window if necessary//   if ( !ishApp->undelWin ) ishApp->undelWin = new UndelWinC(*ishApp);

⌨️ 快捷键说明

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