📄 readfile.c
字号:
/* * $Id: ReadFile.C,v 1.4 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 "ReadWinP.h"#include "ReadWinC.h"#include "IshAppC.h"#include "MainWinC.h"#include "FolderC.h"#include "MsgC.h"#include "MsgItemC.h"#include "AppPrefC.h"#include "QuickMenu.h"#include "SaveMgrC.h"#include "FolderPrefC.h"#include "PrintWinC.h"#include "PipeWinC.h"#include "sun2mime.h"#include "FileMsgC.h"#include "MsgPartC.h"#include "Misc.h"#include "SafeSystem.h"#include "SendWinC.h"#include "Fork.h"#include <hgl/VBoxC.h>#include <hgl/MimeRichTextC.h>#include <hgl/WArgList.h>#include <hgl/WXmString.h>#include <Xm/PushB.h>#include <sys/stat.h>#include <unistd.h>/*--------------------------------------------------------------- * Callback to handle close from menu */voidReadWinP::DoClose(Widget, ReadWinP *This, XtPointer){ This->pub->Hide(); ishApp->mainWin->MsgVBox().Refresh();}/*--------------------------------------------------------------- * Callback to handle close from window manager */voidReadWinP::DoHide(ReadWinC *This, void*){ This->SetMessage((MsgC*)NULL); ishApp->mainWin->MsgVBox().Refresh();}/*--------------------------------------------------------------- * Callback to read next message */voidReadWinP::DoNext(Widget, ReadWinP *This, XtPointer){ if ( This->pub->fullFunction ) { MsgC *nextMsg = ishApp->mainWin->NextReadable(This->pub->msg); ishApp->DisplayMessage(nextMsg, This->pub->Pinned() ? (ReadWinC*)NULL : This->pub); } else This->pub->parentWin->priv->ShowNext822(This->pub);}/*--------------------------------------------------------------- * Callback to read next unread message */voidReadWinP::DoNextUnread(Widget, ReadWinP *This, XtPointer){ MsgC *nextMsg = ishApp->mainWin->NextUnread(This->pub->msg); ishApp->DisplayMessage(nextMsg, This->pub->Pinned() ? (ReadWinC*)NULL : This->pub);}/*--------------------------------------------------------------- * Callback to read next message with same sender */voidReadWinP::DoNextSender(Widget, ReadWinP *This, XtPointer){ MsgC *nextMsg = ishApp->mainWin->NextSender(This->pub->msg); ishApp->DisplayMessage(nextMsg, This->pub->Pinned() ? (ReadWinC*)NULL : This->pub);}/*--------------------------------------------------------------- * Callback to read next message with same subject */voidReadWinP::DoNextSubject(Widget, ReadWinP *This, XtPointer){ MsgC *nextMsg = ishApp->mainWin->NextSubject(This->pub->msg); ishApp->DisplayMessage(nextMsg, This->pub->Pinned() ? (ReadWinC*)NULL : This->pub);}/*--------------------------------------------------------------- * Callback to read previous message */voidReadWinP::DoPrev(Widget, ReadWinP *This, XtPointer){ if ( This->pub->fullFunction ) { MsgC *prevMsg = ishApp->mainWin->PrevReadable(This->pub->msg); ishApp->DisplayMessage(prevMsg, This->pub->Pinned() ? (ReadWinC*)NULL : This->pub); } else This->pub->parentWin->priv->ShowPrev822(This->pub);}/*--------------------------------------------------------------- * Callback to read previous unread message */voidReadWinP::DoPrevUnread(Widget, ReadWinP *This, XtPointer){ MsgC *prevMsg = ishApp->mainWin->PrevUnread(This->pub->msg); ishApp->DisplayMessage(prevMsg, This->pub->Pinned() ? (ReadWinC*)NULL : This->pub);}/*--------------------------------------------------------------- * Callback to read previous message from same sender */voidReadWinP::DoPrevSender(Widget, ReadWinP *This, XtPointer){ MsgC *prevMsg = ishApp->mainWin->PrevSender(This->pub->msg); ishApp->DisplayMessage(prevMsg, This->pub->Pinned() ? (ReadWinC*)NULL : This->pub);}/*--------------------------------------------------------------- * Callback to read previous message with same subject */voidReadWinP::DoPrevSubject(Widget, ReadWinP *This, XtPointer){ MsgC *prevMsg = ishApp->mainWin->PrevSubject(This->pub->msg); ishApp->DisplayMessage(prevMsg, This->pub->Pinned() ? (ReadWinC*)NULL : This->pub);}/*--------------------------------------------------------------- * Callback to handle display of a recent folders menu */voidReadWinP::RecentListChanged(void*, ReadWinP *This){//// Update the menu only if this window is displayed// if ( This->pub->IsShown() ) This->BuildRecentFolderMenu();}/*------------------------------------------------------------------------ * Method to build the menu of recent folders. */voidReadWinP::BuildRecentFolderMenu(){//// Unmanage existing buttons// WidgetList wlist; Cardinal wcount; XtVaGetValues(fileSaveRecentPD, XmNnumChildren, &wcount, XmNchildren, &wlist, NULL); //if ( wcount > 0 ) XtUnmanageChildren(wlist, wcount);//// Create new buttons// WArgList args; WXmString wstr; u_int count = ishApp->appPrefs->recentFolders.size(); for (int i=0; i<count; i++) { StringC *label = ishApp->appPrefs->recentFolders[i]; wstr = (char*)*label; args.LabelString(wstr);//// Create a button in the menu bar message menu. Re-use one if possible// Widget pb; if ( i < wcount ) { pb = wlist[i]; XtSetValues(pb, ARGS); } else { pb = XmCreatePushButton(fileSaveRecentPD, "recentPB", ARGS); XtAddCallback(pb, XmNactivateCallback, (XtCallbackProc)DoSaveToButton, this); } XtManageChild(pb); } // End for each button to be added EnableButtons(); recentMenuTime = time(0);} // End BuildRecentFolderMenu/*--------------------------------------------------------------- * Callback to handle display of message->save quick pulldown */voidReadWinP::PrepareQuickMenu(Widget cb, ReadWinP *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)DoSaveToButton, (XtCallbackProc)PrepareQuickMenu, This);} // End PrepareQuickMenu/*--------------------------------------------------------------- * Callback to save message */voidReadWinP::DoSave(Widget, ReadWinP *This, XtPointer){ ishApp->saveMgr->SaveMsgToFolder(This->pub->msg, ishApp->saveMgr->curSaveFolder, This->pub->fullFunction && ishApp->appPrefs->deleteSaved);}/*--------------------------------------------------------------- * Callback to handle file-save-to-selected */voidReadWinP::DoSaveSel(Widget, ReadWinP *This, XtPointer){//// Loop through folders// Boolean del = False; // Don't delete until last folder VItemListC& slist = ishApp->mainWin->FolderVBox().SelItems(); u_int scount = slist.size(); for (int s=0; s<scount; s++) { if ( s == scount-1 ) del = This->pub->fullFunction && 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->msg, folder, del); saved = True; } } // End for each open folder } // End for each selected folder} // End DoSaveSel/*--------------------------------------------------------------- * Callback to save message to folder */voidReadWinP::DoSaveTo(Widget, ReadWinP *This, XtPointer){ ishApp->saveMgr->SaveMsgToFolder(This->pub->msg, *This->pub, This->pub->msg->folder && This->pub->msg->folder->writable);}/*--------------------------------------------------------------- * Callback to save message to file */voidReadWinP::DoSaveToFile(Widget, ReadWinP *This, XtPointer){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -