コード例 #1
0
/***********************************************************************************
 ** Add an extension filter argument to the argument creator
 ** Format of KDE extension filters:
 **   "*.x *.y |Description for x, y\n*.p *.q |Description for p, q"
 **
 ** KDEOpFileChooser::AddExtensionFilter
 ***********************************************************************************/
OP_STATUS KDEOpFileChooser::AddExtensionFilter(const DesktopFileChooserRequest& request, ArgumentCreator& argument_creator)
{
	OpString filter;

	for (unsigned i = 0; i < request.extension_filters.GetCount(); i++)
	{
		if (filter.HasContent())
			filter.Append("\n");

		OpFileSelectionListener::MediaType* media_type = request.extension_filters.Get(i);

		// extensions
		for (unsigned j = 0; j < media_type->file_extensions.GetCount(); j++)
			RETURN_IF_ERROR(filter.AppendFormat(UNI_L("%s "), media_type->file_extensions.Get(j)->CStr()));
	
		// description
		RETURN_IF_ERROR(filter.AppendFormat(UNI_L("|%s"), media_type->media_type.CStr()));
	}

	return argument_creator.AddArgument(filter);
}
コード例 #2
0
OP_STATUS PlatformGadgetUtils::GetGadgetProfileName(
		const OpStringC& gadget_path, OpString& profile_name)
{ 
	OpAutoPtr<GadgetConfigFile> config_file(GadgetConfigFile::Read(gadget_path));
	if (NULL == config_file.get())
	{
		return OpStatus::ERR;
	}
	RETURN_IF_ERROR(profile_name.Set(config_file->GetProfileName()));

	return OpStatus::OK; 
}
コード例 #3
0
	OP_STATUS Notice(const PosixNetworkAddress *what, bool up)
	{
		const enum OpSocketAddressNetType type = GetNetType();
		if (type == NETTYPE_UNDETERMINED ||
			(m_up == up ? type < what->GetNetType() : up))
		{
			RETURN_IF_ERROR(Import(what));
			m_up = up;
		}

		return OpStatus::OK;
	}
コード例 #4
0
ファイル: tempbuf.cpp プロジェクト: prestocore/browser
OP_STATUS TempBuffer::Expand( size_t capacity )
{
	CHECK_INVARIANTS();

	if (capacity == 0)
		capacity = 1;

	RETURN_IF_ERROR( EnsureConstructed( capacity ) );

	CHECK_INVARIANTS();
	return OpStatus::OK;
}
コード例 #5
0
ファイル: OpButtonStrip.cpp プロジェクト: prestocore/browser
OP_STATUS OpButtonStrip::SetButtonInfo(int id, OpInputAction* action, const OpStringC& text, BOOL enabled, BOOL visible, const OpStringC8& name)
{
	OP_ASSERT(0 <= id && (unsigned)id < m_buttons.GetCount());

	SetButtonAction(id, action);
	RETURN_IF_ERROR(SetButtonText(id, text));
	EnableButton(id, enabled);
	ShowButton(id, visible);
	SetButtonName(id, name);

	return OpStatus::OK;
}
コード例 #6
0
ファイル: upnp_soap.cpp プロジェクト: prestocore/browser
OP_STATUS HTTPMessageWriter::setURL(const uni_char *hostAddress, const uni_char *pageURL, UINT16 port)
{
	RETURN_IF_ERROR(host.Set(hostAddress));
	
	if(!pageURL)
		return OpStatus::ERR_NULL_POINTER;
		
	if(URLStartWithHTTP(pageURL))
	{
		URL url=g_url_api->GetURL(pageURL);
		RETURN_IF_ERROR(url.GetAttribute(URL::KPathAndQuery_L, page));
		httpPort=url.GetServerPort();
	}
	else
	{
		RETURN_IF_ERROR(page.Set(pageURL));
		httpPort=port;
	}
	
	return OpStatus::OK;
}
コード例 #7
0
ファイル: UIReader.cpp プロジェクト: prestocore/browser
OP_STATUS UIReader::GetNodeFromMap(const OpStringC8 &name, ParserNodeMapping* node)
{
	ParserNodeIDTableData * data;
	RETURN_IF_ERROR(m_logger.Evaluate(m_ui_element_hash.GetData(name.CStr(), &data), "ERROR: could not find widget with name '%s'", name));

	if (!m_ui_document.GetNodeByID(data->data_id, *node))
	{
		m_logger.OutputEntry("ERROR: could not retrieve widget node");
		return OpStatus::ERR;
	}
	return OpStatus::OK;;
}
コード例 #8
0
ファイル: probetimeline.cpp プロジェクト: prestocore/browser
OP_STATUS
OpProbeTimeline::Construct(Timer *timer)
{
	RETURN_IF_ERROR(m_stack.Push(&m_root));

	if (!timer)
	{
		// Use default timer if none was provided.
		m_default_timer = OP_NEW(OpProbeSystemInfoTimer, ());
		RETURN_OOM_IF_NULL(m_default_timer);
		timer = m_default_timer;
	}
コード例 #9
0
ファイル: SVGNavigation.cpp プロジェクト: prestocore/browser
OP_STATUS SVGFocusIterator::TestElement(HTML_Element* test_elm, HTML_Element* layouted_elm)
{
	if (layouted_elm->IsText())
		return OpSVGStatus::SKIP_ELEMENT;

	RETURN_IF_ERROR(TestRelevantForDisplay(layouted_elm));

	if (!g_svg_manager_impl->IsFocusableElement(m_doc_ctx->GetDocument(), layouted_elm))
		return OpSVGStatus::SKIP_ELEMENT;

	return TestVisible(test_elm, layouted_elm);
}
コード例 #10
0
ファイル: QuickUICreator.cpp プロジェクト: prestocore/browser
////////// GetTranslatedScalarStringFromMap
OP_STATUS
QuickUICreator::GetTranslatedScalarStringFromMap(const OpStringC8 & key, OpString & translated_string)
{
	OpString8 text_str;
	RETURN_IF_ERROR(GetScalarStringFromMap(key, text_str));

	if (text_str.HasContent())
	{
		return TranslateString(text_str, translated_string);
	}
	return OpStatus::OK;
}
コード例 #11
0
OP_STATUS WebServerStarter::Start()
{
	const WebserverListeningMode listening_mode =
			WebServerPrefs::ReadListeningMode();

	if (!g_webserver) return OpStatus::OK;

#ifdef WEBSERVER_RENDEZVOUS_SUPPORT
	OpString8 shared_secret;
	RETURN_IF_ERROR(WebServerPrefs::ReadSharedSecret(shared_secret));

	RETURN_IF_ERROR(g_webserver->Start(listening_mode, shared_secret));
#else
	RETURN_IF_ERROR(g_webserver->Start(listening_mode));
#endif // WEBSERVER_RENDEZVOUS_SUPPORT

	OpStatus::Ignore(WebServerPrefs::WriteIsConfigured(TRUE));
	OpStatus::Ignore(WebServerPrefs::WriteIsStarted(TRUE));

	return OpStatus::OK;
}
コード例 #12
0
OP_STATUS PlatformGadgetUtils::ExecuteGadget(
		const GadgetInstallerContext& context)
{
	OpString gadget_starter_path;
	RETURN_IF_ERROR(WindowsGadgetUtils::MakeGadgetStarterPath(
				context, gadget_starter_path));

	WindowsLaunchPI launcher;
	const BOOL result = launcher.Launch(gadget_starter_path.CStr(), 0, NULL);
	
	return result ? OpStatus::OK : OpStatus::ERR;
}
コード例 #13
0
ファイル: mboxmonthly.cpp プロジェクト: prestocore/browser
/***********************************************************************************
 ** Fully update an existing message in the store (overwrites existing message)
 **
 ** MboxMonthly::UpdateMessage
 ** @param message Message to update
 ** @param mbx_data Existing mbx_data from the store if there was any, 0 otherwise.
 **        Might be changed by this function to have new mbx_data.
 ** @return OpStatus::OK if save was successful, error codes otherwise
 ***********************************************************************************/
OP_STATUS MboxMonthly::UpdateMessage(StoreMessage& message,
									 INT64& mbx_data)
{
	// Construct file - will be closed on destruction
	OpFile file;

	// Get sent time of message
	time_t date;
	RETURN_IF_ERROR(message.GetDateHeaderValue(Header::DATE, date));

	// Prepare file for writing
	RETURN_IF_ERROR(PrepareFile(file, message.GetId(), message.GetAccountId(), date, FALSE, mbx_data != 0));

	// Go to correct position (if there already was mbx_data), which is past the from header - else write the from header
	if (mbx_data != 0)
		RETURN_IF_ERROR(file.SetFilePos(mbx_data));
	else
		RETURN_IF_ERROR(WriteFromLine(message, file));

	// Set the mbx_data past the from header, start of the raw message
	OpFileLength length;
	RETURN_IF_ERROR(file.GetFilePos(length));
	mbx_data = length;

	// Write message to file
	RETURN_IF_ERROR(WriteRawMessage(message, file));

	// Close file, making sure it's written to disk
	return file.SafeClose();
}
コード例 #14
0
ファイル: connection.cpp プロジェクト: prestocore/browser
OP_STATUS P2PConnection::ConnectTo(OpString& address, WORD port)
{
	ENTER_METHOD;

	if (address.IsEmpty())
		return OpStatus::ERR;

	m_input = OP_NEW(OpByteBuffer, ());
	if (!m_input)
		return OpStatus::ERR_NO_MEMORY;

	// Create a socket address to connect to.
	RETURN_IF_ERROR(OpSocketAddress::Create(&m_socket_address));

//	BT_RESOURCE_ADD("socket_address", m_socket_address);

	m_socket_address->FromString(address.CStr());
	if (!m_socket_address->IsValid())
		return OpStatus::ERR;

	m_socket_address->SetPort(port);

	// Create a socket.
	OpSocket *socket;
	RETURN_IF_ERROR(SocketWrapper::CreateTCPSocket(&socket, this, 0));

	m_socket.Attach(socket);

//	BT_RESOURCE_ADD("socket", socket);

	RETURN_IF_ERROR(socket->Connect(m_socket_address));

	DEBUGTRACE_CONNECT(UNI_L("CONNECTING TO... %s\n"), (uni_char *)address);

	m_address.Set(address);

	LEAVE_METHOD;

	return OpStatus::OK;
}
コード例 #15
0
OP_STATUS OpPluginCrashedBar::ShowCrash(const OpStringC& path, const OpMessageAddress& address)
{
	time_t crash_time = g_timecache->CurrentTime();
	m_logsender.reset(OP_NEW(LogSender, (false)));
	RETURN_OOM_IF_NULL(m_logsender.get());

	m_logsender->SetCrashTime(g_timecache->CurrentTime());
	m_logsender->SetListener(this);

	RETURN_IF_ERROR(FindFile(crash_time));

	PluginViewer* plugin = g_plugin_viewers->FindPluginViewerByPath(path);
	OpLabel* label = static_cast<OpLabel*>(GetWidgetByName("tbb_plugin_crashed_desc"));
	if (plugin && label)
	{
		OpString description;
		RETURN_IF_ERROR(I18n::Format(description, Str::D_PLUGIN_CRASH_DESCRIPTION, plugin->GetProductName()));
		RETURN_IF_ERROR(label->SetText(description));
	}

	m_spinner = static_cast<OpProgressBar*>(GetWidgetByType(WIDGET_TYPE_PROGRESSBAR, FALSE));
	if (!m_spinner)
		return OpStatus::ERR;

	m_spinner->SetType(OpProgressBar::Only_Label);
	m_spinner->SetText(NULL);

	m_send_button = GetWidgetByName("tbb_crash_report");
	if (!m_send_button)
		return OpStatus::ERR;

	m_address = address;
	m_sending_report = false;
	m_sending_failed = false;
	RETURN_IF_ERROR(s_visible_bars.Append(this));

	Show();

	return OpStatus::OK;
}
コード例 #16
0
OP_STATUS CollectionNavigationPane::DropURLItem(HotlistModelItem* target, DesktopDragObject* drag_object, DesktopDragObject::InsertType insert_type)
{
	INT32 new_selection_id = -1;
	INT32 target_id = target ? target->GetID() : -1;

	if (drag_object->GetURLs().GetCount() > 0)
	{
		BookmarkItemData item_data;
		RETURN_IF_ERROR(item_data.name.Set(drag_object->GetTitle()));
		RETURN_IF_ERROR(item_data.description.Set(DragDrop_Data_Utils::GetText(drag_object)));

		for (UINT32 i=0; i < drag_object->GetURLs().GetCount(); i++)
		{
			RETURN_IF_ERROR(item_data.url.Set(*drag_object->GetURLs().Get(i)));
			g_desktop_bookmark_manager->DropItem(item_data, target_id, insert_type, TRUE, drag_object->GetType(), &new_selection_id);
		}
	}
	else
	{
		BookmarkItemData item_data;
		RETURN_IF_ERROR(item_data.name.Set(drag_object->GetTitle()));
		RETURN_IF_ERROR(item_data.url.Set(drag_object->GetURL()));
		RETURN_IF_ERROR(item_data.description.Set(DragDrop_Data_Utils::GetText(drag_object)));
		g_desktop_bookmark_manager->DropItem(item_data, target_id, insert_type, TRUE, drag_object->GetType(), &new_selection_id);
	}

	return OpStatus::OK;
}
コード例 #17
0
/***********************************************************************************
 ** Gets the string for commands (e.g. "RFC822.HEADER BODY.PEEK[]"
 ** Empty string allowed
 ** If content exists, should end in a space
 **
 ** Fetch::GetFetchCommands
 ***********************************************************************************/
OP_STATUS ImapCommands::Fetch::GetFetchCommands(OpString8& commands) const
{
	if (m_flags & BODY)
		RETURN_IF_ERROR(commands.Append("BODY.PEEK[TEXT] "));

	if (m_flags & COMPLETE)
		RETURN_IF_ERROR(commands.Append("BODY.PEEK[] "));

	if (m_flags & HEADERS)
	{
		OpString8 needed_headers;
		RETURN_IF_ERROR(MessageEngine::GetInstance()->GetIndexer()->GetNeededHeaders(needed_headers));
		RETURN_IF_ERROR(commands.AppendFormat("RFC822.SIZE BODY.PEEK[HEADER.FIELDS (%s%s%s)] ",
											  GetDefaultHeaders(),
											  needed_headers.HasContent() ? " " : "",
											  needed_headers.HasContent() ? needed_headers.CStr() : ""));
	}

	if (m_flags & ALL_HEADERS)
		RETURN_IF_ERROR(commands.Append("RFC822.SIZE BODY.PEEK[HEADER] "));

	if (m_flags & BODYSTRUCTURE)
		RETURN_IF_ERROR(commands.Append("BODYSTRUCTURE "));
	
	return OpStatus::OK;
}
コード例 #18
0
OP_STATUS ExtensionsPanel::RefreshCounterLabels()
{
	if (m_extensions_view)
	{
		OpString str, counter_label_fmt;
		RETURN_IF_ERROR(
				g_languageManager->GetString(Str::D_EXTENSION_PANEL_COUNTER, 
					counter_label_fmt));
		RETURN_IF_ERROR(
				str.AppendFormat(counter_label_fmt.CStr(), m_normal_count));
		RETURN_IF_ERROR(
				m_counter_label->SetText(str.CStr()));
	}

	if (m_extensions_dev_view)
	{
		OpString str, counter_label_fmt;
		RETURN_IF_ERROR(
				g_languageManager->GetString(Str::D_EXTENSION_PANEL_DEV_COUNTER, 
					counter_label_fmt));
		RETURN_IF_ERROR(
				str.AppendFormat(counter_label_fmt.CStr(), m_dev_count));
		RETURN_IF_ERROR(
				m_dev_counter_label->SetText(str.CStr()));
	}
	
	return OpStatus::OK;
}
コード例 #19
0
OP_STATUS GadgetTooltipHandler::Init()
{
	CleanUp();

	m_listener = OP_NEW(TooltipListener, ());
	RETURN_OOM_IF_NULL(m_listener);

	m_tooltip = OP_NEW(OpToolTip, ());
	RETURN_OOM_IF_NULL(m_tooltip);
	RETURN_IF_ERROR(m_tooltip->Init());

	return OpStatus::OK;
}
コード例 #20
0
/**
This method calculates the distance between two given localities (a source
locality and a target locality). An estimate of the accuracy of the result
is also provided.
Both the distance and the distance delta are given as TReal64 values which  
is needed when used in other calculations.
This method assumes that all arguments already have been error checked.
 
@param aSrc
@param aTar
@param aDistance
@param aDelta
  */
TInt Distance64(const TLocality& aSrc,
                const TLocality& aTar,
                TReal64& aDistance,
                TReal64& aDelta)
	{
    // Calculate the distance between the localities
    RETURN_IF_ERROR(Distance64(aSrc, aTar, aDistance));

    // Calculate the distance delta
    aDelta = aSrc.HorizontalAccuracy() + aTar.HorizontalAccuracy();
                                    
    return KErrNone;
	}
コード例 #21
0
/***********************************************************************************
 **
 **
 ** MoveCopy::OnCopyUid
 ***********************************************************************************/
OP_STATUS ImapCommands::MoveCopy::OnCopyUid(IMAP4& protocol, unsigned uid_validity, OpINT32Vector& source_set, OpINT32Vector& dest_set)
{
	// This Copy is actually a Move
	// We need to move the message locally as well, and remove the old internet location
	if (source_set.GetCount() != dest_set.GetCount())
		return OpStatus::OK;

	// We try to move the original messages and save their UIDs
	for (unsigned i = 0; i < source_set.GetCount(); i++)
	{
		message_gid_t *message_id;
		RETURN_IF_ERROR(m_uid_m2id_map.GetData(source_set.Get(i), &message_id));
		int			  dest_uid   = dest_set.Get(i);
		
		// remove from source folder
		RETURN_IF_ERROR(protocol.GetBackend().GetUIDManager().RemoveUID(m_mailbox->GetIndexId(), source_set.Get(i))); 
		RETURN_IF_ERROR(m_mailbox->GetIndex()->RemoveMessage(*message_id));

		RETURN_IF_ERROR(protocol.GetBackend().OnMessageCopied(*message_id, m_to_mailbox, dest_uid, TRUE));
	}
	return OpStatus::OK;
}
コード例 #22
0
OP_STATUS
OpScopeTPReader::OnDataReady()
{
    if (!enabled)
        return OpStatus::OK;

    do
    {
        RETURN_IF_ERROR(ParseStream());
    }
    while (continous && enabled);
    return OpStatus::OK;
}
コード例 #23
0
ファイル: mediasource.cpp プロジェクト: prestocore/browser
OP_STATUS
MediaSourceImpl::AddProgressListener(MediaProgressListener* listener)
{
	RETURN_IF_ERROR(m_listeners.Add(listener));
	if (m_state == IDLE || m_state == FAILED)
	{
		// Notify the new listener of the state asynchronously.
		m_message_handler->PostMessage(MSG_MEDIA_SOURCE_NOTIFY_LISTENER,
									   reinterpret_cast<MH_PARAM_1>(this),
									   reinterpret_cast<MH_PARAM_2>(listener));
	}
	return OpStatus::OK;
}
コード例 #24
0
OP_STATUS External_SSL_display_certificate::Make(OpSSLListener::SSLCertificate *&cert_out, OpCertificate *cert)
{
	cert_out = NULL;
	
	OpAutoPtr<External_SSL_display_certificate> temp_cert(OP_NEW(External_SSL_display_certificate, ()));
	if (temp_cert.get())
	{	
		RETURN_IF_ERROR(temp_cert->m_short_name.Set(cert->GetShortName()));
		RETURN_IF_ERROR(temp_cert->m_full_name.Set(cert->GetFullName()));

		RETURN_IF_ERROR(temp_cert->m_valid_from.Set(cert->GetValidFrom()));
		RETURN_IF_ERROR(temp_cert->m_valid_to.Set(cert->GetValidTo()));
		RETURN_IF_ERROR(temp_cert->m_info.Set(cert->GetInfo()));

		temp_cert->m_issuer.Set(cert->GetIssuer());
		cert_out = temp_cert.release();
		return OpStatus::OK;
	}
	
	
	return OpStatus::ERR_NO_MEMORY;
}
コード例 #25
0
/* static */ OP_STATUS
DOM_MutationEvent::SendNodeInsertedIntoDocument(ES_Thread *interrupt_thread, DOM_Node *target)
{
	DOM_EnvironmentImpl *environment = target->GetEnvironment();

	DOM_MutationEvent *mutation_event;
	RETURN_IF_ERROR(CreateEvent(mutation_event, environment, DOMNODEINSERTEDINTODOCUMENT));

	if (mutation_event)
		mutation_event->target = target;

	return SendEvent(mutation_event, environment, interrupt_thread);
}
コード例 #26
0
OP_STATUS SpeedDialGlobalConfigDialog::PopulateThumbnailSize()
{
	OpDropDown* drop_down = static_cast<OpDropDown*>(GetWidgetByName("thumbnail_size_dropdown"));
	if (!drop_down)
		return OpStatus::ERR;

	OpString str_automatic;
	OpString str_manual;

	RETURN_IF_ERROR(g_languageManager->GetString(Str::D_SPEEDDIAL_CONFIG_ZOOM_CONTROL_AUTOMATIC, str_automatic));
	RETURN_IF_ERROR(g_languageManager->GetString(Str::D_SPEEDDIAL_CONFIG_ZOOM_CONTROL_MANUAL, str_manual));

	RETURN_IF_ERROR(drop_down->AddItem(str_automatic.CStr(), -1, NULL, THUMBNAIL_SIZE_AUTO));
	RETURN_IF_ERROR(drop_down->AddItem(str_manual.CStr(), -1, NULL, THUMBNAIL_SIZE_FROM_ZOOM));

	if (g_speeddial_manager->IsScaleAutomatic())
		drop_down->SelectItem(0, TRUE);
	else
		drop_down->SelectItem(1, TRUE);

	return OpStatus::OK;
}
コード例 #27
0
ファイル: OpLabel.cpp プロジェクト: prestocore/browser
OP_STATUS OpLabel::SetWrap(BOOL wrap)
{
	// Recreate the control if the type just changed
	if (m_wrap != wrap)
	{
		RETURN_IF_ERROR(CreateEdit(wrap));
	}

	// Store if we are using wrapping
	m_wrap = wrap;

	return OpStatus::OK;
}
コード例 #28
0
/* static */ OP_STATUS
DOM_MutationEvent::SendSubtreeModified(ES_Thread *interrupt_thread, DOM_Node *target)
{
	DOM_EnvironmentImpl *environment = target->GetEnvironment();

	DOM_MutationEvent *mutation_event;
	RETURN_IF_ERROR(CreateEvent(mutation_event, environment, DOMSUBTREEMODIFIED));

	if (mutation_event)
		mutation_event->target = target;

	return SendEvent(mutation_event, environment, interrupt_thread);
}
コード例 #29
0
OP_STATUS PosixSharedMemory::Open(const Identifier& identifier,
								  OpSharedMemory **out)
{
	PosixIdentifier pid;
	RETURN_IF_ERROR(PosixIdentifier::FromIdentifier(pid, identifier));
	if(pid.platformType != PosixSharedMemory::GetPlatformType())
		return OpStatus::ERR_NO_ACCESS;
	AutoLocker locker;
	RETURN_IF_ERROR(locker.Lock(identifier));
	OpSharedPtr<SharedMemoryBlock> mem;
	OpSharedPtr<Attachment> attachment;
	RETURN_IF_ERROR(SharedMemoryBlock::Open(identifier, mem));
	RETURN_IF_ERROR(Attachment::Create(mem, attachment));
	// Increment RefCounter
	RefCounter* rc = reinterpret_cast<RefCounter*>(attachment->GetOffsetPosition(0));
	rc->Increment();
	PosixSharedMemory* posix_shared_memory = OP_NEW(PosixSharedMemory,
										   (mem, attachment));
	RETURN_OOM_IF_NULL(posix_shared_memory);
	*out = posix_shared_memory;
	return OpStatus::OK;
}
コード例 #30
0
/* static */ OP_STATUS
DOM_MutationEvent::SendNodeRemovedFromDocument(ES_Thread *interrupt_thread, DOM_Node *target)
{
	DOM_EnvironmentImpl *environment = target->GetEnvironment();

	DOM_MutationEvent *mutation_event;
	RETURN_IF_ERROR(CreateEvent(mutation_event, environment, DOMNODEREMOVEDFROMDOCUMENT));

	if (mutation_event)
		mutation_event->target = target;

	return SendEvent(mutation_event, environment, interrupt_thread);
}