зеркало из https://github.com/mozilla/pjs.git
Bug #38374 --> add application and user preferred handle action to mime info.
I'm going to be storing this information in the helper app code. r=valeski
This commit is contained in:
Родитель
a778fbd165
Коммит
7db93f5a1e
|
@ -31,17 +31,9 @@
|
|||
#include "nsISupports.idl"
|
||||
#include "nsIURI.idl"
|
||||
|
||||
%{C++
|
||||
#define NS_MIMEINFO_CID \
|
||||
{ /* {95df6583-0001-11d4-a12b-a66ef662f0bc} */ \
|
||||
0x95df6583, \
|
||||
0x0001, \
|
||||
0x11d4, \
|
||||
{ 0xa1, 0x2b, 0xa6, 0x6e, 0xf6, 0x62, 0xf0, 0xbc } \
|
||||
}
|
||||
#define NS_MIMEINFO_PROGID \
|
||||
"component://netscape/mime-info"
|
||||
%}
|
||||
interface nsIFile;
|
||||
|
||||
typedef long nsMIMEInfoHandleAction;
|
||||
|
||||
[scriptable, uuid(6A57EAE0-2FE8-11d3-A164-0050041CAF44)]
|
||||
interface nsIMIMEInfo : nsISupports {
|
||||
|
@ -111,4 +103,36 @@ interface nsIMIMEInfo : nsISupports {
|
|||
* @returns TRUE if the two are considered equal
|
||||
*/
|
||||
boolean Equals(in nsIMIMEInfo aMIMEInfo);
|
||||
|
||||
/* Returns a nsIFile that points to the application the user has said
|
||||
* they want associated with this content type. This is not always guarunteed
|
||||
* to be set!!
|
||||
*/
|
||||
attribute nsIFile preferredApplicationHandler;
|
||||
|
||||
/* a pretty name description of the associated application */
|
||||
attribute wstring applicationDescription;
|
||||
|
||||
const long saveToDisk = 0;
|
||||
const long alwaysAsk = 1;
|
||||
const long useHelperApp = 2;
|
||||
const long handleInternally = 3;
|
||||
|
||||
/* preferredAction is how the user specified they would like to handle
|
||||
* this content type: save to disk, use specified helper app or always ask.
|
||||
* do we need a separate flag for handle internally?
|
||||
*/
|
||||
attribute nsMIMEInfoHandleAction preferredAction;
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define NS_MIMEINFO_CID \
|
||||
{ /* {95df6583-0001-11d4-a12b-a66ef662f0bc} */ \
|
||||
0x95df6583, \
|
||||
0x0001, \
|
||||
0x11d4, \
|
||||
{ 0xa1, 0x2b, 0xa6, 0x6e, 0xf6, 0x62, 0xf0, 0xbc } \
|
||||
}
|
||||
|
||||
#define NS_MIMEINFO_PROGID "component://netscape/mime-info"
|
||||
%}
|
||||
|
|
|
@ -29,6 +29,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsMIMEInfoImpl, nsIMIMEInfo);
|
|||
// nsMIMEInfoImpl methods
|
||||
nsMIMEInfoImpl::nsMIMEInfoImpl() {
|
||||
NS_INIT_REFCNT();
|
||||
mPreferredAction = 0;
|
||||
}
|
||||
|
||||
nsMIMEInfoImpl::nsMIMEInfoImpl(const char *aMIMEType) :mMIMEType( aMIMEType ){
|
||||
|
@ -186,3 +187,41 @@ NS_IMETHODIMP nsMIMEInfoImpl::SetFileExtensions( const char* aExtensions )
|
|||
mExtensions.AppendCString( extList );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMIMEInfoImpl::GetApplicationDescription(PRUnichar ** aApplicationDescription)
|
||||
{
|
||||
*aApplicationDescription = mPreferredAppDescription.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMIMEInfoImpl::SetApplicationDescription(const PRUnichar * aApplicationDescription)
|
||||
{
|
||||
mPreferredAppDescription = aApplicationDescription;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMIMEInfoImpl::GetPreferredApplicationHandler(nsIFile ** aPreferredAppHandler)
|
||||
{
|
||||
*aPreferredAppHandler = mPreferredApplication;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMIMEInfoImpl::SetPreferredApplicationHandler(nsIFile * aPreferredAppHandler)
|
||||
{
|
||||
mPreferredApplication = aPreferredAppHandler;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsMIMEInfoHandleAction mPreferredAction; // preferred action to associate with this type
|
||||
|
||||
NS_IMETHODIMP nsMIMEInfoImpl::GetPreferredAction(nsMIMEInfoHandleAction * aPreferredAction)
|
||||
{
|
||||
*aPreferredAction = mPreferredAction;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMIMEInfoImpl::SetPreferredAction(nsMIMEInfoHandleAction aPreferredAction)
|
||||
{
|
||||
mPreferredAction = aPreferredAction;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -26,10 +26,11 @@
|
|||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsMIMEInfoImpl : public nsIMIMEInfo {
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMIMEINFO
|
||||
|
||||
|
@ -46,7 +47,9 @@ class nsMIMEInfoImpl : public nsIMIMEInfo {
|
|||
PRUint32 mMacType, mMacCreator; // Mac file type and creator
|
||||
protected:
|
||||
nsCString mMIMEType;
|
||||
|
||||
nsCOMPtr<nsIFile> mPreferredApplication; // preferred application associated with this type.
|
||||
nsMIMEInfoHandleAction mPreferredAction; // preferred action to associate with this type
|
||||
nsString mPreferredAppDescription;
|
||||
};
|
||||
|
||||
#endif //__nsmimeinfoimpl_h___
|
||||
|
|
|
@ -29,6 +29,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsMIMEInfoImpl, nsIMIMEInfo);
|
|||
// nsMIMEInfoImpl methods
|
||||
nsMIMEInfoImpl::nsMIMEInfoImpl() {
|
||||
NS_INIT_REFCNT();
|
||||
mPreferredAction = 0;
|
||||
}
|
||||
|
||||
nsMIMEInfoImpl::nsMIMEInfoImpl(const char *aMIMEType) :mMIMEType( aMIMEType ){
|
||||
|
@ -186,3 +187,41 @@ NS_IMETHODIMP nsMIMEInfoImpl::SetFileExtensions( const char* aExtensions )
|
|||
mExtensions.AppendCString( extList );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMIMEInfoImpl::GetApplicationDescription(PRUnichar ** aApplicationDescription)
|
||||
{
|
||||
*aApplicationDescription = mPreferredAppDescription.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMIMEInfoImpl::SetApplicationDescription(const PRUnichar * aApplicationDescription)
|
||||
{
|
||||
mPreferredAppDescription = aApplicationDescription;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMIMEInfoImpl::GetPreferredApplicationHandler(nsIFile ** aPreferredAppHandler)
|
||||
{
|
||||
*aPreferredAppHandler = mPreferredApplication;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMIMEInfoImpl::SetPreferredApplicationHandler(nsIFile * aPreferredAppHandler)
|
||||
{
|
||||
mPreferredApplication = aPreferredAppHandler;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsMIMEInfoHandleAction mPreferredAction; // preferred action to associate with this type
|
||||
|
||||
NS_IMETHODIMP nsMIMEInfoImpl::GetPreferredAction(nsMIMEInfoHandleAction * aPreferredAction)
|
||||
{
|
||||
*aPreferredAction = mPreferredAction;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMIMEInfoImpl::SetPreferredAction(nsMIMEInfoHandleAction aPreferredAction)
|
||||
{
|
||||
mPreferredAction = aPreferredAction;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -26,10 +26,11 @@
|
|||
#include "nsIAtom.h"
|
||||
#include "nsString.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsMIMEInfoImpl : public nsIMIMEInfo {
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMIMEINFO
|
||||
|
||||
|
@ -46,7 +47,9 @@ class nsMIMEInfoImpl : public nsIMIMEInfo {
|
|||
PRUint32 mMacType, mMacCreator; // Mac file type and creator
|
||||
protected:
|
||||
nsCString mMIMEType;
|
||||
|
||||
nsCOMPtr<nsIFile> mPreferredApplication; // preferred application associated with this type.
|
||||
nsMIMEInfoHandleAction mPreferredAction; // preferred action to associate with this type
|
||||
nsString mPreferredAppDescription;
|
||||
};
|
||||
|
||||
#endif //__nsmimeinfoimpl_h___
|
||||
|
|
Загрузка…
Ссылка в новой задаче