Changeset 49


Ignore:
Timestamp:
Dec 3, 2021, 6:52:12 PM (2 years ago)
Author:
chronos
Message:
  • Added: Context menu action to clear profile image.
  • Fixed: Correctly show contact profile image.
  • Added: Remember last selected tab index in contact form.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.lfm

    r48 r49  
    1818    Top = 8
    1919    Width = 939
    20     ActivePage = TabSheetGeneral
     20    ActivePage = TabSheetAll
    2121    Anchors = [akTop, akLeft, akRight, akBottom]
    2222    ParentFont = False
    23     TabIndex = 0
     23    TabIndex = 4
    2424    TabOrder = 0
    2525    object TabSheetGeneral: TTabSheet
    2626      Caption = 'General'
    27       ClientHeight = 742
    28       ClientWidth = 929
     27      ClientHeight = 744
     28      ClientWidth = 931
    2929      OnHide = TabSheetGeneralHide
    3030      OnShow = TabSheetGeneralShow
     
    3232      object Label1: TLabel
    3333        Left = 240
    34         Height = 24
     34        Height = 25
    3535        Top = 80
    36         Width = 94
     36        Width = 86
    3737        Caption = 'First name:'
    3838        ParentColor = False
     
    4141      object EditFirstName: TEdit
    4242        Left = 360
    43         Height = 42
     43        Height = 33
    4444        Top = 72
    4545        Width = 155
     
    4949      object Label2: TLabel
    5050        Left = 16
    51         Height = 24
     51        Height = 25
    5252        Top = 250
    53         Width = 63
     53        Width = 59
    5454        Caption = 'Mobile:'
    5555        ParentColor = False
     
    5858      object EditMobile: TEdit
    5959        Left = 144
    60         Height = 42
     60        Height = 33
    6161        Top = 240
    6262        Width = 254
     
    6666      object EditPhone: TEdit
    6767        Left = 144
    68         Height = 42
     68        Height = 33
    6969        Top = 286
    7070        Width = 254
     
    7474      object Label3: TLabel
    7575        Left = 16
    76         Height = 24
     76        Height = 25
    7777        Top = 290
    78         Width = 59
     78        Width = 54
    7979        Caption = 'Phone:'
    8080        ParentColor = False
     
    8383      object EditEmail: TEdit
    8484        Left = 144
    85         Height = 42
     85        Height = 33
    8686        Top = 328
    8787        Width = 254
     
    9191      object Label4: TLabel
    9292        Left = 16
    93         Height = 24
     93        Height = 25
    9494        Top = 336
    95         Width = 58
     95        Width = 53
    9696        Caption = 'E-mail:'
    9797        ParentColor = False
     
    100100      object EditLastName: TEdit
    101101        Left = 671
    102         Height = 42
     102        Height = 33
    103103        Top = 72
    104104        Width = 155
     
    108108      object Label5: TLabel
    109109        Left = 536
    110         Height = 24
     110        Height = 25
    111111        Top = 80
    112         Width = 87
     112        Width = 80
    113113        Caption = 'Last name'
    114114        ParentColor = False
     
    117117      object EditBirthday: TEdit
    118118        Left = 144
    119         Height = 42
     119        Height = 33
    120120        Top = 424
    121121        Width = 254
     
    125125      object Label22: TLabel
    126126        Left = 16
    127         Height = 24
     127        Height = 25
    128128        Top = 432
    129         Width = 76
     129        Width = 69
    130130        Caption = 'Birthday:'
    131131        ParentColor = False
     
    144144      object Label24: TLabel
    145145        Left = 240
    146         Height = 24
     146        Height = 25
    147147        Top = 32
    148         Width = 88
     148        Width = 80
    149149        Caption = 'Full name:'
    150150        ParentColor = False
     
    153153      object EditFullName: TEdit
    154154        Left = 360
    155         Height = 42
     155        Height = 33
    156156        Top = 24
    157157        Width = 467
     
    161161      object Label25: TLabel
    162162        Left = 536
    163         Height = 24
     163        Height = 25
    164164        Top = 128
    165         Width = 116
     165        Width = 108
    166166        Caption = 'Middle name:'
    167167        ParentColor = False
     
    170170      object EditMiddleName: TEdit
    171171        Left = 671
    172         Height = 42
     172        Height = 33
    173173        Top = 120
    174174        Width = 155
     
    178178      object Label26: TLabel
    179179        Left = 240
    180         Height = 24
     180        Height = 25
    181181        Top = 176
    182         Width = 101
     182        Width = 93
    183183        Caption = 'Title before:'
    184184        ParentColor = False
     
    187187      object EditTitleBefore: TEdit
    188188        Left = 360
    189         Height = 42
     189        Height = 33
    190190        Top = 168
    191191        Width = 155
     
    195195      object Label27: TLabel
    196196        Left = 536
    197         Height = 24
     197        Height = 25
    198198        Top = 176
    199         Width = 85
     199        Width = 77
    200200        Caption = 'Title after:'
    201201        ParentColor = False
     
    204204      object EditTitleAfter: TEdit
    205205        Left = 671
    206         Height = 42
     206        Height = 33
    207207        Top = 168
    208208        Width = 155
     
    212212      object Label44: TLabel
    213213        Left = 240
    214         Height = 24
     214        Height = 25
    215215        Top = 128
    216         Width = 91
     216        Width = 82
    217217        Caption = 'Nickname:'
    218218        ParentColor = False
     
    221221      object EditNickName: TEdit
    222222        Left = 360
    223         Height = 42
     223        Height = 33
    224224        Top = 120
    225225        Width = 155
     
    229229      object Label45: TLabel
    230230        Left = 432
    231         Height = 24
     231        Height = 25
    232232        Top = 432
    233         Width = 105
     233        Width = 96
    234234        Caption = 'Anniversary:'
    235235        ParentColor = False
     
    238238      object EditAniversary: TEdit
    239239        Left = 575
    240         Height = 42
     240        Height = 33
    241241        Top = 424
    242242        Width = 254
     
    246246      object Label9: TLabel
    247247        Left = 432
    248         Height = 24
     248        Height = 25
    249249        Top = 248
    250         Width = 34
     250        Width = 29
    251251        Caption = 'Fax:'
    252252        ParentColor = False
     
    255255      object EditFax: TEdit
    256256        Left = 575
    257         Height = 42
     257        Height = 33
    258258        Top = 240
    259259        Width = 254
     
    263263      object EditPager: TEdit
    264264        Left = 575
    265         Height = 42
     265        Height = 33
    266266        Top = 286
    267267        Width = 254
     
    271271      object Label10: TLabel
    272272        Left = 432
    273         Height = 24
     273        Height = 25
    274274        Top = 290
    275         Width = 54
     275        Width = 48
    276276        Caption = 'Pager:'
    277277        ParentColor = False
     
    280280      object Label46: TLabel
    281281        Left = 16
    282         Height = 24
     282        Height = 25
    283283        Top = 384
    284         Width = 114
     284        Width = 107
    285285        Caption = 'Web address:'
    286286        ParentColor = False
     
    289289      object EditWeb: TEdit
    290290        Left = 144
    291         Height = 42
     291        Height = 33
    292292        Top = 376
    293293        Width = 683
     
    298298    object TabSheetHome: TTabSheet
    299299      Caption = 'Home'
    300       ClientHeight = 742
    301       ClientWidth = 929
     300      ClientHeight = 744
     301      ClientWidth = 931
    302302      OnHide = TabSheetHomeHide
    303303      OnShow = TabSheetHomeShow
     
    305305      object Label7: TLabel
    306306        Left = 16
    307         Height = 24
     307        Height = 25
    308308        Top = 114
    309         Width = 58
     309        Width = 53
    310310        Caption = 'E-mail:'
    311311        ParentColor = False
     
    314314      object EditHomeEmail: TEdit
    315315        Left = 173
    316         Height = 42
     316        Height = 33
    317317        Top = 112
    318318        Width = 254
     
    322322      object Label11: TLabel
    323323        Left = 448
    324         Height = 24
     324        Height = 25
    325325        Top = 18
    326         Width = 34
     326        Width = 29
    327327        Caption = 'Fax:'
    328328        ParentColor = False
     
    331331      object EditHomeFax: TEdit
    332332        Left = 605
    333         Height = 42
     333        Height = 33
    334334        Top = 16
    335335        Width = 254
     
    339339      object EditHomeMobile: TEdit
    340340        Left = 173
    341         Height = 42
     341        Height = 33
    342342        Top = 60
    343343        Width = 254
     
    347347      object EditHomePhone: TEdit
    348348        Left = 173
    349         Height = 42
     349        Height = 33
    350350        Top = 16
    351351        Width = 254
     
    355355      object Label14: TLabel
    356356        Left = 448
    357         Height = 24
     357        Height = 25
    358358        Top = 68
    359         Width = 54
     359        Width = 48
    360360        Caption = 'Pager:'
    361361        ParentColor = False
     
    364364      object EditHomePager: TEdit
    365365        Left = 605
    366         Height = 42
     366        Height = 33
    367367        Top = 60
    368368        Width = 254
     
    372372      object Label40: TLabel
    373373        Left = 16
    374         Height = 24
     374        Height = 25
    375375        Top = 168
    376         Width = 114
     376        Width = 107
    377377        Caption = 'Web address:'
    378378        ParentColor = False
     
    381381      object EditHomeWeb: TEdit
    382382        Left = 173
    383         Height = 42
     383        Height = 33
    384384        Top = 160
    385385        Width = 683
     
    391391        Height = 242
    392392        Top = 216
    393         Width = 890
     393        Width = 892
    394394        Anchors = [akTop, akLeft, akRight]
    395395        Caption = 'Address'
    396         ClientHeight = 215
     396        ClientHeight = 212
    397397        ClientWidth = 888
    398398        TabOrder = 6
    399399        object Label36: TLabel
    400400          Left = 8
    401           Height = 24
     401          Height = 25
    402402          Top = 18
    403           Width = 54
     403          Width = 49
    404404          Caption = 'Street:'
    405405          ParentColor = False
     
    408408        object Label37: TLabel
    409409          Left = 10
    410           Height = 24
     410          Height = 25
    411411          Top = 66
    412           Width = 137
     412          Width = 126
    413413          Caption = 'Extended street:'
    414414          ParentColor = False
     
    417417        object EditHomeAddressStreetExtended: TEdit
    418418          Left = 173
    419           Height = 42
     419          Height = 33
    420420          Top = 56
    421421          Width = 254
     
    425425        object EditHomeAddressStreet: TEdit
    426426          Left = 173
    427           Height = 42
     427          Height = 33
    428428          Top = 8
    429429          Width = 254
     
    433433        object Label38: TLabel
    434434          Left = 10
    435           Height = 24
     435          Height = 25
    436436          Top = 112
    437           Width = 64
     437          Width = 59
    438438          Caption = 'Region:'
    439439          ParentColor = False
     
    442442        object EditHomeAddressRegion: TEdit
    443443          Left = 173
    444           Height = 42
     444          Height = 33
    445445          Top = 104
    446446          Width = 254
     
    450450        object EditHomeAddressCountry: TEdit
    451451          Left = 173
    452           Height = 42
     452          Height = 33
    453453          Top = 152
    454454          Width = 254
     
    458458        object Label39: TLabel
    459459          Left = 10
    460           Height = 24
     460          Height = 25
    461461          Top = 160
    462           Width = 71
     462          Width = 67
    463463          Caption = 'Country:'
    464464          ParentColor = False
     
    467467        object Label41: TLabel
    468468          Left = 451
    469           Height = 24
     469          Height = 25
    470470          Top = 150
    471           Width = 103
     471          Width = 95
    472472          Caption = 'Postal code:'
    473473          ParentColor = False
     
    476476        object EditHomeAddressPostalCode: TEdit
    477477          Left = 588
    478           Height = 42
     478          Height = 33
    479479          Top = 142
    480480          Width = 254
     
    484484        object EditHomeAddressCity: TEdit
    485485          Left = 588
    486           Height = 42
     486          Height = 33
    487487          Top = 56
    488488          Width = 254
     
    492492        object Label42: TLabel
    493493          Left = 451
    494           Height = 24
     494          Height = 25
    495495          Top = 64
    496           Width = 36
     496          Width = 34
    497497          Caption = 'City:'
    498498          ParentColor = False
     
    501501        object Label43: TLabel
    502502          Left = 451
    503           Height = 24
     503          Height = 25
    504504          Top = 16
    505           Width = 131
     505          Width = 122
    506506          Caption = 'Post office box:'
    507507          ParentColor = False
     
    510510        object EditHomeAddressPostOfficeBox: TEdit
    511511          Left = 588
    512           Height = 42
     512          Height = 33
    513513          Top = 8
    514514          Width = 254
     
    519519      object Label12: TLabel
    520520        Left = 16
    521         Height = 24
     521        Height = 25
    522522        Top = 64
    523         Width = 63
     523        Width = 59
    524524        Caption = 'Mobile:'
    525525        ParentColor = False
     
    528528      object Label13: TLabel
    529529        Left = 16
    530         Height = 24
     530        Height = 25
    531531        Top = 20
    532         Width = 59
     532        Width = 54
    533533        Caption = 'Phone:'
    534534        ParentColor = False
     
    538538    object TabSheetWork: TTabSheet
    539539      Caption = 'Work'
    540       ClientHeight = 742
    541       ClientWidth = 929
     540      ClientHeight = 744
     541      ClientWidth = 931
    542542      OnHide = TabSheetWorkHide
    543543      OnShow = TabSheetWorkShow
    544544      object EditOrganization: TEdit
    545545        Left = 173
    546         Height = 42
     546        Height = 33
    547547        Top = 64
    548548        Width = 254
     
    552552      object LabelOrganization: TLabel
    553553        Left = 10
    554         Height = 24
     554        Height = 25
    555555        Top = 70
    556         Width = 114
     556        Width = 106
    557557        Caption = 'Organization:'
    558558        ParentColor = False
     
    561561      object LabelOrganization1: TLabel
    562562        Left = 451
    563         Height = 24
     563        Height = 25
    564564        Top = 32
    565         Width = 106
     565        Width = 99
    566566        Caption = 'Department:'
    567567        ParentColor = False
     
    570570      object EditDepartment: TEdit
    571571        Left = 608
    572         Height = 42
     572        Height = 33
    573573        Top = 20
    574574        Width = 254
     
    578578      object Label18: TLabel
    579579        Left = 10
    580         Height = 24
     580        Height = 25
    581581        Top = 20
    582         Width = 41
     582        Width = 36
    583583        Caption = 'Title:'
    584584        ParentColor = False
     
    587587      object EditTitle: TEdit
    588588        Left = 173
    589         Height = 42
     589        Height = 33
    590590        Top = 16
    591591        Width = 254
     
    595595      object EditWorkWeb: TEdit
    596596        Left = 173
    597         Height = 42
     597        Height = 33
    598598        Top = 256
    599599        Width = 683
     
    603603      object Label32: TLabel
    604604        Left = 10
    605         Height = 24
     605        Height = 25
    606606        Top = 264
    607         Width = 114
     607        Width = 107
    608608        Caption = 'Web address:'
    609609        ParentColor = False
     
    616616        Width = 911
    617617        Caption = 'Address'
    618         ClientHeight = 220
    619         ClientWidth = 909
     618        ClientHeight = 217
     619        ClientWidth = 907
    620620        TabOrder = 4
    621621        object Label31: TLabel
    622622          Left = 10
    623           Height = 24
     623          Height = 25
    624624          Top = 160
    625           Width = 71
     625          Width = 67
    626626          Caption = 'Country:'
    627627          ParentColor = False
     
    630630        object EditAddressWorkCountry: TEdit
    631631          Left = 173
    632           Height = 42
     632          Height = 33
    633633          Top = 160
    634634          Width = 254
     
    638638        object EditAddressWorkRegion: TEdit
    639639          Left = 173
    640           Height = 42
     640          Height = 33
    641641          Top = 112
    642642          Width = 254
     
    646646        object Label30: TLabel
    647647          Left = 10
    648           Height = 24
     648          Height = 25
    649649          Top = 112
    650           Width = 64
     650          Width = 59
    651651          Caption = 'Region:'
    652652          ParentColor = False
     
    655655        object Label35: TLabel
    656656          Left = 10
    657           Height = 24
     657          Height = 25
    658658          Top = 66
    659           Width = 137
     659          Width = 126
    660660          Caption = 'Extended street:'
    661661          ParentColor = False
     
    664664        object EditAddressWorkStreetExtended: TEdit
    665665          Left = 173
    666           Height = 42
     666          Height = 33
    667667          Top = 64
    668668          Width = 254
     
    672672        object Label28: TLabel
    673673          Left = 10
    674           Height = 24
     674          Height = 25
    675675          Top = 18
    676           Width = 54
     676          Width = 49
    677677          Caption = 'Street:'
    678678          ParentColor = False
     
    681681        object EditAddressWorkStreet: TEdit
    682682          Left = 173
    683           Height = 42
     683          Height = 33
    684684          Top = 8
    685685          Width = 254
     
    689689        object Label34: TLabel
    690690          Left = 451
    691           Height = 24
     691          Height = 25
    692692          Top = 18
    693           Width = 131
     693          Width = 122
    694694          Caption = 'Post office box:'
    695695          ParentColor = False
     
    698698        object EditAddressWorkPostOfficeBox: TEdit
    699699          Left = 608
    700           Height = 42
     700          Height = 33
    701701          Top = 8
    702702          Width = 254
     
    706706        object EditAddressWorkCity: TEdit
    707707          Left = 608
    708           Height = 42
     708          Height = 33
    709709          Top = 56
    710710          Width = 254
     
    714714        object Label29: TLabel
    715715          Left = 451
    716           Height = 24
     716          Height = 25
    717717          Top = 64
    718           Width = 36
     718          Width = 34
    719719          Caption = 'City:'
    720720          ParentColor = False
     
    723723        object EditAddressWorkPostalCode: TEdit
    724724          Left = 608
    725           Height = 42
     725          Height = 33
    726726          Top = 142
    727727          Width = 254
     
    731731        object Label33: TLabel
    732732          Left = 451
    733           Height = 24
     733          Height = 25
    734734          Top = 150
    735           Width = 103
     735          Width = 95
    736736          Caption = 'Postal code:'
    737737          ParentColor = False
     
    741741      object Label15: TLabel
    742742        Left = 10
    743         Height = 24
     743        Height = 25
    744744        Top = 116
    745         Width = 59
     745        Width = 54
    746746        Caption = 'Phone:'
    747747        ParentColor = False
     
    750750      object EditWorkPhone: TEdit
    751751        Left = 173
    752         Height = 42
     752        Height = 33
    753753        Top = 112
    754754        Width = 254
     
    758758      object Label16: TLabel
    759759        Left = 451
    760         Height = 24
     760        Height = 25
    761761        Top = 112
    762         Width = 34
     762        Width = 29
    763763        Caption = 'Fax:'
    764764        ParentColor = False
     
    767767      object EditWorkFax: TEdit
    768768        Left = 608
    769         Height = 42
     769        Height = 33
    770770        Top = 112
    771771        Width = 254
     
    775775      object EditWorkPager: TEdit
    776776        Left = 608
    777         Height = 42
     777        Height = 33
    778778        Top = 156
    779779        Width = 254
     
    783783      object Label17: TLabel
    784784        Left = 448
    785         Height = 24
     785        Height = 25
    786786        Top = 160
    787         Width = 54
     787        Width = 48
    788788        Caption = 'Pager:'
    789789        ParentColor = False
     
    792792      object EditWorkMobile: TEdit
    793793        Left = 173
    794         Height = 42
     794        Height = 33
    795795        Top = 160
    796796        Width = 254
     
    800800      object Label19: TLabel
    801801        Left = 10
    802         Height = 24
     802        Height = 25
    803803        Top = 160
    804         Width = 63
     804        Width = 59
    805805        Caption = 'Mobile:'
    806806        ParentColor = False
     
    809809      object Label8: TLabel
    810810        Left = 10
    811         Height = 24
     811        Height = 25
    812812        Top = 210
    813         Width = 58
     813        Width = 53
    814814        Caption = 'E-mail:'
    815815        ParentColor = False
     
    818818      object EditWorkEmail: TEdit
    819819        Left = 173
    820         Height = 42
     820        Height = 33
    821821        Top = 210
    822822        Width = 254
     
    827827    object TabSheetOthers: TTabSheet
    828828      Caption = 'Others'
    829       ClientHeight = 742
    830       ClientWidth = 929
     829      ClientHeight = 744
     830      ClientWidth = 931
    831831      OnHide = TabSheetOthersHide
    832832      OnShow = TabSheetOthersShow
    833833      object MemoNotes: TMemo
    834834        Left = 16
    835         Height = 392
     835        Height = 394
    836836        Top = 48
    837         Width = 893
     837        Width = 895
    838838        Anchors = [akTop, akLeft, akRight, akBottom]
    839839        ParentFont = False
     
    844844      object Label6: TLabel
    845845        Left = 16
    846         Height = 24
     846        Height = 25
    847847        Top = 16
    848         Width = 55
     848        Width = 51
    849849        Caption = 'Notes:'
    850850        ParentColor = False
     
    916916      OnExecute = APhotoSaveExecute
    917917    end
     918    object APhotoClear: TAction
     919      Caption = 'Clear'
     920      OnExecute = APhotoClearExecute
     921    end
    918922  end
    919923  object PopupMenuPhoto: TPopupMenu
     
    926930    object MenuItem2: TMenuItem
    927931      Action = APhotoSave
     932    end
     933    object MenuItem3: TMenuItem
     934      Action = APhotoClear
    928935    end
    929936  end
  • trunk/Forms/UFormContact.lrj

    r47 r49  
    5858{"hash":347380,"name":"tformcontact.buttonnext.caption","sourcebytes":[78,101,120,116],"value":"Next"},
    5959{"hash":8431845,"name":"tformcontact.aphotoload.caption","sourcebytes":[76,111,97,100,32,102,114,111,109,32,102,105,108,101],"value":"Load from file"},
    60 {"hash":9308581,"name":"tformcontact.aphotosave.caption","sourcebytes":[83,97,118,101,32,116,111,32,102,105,108,101],"value":"Save to file"}
     60{"hash":9308581,"name":"tformcontact.aphotosave.caption","sourcebytes":[83,97,118,101,32,116,111,32,102,105,108,101],"value":"Save to file"},
     61{"hash":4860802,"name":"tformcontact.aphotoclear.caption","sourcebytes":[67,108,101,97,114],"value":"Clear"}
    6162]}
  • trunk/Forms/UFormContact.pas

    r48 r49  
    1414
    1515  TFormContact = class(TForm)
     16    APhotoClear: TAction;
    1617    APhotoSave: TAction;
    1718    APhotoLoad: TAction;
     
    116117    MenuItem1: TMenuItem;
    117118    MenuItem2: TMenuItem;
     119    MenuItem3: TMenuItem;
    118120    OpenPictureDialog1: TOpenPictureDialog;
    119121    PageControlContact: TPageControl;
     
    125127    TabSheetGeneral: TTabSheet;
    126128    TabSheetAll: TTabSheet;
     129    procedure APhotoClearExecute(Sender: TObject);
    127130    procedure APhotoLoadExecute(Sender: TObject);
    128131    procedure APhotoSaveExecute(Sender: TObject);
     
    143146    procedure TabSheetWorkShow(Sender: TObject);
    144147  private
     148    FProfilePhotoActive: Boolean;
     149    procedure SetProfilePhotoActive(AValue: Boolean);
     150  private
    145151    FContact: TContact;
    146152    FOnNext: TNotifyEvent;
    147153    FOnPrevious: TNotifyEvent;
    148154    FormProperties: TFormProperties;
    149     ProfilePhotoActive: Boolean;
    150     procedure DefaultPhoto;
    151155    procedure SetContact(AValue: TContact);
    152156    procedure ReloadAllPropertiesTab;
     157    property ProfilePhotoActive: Boolean read FProfilePhotoActive
     158      write SetProfilePhotoActive;
    153159  public
    154160    procedure UpdateInterface;
     
    178184  FormProperties.Align := alClient;
    179185  FormProperties.Show;
     186
     187  // Force to load default profile image
     188  ProfilePhotoActive := True;
     189  ProfilePhotoActive := False;
     190
     191  PageControlContact.TabIndex := Core.LastContactTabIndex;
    180192  UpdateInterface;
    181193end;
     
    249261      Stream.Free;
    250262    end;
     263  end else begin
     264    PhotoProperty := Contact.GetProperty(cfPhoto);
     265    if Assigned(PhotoProperty) then
     266       Contact.Properties.Remove(PhotoProperty);
    251267  end;
    252268
     
    278294
    279295  // Photo
    280   ImagePhoto.Picture.Bitmap.Clear;
    281296  PhotoProperty := Contact.GetProperty(cfPhoto);
    282297  if Assigned(PhotoProperty) then begin
     
    292307            try
    293308              JpegImage.LoadFromStream(Stream);
     309              ImagePhoto.Picture.Bitmap.Clear;
    294310              ImagePhoto.Picture.Bitmap.SetSize(JpegImage.Width, JpegImage.Height);
    295311              ImagePhoto.Picture.Bitmap.Canvas.Draw(0, 0, JpegImage);
    296312              ProfilePhotoActive := True;
    297313            except
    298               DefaultPhoto;
     314              ProfilePhotoActive := False;
    299315            end;
    300316          finally
     
    306322            ProfilePhotoActive := True;
    307323          except
    308             DefaultPhoto;
     324            ProfilePhotoActive := False;
    309325          end;
    310326        end;
     
    312328        Stream.Free;
    313329      end;
    314     end else DefaultPhoto;
    315   end else DefaultPhoto;
     330    end else ProfilePhotoActive := False;
     331  end else ProfilePhotoActive := False;
    316332end;
    317333
     
    406422end;
    407423
    408 procedure TFormContact.DefaultPhoto;
    409 begin
    410   ProfilePhotoActive := False;
    411   ImagePhoto.Picture.Assign(Core.GetProfileImage.Picture);
     424procedure TFormContact.SetProfilePhotoActive(AValue: Boolean);
     425begin
     426  if FProfilePhotoActive = AValue then Exit;
     427  FProfilePhotoActive := AValue;
     428  if not FProfilePhotoActive then begin
     429    ImagePhoto.Picture.Assign(Core.GetProfileImage.Picture);
     430  end;
     431  UpdateInterface;
    412432end;
    413433
     
    428448  );
    429449begin
     450  // Hide PageControl to fire TabSheet OnHide event on form close
     451  PageControlContact.ActivePage.Hide;
     452
     453  Core.LastContactTabIndex := PageControlContact.TabIndex;
    430454  Core.PersistentForm1.Save(Self);
    431455end;
     
    440464  if OpenPictureDialog1.Execute then begin
    441465    ImagePhoto.Picture.LoadFromFile(OpenPictureDialog1.FileName);
     466    ProfilePhotoActive := True;
    442467  end;
     468end;
     469
     470procedure TFormContact.APhotoClearExecute(Sender: TObject);
     471begin
     472  ProfilePhotoActive := False;
    443473end;
    444474
     
    471501begin
    472502  APhotoSave.Enabled := ProfilePhotoActive;
     503  APhotoClear.Enabled := ProfilePhotoActive;
    473504end;
    474505
  • trunk/Languages/vCardStudio.cs.po

    r47 r49  
    7272msgstr "Nastavení"
    7373
     74msgid "Clear"
     75msgstr "Vyčistit"
     76
    7477#: tformcontact.aphotoload.caption
    7578msgid "Load from file"
     
    910913msgid "Invalid line length for encoded text"
    911914msgstr "Neplatná délka řádky kódovaného textu"
    912 
  • trunk/Languages/vCardStudio.po

    r47 r49  
    6262msgstr ""
    6363
     64#: tformcontact.aphotoclear.caption
     65msgid "Clear"
     66msgstr ""
     67
    6468#: tformcontact.aphotoload.caption
    6569msgid "Load from file"
  • trunk/UCore.pas

    r48 r49  
    8181    FileClosed: Boolean;
    8282    ReopenLastFileOnStart: Boolean;
     83    LastContactTabIndex: Integer;
    8384    ToolbarVisible: Boolean;
    8485    function GetProfileImage: TImage;
     
    278279
    279280procedure TCore.DataModuleCreate(Sender: TObject);
     281{$IFDEF Linux}
    280282const
    281283  LinuxLanguagesDir = '/usr/share/vCardStudio/Languages';
     284{$ENDIF}
    282285begin
    283286  {$IFDEF Linux}
     
    427430    FormMain.MenuItemToolbar.Checked := ReadBoolWithDefault('ToolBarVisible', True);
    428431    ReopenLastFileOnStart := ReadBoolWithDefault('ReopenLastFileOnStart', True);
     432    LastContactTabIndex := ReadIntegerWithDefault('LastContactTabIndex', 0);
    429433  finally
    430434    Free;
     
    448452    WriteBool('ToolBarVisible', FormMain.MenuItemToolbar.Checked);
    449453    WriteBool('ReopenLastFileOnStart', ReopenLastFileOnStart);
     454    WriteInteger('LastContactTabIndex', LastContactTabIndex);
    450455  finally
    451456    Free;
     
    464469  if not Assigned(ProfileImage) then begin
    465470    ProfileImage := TImage.Create(nil);
    466     ProfileImage.Picture.LoadFromFile(ProfilePhotoFileName);
    467471    if FileExists(ProfilePhotoFileName) then
    468472      ProfileImage.Picture.LoadFromFile(ProfilePhotoFileName);
Note: See TracChangeset for help on using the changeset viewer.