diff --git a/src/apps/people/PeopleApp.cpp b/src/apps/people/PeopleApp.cpp index f7869a38ca..39ef3354ed 100644 --- a/src/apps/people/PeopleApp.cpp +++ b/src/apps/people/PeopleApp.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2010, Haiku, Inc. All rights reserved. + * Copyright 2005-2023, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: @@ -223,7 +223,7 @@ TPeopleApp::MessageReceived(BMessage* message) switch (message->what) { case M_NEW: case B_SILENT_RELAUNCH: - _NewWindow(); + _NewWindow(NULL, message); break; case M_WINDOW_QUITS: @@ -274,7 +274,7 @@ TPeopleApp::RefsReceived(BMessage* message) else { BFile file(&ref, B_READ_ONLY); if (file.InitCheck() == B_OK) - _NewWindow(&ref); + _NewWindow(&ref, NULL); } } } @@ -292,13 +292,15 @@ TPeopleApp::ReadyToRun() PersonWindow* -TPeopleApp::_NewWindow(entry_ref* ref) +TPeopleApp::_NewWindow(entry_ref* ref, BMessage* message) { PersonWindow* window = new PersonWindow(fPosition, B_TRANSLATE("New person"), kNameAttribute, kCategoryAttribute, ref); _AddAttributes(window); + if (message != NULL) + window->SetInitialValues(message); window->Show(); diff --git a/src/apps/people/PeopleApp.h b/src/apps/people/PeopleApp.h index 4adb7377d3..c47880b509 100644 --- a/src/apps/people/PeopleApp.h +++ b/src/apps/people/PeopleApp.h @@ -28,7 +28,7 @@ enum { M_NEW = 'newp', M_SAVE_AS = 'svas', M_WINDOW_QUITS = 'wndq', - M_CONFIGURE_ATTRIBUTES = 'catr' + M_CONFIGURE_ATTRIBUTES = 'catr', }; class PersonWindow; @@ -45,7 +45,7 @@ public: private: PersonWindow* _FindWindow(const entry_ref&) const; - PersonWindow* _NewWindow(entry_ref* = NULL); + PersonWindow* _NewWindow(entry_ref* = NULL, BMessage* = NULL); void _AddAttributes(PersonWindow* window) const; void _SavePreferences(BMessage* message) const; diff --git a/src/apps/people/PersonView.cpp b/src/apps/people/PersonView.cpp index 6788dab984..37ef4079c3 100644 --- a/src/apps/people/PersonView.cpp +++ b/src/apps/people/PersonView.cpp @@ -386,8 +386,10 @@ PersonView::SetAttribute(const char* attribute, const char* value, } } - if (control == NULL) + if (control == NULL) { + UnlockLooper(); return; + } if (update) { control->SetText(value); diff --git a/src/apps/people/PersonView.h b/src/apps/people/PersonView.h index f6ecc27941..9f458df76e 100644 --- a/src/apps/people/PersonView.h +++ b/src/apps/people/PersonView.h @@ -62,7 +62,7 @@ public: bool IsTextSelected() const; private: - const entry_ref* fRef; + const entry_ref* fRef; time_t fLastModificationTime; BPopUpMenu* fGroups; typedef BObjectList AttributeList; diff --git a/src/apps/people/PersonWindow.cpp b/src/apps/people/PersonWindow.cpp index fedfebe01a..d4f74ea379 100644 --- a/src/apps/people/PersonWindow.cpp +++ b/src/apps/people/PersonWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2010, Haiku, Inc. All rights reserved. + * Copyright 2005-2023, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: @@ -351,6 +351,21 @@ PersonWindow::AddAttribute(const char* label, const char* attribute) } +void +PersonWindow::SetInitialValues(BMessage* message) +{ + char* attribute; + uint32 type; + int32 count; + + for (int32 i = 0; message->GetInfo(B_STRING_TYPE, i, &attribute, &type, &count) == B_OK; i++) { + BString text = ""; + if (message->FindString(attribute, &text) == B_OK) + fView->SetAttribute(attribute, text.String(), true); + } +} + + void PersonWindow::SaveAs() { diff --git a/src/apps/people/PersonWindow.h b/src/apps/people/PersonWindow.h index 1f7ef6bb8a..854132341e 100644 --- a/src/apps/people/PersonWindow.h +++ b/src/apps/people/PersonWindow.h @@ -1,5 +1,5 @@ /* - * Copyright 2010, Haiku, Inc. All rights reserved. + * Copyright 2010-2023, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: @@ -42,6 +42,7 @@ public: void AddAttribute(const char* label, const char* attribute); + void SetInitialValues(BMessage* message); void SaveAs();