unit TabbedTemplate;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.TabControl,
FMX.StdCtrls, FMX.Gestures, FMX.Edit, IdIOHandler, IdIOHandlerSocket,
IdIOHandlerStack, IdSSL, IdSSLOpenSSL, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdFTP,
FMX.Layouts, FMX.ListBox, FMX.Memo, FMX.Objects;
type
TTabbedForm =
class(TForm)
HeaderToolBar: TToolBar;
ToolBarLabel: TLabel;
TabControl1: TTabControl;
TabItem1: TTabItem;
TabItem2: TTabItem;
GestureManager1: TGestureManager;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
CheckBox2: TCheckBox;
Edit3: TEdit;
Label3: TLabel;
CheckBox3: TCheckBox;
CheckBox4: TCheckBox;
CheckBox1: TCheckBox;
SpeedButton2: TSpeedButton;
ListBox1: TListBox;
IdFTP1: TIdFTP;
IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL;
ProgressBar1: TProgressBar;
SpeedButton1: TSpeedButton;
Memo1: TMemo;
Timer1: TTimer;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure FormGesture(Sender: TObject;
const EventInfo: TGestureEventInfo;
var Handled: Boolean);
procedure SpeedButton2Click(Sender: TObject);
procedure CheckBox3Change(Sender: TObject);
procedure CheckBox4Change(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
TabbedForm: TTabbedForm;
implementation
{$R *.fmx}
procedure TTabbedForm.CheckBox3Change(Sender: TObject);
begin
if checkbox3.IsChecked=true
then checkbox4.IsChecked:=false;
end;
procedure TTabbedForm.CheckBox4Change(Sender: TObject);
begin
if checkbox4.IsChecked=true
then checkbox3.IsChecked:=false;
end;
procedure TTabbedForm.FormCreate(Sender: TObject);
begin
{ This defines the default active tab at runtime }
TabControl1.ActiveTab := TabItem1;
end;
procedure TTabbedForm.FormGesture(Sender: TObject;
const EventInfo: TGestureEventInfo;
var Handled: Boolean);
begin
{$IFDEF ANDROID}
case EventInfo.GestureID
of
sgiLeft:
begin
if TabControl1.ActiveTab <> TabControl1.Tabs[TabControl1.TabCount-1]
then
TabControl1.ActiveTab := TabControl1.Tabs[TabControl1.TabIndex+1];
Handled := True;
end;
sgiRight:
begin
if TabControl1.ActiveTab <> TabControl1.Tabs[0]
then
TabControl1.ActiveTab := TabControl1.Tabs[TabControl1.TabIndex-1];
Handled := True;
end;
end;
{$ENDIF}
end;
procedure ListFileDir(Path:
string; FileList: TStrings);
var
SR: TSearchRec;
begin
if FindFirst(Path + '
*.*', faAnyFile, SR) = 0
then
begin
repeat
if (SR.Attr <> faDirectory)
then
begin
FileList.Add(SR.
Name);
end;
until FindNext(SR) <> 0;
FindClose(SR);
end;
end;
procedure TTabbedForm.SpeedButton1Click(Sender: TObject);
begin
memo1.Lines.Clear;
memo1.Lines.Add(edit1.Text);
memo1.Lines.Add(edit2.Text);
if checkbox2.IsChecked=true
then memo1.Lines.Add('
SSLon')
else memo1.Lines.Add('
SSLoff');
memo1.Lines.Add(edit3.Text);
if checkbox3.IsChecked=true
then memo1.Lines.Add('
copy')
else memo1.Lines.Add('
move');
if checkbox1.IsChecked=true
then memo1.Lines.Add('
erstellen')
else memo1.Lines.Add('
direct');
memo1.Lines.SaveToFile(getHomePath + '
/options.gee');
end;
procedure TTabbedForm.SpeedButton2Click(Sender: TObject);
var
i: integer;
begin
ListFileDir('
/sdcard/DCIM/camera/', ListBox1.Items);
progressbar1.Max:=listbox1.Items.Count;
idftp1.Host:=edit1.Text;
idftp1.Port:=strtoint(edit2.Text);
if checkbox2.IsChecked=true
then begin
idftp1.UseTLS:=utUseExplicitTLS;
idftp1.IOHandler:= IdSSLIOHandlerSocketOpenSSL1;
end else begin
idftp1.UseTLS:=utNoTLSSupport;
idftp1.iohandler:=
nil;
end;
idftp1.Connect;
idftp1.ChangeDir(edit3.Text);
if checkbox1.IsChecked=true
then begin
idftp1.MakeDir(datetostr(now));
idftp1.ChangeDir(datetostr(now));
end;
application.ProcessMessages;
for I := 0
to listbox1.Items.count-1
do begin
idftp1.Put('
/sdcard/DCIM/camera/'+listbox1.Items[i], listbox1.Items[i]);
progressbar1.Value:=i;
application.ProcessMessages;
end;
if checkbox4.IsChecked=true
then begin
for I := 0
to listbox1.Items.Count-1
do begin
deletefile('
/sdcard/DCIM/camera/'+listbox1.Items[i]);
end;
end;
end;
procedure TTabbedForm.Timer1Timer(Sender: TObject);
begin
timer1.Enabled:=false;
if fileexists(getHomePath + '
/options.gee' )
then begin
memo1.Lines.LoadFromFile(getHomePath + '
/options.gee');
edit1.Text:=memo1.Lines[0];
edit2.Text:=memo1.Lines[1];
if memo1.Lines[2]='
SSLon'
then checkbox2.IsChecked:=true;
edit3.Text:=memo1.Lines[3];
if memo1.Lines[4]='
copy'
then checkbox3.ischecked:=true
else checkbox4.IsChecked:=true;
if memo1.Lines[5]='
erstellen'
then checkbox1.IsChecked:=true;
end else begin showmessage('
Bitte alle Einstellungen setzen und speichern.');
end;
end;
end.