コード例 #1
0
void CPrefInfo::Initialize()
{
	int32 prefInt;

	// Unvisited link color
	PREF_GetColorPrefDWord("browser.anchor_color", &m_rgbAnchorColor);
	wfe_SetLayoutColor(LO_COLOR_LINK, m_rgbAnchorColor);
    PREF_RegisterCallback("browser.anchor_color", prefWatcher, (void *)1);

	// Visited link color
	PREF_GetColorPrefDWord("browser.visited_color", &m_rgbVisitedColor);
	wfe_SetLayoutColor(LO_COLOR_VLINK, m_rgbVisitedColor);
    PREF_RegisterCallback("browser.visited_color", prefWatcher, (void *)2);
	
	// Underline links
	/* 
	 * PREF_GetBoolPref("browser.underline_anchors", &m_bUnderlineAnchors);
    	 * PREF_RegisterCallback("browser.underline_anchors", prefWatcher, (void *)3);
	 */
    
	// Text and background color. See if we should use the Windows colors
	PREF_GetBoolPref("browser.wfe.use_windows_colors", &m_bUseWindowsColors);
    PREF_RegisterCallback("browser.wfe.use_windows_colors", prefWatcher, (void *)4);
	
	if (m_bUseWindowsColors) {
		m_rgbForegroundColor = ::GetSysColor(COLOR_WINDOWTEXT);
		m_rgbBackgroundColor = ::GetSysColor(COLOR_WINDOW);

	} else {
		PREF_GetColorPrefDWord("browser.foreground_color", &m_rgbForegroundColor);
		PREF_GetColorPrefDWord("browser.background_color", &m_rgbBackgroundColor);
	}

	wfe_SetLayoutColor(LO_COLOR_FG, m_rgbForegroundColor);
	PREF_RegisterCallback("browser.foreground_color", prefWatcher, (void *)5);
	wfe_SetLayoutColor(LO_COLOR_BG, m_rgbBackgroundColor);
	PREF_RegisterCallback("browser.background_color", prefWatcher, (void *)6);
	
	// See if the user's choices override the document
	PREF_GetBoolPref("browser.use_document_colors", &m_bUseDocumentColors);
    LO_SetUserOverride(!m_bUseDocumentColors);
	PREF_RegisterCallback("browser.use_document_colors", prefWatcher, (void *)7);
	
	// Always Load Images
	PREF_GetBoolPref("general.always_load_images", &m_bAutoLoadImages);
    PREF_RegisterCallback("general.always_load_images", prefWatcher, (void *)8);

	   // type of toolbar buttons
 	PREF_GetIntPref("browser.chrome.button_style",&prefInt);
	theApp.m_pToolbarStyle = CASTINT(prefInt);
	PREF_RegisterCallback("browser.chrome.button_style", SetToolbarButtonStyle, NULL);


}
コード例 #2
0
STDMETHODIMP
CPublishPrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal)
{
	if (!m_bHasBeenActivated) {
		PREF_GetBoolPref("editor.publish_keep_links",&m_bAutoAdjustLinks);
    	PREF_GetBoolPref("editor.publish_keep_images",&m_bKeepImagesWithDoc);
	    PREF_GetStringPref("editor.publish_location",m_strPublishLocation);
	    PREF_GetStringPref("editor.publish_browse_location",m_strBrowseLocation);
	}

	return CEditorPropertyPage::Activate(hwndParent, lprc, bModal);
}
コード例 #3
0
BOOL CAdvSearchOptionsDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	XP_Bool bSubFolders   = FALSE;
	XP_Bool bSearchServer = FALSE;
	PREF_GetBoolPref("mailnews.searchSubFolders",&bSubFolders);
	m_bIncludeSubfolders = bSubFolders;
	PREF_GetBoolPref("mailnews.searchServer",&bSearchServer);
	m_iSearchArea = !bSearchServer ? 0 : 1; 
	UpdateData(FALSE);


	return TRUE;
}
コード例 #4
0
/* Pref for allowing (or not) proxy autodiscovery. */
MODULE_PRIVATE int PR_CALLBACK 
net_EnablePadPrefChanged(const char *pref, void *data) {
	XP_Bool x;
	PREF_GetBoolPref(pref_enablePad, &x);
	MK_PadEnabled=x;
	return PREF_NOERROR;
}
コード例 #5
0
void CNewProfileWizard::InitPrefStrings()
{
	CString csUserAddr = "";
	CString csFullName = "";

	if (m_bUpgrade) {
		csUserAddr = theApp.GetProfileString("User","User_Addr","");
		csFullName = theApp.GetProfileString("User","User_Name","");   
	}

	m_pUserAddr = csUserAddr;
	m_pFullName = csFullName;
	m_pProfileName = "";
	m_pProfilePath = "";
	m_bExistingDir = FALSE;

#ifdef MOZ_MAIL_NEWS
	PREF_GetBoolPref("mail.leave_on_server", &m_bLeftOnServer);

	m_szFullName = g_MsgPrefs.m_csUsersFullName;
	m_szEmail = g_MsgPrefs.m_csUsersEmailAddr;
#endif /* MOZ_MAIL_NEWS */

	char *prefStr = NULL;

	PREF_CopyCharPref("network.hosts.smtp_server", &prefStr);
	if (prefStr)
		m_szMailServer = prefStr;
	XP_FREEIF(prefStr);

	prefStr = NULL;
	PREF_CopyCharPref("mail.pop_name", &prefStr);
	if (prefStr)
		m_szPopName = prefStr;
	XP_FREEIF(prefStr);

	prefStr = NULL;
	PREF_CopyCharPref("network.hosts.pop_server", &prefStr);
	if (prefStr)
		m_szInMailServer = prefStr;
	XP_FREEIF(prefStr);

	if (m_szInMailServer.IsEmpty())
		m_szInMailServer = m_szMailServer;

	int32 prefInt = 0;
	PREF_GetIntPref("mail.server_type", &prefInt);
	m_bUseIMAP = prefInt == MSG_Imap4;

	prefStr = NULL;
	PREF_CopyCharPref("network.hosts.nntp_server", &prefStr);
	if (prefStr)
		m_szNewsServer = prefStr;
	XP_FREEIF(prefStr);

	m_bIsSecure = FALSE;
	m_nPort = NEWS_PORT;
}
コード例 #6
0
STDMETHODIMP
CEditorPrefs2::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal)
{
	if (!m_bHasBeenActivated) {
		PREF_GetBoolPref("editor.page_updown_move_cursor",&m_bUpDownMoveCursor);
	}

	return CEditorPropertyPage::Activate(hwndParent, lprc, bModal);
}
コード例 #7
0
ファイル: nsPrefBranch.cpp プロジェクト: rn10950/RetroZilla
NS_IMETHODIMP nsPrefBranch::GetBoolPref(const char *aPrefName, PRBool *_retval)
{
  const char *pref;
  nsresult   rv;

  rv = getValidatedPrefName(aPrefName, &pref);
  if (NS_SUCCEEDED(rv)) {
    rv = PREF_GetBoolPref(pref, _retval, mIsDefault);
  }
  return rv;
}
コード例 #8
0
/* called from mkgeturl.c, NET_InitNetLib(). 
 * Initializes the pad variables and registers pad callbacks */
PUBLIC void
NET_RegisterPadPrefCallbacks(void) {
	XP_Bool x;
    char s[128];
    int len=sizeof(s);
	XP_MEMSET(s, 0, len);

	PREF_GetBoolPref(pref_enablePad, &x);
	MK_PadEnabled=x;
	PREF_RegisterCallback(pref_enablePad, net_EnablePadPrefChanged, NULL);

	PREF_GetCharPref(pref_padPacURL, s, &len);
	NET_SetPadPacURL(s);
	PREF_RegisterCallback(pref_padPacURL, net_PadPacURLPrefChanged, NULL);
}
コード例 #9
0
void
lo_ProcessScriptTag(MWContext *context, lo_DocState *state, PA_Tag *tag, JSObject *obj)
{
    lo_TopState *top_state;
    pa_DocData *doc_data;
    XP_Bool type_explicitly_set=FALSE;
    XP_Bool saw_archive=FALSE;
#ifdef DEBUG_ScriptPlugin
	char * mimebuf = NULL;
#endif

    top_state = state->top_state;
    doc_data = (pa_DocData *)top_state->doc_data;
    XP_ASSERT(doc_data != NULL || state->in_relayout || tag->lo_data);

    if (tag->is_end == FALSE) {
        PA_Block buff;
        char *str, *url, *archiveSrc, *id, *codebase;

        /* Controversial default language value. */
        top_state->version = JSVERSION_DEFAULT;
        if (tag->type == P_STYLE || tag->type == P_LINK) {
            top_state->in_script = top_state->default_style_script_type;
        }
        else {
            /* in order to get old script behaviour, pretend
             * that the content-type is explicitly set for all scripts
             */
            type_explicitly_set = TRUE;
            top_state->in_script = SCRIPT_TYPE_MOCHA;
        }

        /* XXX account for HTML comment bytes and  "lost" newlines */
        if (lo_IsAnyCurrentAncestorSourced(state))
            top_state->script_bytes = top_state->layout_bytes;
        else
            top_state->script_bytes = top_state->layout_bytes - tag->true_len;
        if (tag->lo_data != NULL) {
            top_state->script_bytes += (int32)tag->lo_data - 1;
            tag->lo_data = NULL;
        } 
        else if (doc_data != NULL) {
            top_state->script_bytes += doc_data->comment_bytes;
        } 
        else {
            XP_ASSERT(state->in_relayout);
        }

	lo_ParseScriptLanguage(context, tag, &top_state->in_script,
			       &top_state->version);
#ifdef DEBUG_ScriptPlugin
		if (top_state->in_script == SCRIPT_TYPE_UNKNOWN)
		{
			mimebuf = npl_Script2mimeType(context,tag);
			if (mimebuf){
				if (NPL_FindPluginEnabledForType(mimebuf)){
					top_state->in_script = SCRIPT_TYPE_PLUGIN;
					XP_ASSERT(top_state->mimetype == NULL);
					StrAllocCopy((char *)top_state->mimetype,mimebuf);
					XP_FREE(mimebuf);
					mimebuf = NULL;
				}
				else{
					XP_FREE(mimebuf);
					mimebuf = NULL;
				}
			}
		}
#endif /* DEBUG_ScriptPlugin */

        buff = lo_FetchParamValue(context, tag, PARAM_TYPE);
        if (buff != NULL) {
            PA_LOCK(str, char *, buff);
            if ((XP_STRCASECMP(str, js_content_type) == 0) ||
                (!XP_STRCASECMP(str, "text/javascript"))) {
		if(tag->type == P_STYLE || tag->type == P_LINK)
		{
		    top_state->in_script = SCRIPT_TYPE_JSSS;
		    top_state->default_style_script_type = SCRIPT_TYPE_JSSS;
		}
		else
		{
		    top_state->in_script = SCRIPT_TYPE_MOCHA;                    
		}
                type_explicitly_set = TRUE;
            } 
            else if ((XP_STRCASECMP(str, TEXT_CSS) == 0)) {
                top_state->in_script = SCRIPT_TYPE_CSS;
                top_state->default_style_script_type = SCRIPT_TYPE_CSS;
                type_explicitly_set = TRUE;
            } 
            else {
                top_state->in_script = SCRIPT_TYPE_UNKNOWN;
                top_state->default_style_script_type = SCRIPT_TYPE_UNKNOWN;
            }
            PA_UNLOCK(buff);
            PA_FREE(buff);
        } 

	/* check for media=screen
	 * don't load the style sheet if there 
	 * is a media not equal to screen
	 */
	buff = lo_FetchParamValue(context, tag, PARAM_MEDIA);
	if (buff) {
	    if (strcasecomp((char*)buff, "screen")) {
		/* set the script type to UNKNOWN
		 * so that it will get thrown away
		 */
		top_state->in_script = SCRIPT_TYPE_UNKNOWN;
	    }
	    PA_FREE(buff);
	}

        /*
         * Flush the line buffer so we can start storing Mocha script
         * source lines in there.
         */
        lo_FlushLineBuffer(context, state);

        url = archiveSrc = id = codebase = NULL;
        if (top_state->in_script != SCRIPT_TYPE_NOT) {
            /*
             * Check for the archive parameter for known languages.
             */
            buff = lo_FetchParamValue(context, tag, PARAM_ARCHIVE);
            if (buff != NULL) {
                saw_archive = TRUE;
                PA_LOCK(str, char *, buff);
                url = NET_MakeAbsoluteURL(top_state->base_url, str);
                PA_UNLOCK(buff);
                PA_FREE(buff);
		if (url == NULL) {
                    top_state->out_of_memory = TRUE;
                    return;
		}
            }

            /* 
             * Look for ID attribute. If it's there we have may have
             * an inline signed script.
             */
            buff = lo_FetchParamValue(context, tag, PARAM_ID);
            if (buff != NULL) {
                PA_LOCK(str, char *, buff);
                StrAllocCopy(id, str);
                PA_UNLOCK(buff);
                PA_FREE(buff);
		if (id == NULL) {
                    top_state->out_of_memory = TRUE;
		    XP_FREEIF(url);
                    return;
		}
            }

            /*
             * Now look for a SRC="url" attribute for known languages.
             * If found, synchronously load the url.
             */
	    buff = lo_FetchParamValue(context, tag, PARAM_SRC);  /* XXX overloaded rv */
            if (buff != NULL) {
		XP_Bool allowFileSrc = FALSE;
                char *absUrl;

                PA_LOCK(str, char *, buff);

		PREF_GetBoolPref(lo_jsAllowFileSrcFromNonFile, &allowFileSrc);
                absUrl = NET_MakeAbsoluteURL(top_state->base_url, str);
		if (absUrl == NULL) {
		    top_state->out_of_memory = TRUE;
		    XP_FREEIF(id);
                } else if (allowFileSrc == FALSE &&
		           NET_URL_Type(absUrl) == FILE_TYPE_URL &&
		           NET_URL_Type(top_state->url) != FILE_TYPE_URL) {
		    /*
		     * Deny access from http: to file: via SCRIPT SRC=...
		     * XXX silently
		     */
                    top_state->in_script = SCRIPT_TYPE_UNKNOWN;
                    XP_FREE(absUrl);
                    XP_FREEIF(url);
		    XP_FREEIF(id);
		} else if (url != NULL) {
                    XP_FREE(absUrl);
                    StrAllocCopy(archiveSrc, str);
		    if (archiveSrc == NULL) {
			top_state->out_of_memory = TRUE;
			XP_FREE(url);
			XP_FREEIF(id);
		    }
                } else {
                    url = absUrl;
                }
                PA_UNLOCK(buff);
                PA_FREE(buff);
		if (top_state->out_of_memory)
		    return;

                /*
                 * If we are doing a <script src=""> mocha script but JS
                 *   is turned off just ignore the tag
                 */
		if (!LM_CanDoJS(context)) {
                    top_state->in_script = SCRIPT_TYPE_UNKNOWN;
                    XP_FREE(url);
		    XP_FREEIF(id);
		    XP_FREEIF(archiveSrc);
                    return;
                }
            }
        }

        /*
         * Set text_divert so we know to accumulate text in line_buf
         * without interpretation.
         */
        state->text_divert = tag->type;

        /*
         * XXX need to stack these to handle blocked SCRIPT tags
         */
        top_state->script_lineno = tag->newline_count + 1;

        /* if we got here as a result of a LINK tag
         * check to make sure rel=stylesheet and then
         * check for an HREF and if one does not exist
         * fail
         */
        if (tag->type == P_LINK) {
            char *cbuff = (char*)lo_FetchParamValue(context, tag, PARAM_REL);
                        
            if (cbuff && !strcasecomp(cbuff, "stylesheet")) {
                XP_FREE(cbuff);

                cbuff = (char*)lo_FetchParamValue(context, tag, PARAM_HREF);

                if (cbuff) {
                    if (saw_archive && url) {
                        archiveSrc = XP_STRDUP(cbuff);
                    } else {
		        XP_FREEIF(url);
                        url = NET_MakeAbsoluteURL(top_state->base_url, cbuff);
                    }
		}
            }

            XP_FREEIF(cbuff);
        }

        if (url != NULL || id != NULL || codebase != NULL) {
            if ((doc_data != NULL) &&
                (state->in_relayout == FALSE) &&
                SCRIPT_EXEC_OK(top_state, state, tag->type, P_SCRIPT)) {
                ScriptData *data;

                data = XP_ALLOC(sizeof(ScriptData));
                if (data == NULL) {
                    top_state->out_of_memory = TRUE;
                    return;
                }
                data->context = context;
                data->state = state;
                data->tag = PA_CloneMDLTag(tag);
                if (data->tag == NULL) {
                    top_state->out_of_memory = TRUE;
		    XP_FREE(data);
                    return;
                }
                data->url = url;
                data->archiveSrc = archiveSrc;
                data->id = id;
                if (codebase == NULL) {
                    StrAllocCopy(codebase, top_state->base_url);
                }
                data->codebase = codebase;
                data->buffer = NULL;
                data->bufferSize = 0;
                data->version = top_state->version;

		/*
		 * Only SCRIPT ARCHIVE= ID= without SRC= is an inline signed
		 * script -- if there is a SRC= attribute, archiveSrc will be
		 * non-null.
		 */
                data->inlineSigned = (JSBool)
		    (url != NULL && archiveSrc == NULL && id != NULL);

                /* Reset version accumulator */
                top_state->version = JSVERSION_UNKNOWN;

                XP_ASSERT (tag->type == P_SCRIPT || tag->type == P_STYLE || 
			   tag->type == P_LINK);

	        /* 
		 * Out-of-line included (by src=) or inline signed script.
		 * Save continuatation data on top_state.  If it's signed,
		 * we'll verify the signature once we see </script> and
		 * have the inline script to verify.
		 */
		top_state->scriptData = data;

            } 
	    else {
                XP_FREE(url);
		XP_FREEIF(id);
		XP_FREEIF(archiveSrc);
            }
        }
    } 
    else {

	/*
	 * We are in the </script> tag now...
	 */

        size_t line_buf_len;
        intn script_type;
        char *scope_to=NULL;
        char *untransformed = NULL;

        script_type = top_state->in_script;
        top_state->in_script = SCRIPT_TYPE_NOT;

	/* guard against superfluous end tags */
	if (script_type == SCRIPT_TYPE_NOT)
	    goto end_tag_out;

	/* convert from CSS to JavaScript here */
        if (tag->type != P_LINK && script_type == SCRIPT_TYPE_CSS) {
            char *new_buffer;
            int32 new_buffer_length;

            CSS_ConvertToJS((char *)state->line_buf, 
                            state->line_buf_len,
                            &new_buffer,
                            &new_buffer_length);

            if (!new_buffer) {
                /* css translator error, unblock layout and return */
                state->text_divert = P_UNKNOWN;
                state->line_buf_len = 0; /* clear script text */
                goto end_tag_out;
            }

            untransformed = (char *) state->line_buf;
            state->line_buf = (PA_Block) new_buffer;
            state->line_buf_len = new_buffer_length;
            state->line_buf_size = new_buffer_length;

            if (state->line_buf_len)
                state->line_buf_len--; /* hack: subtract one to remove final \n */

            script_type = SCRIPT_TYPE_JSSS;
        }

        if (tag->type == P_STYLE) {
            /* mocha scoped to document == jsss */
            scope_to = "document";
        }

        /*
         * Reset these before potentially recursing indirectly through
         * the document.write() built-in function, which writes to the
         * very same doc_data->parser_stream that this <SCRIPT> tag
         * came in on.
         */
        state->text_divert = P_UNKNOWN;
        line_buf_len = state->line_buf_len;
        state->line_buf_len = 0;

        if (script_type != SCRIPT_TYPE_UNKNOWN && 
	    script_type != SCRIPT_TYPE_NOT) {
            /*
             * If mocha is disabled or can't be done in this context we
             *   are going to just ignore the buffer contents
             */
            if (!LM_CanDoJS(context)) {
				top_state->in_script = SCRIPT_TYPE_UNKNOWN;
                goto end_tag_out;
            }

            if ((doc_data != NULL) &&
                (state->in_relayout == FALSE) &&
                SCRIPT_EXEC_OK(top_state, state, tag->type, P_SCRIPT)) {

                /*
                 * First off, make sure layout is blocking on us
                 */
                if (lo_create_script_blockage(context, state, 
					tag->type == P_SCRIPT ? LO_SCRIPT : LO_UNKNOWN)) 
				{
                    ScriptData *data;

                    /*
                     * Extreme hackery.  Hideous and shameful.  See the comment
						* in lo_BlockScriptTag before similar is_end/overflow code
						* and commence vomiting.
                     */
                    lo_BlockScriptTag(context, state, NULL);

		    if (tag->is_end == (PRPackedBool)1) {
			  PA_PushOverflow(doc_data);
			  doc_data->overflow_depth ++;
		    }

		    /*
		     * Set the document.write tag insertion point.
		     */
             top_state->input_write_point[top_state->input_write_level] = &top_state->tags;

		    data = top_state->scriptData;
                    top_state->scriptData = NULL;
                    if (data && data->url) {
			/*
			 * Three cases:
			 * 1.  SCRIPT SRC=: url non-null
			 * 2.  SCRIPT ARCHIVE= SRC=: url, archiveSrc non-null
			 * 3.  SCRIPT ARCHIVE= ID=: url, id non-null
			 * In the last case, we copy the inline script into
			 * data's buffer and let lo_script_archive_exit_fn do
			 * the eval.  We use an inlineSigned flag to avoid a
			 * bunch of (url != NULL && archiveSrc == NULL && id
			 * != NULL) tests.
			 */
			if (data->inlineSigned) {
                            StrAllocCopy(data->buffer, (char *) state->line_buf);
                            data->bufferSize = line_buf_len;
			}
			lo_GetScriptFromURL(data, script_type);
                    }
		    else {
                        JSPrincipals *principals = NULL;
			ETEvalStuff * stuff;
			
                        if (data) {
			    principals = LM_NewJSPrincipals(NULL, data->id, 
							    data->codebase);
                            if (untransformed &&
				!LM_SetUntransformedSource(principals, 
                                                           untransformed,
                                                           (char *) state->line_buf))
                            {
                                top_state->out_of_memory = TRUE;
                            }
                            lo_DestroyScriptData(data);
			}

                        /* 
                         * send the buffer off to be evaluated 
			 */
#ifdef DEBUG_ScriptPlugin
			 			if (script_type == SCRIPT_TYPE_PLUGIN)
						{
							XP_ASSERT(mimebuf == NULL);
							npl_ScriptPlugin(context, state, tag, line_buf_len,top_state->mimetype);
						    lo_unblock_script_tag(context, TRUE);
						}
						else
#endif /* DEBUG_ScriptPlugin */
 

			stuff = (ETEvalStuff *) XP_NEW_ZAP(ETEvalStuff);
			if (!stuff)
			    goto end_tag_out;

			stuff->len = line_buf_len;
			stuff->line_no = top_state->script_lineno;
			if (scope_to)
			    stuff->scope_to = XP_STRDUP(scope_to);
			else
			    stuff->scope_to = NULL;
			stuff->want_result = JS_FALSE;
			stuff->data = context;
			stuff->version = top_state->version;
			stuff->principals = principals;

                        ET_EvaluateScript(context, 
                                          (char *) state->line_buf,
					  stuff,
                                          lo_ScriptEvalExitFn);
                    }

                    /* Reset version accumulator */
                    top_state->version = JSVERSION_UNKNOWN;
                }
            }
        }
      end_tag_out:
	/*
	 * If we got a </SCRIPT> and still have scriptData set here, it must
	 *   be left over from an error case above, so we free it.
	 */
	if (top_state->scriptData) {
	    XP_ASSERT(!top_state->layout_blocking_element);
            lo_DestroyScriptData(top_state->scriptData);
	    top_state->scriptData = NULL;
	}
        XP_FREEIF(untransformed);
    }
}
コード例 #10
0
int PR_CALLBACK prefWatcher(const char *pPrefName, void *pData)
{
	BOOL		bReload = FALSE;
	COLORREF	rgbForegroundColor = prefInfo.m_rgbForegroundColor;
	COLORREF	rgbBackgroundColor = prefInfo.m_rgbBackgroundColor;

	switch ((int)pData) {
		case 1:
			PREF_GetColorPrefDWord("browser.anchor_color", &prefInfo.m_rgbAnchorColor);
			wfe_SetLayoutColor(LO_COLOR_LINK, prefInfo.m_rgbAnchorColor);
			bReload = TRUE;
			break;

		case 2:
			PREF_GetColorPrefDWord("browser.visited_color", &prefInfo.m_rgbVisitedColor);
			wfe_SetLayoutColor(LO_COLOR_VLINK, prefInfo.m_rgbVisitedColor);
			bReload = TRUE;
			break;

		case 3:
			/*
			 * PREF_GetBoolPref("browser.underline_anchors", &prefInfo.m_bUnderlineAnchors);
			 * bReload = TRUE;  // XXX - we really only need to refresh the page...
			 */
			break;

		case 4:
			PREF_GetBoolPref("browser.wfe.use_windows_colors", &prefInfo.m_bUseWindowsColors);
			if (prefInfo.m_bUseWindowsColors) {
				rgbForegroundColor = ::GetSysColor(COLOR_WINDOWTEXT);
				rgbBackgroundColor = ::GetSysColor(COLOR_WINDOW);
		
			} else {
				PREF_GetColorPrefDWord("browser.foreground_color", &rgbForegroundColor);
				PREF_GetColorPrefDWord("browser.background_color", &rgbBackgroundColor);
			}
			break;

		case 5:
			PREF_GetColorPrefDWord("browser.foreground_color", &rgbForegroundColor);
			break;

		case 6:
			PREF_GetColorPrefDWord("browser.background_color", &rgbBackgroundColor);
			break;

		case 7:
			PREF_GetBoolPref("browser.use_document_colors", &prefInfo.m_bUseDocumentColors);
			LO_SetUserOverride(!prefInfo.m_bUseDocumentColors);
			bReload = TRUE;
			break;

		case 8:
			PREF_GetBoolPref("general.always_load_images",&prefInfo.m_bAutoLoadImages);

			CGenericFrame *pGenFrame;
			for(pGenFrame = theApp.m_pFrameList; pGenFrame; pGenFrame = pGenFrame->m_pNext) {
				pGenFrame->GetChrome()->ImagesButton(!prefInfo.m_bAutoLoadImages);
			}
			break;
	}

	// See whether the foreground or background colors changed
	if (rgbForegroundColor != prefInfo.m_rgbForegroundColor) {
		prefInfo.m_rgbForegroundColor = rgbForegroundColor;
		wfe_SetLayoutColor(LO_COLOR_FG, prefInfo.m_rgbForegroundColor);
		bReload = TRUE;
	}

	if (rgbBackgroundColor != prefInfo.m_rgbBackgroundColor) {
		prefInfo.m_rgbBackgroundColor = rgbBackgroundColor;
		wfe_SetLayoutColor(LO_COLOR_BG, prefInfo.m_rgbBackgroundColor);
		bReload = TRUE;
	}

	if (bReload)
		g_bReloadAllWindows = TRUE;

	return PREF_NOERROR;
}
コード例 #11
0
//
// This function will create a composition window and either do
// a blind send or pop up the compose window for the user to 
// complete the operation
//
// Return: appropriate MAPI return code...
//
// 
extern "C" LONG
DoFullMAPIMailOperation(MAPISendMailType      *sendMailPtr,
											  const char            *pInitialText,
                        BOOL                  winShowFlag)
{   
CGenericDoc             *pDocument;
LPSTR                   subject;
NSstringSeq             mailInfoSeq;
DWORD                   stringCount = 6;
DWORD                   i;
CString                 csDefault;

  // Get a context to use for this call...
  MWContext *pOldContext = GetUsableContext();
  if (!pOldContext)
  {
    return(MAPI_E_FAILURE);
  }

  // Don't allow a compose window to be created if the user hasn't 
  // specified an email address
  const char *real_addr = FE_UsersMailAddress();
  if (MISC_ValidateReturnAddress(pOldContext, real_addr) < 0)
  {
    return(MAPI_E_FAILURE);
  }

  //
  // Now, we must build the fields object...
  //
  mailInfoSeq = (NSstringSeq) &(sendMailPtr->dataBuf[0]);
  subject = NSStrSeqGet(mailInfoSeq, 0);

  // We should give it a subject to preven the prompt from coming
  // up...
  if ((!subject) || !(*subject))
  {
    csDefault.LoadString(IDS_COMPOSE_DEFAULTNOSUBJECT);
    subject = csDefault.GetBuffer(2);
  }

  TRACE("MAPI: ProcessMAPISendMail() Subject   = [%s]\n", subject);
  TRACE("MAPI: ProcessMAPISendMail() Text Size = [%d]\n", strlen((const char *)pInitialText));
  TRACE("MAPI: ProcessMAPISendMail() # of Recipients  = [%d]\n", sendMailPtr->MSG_nRecipCount);


  char  toString[1024] = "";
  char  ccString[1024] = "";
  char  bccString[1024] = "";

  for (i=0; i<sendMailPtr->MSG_nRecipCount; i++)
  {
    LPSTR   ptr;
    UCHAR   tempString[256];

    ULONG addrType = atoi(NSStrSeqGet(mailInfoSeq, stringCount++));

    // figure which type of address this is?
    if (addrType == MAPI_CC)
      ptr = ccString;
    else if (addrType == MAPI_BCC)
      ptr = bccString;
    else
      ptr = toString;
      
    LPSTR namePtr = (LPSTR) NSStrSeqGet(mailInfoSeq, stringCount++);
    LPSTR emailPtr = (LPSTR) NSStrSeqGet(mailInfoSeq, stringCount++);
    if ( (lstrlen(emailPtr) > 5) && (*(emailPtr + 4) == ':') )
    {
      emailPtr += 5;
    }

    // Now build the temp string to tack on in the format
    // "Rich Pizzarro" <*****@*****.**>
    wsprintf((LPSTR) tempString, "\"%s\" <%s>", namePtr, emailPtr);

    // add a comma if not the first one
    if (ptr[0] != '\0')
      lstrcat(ptr, ",");

    // tack on string!
    lstrcat(ptr, (LPSTR) tempString);
  }

  BOOL    bEncrypt = FALSE;
  BOOL    bSign    = FALSE;

  PREF_GetBoolPref("mail.crypto_sign_outgoing_mail", &bSign);
  PREF_GetBoolPref("mail.encrypt_outgoing_mail", &bEncrypt);
  MSG_CompositionFields *fields =
      MSG_CreateCompositionFields(real_addr, real_addr, 
                  toString, 
                  ccString, 
                  bccString,
									"", "", "",
									"", subject, "",
									"", "", "",
									"", 
                  bEncrypt,
                  bSign);
  if (!fields)
  {
    return(MAPI_E_FAILURE);
  }

  // RICHIE
  // INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(pOldContext);
  // int16 win_csid = INTL_GetCSIWinCSID(csi);
  
  pDocument = (CGenericDoc*)theApp.m_TextComposeTemplate->OpenDocumentFile(NULL, NULL, /*win_csid RICHIE*/ winShowFlag);
  if ( !pDocument )
  {
    return(MAPI_E_FAILURE);
  }
  
  CWinCX * pContext = (CWinCX*) pDocument->GetContext();
  if ( !pContext ) 
  {
    return(MAPI_E_FAILURE);
  }

  MSG_CompositionPaneCallbacks Callbacks;
  Callbacks.CreateRecipientsDialog = CreateRecipientsDialog;
  Callbacks.CreateAskHTMLDialog = CreateAskHTMLDialog;

  int16 doccsid;
  MWContext *context = pContext->GetContext();
  CComposeFrame *pCompose = (CComposeFrame *) pContext->GetFrame()->GetFrameWnd();

  pCompose->SetComposeStuff(context, fields); // squirl away stuff for post-create

  // This needs to be set TRUE if using the old non-HTML text frame
  // to prevent dropping dragged URLs
  pContext->m_bDragging = !pCompose->UseHtml();
  if (!pCompose->UseHtml()) 
  {
    pCompose->SetMsgPane(
      MSG_CreateCompositionPane(pContext->GetContext(), 
                                context, 
                                g_MsgPrefs.m_pMsgPrefs, 
                                fields,
                                WFE_MSGGetMaster())
                        );
  }

  ASSERT(pCompose->GetMsgPane());
  MSG_SetFEData(pCompose->GetMsgPane(),(void *)pCompose);  
  pCompose->UpdateAttachmentInfo();

  // Pass doccsid info to new context for MailToWin conversion
  doccsid = INTL_GetCSIDocCSID(LO_GetDocumentCharacterSetInfo(context));
  INTL_SetCSIDocCSID(LO_GetDocumentCharacterSetInfo(context), 
    (doccsid ? doccsid : INTL_DefaultDocCharSetID(context)));

  pCompose->DisplayHeaders(NULL);

  CComposeBar * pBar = pCompose->GetComposeBar();
  ASSERT(pBar);
  LPADDRESSCONTROL pIAddressList = pBar->GetAddressWidgetInterface();

  if (!pIAddressList->IsCreated()) 
  {
    pBar->CreateAddressingBlock();
  }

  // rhp - Deal with addressing the brute force way! This is a 
  // "fix" for bad behavior when creating these windows and not
  // showing them on the desktop.
  if (!winShowFlag)      // Hack to fix the window not being mapped
  {
    pCompose->AppendAddress(MSG_TO_HEADER_MASK, "");
    pCompose->AppendAddress(MSG_CC_HEADER_MASK, "");
    pCompose->AppendAddress(MSG_BCC_HEADER_MASK, "");
  }

  // Always do plain text composition!
  pCompose->CompleteComposeInitialization();

  // Do this so we don't get popups on "empty" messages
  if ( (!pInitialText) || (!(*pInitialText)) )
    pInitialText = " ";

  const char * pBody = pInitialText ? pInitialText : MSG_GetCompBody(pCompose->GetMsgPane());
  if (pBody)
  {
    FE_InsertMessageCompositionText(context,pBody,TRUE);
  }

  // 
  // Now set the message as being edited!    
  //
  pCompose->SetModified(TRUE);

  //
  // Finally deal with the attachments...
  //
  if (sendMailPtr->MSG_nFileCount > 0)
  {
    // Send this puppy when done with the attachments...
    if (!winShowFlag)
    {
      pCompose->SetMAPISendMode(MAPI_SEND);
    }

    MSG_AttachmentData *pAttach = (MSG_AttachmentData *)
                  XP_CALLOC((sendMailPtr->MSG_nFileCount + 1),
                  sizeof(MSG_AttachmentData));
    if (!pAttach)
    {
      return(MAPI_E_INSUFFICIENT_MEMORY);
    }

    memset(pAttach, 0, (sendMailPtr->MSG_nFileCount + 1) * 
                                sizeof(MSG_AttachmentData));
    for (i=0; i<sendMailPtr->MSG_nFileCount; i++)
    {
      CString cs;
      // Create URL from filename...
      WFE_ConvertFile2Url(cs, 
          (const char *)NSStrSeqGet(mailInfoSeq, stringCount++));
      pAttach[i].url = XP_STRDUP(cs);

      // Now also include the "display" name...
      StrAllocCopy(pAttach[i].real_name, NSStrSeqGet(mailInfoSeq, stringCount++));
    }

    // Set the list!
    MSG_SetAttachmentList(pCompose->GetMsgPane(), pAttach);

    // Now free everything...
    for (i=0; i<sendMailPtr->MSG_nFileCount; i++)
    {
      if (pAttach[i].url)
        XP_FREE(pAttach[i].url);

      if (pAttach[i].real_name)
        XP_FREE(pAttach[i].real_name);
    }

    XP_FREE(pAttach);
  }

  //
  // Now, if we were supposed to do the blind send...do it, otherwise,
  // just popup the window...
  //
  if (winShowFlag)      
  {
    // Post message to compose window to set the initial focus.
    pCompose->PostMessage(WM_COMP_SET_INITIAL_FOCUS);
  }
  else if (sendMailPtr->MSG_nFileCount <= 0)  // Send NOW if no attachments!
  {
    pCompose->PostMessage(WM_COMMAND, IDM_SEND);
  }

  return(SUCCESS_SUCCESS);
}
コード例 #12
0
//
// This function will create a composition window and just attach
// the attachments of interest and pop up the window...
//
// Return: appropriate MAPI return code...
//
//
extern "C" LONG
DoPartialMAPIMailOperation(MAPISendDocumentsType *sendDocPtr)
{   
CGenericDoc             *pDocument;

  // Get a context to use for this call...
  MWContext *pOldContext = GetUsableContext();
  if (!pOldContext)
  {
    return(MAPI_E_FAILURE);
  }

  // Don't allow a compose window to be created if the user hasn't 
  // specified an email address
  const char *real_addr = FE_UsersMailAddress();
  if (MISC_ValidateReturnAddress(pOldContext, real_addr) < 0)
  {
    return(MAPI_E_FAILURE);
  }

  //
  // Now, build the fields object w/o much info...
  //
  BOOL    bEncrypt = FALSE;
  BOOL    bSign    = FALSE;

  PREF_GetBoolPref("mail.crypto_sign_outgoing_mail", &bSign);
  PREF_GetBoolPref("mail.encrypt_outgoing_mail", &bEncrypt);

  MSG_CompositionFields *fields =
      MSG_CreateCompositionFields(real_addr, real_addr, NULL, 
                  "", "",
									"", "", "",
									"", "", "",
									"", "", "",
									"", 
                  bEncrypt,
                  bSign);
  if (!fields)
  {
    return(MAPI_E_FAILURE);
  }

  // RICHIE - INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(pOldContext);
  // int16 win_csid = INTL_GetCSIWinCSID(csi);

  pDocument = (CGenericDoc*)theApp.m_TextComposeTemplate->OpenDocumentFile(NULL, NULL, /*RICHIE win_csid,*/ TRUE);
  if ( !pDocument )
  {
    // cleanup fields object
    MSG_DestroyCompositionFields(fields);
    return(MAPI_E_FAILURE);
  }

  CWinCX * pContext = (CWinCX*) pDocument->GetContext();
  if ( !pContext ) 
  {
    return(MAPI_E_FAILURE);
  }

  MSG_CompositionPaneCallbacks Callbacks;
  Callbacks.CreateRecipientsDialog = CreateRecipientsDialog;
  Callbacks.CreateAskHTMLDialog = CreateAskHTMLDialog;

  MWContext *context = pContext->GetContext();
  CComposeFrame *pCompose = (CComposeFrame *) pContext->GetFrame()->GetFrameWnd();
  pCompose->SetComposeStuff(context,fields); // squirl away stuff for post-create

  // This needs to be set TRUE if using the old non-HTML text frame
  // to prevent dropping dragged URLs
  pContext->m_bDragging = !pCompose->UseHtml();
  if (!pCompose->UseHtml()) 
  {
    pCompose->SetMsgPane(MSG_CreateCompositionPane(
      pContext->GetContext(), 
      context,
      g_MsgPrefs.m_pMsgPrefs, fields,
      WFE_MSGGetMaster()));
  }

  ASSERT(pCompose->GetMsgPane());
  MSG_SetFEData(pCompose->GetMsgPane(),(void *)pCompose);

  pCompose->UpdateAttachmentInfo();

  // Pass doccsid info to new context for MailToWin conversion
  /***
  doccsid = INTL_GetCSIDocCSID(LO_GetDocumentCharacterSetInfo(pOldContext));

  INTL_SetCSIDocCSID(LO_GetDocumentCharacterSetInfo(context), 
    (doccsid ? doccsid : INTL_DefaultDocCharSetID(pOldContext)));
  ****/

  pCompose->DisplayHeaders(NULL);

  CComposeBar * pBar = pCompose->GetComposeBar();
  ASSERT(pBar);
  LPADDRESSCONTROL pIAddressList = pBar->GetAddressWidgetInterface();

  if (!pIAddressList->IsCreated()) 
  {
    pBar->CreateAddressingBlock();
  }

  // Always do plain text composition!
  pCompose->CompleteComposeInitialization();

  //
  // Finally deal with the attachments...
  //
  NSstringSeq     mailInfoSeq = (NSstringSeq) &(sendDocPtr->dataBuf[0]);
  DWORD           stringCount = 0;
  DWORD           i;

  TRACE("MAPI: ProcessMAPISendDocuments() # of Attachments = [%d]\n", sendDocPtr->nFileCount);

  if (sendDocPtr->nFileCount > 0)
  {
      MSG_AttachmentData *pAttach = (MSG_AttachmentData *)
                    XP_CALLOC((sendDocPtr->nFileCount + 1),
                    sizeof(MSG_AttachmentData));
      if (!pAttach)
      {
        return(MAPI_E_INSUFFICIENT_MEMORY);
      }

      memset(pAttach, 0, (sendDocPtr->nFileCount + 1) * 
                                  sizeof(MSG_AttachmentData));
      for (i=0; i<sendDocPtr->nFileCount; i++)
      {
        CString cs;
        // Create URL from filename...
        WFE_ConvertFile2Url(cs, 
            (const char *)NSStrSeqGet(mailInfoSeq, stringCount++));
        pAttach[i].url = XP_STRDUP(cs);

        // Now also include the "display" name...
        StrAllocCopy(pAttach[i].real_name, NSStrSeqGet(mailInfoSeq, stringCount++));
      }

      // Set the list!
      MSG_SetAttachmentList(pCompose->GetMsgPane(), pAttach);

      // Now free everything...
      for (i=0; i<sendDocPtr->nFileCount; i++)
      {
        if (pAttach[i].url)
          XP_FREE(pAttach[i].url);

        if (pAttach[i].real_name)
          XP_FREE(pAttach[i].real_name);
      }

      XP_FREE(pAttach);
  }
    
  // 
  // Now some checking for ... well I'm not sure...
  //
  if (MSG_GetAttachmentList(pCompose->GetMsgPane()))
    pCompose->SetModified(TRUE);
  else
    pCompose->SetModified(FALSE);

  // Post message to compose window to set the initial focus.
  pCompose->PostMessage(WM_COMP_SET_INITIAL_FOCUS);

  //
  // Now, just popup the window...
  //
  pCompose->ShowWindow(TRUE);

  // return pCompose->GetMsgPane(); rhp - used to return the MsgPane
  return(SUCCESS_SUCCESS);
}