Example #1
0
BString
PlaylistItem::Title() const
{
    BString title;
    if (GetAttribute(ATTR_STRING_TITLE, title) != B_OK)
        title = B_TRANSLATE_WITH_CONTEXT("<untitled>", "PlaylistItem-title");
    return title;
}
Example #2
0
BString
PlaylistItem::Album() const
{
    BString album;
    if (GetAttribute(ATTR_STRING_ALBUM, album) != B_OK)
        album = B_TRANSLATE_WITH_CONTEXT("<unknown>", "PlaylistItem-album");
    return album;
}
Example #3
0
BString
PlaylistItem::Author() const
{
    BString author;
    if (GetAttribute(ATTR_STRING_AUTHOR, author) != B_OK)
        author = B_TRANSLATE_WITH_CONTEXT("<unknown>", "PlaylistItem-author");
    return author;
}
Example #4
0
BString
PlaylistItem::Name() const
{
    BString name;
    if (GetAttribute(ATTR_STRING_NAME, name) != B_OK)
        name = B_TRANSLATE_WITH_CONTEXT("<unnamed>", "PlaylistItem-name");
    return name;
}
// GetName
void
SetPropertiesCommand::GetName(BString& name)
{
	if (fOldProperties->CountProperties() > 1) {
		if (fObjectCount > 1)
			name << B_TRANSLATE("Multi Paste Properties");
		else
			name << B_TRANSLATE("Paste Properties");
	} else {
		BString property = name_for_id(
			fOldProperties->PropertyAt(0)->Identifier());
		if (fObjectCount > 1)
			name << B_TRANSLATE_WITH_CONTEXT("Multi Set ",
				"Multi Set (property name)") << property;
		else
			name << B_TRANSLATE_WITH_CONTEXT("Set ", "Set (property name)")
				 << property;
	}
}
Example #6
0
void
PersonView::BuildGroupMenu()
{
	if (fGroups == NULL)
		return;

	BMenuItem* item;
	while ((item = fGroups->ItemAt(0)) != NULL) {
		fGroups->RemoveItem(item);
		delete item;
	}

	int32 count = 0;

	BVolumeRoster volumeRoster;
	BVolume volume;
	while (volumeRoster.GetNextVolume(&volume) == B_OK) {
		BQuery query;
		query.SetVolume(&volume);

		char buffer[256];
		snprintf(buffer, sizeof(buffer), "%s=*", fCategoryAttribute.String());
		query.SetPredicate(buffer);
		query.Fetch();

		BEntry entry;
		while (query.GetNextEntry(&entry) == B_OK) {
			BFile file(&entry, B_READ_ONLY);
			attr_info info;

			if (file.InitCheck() == B_OK
				&& file.GetAttrInfo(fCategoryAttribute, &info) == B_OK
				&& info.size > 1) {
				if (info.size > sizeof(buffer))
					info.size = sizeof(buffer);

				if (file.ReadAttr(fCategoryAttribute.String(), B_STRING_TYPE,
						0, buffer, info.size) < 0) {
					continue;
				}

				const char *text = buffer;
				while (true) {
					char* offset = strstr(text, ",");
					if (offset != NULL)
						offset[0] = '\0';

					if (!fGroups->FindItem(text)) {
						int32 index = 0;
						while ((item = fGroups->ItemAt(index)) != NULL) {
							if (strcmp(text, item->Label()) < 0)
								break;
							index++;
						}
						BMessage* message = new BMessage(M_GROUP_MENU);
						message->AddString("group", text);
						fGroups->AddItem(new BMenuItem(text, message), index);
						count++;
					}
					if (offset) {
						text = offset + 1;
						while (*text == ' ')
							text++;
					}
					else
						break;
				}
			}
		}
	}

	if (count == 0) {
		fGroups->AddItem(item = new BMenuItem(
			B_TRANSLATE_WITH_CONTEXT("none", "Groups list"),
			new BMessage(M_GROUP_MENU)));
		item->SetEnabled(false);
	}

	fGroups->SetTargetForItems(this);
}