[Initranslator-svncheckins] SF.net SVN: initranslator: [212] translator/trunk/src
Brought to you by:
peter3
|
From: <pe...@us...> - 2006-12-20 14:30:37
|
Revision: 212
http://svn.sourceforge.net/initranslator/?rev=212&view=rev
Author: peter3
Date: 2006-12-20 06:30:34 -0800 (Wed, 20 Dec 2006)
Log Message:
-----------
Added Paths:
-----------
translator/trunk/src/KeePassPlugin/
translator/trunk/src/KeePassPlugin/KeePassParser.bdsproj
translator/trunk/src/KeePassPlugin/KeePassParser.dof
translator/trunk/src/KeePassPlugin/KeePassParser.dpr
translator/trunk/src/KeePassPlugin/KeePassParser.res
translator/trunk/src/KeePassPlugin/KeePassParserImpl.pas
translator/trunk/src/KeePassPlugin/KeePassParserLang.pas
Added: translator/trunk/src/KeePassPlugin/KeePassParser.bdsproj
===================================================================
--- translator/trunk/src/KeePassPlugin/KeePassParser.bdsproj (rev 0)
+++ translator/trunk/src/KeePassPlugin/KeePassParser.bdsproj 2006-12-20 14:30:34 UTC (rev 212)
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="utf-8"?>
+<BorlandProject>
+ <PersonalityInfo>
+ <Option>
+ <Option Name="Personality">Delphi.Personality</Option>
+ <Option Name="ProjectType">VCLApplication</Option>
+ <Option Name="Version">1.0</Option>
+ <Option Name="GUID">{799B9BBC-09A7-41DA-A183-1F8FC43E692A}</Option>
+ </Option>
+ </PersonalityInfo>
+ <Delphi.Personality>
+ <Source>
+ <Source Name="MainSource">KeePassParser.dpr</Source>
+ </Source>
+ <FileVersion>
+ <FileVersion Name="Version">7.0</FileVersion>
+ </FileVersion>
+ <Compiler>
+ <Compiler Name="A">8</Compiler>
+ <Compiler Name="B">0</Compiler>
+ <Compiler Name="C">1</Compiler>
+ <Compiler Name="D">1</Compiler>
+ <Compiler Name="E">0</Compiler>
+ <Compiler Name="F">0</Compiler>
+ <Compiler Name="G">1</Compiler>
+ <Compiler Name="H">1</Compiler>
+ <Compiler Name="I">1</Compiler>
+ <Compiler Name="J">0</Compiler>
+ <Compiler Name="K">0</Compiler>
+ <Compiler Name="L">1</Compiler>
+ <Compiler Name="M">0</Compiler>
+ <Compiler Name="N">1</Compiler>
+ <Compiler Name="O">1</Compiler>
+ <Compiler Name="P">1</Compiler>
+ <Compiler Name="Q">0</Compiler>
+ <Compiler Name="R">0</Compiler>
+ <Compiler Name="S">0</Compiler>
+ <Compiler Name="T">0</Compiler>
+ <Compiler Name="U">0</Compiler>
+ <Compiler Name="V">1</Compiler>
+ <Compiler Name="W">0</Compiler>
+ <Compiler Name="X">1</Compiler>
+ <Compiler Name="Y">1</Compiler>
+ <Compiler Name="Z">1</Compiler>
+ <Compiler Name="ShowHints">True</Compiler>
+ <Compiler Name="ShowWarnings">True</Compiler>
+ <Compiler Name="UnitAliases">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Compiler>
+ <Compiler Name="NamespacePrefix"></Compiler>
+ <Compiler Name="GenerateDocumentation">False</Compiler>
+ <Compiler Name="DefaultNamespace"></Compiler>
+ <Compiler Name="SymbolDeprecated">True</Compiler>
+ <Compiler Name="SymbolLibrary">True</Compiler>
+ <Compiler Name="SymbolPlatform">True</Compiler>
+ <Compiler Name="SymbolExperimental">True</Compiler>
+ <Compiler Name="UnitLibrary">True</Compiler>
+ <Compiler Name="UnitPlatform">True</Compiler>
+ <Compiler Name="UnitDeprecated">True</Compiler>
+ <Compiler Name="UnitExperimental">True</Compiler>
+ <Compiler Name="HResultCompat">True</Compiler>
+ <Compiler Name="HidingMember">True</Compiler>
+ <Compiler Name="HiddenVirtual">True</Compiler>
+ <Compiler Name="Garbage">True</Compiler>
+ <Compiler Name="BoundsError">True</Compiler>
+ <Compiler Name="ZeroNilCompat">True</Compiler>
+ <Compiler Name="StringConstTruncated">True</Compiler>
+ <Compiler Name="ForLoopVarVarPar">True</Compiler>
+ <Compiler Name="TypedConstVarPar">True</Compiler>
+ <Compiler Name="AsgToTypedConst">True</Compiler>
+ <Compiler Name="CaseLabelRange">True</Compiler>
+ <Compiler Name="ForVariable">True</Compiler>
+ <Compiler Name="ConstructingAbstract">True</Compiler>
+ <Compiler Name="ComparisonFalse">True</Compiler>
+ <Compiler Name="ComparisonTrue">True</Compiler>
+ <Compiler Name="ComparingSignedUnsigned">True</Compiler>
+ <Compiler Name="CombiningSignedUnsigned">True</Compiler>
+ <Compiler Name="UnsupportedConstruct">True</Compiler>
+ <Compiler Name="FileOpen">True</Compiler>
+ <Compiler Name="FileOpenUnitSrc">True</Compiler>
+ <Compiler Name="BadGlobalSymbol">True</Compiler>
+ <Compiler Name="DuplicateConstructorDestructor">True</Compiler>
+ <Compiler Name="InvalidDirective">True</Compiler>
+ <Compiler Name="PackageNoLink">True</Compiler>
+ <Compiler Name="PackageThreadVar">True</Compiler>
+ <Compiler Name="ImplicitImport">True</Compiler>
+ <Compiler Name="HPPEMITIgnored">True</Compiler>
+ <Compiler Name="NoRetVal">True</Compiler>
+ <Compiler Name="UseBeforeDef">True</Compiler>
+ <Compiler Name="ForLoopVarUndef">True</Compiler>
+ <Compiler Name="UnitNameMismatch">True</Compiler>
+ <Compiler Name="NoCFGFileFound">True</Compiler>
+ <Compiler Name="ImplicitVariants">True</Compiler>
+ <Compiler Name="UnicodeToLocale">True</Compiler>
+ <Compiler Name="LocaleToUnicode">True</Compiler>
+ <Compiler Name="ImagebaseMultiple">True</Compiler>
+ <Compiler Name="SuspiciousTypecast">True</Compiler>
+ <Compiler Name="PrivatePropAccessor">True</Compiler>
+ <Compiler Name="UnsafeType">False</Compiler>
+ <Compiler Name="UnsafeCode">False</Compiler>
+ <Compiler Name="UnsafeCast">False</Compiler>
+ <Compiler Name="OptionTruncated">True</Compiler>
+ <Compiler Name="WideCharReduced">True</Compiler>
+ <Compiler Name="DuplicatesIgnored">True</Compiler>
+ <Compiler Name="UnitInitSeq">True</Compiler>
+ <Compiler Name="LocalPInvoke">True</Compiler>
+ <Compiler Name="MessageDirective">True</Compiler>
+ <Compiler Name="CodePage"></Compiler>
+ </Compiler>
+ <Linker>
+ <Linker Name="MapFile">3</Linker>
+ <Linker Name="OutputObjs">0</Linker>
+ <Linker Name="GenerateHpps">False</Linker>
+ <Linker Name="ConsoleApp">1</Linker>
+ <Linker Name="DebugInfo">False</Linker>
+ <Linker Name="RemoteSymbols">True</Linker>
+ <Linker Name="GenerateDRC">False</Linker>
+ <Linker Name="MinStackSize">16384</Linker>
+ <Linker Name="MaxStackSize">1048576</Linker>
+ <Linker Name="ImageBase">4194304</Linker>
+ <Linker Name="ExeDescription"></Linker>
+ </Linker>
+ <Directories>
+ <Directories Name="OutputDir">..\..\bin\plugins</Directories>
+ <Directories Name="UnitOutputDir">..\..\dcu</Directories>
+ <Directories Name="PackageDLLOutputDir"></Directories>
+ <Directories Name="PackageDCPOutputDir"></Directories>
+ <Directories Name="SearchPath"></Directories>
+ <Directories Name="Packages"></Directories>
+ <Directories Name="Conditionals"></Directories>
+ <Directories Name="DebugSourceDirs"></Directories>
+ <Directories Name="UsePackages">False</Directories>
+ </Directories>
+ <Parameters>
+ <Parameters Name="RunParams"></Parameters>
+ <Parameters Name="HostApplication"></Parameters>
+ <Parameters Name="Launcher"></Parameters>
+ <Parameters Name="UseLauncher">False</Parameters>
+ <Parameters Name="DebugCWD"></Parameters>
+ <Parameters Name="Debug Symbols Search Path"></Parameters>
+ <Parameters Name="LoadAllSymbols">True</Parameters>
+ <Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
+ </Parameters>
+ <VersionInfo>
+ <VersionInfo Name="IncludeVerInfo">True</VersionInfo>
+ <VersionInfo Name="AutoIncBuild">False</VersionInfo>
+ <VersionInfo Name="MajorVer">1</VersionInfo>
+ <VersionInfo Name="MinorVer">9</VersionInfo>
+ <VersionInfo Name="Release">0</VersionInfo>
+ <VersionInfo Name="Build">41</VersionInfo>
+ <VersionInfo Name="Debug">False</VersionInfo>
+ <VersionInfo Name="PreRelease">False</VersionInfo>
+ <VersionInfo Name="Special">False</VersionInfo>
+ <VersionInfo Name="Private">False</VersionInfo>
+ <VersionInfo Name="DLL">True</VersionInfo>
+ <VersionInfo Name="Locale">1033</VersionInfo>
+ <VersionInfo Name="CodePage">1252</VersionInfo>
+ </VersionInfo>
+ <VersionInfoKeys>
+ <VersionInfoKeys Name="CompanyName">IniTranslator</VersionInfoKeys>
+ <VersionInfoKeys Name="FileDescription">KeePass Plugin for IniTranslator</VersionInfoKeys>
+ <VersionInfoKeys Name="FileVersion">1.9.0.41</VersionInfoKeys>
+ <VersionInfoKeys Name="InternalName">KeePassParser.dll</VersionInfoKeys>
+ <VersionInfoKeys Name="LegalCopyright">Copyright (c) 2006 by Peter Thörnqvist; all rights reserved</VersionInfoKeys>
+ <VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
+ <VersionInfoKeys Name="OriginalFilename">KeePassParser.dll</VersionInfoKeys>
+ <VersionInfoKeys Name="ProductName">KeePass Plugin for IniTranslator</VersionInfoKeys>
+ <VersionInfoKeys Name="ProductVersion">1.9.0.41</VersionInfoKeys>
+ <VersionInfoKeys Name="Comments">Latest version at http://initranslator.sourceforge.net</VersionInfoKeys>
+ </VersionInfoKeys>
+ </Delphi.Personality>
+</BorlandProject>
Added: translator/trunk/src/KeePassPlugin/KeePassParser.dof
===================================================================
--- translator/trunk/src/KeePassPlugin/KeePassParser.dof (rev 0)
+++ translator/trunk/src/KeePassPlugin/KeePassParser.dof 2006-12-20 14:30:34 UTC (rev 212)
@@ -0,0 +1,143 @@
+[FileVersion]
+Version=7.0
+[Compiler]
+A=8
+B=0
+C=1
+D=1
+E=0
+F=0
+G=1
+H=1
+I=1
+J=0
+K=0
+L=1
+M=0
+N=1
+O=1
+P=1
+Q=0
+R=0
+S=0
+T=0
+U=0
+V=1
+W=0
+X=1
+Y=1
+Z=1
+ShowHints=1
+ShowWarnings=1
+UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+NamespacePrefix=
+SymbolDeprecated=1
+SymbolLibrary=1
+SymbolPlatform=1
+UnitLibrary=1
+UnitPlatform=1
+UnitDeprecated=1
+HResultCompat=1
+HidingMember=1
+HiddenVirtual=1
+Garbage=1
+BoundsError=1
+ZeroNilCompat=1
+StringConstTruncated=1
+ForLoopVarVarPar=1
+TypedConstVarPar=1
+AsgToTypedConst=1
+CaseLabelRange=1
+ForVariable=1
+ConstructingAbstract=1
+ComparisonFalse=1
+ComparisonTrue=1
+ComparingSignedUnsigned=1
+CombiningSignedUnsigned=1
+UnsupportedConstruct=1
+FileOpen=1
+FileOpenUnitSrc=1
+BadGlobalSymbol=1
+DuplicateConstructorDestructor=1
+InvalidDirective=1
+PackageNoLink=1
+PackageThreadVar=1
+ImplicitImport=1
+HPPEMITIgnored=1
+NoRetVal=1
+UseBeforeDef=1
+ForLoopVarUndef=1
+UnitNameMismatch=1
+NoCFGFileFound=1
+MessageDirective=1
+ImplicitVariants=1
+UnicodeToLocale=1
+LocaleToUnicode=1
+ImagebaseMultiple=1
+SuspiciousTypecast=1
+PrivatePropAccessor=1
+UnsafeType=0
+UnsafeCode=0
+UnsafeCast=0
+[Linker]
+MapFile=3
+OutputObjs=0
+ConsoleApp=1
+DebugInfo=0
+RemoteSymbols=1
+MinStackSize=16384
+MaxStackSize=1048576
+ImageBase=4194304
+ExeDescription=
+[Directories]
+OutputDir=..\..\bin\plugins
+UnitOutputDir=..\..\dcu
+PackageDLLOutputDir=
+PackageDCPOutputDir=
+SearchPath=
+Packages=
+Conditionals=
+DebugSourceDirs=
+UsePackages=0
+[Parameters]
+RunParams=
+HostApplication=C:\Program Files\Borland\projects\Private\translator\trunk\bin\translator.exe
+Launcher=
+UseLauncher=0
+DebugCWD=
+[Version Info]
+IncludeVerInfo=1
+AutoIncBuild=0
+MajorVer=1
+MinorVer=9
+Release=0
+Build=41
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=1
+Locale=1033
+CodePage=1252
+[Version Info Keys]
+CompanyName=IniTranslator
+FileDescription=KeePass Plugin for IniTranslator
+FileVersion=1.9.0.41
+InternalName=KeePassParser.dll
+LegalCopyright=Copyright (c) 2006 by Peter Th\xF6rnqvist; all rights reserved
+LegalTrademarks=
+OriginalFilename=KeePassParser.dll
+ProductName=KeePass Plugin for IniTranslator
+ProductVersion=1.9.0.41
+Comments=Latest version at http://initranslator.sourceforge.net
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlUnitOutputDirectory]
+Count=2
+Item0=..\dcu
+Item1=..\..\dcu
+[HistoryLists\hlOutputDirectorry]
+Count=2
+Item0=..\bin
+Item1=..\..\bin\plugins
Added: translator/trunk/src/KeePassPlugin/KeePassParser.dpr
===================================================================
--- translator/trunk/src/KeePassPlugin/KeePassParser.dpr (rev 0)
+++ translator/trunk/src/KeePassPlugin/KeePassParser.dpr 2006-12-20 14:30:34 UTC (rev 212)
@@ -0,0 +1,43 @@
+{@abstract(app file for KeePass) }
+{
+ Copyright \xA9 2006 by Peter Thornqvist; all rights reserved
+
+ Developer(s):
+ p3 - peter3 att users dott sourceforge dott net
+
+ Status:
+ The contents of this file are subject to the Mozilla Public License Version
+ 1.1 (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html
+
+ Software distributed under the License is distributed on an "AS IS" basis,
+ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ the specific language governing rights and limitations under the License.
+}
+// $Id$
+library KeePassParser;
+
+uses
+ SysUtils,
+ Classes,
+ PreviewExportFrm in '..\PluginCommon\PreviewExportFrm.pas' {frmExport},
+ TransIntf in '..\TransIntf.pas',
+ KeePassParserImpl in 'KeePassParserImpl.pas',
+ CommonUtils in '..\CommonUtils.pas',
+ SingleImportFrm in '..\PluginCommon\SingleImportFrm.pas' {frmSingleImport: TTntForm},
+ KeePassParserLang in 'KeePassParserLang.pas',
+ WideIniFiles in '..\WideIniFiles.pas';
+
+{$R *.res}
+
+function InstallPlugin(out Parser: IFileParser): HResult; stdcall;
+begin
+ Parser := TKeePassParser.Create;
+ Result := S_OK;
+end;
+
+exports InstallPlugin name cRegisterTransFileParserFuncName;
+begin
+
+end.
+
Property changes on: translator/trunk/src/KeePassPlugin/KeePassParser.dpr
___________________________________________________________________
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Added: translator/trunk/src/KeePassPlugin/KeePassParser.res
===================================================================
(Binary files differ)
Property changes on: translator/trunk/src/KeePassPlugin/KeePassParser.res
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: translator/trunk/src/KeePassPlugin/KeePassParserImpl.pas
===================================================================
--- translator/trunk/src/KeePassPlugin/KeePassParserImpl.pas (rev 0)
+++ translator/trunk/src/KeePassPlugin/KeePassParserImpl.pas 2006-12-20 14:30:34 UTC (rev 212)
@@ -0,0 +1,269 @@
+{@abstract(Parser for KeePass) }
+{
+keepass.sourceforge.net
+ Copyright \xA9 2006 by Peter Thornqvist; all rights reserved
+
+ Developer(s):
+ p3 - peter3 att users dott sourceforge dott net
+
+ Status:
+ The contents of this file are subject to the Mozilla Public License Version
+ 1.1 (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html
+
+ Software distributed under the License is distributed on an "AS IS" basis,
+ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ the specific language governing rights and limitations under the License.
+}
+// $Id$
+
+unit KeePassParserImpl;
+
+interface
+uses
+ Classes, Types, TntClasses, TntSysUtils, TransIntf;
+
+type
+ TKeePassParser = class(TInterfacedObject, IUnknown, IFileParser, ILocalizable)
+ private
+ FIndex: integer;
+ FFilename: WideString;
+ procedure LoadSettings;
+ procedure SaveSettings;
+ procedure BuildPreview(Items: ITranslationItems; Strings: TTntStrings);
+ public
+
+ function Capabilities: Integer; safecall;
+ function Configure(Capability: Integer): HRESULT; safecall;
+ function DisplayName(Capability: Integer): WideString; safecall;
+ function ExportItems(const Items: ITranslationItems;
+ const Orphans: ITranslationItems): HRESULT; safecall;
+ function ImportItems(const Items: ITranslationItems;
+ const Orphans: ITranslationItems): HRESULT; safecall;
+ procedure Init(const ApplicationServices: IApplicationServices); safecall;
+ function GetString(out Section: WideString; out Name: WideString;
+ out Value: WideString): WordBool; safecall;
+ end;
+
+implementation
+uses
+ Windows, SysUtils, Forms,
+ TntWideStrUtils, WideIniFiles,
+ SingleImportFrm, PreviewExportFrm,
+ KeePassParserLang;
+
+{ TKeePassParser }
+
+function TKeePassParser.Capabilities: Integer;
+begin
+ Result := CAP_IMPORT or CAP_EXPORT;
+end;
+
+function TKeePassParser.Configure(Capability: Integer): HRESULT;
+begin
+ Result := E_NOTIMPL;
+end;
+
+function TKeePassParser.DisplayName(Capability: Integer): WideString;
+begin
+ case Capability of
+ CAP_IMPORT:
+ Result := Translate(cKeePassImportTitle);
+ CAP_EXPORT:
+ Result := Translate(cKeePassExportTitle);
+ else
+ Result := '';
+ end;
+end;
+
+procedure TKeePassParser.BuildPreview(Items: ITranslationItems; Strings: TTntStrings);
+var
+ i: integer;
+ S: WideString;
+begin
+ Strings.Clear;
+ S := '';
+ for i := 0 to Items.Count - 1 do
+ S := S + WideFormat('|%s||%s|', [Items[i].Original, Items[i].Translation]);
+ Strings.Add(S);
+end;
+
+function TKeePassParser.ExportItems(const Items, Orphans: ITranslationItems): HRESULT;
+var
+ S: TTntStringlist;
+ FOldSort: TTranslateSortType;
+begin
+ Result := S_FALSE;
+ FOldSort := Items.Sort;
+ try
+ LoadSettings;
+ Items.Sort := stIndex;
+ S := TTntStringlist.Create;
+ try
+ BuildPreview(Items, S);
+ if TfrmExport.Execute(GlobalAppServices, FFilename,
+ Translate(cKeePassExportTitle), Translate(cKeePassFilter), '.', 'lng', S, true) then
+ begin
+ S.Text := Tnt_WideStringReplace(S.Text, CRLF, '', [rfReplaceAll]);
+ S.AnsiStrings.SaveToFileEx(FFilename, CP_UTF8);
+ Result := S_OK;
+ SaveSettings;
+ end;
+ finally
+ S.Free;
+ Items.Sort := FOldSort;
+ end;
+ except
+ Application.HandleException(self);
+ end;
+end;
+
+// format:
+// |ORIGINAL||Translation||ORIGINAL||Translation|...
+
+function TKeePassParser.GetString(out Section, Name, Value: WideString): WordBool;
+begin
+ Result := true;
+ case FIndex of
+ 0: Value := cKeePassFilter;
+ 1: Value := cKeePassImportTitle;
+ 2: Value := cKeePassExportTitle;
+ else
+ Result := false;
+ end;
+ if Result then
+ begin
+ Section := cSectionName;
+ Name := Value;
+ Inc(FIndex);
+ end
+ else
+ FIndex := 0;
+end;
+
+function TKeePassParser.ImportItems(const Items, Orphans: ITranslationItems): HRESULT;
+var
+ S: TTntStringlist;
+
+ procedure ParseItems(P: PWideChar);
+ const
+ cNull = WideChar(#0);
+ cBar = WideChar('|');
+ type
+ States = (Original, Translation);
+ var
+ R, S: PWideChar;
+
+ AStates: States;
+ TI: ITranslationItem;
+
+ begin
+ AStates := Original;
+ TI := nil;
+ S := WStrEnd(P);
+ while P < S do
+ begin
+ if P^ = cBar then
+ begin
+ case AStates of
+ Original:
+ begin
+ Inc(P);
+ R := P;
+ while P^ <> cBar do
+ Inc(P);
+ if P^ = cBar then
+ begin
+ P^ := cNull;
+ TI := Items.Add;
+ TI.Section := cSectionName;
+ TI.Name := IntToStr(TI.Index);
+ TI.Original := R;
+ end;
+ Inc(P);
+ AStates := Translation;
+ end;
+ Translation:
+ begin
+ Inc(P);
+ R := P;
+ while P^ <> cBar do
+ Inc(P);
+ if P^ = cBar then
+ begin
+ P^ := cNull;
+ if TI <> nil then
+ begin
+ TI.Translation := R;
+ TI.Translated := TI.Translation <> '';
+ end;
+ TI := nil;
+ end;
+ Inc(P);
+ AStates := Original;
+ end;
+ end;
+ end
+ else
+ Inc(P);
+ end;
+ end;
+begin
+ LoadSettings;
+ if TfrmSingleImport.Execute(GlobalAppServices, FFilename,
+ Translate(cKeePassImportTitle), Translate(cKeePassFilter), '.', 'lng') then
+ begin
+ Items.Clear;
+ Orphans.Clear;
+ Items.Sort := stNone;
+ S := TTntStringlist.Create;
+ try
+ S.LoadFromFile(FFilename);
+ ParseItems(PWideChar(S.Text));
+ Items.Modified := false;
+ SaveSettings;
+ Result := S_OK;
+ finally
+ S.Free;
+ end;
+ end
+ else
+ Result := S_FALSE;
+end;
+
+procedure TKeePassParser.Init(const ApplicationServices: IApplicationServices);
+begin
+ GlobalAppServices := ApplicationServices;
+end;
+
+procedure TKeePassParser.LoadSettings;
+begin
+ try
+ with TWideMemIniFile.Create(ChangeFileExt(GetModuleName(hInstance), '.ini')) do
+ try
+ FFilename := ReadString('Settings', 'Filename', FFilename);
+ finally
+ Free;
+ end;
+ except
+ Application.HandleException(self);
+ end;
+end;
+
+procedure TKeePassParser.SaveSettings;
+begin
+ try
+ with TWideMemIniFile.Create(ChangeFileExt(GetModuleName(hInstance), '.ini')) do
+ try
+ WriteString('Settings', 'Filename', FFilename);
+ UpdateFile;
+ finally
+ Free;
+ end;
+ except
+ Application.HandleException(self);
+ end;
+end;
+
+end.
+
Property changes on: translator/trunk/src/KeePassPlugin/KeePassParserImpl.pas
___________________________________________________________________
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Added: translator/trunk/src/KeePassPlugin/KeePassParserLang.pas
===================================================================
--- translator/trunk/src/KeePassPlugin/KeePassParserLang.pas (rev 0)
+++ translator/trunk/src/KeePassPlugin/KeePassParserLang.pas 2006-12-20 14:30:34 UTC (rev 212)
@@ -0,0 +1,28 @@
+unit KeePassParserLang;
+
+interface
+uses
+ TransIntf;
+
+const
+ cSectionName = 'KeePass';
+ cKeePassFilter = 'KeePass Language Files (*.lng)|*.lng|All files (*.*)|*.*';
+ cKeePassImportTitle = 'Import from KeePass language file';
+ cKeePassExportTitle = 'Export to KeePass language file';
+
+var
+ GlobalAppServices: IApplicationServices = nil;
+function Translate(Value: WideString): WideString;
+
+implementation
+
+function Translate(Value: WideString): WideString;
+begin
+ if GlobalAppServices <> nil then
+ Result := GlobalAppServices.Translate(cSectionName, Value, Value)
+ else
+ Result := Value;
+end;
+
+end.
+
Property changes on: translator/trunk/src/KeePassPlugin/KeePassParserLang.pas
___________________________________________________________________
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|