📄 fmailboxinfo.pas
字号:
(*
# (C) Copyright 2003
# Miha Vrhovnik, miha.vrhovnik@cordia.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)2003.
# All Rights Reserved.
#==============================================================================
# Contributor(s):
#==============================================================================
# History: see whats new.txt from distribution package
#==============================================================================
*)
unit fMailboxInfo;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, VirtualTrees, account, OmniXMLConf;
type
TfrmMailboxInfo = class(TForm)
cmdOK: TButton;
lstInfo: TVirtualStringTree;
procedure cmdOKClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure lstInfoGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
procedure lstInfoGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType;
var CellText: WideString);
procedure lstInfoPaintText(Sender: TBaseVirtualTree;
const TargetCanvas: TCanvas; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType);
procedure FormShortCut(var Msg: TWMKey; var Handled: Boolean);
procedure FormShow(Sender: TObject);
procedure FormHide(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure LoadInfo(mbox: TMailbox);
end;
var
frmMailboxInfo: TfrmMailboxInfo;
implementation
uses
fMain, mailBox, gnugettext, defFldrs;
{$R *.dfm}
type TTreeInfo = record
col: array [0..1] of String;
end;
type PTreeInfo = ^TTreeInfo;
procedure TfrmMailboxInfo.cmdOKClick(Sender: TObject);
begin
Self.Close;
end;
procedure TfrmMailboxInfo.FormCreate(Sender: TObject);
begin
lstInfo.Header.Columns[0].Width := lstInfo.Width div 2;
lstInfo.Header.Columns[1].Width := lstInfo.Width div 2;
end;
procedure TfrmMailboxInfo.LoadInfo(mbox: TMailbox);
begin
lstInfo.Clear;
with PTreeInfo(lstInfo.GetNodeData(lstInfo.AddChild(nil)))^ do begin
col[0] := _('Mailbox name:');
col[1] := mbox.MailboxName;
end;
with PTreeInfo(lstInfo.GetNodeData(lstInfo.AddChild(nil)))^ do begin
col[0] := _('Index file size:');
col[1] := FloatToStr(mbox.Filesize(True) / 1024) + ' KB';
end;
with PTreeInfo(lstInfo.GetNodeData(lstInfo.AddChild(nil)))^ do begin
col[0] := _('Mailbox file size:');
col[1] := FloatToStr(mbox.Filesize(False) / 1024) + ' KB';
end;
with PTreeInfo(lstInfo.GetNodeData(lstInfo.AddChild(nil)))^ do begin
col[0] := _('Total messages:');
col[1] := IntToStr(mbox.TotalMessageCount);
end;
with PTreeInfo(lstInfo.GetNodeData(lstInfo.AddChild(nil)))^ do begin
col[0] := _('Unread messages:');
col[1] := IntToStr(mbox.UnreadMessageCount);
end;
with PTreeInfo(lstInfo.GetNodeData(lstInfo.AddChild(nil)))^ do begin
col[0] := _('Last message index:');
col[1] := IntToStr(mbox.LastMessageIndex);
end;
with PTreeInfo(lstInfo.GetNodeData(lstInfo.AddChild(nil)))^ do begin
col[0] := _('Unused space (toc file):');
col[1] := FloatToStr(mbox.UnusedSpace(True) / 1024) + ' KB';
end;
with PTreeInfo(lstInfo.GetNodeData(lstInfo.AddChild(nil)))^ do begin
col[0] := _('Unused space (mailbox file):');
col[1] := FloatToStr(mbox.UnusedSpace(False) / 1024) + ' KB';
end;
end;
procedure TfrmMailboxInfo.lstInfoGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
begin
NodeDataSize := sizeOf(TTreeInfo);
end;
procedure TfrmMailboxInfo.lstInfoGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: WideString);
begin
CellText := PTreeInfo(lstInfo.GetNodeData(Node))^.col[Column];
end;
procedure TfrmMailboxInfo.lstInfoPaintText(Sender: TBaseVirtualTree;
const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
TextType: TVSTTextType);
begin
if Column = 0 then TargetCanvas.Font.Style := TargetCanvas.Font.Style + [fsBold]
else TargetCanvas.Font.Style := TargetCanvas.Font.Style - [fsBold];
end;
procedure TfrmMailboxInfo.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
begin
if msg.CharCode = 27 then begin
Self.Close;
Handled := True;
end;
end;
procedure TfrmMailboxInfo.FormShow(Sender: TObject);
begin
//translate me
TranslateComponent(Self);
//read self position & size
frmMailbox.Profile.Config.ReadControlSettings(Self);
end;
procedure TfrmMailboxInfo.FormHide(Sender: TObject);
begin
//write self position & size
frmMailbox.Profile.Config.WriteControlSettings(Self);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -