ADD: msgWarning function and replace some error messages by it

This commit is contained in:
Alexander Koblov 2008-08-18 16:27:35 +00:00
commit c80042ba7d
4 changed files with 40 additions and 14 deletions

View file

@ -1642,7 +1642,7 @@ begin
if (ActiveFrame.pnlFile.PanelMode in [pmVFS, pmArchive]) and
(NotActiveFrame.pnlFile.PanelMode in [pmVFS, pmArchive]) then
begin
ShowMessage(rsMsgErrNotSupported);
msgWarning(rsMsgErrNotSupported);
Exit;
end;
@ -1686,7 +1686,7 @@ begin
ShowPackDlg(NotActiveFrame.pnlFile.VFS, fl, sDestPath, False);
end
else
msgOK(rsMsgErrNotSupported);
msgWarning(rsMsgErrNotSupported);
end;
Exit;
end;
@ -2782,7 +2782,7 @@ begin
logWrite('Chdir to: ' + sDir);
if not mbSetCurrentDir(sDir) then
begin
msgError(Format(rsMsgChDirFailed, [sDir]));
msgWarning(Format(rsMsgChDirFailed, [sDir]));
end
else
begin

View file

@ -1,7 +1,7 @@
{
Seksi Commander
----------------------------
Implementing of Showing messages with lokalization
Implementing of Showing messages with localization
Licence : GNU GPL v 2.0
Author : radek.cervinka@centrum.cz
@ -54,7 +54,8 @@ function msgYesNoCancel(Thread: TThread; const sMsg:String):TMyMsgResult; overlo
procedure msgOK(const sMsg:String); overload;
procedure msgOK(Thread: TThread; const sMsg: String); overload;
function msgWarning(const sMsg:String):Boolean;
function msgWarning(const sMsg: String): Boolean; overload;
function msgWarning(Thread: TThread; const sMsg: String): Boolean; overload;
procedure msgError(const sMsg: String); overload;
procedure msgError(Thread: TThread; const sMsg: String); overload;
@ -70,7 +71,7 @@ procedure msgLoadLng;
implementation
uses
SysUtils, StdCtrls, Graphics, math, fMsg, uLng, Buttons, Controls;
SysUtils, StdCtrls, Graphics, math, fMsg, uLng, Buttons, Controls, uLog, uGlobs;
const
cMsgName='Double Commander';
@ -264,9 +265,30 @@ begin
MsgBox(Thread, sMsg,[msmbOK],msmbOK, msmbOK)
end;
function msgWarning(const sMsg:String):Boolean;
function msgWarning(const sMsg: String): Boolean;
begin
Raise Exception.Create('Not implemented yet!');
if gShowWarningMessages then
MsgBox(sMsg,[msmbOK],msmbOK, msmbOK)
else
begin
if gLogWindow then // if log window enabled then write error to it
logWrite(sMsg, lmtError)
else
Beep;
end;
end;
function msgWarning(Thread: TThread; const sMsg: String): Boolean;
begin
if gShowWarningMessages then
MsgBox(Thread, sMsg,[msmbOK],msmbOK, msmbOK)
else
begin
if gLogWindow then // if log window enabled then write error to it
logWrite(Thread, sMsg, lmtError)
else
Beep;
end;
end;
function ShowInputComboBox(const sCaption, sPrompt : String; var slValueList : TStringList;

View file

@ -282,7 +282,7 @@ with frmMain do
begin
if pnlFile.PanelMode in [pmArchive, pmVFS] then
begin
msgError(rsMsgErrNotSupported);
msgWarning(rsMsgErrNotSupported);
UnMarkAll;
Exit;
end;
@ -506,7 +506,7 @@ begin
begin
if pnlFile.PanelMode in [pmArchive, pmVFS] then // if in VFS
begin
msgOK(rsMsgErrNotSupported);
msgWarning(rsMsgErrNotSupported);
Exit;
end; // in VFS
@ -717,7 +717,7 @@ begin
begin
if pnlFile.PanelMode in [pmArchive, pmVFS] then
begin
msgError(rsMsgErrNotSupported);
msgWarning(rsMsgErrNotSupported);
UnMarkAll;
Exit;
end;
@ -765,7 +765,7 @@ begin
begin
if not (VFS_CAPS_MKDIR in pnlFile.VFS.VFSModule.VFSCaps) then
begin
msgOK(rsMsgErrNotSupported);
msgWarning(rsMsgErrNotSupported);
Exit;
end;
end; // in VFS
@ -832,7 +832,7 @@ begin
begin
if not (VFS_CAPS_DELETE in pnlFile.VFS.VFSModule.VFSCaps) then
begin
msgOK(rsMsgErrNotSupported);
msgWarning(rsMsgErrNotSupported);
Exit;
end;
end; // in VFS

View file

@ -96,6 +96,8 @@ var
gDateTimeFormat : String;
gDriveBlackList: String;
gShowWarningMessages: Boolean;
{ Tools page }
@ -430,7 +432,8 @@ begin
gTrayIcon := gIni.ReadBool('Configuration', 'TrayIcon', False);
gDateTimeFormat := gIni.ReadString('Configuration', 'DateTimeFormat', 'dd.mm.yy');
gDriveBlackList:= gIni.ReadString('Configuration', 'DriveBlackList', '');
gShowWarningMessages := gIni.ReadBool('Configuration', 'ShowWarningMessages', True);
gMouseSelectionEnabled:= gIni.ReadBool('Configuration', 'MouseSelectionEnabled', True);
gMouseSelectionButton := gIni.ReadInteger('Configuration', 'MouseSelectionButton', 0);
@ -590,6 +593,7 @@ begin
gIni.WriteBool('Configuration', 'TrayIcon', gTrayIcon);
gIni.WriteString('Configuration', 'DateTimeFormat', gDateTimeFormat);
gIni.WriteString('Configuration', 'DriveBlackList', gDriveBlackList);
gIni.WriteBool('Configuration', 'ShowWarningMessages', gShowWarningMessages);
gIni.WriteBool('Configuration', 'MouseSelectionEnabled', gMouseSelectionEnabled);
gIni.WriteInteger('Configuration', 'MouseSelectionButton', gMouseSelectionButton);