initial commit from lost SVN repo
This commit is contained in:
138
spackgui/frmaddchangerepo.pas
Normal file
138
spackgui/frmaddchangerepo.pas
Normal file
@@ -0,0 +1,138 @@
|
||||
{
|
||||
********************************************************************************
|
||||
|
||||
SPackGui
|
||||
Copyright (C) 2013 Geoffray Levasseur <geoffray.levasseurbrandin@numericable.fr>.
|
||||
Copyright (C) <date> <add your name and mail address here>
|
||||
|
||||
http://www.geoffray-levasseur.org/
|
||||
http://0.tuxfamilly.org/
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited
|
||||
liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
********************************************************************************
|
||||
|
||||
Description:
|
||||
add/change repository dialog
|
||||
|
||||
********************************************************************************
|
||||
}
|
||||
unit frmAddChangeRepo;
|
||||
|
||||
{$include ../common/defines.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Buttons,
|
||||
StdCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TfAddChangeRepo }
|
||||
|
||||
TfAddChangeRepo = class(TForm)
|
||||
btnCancel: TBitBtn;
|
||||
btnOk: TBitBtn;
|
||||
btnBrowse: TButton;
|
||||
edComment: TEdit;
|
||||
edName: TEdit;
|
||||
edAddress: TEdit;
|
||||
lbHelp: TLabel;
|
||||
lbComment: TLabel;
|
||||
lbName: TLabel;
|
||||
lbAddress: TLabel;
|
||||
dlgSelectDirectory: TSelectDirectoryDialog;
|
||||
procedure btnBrowseClick(Sender: TObject);
|
||||
procedure edNameChange(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
fAddChangeRepo: TfAddChangeRepo;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
uCommon, uIconManager, uStrings, uDebug;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TfAddChangeRepo }
|
||||
|
||||
procedure TfAddChangeRepo.edNameChange(Sender: TObject);
|
||||
begin
|
||||
btnOk.Enabled := (Trim(edName.Text) <> '') and (Trim(edAddress.Text) <> '');
|
||||
end;
|
||||
|
||||
procedure TfAddChangeRepo.btnBrowseClick(Sender: TObject);
|
||||
begin
|
||||
if dlgSelectDirectory.Execute then
|
||||
edAddress.Text := dlgSelectDirectory.FileName;
|
||||
end;
|
||||
|
||||
procedure TfAddChangeRepo.FormClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
begin
|
||||
try
|
||||
SaveWindowGeometry(Self);
|
||||
except
|
||||
PrintLnDbg(rsErrorCannotSaveConf, vlLow);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfAddChangeRepo.FormCloseQuery(Sender: TObject;
|
||||
var CanClose: boolean);
|
||||
begin
|
||||
CanClose := False;
|
||||
// = is forbidden in name and " in address
|
||||
if Pos('=', edName.Text) <> 0 then
|
||||
MessageDlg(rsError, rsErrorEqualForbidden, mtError, [mbOK], 0)
|
||||
else
|
||||
if Pos('"', edAddress.Text) <> 0 then
|
||||
MessageDlg(rsError, rsErrorQuoteForbidden, mtError, [mbOK], 0)
|
||||
else
|
||||
CanClose := True;
|
||||
end;
|
||||
|
||||
procedure TfAddChangeRepo.FormCreate(Sender: TObject);
|
||||
begin
|
||||
btnOk.Tag := icOk;
|
||||
btnCancel.Tag := icCancel;
|
||||
edNameChange(Sender);
|
||||
LoadWindowGeometry(Self);
|
||||
InitBtnGlyphs(Self);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user