diff --git a/src/kits/tracker/FindPanel.cpp b/src/kits/tracker/FindPanel.cpp
index c854b24643..36706fb76e 100644
a
|
b
|
All rights reserved.
|
37 | 37 | |
38 | 38 | #include <utility> |
39 | 39 | |
| 40 | #include <cassert> |
40 | 41 | #include <errno.h> |
41 | 42 | #include <fs_attr.h> |
42 | 43 | #include <parsedate.h> |
… |
… |
FindPanel::AddOneMimeTypeToMenu(const ShortMimeInfo* info, void* castToMenu)
|
2350 | 2351 | BMessage* message = new BMessage(kMIMETypeItem); |
2351 | 2352 | message->AddString("mimetype", info->InternalName()); |
2352 | 2353 | |
| 2354 | BString text = info->ShortDescription(); |
| 2355 | |
2353 | 2356 | // check to ensure previous item's name differs |
2354 | 2357 | BMenu* menu = superItem->Submenu(); |
2355 | | BMenuItem* previous = menu->ItemAt(menu->CountItems() - 1); |
2356 | | BString text = info->ShortDescription(); |
2357 | | if (previous != NULL |
2358 | | && strcasecmp(previous->Label(), info->ShortDescription()) == 0) { |
2359 | | AddSubtype(text, type); |
2360 | | |
2361 | | // update the previous item as well |
2362 | | BMimeType type(previous->Message()->GetString("mimetype", NULL)); |
2363 | | BString label = ShortMimeInfo(type).ShortDescription(); |
2364 | | AddSubtype(label, type); |
2365 | | previous->SetLabel(label.String()); |
| 2358 | |
| 2359 | if (menu != NULL) { |
| 2360 | if (menu->CountItems() > 0) { |
| 2361 | BMenuItem* previous = menu->ItemAt(menu->CountItems() - 1); |
| 2362 | if (previous != NULL |
| 2363 | && strcasecmp(previous->Label(), info->ShortDescription()) == 0) { |
| 2364 | AddSubtype(text, type); |
| 2365 | |
| 2366 | // update the previous item as well |
| 2367 | BMimeType type(previous->Message()->GetString("mimetype", NULL)); |
| 2368 | BString label = ShortMimeInfo(type).ShortDescription(); |
| 2369 | AddSubtype(label, type); |
| 2370 | previous->SetLabel(label.String()); |
| 2371 | } |
| 2372 | } |
| 2373 | menu->AddItem(new IconMenuItem(text.String(), message, info->InternalName())); |
2366 | 2374 | } |
2367 | | |
2368 | | menu->AddItem(new IconMenuItem(text.String(), message, |
2369 | | info->InternalName())); |
2370 | 2375 | } |
2371 | 2376 | |
2372 | 2377 | return false; |