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

View File

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

View File

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