Пример #1
0
bool OpenFileBySystem(C_application_base &app, const wchar *filename, dword app_uid){

   Cstr_w full_path;
   C_file::GetFullPath(filename, full_path);
   TPtrC fn((word*)(const wchar*)full_path);

   int err = 0;
   {
      RApaLsSession ls;
      ls.Connect();
#if !defined __SYMBIAN_3RD__
      //if(!app_uid)
      {
         TThreadId tid;
         err = 1;
         if(!app_uid){
            TRAPD(te, err = ls.StartDocument(fn, tid));
         }else{
            TUid uid;
            uid.iUid = app_uid;
            TRAPD(te, err = ls.StartDocument(fn, uid, tid));
         }
      }//else
//#endif
#else
      {
         TUid uid;
         if(app_uid){
            uid.iUid = app_uid;
            err = 0;
         }else{
#if defined __SYMBIAN_3RD__
            TDataType dt;
            err = ls.AppForDocument(fn, uid, dt);
#endif
         }
         if(!err){
            TApaAppInfo ai;
            err = ls.GetAppInfo(ai, uid);
            if(!err){
               //User::Panic(ai.iFullName, 0);
               CApaCommandLine *cmd = CApaCommandLine::NewL();
#ifdef __SYMBIAN_3RD__
               cmd->SetExecutableNameL(ai.iFullName);
#else
               cmd->SetLibraryNameL(ai.iFullName);
#endif
               cmd->SetDocumentNameL(fn);
               cmd->SetCommandL(EApaCommandOpen);
               err = ls.StartApp(*cmd);
               delete cmd;
            }
         }
      }
#endif
      ls.Close();
   }
   return (!err);
}
Пример #2
0
void CFileExecuter::OpenFileBySystemDefaultL(TFileName aFileName)
{
	#ifndef __SERIES60_3X__
	{
		//如果是Jar、Sis或Sisx文件则调用内容打开
		TInt nType=ParseExPathNum(aFileName);

		if (nType==2)
		{
			OpenAppFile(aFileName);

			return;
		}
	}
	#endif
	
	TDataType empty=TDataType();

	#ifdef __SERIES60_3X__
	{
		iDocHandler->SetExitObserver(this);

		TRAPD(error,iDocHandler->OpenFileEmbeddedL(aFileName,empty));
	}
	#else
	{
		iDocHandler->OpenFileL(aFileName,empty );

		//If the standalone handler is already running then update the
		//document file
		TUid handlerUid;
		TInt err = KErrNone;

		#ifdef __SERIES60_3X__
		err = iDocHandler->HandlerAppUid(handlerUid);
		#else
		RApaLsSession apaLs;
		User::LeaveIfError( apaLs.Connect() );
		err = apaLs.AppForDocument(aFileName, handlerUid, empty);  
		apaLs.Close();          
		#endif

		if( !err )
		{
			RefreshDocumentFileL(handlerUid, aFileName);
		}
		else if( err == KNotInitialized )
		{
			//Handler not initialized
		}
		else
		{
			//Some other error
		}

	}
	#endif
}
// -----------------------------------------------------------------------------
// CPhoneRingingTone::RefreshMimeL
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//    
void CPhoneRingingTone::RefreshMimeL()
    {
    RApaLsSession apaLsSession;
    User::LeaveIfError( apaLsSession.Connect() );
    CleanupClosePushL( apaLsSession );

    TUid dummyUid = { 0 };
    TDataType dataType( dummyUid );
    
    User::LeaveIfError(
        apaLsSession.AppForDocument( *iFileName, dummyUid, dataType ) );
        
    CleanupStack::PopAndDestroy(); // CleanupClosePushL
    
    delete iMimeType;
    iMimeType = NULL;
    iMimeType = dataType.Des().AllocL();
    }
Пример #4
0
TVerdict CMultipartContent::doTestStepL()
	{
	_LIT(KxcafMime, "application/x-caf");
	
	TPtrC contentXml;
	TPtrC contentXml2;
	TPtrC outputFile;
	TPtrC outputFile2;
	TPtrC contentFile;
	TPtrC contentFile2;
	GetStringFromConfig(ConfigSection(),_L("ContentDescription"),contentXml);
	GetStringFromConfig(ConfigSection(),_L("ContentDescription2"),contentXml2);
	GetStringFromConfig(ConfigSection(),_L("OutputFile"),outputFile);
	GetStringFromConfig(ConfigSection(),_L("OutputFile2"),outputFile2);
	GetStringFromConfig(ConfigSection(),_L("ContentFile"), contentFile);
	GetStringFromConfig(ConfigSection(),_L("ContentFile2"), contentFile2);
	__UHEAP_MARK;	
	
	INFO_PRINTF1(_L("Creating DRM archive using the following parameters"));
	INFO_PRINTF2(_L("		Content Xml Description : %S"),&contentXml);
	INFO_PRINTF2(_L("		Output File             : %S"),&outputFile);
	INFO_PRINTF2(_L("		Output File2             : %S"),&outputFile2);
	INFO_PRINTF2(_L("		Content File            : %S"),&contentFile);
	INFO_PRINTF2(_L("		Content File2            : %S"),&contentFile2);

	// will need to modify the output file name
	TFileName outputFileName;
	TFileName outputFileName2;
	outputFileName.Copy(outputFile);
	outputFileName2.Copy(outputFile2);

	TBuf8 <KMaxDataTypeLength> mimeType;
	
	// Pass empty path to rights file to produce a ".content" file
	User::LeaveIfError(CRefTestAgentArchive::CreateArchive(contentXml, _L(""), outputFileName, mimeType));
	User::LeaveIfError(CRefTestAgentArchive::CreateArchive(contentXml2, _L(""), outputFileName2, mimeType));


	TDataType dataType;
	TUid uid = KNullUid;

	// Use the Application Architecture Server to find the Mime type 

	RApaLsSession apparcSession;
	User::LeaveIfError(apparcSession.Connect());
	CleanupClosePushL(apparcSession);
	User::LeaveIfError(apparcSession.AppForDocument(contentFile, uid, dataType));
	// dataType should be of type "application/x-caf"
	if (dataType.Des() != KxcafMime)
    	{
    	SetTestStepResult(EFail);
    	}
	User::LeaveIfError(apparcSession.AppForDocument(contentFile2, uid, dataType));
	// dataType should not be of type "application/x-caf"
	if (dataType.Des() == KxcafMime)
    	{
    	SetTestStepResult(EFail);
    	}
    
    CleanupStack::PopAndDestroy(&apparcSession);
    
    __UHEAP_MARKEND;
    
    
    
	return TestStepResult();
	}