* Added ToDolist cvs export, patch by Alex du Plessis

git-svn-id: trunk@14910 -
This commit is contained in:
marc 2008-04-20 17:01:58 +00:00
parent b7569c6053
commit 523d08cc70
3 changed files with 112 additions and 36 deletions

View File

@ -1,7 +1,7 @@
object frmTodo: TfrmTodo
Left = 429
Left = 451
Height = 300
Top = 227
Top = 665
Width = 643
HorzScrollBar.Page = 642
VertScrollBar.Page = 299
@ -13,14 +13,15 @@ object frmTodo: TfrmTodo
OnCreate = FormCreate
OnKeyDown = FormKeyDown
Position = poScreenCenter
LCLVersion = '0.9.25'
object StatusBar: TStatusBar
Height = 21
Top = 279
Height = 20
Top = 280
Width = 643
Panels = <>
end
object lvTodo: TListView
Height = 231
Height = 232
Top = 48
Width = 643
Align = alClient
@ -28,22 +29,22 @@ object frmTodo: TfrmTodo
item
AutoSize = True
Caption = 'Caption'
Width = 59
Width = 42
end
item
AutoSize = True
Caption = 'Caption'
Width = 59
Width = 42
end
item
AutoSize = True
Caption = 'Caption'
Width = 59
Width = 42
end
item
AutoSize = True
Caption = 'Caption'
Width = 59
Width = 42
end
item
Caption = 'Caption'
@ -74,7 +75,7 @@ object frmTodo: TfrmTodo
ShowHint = True
TabOrder = 1
object tbOptions: TToolButton
Left = 132
Left = 161
Top = 2
AllowAllUp = True
AutoSize = True
@ -82,7 +83,7 @@ object frmTodo: TfrmTodo
Visible = False
end
object tbPrint: TToolButton
Left = 95
Left = 128
Top = 2
AutoSize = True
Caption = 'Print'
@ -95,11 +96,17 @@ object frmTodo: TfrmTodo
AutoSize = True
end
object tbGoto: TToolButton
Left = 56
Left = 51
Top = 2
Action = acGoto
AutoSize = True
end
object tbExport: TToolButton
Left = 85
Top = 2
Action = acExport
AutoSize = True
end
end
object ActionList: TActionList
left = 414
@ -114,5 +121,18 @@ object frmTodo: TfrmTodo
DisableIfNoHandler = True
OnExecute = acRefreshExecute
end
object acExport: TAction
Caption = 'Export'
DisableIfNoHandler = True
OnExecute = acExportExecute
end
end
object SaveDialog1: TSaveDialog
OnShow = SaveDialog1Show
DefaultExt = '.csv'
Filter = 'csv|*.csv'
Options = [ofCreatePrompt, ofEnableSizing, ofViewDetail]
left = 448
top = 11
end
end

View File

@ -1,30 +1,36 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TfrmTodo','FORMDATA',[
'TPF0'#8'TfrmTodo'#7'frmTodo'#4'Left'#3#173#1#6'Height'#3','#1#3'Top'#3#227#0
'TPF0'#8'TfrmTodo'#7'frmTodo'#4'Left'#3#195#1#6'Height'#3','#1#3'Top'#3#153#2
+#5'Width'#3#131#2#18'HorzScrollBar.Page'#3#130#2#18'VertScrollBar.Page'#3'+'
+#1#13'ActiveControl'#7#6'lvTodo'#7'Caption'#6#7'frmTodo'#12'ClientHeight'#3
+','#1#11'ClientWidth'#3#131#2#10'KeyPreview'#9#8'OnCreate'#7#10'FormCreate'#9
+'OnKeyDown'#7#11'FormKeyDown'#8'Position'#7#14'poScreenCenter'#0#10'TStatusB'
+'ar'#9'StatusBar'#6'Height'#2#21#3'Top'#3#23#1#5'Width'#3#131#2#6'Panels'#14
+#0#0#0#9'TListView'#6'lvTodo'#6'Height'#3#231#0#3'Top'#2'0'#5'Width'#3#131#2
+#5'Align'#7#8'alClient'#7'Columns'#14#1#8'AutoSize'#9#7'Caption'#6#7'Caption'
+#5'Width'#2';'#0#1#8'AutoSize'#9#7'Caption'#6#7'Caption'#5'Width'#2';'#0#1#8
+'AutoSize'#9#7'Caption'#6#7'Caption'#5'Width'#2';'#0#1#8'AutoSize'#9#7'Capti'
+'on'#6#7'Caption'#5'Width'#2';'#0#1#7'Caption'#6#7'Caption'#0#1#7'Caption'#6
+#7'Caption'#0#1#7'Caption'#6#7'Caption'#5'Width'#3'3'#1#0#0#9'RowSelect'#9#10
+'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#9'ViewStyle'#7#8'vsReport'#7'O'
+'nClick'#7#11'lvTodoClick'#0#0#8'TToolBar'#7'ToolBar'#6'Height'#2'0'#5'Width'
+#3#131#2#8'AutoSize'#9#12'ButtonHeight'#2'.'#11'ButtonWidth'#2'/'#7'Caption'
+#6#7'ToolBar'#4'Flat'#9#14'ParentShowHint'#8#12'ShowCaptions'#9#8'ShowHint'#9
+#8'TabOrder'#2#1#0#11'TToolButton'#9'tbOptions'#4'Left'#3#132#0#3'Top'#2#2#10
+'AllowAllUp'#9#8'AutoSize'#9#7'Caption'#6#7'Options'#7'Visible'#8#0#0#11'TTo'
+'olButton'#7'tbPrint'#4'Left'#2'_'#3'Top'#2#2#8'AutoSize'#9#7'Caption'#6#5'P'
+'rint'#7'Visible'#8#0#0#11'TToolButton'#9'tbRefresh'#4'Left'#2#1#3'Top'#2#2#6
+'Action'#7#9'acRefresh'#8'AutoSize'#9#0#0#11'TToolButton'#6'tbGoto'#4'Left'#2
+'8'#3'Top'#2#2#6'Action'#7#6'acGoto'#8'AutoSize'#9#0#0#0#11'TActionList'#10
+'ActionList'#4'left'#3#158#1#3'top'#2#11#0#7'TAction'#6'acGoto'#7'Caption'#6
+#4'Goto'#18'DisableIfNoHandler'#9#9'OnExecute'#7#13'acGotoExecute'#0#0#7'TAc'
+'tion'#9'acRefresh'#7'Caption'#6#7'Refresh'#18'DisableIfNoHandler'#9#9'OnExe'
+'cute'#7#16'acRefreshExecute'#0#0#0#0
+'OnKeyDown'#7#11'FormKeyDown'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'
+#6#6'0.9.25'#0#10'TStatusBar'#9'StatusBar'#6'Height'#2#20#3'Top'#3#24#1#5'Wi'
+'dth'#3#131#2#6'Panels'#14#0#0#0#9'TListView'#6'lvTodo'#6'Height'#3#232#0#3
+'Top'#2'0'#5'Width'#3#131#2#5'Align'#7#8'alClient'#7'Columns'#14#1#8'AutoSiz'
+'e'#9#7'Caption'#6#7'Caption'#5'Width'#2'*'#0#1#8'AutoSize'#9#7'Caption'#6#7
+'Caption'#5'Width'#2'*'#0#1#8'AutoSize'#9#7'Caption'#6#7'Caption'#5'Width'#2
+'*'#0#1#8'AutoSize'#9#7'Caption'#6#7'Caption'#5'Width'#2'*'#0#1#7'Caption'#6
+#7'Caption'#0#1#7'Caption'#6#7'Caption'#0#1#7'Caption'#6#7'Caption'#5'Width'
+#3'3'#1#0#0#9'RowSelect'#9#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#9
+'ViewStyle'#7#8'vsReport'#7'OnClick'#7#11'lvTodoClick'#0#0#8'TToolBar'#7'Too'
+'lBar'#6'Height'#2'0'#5'Width'#3#131#2#8'AutoSize'#9#12'ButtonHeight'#2'.'#11
+'ButtonWidth'#2'/'#7'Caption'#6#7'ToolBar'#4'Flat'#9#14'ParentShowHint'#8#12
+'ShowCaptions'#9#8'ShowHint'#9#8'TabOrder'#2#1#0#11'TToolButton'#9'tbOptions'
+#4'Left'#3#161#0#3'Top'#2#2#10'AllowAllUp'#9#8'AutoSize'#9#7'Caption'#6#7'Op'
+'tions'#7'Visible'#8#0#0#11'TToolButton'#7'tbPrint'#4'Left'#3#128#0#3'Top'#2
+#2#8'AutoSize'#9#7'Caption'#6#5'Print'#7'Visible'#8#0#0#11'TToolButton'#9'tb'
+'Refresh'#4'Left'#2#1#3'Top'#2#2#6'Action'#7#9'acRefresh'#8'AutoSize'#9#0#0
+#11'TToolButton'#6'tbGoto'#4'Left'#2'3'#3'Top'#2#2#6'Action'#7#6'acGoto'#8'A'
+'utoSize'#9#0#0#11'TToolButton'#8'tbExport'#4'Left'#2'U'#3'Top'#2#2#6'Action'
+#7#8'acExport'#8'AutoSize'#9#0#0#0#11'TActionList'#10'ActionList'#4'left'#3
+#158#1#3'top'#2#11#0#7'TAction'#6'acGoto'#7'Caption'#6#4'Goto'#18'DisableIfN'
+'oHandler'#9#9'OnExecute'#7#13'acGotoExecute'#0#0#7'TAction'#9'acRefresh'#7
+'Caption'#6#7'Refresh'#18'DisableIfNoHandler'#9#9'OnExecute'#7#16'acRefreshE'
+'xecute'#0#0#7'TAction'#8'acExport'#7'Caption'#6#6'Export'#18'DisableIfNoHan'
+'dler'#9#9'OnExecute'#7#15'acExportExecute'#0#0#0#11'TSaveDialog'#11'SaveDia'
+'log1'#6'OnShow'#7#15'SaveDialog1Show'#10'DefaultExt'#6#4'.csv'#6'Filter'#6#9
+'csv|*.csv'#7'Options'#11#14'ofCreatePrompt'#14'ofEnableSizing'#12'ofViewDet'
+'ail'#0#4'left'#3#192#1#3'top'#2#11#0#0#0
]);

View File

@ -28,6 +28,7 @@
Olivier GUILBAUD <golivier@free.fr>,
Gerard Visent <gerardusmercator@gmail.com>
Mattias Gaertner
Alexander du Plessis
Abstract:
List all to do comments of current project and the file
@ -128,19 +129,25 @@ type
TfrmTodo = class(TForm)
acGoto: TAction;
acRefresh: TAction;
acExport: TAction;
ActionList: TActionList;
lvTodo: TListView;// lvTodo.Items.Data is TTodoItem (they belong to the TTLScannedFile)
lvTodo: TListView;
SaveDialog1: TSaveDialog;
StatusBar: TStatusBar;
ToolBar: TToolBar;
tbGoto: TToolButton;
tbOptions: TToolButton;
tbPrint: TToolButton;
tbRefresh: TToolButton;
tbExport: TToolButton;
procedure acExportExecute(Sender: TObject);
procedure acGotoExecute(Sender: TObject);
procedure acRefreshExecute(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift:TShiftState);
procedure lvTodoClick(Sender: TObject);
procedure SaveDialog1Show(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
private
fBuild : Boolean;
fMainSourceFilename : String;
@ -209,6 +216,16 @@ begin
acGoto.Execute;
end;
procedure TfrmTodo.SaveDialog1Show(Sender: TObject);
begin
SaveDialog1.InitialDir:=GetCurrentDir;
end;
procedure TfrmTodo.ToolButton1Click(Sender: TObject);
begin
end;
//Initialise the todo project and find them
procedure TfrmTodo.SetMainSourceFilename(const AValue: String);
begin
@ -460,6 +477,39 @@ begin
end;
end;
procedure TfrmTodo.acExportExecute(Sender: TObject);
var CommaList : TStringList;
s,t : string;
todoItm : TTodoItem;
i : integer;
begin
SaveDialog1.FileName:='TodoList_'+FormatDateTime('YYYY_MM_DD',now);
if SaveDialog1.Execute then
begin
CommaList:=TStringList.Create;
CommaList.Add('Done,Description,Priority,Module,Line,Owner,Category');
i:=0;
while i<lvTodo.Items.Count do
begin
todoItm:=TTodoItem(lvTodo.Items[i].Data);
if todoItm.Done then s:='X,' else s:=' ,';
t:=DelChars(todoItm.Text,',');{Strip any commas that can cause a faulty csv file}
s:=s+t+','+IntToStr(todoItm.Priority)+','+todoItm.Filename+
','+IntToStr(todoItm.LineNumber)+','+todoItm.Owner+','+todoItm.Category;
CommaList.Add(s);
i:=i+1;
end;
CommaList.SaveToFile(SaveDialog1.FileName);
end
else MessageDlg('Warning','Filename is: '+SaveDialog1.FileName,mtWarning,[mbClose],0);
CommaList.Clear;
CommaList.Free;
end;
procedure TfrmTodo.acRefreshExecute(Sender: TObject);
var
i: integer;