- Find panel now also includes supertype attributes.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28729 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Bruno G. Albuquerque 2008-11-25 22:50:02 +00:00
parent d23283c43e
commit 641305c237
2 changed files with 29 additions and 14 deletions

View File

@ -2611,21 +2611,8 @@ TAttrView::AddMimeTypeAttrs()
void
TAttrView::AddMimeTypeAttrs(BMenu *menu)
TAttrView::AddAttributes(BMenu *menu, const BMimeType &mimeType)
{
FindPanel *mainView = dynamic_cast<FindPanel *>(Parent()->
Parent()->FindView("MainView"));
if (!mainView)
return;
const char *typeName;
if (mainView->CurrentMimeType(&typeName) == NULL)
return;
BMimeType mimeType(typeName);
if (!mimeType.IsInstalled())
return;
// only add things to menu which have "user-visible" data
BMessage attributeMessage;
if (mimeType.GetAttrInfo(&attributeMessage) != B_OK)
@ -2722,7 +2709,34 @@ TAttrView::AddMimeTypeAttrs(BMenu *menu)
break;
}
submenu->SetTargetForItems(this);
}
}
void
TAttrView::AddMimeTypeAttrs(BMenu *menu)
{
FindPanel *mainView = dynamic_cast<FindPanel *>(Parent()->
Parent()->FindView("MainView"));
if (!mainView)
return;
const char *typeName;
if (mainView->CurrentMimeType(&typeName) == NULL)
return;
BMimeType mimeType(typeName);
if (!mimeType.IsInstalled())
return;
if (!mimeType.IsSupertypeOnly()) {
// add supertype attributes
BMimeType supertype;
mimeType.GetSupertype(&supertype);
AddAttributes(menu, supertype);
}
AddAttributes(menu, mimeType);
}

View File

@ -304,6 +304,7 @@ class TAttrView : public BView {
void GetDefaultName(BString &result) const;
private:
void AddAttributes(BMenu *, const BMimeType &);
void AddMimeTypeAttrs(BMenu *);
BMenuField *fMenuField;