📄 task.pas
字号:
(*
# (C) Copyright 2003
# Miha Vrhovnik, miha.vrhovnik@guest.arnes.si
#
# 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.
#
# 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
#
# The Initial Developer of the Original Code is Miha Vrhovnik (Slovenia).
# Portions created by Miha Vrhovnik are Copyright (c)2000-2003.
# All Rights Reserved.
#==============================================================================
# Contributor(s):
#==============================================================================
# History: see whats new.txt from distribution package
#==============================================================================
*)
unit task;
interface
uses Classes, account, mimemess_siMail, SyncObjs;
type TDoWhat = (tdwGetAndLeave, tdwGetAndDelete, tdwDelete, tdwIgnore, tdwGetHeaders);
//frmPreview
type TtaskType = (ttSend, ttFetch, ttFetchHeaders, ttFetchFromPreview);
type TtaskStatus = (tsWaiting, tsWorking, tsComplete, tsError);
type TsizeDescription = (tsdTotal, tsdMessage, tsdUpdate);
//tree type data
type TTreeTask = record
accountID: Integer;
taskID: Integer;
taskType: TtaskType;
status: TtaskStatus;
messageID: array of Integer; //pop3: always nil smtp: contains messageIDs
//this is additional data needed for threads
config: Pointer; //pop3,smtp: this is TAccount
//pop3: when downloading messages which were listed in frmPreview
msgDoWhat: array of TDoWhat;
end;
type PTreeTask = ^TTreeTask;
type
TtaskComm = procedure(Msg: String; err: Boolean) of object;
TtaskStat = procedure(Msg: String) of object;
TtaskDone = procedure() of object;
TtaskProgr = procedure(size: Integer; sizeDescription: TsizeDescription) of object;
TtaskMessage = procedure(msg: TStringList; param1: Integer; param2: Integer) of object;
//this is base class for all tasks
type TBaseTask = class
private
FOnComm: TtaskComm;
FOnProgress: TtaskProgr;
FOnStatus: TtaskStat;
FOnMessage: TtaskMessage;
FOnDone: TtaskDone;
FNoErrors: Boolean;
FCancel: Boolean;
public
procedure Execute(_task: TTreeTask); virtual; abstract;
procedure Cancel; virtual; abstract;
published
property NoErrors: Boolean read FNoErrors write FNoErrors;
property OnComm: TtaskComm read FOnComm write FOnComm;
property OnStatus: TtaskStat read FOnStatus write FOnStatus;
property OnProgress: TtaskProgr read FOnProgress write FOnProgress;
property OnMessage: TtaskMessage read FOnMessage write FOnMessage;
property OnDone: TtaskDone read FOnDone write FOnDone;
end;
var TaskCriticalCancel: TCriticalSection;
implementation
{ TBaseTask }
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -