idlehomescreen/examples/mcsexample/src/MCSExampleAppUi.cpp
branchRCL_3
changeset 102 ba63c83f4716
parent 93 b01126ce0bec
child 103 966d119a7e67
equal deleted inserted replaced
93:b01126ce0bec 102:ba63c83f4716
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <avkon.hrh>
       
    20 #include <aknmessagequerydialog.h>
       
    21 #include <aknnotewrappers.h>
       
    22 #include <stringloader.h>
       
    23 
       
    24 #include <MCSExample_0xEB753B18.rsg>
       
    25 #include "MCSExample.hrh"
       
    26 #include "MCSExample.pan"
       
    27 #include "MCSExampleApplication.h"
       
    28 #include "MCSExampleAppUi.h"
       
    29 #include "MCSExampleAppView.h"
       
    30 
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CMCSExampleAppUi::ConstructL()
       
    37 // Symbian 2nd phase constructor can leave.
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 void CMCSExampleAppUi::ConstructL()
       
    41     {
       
    42     // Initialise app UI with standard value.
       
    43     BaseConstructL(CAknAppUi::EAknEnableSkin|CAknAppUi::EAknSingleClickCompatible);
       
    44 
       
    45     // Create view object
       
    46     iAppView = CMCSExampleAppView::NewL(ClientRect());
       
    47     }
       
    48 // -----------------------------------------------------------------------------
       
    49 // CMCSExampleAppUi::CMCSExampleAppUi()
       
    50 // C++ default constructor can NOT contain any code, that might leave.
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 CMCSExampleAppUi::CMCSExampleAppUi()
       
    54     {
       
    55     // No implementation required
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CMCSExampleAppUi::~CMCSExampleAppUi()
       
    60 // Destructor.
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CMCSExampleAppUi::~CMCSExampleAppUi()
       
    64     {
       
    65     if (iAppView)
       
    66         {
       
    67         delete iAppView;
       
    68         iAppView = NULL;
       
    69         }
       
    70 
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CMCSExampleAppUi::HandleCommandL()
       
    75 // Takes care of command handling.
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 void CMCSExampleAppUi::HandleCommandL(TInt aCommand)
       
    79     {
       
    80     switch (aCommand)
       
    81         {
       
    82         case EEikCmdExit:
       
    83         case EAknSoftkeyExit:
       
    84             Exit();
       
    85             break;
       
    86 
       
    87         case ECommand1:
       
    88             {
       
    89 
       
    90             // Load a string from the resource file and display it
       
    91             HBufC* textResource = StringLoader::LoadLC(R_COMMAND1_TEXT);
       
    92             CAknInformationNote* informationNote;
       
    93 
       
    94             informationNote = new (ELeave) CAknInformationNote;
       
    95 
       
    96             // Show the information Note with
       
    97             // textResource loaded with StringLoader.
       
    98             informationNote->ExecuteLD(*textResource);
       
    99 
       
   100             // Pop HBuf from CleanUpStack and Destroy it.
       
   101             CleanupStack::PopAndDestroy(textResource);
       
   102             }
       
   103             break;
       
   104         case ECommand2:
       
   105             {
       
   106             iAppView->ListAllItemsL();
       
   107             }
       
   108             break;
       
   109         case EHelp:
       
   110             {
       
   111 
       
   112             }
       
   113             break;
       
   114         case EAbout:
       
   115             {
       
   116 
       
   117             CAknMessageQueryDialog* dlg =
       
   118                     new (ELeave) CAknMessageQueryDialog();
       
   119             dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
       
   120             HBufC* title = iEikonEnv->AllocReadResourceLC(
       
   121                     R_ABOUT_DIALOG_TITLE);
       
   122             dlg->QueryHeading()->SetTextL(*title);
       
   123             CleanupStack::PopAndDestroy(); //title
       
   124             HBufC* msg = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TEXT);
       
   125             dlg->SetMessageTextL(*msg);
       
   126             CleanupStack::PopAndDestroy(); //msg
       
   127             dlg->RunLD();
       
   128             }
       
   129             break;
       
   130         default:
       
   131             Panic( EMCSExampleUi);
       
   132             break;
       
   133         }
       
   134     }
       
   135 // -----------------------------------------------------------------------------
       
   136 //  Called by the framework when the application status pane
       
   137 //  size is changed.  Passes the new client rectangle to the
       
   138 //  AppView
       
   139 // -----------------------------------------------------------------------------
       
   140 //
       
   141 void CMCSExampleAppUi::HandleStatusPaneSizeChange()
       
   142     {
       
   143     iAppView->SetRect(ClientRect());
       
   144     }
       
   145 
       
   146 CArrayFix<TCoeHelpContext>* CMCSExampleAppUi::HelpContextL() const
       
   147     {
       
   148 #warning "Please see comment about help and UID3..."
       
   149     // Note: Help will not work if the application uid3 is not in the
       
   150     // protected range.  The default uid3 range for projects created
       
   151     // from this template (0xE0000000 - 0xEFFFFFFF) are not in the protected range so that they
       
   152     // can be self signed and installed on the device during testing.
       
   153     // Once you get your official uid3 from Symbian Ltd. and find/replace
       
   154     // all occurrences of uid3 in your project, the context help will
       
   155     // work. Alternatively, a patch now exists for the versions of 
       
   156     // HTML help compiler in SDKs and can be found here along with an FAQ:
       
   157     // http://www3.symbian.com/faq.nsf/AllByDate/E9DF3257FD565A658025733900805EA2?OpenDocument
       
   158 #ifdef _HELP_AVAILABLE_
       
   159     CArrayFixFlat<TCoeHelpContext>* array = new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
       
   160     CleanupStack::PushL(array);
       
   161     array->AppendL(TCoeHelpContext(KUidMCSExampleApp, KGeneral_Information));
       
   162     CleanupStack::Pop(array);
       
   163     return array;
       
   164 #else
       
   165     return NULL;
       
   166 #endif
       
   167     }
       
   168 
       
   169 // End of File