Пример #1
0
void PrefsLoader::HandleCallback(OpMessage msg, MH_PARAM_1 par1, MH_PARAM_2 par2)
{
	switch(msg)
	{
	case MSG_URL_LOADING_FAILED:
		FinishLoading(par2);
		break;

	case MSG_URL_DATA_LOADED:
		LoadData(par1);
		break;

	case MSG_URL_MOVED:
		{
			MessageHandler *mmh = g_main_message_handler;
			mmh->UnsetCallBack(this, MSG_URL_DATA_LOADED);
			mmh->UnsetCallBack(this, MSG_URL_LOADING_FAILED);
			mmh->UnsetCallBack(this, MSG_URL_MOVED);
			mmh->SetCallBack(this, MSG_URL_DATA_LOADED, par2);
			mmh->SetCallBack(this, MSG_URL_LOADING_FAILED, par2);
			mmh->SetCallBack(this, MSG_URL_MOVED, par2);
		}
		break;
	}
}
Пример #2
0
OP_STATUS PrefsLoader::StartLoading()
{
	MessageHandler *mmh = g_main_message_handler;
	CommState stat = m_serverURL->Load(mmh, URL(),FALSE,FALSE,FALSE,FALSE);

	if(stat == COMM_REQUEST_FAILED)
		return OpStatus::ERR;

	URL_ID url_id = m_serverURL->Id();

	OP_STATUS rc = OpStatus::OK;
	if (OpStatus::IsError(rc = mmh->SetCallBack(this, MSG_URL_DATA_LOADED, url_id)) ||
		OpStatus::IsError(rc = mmh->SetCallBack(this, MSG_URL_MOVED, url_id)) ||
		OpStatus::IsError(rc = mmh->SetCallBack(this, MSG_URL_LOADING_FAILED, url_id)))
	{
		mmh->UnsetCallBacks(this);
	}
	return rc;
}
Пример #3
0
void OpConsolePrefsHelper::ConstructL()
{
	// Register as listener to relevant preferences
	g_pccore->RegisterListenerL(this);
	g_pcfiles->RegisterFilesListenerL(this);

	// Register with the message handler
	MessageHandler *mmh = g_main_message_handler;
	mmh->SetCallBack(this, MSG_CONSOLE_RECONFIGURE, 0);

	// Set up the logger later
	mmh->PostMessage(MSG_CONSOLE_RECONFIGURE, 0, 0);
}