void CMainControlEngine::CreateDir(const TDesC& aPath, const TDesC& aDirName) { if (NULL == aPath.Length()) return; TFileName fileName; fileName.Append(aPath); if(fileName.Right(1).Compare(_L("\\"))!=0) fileName.Append(_L("\\")); fileName.Append(aDirName); if(fileName.Right(1).Compare(_L("\\"))!=0) fileName.Append(_L("\\")); ::MakeDir(fileName); /*RFs oRFs; User::LeaveIfError(oRFs.Connect()); CDir* pDir; oRFs.GetDir(aPath, KEntryAttNormal|KEntryAttDir, ESortByName, pDir); for (TInt n = 0; pDir && (n < pDir->Count()); n ++) { TEntry oFile = (*pDir)[n]; if (oFile.IsDir()) { TFileName oName = oFile.iName; oName.LowerCase(); TInt n = oName.Compare(aDirName); if (!n) { DELETE(pDir); oRFs.Close(); return; } } } TFileName nDirPathAndName; nDirPathAndName.Append(aPath); nDirPathAndName.Append(aDirName); nDirPathAndName.Append(_L("\\")); oRFs.MkDirAll(nDirPathAndName); DELETE(pDir); oRFs.Close();*/ }
// ----------------------------------------------------------------------------- // CAsf::InitializeL // // ----------------------------------------------------------------------------- // void CAsf::InitializeL() { TFileName name; LOGFN( "CAsf::InitializeL" ); iFile.FullName( name ); if ( name.Right( 4 ).CompareF( KWmaExtension ) == 0 ) { iMimeType.Set( KWmaMimeType ); } else if ( name.Right( 4 ).CompareF( KWmvExtension ) == 0 || name.Right( 4 ).CompareF( KAsfExtension ) == 0 ) { iMimeType.Set( KWmvMimeType ); } ValidateL(); }
TBool CRefTestAgentManager::IsRecognizedL(RFile& aFile) const { TBool result = EFalse; // Get the name of the file TFileName fileName; aFile.Name(fileName); // Check that the file has content only, otherwise it should // be put through the supplier API before it can be used TPtrC extension(fileName.Right(KRtaExtensionContent().Length())); if(extension.CompareF(KRtaExtensionContent) == 0) { result = ETrue; } return result; }
void CFileExecuter::OpenFileByDefault(TFileName aFileName) { if (::FileIsExist(aFileName)==1) { iFileName.Zero (); iFileName.Append(aFileName); TInt i = aFileName.LocateReverseF('.'); if(i<0) { iMainEngine.ControlFactory().CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_FileTypeNotSupport),*this,0); return; } TFileName nFileExt = aFileName.Right( aFileName.Length() - i - 1 ); nFileExt.ZeroTerminate(); iMainEngine.WriteLog16(nFileExt); TFileName nAssociatedApp; TBool nIsFindApp = GetAssociatedApp( nFileExt, nAssociatedApp ); if ( nIsFindApp == true) { if (nAssociatedApp.Find(KDefaultAppPath)!=KErrNotFound) { OpenFileBySystemDefaultL(aFileName); } else if ( nAssociatedApp.FindF( KCoCoAppPath )!=KErrNotFound) { //使用内部模块打开 OpenFileByInternal(aFileName); } else { OpenFileByApp(nAssociatedApp,aFileName); } } else { //如果没有默认的打开方式 TInt nType=ParseExPathNum(aFileName); #ifdef __SERIES60_3X__ if(nType==0 || nType==1 || nType==2 || nType==3) #else if(nType==0 || nType==1 || nType==2 || nType==3 || nType==4) #endif { //使用内部模块打开 OpenFileByInternal(aFileName); } else { //采用系统默认方式打开 OpenFileBySystemDefaultL(aFileName); } } } else { //提示用户文件不存在 iMainEngine.ControlFactory().CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_FileNotExist),*this,0); } }
/** Performs any necessary configuration file updates to the database if a configuration file exists for the database that has not yet been processed. If a configuration file is processed then the database settings table will be updated with the version of the configuration file that was processed. @param aStoredDbConfigFileVersion The configuration file version that is currently stored in the settings table @param aFileData The database file data @param aDbName Logical database name: "main" for the main database or attached database name @leave One of the system-wide error codes or SQL errors of ESqlDbError type @panic SqlDb 2 In _DEBUG mode if iDbHandle is NULL (uninitialized TSqlDbSysSettings object) */ void TSqlDbSysSettings::ConfigureDatabaseL(TInt aStoredDbConfigFileVersion, const TSqlSrvFileData& aFileData, const TDesC& aDbName) { SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL_ENTRY, "Entry;0x%X;TSqlDbSysSettings::ConfigureDatabaseL", (TUint)this)); __ASSERT_DEBUG(iDbHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj)); if(!aFileData.IsSecureFileNameFmt()) { //As a first implementation, config files will only be supported for //shared, secure databases - not for private, secure databases or public databases SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL_EXIT1, "Exit;0x%X;TSqlDbSysSettings::ConfigureDatabaseL;Not a secure db", (TUint)this)); return; } //Determine whether there is a configuration file //for this database that has not yet been processed const CDbConfigFiles* dbConfigFiles = aFileData.DbConfigFiles(); if(dbConfigFiles) { //Get the database file name and extension to search for a corresponding config file TPtrC dbName = aFileData.FileName(); TParse parse; __SQLLEAVE_IF_ERROR(parse.Set(dbName, NULL, NULL)); TPtrC dbFileNameAndExt = parse.NameAndExt(); HBufC* matchingConfigFile = dbConfigFiles->FindConfigFile(dbFileNameAndExt); if(matchingConfigFile) { //There exists a config file for this database - now check whether its //version is greater than the version stored in the settings table and //only process the file if it is TFileName configFileName; configFileName.Copy(matchingConfigFile->Des()); TInt offset = configFileName.LocateReverse('.') ; if(KErrNotFound != offset) { TInt lengthOfExt = configFileName.Length() - offset - 1; TPtrC versionNum = configFileName.Right(lengthOfExt); TLex lex(versionNum); TInt fileVersion = 0; if(KErrNone == lex.Val(fileVersion)) { if(fileVersion > aStoredDbConfigFileVersion) { //The latest version of the configuration file has not yet been processed, so do it now SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL1, "0x%X;TSqlDbSysSettings::ConfigureDatabaseL;Config file '%S'", (TUint)this, __SQLPRNSTR(configFileName))); ExecuteConfigurationUpdateL(aFileData, configFileName, fileVersion, aDbName); SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL2, "0x%X;TSqlDbSysSettings::ConfigureDatabaseL;Config file '%S' was processed, no errors", (TUint)this, __SQLPRNSTR(configFileName))); } else { SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL3, "0x%X;TSqlDbSysSettings::ConfigureDatabaseL;Config file '%S' as this or a later version has already been processed", (TUint)this, __SQLPRNSTR(configFileName))); } } else { //Invalid config file name extension - it cannot be converted to an integer __SQLLEAVE(KErrCorrupt); } } else { //Invalid config file name - it doesn't contain the character '.' __SQLLEAVE(KErrCorrupt); } } else { SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL4, "0x%X;TSqlDbSysSettings::ConfigureDatabaseL;No config file found for database '%S'", (TUint)this, __SQLPRNSTR(dbFileNameAndExt))); } } SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, TSQLDBSYSSETTINGS_CONFIGUREDATABASEL_EXIT2, "Exit;0x%X;TSqlDbSysSettings::ConfigureDatabaseL", (TUint)this)); }
void CFileEngine::PasteFile(const TDesC& aFilaName) { if(NULL == iCopiedFile) { iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_Copy_NotSelect),*this,ECmdNull); } else { if(!BaflUtils::FileExists(iFs,*iCopiedFile)) { iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_FilePaste_SourceNotExist),*this,ECmdCancelCopy); } else { TParse parse; parse.Set(*iCopiedFile,NULL,NULL); const TDesC& driveAndPath = parse.DriveAndPath(); const TDesC& nameAndExt = parse.NameAndExt(); TFileName desFileName; TBool isFolder = EFalse; TInt err = BaflUtils::IsFolder(iFs,aFilaName,isFolder); if(KErrNone == err && isFolder) { desFileName.Append(aFilaName); if(desFileName.Right(1).Compare(_L("\\"))!=0) { desFileName.Append(_L("\\")); } desFileName.Append(nameAndExt); } else { TParse parseDes; parseDes.Set(aFilaName,NULL,NULL); desFileName.Append(parseDes.DriveAndPath()); if(parseDes.DriveAndPath().Right(1).Compare(_L("\\"))!=0) { desFileName.Append(_L("\\")); } desFileName.Append(nameAndExt); } iMainEngine.WriteLog16(*iCopiedFile); iMainEngine.WriteLog16(desFileName); TInt result = CheckDiskSpace(*iCopiedFile,desFileName); if(1 == result) { iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_SaveAs_NoSpace),*this,ECmdCancelCopy); } else if(2 == result) { iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_FilePaste_OtherError),*this,ECmdCancelCopy); } else { if(BaflUtils::FileExists(iFs,desFileName)) { TParse parseTemp; parseTemp.Set(desFileName,NULL,NULL); desFileName.Zero(); desFileName.Append(parseTemp.DriveAndPath()); desFileName.Append(iMainEngine.GetDesById(ETurkeyTextRes_Copy_SameName)); desFileName.Append(parseTemp.NameAndExt()); } iFileActiveEngine.CopyFile(*iCopiedFile,desFileName,this); iDialog = iControlFactory.CreateWaitDialog(iMainEngine.GetDesById(ETurkeyTextRes_NewSearch_SaveFile),*this,ECmdCopying); delete iCopiedFile; iCopiedFile = NULL; } //CleanupStack::PopAndDestroy(); //desFileName } } }