Changeset 101 for trunk


Ignore:
Timestamp:
Feb 8, 2022, 6:07:35 PM (3 years ago)
Author:
chronos
Message:
  • Added: Buttons to show contact home and work addresses on online map. Predefined map uses openstreetmap.org.
Location:
trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.lfm

    r100 r101  
    11object FormContact: TFormContact
    2   Left = 604
     2  Left = 1121
    33  Height = 773
    4   Top = 484
     4  Top = 472
    55  Width = 1032
    66  Caption = 'Contact'
     
    1818    Top = 8
    1919    Width = 1009
    20     ActivePage = TabSheetGeneral
     20    ActivePage = TabSheetWork
    2121    Anchors = [akTop, akLeft, akRight, akBottom]
    2222    ParentFont = False
    23     TabIndex = 0
     23    TabIndex = 2
    2424    TabOrder = 0
    2525    object TabSheetGeneral: TTabSheet
     
    451451      object GroupBox1: TGroupBox
    452452        Left = 10
    453         Height = 252
     453        Height = 287
    454454        Top = 225
    455         Width = 961
     455        Width = 897
    456456        Anchors = [akTop, akLeft, akRight]
    457457        Caption = 'Address'
    458         ClientHeight = 224
    459         ClientWidth = 959
     458        ClientHeight = 259
     459        ClientWidth = 895
    460460        TabOrder = 6
    461461        object Label36: TLabel
     
    570570          ParentFont = False
    571571          TabOrder = 1
     572        end
     573        object ButtonHomeAddressShow: TButton
     574          Left = 10
     575          Height = 39
     576          Top = 208
     577          Width = 182
     578          Caption = 'Show on map'
     579          OnClick = ButtonHomeAddressShowClick
     580          TabOrder = 7
    572581        end
    573582      end
     
    685694      object GroupBox2: TGroupBox
    686695        Left = 8
    687         Height = 257
     696        Height = 283
    688697        Top = 325
    689         Width = 949
     698        Width = 920
    690699        Caption = 'Address'
    691         ClientHeight = 229
    692         ClientWidth = 947
     700        ClientHeight = 255
     701        ClientWidth = 918
    693702        TabOrder = 9
    694703        object Label31: TLabel
     
    700709          ParentFont = False
    701710        end
    702         object EditAddressWorkCountry: TEdit
     711        object EditWorkAddressCountry: TEdit
    703712          Left = 180
    704713          Height = 43
     
    708717          TabOrder = 5
    709718        end
    710         object EditAddressWorkRegion: TEdit
     719        object EditWorkAddressRegion: TEdit
    711720          Left = 180
    712721          Height = 43
     
    732741          ParentFont = False
    733742        end
    734         object EditAddressWorkStreetExtended: TEdit
     743        object EditWorkAddressStreetExtended: TEdit
    735744          Left = 180
    736745          Height = 43
     
    748757          ParentFont = False
    749758        end
    750         object EditAddressWorkStreet: TEdit
     759        object EditWorkAddressStreet: TEdit
    751760          Left = 180
    752761          Height = 43
     
    764773          ParentFont = False
    765774        end
    766         object EditAddressWorkPostOfficeBox: TEdit
     775        object EditWorkAddressPostOfficeBox: TEdit
    767776          Left = 633
    768777          Height = 43
     
    772781          TabOrder = 1
    773782        end
    774         object EditAddressWorkCity: TEdit
     783        object EditWorkAddressCity: TEdit
    775784          Left = 633
    776785          Height = 43
     
    788797          ParentFont = False
    789798        end
    790         object EditAddressWorkPostalCode: TEdit
     799        object EditWorkAddressPostalCode: TEdit
    791800          Left = 633
    792801          Height = 43
     
    803812          Caption = 'Postal code:'
    804813          ParentFont = False
     814        end
     815        object ButtonWorkAddressShow: TButton
     816          Left = 10
     817          Height = 39
     818          Top = 208
     819          Width = 182
     820          Caption = 'Show on map'
     821          OnClick = ButtonWorkAddressShowClick
     822          TabOrder = 7
    805823        end
    806824      end
  • trunk/Forms/UFormContact.lrj

    r100 r101  
    3636{"hash":4852682,"name":"tformcontact.label42.caption","sourcebytes":[67,105,116,121,58],"value":"City:"},
    3737{"hash":252071146,"name":"tformcontact.label43.caption","sourcebytes":[80,111,115,116,32,111,102,102,105,99,101,32,98,111,120,58],"value":"Post office box:"},
     38{"hash":119121168,"name":"tformcontact.buttonhomeaddressshow.caption","sourcebytes":[83,104,111,119,32,111,110,32,109,97,112],"value":"Show on map"},
    3839{"hash":72942298,"name":"tformcontact.label12.caption","sourcebytes":[77,111,98,105,108,101,58],"value":"Mobile:"},
    3940{"hash":91186314,"name":"tformcontact.label13.caption","sourcebytes":[80,104,111,110,101,58],"value":"Phone:"},
     
    5354{"hash":4852682,"name":"tformcontact.label29.caption","sourcebytes":[67,105,116,121,58],"value":"City:"},
    5455{"hash":186708218,"name":"tformcontact.label33.caption","sourcebytes":[80,111,115,116,97,108,32,99,111,100,101,58],"value":"Postal code:"},
     56{"hash":119121168,"name":"tformcontact.buttonworkaddressshow.caption","sourcebytes":[83,104,111,119,32,111,110,32,109,97,112],"value":"Show on map"},
    5557{"hash":91186314,"name":"tformcontact.label15.caption","sourcebytes":[80,104,111,110,101,58],"value":"Phone:"},
    5658{"hash":313530,"name":"tformcontact.label16.caption","sourcebytes":[70,97,120,58],"value":"Fax:"},
  • trunk/Forms/UFormContact.pas

    r100 r101  
    1919    APhotoLoad: TAction;
    2020    ActionList1: TActionList;
     21    ButtonHomeAddressShow: TButton;
    2122    ButtonCancel: TButton;
     23    ButtonWorkAddressShow: TButton;
    2224    ButtonNext: TButton;
    2325    ButtonOk: TButton;
     
    5254    EditHomeAddressStreet: TEdit;
    5355    EditHomeAddressStreetExtended: TEdit;
    54     EditAddressWorkCity: TEdit;
    55     EditAddressWorkCountry: TEdit;
    56     EditAddressWorkPostalCode: TEdit;
    57     EditAddressWorkPostOfficeBox: TEdit;
    58     EditAddressWorkRegion: TEdit;
    59     EditAddressWorkStreet: TEdit;
    60     EditAddressWorkStreetExtended: TEdit;
     56    EditWorkAddressCity: TEdit;
     57    EditWorkAddressCountry: TEdit;
     58    EditWorkAddressPostalCode: TEdit;
     59    EditWorkAddressPostOfficeBox: TEdit;
     60    EditWorkAddressRegion: TEdit;
     61    EditWorkAddressStreet: TEdit;
     62    EditWorkAddressStreetExtended: TEdit;
    6163    EditAniversary: TEdit;
    6264    EditJabber: TEdit;
     
    192194    procedure APhotoLoadExecute(Sender: TObject);
    193195    procedure APhotoSaveExecute(Sender: TObject);
     196    procedure ButtonHomeAddressShowClick(Sender: TObject);
    194197    procedure ButtonNextClick(Sender: TObject);
    195198    procedure ButtonPreviousClick(Sender: TObject);
     199    procedure ButtonWorkAddressShowClick(Sender: TObject);
    196200    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    197201    procedure FormCreate(Sender: TObject);
     
    254258begin
    255259  Result := FormatDateTime('yyyy-mm-dd', Date);
     260end;
     261
     262function URLEncode(Text: string): string;
     263var
     264  I: Integer;
     265begin
     266  Result := '';
     267  for I := 1 to Length(Text) do begin
     268    if not (Text[I] in ['A'..'Z', 'a'..'z', '0'..'9', '-', '_', '~', '.', ':', '/']) then
     269      Result := Result + '%' + IntToHex(Ord(Text[I]), 2)
     270    else
     271      Result := Result + Text[I];
     272  end;
    256273end;
    257274
     
    677694  Contact.Fields[cfOrganization] := EditOrganization.Text;
    678695  Contact.Fields[cfDepartment] := EditDepartment.Text;
    679   Contact.Fields[cfWorkAddressPostOfficeBox] := EditAddressWorkPostOfficeBox.Text;
    680   Contact.Fields[cfWorkAddressStreet] := EditAddressWorkStreet.Text;
    681   Contact.Fields[cfWorkAddressStreetExtended] := EditAddressWorkStreetExtended.Text;
    682   Contact.Fields[cfWorkAddressCity] := EditAddressWorkCity.Text;
    683   Contact.Fields[cfWorkAddressRegion] := EditAddressWorkRegion.Text;
    684   Contact.Fields[cfWorkAddressCountry] := EditAddressWorkCountry.Text;
    685   Contact.Fields[cfWorkAddressPostalCode] := EditAddressWorkPostalCode.Text;
     696  Contact.Fields[cfWorkAddressPostOfficeBox] := EditWorkAddressPostOfficeBox.Text;
     697  Contact.Fields[cfWorkAddressStreet] := EditWorkAddressStreet.Text;
     698  Contact.Fields[cfWorkAddressStreetExtended] := EditWorkAddressStreetExtended.Text;
     699  Contact.Fields[cfWorkAddressCity] := EditWorkAddressCity.Text;
     700  Contact.Fields[cfWorkAddressRegion] := EditWorkAddressRegion.Text;
     701  Contact.Fields[cfWorkAddressCountry] := EditWorkAddressCountry.Text;
     702  Contact.Fields[cfWorkAddressPostalCode] := EditWorkAddressPostalCode.Text;
    686703  Contact.Fields[cfUrlWork] := EditWorkWeb.Text;
    687704
     
    699716  EditOrganization.Text := Contact.Fields[cfOrganization];
    700717  EditDepartment.Text := Contact.Fields[cfDepartment];
    701   EditAddressWorkPostOfficeBox.Text := Contact.Fields[cfWorkAddressPostOfficeBox];
    702   EditAddressWorkStreet.Text := Contact.Fields[cfWorkAddressStreet];
    703   EditAddressWorkStreetExtended.Text := Contact.Fields[cfWorkAddressStreetExtended];
    704   EditAddressWorkCity.Text := Contact.Fields[cfWorkAddressCity];
    705   EditAddressWorkRegion.Text := Contact.Fields[cfWorkAddressRegion];
    706   EditAddressWorkCountry.Text := Contact.Fields[cfWorkAddressCountry];
    707   EditAddressWorkPostalCode.Text := Contact.Fields[cfWorkAddressPostalCode];
     718  EditWorkAddressPostOfficeBox.Text := Contact.Fields[cfWorkAddressPostOfficeBox];
     719  EditWorkAddressStreet.Text := Contact.Fields[cfWorkAddressStreet];
     720  EditWorkAddressStreetExtended.Text := Contact.Fields[cfWorkAddressStreetExtended];
     721  EditWorkAddressCity.Text := Contact.Fields[cfWorkAddressCity];
     722  EditWorkAddressRegion.Text := Contact.Fields[cfWorkAddressRegion];
     723  EditWorkAddressCountry.Text := Contact.Fields[cfWorkAddressCountry];
     724  EditWorkAddressPostalCode.Text := Contact.Fields[cfWorkAddressPostalCode];
    708725  EditWorkWeb.Text := Contact.Fields[cfUrlWork];
    709726end;
     
    771788end;
    772789
     790procedure TFormContact.ButtonHomeAddressShowClick(Sender: TObject);
     791var
     792  Address: string;
     793begin
     794  Address := '';
     795  if EditHomeAddressStreet.Text <> '' then Address := Address + ' ' + EditHomeAddressStreet.Text;
     796  if EditHomeAddressStreetExtended.Text <> '' then Address := Address + ' ' + EditHomeAddressStreetExtended.Text;
     797  if EditHomeAddressPostOfficeBox.Text <> '' then Address := Address + ' ' + EditHomeAddressPostOfficeBox.Text;
     798  if EditHomeAddressCity.Text <> '' then Address := Address + ' ' + EditHomeAddressCity.Text;
     799  if EditHomeAddressCountry.Text <> '' then Address := Address + ' ' + EditHomeAddressCountry.Text;
     800  OpenURL(Core.MapUrl + URLEncode(Trim(Address)));
     801end;
     802
    773803procedure TFormContact.ButtonPreviousClick(Sender: TObject);
    774804begin
    775805  if Assigned(FOnGetPrevious) then
    776806    Contact := FOnGetPrevious(Contact);
     807end;
     808
     809procedure TFormContact.ButtonWorkAddressShowClick(Sender: TObject);
     810var
     811  Address: string;
     812begin
     813  Address := '';
     814  if EditWorkAddressStreet.Text <> '' then Address := Address + ' ' + EditWorkAddressStreet.Text;
     815  if EditWorkAddressStreetExtended.Text <> '' then Address := Address + ' ' + EditWorkAddressStreetExtended.Text;
     816  if EditWorkAddressPostOfficeBox.Text <> '' then Address := Address + ' ' + EditWorkAddressPostOfficeBox.Text;
     817  if EditWorkAddressCity.Text <> '' then Address := Address + ' ' + EditWorkAddressCity.Text;
     818  if EditWorkAddressCountry.Text <> '' then Address := Address + ' ' + EditWorkAddressCountry.Text;
     819  OpenURL(Core.MapUrl + URLEncode(Trim(Address)));
    777820end;
    778821
  • trunk/Forms/UFormSettings.lfm

    r89 r101  
    11object FormSettings: TFormSettings
    22  Left = 798
    3   Height = 360
    4   Top = 367
    5   Width = 564
     3  Height = 421
     4  Top = 321
     5  Width = 548
    66  Caption = 'Settings'
    7   ClientHeight = 360
    8   ClientWidth = 564
    9   Constraints.MinHeight = 360
    10   Constraints.MinWidth = 480
    11   DesignTimePPI = 144
     7  ClientHeight = 421
     8  ClientWidth = 548
     9  Constraints.MinHeight = 421
     10  Constraints.MinWidth = 548
     11  DesignTimePPI = 150
    1212  OnClose = FormClose
    1313  OnCreate = FormCreate
    1414  OnShow = FormShow
    1515  Position = poScreenCenter
    16   LCLVersion = '2.0.12.0'
     16  LCLVersion = '2.2.0.4'
    1717  object ComboBoxLanguage: TComboBox
    18     Left = 240
    19     Height = 41
    20     Top = 16
    21     Width = 264
     18    Left = 250
     19    Height = 42
     20    Top = 17
     21    Width = 275
    2222    ItemHeight = 0
    2323    ParentFont = False
     
    2626  end
    2727  object Label1: TLabel
    28     Left = 24
    29     Height = 24
    30     Top = 24
    31     Width = 88
     28    Left = 25
     29    Height = 27
     30    Top = 25
     31    Width = 96
    3232    Caption = 'Language:'
    33     ParentColor = False
    3433    ParentFont = False
    3534  end
    3635  object ButtonOk: TButton
    37     Left = 438
    38     Height = 37
    39     Top = 307
    40     Width = 113
     36    Left = 416
     37    Height = 39
     38    Top = 365
     39    Width = 118
    4140    Anchors = [akRight, akBottom]
    4241    Caption = 'Ok'
     
    4746  end
    4847  object ButtonCancel: TButton
    49     Left = 294
    50     Height = 37
    51     Top = 307
    52     Width = 113
     48    Left = 266
     49    Height = 39
     50    Top = 365
     51    Width = 118
    5352    Anchors = [akRight, akBottom]
    5453    Caption = 'Cancel'
     
    5958  object CheckBoxAutomaticDPI: TCheckBox
    6059    Left = 24
    61     Height = 30
    62     Top = 200
    63     Width = 148
     60    Height = 31
     61    Top = 257
     62    Width = 154
    6463    Caption = 'Automatic DPI'
    6564    OnChange = CheckBoxAutomaticDPIChange
     
    6968  end
    7069  object SpinEditDPI: TSpinEdit
    71     Left = 240
    72     Height = 42
    73     Top = 232
    74     Width = 145
     70    Left = 249
     71    Height = 43
     72    Top = 291
     73    Width = 151
    7574    MaxValue = 300
    7675    MinValue = 96
     
    8180  end
    8281  object LabelDPI: TLabel
    83     Left = 56
    84     Height = 24
    85     Top = 240
    86     Width = 35
     82    Left = 57
     83    Height = 27
     84    Top = 299
     85    Width = 36
    8786    Caption = 'DPI:'
    88     ParentColor = False
    8987    ParentFont = False
    9088    Visible = False
     
    9290  object CheckBoxReopenLastFileOnStart: TCheckBox
    9391    Left = 24
    94     Height = 30
    95     Top = 160
    96     Width = 226
     92    Height = 31
     93    Top = 216
     94    Width = 239
    9795    Caption = 'Reopen last file on start'
    9896    ParentFont = False
     
    102100    Left = 12
    103101    Height = 2
    104     Top = 288
    105     Width = 534
     102    Top = 346
     103    Width = 517
    106104    Anchors = [akLeft, akRight, akBottom]
    107105  end
    108106  object Label2: TLabel
    109     Left = 24
    110     Height = 24
    111     Top = 72
    112     Width = 63
     107    Left = 25
     108    Height = 27
     109    Top = 75
     110    Width = 67
    113111    Caption = 'Theme:'
    114     ParentColor = False
    115112    ParentFont = False
    116113  end
    117114  object ComboBoxTheme: TComboBox
    118     Left = 240
    119     Height = 41
    120     Top = 64
    121     Width = 264
     115    Left = 250
     116    Height = 42
     117    Top = 67
     118    Width = 275
    122119    ItemHeight = 0
    123120    ParentFont = False
     
    126123  end
    127124  object Label3: TLabel
    128     Left = 24
    129     Height = 24
    130     Top = 120
    131     Width = 186
     125    Left = 25
     126    Height = 27
     127    Top = 125
     128    Width = 199
    132129    Caption = 'Default vCard version:'
    133     ParentColor = False
    134130  end
    135131  object EditDefaultVcardVersion: TEdit
    136     Left = 240
    137     Height = 42
    138     Top = 112
    139     Width = 144
     132    Left = 250
     133    Height = 43
     134    Top = 117
     135    Width = 150
    140136    TabOrder = 2
    141137  end
     138  object Label4: TLabel
     139    Left = 25
     140    Height = 27
     141    Top = 172
     142    Width = 144
     143    Caption = 'Map query URL:'
     144  end
     145  object EditMapUrl: TEdit
     146    Left = 250
     147    Height = 43
     148    Top = 168
     149    Width = 278
     150    Anchors = [akTop, akLeft, akRight]
     151    TabOrder = 8
     152  end
    142153end
  • trunk/Forms/UFormSettings.lrj

    r82 r101  
    88{"hash":55973348,"name":"tformsettings.checkboxreopenlastfileonstart.caption","sourcebytes":[82,101,111,112,101,110,32,108,97,115,116,32,102,105,108,101,32,111,110,32,115,116,97,114,116],"value":"Reopen last file on start"},
    99{"hash":95339402,"name":"tformsettings.label2.caption","sourcebytes":[84,104,101,109,101,58],"value":"Theme:"},
    10 {"hash":232157114,"name":"tformsettings.label3.caption","sourcebytes":[68,101,102,97,117,108,116,32,118,67,97,114,100,32,118,101,114,115,105,111,110,58],"value":"Default vCard version:"}
     10{"hash":232157114,"name":"tformsettings.label3.caption","sourcebytes":[68,101,102,97,117,108,116,32,118,67,97,114,100,32,118,101,114,115,105,111,110,58],"value":"Default vCard version:"},
     11{"hash":26355722,"name":"tformsettings.label4.caption","sourcebytes":[77,97,112,32,113,117,101,114,121,32,85,82,76,58],"value":"Map query URL:"}
    1112]}
  • trunk/Forms/UFormSettings.pas

    r82 r101  
    2222    ComboBoxTheme: TComboBox;
    2323    EditDefaultVcardVersion: TEdit;
     24    EditMapUrl: TEdit;
    2425    Label1: TLabel;
    2526    Label2: TLabel;
     
    103104  CheckBoxReopenLastFileOnStart.Checked := Core.ReopenLastFileOnStart;
    104105  EditDefaultVcardVersion.Text := Core.DefaultVcardVersion;
     106  EditMapUrl.Text := Core.MapUrl;
    105107  UpdateInterface;
    106108end;
     
    112114  Core.ReopenLastFileOnStart := CheckBoxReopenLastFileOnStart.Checked;
    113115  Core.DefaultVcardVersion := EditDefaultVcardVersion.Text;
     116  Core.MapUrl := EditMapUrl.Text;
    114117end;
    115118
  • trunk/Languages/vCardStudio.cs.po

    r100 r101  
    118118msgstr "Zrušit"
    119119
     120#: tformcontact.buttonhomeaddressshow.caption
     121msgctxt "tformcontact.buttonhomeaddressshow.caption"
     122msgid "Show on map"
     123msgstr "Ukázat na mapě"
     124
    120125#: tformcontact.buttonnext.caption
    121126msgid "Next"
     
    130135msgid "Previous"
    131136msgstr "Předchozí"
     137
     138#: tformcontact.buttonworkaddressshow.caption
     139msgctxt "tformcontact.buttonworkaddressshow.caption"
     140msgid "Show on map"
     141msgstr "Ukázat na mapět"
    132142
    133143#: tformcontact.calendardialog1.cancelcaption
     
    142152
    143153#: tformcontact.calendardialog1.title
    144 #, fuzzy
    145154msgctxt "tformcontact.calendardialog1.title"
    146155msgid "Select date"
     
    867876msgid "Default vCard version:"
    868877msgstr "Výchozí verze vCard:"
     878
     879#: tformsettings.label4.caption
     880msgid "Map query URL:"
     881msgstr "URL dotazu mapy:"
    869882
    870883#: tformsettings.labeldpi.caption
  • trunk/Languages/vCardStudio.pot

    r100 r101  
    106106msgstr ""
    107107
     108#: tformcontact.buttonhomeaddressshow.caption
     109msgctxt "tformcontact.buttonhomeaddressshow.caption"
     110msgid "Show on map"
     111msgstr ""
     112
    108113#: tformcontact.buttonnext.caption
    109114msgid "Next"
     
    119124msgstr ""
    120125
     126#: tformcontact.buttonworkaddressshow.caption
     127msgctxt "tformcontact.buttonworkaddressshow.caption"
     128msgid "Show on map"
     129msgstr ""
     130
    121131#: tformcontact.calendardialog1.cancelcaption
    122132msgctxt "tformcontact.calendardialog1.cancelcaption"
     
    838848msgstr ""
    839849
     850#: tformsettings.label4.caption
     851msgid "Map query URL:"
     852msgstr ""
     853
    840854#: tformsettings.labeldpi.caption
    841855msgid "DPI:"
  • trunk/UCore.pas

    r90 r101  
    8383    LastContactFileName: string;
    8484    LastPropertyValueFileName: string;
     85    MapUrl: string;
    8586    GenerateCount: Integer;
    8687    ToolbarVisible: Boolean;
     
    467468    GenerateCount := ReadIntegerWithDefault('GenerateCount', 1);
    468469    DefaultVcardVersion := ReadStringWithDefault('DefaultVcardVersion', '2.1');
     470    MapUrl := ReadStringWithDefault('MapUrl', 'https://www.openstreetmap.org/search?query=');
    469471  finally
    470472    Free;
     
    494496    WriteInteger('GenerateCount', GenerateCount);
    495497    WriteString('DefaultVcardVersion', DefaultVcardVersion);
     498    WriteString('MapUrl', MapUrl);
    496499  finally
    497500    Free;
Note: See TracChangeset for help on using the changeset viewer.