* Fix drive demo compilation

git-svn-id: trunk@62332 -
This commit is contained in:
michael 2019-12-06 12:32:21 +00:00
parent 18c804d07f
commit c22ac41cb7
4 changed files with 37 additions and 54 deletions

View File

@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/> <Version Value="12"/>
<General> <General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="drivedemo"/> <Title Value="drivedemo"/>
<ResourceType Value="res"/> <ResourceType Value="res"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
@ -13,9 +15,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -23,9 +22,10 @@
<Version Value="2"/> <Version Value="2"/>
</PublishOptions> </PublishOptions>
<RunParams> <RunParams>
<local> <FormatVersion Value="2"/>
<FormatVersion Value="1"/> <Modes Count="1">
</local> <Mode0 Name="default"/>
</Modes>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="2">
<Item1> <Item1>

View File

@ -8,7 +8,7 @@ object MainForm: TMainForm
ClientWidth = 756 ClientWidth = 756
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
LCLVersion = '1.5' LCLVersion = '2.1.0.0'
object BRefreshFolders: TButton object BRefreshFolders: TButton
Left = 72 Left = 72
Height = 25 Height = 25
@ -25,20 +25,20 @@ object MainForm: TMainForm
Width = 756 Width = 756
Align = alBottom Align = alBottom
Caption = 'Please provide Google API access code' Caption = 'Please provide Google API access code'
ClientHeight = 45 ClientHeight = 55
ClientWidth = 752 ClientWidth = 754
TabOrder = 1 TabOrder = 1
Visible = False Visible = False
object LEAccess: TLabel object LEAccess: TLabel
Left = 16 Left = 16
Height = 12 Height = 17
Top = 8 Top = 8
Width = 56 Width = 69
Caption = 'Access code' Caption = 'Access code'
ParentColor = False ParentColor = False
end end
object BSetAccess: TButton object BSetAccess: TButton
Left = 582 Left = 584
Height = 25 Height = 25
Top = 1 Top = 1
Width = 75 Width = 75
@ -48,7 +48,7 @@ object MainForm: TMainForm
TabOrder = 0 TabOrder = 0
end end
object BCancel: TButton object BCancel: TButton
Left = 662 Left = 664
Height = 25 Height = 25
Top = 0 Top = 0
Width = 75 Width = 75
@ -59,7 +59,7 @@ object MainForm: TMainForm
end end
object EAccessCode: TEdit object EAccessCode: TEdit
Left = 112 Left = 112
Height = 18 Height = 29
Top = 8 Top = 8
Width = 400 Width = 400
TabOrder = 2 TabOrder = 2
@ -78,7 +78,7 @@ object MainForm: TMainForm
end end
object LTasks: TLabel object LTasks: TLabel
Left = 392 Left = 392
Height = 12 Height = 17
Top = 16 Top = 16
Width = 215 Width = 215
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
@ -87,9 +87,9 @@ object MainForm: TMainForm
end end
object Label1: TLabel object Label1: TLabel
Left = 22 Left = 22
Height = 12 Height = 17
Top = 16 Top = 16
Width = 34 Width = 41
Caption = 'Folders' Caption = 'Folders'
ParentColor = False ParentColor = False
end end
@ -99,7 +99,6 @@ object MainForm: TMainForm
Top = 35 Top = 35
Width = 344 Width = 344
Anchors = [akTop, akLeft, akBottom] Anchors = [akTop, akLeft, akBottom]
DefaultItemHeight = 14
ReadOnly = True ReadOnly = True
TabOrder = 3 TabOrder = 3
OnSelectionChanged = TVFoldersSelectionChanged OnSelectionChanged = TVFoldersSelectionChanged

View File

@ -126,26 +126,11 @@ begin
If Not (Assigned(LVFiles.Selected) and Assigned(LVFiles.Selected.Data)) then If Not (Assigned(LVFiles.Selected) and Assigned(LVFiles.Selected.Data)) then
Exit; Exit;
Entry:=TFile(LVFiles.Selected.Data); Entry:=TFile(LVFiles.Selected.Data);
if (Entry.DownloadUrl='') if (Entry.WebViewLink='') then
and ((Entry.exportLinks=Nil) or (Entry.exportLinks.additionalProperties=Nil) or ((Entry.exportLinks.additionalProperties.Count)=0)) then
Exit; Exit;
if Entry.DownloadUrl<>'' then if Entry.WebViewLink<>'' then
URL:=TDriveAPI.APIBaseURL+'files/'+Entry.ID+'?alt=media' URL:=TDriveAPI.APIBaseURL+'files/'+Entry.ID+'?alt=media';
else SDDownload.FileName:=Application.Location+Entry.name+'.'+Entry.fileExtension;
begin
With TSelectDownloadForm.Create(Self) do
try
Formats.BeginUpdate;
For D in Entry.exportLinks.additionalProperties do
Formats.Add(D.Key);
if (ShowModal=mrOK) then
S:=Selected;
finally
Free;
end;
URL:=Entry.exportLinks.additionalProperties.Strings[S];
end;
SDDownload.FileName:=Application.Location+Entry.Title+'.'+Entry.fileExtension;
If Not SDDownload.Execute then If Not SDDownload.Execute then
Exit; Exit;
Response:=Nil; Response:=Nil;
@ -253,9 +238,8 @@ begin
// Search for folders of indicated folder only. // Search for folders of indicated folder only.
Q.q:='mimeType = ''application/vnd.google-apps.folder'' and '''+AFolderId+''' in parents'; Q.q:='mimeType = ''application/vnd.google-apps.folder'' and '''+AFolderId+''' in parents';
Q.corpus:=''; Q.corpus:='';
q.maxResults:=0; q.pageSize:=12;
Q.pageToken:=''; Q.pageToken:='';
Q.projection:='';
List:=Resource.list(Q); List:=Resource.list(Q);
SaveRefreshToken; SaveRefreshToken;
With TVFolders.Items do With TVFolders.Items do
@ -263,11 +247,11 @@ begin
BeginUpdate; BeginUpdate;
try try
if Assigned(List) then if Assigned(List) then
for i:= 0 to Length(List.items)-1 do for i:= 0 to Length(List.files)-1 do
begin begin
Entry:=List.items[i]; Entry:=List.files[i];
List.Items[i]:=Nil; List.files[i]:=Nil;
N:=AddChild(AParent,Entry.title); N:=AddChild(AParent,Entry.Name);
N.Data:=Entry; N.Data:=Entry;
end; end;
finally finally
@ -361,20 +345,20 @@ begin
try try
Clear; Clear;
if Assigned(List) then if Assigned(List) then
for i:= 0 to Length(List.items)-1 do for i:= 0 to Length(List.files)-1 do
begin begin
Entry:=List.items[i]; Entry:=List.files[i];
List.Items[i]:=Nil; List.files[i]:=Nil;
LI:=Add; LI:=Add;
LI.Caption:=Entry.Title; LI.Caption:=Entry.Name;
With LI.SubItems do With LI.SubItems do
begin begin
Add(DateTimeToStr(Entry.createdDate)); Add(DateTimeToStr(Entry.createdTime));
Add(Entry.Description); Add(Entry.Description);
Add(BoolToStr(Entry.Editable,'Yes','No')); Add(BoolToStr(Entry.capabilities.canEdit,'Yes','No'));
Add(Entry.fileSize); Add(Entry.Size);
Add(Entry.lastModifyingUserName); Add(Entry.lastModifyingUser.displayName);
Add(Entry.downloadUrl); Add(Entry.webContentLink);
Add(Entry.version); Add(Entry.version);
Add(Entry.mimeType); Add(Entry.mimeType);
end; end;