Renamed PeopleWindow/View to PersonWindow/View, since they only show one person at a time.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40462 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2011-02-12 17:40:58 +00:00
parent 8f5c65ecfa
commit 968ec77e1f
9 changed files with 61 additions and 75 deletions

View File

@ -5,8 +5,8 @@ UsePrivateHeaders shared ;
Application People : main.cpp
AttributeTextControl.cpp
PeopleApp.cpp
PeopleView.cpp
PeopleWindow.cpp
PersonView.cpp
PersonWindow.cpp
: libbe.so libtracker.so $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
: People.rdef
;
@ -15,6 +15,6 @@ DoCatalogs People :
x-vnd.Be-PEPL
:
PeopleApp.cpp
PeopleView.cpp
PeopleWindow.cpp
PersonView.cpp
PersonWindow.cpp
;

View File

@ -10,7 +10,7 @@ resource app_version {
internal = 0,
short_info = "People",
long_info = "People ©1999 Be, Inc. ©2005-2009 Haiku, Inc."
long_info = "People ©1999 Be, Inc. ©2005-2011 Haiku, Inc."
};
resource app_flags B_SINGLE_LAUNCH;

View File

@ -12,6 +12,8 @@
*/
#include "PeopleApp.h"
#include <Alert.h>
#include <AutoDeleter.h>
#include <Bitmap.h>
@ -25,8 +27,7 @@
#include <Volume.h>
#include <VolumeRoster.h>
#include "PeopleApp.h"
#include "PeopleWindow.h"
#include "PersonWindow.h"
#include "PersonIcons.h"
#include <string.h>
@ -250,7 +251,7 @@ TPeopleApp::RefsReceived(BMessage* message)
entry_ref ref;
message->FindRef("refs", index++, &ref);
TPeopleWindow* window = _FindWindow(ref);
PersonWindow* window = _FindWindow(ref);
if (window != NULL)
window->Activate(true);
else {
@ -273,10 +274,10 @@ TPeopleApp::ReadyToRun()
// #pragma mark -
TPeopleWindow*
PersonWindow*
TPeopleApp::_NewWindow(entry_ref* ref)
{
TPeopleWindow* window = new TPeopleWindow(fPosition,
PersonWindow* window = new PersonWindow(fPosition,
B_TRANSLATE("New person"), kNameAttribute,
kCategoryAttribute, ref);
@ -300,7 +301,7 @@ TPeopleApp::_NewWindow(entry_ref* ref)
void
TPeopleApp::_AddAttributes(TPeopleWindow* window) const
TPeopleApp::_AddAttributes(PersonWindow* window) const
{
int32 count = fAttributes.CountItems();
for (int32 i = 0; i < count; i++) {
@ -314,11 +315,11 @@ TPeopleApp::_AddAttributes(TPeopleWindow* window) const
}
TPeopleWindow*
PersonWindow*
TPeopleApp::_FindWindow(const entry_ref& ref) const
{
for (int32 i = 0; BWindow* window = WindowAt(i); i++) {
TPeopleWindow* personWindow = dynamic_cast<TPeopleWindow*>(window);
PersonWindow* personWindow = dynamic_cast<PersonWindow*>(window);
if (personWindow == NULL)
continue;
if (personWindow->RefersPersonFile(ref))

View File

@ -30,7 +30,7 @@ enum {
M_WINDOW_QUITS = 'wndq'
};
class TPeopleWindow;
class PersonWindow;
class TPeopleApp : public BApplication {
public:
@ -44,9 +44,9 @@ public:
virtual void ReadyToRun();
private:
TPeopleWindow* _FindWindow(const entry_ref&) const;
TPeopleWindow* _NewWindow(entry_ref* = NULL);
void _AddAttributes(TPeopleWindow* window) const;
PersonWindow* _FindWindow(const entry_ref&) const;
PersonWindow* _NewWindow(entry_ref* = NULL);
void _AddAttributes(PersonWindow* window) const;
void _SavePreferences(BMessage* message) const;
private:

View File

@ -11,7 +11,7 @@
*/
#include "PeopleView.h"
#include "PersonView.h"
#include <stdio.h>
#include <stdlib.h>
@ -37,7 +37,7 @@
#define B_TRANSLATE_CONTEXT "People"
TPeopleView::TPeopleView(const char* name, const char* categoryAttribute,
PersonView::PersonView(const char* name, const char* categoryAttribute,
const entry_ref *ref)
:
BGridView(),
@ -55,14 +55,14 @@ TPeopleView::TPeopleView(const char* name, const char* categoryAttribute,
}
TPeopleView::~TPeopleView()
PersonView::~PersonView()
{
delete fFile;
}
void
TPeopleView::AddAttribute(const char* label, const char* attribute)
PersonView::AddAttribute(const char* label, const char* attribute)
{
// TODO: We could check if this attribute has already been added.
@ -95,7 +95,7 @@ TPeopleView::AddAttribute(const char* label, const char* attribute)
void
TPeopleView::MakeFocus(bool focus)
PersonView::MakeFocus(bool focus)
{
if (focus && fControls.CountItems() > 0)
fControls.ItemAt(0)->MakeFocus();
@ -105,7 +105,7 @@ TPeopleView::MakeFocus(bool focus)
void
TPeopleView::MessageReceived(BMessage* msg)
PersonView::MessageReceived(BMessage* msg)
{
switch (msg->what) {
case M_SAVE:
@ -140,7 +140,7 @@ TPeopleView::MessageReceived(BMessage* msg)
void
TPeopleView::BuildGroupMenu()
PersonView::BuildGroupMenu()
{
BMenuItem* item;
while ((item = fGroups->ItemAt(0)) != NULL) {
@ -219,7 +219,7 @@ TPeopleView::BuildGroupMenu()
void
TPeopleView::CreateFile(const entry_ref* ref)
PersonView::CreateFile(const entry_ref* ref)
{
delete fFile;
fFile = new BFile(ref, B_READ_WRITE);
@ -228,7 +228,7 @@ TPeopleView::CreateFile(const entry_ref* ref)
bool
TPeopleView::IsSaved() const
PersonView::IsSaved() const
{
for (int32 i = fControls.CountItems() - 1; i >= 0; i--) {
if (fControls.ItemAt(i)->HasChanged())
@ -240,7 +240,7 @@ TPeopleView::IsSaved() const
void
TPeopleView::Save()
PersonView::Save()
{
int32 count = fControls.CountItems();
for (int32 i = 0; i < count; i++) {
@ -254,7 +254,7 @@ TPeopleView::Save()
const char*
TPeopleView::AttributeValue(const char* attribute) const
PersonView::AttributeValue(const char* attribute) const
{
for (int32 i = fControls.CountItems() - 1; i >= 0; i--) {
if (fControls.ItemAt(i)->Attribute() == attribute)
@ -266,7 +266,7 @@ TPeopleView::AttributeValue(const char* attribute) const
void
TPeopleView::SetAttribute(const char* attribute, bool update)
PersonView::SetAttribute(const char* attribute, bool update)
{
char* value = NULL;
attr_info info;
@ -282,7 +282,7 @@ TPeopleView::SetAttribute(const char* attribute, bool update)
void
TPeopleView::SetAttribute(const char* attribute, const char* value,
PersonView::SetAttribute(const char* attribute, const char* value,
bool update)
{
if (!LockLooper())
@ -324,7 +324,7 @@ TPeopleView::SetAttribute(const char* attribute, const char* value,
bool
TPeopleView::IsTextSelected() const
PersonView::IsTextSelected() const
{
for (int32 i = fControls.CountItems() - 1; i >= 0; i--) {
BTextView* text = fControls.ItemAt(i)->TextView();

View File

@ -9,8 +9,8 @@
* Copyright 1999, Be Incorporated. All Rights Reserved.
* This file may be used under the terms of the Be Sample Code License.
*/
#ifndef PEOPLE_VIEW_H
#define PEOPLE_VIEW_H
#ifndef PERSON_VIEW_H
#define PERSON_VIEW_H
#include <GridView.h>
@ -30,12 +30,12 @@ enum {
};
class TPeopleView : public BGridView {
class PersonView : public BGridView {
public:
TPeopleView(const char* name,
PersonView(const char* name,
const char* categoryAttribute,
const entry_ref* ref);
virtual ~TPeopleView();
virtual ~PersonView();
virtual void MakeFocus(bool focus = true);
virtual void MessageReceived(BMessage* message);
@ -66,4 +66,4 @@ private:
BString fCategoryAttribute;
};
#endif // PEOPLE_VIEW_H
#endif // PERSON_VIEW_H

View File

@ -10,7 +10,7 @@
* This file may be used under the terms of the Be Sample Code License.
*/
#include "PeopleWindow.h"
#include "PersonWindow.h"
#include <stdio.h>
#include <string.h>
@ -34,14 +34,14 @@
#include <Volume.h>
#include "PeopleApp.h"
#include "PeopleView.h"
#include "PersonView.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "People"
TPeopleWindow::TPeopleWindow(BRect frame, const char* title,
PersonWindow::PersonWindow(BRect frame, const char* title,
const char* nameAttribute, const char* categoryAttribute,
const entry_ref* ref)
:
@ -100,7 +100,7 @@ TPeopleWindow::TPeopleWindow(BRect frame, const char* title,
} else
_SetToRef(NULL);
fView = new TPeopleView("PeopleView", categoryAttribute, fRef);
fView = new PersonView("PeopleView", categoryAttribute, fRef);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(0, 0, 0, 0)
@ -112,14 +112,14 @@ TPeopleWindow::TPeopleWindow(BRect frame, const char* title,
}
TPeopleWindow::~TPeopleWindow()
PersonWindow::~PersonWindow()
{
_SetToRef(NULL);
}
void
TPeopleWindow::MenusBeginning()
PersonWindow::MenusBeginning()
{
bool enabled = !fView->IsSaved();
fSave->SetEnabled(enabled);
@ -147,7 +147,7 @@ TPeopleWindow::MenusBeginning()
void
TPeopleWindow::MessageReceived(BMessage* msg)
PersonWindow::MessageReceived(BMessage* msg)
{
char str[256];
BDirectory directory;
@ -263,7 +263,7 @@ TPeopleWindow::MessageReceived(BMessage* msg)
bool
TPeopleWindow::QuitRequested()
PersonWindow::QuitRequested()
{
status_t result;
@ -296,7 +296,7 @@ TPeopleWindow::QuitRequested()
void
TPeopleWindow::Show()
PersonWindow::Show()
{
fView->MakeFocus();
BWindow::Show();
@ -304,14 +304,14 @@ TPeopleWindow::Show()
void
TPeopleWindow::AddAttribute(const char* label, const char* attribute)
PersonWindow::AddAttribute(const char* label, const char* attribute)
{
fView->AddAttribute(label, attribute);
}
void
TPeopleWindow::SaveAs()
PersonWindow::SaveAs()
{
char name[B_FILE_NAME_LENGTH];
_GetDefaultFileName(name);
@ -346,7 +346,7 @@ TPeopleWindow::SaveAs()
bool
TPeopleWindow::RefersPersonFile(const entry_ref& ref) const
PersonWindow::RefersPersonFile(const entry_ref& ref) const
{
if (fRef == NULL)
return false;
@ -355,7 +355,7 @@ TPeopleWindow::RefersPersonFile(const entry_ref& ref) const
void
TPeopleWindow::_GetDefaultFileName(char* name)
PersonWindow::_GetDefaultFileName(char* name)
{
strncpy(name, fView->AttributeValue(fNameAttribute), B_FILE_NAME_LENGTH);
while (*name) {
@ -367,7 +367,7 @@ TPeopleWindow::_GetDefaultFileName(char* name)
void
TPeopleWindow::_SetToRef(entry_ref* ref)
PersonWindow::_SetToRef(entry_ref* ref)
{
if (fRef != NULL) {
_WatchChanges(false);
@ -381,7 +381,7 @@ TPeopleWindow::_SetToRef(entry_ref* ref)
void
TPeopleWindow::_WatchChanges(bool enable)
PersonWindow::_WatchChanges(bool enable)
{
if (fRef == NULL)
return;

View File

@ -8,8 +8,8 @@
* Copyright 1999, Be Incorporated. All Rights Reserved.
* This file may be used under the terms of the Be Sample Code License.
*/
#ifndef PEOPLE_WINDOW_H
#define PEOPLE_WINDOW_H
#ifndef PERSON_WINDOW_H
#define PERSON_WINDOW_H
#include <String.h>
@ -21,19 +21,19 @@
#define WIND_HEIGHT 340
class TPeopleView;
class PersonView;
class BFilePanel;
class BMenuItem;
class TPeopleWindow : public BWindow {
class PersonWindow : public BWindow {
public:
TPeopleWindow(BRect frame, const char* title,
PersonWindow(BRect frame, const char* title,
const char* nameAttribute,
const char* categoryAttribute,
const entry_ref* ref);
virtual ~TPeopleWindow();
virtual ~PersonWindow();
virtual void MenusBeginning();
virtual void MessageReceived(BMessage* message);
@ -62,10 +62,10 @@ private:
BMenuItem* fRevert;
BMenuItem* fSave;
BMenuItem* fUndo;
TPeopleView* fView;
PersonView* fView;
BString fNameAttribute;
};
#endif // PEOPLE_WINDOW_H
#endif // PERSON_WINDOW_H

View File

@ -1,15 +0,0 @@
People -- README
This directory contains the source code for building
the standard People application that ships with BeOS.
You can use this application to create Person records,
which can be dropped into BeMail headers (see the
BeOS User's Guide Chap. 4: Sending Mail) and other
applications.
Ostensibly, this application reveals how the Person
record is stored, but it also demonstrates how to
use the BeOS file type database in an application.
Owen Smith <orpheus@be.com>
July 1998