ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/iblocaldb/IBXSaveDatabaseDlg.pas
(Generate patch)

Comparing ibx/trunk/iblocaldb/IBXSaveDatabaseDlg.pas (file contents):
Revision 37 by tony, Mon Feb 15 14:44:25 2016 UTC vs.
Revision 80 by tony, Mon Jan 1 11:31:07 2018 UTC

# Line 56 | Line 56 | type
56   var
57    SaveDatabaseDlg: TSaveDatabaseDlg;
58  
59 + function SaveDatabaseToArchive(DBName: string;  DBParams: TStrings; aFilename: string): boolean;
60 +
61   implementation
62  
63 + uses Registry;
64 +
65 + {$IFDEF WINDOWS}
66 + const
67 +  rgShellFolders      = 'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders';
68 +  rgPersonal          = 'Personal';
69 + {$ENDIF}
70 +
71 + function SaveDatabaseToArchive(DBName: string; DBParams: TStrings;
72 +  aFilename: string): boolean;
73 + begin
74 + with TSaveDatabaseDlg.Create(Application) do
75 + try
76 +  if aFilename = ''  then
77 +  begin
78 +    SaveDialog1.InitialDir := GetUserDir;
79 +    {$IFDEF WINDOWS}
80 +    with TRegistry.Create do
81 +    try
82 +      if OpenKey(rgShellFolders,false) then
83 +      begin
84 +        SaveDialog1.InitialDir := ReadString(rgPersonal)
85 +      end;
86 +    finally
87 +      Free
88 +    end;
89 +    {$ENDIF}
90 +    if SaveDialog1.Execute then
91 +      aFilename := SaveDialog1.FileName
92 +    else
93 +      Exit;
94 +  end;
95 +  IBBackupService1.SetDBParams(DBParams);
96 +  IBBackupService1.BackupFile.Clear;
97 +  IBBackupService1.DatabaseName := DBName;
98 +  IBBackupService1.BackupFile.Add(aFilename);
99 +  Result := ShowModal = mrOK
100 + finally
101 +   Free
102 + end;
103 + end;
104 +
105   {$R *.lfm}
106  
107   { TSaveDatabaseDlg }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines