phoneengine/phoneservices/src/keysequencerecognitionservicedepricated.cpp
changeset 30 ebdbd102c78a
equal deleted inserted replaced
27:2f8f8080a020 30:ebdbd102c78a
       
     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:  Provides key sequence recognition and execution services.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QDebug>
       
    19 #include <xqserviceutil.h>
       
    20 #include <e32base.h>
       
    21 #include "keysequencerecognitionservicedepricated.h"
       
    22 #include "mpekeysequencerecognitionif.h"
       
    23 
       
    24 /*!
       
    25   KeySequenceRecognitionServiceDepricated::KeySequenceRecognitionServiceDepricated.
       
    26  */
       
    27 KeySequenceRecognitionServiceDepricated::KeySequenceRecognitionServiceDepricated(
       
    28     MPEKeySequenceRecognitionIF &keySequenceRecognizer,
       
    29     QObject* parent) 
       
    30     : 
       
    31     XQServiceProvider(
       
    32         QLatin1String("com.nokia.services.telephony"), parent),
       
    33         m_keySequenceRecognizer(keySequenceRecognizer)
       
    34 {
       
    35     publishAll();
       
    36 }
       
    37 
       
    38 
       
    39 /*!
       
    40   KeySequenceRecognitionServiceDepricated::~KeySequenceRecognitionServiceDepricated.
       
    41  */
       
    42 KeySequenceRecognitionServiceDepricated::~KeySequenceRecognitionServiceDepricated()
       
    43 {
       
    44 }
       
    45 
       
    46 
       
    47 /*!
       
    48   KeySequenceRecognitionServiceDepricated::executeKeySequence.
       
    49  */
       
    50 bool KeySequenceRecognitionServiceDepricated::executeKeySequence(
       
    51     const QString &keySequence)
       
    52 {
       
    53     TPtrC16 keySequencePtr(
       
    54         reinterpret_cast<const TUint16*>(keySequence.utf16()));
       
    55     bool sequenceProcessed = false;
       
    56     TRAPD(leaveCode, sequenceProcessed = static_cast<bool>(
       
    57         m_keySequenceRecognizer.ExecuteKeySequenceL(keySequencePtr)));
       
    58     sequenceProcessed = (KErrNone == leaveCode) ? sequenceProcessed : false;
       
    59     return sequenceProcessed;
       
    60 }