void CJavaDebugAgentSettings::SaveL(const TDesC& aPrefsFile) const { RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); RFileWriteStream out; out.PushL(); TInt err = out.Create(fs, aPrefsFile, EFileWrite); if (err != KErrNone) { // Try to eliminate the problem if we can switch (err) { case KErrAlreadyExists: fs.Delete(aPrefsFile); break; case KErrPathNotFound: fs.MkDirAll(aPrefsFile); break; default: User::Leave(err); break; } User::LeaveIfError(out.Create(fs, aPrefsFile, EFileWrite)); } SaveL(&out); out.Close(); out.Pop(); CleanupStack::PopAndDestroy(&fs); }
EXPORT_C void CEikDocument::SaveL(MSaveObserver::TSaveType /*aSaveType*/) /** Saves the document's state. This function is called by the UI framework when it needs to close down the application and the parameter provides the reason. For instance, it might be due to RAM running out. This function simply calls the other overload, and ignores the parameter. Applications should override this function if they need to take account of the parameter. @param aSaveType Notification code. This indicates to the application why this function was called. */ { // by default, just save all app data if (iEikProcess->MainStore()) SaveL(); }
TInt CSpecialLog::UpdateL(TBool aForced) { if (NULL == iFs) return KErrNotReady; if (EInitializing == iState) // No need to flush during loading. return KErrNone; iState = EUnsaved; TTime now; TTimeIntervalMinutes diff; now.UniversalTime(); // Check flush interval. if (!aForced && (now.MinutesFrom(iTimeLastSave, diff), diff < TTimeIntervalMinutes(KSpecialLogInterval))) return KErrNone; // Update time of last save. iTimeLastSave = now; return SaveL(); }
void CSpaceInvadersAppUi::ExitGame() { SaveL(); Exit(); }
// --------------------------------------------------------------------------- // CListboxSettingList::~CListboxSettingList() // Destructor // --------------------------------------------------------------------------- // CYCSettingList::~CYCSettingList() { SaveL(); SAFE_DELETE(iScaner); SAFE_DELETE(iConfig); }
void CJavaDebugAgentSettings::SaveL() const { SaveL(KDebugAgentPrefsFile); }
/** Auxiliary Function for T-CoGridStep-RunTestStepL.\n Handles the following Key Events\n 1. Ctrl+ e - Exits the application\n 2. Ctrl+ t - Toggles the Title Lines\n 3. Ctrl+ r - Resets the grid to its default layout and sets the cursor position to the cell at the top of the window\n 4. Ctrl+ m - Sets the zoom factor \n 5. Ctrl+ p - Paginates the Grid \n 6. Ctrl+ i - Inserts columns \n 7. Ctrl+ d - Deletes columns \n 8. Ctrl+ c - Changes the grid colour settings\n 9. Shift+m - Sets the zoom factor\n @return TKeyResponse indicating whether the key event has been handled or not.\n */ TKeyResponse CTestCoeGridAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) { if (aType==EEventKey) { if ((aKeyEvent.iModifiers&EAllStdModifiers)==EModifierCtrl) { switch (aKeyEvent.iCode) { case CTRL('e'): SaveL(); iCoeEnv->Flush(); CBaActiveScheduler::Exit(); break; case CTRL('t'): iGridWin->GridLay()->ToggleTitleLinesL(); break; case CTRL('r'): iGridWin->GridLay()->SetGridToDefault(); iUndoColors=EFalse; iUndoColors =~iUndoColors; ChangeColors(iUndoColors); iGridWin->DrawNow(); iGridWin->SetCursorPosL(iGridWin->GridLay()->VisibleRange().iFrom); break; case CTRL('m'): { TInt zoomFactor=iZoomFactor->ZoomFactor(); zoomFactor=(zoomFactor<(TZoomFactor::EZoomOneToOne*4)) ? zoomFactor*2 : TZoomFactor::EZoomOneToOne/4; SetZoomFactorL(zoomFactor); break; } case CTRL('p'): iGridWin->GridLay()->SetPageSizeInTwipsL (TSize(EPageWidthInTwips,EPageHeightInTwips)); iGridWin->GridLay()->PaginateL(); iGridWin->DrawNow(); break; case CTRL('c'): { iUndoColors = ~iUndoColors; ChangeColors(iUndoColors); iGridWin->DrawNow(); } break; case CTRL('i'): case CTRL('d'): { TInt noOfCols=(aKeyEvent.iCode==CTRL('i')) ? 1 : -1; iGridLay->InsertDeleteColumns(iGridLay->VisibleRange().iFrom.iCol, noOfCols,CGridLay::EAdjustGridRange); iGridWin->DrawNow(); } break; case CTRL('z'): { iGridTable->iZeroRows=!iGridTable->iZeroRows; iGridImg->ResetReferencePoints(); iGridLay->ResetVisibleToCell(); iGridWin->DrawNow(); } break; default: break; } } else if ((aKeyEvent.iModifiers&EAllStdModifiers)==EModifierShift) { switch (User::LowerCase(aKeyEvent.iCode)) { case 'm': { TInt zoomFactor=iZoomFactor->ZoomFactor(); zoomFactor=(zoomFactor>(TZoomFactor::EZoomOneToOne/4)) ? zoomFactor/2 : TZoomFactor::EZoomOneToOne*4; SetZoomFactorL(zoomFactor); break; } default: break; } } } return EKeyWasConsumed; }
/** @SYMTestCaseID UIF-CoGridStep-RunTestStepL @SYMPREQ @SYMTestCaseDesc Tests different functionalities of Grid Window @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions \n The following tests are performed \n 1. Setting grid with its default settings.\n 2. Simulating right arrow key event.\n 3. Simulating down arrow key event.\n 4. Change Color Settings. \n 5. Setting zoom in factor. \n 6. Setting zoom out factor.\n 7. Toggle Title Lines. \n 8. Scroll Right.\n 9. Scroll Left.\n 7. Paginate the Grid. \n @SYMTestExpectedResults The test pass if the events are handled without exceptions / panic / crashes\n */ void CTestCoeGridAppUi::RunTestStepL(TInt aNumStep) { TKeyEvent theKeyEvent; Mem::FillZ(&theKeyEvent, sizeof(TKeyEvent)); TEventCode theType=EEventKey; User::After(TTimeIntervalMicroSeconds32(1000000)); switch(aNumStep) { case 1: SetTestStepID(_L("UIF-CoGridStep-RunTestStepL")); theKeyEvent.iModifiers = EModifierCtrl; theKeyEvent.iCode=CTRL('r'); INFO_PRINTF1(_L("Set grid to default")); HandleKeyEventL(theKeyEvent,theType); break; case 2: case 3: case 4: INFO_PRINTF1(_L("Move cursor right")); theKeyEvent.iCode = EKeyRightArrow; iGridWin->OfferKeyEventL(theKeyEvent,theType); break; case 5: case 6: INFO_PRINTF1(_L("Move cursor down")); theKeyEvent.iCode = EKeyDownArrow; iGridWin->OfferKeyEventL(theKeyEvent,theType); break; case 7: case 8: INFO_PRINTF1(_L("Change color")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = CTRL('c'); HandleKeyEventL(theKeyEvent,theType); break; case 9: case 10: INFO_PRINTF1(_L("Zoom in")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = CTRL('m'); HandleKeyEventL(theKeyEvent,theType); break; case 11: case 12: INFO_PRINTF1(_L("Zoom out")); theKeyEvent.iModifiers=EModifierShift; theKeyEvent.iCode = 'm'; HandleKeyEventL(theKeyEvent,theType); break; case 13: INFO_PRINTF1(_L("Toggle title lines")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = CTRL('t'); HandleKeyEventL(theKeyEvent,theType); break; case 14: INFO_PRINTF1(_L("Scroll right")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = EKeyRightArrow; iGridWin->OfferKeyEventL(theKeyEvent,theType); break; case 15: INFO_PRINTF1(_L("Scroll left")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = EKeyLeftArrow; iGridWin->OfferKeyEventL(theKeyEvent,theType); break; case 16: INFO_PRINTF1(_L("Toggle title lines")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = CTRL('t'); HandleKeyEventL(theKeyEvent,theType); break; case 17: INFO_PRINTF1(_L("Paginate")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = CTRL('p'); HandleKeyEventL(theKeyEvent,theType); break; case 18: INFO_PRINTF1(_L("Set grid to default")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = CTRL('r'); HandleKeyEventL(theKeyEvent,theType); RecordTestResultL(); CloseTMSGraphicsStep(); break; case 19: SaveL(); iCoeEnv->Flush(); AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass); break; } }