void CGNAppletAppUi::ConstructL(void) { TFileName file; int pos; BaseConstructL(ENoAppResourceFile); file.Copy(Application()->AppFullName()); pos = file.LocateReverse('\\'); file.Replace(pos, file.Length() - pos, _L("\\gnapplet.exe")); EikDll::StartExeL(file); User::Exit(0); }
EXPORT_C void LoadIcons(CArrayPtrFlat<CGulIcon> * aIconList, const TIconID* aIconDefs, TInt aNbIcons, TInt aScale) { CALLSTACKITEM_N(_CL(""), _CL("LoadIcons")); TFileName real; TFileName prev; CEikonEnv* env=CEikonEnv::Static(); RFs& fs=env->FsSession(); CWsScreenDevice* screen=env->ScreenDevice(); RWsSession& ws=env->WsSession(); RArray<TInt> Offsets; RFile File; bool file_is_open=false; CleanupClosePushL(Offsets); RFileReadStream s; int j=0; bool romfile=false; for (int i = 0; i<aNbIcons;i++) { TPtrC file((TText16*)aIconDefs[i].iMbmFile); #ifdef __S60V3__ if (file.FindF(_L("avkon"))==KErrNotFound) { #endif if (prev.Compare(file)) { #ifndef __S60V3__ real=file; #else TParse p; p.Set(file, 0, 0); real=_L("c:\\resource\\"); real.Append(p.NameAndExt()); #endif #ifdef __WINS__ real.Replace(0, 1, _L("z")); #else if (! BaflUtils::FileExists(fs, real)) { real.Replace(0, 1, _L("e")); } #endif prev=file; if (file_is_open) { s.Close(); file_is_open=false; } if (real.Left(1).CompareF(_L("z"))==0) { romfile=true; } else { romfile=false; GetIconInfo(real, fs, File, s, Offsets, j); file_is_open=true; } ++j; } auto_ptr<CWsBitmap> bitmap(new (ELeave) CWsBitmap(ws)); if (!romfile) { RFile f1=File; s.Attach(f1, Offsets[aIconDefs[i].iBitmap]); bitmap->InternalizeL(s); } else { TInt err=bitmap->Load(real, aIconDefs[i].iBitmap); if (err!=KErrNone) User::Leave(err); } bitmap->SetSizeInTwips(screen); #ifdef __S60V2__ if (aScale>1) { auto_ptr<CWsBitmap> scaled(new (ELeave) CWsBitmap(ws)); ScaleFbsBitmapL(bitmap.get(), scaled.get(), aScale); bitmap=scaled; } #endif auto_ptr<CWsBitmap> mask(NULL); if ( aIconDefs[i].iMask != KErrNotFound ) { mask.reset(new (ELeave) CWsBitmap(ws)); if (!romfile) { RFile f2=File; s.Attach(f2, Offsets[aIconDefs[i].iMask]); mask->InternalizeL(s); } else { User::LeaveIfError(mask->Load(real, aIconDefs[i].iMask)); } mask->SetSizeInTwips(screen); #ifdef __S60V2__ if (aScale>1) { auto_ptr<CWsBitmap> scaled(new (ELeave) CWsBitmap(ws)); ScaleFbsBitmapL(mask.get(), scaled.get(), aScale); mask=scaled; } #endif } auto_ptr<CGulIcon> icon(CGulIcon::NewL(bitmap.get(), mask.get())); bitmap.release(); mask.release(); aIconList->AppendL(icon.get()); icon.release(); #ifdef __S60V3__ } else { auto_ptr<CFbsBitmap> bitmap(0); auto_ptr<CFbsBitmap> mask(0); if ( aIconDefs[i].iMask != KErrNotFound ) { CFbsBitmap *bitmapp=0, *maskp=0; AknIconUtils::CreateIconL(bitmapp, maskp, AknIconUtils::AvkonIconFileName(), aIconDefs[i].iBitmap, aIconDefs[i].iMask); bitmap.reset(bitmapp); mask.reset(maskp); } else { bitmap.reset(AknIconUtils::CreateIconL(AknIconUtils::AvkonIconFileName(), aIconDefs[i].iBitmap)); } bitmap->SetSizeInTwips(screen); if (mask.get()) mask->SetSizeInTwips(screen); auto_ptr<CGulIcon> icon(CGulIcon::NewL(bitmap.get(), mask.get())); bitmap.release(); mask.release(); aIconList->AppendL(icon.get()); icon.release(); } #endif } if (file_is_open) { s.Close(); } CleanupStack::PopAndDestroy(); // Offsets }