FepSetupDialog.cpp
上传用户:tjsjht
上传日期:2021-01-13
资源大小:25k
文件大小:3k
源码类别:

输入法编程

开发平台:

Visual C++

  1. /*
  2. * ============================================================================
  3. *  Name     : CFepSetupDialog from FepSetupDialog.h
  4. *  Part of  : FepSetup
  5. *  Created  : 02/22/2003 by Chiam Poh Guan
  6. *  Implementation notes:
  7. *     Initial content was generated by Series 60 AppWizard.
  8. *  Version  :
  9. *  Copyright: Forum Nokia
  10. * ============================================================================
  11. */
  12. // INCLUDE FILES
  13. #include    "FepSetupDialog.h"
  14. #include <eiklabel.h>  // for example label control
  15. #include <avkon.hrh>
  16. #include <aknappui.h>
  17. #include <f32file.h> // for TParseBase
  18. #include <FepSetup.rsg>
  19. #include "fepsetup.hrh"
  20. #include <AknListQueryDialog.h>
  21. //_LIT(KAknExQueryDefaultDataText, "Hello");
  22. _LIT(KMySelect, "Selected %d");
  23. // ================= MEMBER FUNCTIONS =======================
  24. // Destructor
  25. CFepSetupDialog::~CFepSetupDialog()
  26.     {
  27. delete iFepSetting;
  28. delete iFileNamesOfAvailableFeps;
  29. delete iNamesOfAvailableFeps;
  30.     }
  31. // ---------------------------------------------------------
  32. // CFepSetupDialog::OkToExitL(TInt aButtonId)
  33. // called by framework when the OK button is pressed
  34. // ---------------------------------------------------------
  35. //
  36. TBool CFepSetupDialog::OkToExitL(TInt aButtonId)
  37. {
  38.     // Translate the button presses into commands for the appui & current
  39.     // view to handle
  40.     if ( aButtonId == EAknSoftkeyOptions )
  41.         {
  42.         iAvkonAppUi->ProcessCommandL( EAknSoftkeyOptions );
  43.         }
  44.     else if ( aButtonId == EAknSoftkeyBack )
  45.         {
  46.         iAvkonAppUi->ProcessCommandL( EEikCmdExit );
  47.         }
  48.     
  49.     return EFalse;
  50. }
  51. // ---------------------------------------------------------
  52. // CFepSetupDialog::PreLayoutDynInitL();
  53. // called by framework before dialog is shown 
  54. // ---------------------------------------------------------
  55. //
  56. void CFepSetupDialog::PreLayoutDynInitL()
  57.     {
  58. iFepSetting=CFepGenericGlobalSettings::NewL(*iEikonEnv, 
  59. TFepOnOrOffKeyData(EKeyEnter, EModifierFunc|EModifierShift, EModifierFunc),
  60. TFepOnOrOffKeyData(EKeyEnter, EModifierFunc|EModifierShift, EModifierShift), 
  61. EFalse);
  62. iFileNamesOfAvailableFeps = iEikonEnv->FileNamesOfAvailableFepsL();
  63. const TInt numberOfAvailableFeps = iFileNamesOfAvailableFeps->MdcaCount();
  64. iNamesOfAvailableFeps = new(ELeave) CDesCArrayFlat(numberOfAvailableFeps+1);
  65. for(TInt i=0; i<numberOfAvailableFeps; i++)
  66. {
  67. iNamesOfAvailableFeps->AppendL(TParsePtrC(iFileNamesOfAvailableFeps->MdcaPoint(i)).Name());
  68. }
  69. HBufC* noneFepText = iCoeEnv->AllocReadResourceLC(R_FEPSETUP_TBUF_NONE);
  70. iNamesOfAvailableFeps->AppendL(*noneFepText);
  71. CleanupStack::PopAndDestroy(); // noneFepText
  72. }
  73. void CFepSetupDialog::DisplayListOfFepsL()
  74.     {
  75.     TInt index(0);
  76.     CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog(&index);
  77.     dlg->PrepareLC(R_FEPSETUP_LIST_QUERY);
  78.     dlg->SetItemTextArray(iNamesOfAvailableFeps);
  79.     dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
  80.     TInt answer( dlg->RunLD() );
  81.     if (answer)
  82. {
  83.     TBuf<50> text;
  84.         text.Format(KMySelect, index+1);
  85. iEikonEnv->InfoMsg(text);
  86. }
  87. else
  88. {
  89. // iEikonEnv->InfoMsg("Error");
  90. }
  91. }
  92. // End of File