TBool CEmTubeVideoUploadDialog::OkToExitL(TInt aButtonId) { if (aButtonId == EAknSoftkeyDone) { SaveFormDataL(); if( iQueueEntry->Title().Length() == 0 ) { HBufC* message = StringLoader::LoadLC( R_DIALOG_TITLE_AND_DESCRIPTION_NEEDED_TXT ); CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; informationNote->ExecuteLD( *message ); CleanupStack::PopAndDestroy( message ); return EFalse; } if( iQueueEntry->Description().Length() == 0 ) { HBufC* message = StringLoader::LoadLC( R_DIALOG_TITLE_AND_DESCRIPTION_NEEDED_TXT ); CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; informationNote->ExecuteLD( *message ); CleanupStack::PopAndDestroy( message ); return EFalse; } TBool res = ETrue; if( iQueueEntry->Tags().Length() == 0 ) res = EFalse; TLex lex = TLex( iQueueEntry->Tags() ); TPtrC16 ptr( lex.NextToken() ); TInt tokenCount = 0; while( ptr.Length() && (tokenCount < 2) ) { tokenCount++; ptr.Set( lex.NextToken() ); } if( tokenCount < 2 ) res = EFalse; if( !res ) { HBufC* message = StringLoader::LoadLC( R_DIALOG_TWO_TAGS_NEEDED_TXT ); CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; informationNote->ExecuteLD( *message ); CleanupStack::PopAndDestroy( message ); return EFalse; } return ETrue; } else { return CAknForm::OkToExitL(aButtonId); } }
/* ------------------------------------------------------------------------------- Class: CStifSectionParser Method: GotoEndOfLine Description: Goes end of the line. Parameters: TLex& lex: inout: Parsed line. Return Values: TInt: Last item's end position. Errors/Exceptions: None Status: Proposal ------------------------------------------------------------------------------- */ TInt CStifSectionParser::GotoEndOfLine( TLex& lex ) { // End position of the last token(Initialized with current position) TInt lastItemPosition( lex.Offset() ); // LINE BREAK NOTE: // Line break in SOS, WIN: '\r\n' // Line break in UNIX: '\n' do { // Peek next character(10 or '\n' in UNIX style ) if( lex.Peek() == 0x0A ) { lex.Inc(); break; } // Peek next character(13 or '\r' in Symbian OS) if ( lex.Peek() == 0x0D ) { // Increment the lex position lex.Inc(); // Peek next character(10 or '\n' in Symbian OS) if ( lex.Peek() == 0x0A ) { // End of the section is found and increment the lex position lex.Inc(); break; } // 0x0A not found, decrement position lex.UnGet(); } // Peek for tabulator(0x09) and space(0x20) else if ( lex.Peek() == 0x09 || lex.Peek() == 0x20 ) { // Increment the lex position lex.Inc(); continue; } // If white spaces not found take next token lex.NextToken(); lastItemPosition = lex.Offset(); } while ( !lex.Eos() ); return lastItemPosition; }
/** * Read the Cfg File data into a heap buffer * And populate the arrays of selective test case IDs and * Ranges to be used by the state machine * NOTE: we do not support nested cfgs... */ LOCAL_C void CreateCfgDataFromFileL(TPtrC& aCfgFilePath,RArray<TRange>& aSelectiveCaseRange, TDesC*& aSelTestCfgFileData) { RFs fS; User::LeaveIfError(fS.Connect()); CleanupClosePushL(fS); RFile cfgFile; User::LeaveIfError(cfgFile.Open(fS,aCfgFilePath,EFileRead | EFileShareAny)); CleanupClosePushL(cfgFile); TInt fileSize; User::LeaveIfError(cfgFile.Size(fileSize)); // Create a 16bit heap buffer HBufC* cfgData = HBufC::NewL(fileSize); CleanupStack::PushL(cfgData); HBufC8* narrowData = HBufC8::NewL(fileSize); CleanupStack::PushL(narrowData); TPtr8 narrowPtr=narrowData->Des(); // Read the file into an 8bit heap buffer User::LeaveIfError(cfgFile.Read(narrowPtr)); TPtr widePtr(cfgData->Des()); // Copy it to the 16bit buffer widePtr.Copy(narrowData->Des()); CleanupStack::PopAndDestroy(narrowData); CleanupStack::Pop(cfgData); CleanupStack::Pop(2); cfgFile.Close(); fS.Close(); // Set up the instance token parser TLex cfgLex = cfgData->Des(); aSelTestCfgFileData = cfgData; // to preserve the pointer of cfgdata and transfer the ownership to aSelTestCfgFileData cfgData = NULL; // relinquish the ownership while(!cfgLex.Eos()) { DistinguishElement(cfgLex.NextToken(),aSelectiveCaseRange) ; } }