usability improvement for 'ban this address'

This commit is contained in:
Massimo Melina 2020-05-31 00:35:21 +02:00
parent 8be3ff6331
commit e8a2e281ec
2 changed files with 22 additions and 32 deletions

View File

@ -322,7 +322,7 @@ button i.fa { font-size:110% }
background-color:rgba(0,0,0,.04); /* dynamically darker, as also hover is darker */ } background-color:rgba(0,0,0,.04); /* dynamically darker, as also hover is darker */ }
.comment>i:first-child { margin-right:0.5em; margin-left:-1.4em; } .comment>i:first-child { margin-right:0.5em; margin-left:-1.4em; }
.item-size { margin-left:.3em } .item-size { margin-left:.3em }
.selector { float:left; width: 1.2em; height:1.2em; margin-right: .5em;} .selector { float:left; width: 1.2em; height:1.2em; margin-right: .5em; filter:grayscale(1); }
.item-menu { padding:0.1em 0.3em; border-radius:0.6em; position: relative; top: -0.1em;} .item-menu { padding:0.1em 0.3em; border-radius:0.6em; position: relative; top: -0.1em;}
.dialog-content h1 { margin:0; } .dialog-content h1 { margin:0; }
.dialog-content .buttons { margin-top:1.5em } .dialog-content .buttons { margin-top:1.5em }

View File

@ -1166,7 +1166,6 @@ var
lockTimerevent: boolean; lockTimerevent: boolean;
filesStayFlaggedForMinutes: integer; filesStayFlaggedForMinutes: integer;
autosaveVFS: Tautosave; autosaveVFS: Tautosave;
logRightClick: Tpoint;
warnManyItems: boolean = TRUE; warnManyItems: boolean = TRUE;
runningOnRemovable: boolean; runningOnRemovable: boolean;
startupFilename: string; startupFilename: string;
@ -3879,7 +3878,7 @@ else if sectionName = 'login' then
data.conn.reply.mode:=HRM_DENY data.conn.reply.mode:=HRM_DENY
else if sectionName = 'not found' then else if sectionName = 'not found' then
data.conn.reply.mode:=HRM_NOT_FOUND data.conn.reply.mode:=HRM_NOT_FOUND
else if sectionName = 'unauthorized' then else if sectionName = 'unauth' then
data.conn.reply.mode:=HRM_UNAUTHORIZED data.conn.reply.mode:=HRM_UNAUTHORIZED
else if sectionName = 'overload' then else if sectionName = 'overload' then
data.conn.reply.mode:=HRM_OVERLOAD data.conn.reply.mode:=HRM_OVERLOAD
@ -5398,7 +5397,7 @@ var
begin begin
data.acceptedCredentials:=FALSE; data.acceptedCredentials:=FALSE;
runEventScript('unauthorized'); runEventScript('unauthorized');
getPage('unauthorized', data); getPage('unauth', data);
conn.reply.realm:='Invalid login'; conn.reply.realm:='Invalid login';
exit; exit;
end end
@ -5455,21 +5454,6 @@ var
exit; exit;
end; end;
if urlCmd = '~login' then // legacy method for login dialog
if conn.request.user = '' then
begin
getPage('unauthorized', data);
if loginRealm > '' then
conn.reply.realm:=loginRealm;
exit;
end
else
begin
conn.reply.mode:=HRM_REDIRECT;
conn.reply.url:=first(getAccountRedirect(), url);
exit;
end;
b:=urlCmd = '~upload+progress'; b:=urlCmd = '~upload+progress';
if (b or (urlCmd = '~upload') or (urlCmd = '~upload-no-progress')) then if (b or (urlCmd = '~upload') or (urlCmd = '~upload-no-progress')) then
begin begin
@ -5479,7 +5463,7 @@ var
getPage( if_(b,'upload+progress','upload'), data, f) getPage( if_(b,'upload+progress','upload'), data, f)
else else
begin begin
getPage('unauthorized', data); getPage('unauth', data);
runEventScript('unauthorized'); runEventScript('unauthorized');
end; end;
if b then // fix for IE6 if b then // fix for IE6
@ -8710,7 +8694,7 @@ procedure TmainFrm.logmenuPopup(Sender: TObject);
begin begin
Readonly1.Checked:=logBox.ReadOnly; Readonly1.Checked:=logBox.ReadOnly;
Readonly1.visible:=not easyMode; Readonly1.visible:=not easyMode;
Banthisaddress1.visible:= logBox.selAttributes.color=ADDRESS_COLOR; Banthisaddress1.visible:= ipPointedInLog() > '';
Address2name1.visible:=not easyMode; Address2name1.visible:=not easyMode;
Logfile1.visible:=not easyMode; Logfile1.visible:=not easyMode;
logOnVideoChk.visible:=not easyMode; logOnVideoChk.visible:=not easyMode;
@ -10256,12 +10240,6 @@ end; // loadVFS
procedure TmainFrm.logBoxChange(Sender: TObject); procedure TmainFrm.logBoxChange(Sender: TObject);
begin logToolbar.visible:=not easyMode and (logBox.Lines.count > 0) end; begin logToolbar.visible:=not easyMode and (logBox.Lines.count > 0) end;
procedure TmainFrm.logBoxMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if button = mbRight then
logRightClick:=point(x,y);
end;
procedure Tmainfrm.popupMainMenu(); procedure Tmainfrm.popupMainMenu();
begin begin
menuBtn.Down:=TRUE; menuBtn.Down:=TRUE;
@ -11240,8 +11218,11 @@ function pointToCharPoint(re:TRichEdit; pt:Tpoint):Tpoint;
const const
EM_EXLINEFROMCHAR = WM_USER+54; EM_EXLINEFROMCHAR = WM_USER+54;
begin begin
if pt.x < 0 then
exit(point(-1,-1));
result.x:=re.perform(EM_CHARFROMPOS, 0, integer(@pt)); result.x:=re.perform(EM_CHARFROMPOS, 0, integer(@pt));
if result.x < 0 then exit; if result.x < 0 then
exit;
result.y:=re.perform(EM_EXLINEFROMCHAR, 0, result.x); result.y:=re.perform(EM_EXLINEFROMCHAR, 0, result.x);
dec(result.x, re.perform(EM_LINEINDEX, result.y, 0)); dec(result.x, re.perform(EM_LINEINDEX, result.y, 0));
end; // pointToCharPoint end; // pointToCharPoint
@ -11252,17 +11233,26 @@ var
pt: Tpoint; pt: Tpoint;
begin begin
result:=''; result:='';
pt:=pointToCharPoint(logBox, logRightClick);
if pt.x < 0 then
pt:=logbox.caretpos; pt:=logbox.caretpos;
if pt.y >= logbox.lines.count then if pt.y >= logbox.lines.count then
exit; exit;
s:=logbox.lines[pt.y]; s:=logbox.lines[pt.y];
s:=reGet(s, '.+ (\S+@)?(\S+):\d+ ', 2); s:=reGet(s, '^.+ (\S+@)?(\S+):\d+ ', 2);
if checkAddressSyntax(s,FALSE) then if checkAddressSyntax(s,FALSE) then
result:=s; result:=s;
end; // ipPointedInLog end; // ipPointedInLog
procedure TmainFrm.logBoxMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var pt: Tpoint;
begin
if button = mbRight then
begin
pt:=pointToCharPoint(logBox, Point(x,y));
if pt.x >= 0 then
logBox.CaretPos:=pt;
end;
end;
procedure TmainFrm.Banthisaddress1Click(Sender: TObject); procedure TmainFrm.Banthisaddress1Click(Sender: TObject);
begin banAddress(ipPointedInLog()); end; begin banAddress(ipPointedInLog()); end;