javauis/lcdui_akn/lcdui/src/CMIDQwertyWatch.cpp
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2003 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "CMIDQwertyWatch.h"
       
    20 // Internal Central Repository keys, keys constants
       
    21 #include <AvkonInternalCRKeys.h>
       
    22 
       
    23 CMIDQwertyWatch* CMIDQwertyWatch::NewL(MMIDQwertyObserver* aObserver)
       
    24 {
       
    25     CMIDQwertyWatch* me=new(ELeave) CMIDQwertyWatch(aObserver);
       
    26     CleanupStack::PushL(me);
       
    27     me->ConstructL();
       
    28     CleanupStack::Pop(me);
       
    29     return me;
       
    30 }
       
    31 
       
    32 CMIDQwertyWatch::CMIDQwertyWatch(MMIDQwertyObserver* aObserver)
       
    33         : CActive(EPriority), iObserver(aObserver)
       
    34 {
       
    35     ASSERT(iObserver);
       
    36 }
       
    37 
       
    38 void CMIDQwertyWatch::ConstructL()
       
    39 {
       
    40     User::LeaveIfError(iProperty.Attach(KCRUidAvkon,KAknQwertyInputModeActive));
       
    41     CActiveScheduler::Add(this);
       
    42 
       
    43     RunL();
       
    44 }
       
    45 
       
    46 CMIDQwertyWatch::~CMIDQwertyWatch()
       
    47 {
       
    48     Cancel();
       
    49     iProperty.Close();
       
    50 }
       
    51 
       
    52 void CMIDQwertyWatch::DoCancel()
       
    53 {
       
    54     iProperty.Cancel();
       
    55 }
       
    56 
       
    57 void CMIDQwertyWatch::RunL()
       
    58 {
       
    59     iProperty.Subscribe(iStatus);
       
    60     SetActive();
       
    61 
       
    62     TInt value;
       
    63     TInt err = iProperty.Get(value);
       
    64     iObserver->NewQwertyValueL(err == KErrNone ? value : err);
       
    65 }
       
    66 
       
    67 
       
    68