Fix Feed Entry mimetype installation

This commit is contained in:
Jaidyn Ann 2020-11-12 19:53:57 -06:00
parent b8e20ea38b
commit f21065750d
2 changed files with 16 additions and 22 deletions

View File

@ -1,4 +1,5 @@
// borrowed significantly from mailserver. thanks! <3 // borrowed significantly from mailserver. thanks! <3
#include <Application.h>
#include <DateTime.h> #include <DateTime.h>
#include <Message.h> #include <Message.h>
#include <MimeType.h> #include <MimeType.h>
@ -9,26 +10,19 @@ feedMimeType ( )
{ {
BMessage info; BMessage info;
BMimeType mime( "text/x-feed-entry" ); BMimeType mime( "text/x-feed-entry" );
mime.GetAttrInfo( &info );
if ( mime.InitCheck() != B_OK ) { mime.SetShortDescription( "Feed Entry" );
return false; mime.SetLongDescription( "Atom/RSS Feed Entry" );
}
if ( !mime.IsInstalled() ) {
mime.Delete();
mime.Install();
addAttribute( info, "FEED:name", "Name" ); addAttribute( info, "FEED:name", "Name" );
addAttribute( info, "FEED:description", "Description" ); addAttribute( info, "FEED:description", "Description" );
addAttribute( info, "META:url", "URL" ); addAttribute( info, "META:url", "URL" );
addAttribute( info, "FEED:source", "Source" ); addAttribute( info, "FEED:source", "Source" );
addAttribute( info, "FEED:when", "When", B_TIME_TYPE, true, false, 150 ); addAttribute( info, "FEED:when", "When", B_TIME_TYPE, 150 );
mime.SetAttrInfo( &info ); mime.SetAttrInfo( &info );
mime.SetShortDescription("Feed Entry");
mime.SetLongDescription("RSS/Atom Feed Entry");
}
return true; return true;
} }
@ -36,13 +30,14 @@ feedMimeType ( )
static void static void
addAttribute addAttribute
( BMessage& msg, const char* name, const char* publicName, int32 type, bool viewable, bool editable, ( BMessage& msg, const char* name, const char* publicName, int32 type, int32 width )
int32 width)
{ {
msg.AddString( "attr:name", name ); msg.AddString( "attr:name", name );
msg.AddString( "attr:public_name", publicName ); msg.AddString( "attr:public_name", publicName );
msg.AddInt32( "attr:type", type ); msg.AddInt32( "attr:type", type );
msg.AddBool( "attr:viewable", viewable );
msg.AddBool( "attr:editable", editable );
msg.AddInt32( "attr:width", width ); msg.AddInt32( "attr:width", width );
msg.AddInt32( "attr:alignment", B_ALIGN_LEFT );
msg.AddBool( "attr:extra", false );
msg.AddBool( "attr:viewable", true );
msg.AddBool( "attr:editable", false );
} }

View File

@ -7,8 +7,7 @@
bool feedMimeType ( ); bool feedMimeType ( );
static void addAttribute static void addAttribute
( BMessage&, const char*, const char*, int32 type = B_STRING_TYPE, bool viewable = true, ( BMessage&, const char*, const char*, int32 type = B_STRING_TYPE, int32 width = 200);
bool editable = false, int32 width = 200);
#endif #endif