Example #1
0
OP_STATUS PKCS11_DeleteModuleL(OpString &Module_name
#ifdef SMC_ES_THREAD
							   , ES_RestartObject* restartobject
#endif
							   )
{
	if(Module_name.IsEmpty())
		return OpStatus::ERR;

	OpString value;
	ANCHOR(OpString,value);

	OpString ininame;
	ANCHOR(OpString,ininame);

	RETURN_IF_ERROR(prefsManager->GetSmartCardDriverL(Module_name, value));

	if(value.IsEmpty())
		return OpStatus::OK;

	int i = value.FindFirstOf(',');
	if(i != KNotFound)
		value.Delete(i);

	Uninstall_PKCS(NULL, value,
#ifdef SMC_ES_THREAD
		restartobject, 
#endif
		&Module_name);

	return OpStatus::OK;
}
Example #2
0
OP_STATUS PKCS11_AddModuleL(OpString &Module_name, 
						   OpString &DLL_path, 
						   unsigned long methods,
						   unsigned long ciphers
#ifdef SMC_ES_THREAD
						   , ES_RestartObject* restartobject
#endif
						   )
{
	if(Module_name.IsEmpty() || DLL_path.IsEmpty())
		return OpStatus::ERR;

	if(DLL_path.FindFirstOf(',') != KNotFound)
		return OpStatus::ERR;

	OpString value;
	ANCHOR(OpString,value);

	OpString ininame;
	ANCHOR(OpString,ininame);

	RETURN_IF_ERROR(prefsManager->GetSmartCardDriverL(Module_name, value));

	if(!value.IsEmpty())
		return OpStatus::OK;

	Install_PKCS(NULL, DLL_path, 
#ifdef SMC_ES_THREAD
		restartobject, 
#endif
		methods, ciphers, &Module_name);

	return OpStatus::OK;
}
Example #3
0
void CServerWnd::ReattachAnchors()
{
	RemoveAnchor(serverlistctrl);
	RemoveAnchor(StatusSelector);
	RemoveAnchor(IDC_LOGRESET);
	RemoveAnchor(*servermsgbox);
	RemoveAnchor(*logbox);
	RemoveAnchor(*debuglog);

	AddAnchor(serverlistctrl, TOP_LEFT, ANCHOR(100, thePrefs.GetSplitterbarPositionServer()));
	AddAnchor(StatusSelector, ANCHOR(0, thePrefs.GetSplitterbarPositionServer()), BOTTOM_RIGHT);
	AddAnchor(IDC_LOGRESET, MIDDLE_RIGHT);
	AddAnchor(*servermsgbox, ANCHOR(0, thePrefs.GetSplitterbarPositionServer()), BOTTOM_RIGHT);
	AddAnchor(*logbox, ANCHOR(0, thePrefs.GetSplitterbarPositionServer()), BOTTOM_RIGHT);
	AddAnchor(*debuglog, ANCHOR(0, thePrefs.GetSplitterbarPositionServer()), BOTTOM_RIGHT);

	GetDlgItem(IDC_LOGRESET)->Invalidate();

	if (servermsgbox->IsWindowVisible())
		servermsgbox->Invalidate();
	if (logbox->IsWindowVisible())
		logbox->Invalidate();
	if (debuglog->IsWindowVisible())
		debuglog->Invalidate();
}
Example #4
0
size_t CookiePath::WriteCookiesL(DataFile &fp, time_t this_time, BOOL dry_run)
{
	size_t size = 0;
	Cookie* ck = (Cookie*) cookie_list.First();
	while (ck)
	{
		if(ck->Persistent(this_time))
		{
			DataFile_Record rec(TAG_COOKIE_ENTRY);
			ANCHOR(DataFile_Record,rec);

			rec.SetRecordSpec(fp.GetRecordSpec());

			ck->FillDataFileRecordL(rec);

			if (dry_run)
				size += rec.CalculateLength();
			else
				rec.WriteRecordL(&fp);
		}
		ck = ck->Suc();
	}

	CookiePath* cp = (CookiePath*) FirstChild();
	while (cp)
	{
		if (cp->HasCookies(this_time))
		{
			DataFile_Record rec(TAG_COOKIE_PATH_ENTRY);
			ANCHOR(DataFile_Record,rec);


			rec.SetRecordSpec(fp.GetRecordSpec());
			rec.AddRecordL(TAG_COOKIE_PATH_NAME, cp->PathPart());
			if (dry_run)
				size += rec.CalculateLength();
			else
				rec.WriteRecordL(&fp);

			size += cp->WriteCookiesL(fp, this_time, dry_run);
		}
		cp = cp->Suc();
	}

	{
		DataFile_Record rec(TAG_COOKIE_PATH_END);
		// spec is a pointer to existing field of object fp, there is no need to assert that it's not null
		const DataRecord_Spec *spec = fp.GetRecordSpec();
		rec.SetRecordSpec(spec);
		if (dry_run)
			size += ((rec.GetTag() & MSB_VALUE) == MSB_VALUE) ? spec->idtag_len : rec.CalculateLength();
		else
			rec.WriteRecordL(&fp);
	}
	return size;
}
Example #5
0
void TouchInputManager::activateDebug(Entity camera) {
    for (int i=0; i<MAX_TOUCH_POINT; i++) {
        debugState[i] = theEntityManager.CreateEntity(HASH("debug_input", 0x0));
        ADD_COMPONENT(debugState[i], Transformation);
        ADD_COMPONENT(debugState[i], Anchor);
        ANCHOR(debugState[i])->parent = camera;
        ANCHOR(debugState[i])->z = 0.9999f - TRANSFORM(camera)->z;
        ADD_COMPONENT(debugState[i], Rendering);
        RENDERING(debugState[i])->show = 1;
    }
}
Example #6
0
uint32 SSL_Cipher::EncryptStreamL(DataStream *source, DataStream *target, uint32 len)
{
    if(target == NULL)
        return 0;

    SSL_secure_varvector32 temp_in, temp_out;
    ANCHOR(SSL_secure_varvector32, temp_in);
    ANCHOR(SSL_secure_varvector32, temp_out);

    uint32 maxlen = (len ? len : 4096);
    uint32 read_len, enc_len;
    uint32 consumed_len = 0;
    uint32 produced_len = 0;

    temp_out.Resize(maxlen);
    if(temp_out.Error())
        LEAVE(temp_out.GetOPStatus());

    if(source == NULL)
    {
        FinishEncrypt(temp_out.GetDirect(), enc_len, temp_out.GetLength());
        target->WriteDataL(temp_out.GetDirect(), enc_len);

        produced_len += enc_len;
        return produced_len;
    }

    temp_in.Resize(maxlen);
    if(temp_in.Error())
        LEAVE(temp_in.GetOPStatus());

    while(source->MoreData() && (!len || consumed_len < len))
    {
        read_len = source->ReadDataL(temp_in.GetDirect(), temp_in.GetLength());

        if(!read_len)
            break;

        consumed_len += read_len;

        Encrypt(temp_in.GetDirect(), read_len, temp_out.GetDirect(), enc_len, temp_out.GetLength());
        target->WriteDataL(temp_out.GetDirect(), enc_len);

        produced_len += enc_len;

        if(read_len < maxlen)
            break;
    }

    return produced_len;
}
Example #7
0
void ScrollingSystem::initScrolling(Entity e, ScrollingComponent* sc) {
    ScrollingElement se;

    TransformationComponent* ptc = TRANSFORM(e);
    for (int i=0; i<2; i++) {
        se.e[i] = theEntityManager.CreateEntity(HASH("scroll/e", 0x4ab48dfd));

        ADD_COMPONENT(se.e[i], Transformation);
        ADD_COMPONENT(se.e[i], Rendering);
        ADD_COMPONENT(se.e[i], Anchor);

        TRANSFORM(se.e[i])->size = sc->displaySize;
        auto* tc = ANCHOR(se.e[i]);
        tc->parent = e;
        tc->position = -glm::vec2(sc->direction.x * ptc->size.x, sc->direction.y * ptc->size.y) * (float)i;
        tc->z = i * 0.001f;

        RenderingComponent* rc = RENDERING(se.e[i]);
        se.imageIndex[i] = i % sc->images.size();
        rc->texture = sc->images[se.imageIndex[i]];
        // rc->color = debugColors[se.imageIndex[i]];
        se.hasBeenVisible[i] = false;
        rc->flags = sc->renderingFlags;
    }
    elements[e] = se;
}
Example #8
0
double
XPath_ConversionExpressionHelper::GetNumberL (XPath_Context *context, BOOL initial)
{
  OP_ASSERT (!numberexpression);

  StartL (context, initial);

  TempBuffer buffer; ANCHOR (TempBuffer, buffer);
  if (GetStringValueL (context, initial, buffer))
    return XPath_Value::AsNumber (buffer.GetStorage ());
  else if (booleanexpression)
    return booleanexpression->EvaluateToBooleanL (context, initial) ? 1. : 0.;
  else if (stringexpression)
    return XPath_Value::AsNumber (stringexpression->EvaluateToStringL (context, initial, buffer));

#ifdef XPATH_EXTENSION_SUPPORT
  OP_ASSERT (unknown);
  XPath_Value *value = unknown->EvaluateL (context, initial);
  double number = value->AsNumberL ();
  XPath_Value::DecRef (context, value);
  return number;
#else // XPATH_EXTENSION_SUPPORT
  OP_ASSERT (FALSE);
  return op_nan (0);
#endif // XPATH_EXTENSION_SUPPORT
}
Example #9
0
/*
 * top-level compilation; break the document into
 * style, html, and source blocks with footnote links
 * weeded out.
 */
static Paragraph *
compile_document(Line *ptr, MMIOT *f)
{
    ParagraphRoot d = { 0, 0 };
    ANCHOR(Line) source = { 0, 0 };
    Paragraph *p = 0;
    struct kw *tag;
    int eaten, unclosed;

    while ( ptr ) {
	if ( !(f->flags & MKD_NOHTML) && (tag = isopentag(ptr)) ) {
	    int blocktype;
	    /* If we encounter a html/style block, compile and save all
	     * of the cached source BEFORE processing the html/style.
	     */
	    if ( T(source) ) {
		E(source)->next = 0;
		p = Pp(&d, 0, SOURCE);
		p->down = compile(T(source), 1, f);
		T(source) = E(source) = 0;
	    }
	    
	    if ( f->flags & MKD_NOSTYLE )
		blocktype = HTML;
	    else
		blocktype = strcmp(tag->id, "STYLE") == 0 ? STYLE : HTML;
	    p = Pp(&d, ptr, blocktype);
	    ptr = htmlblock(p, tag, &unclosed);
	    if ( unclosed ) {
		p->typ = SOURCE;
		p->down = compile(p->text, 1, f);
		p->text = 0;
	    }
	}
	else if ( isfootnote(ptr) ) {
	    /* footnotes, like cats, sleep anywhere; pull them
	     * out of the input stream and file them away for
	     * later processing
	     */
	    ptr = consume(addfootnote(ptr, f), &eaten);
	}
	else {
	    /* source; cache it up to wait for eof or the
	     * next html/style block
	     */
	    ATTACH(source,ptr);
	    ptr = ptr->next;
	}
    }
    if ( T(source) ) {
	/* if there's any cached source at EOF, compile
	 * it now.
	 */
	E(source)->next = 0;
	p = Pp(&d, 0, SOURCE);
	p->down = compile(T(source), 1, f);
    }
    return T(d);
}
Example #10
0
void Header_QuotedPrintable_Parameter::InitL(const OpStringC8 &p_name, const OpStringC16 &p_value, const OpStringC8 &charset, Header_Encoding encoding, BOOL quote_if_not_encoded)
{
	OpString8 p_value2;
	ANCHOR(OpString8, p_value2);

	SetToEncodingL(&p_value2, (charset.HasContent() && charset.CompareI("utf-16") != 0 ? charset.CStr() : "utf-8"), p_value.CStr());
	InitL(p_name, p_value2, charset, encoding, quote_if_not_encoded);
}
Example #11
0
/* static */ double
XPath_Value::AsNumberL (const uni_char *string, unsigned string_length)
{
  TempBuffer buffer; ANCHOR (TempBuffer, buffer);
  buffer.AppendL (string, string_length);

  uni_char *endptr;
  return uni_strtod (buffer.GetStorage (), &endptr);
}
Example #12
0
void
WebFeedStorage::SaveStoreL(WebFeedsAPI_impl* api_impl)
{
	OP_ASSERT(api_impl);
	if (!api_impl)
		return;

	WriteBuffer w_buf; ANCHOR(WriteBuffer, w_buf);
	w_buf.InitL(UNI_L("tmp.storage"));

	api_impl->SaveL(w_buf);
	w_buf.Flush();
	w_buf.GetFile().Close();

	OpFile old_file; ANCHOR(OpFile, old_file);
	LEAVE_IF_ERROR(old_file.Construct(FEED_STORE_FILE, OPFILE_WEBFEEDS_FOLDER));
	LEAVE_IF_ERROR(old_file.SafeReplace(&w_buf.GetFile()));
}
Example #13
0
static void emitCoord(Coordinate src) {

	if (src.file && *src.file) {
		ANCHOR(href, print("%s", src.file)); print("%s", src.file); END;
		print(":");
	}

	print("%d.%d", src.y, src.x);
}
Example #14
0
void ScrollingSystem::DoUpdate(float dt) {
    FOR_EACH_ENTITY_COMPONENT(Scrolling, a, sc)
        EltIt iter = elements.find(a);
        if (iter == elements.end()) {
            if ( glm::abs(glm::length(sc->direction) - 1) <= 0.001) {
                initScrolling(a, sc);
                iter = elements.find(a);
            }
            continue;
        }
        if (!sc->show) {
            ScrollingElement& se = iter->second;
            for (int i=0; i<2; i++) {
                RENDERING(se.e[i])->show = false;
            }
            continue;
        }

        LOGF_IF(sc->speed < 0, "Scrolling component '" << sc << "' has a speed < 0");

        ScrollingElement& se = iter->second;
        for (int i=0; i<2; i++) {
            RENDERING(se.e[i])->show = true;

            AnchorComponent* tc = ANCHOR(se.e[i]);
            tc->position += sc->direction * (sc->speed * dt);

            bool isVisible = theRenderingSystem.isVisible(se.e[i]);
            if (!se.hasBeenVisible[i] && isVisible) {
                se.hasBeenVisible[i] = true;
            } else if (se.hasBeenVisible[i] && !isVisible) {
                se.imageIndex[i] = (se.imageIndex[i] + 2) % sc->images.size();
                RENDERING(se.e[i])->texture = sc->images[se.imageIndex[i]];
                const auto* ptc = TRANSFORM(a);
                tc->position =
                    ANCHOR(se.e[(i+1)%2])->position -
                    glm::vec2(sc->direction.x * ptc->size.x, sc->direction.y * ptc->size.y);
                se.hasBeenVisible[i] = false;
            }
        }
    END_FOR_EACH()
}
Example #15
0
XMLTreeAccessor::Node *
XPath_Node::GetTreeNodeByIdL (const uni_char *id, unsigned id_length)
{
  TempBuffer buffer; ANCHOR (TempBuffer, buffer);
  buffer.AppendL (id, id_length);

  XMLTreeAccessor::Node *node;
  LEAVE_IF_ERROR (tree->GetElementById (node, buffer.GetStorage ()));

  return node;
}
Example #16
0
XPath_Value *
XPath_Value::ConvertToStringL (XPath_Context *context)
{
  if (type == XP_VALUE_STRING)
    return IncRef (this);
  else
    {
      TempBuffer buffer; ANCHOR (TempBuffer, buffer);
      return MakeStringL (context, AsStringL (buffer));
    }
}
Example #17
0
void URL_RelRep::WriteCacheDataL(DataFile_Record *rec)
{
	DataFile_Record relrec(TAG_RELATIVE_ENTRY);
	ANCHOR(DataFile_Record,relrec);

	relrec.SetRecordSpec(rec->GetRecordSpec());

	relrec.AddRecordL(TAG_RELATIVE_NAME, name);
	relrec.AddRecordL(TAG_RELATIVE_VISITED, (uint32) last_visited);

	relrec.WriteRecordL(rec);
}
void Undo( HWND hwndDlg )
{
    DLGINFO dlgInfoLocal;

    if( RetrieveDlgInfo( ANCHOR( hwndDlg ), &dlgInfoLocal ) )
    {
        UpdateGlobalDlgInfo( &dlgInfoLocal );
        UpdateControls( hwndDlg );
    }
    else
        Defaults( hwndDlg );
}
Example #19
0
BOOL SpdyFramesHandler::SendDataL(SComm* sink)
{
	BOOL somethingSent = FALSE;
	SpdyNetworkBuffer buffer(HTTP_TmpBuf, HTTP_TmpBufSize);
	ANCHOR(SpdyNetworkBuffer, buffer); 
	while (!prioritizedFramesProducers.Empty())
	{
		SpdyFramesProducer *producer = prioritizedFramesProducers.First();
		OP_ASSERT(producer->HasNextFrame());
		producer->Out();

		producer->WriteNextFrameL(buffer);
		buffer.SendAndClearL(sink);
		somethingSent = TRUE;
	}

	pendingDataToSend = FALSE;
	if (!priorityOrderedFramesProducers.Empty())
	{
		SpdyFramesProducer *firstProducer = priorityOrderedFramesProducers.First();
		while (firstProducer && buffer.Length() < maxBufLen)
		{
			UINT8 currentPriority = firstProducer->GetPriority();
			BOOL producedSomethingForPriority = FALSE;
			SpdyFramesProducer *it, *suc;

			for (it = firstProducer; it && it->GetPriority() == currentPriority && buffer.Length() < maxBufLen; it = suc)
			{
				suc = it->Suc();

				if (!it->HasNextFrame())
					continue;

				it->WriteNextFrameL(buffer);
				producedSomethingForPriority = TRUE;
			}
			if (!producedSomethingForPriority)
				firstProducer = it;
		}
		pendingDataToSend = firstProducer != NULL;

		if (buffer.Length())
		{
			buffer.SendAndClearL(sink);
			somethingSent = TRUE;
		}
	}

	if (pendingDataToSend)
		listener->OnHasDataToSend();
	return somethingSent;
}
void SpeedDialSuggestionsModel::AddClosedTabsHelperL(BOOL items_under_parent_folder, INT32 num_of_item_to_add)
{
	//Todo: Add folder if parameter 'items_under_parent_folder' is true
	INT32 session_pages_folder_idx = -1;

	OP_ASSERT(g_application->GetActiveBrowserDesktopWindow());
	OpSession* session;
	if ((session = g_application->GetActiveBrowserDesktopWindow()->GetUndoSession()) != NULL)
	{
		INT32 session_wnd_count = session->GetWindowCountL();
		for (INT32 index = static_cast<INT32>(session_wnd_count - 1), count = 0; index >= 0 && count < num_of_item_to_add; index--)
		{
			OpSessionWindow* session_window = session->GetWindowL(index);
			if (session_window->GetTypeL() ==  OpSessionWindow::DOCUMENT_WINDOW)
			{
				UINT32 current_history = session_window->GetValueL("current history");
				if (current_history == 0 && session_window->GetValueL("max history"))
					continue; //Speed-dial in history

				OpAutoVector<OpString> history_url_list; ANCHOR(OpAutoVector<OpString>, history_url_list);
				session_window->GetStringArrayL("history url", history_url_list);
				if (!history_url_list.Get(current_history - 1)) 
					continue;

				if (!DocumentView::IsUrlRestrictedForViewFlag(history_url_list.Get(current_history - 1)->CStr(), DocumentView::ALLOW_ADD_TO_SPEED_DIAL))
					continue;

				OpAutoVector<OpString> history_title_list; ANCHOR(OpAutoVector<OpString>, history_title_list);
				session_window->GetStringArrayL("history title", history_title_list);
				
				if ( -1 != AddSuggestion(history_title_list.Get(current_history - 1)->CStr()
					, history_url_list.Get(current_history - 1) ? history_url_list.Get(current_history - 1)->CStr() : UNI_L("")
					, session_pages_folder_idx))
					count ++;
			}
		}
	}
}
Example #21
0
void
WebFeedStorage::SaveFeedL(WebFeed *feed)
{
	if (!feed)
		return;

	WriteBuffer w_buf; ANCHOR(WriteBuffer, w_buf);
	w_buf.InitL(UNI_L("tmp.feed"));

	feed->GetStub()->SaveL(w_buf, FALSE);
	w_buf.Flush();
	w_buf.GetFile().Close();

	OpString file_name; ANCHOR(OpString, file_name);
	file_name.Reserve(14);
	uni_sprintf(file_name.CStr(), UNI_L("%08x.feed"), feed->GetId());

	OpFile old_file; ANCHOR(OpFile, old_file);
	LEAVE_IF_ERROR(old_file.Construct(file_name.CStr(), OPFILE_WEBFEEDS_FOLDER));
	LEAVE_IF_ERROR(old_file.SafeReplace(&w_buf.GetFile()));

	return;
}
void FreeResources()
{
    USHORT    usNext = BKA_FIRST;
    ULONG     ulPageId = 0;
    PPAGEDATA pPageData;
    HWND      hwndDlg;

    // Enumerate through all the pages of the notebook so we can gain access
    // to their page data to free their resources.

    for( ; ; )
    {
        ulPageId = (ULONG) WinSendMsg( hwndBook, BKM_QUERYPAGEID,
                                       MPFROMLONG( ulPageId ),
                                       MPFROM2SHORT( usNext, 0 ) );

        if( !ulPageId )
            break;

        usNext = BKA_NEXT;

        if( ulPageId == (ULONG) BOOKERR_INVALID_PARAMETERS )
            Msg( "FreeResources QUERYPAGEID RC(%X)", HWNDERR( hwndBook ) );

        // Get a pointer to the page information that is associated with this
        // page. It was stored in the page's PAGE DATA in the SetUpPage
        // function.

        pPageData = (PPAGEDATA) WinSendMsg( hwndBook, BKM_QUERYPAGEDATA,
                                            MPFROMLONG( ulPageId ), NULL );

        if( !pPageData || pPageData == (PPAGEDATA) BOOKERR_INVALID_PARAMETERS )
            Msg( "FreeResources QUERYPAGEDATA RC(%X)", HWNDERR( hwndBook ) );
        else
            free( pPageData );

        hwndDlg = (HWND) WinSendMsg( hwndBook, BKM_QUERYPAGEWINDOWHWND,
                                     MPFROMLONG( ulPageId ), NULL );

        if( hwndDlg != (HWND) BOOKERR_INVALID_PARAMETERS && hwndDlg )
        {
            WinSendMsg( hwndDlg, UM_DUMP_DLGINFO, NULL, NULL );
            WinDestroyWindow( hwndDlg );
        }
    }

    SaveDlgInfo( ANCHOR( hwndBook ) );

    hwndBook = NULLHANDLE;
}
Example #23
0
void WebFeedContentElement::WriteAsStrippedHTMLL(URL& out_url) const
{
	if (!HasValue())
		return;

	if (!IsMarkup())  // no markup to strip
	{
		WriteAsHTMLL(out_url);
		return;
	}

	OpString stripped; ANCHOR(OpString, stripped);
	LEAVE_IF_ERROR(WebFeedUtil::StripTags((uni_char*)m_value, stripped));
	LEAVE_IF_ERROR(out_url.WriteDocumentData(URL::KNormal, stripped));
}
Example #24
0
void PrefsCollectionApp::ReadAllPrefsL(PrefsModule::PrefsInitInfo *)
{
	// Read everything
	OpPrefsCollection::ReadAllPrefsL(
		m_stringprefdefault, PCAPP_NUMBEROFSTRINGPREFS,
		m_integerprefdefault, PCAPP_NUMBEROFINTEGERPREFS);

#ifdef DYNAMIC_VIEWERS
	// Cache viewer data
	m_viewersection = m_reader->ReadSectionL(UNI_L("File Types"));
	/*DOC
	 *section=File Types
	 *name=m_viewersection
	 *key=mime/type
	 *type=string
	 *value=action,app,plugin,pluginname,ext,|fileopenext
	 *description=How to handle file type
	 */
	m_viewerextensionsection = m_reader->ReadSectionL(UNI_L("File Types Extension"));
	/*DOC
	 *section=File Types Extension
	 *name=m_viewerextensionsection
	 *key=mime/type
	 *type=string
	 *value=destfolder,flags
	 *description=Additional data on how to handle file type
	 */
#endif

#ifdef _PLUGIN_SUPPORT_
	// Fix-up plug-in path
	OpString newpath; ANCHOR(OpString, newpath);
	g_op_system_info->GetPluginPathL(m_stringprefs[PluginPath], newpath);
	m_stringprefs[PluginPath].SetL(newpath);

# if defined PREFS_HAS_PREFSFILE && defined PREFS_READ
	ReadPluginsToBeIgnoredL();
# endif
#endif

#ifdef PREFS_HAVE_DEFAULT_SOURCE_VIEWER
	// Retrieve non-static defaults
	if (m_stringprefs[SourceViewer].IsEmpty())
	{
		m_stringprefs[SourceViewer].SetL(g_op_system_info->GetDefaultTextEditorL());
	}
#endif // PREFS_HAVE_DEFAULT_SOURCE_VIEWER
}
Example #25
0
void WebFeedContentElement::WriteAsHTMLL(URL& out_url) const
{
	if (HasValue())
	{
		if (IsPlainText())
			LEAVE_IF_ERROR(out_url.WriteDocumentData(URL::KHTMLify, (uni_char*)m_value, m_value_length / sizeof(uni_char)));
		else if (IsMarkup())
		{
			OpString stripped_html; ANCHOR(OpString, stripped_html);
			WebFeedUtil::StripTags((const uni_char*)m_value, stripped_html, UNI_L("style"), TRUE);
			LEAVE_IF_ERROR(out_url.WriteDocumentData(URL::KNormal, stripped_html, stripped_html.Length()));
		}
		else
			OP_ASSERT(!"What to do, what to do, with this strange content type");
	}
}
Example #26
0
double
XPath_Value::AsNumberL ()
{
  switch (type)
    {
    case XP_VALUE_BOOLEAN:
      return data.boolean ? 1. : 0.;

    case XP_VALUE_NUMBER:
      return data.number;

    case XP_VALUE_STRING:
      return AsNumber (data.string);
    }

  TempBuffer buffer; ANCHOR (TempBuffer, buffer);
  return AsNumber (AsStringL (buffer));
}
Example #27
0
void URL_DataDescriptor::SetupContentDecodingL(const char *header)
{
	if(!header)
		LEAVE(OpStatus::ERR);
	
	ParameterList params(KeywordIndex_HTTP_General_Parameters); 
	ANCHOR(ParameterList, params);
	
	params.SetValueL((char *) header, PARAM_SEP_COMMA| PARAM_NO_ASSIGN | PARAM_ONLY_SEP);

	Parameters *encoding = params.First();

	while(encoding)
	{
		ParameterList *current_encoding = encoding->GetParametersL(PARAM_SEP_SEMICOLON, KeywordIndex_HTTP_General_Parameters);
		Parameters *name = (current_encoding ? current_encoding->First() : NULL);
		
		if(name)
		{
			HTTP_compression mth;
			
			switch(mth = (HTTP_compression) name->GetNameID())
			{
			case HTTP_Deflate:
			case HTTP_Compress:
			case HTTP_Gzip:
				{
					HTTP_Transfer_Decoding *decoder = HTTP_Transfer_Decoding::Create(mth);
					if(decoder)
						decoder->Into(&CE_decoding);
					else
					{
						g_memory_manager->RaiseCondition(OpStatus::ERR_NO_MEMORY);
						LEAVE(OpStatus::ERR_NO_MEMORY);
					}
				}
				break;

			default: break; // nothing to do for plaintext
			}
		}
		encoding = encoding->Suc();
	}
}
Example #28
0
XPath_Value *
XPath_Expression::EvaluateToValueL (XPath_Context *context, BOOL initial)
{
  unsigned expression_flags = GetExpressionFlags ();

#ifdef XPATH_EXTENSION_SUPPORT
  if ((expression_flags & FLAG_UNKNOWN) != 0)
    return static_cast<XPath_Unknown *> (this)->EvaluateToValueL (context, initial);
#endif // XPATH_EXTENSION_SUPPORT

  if ((expression_flags & FLAG_NUMBER) != 0)
    return XPath_Value::MakeNumberL (context, static_cast<XPath_NumberExpression *> (this)->EvaluateToNumberL (context, initial));
  else if ((expression_flags & FLAG_BOOLEAN) != 0)
    return XPath_Value::MakeBooleanL (context, static_cast<XPath_BooleanExpression *> (this)->EvaluateToBooleanL (context, initial));
  else
    {
      OP_ASSERT ((expression_flags & FLAG_STRING) != 0);
      TempBuffer buffer; ANCHOR (TempBuffer, buffer);
      return XPath_Value::MakeStringL (context, static_cast<XPath_StringExpression *> (this)->EvaluateToStringL (context, initial, buffer));
    }
}
Example #29
0
BOOL CMyPropertyPage2::OnInitDialog() 
{
	CResizablePage::OnInitDialog();
	
	// preset layout
	AddAnchor(IDC_LIST1, TOP_LEFT, ANCHOR(50,70));
	AddAnchor(IDC_PICTURE1, ANCHOR(50,0), ANCHOR(100,70));
	AddAnchor(IDC_GROUP1, ANCHOR(0,70), BOTTOM_RIGHT);
	AddAnchor(IDC_CHECK1, ANCHOR(0,85));
	AddAnchor(IDC_RADIO1, ANCHOR(100,85));
	AddAnchor(IDC_COMBO1, ANCHOR(100,70));
	AddAnchor(IDC_BUTTON1, BOTTOM_RIGHT);

	m_ctlEdit1.AddString(_T("Just a single item to test the ")
		_T("listbox behavior with very long lines..."));
	m_ctlEdit1.SetHorizontalExtent(300);

	return TRUE;
}
Example #30
0
BOOL
XPath_ConversionExpressionHelper::GetBooleanL (XPath_Context *context, BOOL initial)
{
  OP_ASSERT (!booleanexpression);

  StartL (context, initial);

  XPath_Node *node;
  if (GetNodeL (context, initial, node))
    {
      BOOL result = node != 0;
      XPath_Node::DecRef (context, node);
      return result;
    }
  else if (numberexpression)
    {
      double number = numberexpression->EvaluateToNumberL (context, initial);
      return !op_isnan (number) && number != 0.;
    }
  else if (stringexpression)
    {
      TempBuffer buffer; ANCHOR (TempBuffer, buffer);
      return *stringexpression->EvaluateToStringL (context, initial, buffer) != 0;
    }

#ifdef XPATH_EXTENSION_SUPPORT
  OP_ASSERT (unknown);
  XPath_Value *value = unknown->EvaluateL (context, initial);
  BOOL boolean = value->AsBoolean ();
  XPath_Value::DecRef (context, value);
  return boolean;
#else // XPATH_EXTENSION_SUPPORT
  OP_ASSERT (FALSE);
  return FALSE;
#endif // XPATH_EXTENSION_SUPPORT
}