home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 March
/
Chip_2002-03_cd1.bin
/
zkuste
/
delphi
/
kompon
/
d5
/
cak
/
CAKDIR.ZIP
/
CakListView.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
2001-04-24
|
4KB
|
121 lines
unit CakListView;
// Common Archiver Kit (CAK) List View
// Common Interface for Compression/Decompression components.
//Copyright (C) Joseph Leung 2001 (lycj@yahoo.com)
//
//This library is free software; you can redistribute it and/or
//modify it under the terms of the GNU Lesser General Public
//License as published by the Free Software Foundation; either
//version 2.1 of the License, or (at your option) any later version.
//
//This library 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
//Lesser General Public License for more details.
//
//You should have received a copy of the GNU Lesser General Public
//License along with this library; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// ver 0.1.0.0
// lastupdate 3.19.2001
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, CakDir;
type
TCakListView = class(TListView)
private
{ Private declarations }
protected
{ Protected declarations }
public
CakDir : TCakDir;
procedure ReloadCAK;
constructor Create( AOwner: TComponent ); override;
destructor Destroy; override;
{ Public declarations }
published
property CakitDir : TCakDir read CakDir write CakDir;
{ Published declarations }
end;
procedure Register;
implementation
const listwidth : array[0..8] of integer = (150,100,50,120,50,40,70,200,200);
listname : array[0..8] of string =
('File name','Type','Size','Time',
'Comp','%','CRC',
'Defpath','FileArchive');
procedure TCakListView.ReloadCAK;
var aListitem : TListitem;
i : integer;
begin
if not assigned(CakDir) then exit;
items.Clear;
SmallImages := CakDir.ImageS;
LargeImages := Cakdir.ImageL;
if CakDir.Total_Contents > 500 then
if MessageDlg(
'Large file list will takelong time to load, '+#13+#10+
'are you sure want to load it?' +#13+#10+
'You can extract/add/test without loading the list.'
, mtConfirmation, [mbYes, mbNo], 0) = MrNo then
exit;
items.BeginUpdate;
for i := 0 to CakDir.Total_Contents -1 do
begin
aListitem := items.Add;
with CakDir.Archive_Contents[i] do
begin
aListitem.Caption := _Filename;
aListitem.ImageIndex := _FileIcon;
if _Encrypted then
aListitem.SubItems.Add('*' + _FileType) else
aListitem.SubItems.Add(_FileType);
aListitem.SubItems.Add(inttostr(_FileSize));
aListitem.SubItems.Add(Datetimetostr(_Filetime));
aListitem.SubItems.Add(inttostr(_FilePackedSize));
aListitem.SubItems.Add(inttostr(_FileRatio) + '%');
aListitem.SubItems.Add(_FileCRC);
aListitem.SubItems.Add(_FileDefpath);
aListitem.SubItems.Add(_FileArchive);
end;
end;
items.EndUpdate;
end;
constructor TCakListview.Create( AOwner: TComponent );
var aListcolumn : TListColumn;
i : integer;
begin
inherited Create( AOwner );
for i := 0 to 8 do
begin
aListcolumn := Columns.Add;
aListcolumn.Width := Listwidth[i];
aListcolumn.Caption := Listname[i];
end;
end;
destructor TCakListview.Destroy;
begin
inherited Destroy;
end;
procedure Register;
begin
RegisterComponents('QZip', [TCakListView]);
end;
end.