Bug #43583 --> new state for using system default. Add a separate boolean

for asking the user before handling.
r=alecf
This commit is contained in:
mscott%netscape.com 2000-07-11 23:11:59 +00:00
Родитель 1c72f33a9a
Коммит 3ddf6e8910
5 изменённых файлов: 48 добавлений и 14 удалений

Просмотреть файл

@ -117,12 +117,18 @@ interface nsIMIMEInfo : nsISupports {
const long alwaysAsk = 1;
const long useHelperApp = 2;
const long handleInternally = 3;
const long useSystemDefault = 4;
/* 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?
* this content type: save to disk, use specified helper app, use OS
* default handler or handle using navigator.
*/
attribute nsMIMEInfoHandleAction preferredAction;
/* alwaysAskBeforeHandling: if true, we should always give the user a dialog
* asking how to dispose of this content.
*/
attribute boolean alwaysAskBeforeHandling;
};
%{C++

Просмотреть файл

@ -29,11 +29,14 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsMIMEInfoImpl, nsIMIMEInfo);
// nsMIMEInfoImpl methods
nsMIMEInfoImpl::nsMIMEInfoImpl() {
NS_INIT_REFCNT();
mPreferredAction = 0;
mPreferredAction = nsIMIMEInfo::saveToDisk;
mAlwaysAskBeforeHandling = PR_TRUE;
}
nsMIMEInfoImpl::nsMIMEInfoImpl(const char *aMIMEType) :mMIMEType( aMIMEType ){
NS_INIT_REFCNT();
mPreferredAction = nsIMIMEInfo::saveToDisk;
mAlwaysAskBeforeHandling = PR_TRUE;
}
PRUint32
@ -213,8 +216,6 @@ NS_IMETHODIMP nsMIMEInfoImpl::SetPreferredApplicationHandler(nsIFile * aPreferre
return NS_OK;
}
nsMIMEInfoHandleAction mPreferredAction; // preferred action to associate with this type
NS_IMETHODIMP nsMIMEInfoImpl::GetPreferredAction(nsMIMEInfoHandleAction * aPreferredAction)
{
*aPreferredAction = mPreferredAction;
@ -226,3 +227,15 @@ NS_IMETHODIMP nsMIMEInfoImpl::SetPreferredAction(nsMIMEInfoHandleAction aPreferr
mPreferredAction = aPreferredAction;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::GetAlwaysAskBeforeHandling(PRBool * aAlwaysAsk)
{
*aAlwaysAsk = mAlwaysAskBeforeHandling;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::SetAlwaysAskBeforeHandling(PRBool aAlwaysAsk)
{
mAlwaysAskBeforeHandling = aAlwaysAsk;
return NS_OK;
}

Просмотреть файл

@ -41,15 +41,16 @@ public:
PRUint32 GetExtCount(); // returns the number of extensions associated.
// member variables
nsCStringArray mExtensions; // array of file extensions associated w/ this MIME obj
nsCStringArray mExtensions; // array of file extensions associated w/ this MIME obj
nsAutoString mDescription; // human readable description
nsCOMPtr<nsIURI> mURI; // URI pointing to data associated w/ this obj
PRUint32 mMacType, mMacCreator; // Mac file type and creator
protected:
nsCString mMIMEType;
nsCOMPtr<nsIFile> mPreferredApplication; // preferred application associated with this type.
nsCString mMIMEType;
nsCOMPtr<nsIFile> mPreferredApplication; // preferred application associated with this type.
nsMIMEInfoHandleAction mPreferredAction; // preferred action to associate with this type
nsString mPreferredAppDescription;
PRBool mAlwaysAskBeforeHandling;
};
#endif //__nsmimeinfoimpl_h___

Просмотреть файл

@ -29,11 +29,14 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsMIMEInfoImpl, nsIMIMEInfo);
// nsMIMEInfoImpl methods
nsMIMEInfoImpl::nsMIMEInfoImpl() {
NS_INIT_REFCNT();
mPreferredAction = 0;
mPreferredAction = nsIMIMEInfo::saveToDisk;
mAlwaysAskBeforeHandling = PR_TRUE;
}
nsMIMEInfoImpl::nsMIMEInfoImpl(const char *aMIMEType) :mMIMEType( aMIMEType ){
NS_INIT_REFCNT();
mPreferredAction = nsIMIMEInfo::saveToDisk;
mAlwaysAskBeforeHandling = PR_TRUE;
}
PRUint32
@ -213,8 +216,6 @@ NS_IMETHODIMP nsMIMEInfoImpl::SetPreferredApplicationHandler(nsIFile * aPreferre
return NS_OK;
}
nsMIMEInfoHandleAction mPreferredAction; // preferred action to associate with this type
NS_IMETHODIMP nsMIMEInfoImpl::GetPreferredAction(nsMIMEInfoHandleAction * aPreferredAction)
{
*aPreferredAction = mPreferredAction;
@ -226,3 +227,15 @@ NS_IMETHODIMP nsMIMEInfoImpl::SetPreferredAction(nsMIMEInfoHandleAction aPreferr
mPreferredAction = aPreferredAction;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::GetAlwaysAskBeforeHandling(PRBool * aAlwaysAsk)
{
*aAlwaysAsk = mAlwaysAskBeforeHandling;
return NS_OK;
}
NS_IMETHODIMP nsMIMEInfoImpl::SetAlwaysAskBeforeHandling(PRBool aAlwaysAsk)
{
mAlwaysAskBeforeHandling = aAlwaysAsk;
return NS_OK;
}

Просмотреть файл

@ -41,15 +41,16 @@ public:
PRUint32 GetExtCount(); // returns the number of extensions associated.
// member variables
nsCStringArray mExtensions; // array of file extensions associated w/ this MIME obj
nsCStringArray mExtensions; // array of file extensions associated w/ this MIME obj
nsAutoString mDescription; // human readable description
nsCOMPtr<nsIURI> mURI; // URI pointing to data associated w/ this obj
PRUint32 mMacType, mMacCreator; // Mac file type and creator
protected:
nsCString mMIMEType;
nsCOMPtr<nsIFile> mPreferredApplication; // preferred application associated with this type.
nsCString mMIMEType;
nsCOMPtr<nsIFile> mPreferredApplication; // preferred application associated with this type.
nsMIMEInfoHandleAction mPreferredAction; // preferred action to associate with this type
nsString mPreferredAppDescription;
PRBool mAlwaysAskBeforeHandling;
};
#endif //__nsmimeinfoimpl_h___