PersonView::PersonView(const char* name, BContact* contact, BFile* file) : BGridView(), // fGroups(NULL), fControls(20, false), fPictureView(NULL), fSaving(false), fSaved(true), fContact(contact), fPhotoField(NULL), fContactFile(file) { SetName(name); SetFlags(Flags() | B_WILL_DRAW); UpdatePicture(NULL); fAddressWindow = NULL; float spacing = be_control_look->DefaultItemSpacing(); GridLayout()->SetInsets(spacing, spacing, spacing, spacing); _LoadFieldsFromContact(); if (fContactFile) fContactFile->GetModificationTime(&fLastModificationTime); }
PersonView::PersonView(const char* name, BContact* contact, BFile* file) : BGridView(B_VERTICAL), // fGroups(NULL), fControls(20, false), fAddrView(NULL), fPictureView(NULL), fSaving(false), fContact(contact), fPhotoField(NULL), fFile(file) { SetName(name); SetFlags(Flags() | B_WILL_DRAW); UpdatePicture(NULL); fInfoView = new BGridView(B_VERTICAL); fFieldsBox = new BBox("Contact informations", B_WILL_DRAW, B_FANCY_BORDER, fInfoView); //float spacing = be_control_look->DefaultItemSpacing(); //fInfoView->GridLayout()->SetInsets(spacing); GridLayout()->AddView(fFieldsBox, 0, GridLayout()->CountRows()); if (fFile) fFile->GetModificationTime(&fLastModificationTime); _LoadFieldsFromContact(); }
void PersonView::Reload(const entry_ref* ref) { if (fReloading == true) return; else fReloading = true; BAlert* panel = new BAlert( "", "The file has been modified by another application\n" "Do you want to reload it?\n\n", "Reload", "No"); int32 index = panel->Go(); if (index == 1) { fSaved = false; fReloading = false; return; } if (ref != NULL) { delete fContactFile; fContactFile = new BFile(ref, B_READ_WRITE); fContact->Append(new BRawContact(B_CONTACT_ANY, fContactFile)); } fContact->Reload(); for (int i = 0; i < fControls.CountItems(); i++) { ContactFieldTextControl* control = fControls.ItemAt(i); fControls.RemoveItem(control); RemoveChild(control); delete control; } _LoadFieldsFromContact(); fSaved = true; fReloading = false; }