From f0d779890f150eeddbd10d9b19bec716f0f8f48d Mon Sep 17 00:00:00 2001 From: mbirth Date: Wed, 8 Dec 2004 09:36:32 +0000 Subject: [PATCH] modified PBE.cfg modified PBE.dof modified PBE_U.dfm modified PBE_U.pas * Form design + Code preparation for other parsers --- PBE.cfg | 4 +- PBE.dof | 59 +++++++++++-- PBE_U.dfm | 124 +++++++++++++++++++++++---- PBE_U.pas | 249 ++++++++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 367 insertions(+), 69 deletions(-) diff --git a/PBE.cfg b/PBE.cfg index dc18277..10fc3e1 100644 --- a/PBE.cfg +++ b/PBE.cfg @@ -31,5 +31,5 @@ -M -$M16384,1048576 -K$00400000 --LE"c:\program files\borland\delphi6\Projects\Bpl" --LN"c:\program files\borland\delphi6\Projects\Bpl" +-LE"c:\program files\borland\delphi7\Projects\Bpl" +-LN"c:\program files\borland\delphi7\Projects\Bpl" diff --git a/PBE.dof b/PBE.dof index 514090f..f30219f 100644 --- a/PBE.dof +++ b/PBE.dof @@ -1,5 +1,5 @@ [FileVersion] -Version=6.0 +Version=7.0 [Compiler] A=8 B=0 @@ -30,6 +30,55 @@ 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=1 +UnsafeCode=1 +UnsafeCast=1 [Linker] MapFile=0 OutputObjs=0 @@ -62,11 +111,11 @@ ProjectLang= RootDir= [Version Info] IncludeVerInfo=1 -AutoIncBuild=0 +AutoIncBuild=1 MajorVer=1 -MinorVer=0 +MinorVer=1 Release=0 -Build=0 +Build=15 Debug=0 PreRelease=1 Special=0 @@ -77,7 +126,7 @@ CodePage=1252 [Version Info Keys] CompanyName= FileDescription= -FileVersion=1.0.0.0 +FileVersion=1.1.0.15 InternalName=PhoneBackup Editor LegalCopyright= LegalTrademarks= diff --git a/PBE_U.dfm b/PBE_U.dfm index 0699671..1bf6b8b 100644 --- a/PBE_U.dfm +++ b/PBE_U.dfm @@ -27,6 +27,29 @@ object Form1: TForm1 'C:\Documents and Settings\Administrator\My Documents\Development' + '\Delphi\PBE' end + object ProgBarText: TLabel + Left = 336 + Top = 240 + Width = 257 + Height = 21 + AutoSize = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + Visible = False + end + object FileName: TEdit + Left = 336 + Top = 240 + Width = 257 + Height = 21 + Enabled = False + TabOrder = 2 + Text = '*.MS' + end object PageControl1: TPageControl Left = 8 Top = 272 @@ -371,6 +394,7 @@ object Form1: TForm1 Top = 36 Width = 48 Height = 13 + Alignment = taRightJustify Caption = 'Recipient:' end object SM_List: TListBox @@ -444,9 +468,25 @@ object Form1: TForm1 Enabled = False TabOrder = 7 end + object SM_RadioSent: TRadioButton + Left = 200 + Top = 56 + Width = 49 + Height = 17 + Caption = 'Sent' + TabOrder = 9 + end + object SM_RadioRecvd: TRadioButton + Left = 296 + Top = 56 + Width = 73 + Height = 17 + Caption = 'Received' + TabOrder = 10 + end object SM_Message: TMemo Left = 136 - Top = 56 + Top = 72 Width = 233 Height = 137 Enabled = False @@ -463,8 +503,12 @@ object Form1: TForm1 Top = 8 Width = 769 Height = 273 - ActivePage = TabSheet7 + ActivePage = TabSheet6 TabOrder = 0 + object TabSheet6: TTabSheet + Caption = 'Data Accounts' + ImageIndex = 1 + end object TabSheet5: TTabSheet Caption = 'WAP Profiles' object WP_List: TListBox @@ -476,10 +520,6 @@ object Form1: TForm1 TabOrder = 0 end end - object TabSheet6: TTabSheet - Caption = 'Data Accounts' - ImageIndex = 1 - end object TabSheet7: TTabSheet Caption = 'Bookmarks' ImageIndex = 2 @@ -538,7 +578,7 @@ object Form1: TForm1 TabOrder = 4 end object BM_NewButton: TButton - Left = 336 + Left = 256 Top = 152 Width = 75 Height = 25 @@ -553,6 +593,14 @@ object Form1: TForm1 Caption = 'Delete!' TabOrder = 6 end + object BM_ButtonSave: TButton + Left = 336 + Top = 152 + Width = 75 + Height = 25 + Caption = 'Save' + TabOrder = 7 + end end object TabSheet8: TTabSheet Caption = 'Profiles' @@ -600,6 +648,55 @@ object Form1: TForm1 object TabSheet11: TTabSheet Caption = 'My Shortcuts' ImageIndex = 6 + object SC_List: TListBox + Left = 8 + Top = 8 + Width = 425 + Height = 225 + ItemHeight = 13 + TabOrder = 0 + end + object SC_ButtonUp: TButton + Left = 432 + Top = 200 + Width = 49 + Height = 17 + Caption = 'Up' + TabOrder = 1 + end + object SC_ButtonDown: TButton + Left = 432 + Top = 216 + Width = 49 + Height = 17 + Caption = 'Down' + TabOrder = 2 + end + object SC_AvailSCs: TComboBox + Left = 440 + Top = 8 + Width = 313 + Height = 21 + ItemHeight = 13 + TabOrder = 3 + Text = 'SC_AvailSCs' + end + object SC_ButtonAdd: TButton + Left = 440 + Top = 32 + Width = 75 + Height = 25 + Caption = '< Add' + TabOrder = 4 + end + object SC_ButtonDel: TButton + Left = 440 + Top = 96 + Width = 75 + Height = 25 + Caption = 'Delete!' + TabOrder = 5 + end end end end @@ -707,15 +804,6 @@ object Form1: TForm1 SimplePanel = True SimpleText = 'Select a PhoneBackup file (*.MS)' end - object FileName: TEdit - Left = 336 - Top = 240 - Width = 257 - Height = 21 - Enabled = False - TabOrder = 2 - Text = '*.MS' - end object FileListBox1: TFileListBox Left = 336 Top = 24 @@ -771,9 +859,10 @@ object Form1: TForm1 Top = 240 Width = 49 Height = 20 - Caption = 'Save' + Caption = 'Save!' Enabled = False TabOrder = 8 + OnClick = Button_SaveClick end object ProgressBar: TProgressBar Left = 336 @@ -791,6 +880,7 @@ object Form1: TForm1 Caption = 'Save As' Enabled = False TabOrder = 10 + OnClick = Button_SaveAsClick end object Button_Close: TButton Left = 769 diff --git a/PBE_U.pas b/PBE_U.pas index 785cbb7..5504af2 100644 --- a/PBE_U.pas +++ b/PBE_U.pas @@ -104,6 +104,16 @@ type DBG_SelEntry: TSpinEdit; DBG_LastEntry: TCheckBox; DBG_Groups: TMemo; + ProgBarText: TLabel; + SC_List: TListBox; + SC_ButtonUp: TButton; + SC_ButtonDown: TButton; + SC_AvailSCs: TComboBox; + SC_ButtonAdd: TButton; + SC_ButtonDel: TButton; + SM_RadioSent: TRadioButton; + SM_RadioRecvd: TRadioButton; + BM_ButtonSave: TButton; procedure Button_LoadClick(Sender: TObject); procedure PB_ListClick(Sender: TObject); procedure PB_OrderFLClick(Sender: TObject); @@ -114,6 +124,8 @@ type procedure DirectoryListBox1Change(Sender: TObject); procedure Button_CloseClick(Sender: TObject); procedure DBG_ShowEntryClick(Sender: TObject); + procedure Button_SaveClick(Sender: TObject); + procedure Button_SaveAsClick(Sender: TObject); private { Private declarations } public @@ -365,12 +377,38 @@ procedure ReadPBintoMem(var InFile: TextFile); var i, j: integer; cl, gp: AnsiString; begin + (********************************************************************* + ***** READ FILE INTO ARRAY ***** + *********************************************************************) Form1.ProgressBar.Min := 0; Form1.ProgressBar.Max := FileSize(InFile); Form1.ProgressBar.Position := 0; Form1.ProgressBar.Visible := true; + Form1.ProgBarText.Caption := 'Reading file...'; + Application.ProcessMessages; i:=0; gp := ''; + Groups.Contacts.from := $FFFF; + Groups.Contacts.til := $FFFF; + Groups.Calendar.from := $FFFF; + Groups.Calendar.til := $FFFF; + Groups.SMSes.from := $FFFF; + Groups.SMSes.til := $FFFF; + Groups.SettingsData.from := $FFFF; + Groups.SettingsData.til := $FFFF; + Groups.SettingsWAP.from := $FFFF; + Groups.SettingsWAP.til := $FFFF; + Groups.Bookmarks.from := $FFFF; + Groups.Bookmarks.til := $FFFF; + Groups.SettingsProfiles.from := $FFFF; + Groups.SettingsProfiles.til := $FFFF; + Groups.SettingsLocks.from := $FFFF; + Groups.SettingsLocks.til := $FFFF; + Groups.SettingsTime.from := $FFFF; + Groups.SettingsTime.til := $FFFF; + Groups.SettingsCustMenu.from := $FFFF; + Groups.SettingsCustMenu.til := $FFFF; + repeat ReadLn(InFile, cl); Form1.ProgressBar.Position := FilePos(InFile); @@ -423,6 +461,7 @@ begin PB[i-1].Value := PB[i-1].Value + Copy(cl,1,Pos('/>', cl)-2); end; until Eof(InFile); + Form1.ProgressBar.Visible := false; Form1.DBG_Count.Text := IntToStr(i); Form1.DBG_SelEntry.MaxValue := i-1; Form1.DBG_Groups.Text := 'Contacts: '+IntToStr(Groups.Contacts.from)+'..'+IntToStr(Groups.Contacts.til)+CRLF+ @@ -436,25 +475,113 @@ begin 'Time: '+IntToStr(Groups.SettingsTime.from)+'..'+IntToStr(Groups.SettingsTime.til)+CRLF+ 'CustomMenu: '+IntToStr(Groups.SettingsCustMenu.from)+'..'+IntToStr(Groups.SettingsCustMenu.til); - Form1.ProgressBar.Visible := false; Form1.StatusBar.SimpleText := 'File openened. Now parsing for Contacts ...'; - j := 1; - i := Groups.Contacts.from; - Form1.ProgressBar.Min := Groups.Contacts.from; - Form1.ProgressBar.Max := Groups.Contacts.til; - Form1.ProgressBar.Position := Groups.Contacts.from; - Form1.ProgressBar.Visible := true; - while (i<=Groups.Contacts.til) do begin - Form1.ProgressBar.Position := i; - SetLength(PhoneBook, j); - PhoneBook[j-1] := ParsePBStream(PB[i].Value); - Inc(j); - Inc(i); + (********************************************************************* + ***** PARSE CONTACTS FROM ARRAY ***** + *********************************************************************) + Form1.ProgBarText.Caption := 'Parsing Contacts (1/10) ...'; + Application.ProcessMessages; + if (Groups.Contacts.from<$FFFF) then begin + j := 1; + i := Groups.Contacts.from; + Form1.ProgressBar.Min := Groups.Contacts.from; + Form1.ProgressBar.Max := Groups.Contacts.til; + Form1.ProgressBar.Position := Groups.Contacts.from; + Form1.ProgressBar.Visible := true; + while (i<=Groups.Contacts.til) do begin + Form1.ProgressBar.Position := i; + SetLength(PhoneBook, j); + PhoneBook[j-1] := ParsePBStream(PB[i].Value); + Inc(j); + Inc(i); + end; + Form1.StatusBar.SimpleText := 'Loaded '+IntToStr(Length(PhoneBook))+' contacts into memory.'; + BuildPBList; + Form1.ProgressBar.Visible := false; end; - Form1.StatusBar.SimpleText := 'Loaded '+IntToStr(Length(PhoneBook))+' contacts into memory.'; - BuildPBList; - Form1.ProgressBar.Visible := false; + + (********************************************************************* + ***** PARSE CALENDAR ENTRIES FROM ARRAY ***** + *********************************************************************) + Form1.ProgBarText.Caption := 'Parsing Calendar (2/10) ...'; + Application.ProcessMessages; + if (Groups.Calendar.from<$FFFF) then begin + + end; + + (********************************************************************* + ***** PARSE SMSes FROM ARRAY ***** + *********************************************************************) + Form1.ProgBarText.Caption := 'Parsing SMSes (3/10) ...'; + Application.ProcessMessages; + if (Groups.SMSes.from<$FFFF) then begin + + end; + + (********************************************************************* + ***** PARSE DATA ACCOUNTS FROM ARRAY ***** + *********************************************************************) + Form1.ProgBarText.Caption := 'Parsing Data accounts (4/10) ...'; + Application.ProcessMessages; + if (Groups.SettingsData.from<$FFFF) then begin + + end; + + (********************************************************************* + ***** PARSE WAP ACCOUNTS FROM ARRAY ***** + *********************************************************************) + Form1.ProgBarText.Caption := 'Parsing WAP accounts (5/10) ...'; + Application.ProcessMessages; + if (Groups.SettingsWAP.from<$FFFF) then begin + + end; + + (********************************************************************* + ***** PARSE BOOKMARKS FROM ARRAY ***** + *********************************************************************) + Form1.ProgBarText.Caption := 'Parsing Bookmarks (6/10) ...'; + Application.ProcessMessages; + if (Groups.Bookmarks.from<$FFFF) then begin + + end; + + (********************************************************************* + ***** PARSE PROFILES FROM ARRAY ***** + *********************************************************************) + Form1.ProgBarText.Caption := 'Parsing Profiles (7/10) ...'; + Application.ProcessMessages; + if (Groups.SettingsProfiles.from<$FFFF) then begin + + end; + + (********************************************************************* + ***** PARSE LOCK SETTINGS FROM ARRAY ***** + *********************************************************************) + Form1.ProgBarText.Caption := 'Parsing Locks (8/10) ...'; + Application.ProcessMessages; + if (Groups.SettingsLocks.from<$FFFF) then begin + + end; + + (********************************************************************* + ***** PARSE TIME SETTINGS FROM ARRAY ***** + *********************************************************************) + Form1.ProgBarText.Caption := 'Parsing Time settings (9/10) ...'; + Application.ProcessMessages; + if (Groups.SettingsTime.from<$FFFF) then begin + + end; + + (********************************************************************* + ***** PARSE CUSTOM MENUS FROM ARRAY ***** + *********************************************************************) + Form1.ProgBarText.Caption := 'Parsing Custom Menus (10/10) ...'; + Application.ProcessMessages; + if (Groups.SettingsCustMenu.from<$FFFF) then begin + + end; + end; procedure EnablePBFields(x: boolean); @@ -488,6 +615,8 @@ begin Form1.DriveComboBox1.Enabled := false; Form1.FilterComboBox1.Enabled := false; Form1.FileListBox1.Enabled := false; + Form1.FileName.Visible := false; + Form1.ProgBarText.Visible := true; BackupFileName := DirectoryListBox1.Directory+'\'+FileName.Text; StatusBar.SimpleText := 'Loading '+BackupFileName+' ...'; AssignFile(f,BackupFileName); @@ -497,6 +626,8 @@ begin ReadPBintoMem(f); StatusBar.SimpleText := StatusBar.SimpleText + ' done.'; CloseFile(f); + Form1.ProgBarText.Visible := false; + Form1.FileName.Visible := true; Form1.PB_List.Enabled := true; Form1.PB_OrderGroup.Enabled := true; Form1.PB_OrderFL.Enabled := true; @@ -561,6 +692,7 @@ end; procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin + StatusBar.SimpleText := 'Cleaning up ...'; DeleteTemp; end; @@ -576,35 +708,42 @@ end; procedure TForm1.Button_CloseClick(Sender: TObject); begin - StatusBar.SimpleText := 'Cleaning up ...'; - EnablePBFields(false); - PB_List.Enabled := false; - PB_OrderGroup.Enabled := false; - PB_OrderFL.Enabled := false; - PB_OrderLF.Enabled := false; - PB_List.Clear; - PB_Name.Text := ''; - PB_Home.Text := ''; - PB_Work.Text := ''; - PB_Mobile.Text := ''; - PB_Fax.Text := ''; - PB_Other.Text := ''; - PB_Email.Text := ''; - PB_Title.Text := ''; - PB_Company.Text := ''; - PB_PhotoAtt.Checked := false; - PB_Photo.Visible := false; - DeleteTemp; - SetLength(PhoneBook, 0); - StatusBar.SimpleText := StatusBar.SimpleText + ' done.'; - Button_Close.Enabled := false; - Button_SaveAs.Enabled := false; - Button_Save.Enabled := false; - if (FileExists(DirectoryListBox1.Directory+'\'+FileName.Text)) AND (Pos('*',FileName.Text)=0) then Button_Load.Enabled := true else Button_Load.Enabled := false; - Form1.DriveComboBox1.Enabled := true; - Form1.DirectoryListBox1.Enabled := true; - Form1.FilterComboBox1.Enabled := true; - Form1.FileListBox1.Enabled := true; + if (Button_Close.Caption = 'Close') then begin + StatusBar.SimpleText := 'Cleaning up ...'; + EnablePBFields(false); + PB_List.Enabled := false; + PB_OrderGroup.Enabled := false; + PB_OrderFL.Enabled := false; + PB_OrderLF.Enabled := false; + PB_List.Clear; + PB_Name.Text := ''; + PB_Home.Text := ''; + PB_Work.Text := ''; + PB_Mobile.Text := ''; + PB_Fax.Text := ''; + PB_Other.Text := ''; + PB_Email.Text := ''; + PB_Title.Text := ''; + PB_Company.Text := ''; + PB_PhotoAtt.Checked := false; + PB_Photo.Visible := false; + DeleteTemp; + SetLength(PhoneBook, 0); + StatusBar.SimpleText := StatusBar.SimpleText + ' done.'; + Button_Close.Enabled := false; + Button_SaveAs.Enabled := false; + Button_Save.Enabled := false; + if (FileExists(DirectoryListBox1.Directory+'\'+FileName.Text)) AND (Pos('*',FileName.Text)=0) then Button_Load.Enabled := true else Button_Load.Enabled := false; + Form1.DriveComboBox1.Enabled := true; + Form1.DirectoryListBox1.Enabled := true; + Form1.FilterComboBox1.Enabled := true; + Form1.FileListBox1.Enabled := true; + end else if Button_Close.Caption = 'Cancel' then begin + Button_SaveAs.Enabled := true; + Button_Close.Caption := 'Close'; + FileName.Text := ExtractFileName(BackupFileName); + FileName.Enabled := false; + end; end; procedure TForm1.DBG_ShowEntryClick(Sender: TObject); @@ -617,4 +756,24 @@ begin Form1.DBG_LastEntry.Checked := PB[i].LastOfGroup; end; +procedure TForm1.Button_SaveClick(Sender: TObject); +begin + ShowMessage('Not yet supported.'); + if (Button_Close.Caption = 'Cancel') then begin + Button_Close.Caption := 'Close'; + FileName.Enabled := false; + BackupFileName := DirectoryListBox1.Directory+'\'+FileName.Text; + Button_SaveAs.Enabled := true; + end; + AssignFile(f, BackupFileName); +end; + +procedure TForm1.Button_SaveAsClick(Sender: TObject); +begin + Button_SaveAs.Enabled := false; + Button_Close.Caption := 'Cancel'; + FileName.Enabled := true; + FileName.SetFocus; +end; + end.