зеркало из https://github.com/mozilla/pjs.git
Moving dumpJSConsole pref to when we exit so that we don't have to be an observer.
Making the softkey listen to preferences so that we can enable and disable it.
This commit is contained in:
Родитель
c7a963bc42
Коммит
1cca29f40c
|
@ -159,9 +159,6 @@ ApplicationObserver::Observe(nsISupports *aSubject, const char *aTopic, const PR
|
|||
if (!bundle)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
|
||||
|
||||
const PRUnichar *formatStrings[] = { filePath.get() };
|
||||
nsXPIDLString message;
|
||||
bundle->FormatStringFromName(NS_LITERAL_STRING("loadFailed").get(),
|
||||
|
@ -401,10 +398,6 @@ void DoPreferences()
|
|||
return;
|
||||
|
||||
prefBranch->SetIntPref("snav.keyCode.modifier", 0);
|
||||
|
||||
|
||||
|
||||
prefBranch->GetBoolPref("config.wince.dumpJSConsole", &gDumpJSConsole);
|
||||
}
|
||||
|
||||
#define NS_FULLSCREEN_CID \
|
||||
|
|
|
@ -74,6 +74,9 @@
|
|||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch2.h"
|
||||
|
||||
class nsSoftKeyBoard : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
|
@ -109,6 +112,8 @@ public:
|
|||
NS_DECL_NSIOBSERVER
|
||||
|
||||
nsCOMArray<nsSoftKeyBoard> mObjects;
|
||||
|
||||
PRBool mUseSoftwareKeyboard;
|
||||
};
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSoftKeyBoard)
|
||||
|
@ -190,11 +195,14 @@ nsSoftKeyBoard::HandleEvent(nsIDOMEvent* aEvent)
|
|||
void
|
||||
nsSoftKeyBoard::OpenSIP()
|
||||
{
|
||||
#ifdef WINCE
|
||||
#define KBDI_KEYBOARD_ENABLED 0x0002
|
||||
// if (KBDI_KEYBOARD_ENABLED & GetKeyboardStatus())
|
||||
// return;
|
||||
// It is okay to CloseSip if there is a hardware keyboard
|
||||
// present, but it isn't nice to use a software keyboard
|
||||
// when a hardware one is present.
|
||||
|
||||
if (!mService->mUseSoftwareKeyboard)
|
||||
return;
|
||||
|
||||
#ifdef WINCE
|
||||
HWND hWndSIP = ::FindWindow( _T( "SipWndClass" ), NULL );
|
||||
if (hWndSIP)
|
||||
{
|
||||
|
@ -208,10 +216,6 @@ void
|
|||
nsSoftKeyBoard::CloseSIP()
|
||||
{
|
||||
#ifdef WINCE
|
||||
#define KBDI_KEYBOARD_ENABLED 0x0002
|
||||
// if (KBDI_KEYBOARD_ENABLED & GetKeyboardStatus())
|
||||
// return;
|
||||
|
||||
HWND hWndSIP = ::FindWindow( _T( "SipWndClass" ), NULL );
|
||||
if (hWndSIP)
|
||||
{
|
||||
|
@ -302,6 +306,7 @@ nsSoftKeyBoard::GetAttachedWindow(nsIDOMWindow * *aAttachedWindow)
|
|||
|
||||
nsSoftKeyBoardService::nsSoftKeyBoardService()
|
||||
{
|
||||
mUseSoftwareKeyboard = PR_TRUE;
|
||||
}
|
||||
|
||||
nsSoftKeyBoardService::~nsSoftKeyBoardService()
|
||||
|
@ -358,6 +363,29 @@ nsSoftKeyBoardService::Observe(nsISupports *aSubject, const char *aTopic, const
|
|||
nsCOMPtr<nsIWindowWatcher> windowWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
windowWatcher->RegisterNotification(this);
|
||||
|
||||
nsCOMPtr<nsIPrefBranch2> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
prefBranch->AddObserver("skey.", this, PR_FALSE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID))
|
||||
{
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(aSubject);
|
||||
nsXPIDLCString cstr;
|
||||
|
||||
const char* pref = NS_ConvertUCS2toUTF8(aData).get();
|
||||
|
||||
if (!strcmp(pref, "skey.enabled"))
|
||||
{
|
||||
PRBool enabled;
|
||||
prefBranch->GetBoolPref(pref, &enabled);
|
||||
|
||||
mUseSoftwareKeyboard = enabled;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -96,7 +96,7 @@ nsSSRSupport::SetSSREnabled(PRBool aSsrEnabled)
|
|||
|
||||
if (aSsrEnabled)
|
||||
return m_sss->LoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
|
||||
|
||||
|
||||
return m_sss->UnregisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ nsSSRSupport::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
if (!strcmp(aTopic,"xpcom-startup"))
|
||||
if (!strcmp(aTopic,"app-startup"))
|
||||
{
|
||||
nsCOMPtr<nsIPrefBranch2> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -142,7 +142,7 @@ nsSSRSupport::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar
|
|||
if (!strcmp(pref, "ssr.enabled"))
|
||||
{
|
||||
PRBool enabled;
|
||||
prefBranch->GetIntPref(pref, &enabled);
|
||||
prefBranch->GetBoolPref(pref, &enabled);
|
||||
|
||||
SetSSREnabled(enabled);
|
||||
return NS_OK;
|
||||
|
@ -151,7 +151,7 @@ nsSSRSupport::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar
|
|||
if (!strcmp(pref, "ssr.site.enabled"))
|
||||
{
|
||||
PRBool enabled;
|
||||
prefBranch->GetIntPref(pref, &enabled);
|
||||
prefBranch->GetBoolPref(pref, &enabled);
|
||||
|
||||
SetSiteSSREnabled(enabled);
|
||||
return NS_OK;
|
||||
|
@ -196,7 +196,7 @@ static NS_METHOD SSRRegistration(nsIComponentManager *aCompMgr,
|
|||
return rv;
|
||||
|
||||
char* previous = nsnull;
|
||||
rv = catman->AddCategoryEntry("xpcom-startup",
|
||||
rv = catman->AddCategoryEntry("app-startup",
|
||||
"SSR",
|
||||
SSRSupport_ContractID,
|
||||
PR_TRUE,
|
||||
|
@ -227,7 +227,7 @@ static NS_METHOD SSRUnregistration(nsIComponentManager *aCompMgr,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = catman->DeleteCategoryEntry("xpcom-startup",
|
||||
rv = catman->DeleteCategoryEntry("app-startup",
|
||||
"SSR",
|
||||
PR_TRUE);
|
||||
|
||||
|
|
|
@ -71,6 +71,8 @@ img[src*="spacer"] {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
*:focus
|
||||
{
|
||||
-moz-outline: 3px solid #FFFF00 !important;
|
||||
|
|
|
@ -766,5 +766,5 @@ pref("config.wince.useOKBtn", true);
|
|||
pref("ssr.enabled", true);
|
||||
pref("ssr.site.enabled", true);
|
||||
|
||||
pref("skey.enabled", true);
|
||||
|
||||
pref("config.wince.dumpJSConsole", true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче