We now set the preferred application of MIME types that are installed from
the supported types of an application to the one responsible. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16542 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -486,34 +486,44 @@ Database::SetSupportedTypes(const char *type, const BMessage *types, bool fullSy
|
|||||||
{
|
{
|
||||||
DBG(OUT("Database::SetSupportedTypes()\n"));
|
DBG(OUT("Database::SetSupportedTypes()\n"));
|
||||||
|
|
||||||
bool didCreate = false;
|
if (type == NULL || types == NULL)
|
||||||
status_t err = (type && types) ? B_OK : B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
// Install the types
|
// Install the types
|
||||||
if (!err) {
|
const char *supportedType;
|
||||||
const char *supportedType;
|
for (int32 i = 0; types->FindString("types", i, &supportedType) == B_OK; i++) {
|
||||||
for (int32 i = 0;
|
if (!is_installed(supportedType)) {
|
||||||
err == B_OK
|
if (Install(supportedType) != B_OK)
|
||||||
&& types->FindString("types", i, &supportedType) == B_OK;
|
break;
|
||||||
i++) {
|
|
||||||
if (!is_installed(supportedType))
|
// Since the type has been introduced by this application
|
||||||
err = Install(supportedType);
|
// we take the liberty and make it the preferred handler
|
||||||
|
// for them, too.
|
||||||
|
SetPreferredApp(supportedType, type, B_OPEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the attr
|
// Write the attr
|
||||||
if (!err)
|
bool didCreate = false;
|
||||||
err = write_mime_attr_message(type, kSupportedTypesAttr, types, &didCreate);
|
status_t status = write_mime_attr_message(type, kSupportedTypesAttr, types,
|
||||||
|
&didCreate);
|
||||||
|
|
||||||
// Notify the monitor if we created the type when we opened it
|
// Notify the monitor if we created the type when we opened it
|
||||||
if (!err && didCreate)
|
if (status == B_OK && didCreate)
|
||||||
_SendInstallNotification(type);
|
_SendInstallNotification(type);
|
||||||
|
|
||||||
// Update the supporting apps map
|
// Update the supporting apps map
|
||||||
if (!err)
|
if (status == B_OK)
|
||||||
err = fSupportingApps.SetSupportedTypes(type, types, fullSync);
|
status = fSupportingApps.SetSupportedTypes(type, types, fullSync);
|
||||||
|
|
||||||
// Notify the monitor
|
// Notify the monitor
|
||||||
if (!err)
|
if (status == B_OK)
|
||||||
_SendMonitorUpdate(B_SUPPORTED_TYPES_CHANGED, type, B_META_MIME_MODIFIED);
|
_SendMonitorUpdate(B_SUPPORTED_TYPES_CHANGED, type, B_META_MIME_MODIFIED);
|
||||||
return err;
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GetInstalledSupertypes
|
// GetInstalledSupertypes
|
||||||
/*! \brief Fetches a BMessage listing all the MIME supertypes currently
|
/*! \brief Fetches a BMessage listing all the MIME supertypes currently
|
||||||
installed in the MIME database.
|
installed in the MIME database.
|
||||||
|
|||||||
Reference in New Issue
Block a user