CreateAppMetaMimeThread::DoMimeUpdate() now also updates the supported types
of an application as well as the their icons. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16541 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+100
-119
@@ -1,14 +1,11 @@
|
|||||||
//----------------------------------------------------------------------
|
/*
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
* Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
|
||||||
// by the OpenBeOS license.
|
* Distributed under the terms of the MIT License.
|
||||||
//---------------------------------------------------------------------
|
*/
|
||||||
/*!
|
|
||||||
\file MimeType.h
|
|
||||||
BMimeType interface declarations.
|
|
||||||
*/
|
|
||||||
#ifndef _MIME_TYPE_H
|
#ifndef _MIME_TYPE_H
|
||||||
#define _MIME_TYPE_H
|
#define _MIME_TYPE_H
|
||||||
|
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
#include <StorageDefs.h>
|
#include <StorageDefs.h>
|
||||||
|
|
||||||
@@ -24,6 +21,11 @@ class BMessenger;
|
|||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
class MimeDatabase;
|
class MimeDatabase;
|
||||||
|
namespace Storage {
|
||||||
|
namespace Mime {
|
||||||
|
class CreateAppMetaMimeThread;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum app_verb {
|
enum app_verb {
|
||||||
@@ -83,141 +85,120 @@ enum {
|
|||||||
\version 0.0.0
|
\version 0.0.0
|
||||||
*/
|
*/
|
||||||
class BMimeType {
|
class BMimeType {
|
||||||
public:
|
public:
|
||||||
BMimeType();
|
BMimeType();
|
||||||
BMimeType(const char *mimeType);
|
BMimeType(const char *mimeType);
|
||||||
virtual ~BMimeType();
|
virtual ~BMimeType();
|
||||||
|
|
||||||
status_t SetTo(const char *mimeType);
|
status_t SetTo(const char *mimeType);
|
||||||
void Unset();
|
void Unset();
|
||||||
status_t InitCheck() const;
|
status_t InitCheck() const;
|
||||||
|
|
||||||
/* these functions simply perform string manipulations*/
|
/* these functions simply perform string manipulations*/
|
||||||
const char *Type() const;
|
const char *Type() const;
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
bool IsSupertypeOnly() const;
|
bool IsSupertypeOnly() const;
|
||||||
status_t GetSupertype(BMimeType *superType) const;
|
status_t GetSupertype(BMimeType *superType) const;
|
||||||
|
|
||||||
bool operator==(const BMimeType &type) const;
|
bool operator==(const BMimeType &type) const;
|
||||||
bool operator==(const char *type) const;
|
bool operator==(const char *type) const;
|
||||||
|
|
||||||
bool Contains(const BMimeType *type) const;
|
bool Contains(const BMimeType *type) const;
|
||||||
|
|
||||||
/* These functions are for managing data in the meta mime file*/
|
/* These functions are for managing data in the meta mime file */
|
||||||
status_t Install();
|
status_t Install();
|
||||||
status_t Delete();
|
status_t Delete();
|
||||||
bool IsInstalled() const;
|
bool IsInstalled() const;
|
||||||
status_t GetIcon(BBitmap *icon, icon_size size) const;
|
status_t GetIcon(BBitmap *icon, icon_size size) const;
|
||||||
status_t GetPreferredApp(char *signature, app_verb verb = B_OPEN) const;
|
status_t GetPreferredApp(char *signature, app_verb verb = B_OPEN) const;
|
||||||
status_t GetAttrInfo(BMessage *info) const;
|
status_t GetAttrInfo(BMessage *info) const;
|
||||||
status_t GetFileExtensions(BMessage *extensions) const;
|
status_t GetFileExtensions(BMessage *extensions) const;
|
||||||
status_t GetShortDescription(char *description) const;
|
status_t GetShortDescription(char *description) const;
|
||||||
status_t GetLongDescription(char *description) const;
|
status_t GetLongDescription(char *description) const;
|
||||||
status_t GetSupportingApps(BMessage *signatures) const;
|
status_t GetSupportingApps(BMessage *signatures) const;
|
||||||
|
|
||||||
status_t SetIcon(const BBitmap *icon, icon_size size);
|
status_t SetIcon(const BBitmap *icon, icon_size size);
|
||||||
status_t SetPreferredApp(const char *signature, app_verb verb = B_OPEN);
|
status_t SetPreferredApp(const char *signature, app_verb verb = B_OPEN);
|
||||||
status_t SetAttrInfo(const BMessage *info);
|
status_t SetAttrInfo(const BMessage *info);
|
||||||
status_t SetFileExtensions(const BMessage *extensions);
|
status_t SetFileExtensions(const BMessage *extensions);
|
||||||
status_t SetShortDescription(const char *description);
|
status_t SetShortDescription(const char *description);
|
||||||
status_t SetLongDescription(const char *description);
|
status_t SetLongDescription(const char *description);
|
||||||
|
|
||||||
static status_t GetInstalledSupertypes(BMessage *supertypes);
|
static status_t GetInstalledSupertypes(BMessage *supertypes);
|
||||||
static status_t GetInstalledTypes(BMessage *types);
|
static status_t GetInstalledTypes(BMessage *types);
|
||||||
static status_t GetInstalledTypes(const char *supertype,
|
static status_t GetInstalledTypes(const char* supertype,
|
||||||
BMessage *subtypes);
|
BMessage* subtypes);
|
||||||
static status_t GetWildcardApps(BMessage *wild_ones);
|
static status_t GetWildcardApps(BMessage* wildcardApps);
|
||||||
static bool IsValid(const char *mimeType);
|
static bool IsValid(const char *mimeType);
|
||||||
|
|
||||||
status_t GetAppHint(entry_ref *ref) const;
|
status_t GetAppHint(entry_ref *ref) const;
|
||||||
status_t SetAppHint(const entry_ref *ref);
|
status_t SetAppHint(const entry_ref *ref);
|
||||||
|
|
||||||
/* for application signatures only.*/
|
/* for application signatures only. */
|
||||||
status_t GetIconForType(const char *type, BBitmap *icon,
|
status_t GetIconForType(const char *type, BBitmap *icon,
|
||||||
icon_size which) const;
|
icon_size which) const;
|
||||||
status_t SetIconForType(const char *type, const BBitmap *icon,
|
status_t SetIconForType(const char *type, const BBitmap *icon,
|
||||||
icon_size which);
|
icon_size which);
|
||||||
|
|
||||||
/* sniffer rule manipulation */
|
/* sniffer rule manipulation */
|
||||||
status_t GetSnifferRule(BString *result) const;
|
status_t GetSnifferRule(BString *result) const;
|
||||||
status_t SetSnifferRule(const char *);
|
status_t SetSnifferRule(const char *);
|
||||||
static status_t CheckSnifferRule(const char *rule, BString *parseError);
|
static status_t CheckSnifferRule(const char *rule, BString *parseError);
|
||||||
|
|
||||||
/* calls to ask the sniffer to identify the MIME type of a file or data in
|
/* calls to ask the sniffer to identify the MIME type of a file or data in
|
||||||
memory */
|
memory */
|
||||||
static status_t GuessMimeType(const entry_ref *file, BMimeType *type);
|
static status_t GuessMimeType(const entry_ref *file, BMimeType *type);
|
||||||
static status_t GuessMimeType(const void *buffer, int32 length,
|
static status_t GuessMimeType(const void *buffer, int32 length,
|
||||||
BMimeType *type);
|
BMimeType *type);
|
||||||
static status_t GuessMimeType(const char *filename, BMimeType *type);
|
static status_t GuessMimeType(const char *filename, BMimeType *type);
|
||||||
|
|
||||||
static status_t StartWatching(BMessenger target);
|
static status_t StartWatching(BMessenger target);
|
||||||
static status_t StopWatching(BMessenger target);
|
static status_t StopWatching(BMessenger target);
|
||||||
|
|
||||||
/* Deprecated Use SetTo instead. */
|
/* Deprecated. Use SetTo() instead. */
|
||||||
status_t SetType(const char *mimeType);
|
status_t SetType(const char *mimeType);
|
||||||
|
|
||||||
/* Brand new Delete() methods */
|
/* Brand new Delete() methods */
|
||||||
status_t DeleteAppHint();
|
status_t DeleteAppHint();
|
||||||
status_t DeleteAttrInfo();
|
status_t DeleteAttrInfo();
|
||||||
status_t DeleteShortDescription();
|
status_t DeleteShortDescription();
|
||||||
status_t DeleteLongDescription();
|
status_t DeleteLongDescription();
|
||||||
status_t DeleteFileExtensions();
|
status_t DeleteFileExtensions();
|
||||||
status_t DeleteIcon(icon_size size);
|
status_t DeleteIcon(icon_size size);
|
||||||
status_t DeleteIconForType(const char *type, icon_size which);
|
status_t DeleteIconForType(const char *type, icon_size which);
|
||||||
status_t DeletePreferredApp(app_verb verb = B_OPEN);
|
status_t DeletePreferredApp(app_verb verb = B_OPEN);
|
||||||
status_t DeleteSnifferRule();
|
status_t DeleteSnifferRule();
|
||||||
status_t DeleteSupportedTypes(bool fullSync = true);
|
status_t DeleteSupportedTypes(bool fullSync = true);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BMimeType(const char *mimeType, const char *mimePath);
|
BMimeType(const char *mimeType, const char *mimePath);
|
||||||
// if mimePath is NULL, defaults to "/boot/home/config/settings/beos_mime/"
|
// if mimePath is NULL, defaults to "/boot/home/config/settings/beos_mime/"
|
||||||
|
|
||||||
friend class MimeTypeTest;
|
|
||||||
|
|
||||||
// Uncomment, when needed...
|
friend class MimeTypeTest;
|
||||||
|
// for testing only
|
||||||
|
|
||||||
friend class BAppFileInfo;
|
friend class BAppFileInfo;
|
||||||
// friend class BRoster;
|
friend class BPrivate::Storage::Mime::CreateAppMetaMimeThread;
|
||||||
// friend class TRosterApp;
|
|
||||||
// friend class TMimeWorker;
|
|
||||||
|
|
||||||
// friend status_t _update_mime_info_(const char *, int32);
|
virtual void _ReservedMimeType1();
|
||||||
// friend status_t _real_update_app_(BAppFileInfo *, const char *, bool);
|
virtual void _ReservedMimeType2();
|
||||||
|
virtual void _ReservedMimeType3();
|
||||||
|
|
||||||
// static void _set_local_dispatch_target_(BMessenger *, void (*)(BMessage *));
|
BMimeType &operator=(const BMimeType &);
|
||||||
// void _touch_();
|
BMimeType(const BMimeType &);
|
||||||
|
|
||||||
virtual void _ReservedMimeType1();
|
status_t GetSupportedTypes(BMessage* types);
|
||||||
virtual void _ReservedMimeType2();
|
status_t SetSupportedTypes(const BMessage* types, bool fullSync = true);
|
||||||
virtual void _ReservedMimeType3();
|
|
||||||
|
|
||||||
BMimeType &operator=(const BMimeType &);
|
|
||||||
BMimeType(const BMimeType &);
|
|
||||||
|
|
||||||
|
|
||||||
// void InitData(const char *type);
|
|
||||||
// void InitData(const char *type);
|
|
||||||
// status_t OpenFile(bool create_file = false, dev_t dev = -1) const;
|
|
||||||
// status_t CloseFile() const;
|
|
||||||
status_t GetSupportedTypes(BMessage *types);
|
|
||||||
status_t SetSupportedTypes(const BMessage *types, bool fullSync = true);
|
|
||||||
|
|
||||||
static status_t GetAssociatedTypes(const char *extension, BMessage *types);
|
static status_t GetAssociatedTypes(const char *extension, BMessage *types);
|
||||||
|
|
||||||
// void MimeChanged(int32 w, const char *type = NULL,
|
|
||||||
// bool large = true) const;
|
|
||||||
|
|
||||||
|
private:
|
||||||
char *fType;
|
char* fType;
|
||||||
BFile *fMeta;
|
BFile* fMeta;
|
||||||
void *_unused;
|
void* _unused;
|
||||||
entry_ref fRef;
|
entry_ref fRef;
|
||||||
int fWhere;
|
status_t fCStatus;
|
||||||
status_t fCStatus;
|
uint32 _reserved[4];
|
||||||
uint32 _reserved[3];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _MIME_TYPE_H
|
#endif // _MIME_TYPE_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,8 +46,9 @@ const char *B_APP_MIME_TYPE = B_ELF_APP_MIME_TYPE;
|
|||||||
/*! \brief Creates an uninitialized BMimeType object.
|
/*! \brief Creates an uninitialized BMimeType object.
|
||||||
*/
|
*/
|
||||||
BMimeType::BMimeType()
|
BMimeType::BMimeType()
|
||||||
: fType(NULL)
|
:
|
||||||
, fCStatus(B_NO_INIT)
|
fType(NULL),
|
||||||
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,8 +60,9 @@ BMimeType::BMimeType()
|
|||||||
\param mimeType The MIME string.
|
\param mimeType The MIME string.
|
||||||
*/
|
*/
|
||||||
BMimeType::BMimeType(const char *mimeType)
|
BMimeType::BMimeType(const char *mimeType)
|
||||||
: fType(NULL)
|
:
|
||||||
, fCStatus(B_NO_INIT)
|
fType(NULL),
|
||||||
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
SetTo(mimeType);
|
SetTo(mimeType);
|
||||||
}
|
}
|
||||||
@@ -102,7 +104,7 @@ BMimeType::SetTo(const char *mimeType)
|
|||||||
fCStatus = B_BAD_VALUE;
|
fCStatus = B_BAD_VALUE;
|
||||||
} else {
|
} else {
|
||||||
Unset();
|
Unset();
|
||||||
fType = new(std::nothrow) char[strlen(mimeType)+1];
|
fType = new(std::nothrow) char[strlen(mimeType) + 1];
|
||||||
if (fType) {
|
if (fType) {
|
||||||
strcpy(fType, mimeType);
|
strcpy(fType, mimeType);
|
||||||
fCStatus = B_OK;
|
fCStatus = B_OK;
|
||||||
@@ -119,8 +121,7 @@ BMimeType::SetTo(const char *mimeType)
|
|||||||
void
|
void
|
||||||
BMimeType::Unset()
|
BMimeType::Unset()
|
||||||
{
|
{
|
||||||
if (fType)
|
delete [] fType;
|
||||||
delete [] fType;
|
|
||||||
fType = NULL;
|
fType = NULL;
|
||||||
fCStatus = B_NO_INIT;
|
fCStatus = B_NO_INIT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,32 @@
|
|||||||
//----------------------------------------------------------------------
|
/*
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
* Copyright 2002-2006, Haiku.
|
||||||
// by the OpenBeOS license.
|
* Distributed under the terms of the MIT License.
|
||||||
//---------------------------------------------------------------------
|
*
|
||||||
/*!
|
* Authors:
|
||||||
\file CreateAppMetaMimeThread.h
|
* Tyler Dauwalder
|
||||||
CreateAppMetaMimeThread implementation
|
* Axel Dörfler, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "mime/CreateAppMetaMimeThread.h"
|
#include "mime/CreateAppMetaMimeThread.h"
|
||||||
|
#include "mime/database_support.h"
|
||||||
|
|
||||||
|
#include <AppFileInfo.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <fs_attr.h>
|
#include <fs_attr.h>
|
||||||
#include <MimeType.h>
|
#include <MimeType.h>
|
||||||
#include <mime/database_support.h>
|
|
||||||
#include <Node.h>
|
#include <Node.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
namespace Storage {
|
namespace Storage {
|
||||||
namespace Mime {
|
namespace Mime {
|
||||||
|
|
||||||
|
|
||||||
CreateAppMetaMimeThread::CreateAppMetaMimeThread(const char *name,
|
CreateAppMetaMimeThread::CreateAppMetaMimeThread(const char *name,
|
||||||
int32 priority, BMessenger managerMessenger, const entry_ref *root,
|
int32 priority, BMessenger managerMessenger, const entry_ref *root,
|
||||||
bool recursive, int32 force, BMessage *replyee)
|
bool recursive, int32 force, BMessage *replyee)
|
||||||
@@ -31,67 +35,107 @@ CreateAppMetaMimeThread::CreateAppMetaMimeThread(const char *name,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
CreateAppMetaMimeThread::DoMimeUpdate(const entry_ref *entry, bool *entryIsDir)
|
CreateAppMetaMimeThread::DoMimeUpdate(const entry_ref* ref, bool* _entryIsDir)
|
||||||
{
|
{
|
||||||
status_t err = entry ? B_OK : B_BAD_VALUE;
|
if (ref == NULL)
|
||||||
BNode node;
|
return B_BAD_VALUE;
|
||||||
BString sig;
|
|
||||||
BMimeType mime;
|
|
||||||
BPath path;
|
|
||||||
attr_info info;
|
|
||||||
BBitmap miniIcon(BRect(0,0,15,15), B_BITMAP_NO_SERVER_LINK, B_CMAP8);
|
|
||||||
BNode typeNode;
|
BNode typeNode;
|
||||||
|
|
||||||
if (!err)
|
BFile file;
|
||||||
err = node.SetTo(entry);
|
status_t status = file.SetTo(ref, B_READ_ONLY);
|
||||||
if (!err && entryIsDir)
|
if (status < B_OK)
|
||||||
*entryIsDir = node.IsDirectory();
|
return status;
|
||||||
|
|
||||||
|
BAppFileInfo appInfo(&file);
|
||||||
|
status = appInfo.InitCheck();
|
||||||
|
if (status < B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
|
BPath path;
|
||||||
|
status = path.SetTo(ref);
|
||||||
|
if (status < B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
// Read the app sig (which consequently keeps us from updating
|
// Read the app sig (which consequently keeps us from updating
|
||||||
// non-applications, since we get an error if the file has no
|
// non-applications, since we get an error if the file has no
|
||||||
// app sig)
|
// app sig)
|
||||||
if (!err)
|
BString signature;
|
||||||
err = node.ReadAttrString("BEOS:APP_SIG", &sig);
|
status = file.ReadAttrString("BEOS:APP_SIG", &signature);
|
||||||
if (!err) {
|
if (status < B_OK)
|
||||||
sig.ToLower();
|
return B_BAD_TYPE;
|
||||||
// Init our various objects
|
|
||||||
err = mime.SetTo(sig.String());
|
signature.ToLower();
|
||||||
if (!err && !mime.IsInstalled())
|
// Signatures and MIME types are case insensitive
|
||||||
mime.Install();
|
|
||||||
if (!err) {
|
// Init our various objects
|
||||||
char metaMimePath[B_PATH_NAME_LENGTH];
|
|
||||||
sprintf(metaMimePath, "%s/%s", kDatabaseDir.c_str(), sig.String());
|
BMimeType mime;
|
||||||
err = typeNode.SetTo(metaMimePath);
|
status = mime.SetTo(signature.String());
|
||||||
}
|
if (status < B_OK)
|
||||||
if (!err)
|
return status;
|
||||||
err = path.SetTo(entry);
|
|
||||||
|
if (!mime.IsInstalled())
|
||||||
// Preferred App
|
mime.Install();
|
||||||
if (!err && (fForce || typeNode.GetAttrInfo(kPreferredAppAttr, &info) == B_ENTRY_NOT_FOUND)) {
|
|
||||||
err = mime.SetPreferredApp(sig.String());
|
char metaMimePath[B_PATH_NAME_LENGTH];
|
||||||
}
|
sprintf(metaMimePath, "%s/%s", kDatabaseDir.c_str(), signature.String());
|
||||||
// Short Description
|
|
||||||
if (!err && (fForce || typeNode.GetAttrInfo(kShortDescriptionAttr, &info) == B_ENTRY_NOT_FOUND)) {
|
status = typeNode.SetTo(metaMimePath);
|
||||||
err = mime.SetShortDescription(path.Leaf());
|
if (status < B_OK)
|
||||||
}
|
return status;
|
||||||
// App Hint
|
|
||||||
if (!err && (fForce || typeNode.GetAttrInfo(kAppHintAttr, &info) == B_ENTRY_NOT_FOUND)) {
|
// Preferred App
|
||||||
err = mime.SetAppHint(entry);
|
attr_info info;
|
||||||
}
|
if (status == B_OK && (fForce || typeNode.GetAttrInfo(kPreferredAppAttr, &info) != B_OK)) {
|
||||||
// Mini icon
|
status = mime.SetPreferredApp(signature.String());
|
||||||
if (!err && (fForce || typeNode.GetAttrInfo(kMiniIconAttr, &info) == B_ENTRY_NOT_FOUND)) {
|
|
||||||
err = node.GetAttrInfo("BEOS:M:STD_ICON", &info);
|
|
||||||
if (!err)
|
|
||||||
err = info.size == 16*16 ? B_OK : B_BAD_VALUE;
|
|
||||||
if (!err) {
|
|
||||||
ssize_t bytes = node.ReadAttr("BEOS:M:STD_ICON", kMiniIconType, 0, miniIcon.Bits(), 16*16);
|
|
||||||
err = bytes == 16*16 ? (status_t)B_OK : (status_t)B_FILE_ERROR;
|
|
||||||
}
|
|
||||||
if (!err)
|
|
||||||
err = mime.SetIcon(&miniIcon, B_MINI_ICON);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return err;
|
// Short Description (name of the application)
|
||||||
|
if (status == B_OK && (fForce || typeNode.GetAttrInfo(kShortDescriptionAttr, &info) != B_OK)) {
|
||||||
|
status = mime.SetShortDescription(path.Leaf());
|
||||||
|
}
|
||||||
|
// App Hint
|
||||||
|
if (status == B_OK && (fForce || typeNode.GetAttrInfo(kAppHintAttr, &info) != B_OK)) {
|
||||||
|
status = mime.SetAppHint(ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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(&miniIcon, B_LARGE_ICON) == B_OK)
|
||||||
|
status = mime.SetIcon(&miniIcon, B_LARGE_ICON);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Supported Types
|
||||||
|
BMessage supportedTypes;
|
||||||
|
if (status == B_OK && (fForce || typeNode.GetAttrInfo(kSupportedTypesAttr, &info) != B_OK)) {
|
||||||
|
if (appInfo.GetSupportedTypes(&supportedTypes) == B_OK)
|
||||||
|
status = mime.SetSupportedTypes(&supportedTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Icons for supported types
|
||||||
|
const char* type;
|
||||||
|
for (int32 i = 0; supportedTypes.FindString("types", i, &type) == B_OK; i++) {
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == B_OK && _entryIsDir != NULL)
|
||||||
|
*_entryIsDir = file.IsDirectory();
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Mime
|
} // namespace Mime
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ SupportingApps::BuildSupportingAppsTable()
|
|||||||
for (int i = 0; msg.FindString(kTypesField, i, &type) == B_OK; i++) {
|
for (int i = 0; msg.FindString(kTypesField, i, &type) == B_OK; i++) {
|
||||||
supportedTypes.insert(type);
|
supportedTypes.insert(type);
|
||||||
AddSupportingApp(type, appSig);
|
AddSupportingApp(type, appSig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user