telutils/keysequencerecognitionservice/inc/keysequencerecognitionprovider.h
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     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: Implements Qt Highway provider for key sequence handling.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef KEYSEQUENCERECOGNITIONPROVIDER_H
       
    19 #define KEYSEQUENCERECOGNITIONPROVIDER_H
       
    20 
       
    21 #include <xqserviceprovider.h>
       
    22 
       
    23 class KeySequenceHandler;
       
    24 
       
    25 class KeySequenceRecognitionProvider : public XQServiceProvider
       
    26 {
       
    27     Q_OBJECT
       
    28 
       
    29 public:
       
    30 
       
    31     KeySequenceRecognitionProvider(QObject *parent = 0);
       
    32     ~KeySequenceRecognitionProvider();
       
    33     
       
    34 public slots:
       
    35     
       
    36     /*!
       
    37         \fn keySequenceValidator()
       
    38         
       
    39         Returns regular expression for key sequence validation. Client must 
       
    40         validate sequence before requesting provider to execute it. Regular
       
    41         expression is in escaped format.
       
    42         
       
    43         \return Escaped regular expression.
       
    44         
       
    45         Usage example:
       
    46         XQAiwRequest *request = mAiwMgr.create(
       
    47             "com.nokia.symbian.IKeySequenceRecognition",
       
    48             "keySequenceValidator()", 
       
    49             true);
       
    50         
       
    51         QVariant keySequenceValidator;
       
    52         bool requestOk = request->send(keySequenceValidator);
       
    53         if (requestOk && keySequenceValidator.toString().size()) {
       
    54             QString expression = keySequenceValidator.toString();
       
    55             mValidator = new QRegExp(expression);
       
    56         }
       
    57     */
       
    58     QString keySequenceValidator();
       
    59     
       
    60     /*!
       
    61         \fn executeKeySequence(const QString& keySequence)
       
    62         
       
    63         Client can use this method to execute key sequence.
       
    64         Key sequence may contain for example product codes etc. that
       
    65         may cause lower layers to do any specific things.
       
    66         
       
    67         \param  keySequence          Key sequence to execute.
       
    68         \return True if key sequence was processed, false otherwise.
       
    69         
       
    70         Usage example:
       
    71         XQAiwRequest *request = mAiwMgr.create(
       
    72             "com.nokia.symbian.IKeySequenceRecognition",
       
    73             "executeKeySequence(QString)", 
       
    74             true);
       
    75         
       
    76         QList<QVariant> arguments;
       
    77         arguments << "*#0000#";
       
    78         request->setArguments(arguments);
       
    79         
       
    80         QVariant keySequenceProcessed;
       
    81         bool requestOk = request.send(keySequenceProcessed);
       
    82     */
       
    83     bool executeKeySequence(const QString &keySequence);
       
    84 
       
    85 private:
       
    86     void setupLocalization();
       
    87     void constructKeySequenceHandlers();
       
    88     void constructKeySequenceValidator();
       
    89     
       
    90 private:
       
    91     QString m_keySequenceValidator;
       
    92     QList<KeySequenceHandler*> m_handlers;
       
    93 };
       
    94 
       
    95 #endif // KEYSEQUENCERECOGNITIONPROVIDER_H