robustness improvements and correct setting of "none" for empty preferred app
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5979 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -103,12 +103,16 @@ FileTypeView::SetFileType(const char * fileType)
|
|||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
BMimeType mime(fileType);
|
BMimeType mime(fileType);
|
||||||
if (mime.InitCheck() != B_OK) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BMessage applications;
|
BMessage applications;
|
||||||
if (mime.GetSupportingApps(&applications) != B_OK) {
|
if (mime.InitCheck() == B_OK) {
|
||||||
return;
|
if (mime.GetSupportingApps(&applications) != B_OK) {
|
||||||
|
BMimeType super;
|
||||||
|
if (mime.GetSupertype(&super) == B_OK) {
|
||||||
|
if (super.GetSupportingApps(&applications) != B_OK) {
|
||||||
|
applications.MakeEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int32 subs = 0;
|
int32 subs = 0;
|
||||||
if (applications.FindInt32("be:sub", &subs) != B_OK) {
|
if (applications.FindInt32("be:sub", &subs) != B_OK) {
|
||||||
@@ -140,7 +144,8 @@ void
|
|||||||
FileTypeView::SetPreferredApplication(const char * preferredApplication)
|
FileTypeView::SetPreferredApplication(const char * preferredApplication)
|
||||||
{
|
{
|
||||||
fPreferredApp.SetTo(preferredApplication);
|
fPreferredApp.SetTo(preferredApplication);
|
||||||
if (preferredApplication == NULL) {
|
if ((preferredApplication == NULL) ||
|
||||||
|
(strlen(preferredApplication) == 0)) {
|
||||||
fPreferredAppMenuItemNone->SetMarked(true);
|
fPreferredAppMenuItemNone->SetMarked(true);
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0 ; (i < fPreferredAppMenu->CountItems()) ; i++) {
|
for (int i = 0 ; (i < fPreferredAppMenu->CountItems()) ; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user