Exemplo n.º 1
0
static void SetupFeatureNew()
{
	FormPtr form = FrmGetActiveForm();
	if (FormIsNot(form, FormReply)) return;

	char* data;
	Err err = FtrGet(appFileCreator, FEATURE_COMPOSE_NEW, (UInt32 *) &data);
	if (err) return;
	char* pszTo = data;
	SetFieldText((FieldPtr) GetObjectPtr(form, FieldTo), pszTo);
	FtrPtrFree(appFileCreator, FEATURE_COMPOSE_NEW);

	FrmSetFocus(form, FrmGetObjectIndex(form, FieldCompose));
}
Exemplo n.º 2
0
static void RestoreReplyForm()
{
	FormPtr form = FrmGetActiveForm();
	if (FormIsNot(form, FormReply)) return;

	FasSearchInfoType FasSearchInfo;
	if (FasGetSearchInfo(&FasSearchInfo) == fasNoSearchInfo) return;

	char* data;
	Err err = FtrGet(appFileCreator, FEATURE_FINGER_ADDR, (UInt32 *) &data);
	if (err) return;

	UInt16 mode = *(UInt16*)data;
	data += sizeof(UInt16);
	
	char* pszTo = data;
	data += StrLen(pszTo) + 1;
	
	char* pszCompose = data;
	data += StrLen(pszCompose) + 1;
	
	char* pszReference = data;
	
	FieldPtr fieldTo = (FieldPtr) GetObjectPtr(form, FieldTo);
	FieldPtr fieldCompose = (FieldPtr) GetObjectPtr(form, FieldCompose);
	FieldPtr fieldReference = (FieldPtr) GetObjectPtr(form, FieldReference);

	if (FasSearchInfo.pPhoneNumber) {
		SetFieldText(fieldTo, FasSearchInfo.pPhoneNumber);
	} else {
		SetFieldText(fieldTo, pszTo);
	}

	SetFieldText(fieldCompose, pszCompose);
	SetFieldText(fieldReference, pszReference);
	
	if (mode == COMPOSE_REPLY) {
		SetupReplyForm(form);
	} else {
		SetupNewForm(form);
	}
	FrmSetFocus(form, FrmGetObjectIndex(form, FieldCompose));
	g_ComposeMode = (ComposeMode) mode;
		
	FtrPtrFree(appFileCreator, FEATURE_FINGER_ADDR);
}
UInt32 PilotMain(UInt16 launchCode, MemPtr launchParameters, UInt16 launchFlags)
{
	UInt32 Value;
	UInt32 Result = errNone;
	UInt32 CPU;
	launch Launch;
	Launch.launchParameters = launchParameters;
	Launch.launchCode = launchCode;
	Launch.launchFlags = launchFlags;

	if ((launchCode == sysAppLaunchCmdNormalLaunch ||
		launchCode == sysAppLaunchCmdOpenDB ||
		launchCode == sysAppLaunchCmdCustomBase) && !RomVersionCheck(launchFlags))
	{
		FtrGet(sysFileCSystem, sysFtrNumProcessorID, &CPU);
		if (CPU == sysFtrNumProcessorx86)
		{
			Module = PealLoadFromResources('armc', 1000, NULL, PROJECT_FOURCC,32,0,0,0); // just for testing

			Launch.FreeModule = PealUnload;
			Launch.LoadModule = LoadModule;
			Launch.GetSymbol = LookupSymbol86;
			Launch.PealCall = PealCall86;
			Launch.Module = Module;
			PceNativeCall(PALMOS_IX86_FUNC(PROJECT_OUTPUT,PaceMain86),&Launch);

			if (Module)
				PealUnload(Module);
		}
		else
		if (sysFtrNumProcessorIsARM(CPU))
		{
			UInt32 Version;
			Boolean MemSema;

			FtrGet(sysFtrCreator, sysFtrNumROMVersion, &Version);
			MemSema = Version < sysMakeROMVersion(6,0,0,sysROMStageDevelopment,0);

			Module = PealLoadFromResources('armc', 1000, NULL, PROJECT_FOURCC,32,0,0,MemSema);
			if (Module)
			{
				PaceMain = PealLookupSymbol(Module, "PaceMain");
				if (PaceMain)
				{
					Launch.FreeModule = PealUnload;
					Launch.LoadModule = LoadModule;
					Launch.GetSymbol = PealLookupSymbol;
					Launch.PealCall = PealCall;
					Launch.Module = Module;

					Result = PealCall(Module,PaceMain,&Launch);
				}
				PealUnload(Module);
				MemHeapCompact(GetHeapId()); 
			}
		}
		else
			FrmCustomAlert(WarningOKAlert, "ARM processor is required to run this application!", " ", " ");

		if (FtrGet(PROJECT_FOURCC,20,&Value)==errNone)
			FtrPtrFree(PROJECT_FOURCC,20);
	}
	else
	if (launchCode == sysAppLaunchCmdNotify && (launchFlags & sysAppLaunchFlagSubCall)!=0)
	{
		FtrGet(sysFileCSystem, sysFtrNumProcessorID, &CPU);
		if (CPU == sysFtrNumProcessorx86)
			Result = PceNativeCall(PALMOS_IX86_FUNC(PROJECT_OUTPUT,PaceMain86),&Launch);
		else
		if (sysFtrNumProcessorIsARM(CPU) && Module && PaceMain)
			Result = PealCall(Module,PaceMain,&Launch);
	}
	return Result;
}