Changeset 72 for trunk/Forms


Ignore:
Timestamp:
Dec 13, 2021, 8:47:20 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Properties with just BASE64 instead of ENCODING=BASE64 was not decoded using Base64 and so contact photos were not loaded correctly.
  • Added: Allow to save from file and load to file contact property values in All fields tab.
Location:
trunk/Forms
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContacts.lfm

    r61 r72  
    1414  object ListView1: TListView
    1515    Left = 0
    16     Height = 810
     16    Height = 801
    1717    Top = 0
    1818    Width = 1210
     
    6666    Left = 0
    6767    Height = 39
    68     Top = 842
     68    Top = 833
    6969    Width = 1210
    7070    Align = alBottom
     
    114114    Left = 0
    115115    Height = 32
    116     Top = 810
     116    Top = 801
    117117    Width = 1210
    118118    OnChange = ListViewFilter1Change
     
    121121  object StatusBar1: TStatusBar
    122122    Left = 0
    123     Height = 27
    124     Top = 881
     123    Height = 36
     124    Top = 872
    125125    Width = 1210
    126126    Panels = <   
  • trunk/Forms/UFormContacts.pas

    r63 r72  
    473473begin
    474474  if FUpdateCount = 0 then DoUpdateInterface;
    475   ALoadFromFile.Enabled := Assigned(ListView1.Selected);
    476   ASaveToFile.Enabled := Assigned(ListView1.Selected);
    477   AModify.Enabled := Assigned(ListView1.Selected);
    478   AClone.Enabled := Assigned(ListView1.Selected);
    479   ARemove.Enabled := Assigned(ListView1.Selected);
     475  AAdd.Enabled := Assigned(Contacts);
     476  AModify.Enabled := Assigned(Contacts) and Assigned(ListView1.Selected);
     477  AClone.Enabled := Assigned(Contacts) and Assigned(ListView1.Selected);
     478  ARemove.Enabled := Assigned(Contacts) and Assigned(ListView1.Selected);
    480479  ASelectAll.Enabled := ListView1.Items.Count > 0;
     480  ALoadFromFile.Enabled := Assigned(Contacts) and Assigned(ListView1.Selected);
     481  ASaveToFile.Enabled := Assigned(Contacts) and Assigned(ListView1.Selected);
    481482end;
    482483
  • trunk/Forms/UFormProperties.lfm

    r62 r72  
    7474      Action = AClone
    7575    end
     76    object ToolButton5: TToolButton
     77      Left = 141
     78      Height = 33
     79      Top = 2
     80      Style = tbsSeparator
     81    end
     82    object ToolButton6: TToolButton
     83      Left = 149
     84      Top = 2
     85      Action = ALoadValueFromFile
     86    end
     87    object ToolButton7: TToolButton
     88      Left = 184
     89      Top = 2
     90      Action = ASaveValueToFile
     91    end
    7692  end
    7793  object ListViewFilter1: TListViewFilter
     
    112128    object MenuItem4: TMenuItem
    113129      Action = ASelectAll
     130    end
     131    object MenuItem6: TMenuItem
     132      Caption = '-'
     133    end
     134    object MenuItem7: TMenuItem
     135      Action = ALoadValueFromFile
     136    end
     137    object MenuItem8: TMenuItem
     138      Action = ASaveValueToFile
    114139    end
    115140  end
     
    146171      OnExecute = ACloneExecute
    147172    end
     173    object ASaveValueToFile: TAction
     174      Caption = 'Save value to file...'
     175      ImageIndex = 7
     176      OnExecute = ASaveValueToFileExecute
     177    end
     178    object ALoadValueFromFile: TAction
     179      Caption = 'Load value from file...'
     180      ImageIndex = 5
     181      OnExecute = ALoadValueFromFileExecute
     182    end
    148183  end
    149184  object ListViewSort1: TListViewSort
     
    157192    Top = 428
    158193  end
     194  object SaveDialog1: TSaveDialog
     195    Left = 760
     196    Top = 448
     197  end
     198  object OpenDialog1: TOpenDialog
     199    Left = 760
     200    Top = 520
     201  end
    159202end
  • trunk/Forms/UFormProperties.lrj

    r62 r72  
    88{"hash":93079237,"name":"tformproperties.aremove.caption","sourcebytes":[82,101,109,111,118,101],"value":"Remove"},
    99{"hash":195296268,"name":"tformproperties.aselectall.caption","sourcebytes":[83,101,108,101,99,116,32,97,108,108],"value":"Select all"},
    10 {"hash":4863557,"name":"tformproperties.aclone.caption","sourcebytes":[67,108,111,110,101],"value":"Clone"}
     10{"hash":4863557,"name":"tformproperties.aclone.caption","sourcebytes":[67,108,111,110,101],"value":"Clone"},
     11{"hash":201478110,"name":"tformproperties.asavevaluetofile.caption","sourcebytes":[83,97,118,101,32,118,97,108,117,101,32,116,111,32,102,105,108,101,46,46,46],"value":"Save value to file..."},
     12{"hash":231494782,"name":"tformproperties.aloadvaluefromfile.caption","sourcebytes":[76,111,97,100,32,118,97,108,117,101,32,102,114,111,109,32,102,105,108,101,46,46,46],"value":"Load value from file..."}
    1113]}
  • trunk/Forms/UFormProperties.pas

    r54 r72  
    1616    AAdd: TAction;
    1717    AClone: TAction;
     18    ASaveValueToFile: TAction;
     19    ALoadValueFromFile: TAction;
    1820    ASelectAll: TAction;
    1921    ARemove: TAction;
     
    2830    MenuItem4: TMenuItem;
    2931    MenuItem5: TMenuItem;
     32    MenuItem6: TMenuItem;
     33    MenuItem7: TMenuItem;
     34    MenuItem8: TMenuItem;
     35    OpenDialog1: TOpenDialog;
    3036    PopupMenuField: TPopupMenu;
     37    SaveDialog1: TSaveDialog;
    3138    StatusBar1: TStatusBar;
    3239    ToolBar1: TToolBar;
     
    3542    ToolButton3: TToolButton;
    3643    ToolButton4: TToolButton;
     44    ToolButton5: TToolButton;
     45    ToolButton6: TToolButton;
     46    ToolButton7: TToolButton;
    3747    procedure AAddExecute(Sender: TObject);
    3848    procedure ACloneExecute(Sender: TObject);
     49    procedure ALoadValueFromFileExecute(Sender: TObject);
    3950    procedure AModifyExecute(Sender: TObject);
    4051    procedure ARemoveExecute(Sender: TObject);
     52    procedure ASaveValueToFileExecute(Sender: TObject);
    4153    procedure ASelectAllExecute(Sender: TObject);
    4254    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     
    7082
    7183uses
    72   UFormProperty, UCore;
     84  UFormProperty, UCore, UCommon;
    7385
    7486resourcestring
     
    7890  SFiltered = 'Filtered';
    7991  SSelected = 'Selected';
     92  SAllFiles = 'All files';
     93  STextFiles = 'Text files';
     94  SValue = 'Value';
     95
     96const
     97  TextFileExt = '.txt';
    8098
    8199{ TFormProperties }
     
    247265end;
    248266
     267procedure TFormProperties.ALoadValueFromFileExecute(Sender: TObject);
     268begin
     269  if Assigned(ListView1.Selected) then begin
     270    OpenDialog1.Filter := STextFiles + '|*' + TextFileExt + '|' + SAllFiles + '|*.*';
     271    OpenDialog1.DefaultExt := TextFileExt;
     272    OpenDialog1.InitialDir := ExtractFileDir(Core.LastPropertyValueFileName);
     273    OpenDialog1.FileName := ExtractFileName(Core.LastPropertyValueFileName);
     274    if OpenDialog1.Execute then begin
     275      TContactProperty(ListView1.Selected.Data).Value := LoadFileToStr(OpenDialog1.FileName);
     276      Core.LastPropertyValueFileName := OpenDialog1.FileName;
     277      ReloadList;
     278    end;
     279  end;
     280end;
     281
    249282procedure TFormProperties.AModifyExecute(Sender: TObject);
    250283var
     
    289322end;
    290323
     324procedure TFormProperties.ASaveValueToFileExecute(Sender: TObject);
     325begin
     326  if Assigned(ListView1.Selected) then begin
     327    SaveDialog1.Filter := STextFiles + '|*' + TextFileExt + '|' + SAllFiles + '|*.*';
     328    SaveDialog1.DefaultExt := TextFileExt;
     329    SaveDialog1.InitialDir := ExtractFileDir(Core.LastPropertyValueFileName);
     330    SaveDialog1.FileName := SValue + TextFileExt;
     331    if SaveDialog1.Execute then begin
     332      SaveStringToFile(TContactProperty(ListView1.Selected.Data).Value, SaveDialog1.FileName);
     333      Core.LastPropertyValueFileName := SaveDialog1.FileName;
     334    end;
     335  end;
     336end;
     337
    291338procedure TFormProperties.ASelectAllExecute(Sender: TObject);
    292339begin
     
    324371  AAdd.Enabled := Assigned(Properties);
    325372  AModify.Enabled := Assigned(Properties) and Assigned(ListView1.Selected);
     373  AClone.Enabled := Assigned(Properties) and Assigned(ListView1.Selected);;
    326374  ARemove.Enabled := Assigned(Properties) and Assigned(ListView1.Selected);
     375  ALoadValueFromFile.Enabled := Assigned(Properties) and Assigned(ListView1.Selected);
     376  ASaveValueToFile.Enabled := Assigned(Properties) and Assigned(ListView1.Selected);
     377  ASelectAll.Enabled := ListView1.Items.Count > 0;
    327378
    328379  Text := '';
Note: See TracChangeset for help on using the changeset viewer.