NS_IMETHODIMP nsOSHelperAppService::ExternalProtocolHandlerExists(const char * aProtocolScheme, PRBool * aHandlerExists)
{
	LOG(("-- nsOSHelperAppService::ExternalProtocolHandlerExists for '%s'\n",
	     aProtocolScheme));
	// look up the protocol scheme in the MIME database
	*aHandlerExists = PR_FALSE;
	if (aProtocolScheme && *aProtocolScheme)
	{
		BString protoStr(aProtocolScheme);
		protoStr.Prepend("application/x-vnd.Be.URL.");
		BMimeType protocol;
		if (protocol.SetTo(protoStr.String()) == B_OK)
		{
			if (protocol.IsInstalled())
				*aHandlerExists = PR_TRUE;
		}
		if ((!*aHandlerExists) && (!strcmp("mailto", aProtocolScheme)))
		{
			// mailto link, no x-vnd.Be.URL.mailto entry
			if (protocol.SetTo("text/x-email") == B_OK)
			{
				if (protocol.IsInstalled())
					*aHandlerExists = PR_TRUE;
			}
		}
	}

	return NS_OK;
}
Example #2
0
/*!	\brief Returns whether the application supports the supplied MIME type.

	If the application supports the wildcard type "application/octet-stream"
	any this method returns \c true for any MIME type.

	\param type The MIME type in question.
	\return \c true, if \a type is a valid MIME type and it is supported by
			the application, \c false otherwise.
*/
bool
BAppFileInfo::IsSupportedType(const char *type) const
{
	status_t error = (type ? B_OK : B_BAD_VALUE);
	// get the supported types
	BMessage types;
	if (error == B_OK)
		error = GetSupportedTypes(&types);
	// turn type into a BMimeType
	BMimeType mimeType;
	if (error == B_OK)
		error = mimeType.SetTo(type);
	// iterate through the supported types
	bool found = false;
	if (error == B_OK) {
		const char *supportedType;
		for (int32 i = 0;
			 !found && types.FindString("types", i, &supportedType) == B_OK;
			 i++) {
			found = !strcmp(supportedType, "application/octet-stream")
					|| BMimeType(supportedType).Contains(&mimeType);
		}
	}
	return found;
}
Example #3
0
/*! \brief Returns a list of all currently installed types of the given
	supertype in the pre-allocated \c BMessage pointed to by \c types.

	See \c BMimeType::GetInstalledTypes(const char*, BMessage*) for more
	information.
*/
status_t
InstalledTypes::GetInstalledTypes(const char *supertype, BMessage *types)
{
	if (supertype == NULL || types == NULL)
		return B_BAD_VALUE;

	// Verify the supertype is valid *and* is a supertype

	BMimeType mime;
	BMimeType super;
	// Make sure the supertype is valid
	status_t err = mime.SetTo(supertype);
	// Make sure it's really a supertype
	if (!err && !mime.IsSupertypeOnly())
		err = B_BAD_VALUE;
	// See if we need to do our initial build still
	if (!err && !fHaveDoneFullBuild)
		err = _BuildInstalledTypesList();

	// Ask the appropriate supertype for its list
	if (!err) {
		std::map<std::string, Supertype>::iterator i = fSupertypes.find(supertype);
		if (i != fSupertypes.end())
			err = i->second.GetInstalledSubtypes(types);
		else
			err = B_NAME_NOT_FOUND;
	}
	return err;
}
nsresult nsOSHelperAppService::LoadUriInternal(nsIURI * aURL)
{
	LOG(("-- nsOSHelperAppService::LoadUrl\n"));
	nsresult rv = NS_OK;

	if (aURL) {
		// Get the Protocol
		nsCAutoString scheme;
		aURL->GetScheme(scheme);
		BString protoStr(scheme.get());
		protoStr.Prepend("application/x-vnd.Be.URL.");
		// Get the Spec
		nsCAutoString spec;
		aURL->GetSpec(spec);
		const char* args[] = { spec.get() };
		
		//Launch the app		
		BMimeType protocol;
		bool isInstalled = false;
		if (protocol.SetTo(protoStr.String()) == B_OK)
		{
			if(protocol.IsInstalled())
			{
				isInstalled = true;	
				be_roster->Launch(protoStr.String(), NS_ARRAY_LENGTH(args), (char **)args);
			}
		}
		if ((!isInstalled) && (!strcmp("mailto", scheme.get())))
			be_roster->Launch("text/x-email", NS_ARRAY_LENGTH(args), (char **)args);
	}
	return rv;
}
Example #5
0
void TorrentObject::MimeType(BMimeType& mime)
{
	mime.SetTo(B_DIRECTORY_MIME_TYPE);
	
	if( !IsFolder() && !IsMagnet() )
		BMimeType::GuessMimeType(Info()->files[0].name, &mime);
}
Example #6
0
void
ExtensionListView::SetType(BMimeType* type)
{
	if (type != NULL)
		fType.SetTo(type->Type());
	else
		fType.Unset();
}
Example #7
0
// Fetches a \c BMessage containing a list of MIME signatures of
// applications that are able to handle files of any type.
status_t
BMimeType::GetWildcardApps(BMessage* wild_ones)
{
	BMimeType mime;
	status_t err = mime.SetTo("application/octet-stream");
	if (err == B_OK)
		err = mime.GetSupportingApps(wild_ones);
	return err;
}
status_t
IconView::GetMimeType(BMimeType& type) const
{
	if (!fHasType)
		return B_BAD_TYPE;

	type.SetTo(fType.Type());
	return B_OK;
}
Example #9
0
// Returns whether this and the supplied MIME type are equal
bool
BMimeType::operator==(const char* type) const
{
	BMimeType mime;
	if (type)
		mime.SetTo(type);

	return (*this) == mime;
}
Example #10
0
void
TBarApp::FetchAppIcon(BarTeamInfo* barInfo)
{
	int32 width = IconSize();
	int32 index = (width - kMinimumIconSize) / kIconSizeInterval;

	// first look in the icon cache
	barInfo->icon = barInfo->iconCache[index];
	if (barInfo->icon != NULL)
		return;

	// icon wasn't in cache, get it from be_roster and cache it
	app_info appInfo;
	icon_size size = width >= 31 ? B_LARGE_ICON : B_MINI_ICON;
	BBitmap* icon = new BBitmap(IconRect(), kIconColorSpace);
	if (be_roster->GetAppInfo(barInfo->sig, &appInfo) == B_OK) {
		// fetch the app icon
		BFile file(&appInfo.ref, B_READ_ONLY);
		BAppFileInfo appMime(&file);
		if (appMime.GetIcon(icon, size) == B_OK) {
			delete barInfo->iconCache[index];
			barInfo->iconCache[index] = barInfo->icon = icon;
			return;
		}
	}

	// couldn't find the app icon
	// fetch the generic 3 boxes icon and cache it
	BMimeType defaultAppMime;
	defaultAppMime.SetTo(B_APP_MIME_TYPE);
	if (defaultAppMime.GetIcon(icon, size) == B_OK) {
		delete barInfo->iconCache[index];
		barInfo->iconCache[index] = barInfo->icon = icon;
		return;
	}

	// couldn't find generic 3 boxes icon
	// fill with transparent
	uint8* iconBits = (uint8*)icon->Bits();
	if (icon->ColorSpace() == B_RGBA32) {
		int32 i = 0;
		while (i < icon->BitsLength()) {
			iconBits[i++] = B_TRANSPARENT_32_BIT.red;
			iconBits[i++] = B_TRANSPARENT_32_BIT.green;
			iconBits[i++] = B_TRANSPARENT_32_BIT.blue;
			iconBits[i++] = B_TRANSPARENT_32_BIT.alpha;
		}
	} else {
		// Assume B_CMAP8
		for (int32 i = 0; i < icon->BitsLength(); i++)
			iconBits[i] = B_TRANSPARENT_MAGIC_CMAP8;
	}

	delete barInfo->iconCache[index];
	barInfo->iconCache[index] = barInfo->icon = icon;
}
Example #11
0
		void checkMimeTypes()
		{
			BMimeType mime;
			mime.SetTo("application/x-vnd.BeServed-fileserver");
			mime.Delete();
			if (!mime.IsInstalled())
			{
				mime.Install();
				mime.SetShortDescription("Network File Server");
				mime.SetLongDescription("A network server running BeServed");
				setMimeIcon(&mime, MYNET_ICON_HOST_LARGE, B_LARGE_ICON);
				setMimeIcon(&mime, MYNET_ICON_HOST_SMALL, B_MINI_ICON);
			}

			mime.SetTo("application/x-vnd.BeServed-inetserver");
			mime.Delete();
			if (!mime.IsInstalled())
			{
				mime.Install();
				mime.SetShortDescription("Public File Server");
				mime.SetLongDescription("A remote network server running BeServed");
				setMimeIcon(&mime, MYNET_ICON_INETHOST_LARGE, B_LARGE_ICON);
				setMimeIcon(&mime, MYNET_ICON_INETHOST_SMALL, B_MINI_ICON);
			}

			mime.SetTo("application/x-vnd.BeServed-fileshare");
			mime.Delete();
			if (!mime.IsInstalled())
			{
				mime.Install();
				mime.SetShortDescription("Shared Volume");
				mime.SetLongDescription("A BeServed network shared volume");
				setMimeIcon(&mime, MYNET_ICON_SHARE_LARGE, B_LARGE_ICON);
				setMimeIcon(&mime, MYNET_ICON_SHARE_SMALL, B_MINI_ICON);
			}
		}
Example #12
0
void
TBarApp::FetchAppIcon(const char* signature, BBitmap* icon)
{
	app_info appInfo;
	icon_size size = icon->Bounds().IntegerHeight() >= 32
		? B_LARGE_ICON : B_MINI_ICON;

	if (be_roster->GetAppInfo(signature, &appInfo) == B_OK) {
		// fetch the app icon
		BFile file(&appInfo.ref, B_READ_ONLY);
		BAppFileInfo appMime(&file);
		if (appMime.GetIcon(icon, size) == B_OK)
			return;
	}

	// couldn't find the app icon
	// fetch the generic 3 boxes icon
	BMimeType defaultAppMime;
	defaultAppMime.SetTo(B_APP_MIME_TYPE);
	if (defaultAppMime.GetIcon(icon, size) == B_OK)
		return;

	// couldn't find generic 3 boxes icon
	// fill with transparent
	uint8* iconBits = (uint8*)icon->Bits();
	if (icon->ColorSpace() == B_RGBA32) {
		int32 i = 0;
		while (i < icon->BitsLength()) {
			iconBits[i++] = B_TRANSPARENT_32_BIT.red;
			iconBits[i++] = B_TRANSPARENT_32_BIT.green;
			iconBits[i++] = B_TRANSPARENT_32_BIT.blue;
			iconBits[i++] = B_TRANSPARENT_32_BIT.alpha;
		}
	} else {
		// Assume B_CMAP8
		for (int32 i = 0; i < icon->BitsLength(); i++)
			iconBits[i] = B_TRANSPARENT_MAGIC_CMAP8;
	}
}
Example #13
0
bool
FileIterator::_ExamineFile(BEntry& entry, char* buffer, bool textFilesOnly)
{
	BPath path;
	if (entry.GetPath(&path) != B_OK)
		return false;

	strcpy(buffer, path.Path());

	if (!textFilesOnly)
		return true;

	BMimeType mimeType;
	BNode node(&entry);
	BNodeInfo nodeInfo(&node);
	char mimeTypeString[B_MIME_TYPE_LENGTH];

	if (nodeInfo.GetType(mimeTypeString) != B_OK) {
		// try to get a MIME type before failing
		if (BMimeType::GuessMimeType(path.Path(), &mimeType) != B_OK)
			return false;

		nodeInfo.SetType(mimeType.Type());
	} else
		mimeType.SetTo(mimeTypeString);

	BMimeType superType;
	if (mimeType.GetSupertype(&superType) == B_OK) {
		if (strcmp("text", superType.Type()) == 0
			|| strcmp("message", superType.Type()) == 0) {
			return true;
		}
	}

	return false;
}
Example #14
0
CFtpDialog::CFtpDialog(BRect frame, const char *name, window_type type, int flags,
	BWindow *owner)
	: HDialog(frame, name, type, flags, owner, NULL)
{

	fReply = new char[1024];
	fPath = new char[PATH_MAX];
	fSave = false;
	fSocket = -1;

	Create();
	Layout();

#if 0
	// Build Extension->Mimetype list // Takes looong
	typedef pair<string,string> entry;
	BMessage mimDat;
	BMessage extDat;
	BMimeType mimTyp;
	int32 mimIdx = -1;
	int32 extIdx = 0;
	const char* mimCStr;
	const char* extCStr;
	if (BMimeType::GetInstalledTypes(&mimDat) == B_OK) {
		while (mimDat.FindString("types", ++mimIdx, &mimCStr) == B_OK) {
			if ((mimTyp.SetTo(mimCStr) == B_OK) && (mimTyp.GetFileExtensions(&extDat) == B_OK)) {
				extIdx = -1;
				while (extDat.FindString("extensions", ++extIdx, &extCStr) == B_OK) {
					BString extStr(extCStr);
					extStr.ToLower();
					if (extStr.ByteAt(0) == '.')  extStr.Remove(0, 1);
					fExtMime[extCStr] = mimCStr;
				}
			}
		}
	}
#else
	// perhaps it's better to go with some predefiend types:
	fExtMime["aiff"] = "audio/x-aiff";
	fExtMime["bz2"] = "application/x-bzip2";
	fExtMime["cc"] = "text/x-source-code";
	fExtMime["cpp"] = "text/x-source-code";
	fExtMime["css"] = "text/css";
	fExtMime["gif"] = "image/gif";
	fExtMime["gz"] = "application/x-gzip";
	fExtMime["h"] = "text/x-source-code";
	fExtMime["htm"] = "text/html";
	fExtMime["html"] = "text/html";
	fExtMime["jpeg"] = "image/jpeg";
	fExtMime["jpg"] = "image/jpeg";
	fExtMime["mod"] = "audio/x-mod";
	fExtMime["mov"] = "video/quicktime";
	fExtMime["mp3"] = "audio/x-mpeg";
	fExtMime["ogg"] = "audio/ogg.vorbis";
	fExtMime["pdf"] = "application/pdf";
	fExtMime["php"] = "text/x-php";
	fExtMime["pl"] = "text/x-perl";
	fExtMime["pkg"] = "application/x-scode-UPkg";
	fExtMime["png"] = "image/png";
	fExtMime["py"] = "text/x-source-code";
	fExtMime["rar"] = "application/x-rar";
	fExtMime["swf"] = "application/x-shockwave-flash";
	fExtMime["tar"] = "application/x-tar";
	fExtMime["tga"] = "image/x-targa";
	fExtMime["tgz"] = "application/x-gzip";
	fExtMime["txt"] = "text/plain";
	fExtMime["xml"] = "text/xml";
	fExtMime["zip"] = "application/zip";
#endif

} // CFtpDialog::CFtpDialog
Example #15
0
void
SearchForSignatureEntryList::RelationDescription(const BMessage* entriesToOpen,
	const Model* applicationModel, BString* description,
	const entry_ref* preferredApp, const entry_ref* preferredAppForFile)
{
	for (int32 index = 0; ;index++) {
		entry_ref ref;
		if (entriesToOpen->FindRef("refs", index, &ref) != B_OK)
			break;

		if (preferredAppForFile && ref == *preferredAppForFile) {
			description->SetTo(B_TRANSLATE("Preferred for file"));
			return;
		}

		Model model(&ref, true, true);
		if (model.InitCheck())
			continue;

		BMimeType mimeType;
		int32 result = Relation(&model, applicationModel);
		switch (result) {
			case kDoesNotSupportType:
				continue;

			case kSuperhandler:
				description->SetTo(B_TRANSLATE("Handles any file"));
				return;

			case kSupportsSupertype:
			{
				mimeType.SetTo(model.MimeType());
				// status_t result = mimeType.GetSupertype(&mimeType);

				char* type = (char*)mimeType.Type();
				char* tmp = strchr(type, '/');
				if (tmp != NULL)
					*tmp = '\0';

				//PRINT(("getting supertype for %s, result %s, got %s\n",
				//	model.MimeType(), strerror(result), mimeType.Type()));
				description->SetTo(B_TRANSLATE("Handles any %type"));
				//*description += mimeType.Type();
				description->ReplaceFirst("%type", type);
				return;
			}

			case kSupportsType:
			{
				mimeType.SetTo(model.MimeType());

				if (preferredApp != NULL
					&& *applicationModel->EntryRef() == *preferredApp) {
					// application matches cached preferred app, we are done
					description->SetTo(B_TRANSLATE("Preferred for %type"));
				} else
					description->SetTo(B_TRANSLATE("Handles %type"));

				char shortDescription[256];
				if (mimeType.GetShortDescription(shortDescription) == B_OK)
					description->ReplaceFirst("%type", shortDescription);
				else
					description->ReplaceFirst("%type", mimeType.Type());

				return;
			}
		}
	}

	description->SetTo(B_TRANSLATE("Does not handle file"));
}
Example #16
0
void
TestView::SetupTestMenu(void)
{
	// These ones will always exist. Type is the default because it's probably
	// going to be the one most used
	BMessage *msg;
	BPopUpMenu *menu = new BPopUpMenu("Test");
	
	
	// Read in the types in the MIME database which have extra attributes
	// associated with them
	
	BMimeType mime;
	BMessage types, info, attr;
	BString string;
	
	BMimeType::GetInstalledTypes(&types);
	
	int32 index = 0;
	while (types.FindString("types",index,&string) == B_OK)
	{
		index++;
		mime.SetTo(string.String());
		if (mime.GetAttrInfo(&info) != B_OK)
			continue;
		
		int32 infoindex = 0;
		BString attrName;
		BString attrPublicName;
		int32 attrType;
		
		char attrTypeName[B_MIME_TYPE_LENGTH];
		mime.GetShortDescription(attrTypeName);
		
		while (info.FindString("attr:name",infoindex,&attrName) == B_OK)
		{
			// This is where we create tests based on a particular type's "special" attributes
			
			// Just string attributes are supported for now
			if (info.FindInt32("attr:type",infoindex,&attrType) != B_OK ||
				attrType != B_STRING_TYPE ||
				info.FindString("attr:public_name",infoindex,&attrPublicName) != B_OK)
			{
				infoindex++;
				continue;
			}
			
			BMenu *submenu = GetMenu(menu,attrTypeName);
			if (!submenu)
				submenu = AddMenuSorted(menu,attrTypeName);
			
			msg = new BMessage(M_TEST_CHOSEN);
			msg->AddString("name","Attribute");
			msg->AddString("attrtype",attrName);
			msg->AddString("attrname",attrPublicName);
			msg->AddString("mimetype",string);
			msg->AddString("typename",attrTypeName);
			submenu->AddItem(new BMenuItem(attrPublicName.String(),msg));
			
			infoindex++;
		}
	}
	
	menu->AddItem(new BSeparatorItem(),0);
	
	
	// All this weirdness is to have the "standard"	tests at the top and
	// the attribute tests at the bottom with a separator in between
	BString testtype;
	int32 i = 0;
	while (fTestTypes.FindString("tests",i,&testtype) == B_OK)
		i++;
	
	i--;
	
	while (i >= 0)
	{
		fTestTypes.FindString("tests",i,&testtype);
		msg = new BMessage(M_TEST_CHOSEN);
		msg->AddString("name",testtype);
		menu->AddItem(new BMenuItem(testtype.String(),msg),0);
		i--;
	}
	
	
	menu->Archive(&fArchivedTestMenu);
	delete menu;
}
Example #17
0
/***********************************************************
 * Constructor
 ***********************************************************/
HAttachmentItem::HAttachmentItem(const char* name,
									off_t	file_offset,
									int32	data_len,
									const char *content_type,
									const char *encoding,
									const char	*charset)
	:CLVEasyItem(0,false,false,20.0)
	,fFileOffset(file_offset)
	,fDataLen(data_len)
	,fExtracted(false)
	,fContentType(NULL)
	,fEncoding(NULL)
	,fCharset(NULL)
	,fName(NULL)
{
	fName = (name)?name:_("Unknown");
	
	Encoding().Mime2UTF8(fName);
	
	SetColumnContent(1,fName.String());
	SetColumnContent(2,(content_type)?content_type:_("(Unknown)"));
	
	char *size = new char[15];
	float d = 0;
	char *unit = new char[6];
	if(data_len < 1024)
	{
		d = data_len;
		::strcpy(unit,_("bytes"));
	}else if(data_len >= 1024 && data_len < 1024*1024){
		d = data_len/1024.0;
		::strcpy(unit,_("KB"));
	}else{
		d = data_len/(1024.0*1024.0);
		::strcpy(unit,_("MB"));
	}
	::sprintf(size,"%6.2f %s",d,unit);
	SetColumnContent(3,size);
	delete[] size;
	delete[] unit;
	BBitmap *bitmap = new BBitmap(BRect(0,0,15,15),B_CMAP8);
	BMimeType preferredApp;
	if(content_type)
	{
		BMimeType mime(content_type);
		char prefApp[B_MIME_TYPE_LENGTH];
		mime.GetPreferredApp(prefApp);
		preferredApp.SetTo(prefApp);
		fContentType = ::strdup(content_type);
		if(preferredApp.GetIconForType(content_type,bitmap,B_MINI_ICON) != B_OK)
		{
			mime.GetIcon(bitmap,B_MINI_ICON);
		}
		SetColumnContent(0,bitmap);
	}
	
	delete bitmap;
	if(encoding)
		fEncoding = ::strdup(encoding);
	if(charset)
		fCharset = ::strdup(charset);
}
status_t
CreateAppMetaMimeThread::DoMimeUpdate(const entry_ref* ref, bool* _entryIsDir)
{
    if (ref == NULL)
        return B_BAD_VALUE;

    BNode typeNode;

    BFile file;
    status_t status = file.SetTo(ref, B_READ_ONLY);
    if (status < B_OK)
        return status;

    bool isDir = file.IsDirectory();
    if (_entryIsDir != NULL)
        *_entryIsDir = isDir;

    if (isDir)
        return B_OK;

    BAppFileInfo appInfo(&file);
    status = appInfo.InitCheck();
    if (status < B_OK)
        return status;

    // Read the app sig (which consequently keeps us from updating
    // non-applications, since we get an error if the file has no
    // app sig)
    BString signature;
    status = file.ReadAttrString("BEOS:APP_SIG", &signature);
    if (status < B_OK)
        return B_BAD_TYPE;

    // Init our various objects

    BMimeType mime;
    status = mime.SetTo(signature.String());
    if (status < B_OK)
        return status;

    InstallNotificationDeferrer _(fDatabase, signature.String());

    if (!mime.IsInstalled())
        mime.Install();

    BString path = "/";
    path.Append(signature);
    path.ToLower();
    // Signatures and MIME types are case insensitive, but we want to
    // preserve the case wherever possible
    path.Prepend(get_database_directory().c_str());

    status = typeNode.SetTo(path.String());
    if (status < B_OK)
        return status;

    // Preferred App
    attr_info info;
    if (status == B_OK && (fForce || typeNode.GetAttrInfo(kPreferredAppAttr, &info) != B_OK))
        status = mime.SetPreferredApp(signature.String());

    // Short Description (name of the application)
    if (status == B_OK && (fForce || typeNode.GetAttrInfo(kShortDescriptionAttr, &info) != B_OK))
        status = mime.SetShortDescription(ref->name);

    // App Hint
    if (status == B_OK && (fForce || typeNode.GetAttrInfo(kAppHintAttr, &info) != B_OK))
        status = mime.SetAppHint(ref);

    // Vector Icon
    if (status == B_OK && (fForce || typeNode.GetAttrInfo(kIconAttr, &info) != B_OK)) {
        uint8* data = NULL;
        size_t size = 0;
        if (appInfo.GetIcon(&data, &size) == B_OK) {
            status = mime.SetIcon(data, size);
            free(data);
        }
    }
    // Mini Icon
    BBitmap miniIcon(BRect(0, 0, 15, 15), B_BITMAP_NO_SERVER_LINK, B_CMAP8);
    if (status == B_OK && (fForce || typeNode.GetAttrInfo(kMiniIconAttr, &info) != B_OK)) {
        if (appInfo.GetIcon(&miniIcon, B_MINI_ICON) == B_OK)
            status = mime.SetIcon(&miniIcon, B_MINI_ICON);
    }
    // Large Icon
    BBitmap largeIcon(BRect(0, 0, 31, 31), B_BITMAP_NO_SERVER_LINK, B_CMAP8);
    if (status == B_OK && (fForce || typeNode.GetAttrInfo(kLargeIconAttr, &info) != B_OK)) {
        if (appInfo.GetIcon(&largeIcon, B_LARGE_ICON) == B_OK)
            status = mime.SetIcon(&largeIcon, B_LARGE_ICON);
    }

    // Supported Types
    bool setSupportedTypes = false;
    BMessage supportedTypes;
    if (status == B_OK && (fForce || typeNode.GetAttrInfo(kSupportedTypesAttr, &info) != B_OK)) {
        if (appInfo.GetSupportedTypes(&supportedTypes) == B_OK)
            setSupportedTypes = true;
    }

    // defer notifications for supported types
    const char* type;
    for (int32 i = 0; supportedTypes.FindString("types", i, &type) == B_OK; i++)
        fDatabase->DeferInstallNotification(type);

    // set supported types
    if (setSupportedTypes)
        status = mime.SetSupportedTypes(&supportedTypes);

    // Icons for supported types
    for (int32 i = 0; supportedTypes.FindString("types", i, &type) == B_OK; i++) {
        // vector icon
        uint8* data = NULL;
        size_t size = 0;
        if (status == B_OK && appInfo.GetIconForType(type, &data, &size) == B_OK) {
            status = mime.SetIconForType(type, data, size);
            free(data);
        }
        // mini icon
        if (status == B_OK && appInfo.GetIconForType(type, &miniIcon, B_MINI_ICON) == B_OK)
            status = mime.SetIconForType(type, &miniIcon, B_MINI_ICON);
        // large icon
        if (status == B_OK && appInfo.GetIconForType(type, &largeIcon, B_LARGE_ICON) == B_OK)
            status = mime.SetIconForType(type, &largeIcon, B_LARGE_ICON);
    }

    // undefer notifications for supported types
    for (int32 i = 0; supportedTypes.FindString("types", i, &type) == B_OK; i++)
        fDatabase->UndeferInstallNotification(type);

    return status;
}