Пример #1
0
void CDummyCalendarApp::ExtractFromDatabaseL()
	{
	// Print test's description
	// Check if description field is longer than 124 characters and split the print if it is.
	// (printf does not seem to handle string length > 124)
	TInt len(iCurrentTestData->iDescription.Length());
	if(len > 124)
		{
		TInt num(len / 124);
		TBuf<TTestDataStruct::KDescriptionLen> tmpBuff(iCurrentTestData->iDescription);
		for(TInt i = 0; i < num; ++i)
			{
			test.Printf(_L("%.124S"), &tmpBuff);
			tmpBuff.Delete(0, 124);
			}
		if(tmpBuff.Length())
			{
			test.Printf(_L("%S\n"), &tmpBuff);
			}
		}
	else
		{
		test.Printf(_L("TEST: %S\n"), &iCurrentTestData->iDescription);
		}	

	if(iCurrentTestData->iTestType == TTestDataStruct::EEntryTest)
		{
		ExtractEntriesL();
		}
		
	else if(iCurrentTestData->iTestType == TTestDataStruct::EInstanceTest)
		{
		ExtractInstancesL();
		}
	}
Пример #2
0
bool GuiConsoleEditCtrl::onKeyDown(const GuiEvent &event)
{
   setUpdate();

   if (event.keyCode == KEY_TAB) 
   {
      // Get a buffer that can hold the completed text...
      FrameTemp<UTF8> tmpBuff(GuiTextCtrl::MAX_STRING_LENGTH);
      // And copy the text to be completed into it.
      mTextBuffer.getCopy8(tmpBuff, GuiTextCtrl::MAX_STRING_LENGTH);

      // perform the completion
      bool forward = (event.modifier & SI_SHIFT) == 0;
      mCursorPos = Con::tabComplete(tmpBuff, mCursorPos, GuiTextCtrl::MAX_STRING_LENGTH, forward);

      // place results in our buffer.
      mTextBuffer.set(tmpBuff);
      return true;
   }
   else if ((event.keyCode == KEY_PAGE_UP) || (event.keyCode == KEY_PAGE_DOWN)) 
   {
      // See if there's some other widget that can scroll the console history.
      if (mUseSiblingScroller) 
      {
         if (mSiblingScroller) 
         {
            return mSiblingScroller->onKeyDown(event);
         }
         else 
         {
            // Let's see if we can find it...
            SimGroup* pGroup = getGroup();
            if (pGroup) 
            {
               // Find the first scroll control in the same group as us.
               for (SimSetIterator itr(pGroup); *itr; ++itr) 
               {
                  mSiblingScroller = dynamic_cast<GuiScrollCtrl*>(*itr);
                  if (mSiblingScroller != NULL)
                  {
                     return mSiblingScroller->onKeyDown(event);
                  }
               }
            }

            // No luck... so don't try, next time.
            mUseSiblingScroller = false;
         }
      }
   }
	else if( event.keyCode == KEY_RETURN || event.keyCode == KEY_NUMPADENTER )
	{
      if ( event.modifier & SI_SHIFT &&
           mTextBuffer.length() + dStrlen("echo();") <= GuiTextCtrl::MAX_STRING_LENGTH )
      {
         // Wrap the text with echo( %s );

         char buf[GuiTextCtrl::MAX_STRING_LENGTH];
         getText( buf );

         String text( buf );         
         text.replace( ";", "" );

         text = String::ToString( "echo(%s);", text.c_str() );

         setText( text );
      }

		return Parent::dealWithEnter(false);
	}

   return Parent::onKeyDown(event);
}