The IconView now also shows an icon for a MIME type if it got it from the
super type's preferred application. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16366 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1d268b8f9f
commit
9a7fabb66c
@ -191,8 +191,10 @@ IconView::SetTo(BMimeType* type)
|
|||||||
fIconSource = kNoIcon;
|
fIconSource = kNoIcon;
|
||||||
|
|
||||||
if (type != NULL) {
|
if (type != NULL) {
|
||||||
if (fIcon == NULL)
|
if (fIcon == NULL) {
|
||||||
fIcon = new BBitmap(BRect(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1), B_CMAP8);
|
fIcon = new BBitmap(BRect(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1),
|
||||||
|
B_CMAP8);
|
||||||
|
}
|
||||||
|
|
||||||
if (type->GetIcon(fIcon, B_LARGE_ICON) == B_OK)
|
if (type->GetIcon(fIcon, B_LARGE_ICON) == B_OK)
|
||||||
fIconSource = kOwnIcon;
|
fIconSource = kOwnIcon;
|
||||||
@ -204,7 +206,8 @@ IconView::SetTo(BMimeType* type)
|
|||||||
if (type->GetPreferredApp(preferred) == B_OK) {
|
if (type->GetPreferredApp(preferred) == B_OK) {
|
||||||
BMimeType preferredApp(preferred);
|
BMimeType preferredApp(preferred);
|
||||||
|
|
||||||
if (preferredApp.GetIconForType(type->Type(), fIcon, B_LARGE_ICON) == B_OK)
|
if (preferredApp.GetIconForType(type->Type(), fIcon,
|
||||||
|
B_LARGE_ICON) == B_OK)
|
||||||
fIconSource = kApplicationIcon;
|
fIconSource = kApplicationIcon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,6 +219,17 @@ IconView::SetTo(BMimeType* type)
|
|||||||
if (type->GetSupertype(&superType) == B_OK) {
|
if (type->GetSupertype(&superType) == B_OK) {
|
||||||
if (superType.GetIcon(fIcon, B_LARGE_ICON) == B_OK)
|
if (superType.GetIcon(fIcon, B_LARGE_ICON) == B_OK)
|
||||||
fIconSource = kSupertypeIcon;
|
fIconSource = kSupertypeIcon;
|
||||||
|
else {
|
||||||
|
// check the super type's preferred app
|
||||||
|
char preferred[B_MIME_TYPE_LENGTH];
|
||||||
|
if (superType.GetPreferredApp(preferred) == B_OK) {
|
||||||
|
BMimeType preferredApp(preferred);
|
||||||
|
|
||||||
|
if (preferredApp.GetIconForType(superType.Type(),
|
||||||
|
fIcon, B_LARGE_ICON) == B_OK)
|
||||||
|
fIconSource = kSupertypeIcon;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user