offer "copy url with password" also for upload/delete restriction

This commit is contained in:
Massimo Melina 2020-05-27 12:12:00 +02:00
parent 0483032439
commit b877d6853b
3 changed files with 31 additions and 22 deletions

View File

@ -749,6 +749,13 @@ object mainFrm: TmainFrm
AutoHotkeys = maManual AutoHotkeys = maManual
Caption = 'Copy URL with password' Caption = 'Copy URL with password'
end end
object CopyURLwithdifferentaddress1: TMenuItem
Caption = 'Copy URL with different host address'
end
object CopyURLwithfingerprint1: TMenuItem
Caption = 'Copy URL with fingerprint'
OnClick = CopyURLwithfingerprint1Click
end
object Browseit1: TMenuItem object Browseit1: TMenuItem
Caption = 'Browse it' Caption = 'Browse it'
ImageIndex = 26 ImageIndex = 26
@ -785,13 +792,6 @@ object mainFrm: TmainFrm
object N11: TMenuItem object N11: TMenuItem
Caption = '-' Caption = '-'
end end
object CopyURLwithdifferentaddress1: TMenuItem
Caption = 'Copy URL with different host address'
end
object CopyURLwithfingerprint1: TMenuItem
Caption = 'Copy URL with fingerprint'
OnClick = CopyURLwithfingerprint1Click
end
object Purge1: TMenuItem object Purge1: TMenuItem
Caption = 'Purge...' Caption = 'Purge...'
OnClick = Purge1Click OnClick = Purge1Click

View File

@ -3150,19 +3150,22 @@ f:=self;
if assigned(outInherited) then outInherited^:=FALSE; if assigned(outInherited) then outInherited^:=FALSE;
while assigned(f) do while assigned(f) do
begin begin
for i:=0 to length(f.accounts[action])-1 do for s in f.accounts[action] do
begin begin
s:=f.accounts[action][i];
if (s = '') if (s = '')
or (action = FA_UPLOAD) and not f.isRealFolder() then continue; // we must ignore this setting or (action = FA_UPLOAD) and not f.isRealFolder() then // we must ignore this setting
continue;
if specialUsernames and (s[1] = '@') if specialUsernames and (s[1] = '@')
or accountExists(s, specialUsernames) then // we admit groups only if specialUsernames are admitted too or accountExists(s, specialUsernames) then // we admit groups only if specialUsernames are admitted too
addString(s, result); addString(s, result);
end; end;
if (action = FA_ACCESS) and (f.user > '') then addString(f.user, result); if (action = FA_ACCESS) and (f.user > '') then
if assigned(result) then exit; addString(f.user, result);
if assigned(outInherited) then outInherited^:=TRUE; if assigned(result) then
exit;
if assigned(outInherited) then
outInherited^:=TRUE;
f:=f.parent; f:=f.parent;
end; end;
end; // getAccountsFor end; // getAccountsFor
@ -7364,6 +7367,8 @@ var
inc(result); inc(result);
end; // itemsVisible end; // itemsVisible
var
s: string;
begin begin
// default values // default values
setDefaultValues(filemenu.items); setDefaultValues(filemenu.items);
@ -7407,19 +7412,22 @@ if filesBox.SelectionCount = 1 then
a:=NIL; a:=NIL;
if anyFileSelected then if anyFileSelected then
a:=expandAccountsByLink(selectedFile.getAccountsFor(FA_ACCESS, TRUE)); a:=expandAccountsByLink(selectedFile.getAccountsFor(FA_ACCESS, TRUE))
+expandAccountsByLink(selectedFile.getAccountsFor(FA_UPLOAD, TRUE))
+expandAccountsByLink(selectedFile.getAccountsFor(FA_DELETE, TRUE));
visibleIf(CopyURLwithpassword1, assigned(a), ONLY_EXPERT); visibleIf(CopyURLwithpassword1, assigned(a), ONLY_EXPERT);
copyURLwithpassword1.Clear(); copyURLwithpassword1.Clear();
for i:=0 to length(a)-1 do uniqueStrings(a, FALSE);
copyURLwithpassword1.add( newItem( a[i], 0, FALSE, TRUE, copyURLwithPasswordMenuClick, 0, '') ); for s in a do
copyURLwithpassword1.add( newItem( s, 0, FALSE, TRUE, copyURLwithPasswordMenuClick, 0, '') );
end; end;
a:=getPossibleAddresses(); a:=getPossibleAddresses();
if length(a) = 1 then a:=NIL; if length(a) = 1 then a:=NIL;
visibleIf(CopyURLwithdifferentaddress1, anyFileSelected and assigned(a), ONLY_EXPERT); visibleIf(CopyURLwithdifferentaddress1, anyFileSelected and assigned(a), ONLY_EXPERT);
copyURLwithdifferentaddress1.clear(); copyURLwithdifferentaddress1.clear();
for i:=0 to length(a)-1 do for s in a do
copyURLwithdifferentaddress1.add( newItem( a[i], 0, FALSE, TRUE, copyURLwithAddressMenuclick, 0, '') ); copyURLwithdifferentaddress1.add( newItem( s, 0, FALSE, TRUE, copyURLwithAddressMenuclick, 0, '') );
end; end;
@ -10508,7 +10516,7 @@ f:=selectedFile;
while assigned(f) and (f.accounts[FA_ACCESS] = NIL) and (f.user = '') do while assigned(f) and (f.accounts[FA_ACCESS] = NIL) and (f.user = '') do
f:=f.parent; f:=f.parent;
if f.user = user then if assigned(f) and (f.user = user) then
pwd:=f.pwd pwd:=f.pwd
else else
begin begin

View File

@ -172,7 +172,7 @@ function onlyString(s:string; ss:TStringDynArray):boolean;
function addArray(var dst:TstringDynArray; src:array of string; where:integer=-1; srcOfs:integer=0; srcLn:integer=-1):integer; function addArray(var dst:TstringDynArray; src:array of string; where:integer=-1; srcOfs:integer=0; srcLn:integer=-1):integer;
function removeArray(var src:TstringDynArray; toRemove:array of string):integer; function removeArray(var src:TstringDynArray; toRemove:array of string):integer;
function addUniqueArray(var a:TstringDynArray; b:array of string):integer; function addUniqueArray(var a:TstringDynArray; b:array of string):integer;
procedure uniqueStrings(var a:TstringDynArray); procedure uniqueStrings(var a:TstringDynArray; ci:Boolean=TRUE);
function idxOf(s:string; a:array of string; isSorted:boolean=FALSE):integer; function idxOf(s:string; a:array of string; isSorted:boolean=FALSE):integer;
function stringExists(s:string; a:array of string; isSorted:boolean=FALSE):boolean; function stringExists(s:string; a:array of string; isSorted:boolean=FALSE):boolean;
function listToArray(l:Tstrings):TstringDynArray; function listToArray(l:Tstrings):TstringDynArray;
@ -639,13 +639,14 @@ if i < 0 then addString(s, ss)
else removeString(ss, i); else removeString(ss, i);
end; // toggleString end; // toggleString
procedure uniqueStrings(var a:TstringDynArray); procedure uniqueStrings(var a:TstringDynArray; ci:Boolean=TRUE);
var var
i, j: integer; i, j: integer;
begin begin
for i:=length(a)-1 downto 1 do for i:=length(a)-1 downto 1 do
for j:=i-1 downto 0 do for j:=i-1 downto 0 do
if ansiCompareText(a[i], a[j]) = 0 then if ci and SameText(a[i], a[j])
or not ci and (a[i] = a[j]) then
begin begin
removeString(a, i); removeString(a, i);
break; break;