2002-07-21 22:40:07 +00:00
|
|
|
// MIMEManager.cpp
|
|
|
|
|
2002-08-19 08:42:14 +00:00
|
|
|
#include <Bitmap.h>
|
|
|
|
#include <ClassInfo.h>
|
2002-07-21 22:40:07 +00:00
|
|
|
#include <Message.h>
|
2002-08-16 22:08:49 +00:00
|
|
|
#include <RegistrarDefs.h>
|
2002-09-24 05:36:03 +00:00
|
|
|
#include <String.h>
|
2002-08-19 08:42:14 +00:00
|
|
|
#include <TypeConstants.h>
|
|
|
|
|
2002-08-16 22:08:49 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string>
|
2002-07-21 22:40:07 +00:00
|
|
|
|
|
|
|
#include "MIMEManager.h"
|
|
|
|
|
2002-07-28 13:37:26 +00:00
|
|
|
/*!
|
|
|
|
\class MIMEManager
|
2002-08-19 08:42:14 +00:00
|
|
|
\brief MIMEManager handles communication between BMimeType and the system-wide
|
|
|
|
MimeDatabase object for BMimeType's write and non-atomic read functions.
|
2002-07-28 13:37:26 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2002-07-21 22:40:07 +00:00
|
|
|
// constructor
|
2002-07-28 13:37:26 +00:00
|
|
|
/*! \brief Creates and initializes a MIMEManager.
|
|
|
|
*/
|
2002-07-21 22:40:07 +00:00
|
|
|
MIMEManager::MIMEManager()
|
|
|
|
: BLooper("main_mime")
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
, fDatabase()
|
2002-07-21 22:40:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// destructor
|
2002-07-28 13:37:26 +00:00
|
|
|
/*! \brief Frees all resources associate with this object.
|
|
|
|
*/
|
2002-07-21 22:40:07 +00:00
|
|
|
MIMEManager::~MIMEManager()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// MessageReceived
|
2002-07-28 13:37:26 +00:00
|
|
|
/*! \brief Overrides the super class version to handle the MIME specific
|
|
|
|
messages.
|
|
|
|
\param message The message to be handled
|
|
|
|
*/
|
2002-07-21 22:40:07 +00:00
|
|
|
void
|
|
|
|
MIMEManager::MessageReceived(BMessage *message)
|
|
|
|
{
|
2002-08-16 22:08:49 +00:00
|
|
|
BMessage reply;
|
|
|
|
status_t err;
|
|
|
|
|
2002-07-21 22:40:07 +00:00
|
|
|
switch (message->what) {
|
2002-08-16 22:08:49 +00:00
|
|
|
case B_REG_MIME_SET_PARAM:
|
2002-08-19 08:42:14 +00:00
|
|
|
HandleSetParam(message);
|
2002-08-20 09:37:04 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case B_REG_MIME_DELETE_PARAM:
|
|
|
|
HandleDeleteParam(message);
|
|
|
|
break;
|
2002-08-16 22:08:49 +00:00
|
|
|
|
|
|
|
case B_REG_MIME_START_WATCHING:
|
|
|
|
case B_REG_MIME_STOP_WATCHING:
|
|
|
|
{
|
|
|
|
BMessenger messenger;
|
|
|
|
err = message->FindMessenger("target", &messenger);
|
|
|
|
if (!err) {
|
|
|
|
err = message->what == B_REG_MIME_START_WATCHING
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
? fDatabase.StartWatching(messenger)
|
|
|
|
: fDatabase.StopWatching(messenger);
|
2002-08-16 22:08:49 +00:00
|
|
|
}
|
|
|
|
|
2002-08-19 08:42:14 +00:00
|
|
|
reply.what = B_REG_RESULT;
|
2002-08-16 22:08:49 +00:00
|
|
|
reply.AddInt32("result", err);
|
|
|
|
message->SendReply(&reply, this);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case B_REG_MIME_INSTALL:
|
|
|
|
case B_REG_MIME_DELETE:
|
|
|
|
{
|
|
|
|
const char *type;
|
|
|
|
err = message->FindString("type", &type);
|
|
|
|
if (!err)
|
|
|
|
err = message->what == B_REG_MIME_INSTALL
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
? fDatabase.Install(type)
|
|
|
|
: fDatabase.Delete(type);
|
|
|
|
|
2002-08-19 08:42:14 +00:00
|
|
|
reply.what = B_REG_RESULT;
|
2002-08-16 22:08:49 +00:00
|
|
|
reply.AddInt32("result", err);
|
|
|
|
message->SendReply(&reply, this);
|
|
|
|
break;
|
|
|
|
}
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
|
|
|
|
case B_REG_MIME_GET_INSTALLED_TYPES:
|
|
|
|
{
|
|
|
|
const char *supertype;
|
|
|
|
err = message->FindString("supertype", &supertype);
|
|
|
|
if (err == B_NAME_NOT_FOUND)
|
2002-09-09 08:12:03 +00:00
|
|
|
err = fDatabase.GetInstalledTypes(&reply);
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
else if (!err)
|
2002-09-09 08:12:03 +00:00
|
|
|
err = fDatabase.GetInstalledTypes(supertype, &reply);
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
|
|
|
|
reply.what = B_REG_RESULT;
|
|
|
|
reply.AddInt32("result", err);
|
|
|
|
message->SendReply(&reply, this);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case B_REG_MIME_GET_INSTALLED_SUPERTYPES:
|
|
|
|
{
|
2002-09-09 08:12:03 +00:00
|
|
|
err = fDatabase.GetInstalledSupertypes(&reply);
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
|
|
|
|
reply.what = B_REG_RESULT;
|
|
|
|
reply.AddInt32("result", err);
|
|
|
|
message->SendReply(&reply, this);
|
|
|
|
break;
|
|
|
|
}
|
2002-08-25 22:51:50 +00:00
|
|
|
|
2002-08-28 23:59:57 +00:00
|
|
|
case B_REG_MIME_GET_SUPPORTING_APPS:
|
2002-08-25 22:51:50 +00:00
|
|
|
{
|
2002-08-28 23:59:57 +00:00
|
|
|
const char *type;
|
|
|
|
err = message->FindString("type", &type);
|
|
|
|
if (!err)
|
2002-09-09 08:12:03 +00:00
|
|
|
err = fDatabase.GetSupportingApps(type, &reply);
|
2002-08-28 23:59:57 +00:00
|
|
|
|
|
|
|
reply.what = B_REG_RESULT;
|
|
|
|
reply.AddInt32("result", err);
|
2002-09-24 05:36:03 +00:00
|
|
|
message->SendReply(&reply, this);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case B_REG_MIME_GET_ASSOCIATED_TYPES:
|
|
|
|
{
|
|
|
|
const char *extension;
|
|
|
|
err = message->FindString("extension", &extension);
|
|
|
|
if (!err)
|
|
|
|
err = fDatabase.GetAssociatedTypes(extension, &reply);
|
|
|
|
|
|
|
|
reply.what = B_REG_RESULT;
|
|
|
|
reply.AddInt32("result", err);
|
|
|
|
message->SendReply(&reply, this);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case B_REG_MIME_SNIFF:
|
|
|
|
{
|
|
|
|
BString str;
|
|
|
|
entry_ref ref;
|
|
|
|
const char *filename;
|
|
|
|
err = message->FindString("filename", &filename);
|
|
|
|
if (!err)
|
|
|
|
err = fDatabase.GuessMimeType(filename, &str);
|
|
|
|
else if (err == B_NAME_NOT_FOUND) {
|
|
|
|
err = message->FindRef("file ref", &ref);
|
|
|
|
if (!err)
|
|
|
|
err = fDatabase.GuessMimeType(&ref, &str);
|
|
|
|
else if (err == B_NAME_NOT_FOUND) {
|
|
|
|
// err = message->FindData("file ref", &ref);
|
|
|
|
// if (!err)
|
|
|
|
// err = fDatabase.GuessMimeType(data, length, &str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!err)
|
|
|
|
err = reply.AddString("mime type", str);
|
|
|
|
|
|
|
|
reply.what = B_REG_RESULT;
|
|
|
|
reply.AddInt32("result", err);
|
|
|
|
message->SendReply(&reply, this);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case B_REG_MIME_UPDATE_MIME_INFO_ASYNC:
|
|
|
|
{
|
|
|
|
entry_ref ref;
|
|
|
|
bool recursive, force;
|
|
|
|
err = message->FindRef("entry", &ref);
|
|
|
|
if (!err)
|
|
|
|
err = message->FindBool("recursive", &recursive);
|
|
|
|
if (!err)
|
|
|
|
err = message->FindBool("force", &force);
|
|
|
|
if (!err)
|
|
|
|
err = fDatabase.UpdateMimeInfoAsync(&ref, recursive, force);
|
|
|
|
|
|
|
|
reply.what = B_REG_RESULT;
|
|
|
|
reply.AddInt32("result", err);
|
|
|
|
message->SendReply(&reply, this);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case B_REG_MIME_ASYNC_THREAD_FINISHED:
|
|
|
|
{
|
|
|
|
thread_id id;
|
|
|
|
err = message->FindInt32("thread id", &id);
|
|
|
|
if (!err)
|
|
|
|
err = fDatabase.CleanupAfterAsyncThread(id);
|
|
|
|
|
|
|
|
reply.what = B_REG_RESULT;
|
|
|
|
reply.AddInt32("result", err);
|
2002-08-28 23:59:57 +00:00
|
|
|
message->SendReply(&reply, this);
|
2002-08-25 22:51:50 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-08-28 23:59:57 +00:00
|
|
|
|
2002-07-21 22:40:07 +00:00
|
|
|
default:
|
2002-08-25 22:51:50 +00:00
|
|
|
printf("MIMEMan: msg->what == %.4s\n", (char*)&(message->what));
|
2002-07-21 22:40:07 +00:00
|
|
|
BLooper::MessageReceived(message);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-20 09:37:04 +00:00
|
|
|
// HandleSetParam
|
2002-08-19 08:42:14 +00:00
|
|
|
//! Handles all B_REG_MIME_SET_PARAM messages
|
|
|
|
void
|
|
|
|
MIMEManager::HandleSetParam(BMessage *message)
|
|
|
|
{
|
|
|
|
status_t err;
|
|
|
|
int32 which;
|
|
|
|
const char *type;
|
|
|
|
|
|
|
|
err = message->FindString("type", &type);
|
|
|
|
if (!err)
|
|
|
|
err = message->FindInt32("which", &which);
|
|
|
|
if (!err) {
|
|
|
|
switch (which) {
|
|
|
|
case B_REG_MIME_APP_HINT:
|
|
|
|
{
|
|
|
|
entry_ref ref;
|
|
|
|
err = message->FindRef("app hint", &ref);
|
|
|
|
if (!err)
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.SetAppHint(type, &ref);
|
2002-08-19 08:42:14 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-08-21 10:55:20 +00:00
|
|
|
case B_REG_MIME_ATTR_INFO:
|
|
|
|
{
|
|
|
|
BMessage info;
|
|
|
|
err = message->FindMessage("attr info", &info);
|
|
|
|
if (!err)
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.SetAttrInfo(type, &info);
|
2002-08-21 10:55:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-08-19 08:42:14 +00:00
|
|
|
case B_REG_MIME_DESCRIPTION:
|
|
|
|
{
|
|
|
|
bool isLong;
|
|
|
|
const char *description;
|
|
|
|
err = message->FindBool("long", &isLong);
|
|
|
|
if (!err)
|
|
|
|
err = message->FindString("description", &description);
|
|
|
|
if (!err)
|
|
|
|
err = (isLong
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
? fDatabase.SetLongDescription(type, description)
|
|
|
|
: fDatabase.SetShortDescription(type, description));
|
2002-08-19 08:42:14 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-08-21 10:55:20 +00:00
|
|
|
case B_REG_MIME_FILE_EXTENSIONS:
|
2002-08-19 08:42:14 +00:00
|
|
|
{
|
2002-08-21 10:55:20 +00:00
|
|
|
BMessage extensions;
|
|
|
|
err = message->FindMessage("extensions", &extensions);
|
2002-08-19 08:42:14 +00:00
|
|
|
if (!err)
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.SetFileExtensions(type, &extensions);
|
2002-08-19 08:42:14 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-08-21 10:55:20 +00:00
|
|
|
|
2002-08-19 08:42:14 +00:00
|
|
|
case B_REG_MIME_ICON:
|
2002-08-20 09:37:04 +00:00
|
|
|
case B_REG_MIME_ICON_FOR_TYPE:
|
2002-08-19 08:42:14 +00:00
|
|
|
{
|
|
|
|
const void *data;
|
|
|
|
ssize_t dataSize;
|
|
|
|
int32 size;
|
|
|
|
err = message->FindData("icon data", B_RAW_TYPE, &data, &dataSize);
|
|
|
|
if (!err)
|
|
|
|
err = message->FindInt32("icon size", &size);
|
2002-08-20 09:37:04 +00:00
|
|
|
if (which == B_REG_MIME_ICON_FOR_TYPE) {
|
|
|
|
const char *fileType;
|
|
|
|
if (!err)
|
|
|
|
err = message->FindString("file type", &fileType);
|
|
|
|
if (!err)
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.SetIconForType(type, fileType, data,
|
2002-08-20 09:37:04 +00:00
|
|
|
dataSize, (icon_size)size);
|
|
|
|
} else {
|
|
|
|
if (!err)
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.SetIcon(type, data, dataSize,
|
2002-08-20 09:37:04 +00:00
|
|
|
(icon_size)size);
|
|
|
|
}
|
2002-08-19 08:42:14 +00:00
|
|
|
break;
|
|
|
|
// End temporary fix code
|
2002-08-21 10:55:20 +00:00
|
|
|
}
|
2002-08-19 08:42:14 +00:00
|
|
|
|
2002-08-21 10:55:20 +00:00
|
|
|
case B_REG_MIME_PREFERRED_APP:
|
|
|
|
{
|
|
|
|
const char *signature;
|
|
|
|
int32 verb;
|
|
|
|
err = message->FindString("signature", &signature);
|
2002-08-19 08:42:14 +00:00
|
|
|
if (!err)
|
2002-08-21 10:55:20 +00:00
|
|
|
err = message->FindInt32("app verb", &verb);
|
|
|
|
if (!err)
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.SetPreferredApp(type, signature, (app_verb)verb);
|
2002-08-19 08:42:14 +00:00
|
|
|
break;
|
2002-09-09 08:12:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case B_REG_MIME_SNIFFER_RULE:
|
|
|
|
{
|
|
|
|
const char *rule;
|
|
|
|
err = message->FindString("sniffer rule", &rule);
|
|
|
|
if (!err)
|
|
|
|
err = fDatabase.SetSnifferRule(type, rule);
|
|
|
|
break;
|
|
|
|
}
|
2002-08-19 08:42:14 +00:00
|
|
|
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
case B_REG_MIME_SUPPORTED_TYPES:
|
|
|
|
{
|
|
|
|
BMessage types;
|
2002-08-28 23:59:57 +00:00
|
|
|
bool fullSync = true;
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = message->FindMessage("types", &types);
|
|
|
|
if (!err)
|
2002-08-28 23:59:57 +00:00
|
|
|
err = message->FindBool("full sync", &fullSync);
|
|
|
|
if (!err)
|
|
|
|
err = fDatabase.SetSupportedTypes(type, &types, fullSync);
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-08-19 08:42:14 +00:00
|
|
|
default:
|
|
|
|
err = B_BAD_VALUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BMessage reply(B_REG_RESULT);
|
|
|
|
reply.AddInt32("result", err);
|
|
|
|
message->SendReply(&reply, this);
|
2002-08-20 09:37:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// HandleSetParam
|
|
|
|
//! Handles all B_REG_MIME_SET_PARAM messages
|
|
|
|
void
|
|
|
|
MIMEManager::HandleDeleteParam(BMessage *message)
|
|
|
|
{
|
|
|
|
// using BPrivate::MimeDatabase;
|
|
|
|
|
|
|
|
status_t err;
|
|
|
|
int32 which;
|
|
|
|
const char *type;
|
|
|
|
|
|
|
|
err = message->FindString("type", &type);
|
|
|
|
if (!err)
|
|
|
|
err = message->FindInt32("which", &which);
|
|
|
|
if (!err) {
|
|
|
|
switch (which) {
|
|
|
|
case B_REG_MIME_APP_HINT:
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.DeleteAppHint(type);
|
2002-08-20 09:37:04 +00:00
|
|
|
break;
|
|
|
|
|
2002-08-21 10:55:20 +00:00
|
|
|
case B_REG_MIME_ATTR_INFO:
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.DeleteAttrInfo(type);
|
2002-08-21 10:55:20 +00:00
|
|
|
break;
|
|
|
|
|
2002-08-20 09:37:04 +00:00
|
|
|
case B_REG_MIME_DESCRIPTION:
|
|
|
|
{
|
|
|
|
bool isLong;
|
|
|
|
err = message->FindBool("long", &isLong);
|
|
|
|
if (!err)
|
2002-08-21 10:55:20 +00:00
|
|
|
err = isLong
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
? fDatabase.DeleteLongDescription(type)
|
|
|
|
: fDatabase.DeleteShortDescription(type);
|
2002-08-20 09:37:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-08-21 10:55:20 +00:00
|
|
|
case B_REG_MIME_FILE_EXTENSIONS:
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.DeleteFileExtensions(type);
|
2002-08-21 10:55:20 +00:00
|
|
|
break;
|
|
|
|
|
2002-08-20 09:37:04 +00:00
|
|
|
case B_REG_MIME_ICON:
|
|
|
|
case B_REG_MIME_ICON_FOR_TYPE:
|
|
|
|
{
|
|
|
|
int32 size;
|
|
|
|
err = message->FindInt32("icon size", &size);
|
|
|
|
if (which == B_REG_MIME_ICON_FOR_TYPE) {
|
|
|
|
const char *fileType;
|
|
|
|
if (!err)
|
|
|
|
err = message->FindString("file type", &fileType);
|
2002-08-21 10:55:20 +00:00
|
|
|
if (!err)
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.DeleteIconForType(type, fileType, (icon_size)size);
|
2002-08-20 09:37:04 +00:00
|
|
|
} else {
|
2002-08-21 10:55:20 +00:00
|
|
|
if (!err)
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.DeleteIcon(type, (icon_size)size);
|
2002-08-20 09:37:04 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-08-21 10:55:20 +00:00
|
|
|
case B_REG_MIME_PREFERRED_APP:
|
|
|
|
{
|
|
|
|
int32 verb;
|
|
|
|
err = message->FindInt32("app verb", &verb);
|
|
|
|
if (!err)
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.DeletePreferredApp(type, (app_verb)verb);
|
2002-08-21 10:55:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case B_REG_MIME_SNIFFER_RULE:
|
After implementing the BMimeType::GetInstalled[Super]Types()
functionality, it became apparent that some restructuring was
needed if I wanted to keep things clean and managble.
storage/MimeDatabase.{h,cpp} have been broken into:
storage/mime/database_support.{h,cpp}
+ MIME database constants
+ high-level database access functions like open_type(),
read_mime_attr(), etc.
storage/mime/database_access.{h,cpp}
+ atomic read functions
+ is_installed()
+ get_icon_data()
storage/mime/Database.{h,cpp}
+ Mime::Database class, which is responsible for all write,
non-atomic read, and mime monitor functionality.
storage/mime/InstalledTypes.{h,cpp}
+ Helper class for Mime::Database::GetInstalled[Super]Types()
storage/mime/Supertype.{h,cpp}
+ Helper class for Mime::InstalledTypes
I haven't merged my intial, somewhat cludgy GetInstalled[Super]Types
implementation into the new setup yet. That comes next, and it ought
to be a more graceful implementation now.
I also implemented BMimeType::Get/SetSupportingTypes(), though
they haven't been tested yet (sorry).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@862 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-24 05:04:02 +00:00
|
|
|
err = fDatabase.DeleteSnifferRule(type);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case B_REG_MIME_SUPPORTED_TYPES:
|
2002-09-09 08:12:03 +00:00
|
|
|
{
|
|
|
|
bool fullSync;
|
|
|
|
err = message->FindBool("full sync", &fullSync);
|
|
|
|
if (!err)
|
|
|
|
err = fDatabase.DeleteSupportedTypes(type, fullSync);
|
|
|
|
break;
|
|
|
|
}
|
2002-08-21 10:55:20 +00:00
|
|
|
|
2002-08-20 09:37:04 +00:00
|
|
|
default:
|
|
|
|
err = B_BAD_VALUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BMessage reply(B_REG_RESULT);
|
|
|
|
reply.AddInt32("result", err);
|
|
|
|
message->SendReply(&reply, this);
|
|
|
|
}
|
|
|
|
|