void CCalAlarmAttachTest::ConstructL()
	{
	iTestLib = CCalTestLibrary::NewL();
	iTestLib->ReplaceFileL(KCalName());
	iTestLib->OpenFileL(KCalName());
	
	User::LeaveIfError(iAlarmServer.Connect());
	}
Exemplo n.º 2
0
/**
 * @brief Completes the second phase of Symbian object construction.
 * Put initialization code that could leave here.
 */
void CAlarmSwitcherAppUi::ConstructL()
{
    // [[[ begin generated region: do not modify [Generated Contents]

    BaseConstructL( EAknEnableSkin  |
                    EAknEnableMSK );
    InitializeContainersL();
    // ]]] end generated region [Generated Contents]

    RASCliSession session;
    session.Connect();
    RArray<TInt> ids;
    session.GetAlarmIdListL(ids);
    TASShdAlarm tempAlarm;
    TASShdAlarm aAlarmInfo;
    TAlarmStatus newstat;
    TInt MaskID=EMbmAlarmswitcher_aifQgn_menu_alarmswitcher;
    TInt ImageID=EMbmAlarmswitcher_aifQgn_menu_alarmswitcher_mask;
    CEikonEnv::Static()->RootWin().SetOrdinalPosition(-4);
    RWindowGroup* iWinGroup = new (ELeave) RWindowGroup(CEikonEnv::Static()->WsSession());
    iWinGroup->Construct((TUint32)iWinGroup);
    iWinGroup->EnableReceiptOfFocus(EFalse); // Don't capture any key events.
    iWinGroup->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
    for (TInt i=0; i<ids.Count(); i++)
    {
        TInt err=session.GetAlarmDetails(ids[i],tempAlarm);
        if (err!=KErrNone) {
            continue;
        }
        if (tempAlarm.Status()==EAlarmStatusDisabled) {
            ImageID=EMbmAlarmswitcher_aifAlarmon;
            MaskID=EMbmAlarmswitcher_aifAlarmon_mask;
            newstat=EAlarmStatusEnabled;
        }
        else {
            ImageID=EMbmAlarmswitcher_aifAlarmoff;
            MaskID=EMbmAlarmswitcher_aifAlarmoff_mask;
            newstat=EAlarmStatusDisabled;
        }
        tempAlarm.iStatus=newstat;
        session.SetAlarmStatus(ids[i],newstat);
        err=session.GetAlarmDetails(ids[i],tempAlarm);
        RDebug::Print(_L("%d"),i);
    }
    session.Close();
    RWsSprite* iSprite= new (ELeave) RWsSprite(CEikonEnv::Static()->WsSession());
    iSprite->Construct(*iWinGroup,TPoint(0,0),0);

    TInt ScrX=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iWidth;
    TInt ScrY=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iHeight;
    TInt min=ScrX/2;
    if (ScrX>ScrY) {
        min=ScrY/2;
    }
    else {
        min=ScrX/2;
    }
    TSize size=TSize(min/2,min/2);
    TSpriteMember Member;
    CGulIcon* icon=LoadIcon(ImageID,MaskID,size);
    Member.iBitmap=icon->Bitmap();
    Member.iMaskBitmap=icon->Mask();
    Member.iOffset=TPoint(0,0);
    Member.iInterval=TTimeIntervalMicroSeconds32(60*1000000);
    Member.iInvertMask=EFalse;
    iSprite->AppendMember(Member);

    TInt BitX=Member.iBitmap->SizeInPixels().iWidth;
    TInt BitY=Member.iBitmap->SizeInPixels().iHeight;

    iSprite->SetPosition(TPoint(ScrX/2-BitX/2,ScrY/2-BitY/2));
    iSprite->Activate();
    CEikonEnv::Static()->WsSession().Flush();
    User::After(2000000);
    User::Exit(0);
}