当前位置: 首页>>代码示例>>C++>>正文


C++ TFileName::Insert方法代码示例

本文整理汇总了C++中TFileName::Insert方法的典型用法代码示例。如果您正苦于以下问题:C++ TFileName::Insert方法的具体用法?C++ TFileName::Insert怎么用?C++ TFileName::Insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TFileName的用法示例。


在下文中一共展示了TFileName::Insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: storageLocation

QString QDesktopServices::storageLocation(StandardLocation type)
{
    TFileName path;

    switch (type) {
    case DesktopLocation:
        qWarning("No desktop concept in Symbian OS");
        // But lets still use some feasible default
        path.Append(writableDataRoot());
        break;
    case DocumentsLocation:
        path.Append(writableDataRoot());
        break;
    case FontsLocation:
        path.Append(KFontsDir);
        break;
    case ApplicationsLocation:
        path.Append(exeDrive().Name());
        path.Append(KSysBin);
        break;
    case MusicLocation:
        path.Append(writableDataRoot());
        path.Append(PathInfo::SoundsPath());
        break;
    case MoviesLocation:
        path.Append(writableDataRoot());
        path.Append(PathInfo::VideosPath());
        break;
    case PicturesLocation:
        path.Append(writableDataRoot());
        path.Append(PathInfo::ImagesPath());
        break;
    case TempLocation:
        return QDir::tempPath();
        break;
    case HomeLocation:
        path.Append(writableDataRoot());
        //return QDir::homePath(); break;
        break;
    case DataLocation:
        qt_s60GetRFs().PrivatePath(path);
        path.Insert(0, writableExeDrive().Name());
        break;
    case CacheLocation:
        qt_s60GetRFs().PrivatePath(path);
        path.Insert(0, writableExeDrive().Name());
        path.Append(KCacheSubDir);
        break;
    default:
        // Lets use feasible default
        path.Append(writableDataRoot());
        break;
    }

    // Convert to cross-platform format and clean the path
    QString nativePath = QString::fromUtf16(path.Ptr(), path.Length());
    QString qtPath = QDir::fromNativeSeparators(nativePath);
    qtPath = QDir::cleanPath(qtPath);

    // Note: The storage location returned can be a directory that does not exist;
    // i.e., it may need to be created by the system or the user.
    return  qtPath;
}
开发者ID:DreamOnTheGo,项目名称:src,代码行数:63,代码来源:qdesktopservices_s60.cpp

示例2: DumpJsFileL

void ScrShotsGenUtils::DumpJsFileL(CScrShotsSettings* scrShotsSettings)
{
    CGetImei* getImei = CGetImei::NewL();
    CleanupStack::PushL(getImei);
    RBuf8 formatBuf;
    formatBuf.Create(256);
    formatBuf.CleanupClosePushL();
    TFileName infoFile;
    
    User::LeaveIfError(CEikonEnv::Static()->FsSession().PrivatePath(infoFile));
    infoFile.Append( KDeviceJSFile );
    TParsePtrC parse((CEikonEnv::Static()->EikAppUi()->Application())->AppFullName());
    infoFile.Insert(0, KCDriveWithColon);
    
    RFs fsConn;
    User::LeaveIfError(fsConn.Connect());
    CleanupClosePushL(fsConn);
    RFile jsFile;
    if(BaflUtils::FileExists(fsConn, infoFile)){
        BaflUtils::DeleteFile(fsConn, infoFile);
    }
    //now create the file
    User::LeaveIfError(jsFile.Create(fsConn, infoFile, EFileWrite));
    CleanupClosePushL(jsFile);
    
//    User::LeaveIfError(jsFile.Write(KFunctionBlockStart));
    RBuf8 values;
    values.Create(256);
    for(int i = 0; i < KDeviceParamsCount ; i++){
        formatBuf.Zero();
        TInt sizeOfItem = User::StringLength((TText8 *)DeviceParams [i]);
        TPtr8 item((unsigned char*)DeviceParams [i],sizeOfItem ,sizeOfItem );
        switch(i){
            //device_model
            case 0:{
                CDeviceTypeInformation* devInfo = SysUtil::GetDeviceTypeInfoL();
                CleanupStack::PushL(devInfo);
                TPtrC manufName, modelCode, modelName;
                devInfo->GetManufacturerName(manufName);
                devInfo->GetModelCode(modelCode);
                devInfo->GetModelName(modelName);
                RBuf8 manufName8, modelName8, modelCode8;
                manufName8.Create(128); modelName8.Create(128); modelCode8.Create(128);
                manufName8.CleanupClosePushL(); modelName8.CleanupClosePushL(); modelCode8.CleanupClosePushL();
                manufName8.Copy(manufName);
                modelName8.Copy(modelName);
                modelCode8.Copy(modelCode);
                values.Format(KModelNameFormatString, &manufName8, &modelName8, &modelCode8);
                CleanupStack::PopAndDestroy(4);
                break;
            }
            //firmware_version
            case 1:{
                RBuf swVersion;
                swVersion.Create(128);
                SysUtil::GetSWVersion(swVersion);
                values.Copy(swVersion);
                TInt pos = 0;
                while((pos = values.Find(_L8("\n"))) != KErrNotFound){
                    //values.Delete(pos,1);
                    values.Replace(pos,1,_L8("_"));
                }
                swVersion.Close();
                break;
            }
            
            //ram_info
            case 2:{
                TInt totalram= 0;
                HAL::Get(HALData::EMemoryRAM, totalram);
                totalram /= 1024;
                values.Num(totalram);
                break;
            }
            
            //uptime
            case 3:{
                TTimeIntervalMicroSeconds32 iTickPeriod;
                UserHal::TickPeriod(iTickPeriod);
                TUint tickCount = User::TickCount();
                TUint noOfTicksPerSecond = (1000 * 1000) / iTickPeriod.Int();
                TInt noOfSecsSinceStartUp = tickCount / noOfTicksPerSecond;//noOfMicroSecsSinceStartup / (1000 * 1000);
                values.Num(noOfSecsSinceStartUp);
                break;
            }
            
            //scrshot count
            case 4:{
                values.Num(scrShotsSettings->TotalScrShotCount());
                break;
            }
            
            //symbian version
            case 5:{
                TVersion epocver = User::Version();
                values.Copy(epocver.Name());            
                break;
            }
            
            //series 60 version
//.........这里部分代码省略.........
开发者ID:eminemence,项目名称:pre-2013-prjs,代码行数:101,代码来源:ScrShotsGenUtils.cpp

示例3: CreateAppIconLC

EXPORT_C void AknsUtils::CreateAppIconLC(
    MAknsSkinInstance* aInstance, TUid aAppUid,
    TAknsAppIconType aType,
    CFbsBitmap*& aBitmap, CFbsBitmap*& aMask )
    {
    aBitmap = NULL;
    aMask = NULL;

    if (!aInstance)
        {
        User::Leave(KErrArgument);
        }

    TSize legacySize( 42, 29 );
    TInt bitmapIndex( 0 );
    TInt maskIndex( 1 );
    if( aType == EAknsAppIconTypeContext )
        {
        legacySize = TSize( 44, 44 );
        bitmapIndex = 2;
        maskIndex = 3;
        }
    else if( aType != EAknsAppIconTypeList )
        {
        User::Leave( KErrArgument );
        }

    // Make the forthcoming pushes safe (up to level 2)
    CleanupStack::PushL( static_cast<TAny*>(NULL) );
    CleanupStack::PushL( static_cast<TAny*>(NULL) );
    CleanupStack::Pop( 2 );

    // 1. Check if the icon has been configured.
    TInt ret = KErrNone;
    TBool configuredIcon = EFalse;
    //
    CAknsAppSkinInstance* apskin = static_cast<CAknsAppSkinInstance*>(aInstance);
    if ( apskin )
        {
        TInt config = apskin->IsIconConfiguredL( aAppUid );
        if ( config > 0 )
        configuredIcon = ETrue;
        }

    if ( !configuredIcon )
        {
        // 2. Skin-originating icon
        ret = GetAppIconFromSkin( aInstance, aAppUid, legacySize, aBitmap, aMask );
        if( ret == KErrNone )
            {
            // These pushes are safe
            CleanupStack::PushL( aBitmap ); // (1)
            CleanupStack::PushL( aMask ); // (2)
            return;
            }
        }
    // Cache connected apparc session for future reuse, if not already cached
    // This is done per appskininstance when necessary...
    if (!apskin->iCachedApaSession)
        {
        apskin->iCachedApaSession = new (ELeave) RApaLsSession;
        User::LeaveIfError(apskin->iCachedApaSession->Connect());
        }

    RApaLsSession* lsSession = apskin->iCachedApaSession;

    TBool forceDefaultIcon = EFalse;

    TApaAppInfo appInfo;
    TFileName filename;
    // 3. New appicon framework
    HBufC* filenameBuf = NULL;
    TBool javaIcon = EFalse;
    ret = lsSession->GetAppIcon( aAppUid, filenameBuf );
    if( filenameBuf )
        {
        filename.Copy( *filenameBuf );
        delete filenameBuf;
        }
    if( ret == KErrNone )
        {
        ret = lsSession->GetAppInfo( appInfo, aAppUid );
        }
    if( (ret==KErrNone) && (filename.Length()>2) &&
        (appInfo.iFullName.Length()>2) )
        {
        // Correct drive letter, if necessary
        if( appInfo.iFullName[1]==':' )
            {
            if( filename[1]==':' )
                {
                filename[0] = appInfo.iFullName[0];
                }
            else if( filename[0]=='\\' )
                {
                filename.Insert( 0, appInfo.iFullName.Left(2) );
                }
            }

        // check if the icon is java icon
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:101,代码来源:AknsUtilsAppIcon.cpp

示例4: ResolveUidL

TUid CDeploymentComponentData::ResolveUidL(RFs& aFs)
    {
    RDEBUG("CDeploymentComponentData::ResolveUidL()");

    TUid ret(TUid::Null() );
    HBufC* buf = HBufC::NewLC(KMaxFileName);
    TPtr16 ptr = buf->Des();
    ptr.Copy(iDataFileName);

    // if PIP/DRM package, we need to use license manager to extract the sis file
    if (iMimeType == KPipMimeType || iMimeType == KDrmMessageMimeType
            || iMimeType == KDrmContentMimeType)
        {
        RDEBUG8_2("	-> mime: %S", &iMimeType );

        RFile originalFile;
        RFile decryptedFile;
        TFileName decryptedTempFileName;

        RDEBUG_2("	-> opening original file: %S", &ptr );
        // leave if can not open the original file
        User::LeaveIfError(originalFile.Open(aFs, ptr, EFileWrite) );
        RDEBUG("	-> done");

        // First construct the temp path
        User::LeaveIfError(aFs.PrivatePath(decryptedTempFileName) );
        // set drive letter into the path
        decryptedTempFileName.Insert( 0, TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() );
        // append "piptemp\\"	
        decryptedTempFileName.Append(KTempDir);
        // create the folder
        aFs.MkDir(decryptedTempFileName);

        // Use license manager to extract files from the pip package
        CDRMLicenseManager* licenseMgr = CDRMLicenseManager::NewL();
        CleanupStack::PushL(licenseMgr);
        // decryp from the original file into the temp file   
        RDEBUG_2("	-> extracting SIS file into: %S", &decryptedTempFileName);
        User::LeaveIfError(licenseMgr->ExtractSISFileL(originalFile,
                decryptedTempFileName) );
        RDEBUG("	-> done");

        // Get the sis file name 
        decryptedTempFileName.Append( *(licenseMgr->GetSISMemberL()->Name() ));
        // open temporary handle to it.
        RDEBUG_2("	-> opening decrypted file: %S", &decryptedTempFileName );
        User::LeaveIfError(decryptedFile.Open(aFs, decryptedTempFileName,
                EFileShareAny) );
        RDEBUG("	-> done");
        // parse the uid from the file
        ret = ParseUidFromSisFileL(decryptedFile);

        // no use anymore for the decrypted file
        decryptedFile.Close();
        // delete the temp file
        TInt err = aFs.Delete(decryptedTempFileName);
        if (err != KErrNone)
            {
            RDEBUG_2("**** ERROR, unable to delete temporary file: %S", &decryptedTempFileName );
            }

        CleanupStack::PopAndDestroy(licenseMgr);
        decryptedFile.Close();
        originalFile.Close();
        }
    else
        if (iMimeType == KSisxMimeType || iMimeType == KSisMimeType )
            {
            RDEBUG("	-> mime: x-epoc/x-sisx-app");
            RFile originalFile;
            RDEBUG_2("	-> opening file: %S", &ptr );
            User::LeaveIfError(originalFile.Open(aFs, ptr, EFileRead) );
            RDEBUG("	-> opened ok");
            ret = ParseUidFromSisFileL(originalFile);
            originalFile.Close();
            }

        else
            {
            RDEBUG8_2( "**** ERROR - CDeploymentComponentData::ResolveUidL( ) - cannot get uid from mime type: %S", &iMimeType );
            }

    CleanupStack::PopAndDestroy(buf);
    return ret;
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:85,代码来源:AMDeploymentComponentData.cpp


注:本文中的TFileName::Insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。