qtmobileextensions/src/keycapture/targetwrapper.h
branchRCL_3
changeset 9 5d007b20cfd0
equal deleted inserted replaced
8:885c2596c964 9:5d007b20cfd0
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  *
       
     5  * This program is free software: you can redistribute it and/or modify
       
     6  * it under the terms of the GNU Lesser General Public License as published by
       
     7  * the Free Software Foundation, version 2.1 of the License.
       
     8  * 
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU Lesser General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU Lesser General Public License
       
    15  * along with this program.  If not, 
       
    16  * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17  *
       
    18  * Description:
       
    19  *
       
    20  */
       
    21 
       
    22 #ifndef TARGETWRAPPER_H_
       
    23 #define TARGETWRAPPER_H_
       
    24 
       
    25 #include <remconcoreapi.h>
       
    26 #include <remconinterfaceselector.h>
       
    27 #include <remconcoreapitarget.h>
       
    28 #include <remconcoreapitargetobserver.h>    
       
    29 #include <remconcoreapitargetobserver.h>    
       
    30 #include <remconcallhandlingtargetobserver.h>
       
    31 #include <remconcallhandlingtarget.h>
       
    32 
       
    33 #include <QMainWindow>
       
    34 #include <QMap>
       
    35 #include <QEvent>
       
    36 
       
    37 #include <e32base.h>
       
    38 
       
    39 #include <XqKeyCapture>
       
    40 
       
    41 class QPlainTextEdit;
       
    42 class QAction;
       
    43 class QWidget;
       
    44 class QMenu;
       
    45 
       
    46 #ifdef XQKEYCAPTURE_LIBRARY
       
    47 #define XQKEYCAPTURE_EXPORT Q_DECL_EXPORT
       
    48 #else
       
    49 #define XQKEYCAPTURE_EXPORT Q_DECL_IMPORT
       
    50 #endif
       
    51 
       
    52 
       
    53 class CResponseHandler;
       
    54 class CResponseHandlerEx;
       
    55 
       
    56 class TargetWrapper : public MRemConCoreApiTargetObserver, public MRemConCallHandlingTargetObserver
       
    57 {
       
    58 public:
       
    59     TargetWrapper();
       
    60     
       
    61     ~TargetWrapper();
       
    62     
       
    63     void init(XQKeyCapture::CapturingFlags flags);
       
    64     void close(XQKeyCapture::CapturingFlags flags);
       
    65 
       
    66 public:
       
    67     // -- MRemConCoreApiTargetObserver overloaded methods --    
       
    68     void MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct);
       
    69     
       
    70     // -- MRemConCallHandlingTargetObserver overloaded methods --    
       
    71     
       
    72      void AnswerCall();
       
    73 
       
    74      void EndCall();
       
    75     
       
    76      void AnswerEndCall();
       
    77     
       
    78      void VoiceDial( const TBool aActivate );
       
    79     
       
    80      void LastNumberRedial();
       
    81     
       
    82      void DialCall( const TDesC8& aTelNumber );
       
    83     
       
    84      void MultipartyCalling( const TDesC8& aData );
       
    85     
       
    86      void GenerateDTMF( const TChar aChar );
       
    87     
       
    88      void SpeedDial( const TInt aIndex );    
       
    89      
       
    90 protected:    
       
    91      
       
    92     void reset();
       
    93     void initMapping();
       
    94 
       
    95     QWidget *getTargetWidget();
       
    96     
       
    97     void sendKey(QEvent::Type eventType, Qt::Key key, Qt::KeyboardModifiers modFlags, 
       
    98             TRemConCoreApiOperationId aOperationId = ENop);
       
    99 
       
   100     Qt::Key mapKey(TRemConCoreApiOperationId aOperationId);
       
   101 
       
   102 private:
       
   103     CRemConInterfaceSelector *selector;
       
   104     
       
   105     CRemConCoreApiTarget *target;
       
   106     CRemConCallHandlingTarget *targetEx;
       
   107 
       
   108     CResponseHandler *handler;
       
   109     CResponseHandlerEx *handlerEx;
       
   110     
       
   111     QFlags<XQKeyCapture::CapturingFlags> captureFlags;
       
   112     
       
   113     QMap<TRemConCoreApiOperationId, Qt::Key> keyMapping;
       
   114 };
       
   115 
       
   116 #endif /* TARGETWRAPPER_H_ */