src/hbcore/inputfw/hbinputvkbhostbridge.cpp
changeset 6 c3690ec91ef8
parent 5 627c4a0fd0e7
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
5:627c4a0fd0e7 6:c3690ec91ef8
    20 **
    20 **
    21 ** If you have questions regarding the use of this file, please contact
    21 ** If you have questions regarding the use of this file, please contact
    22 ** Nokia at developer.feedback@nokia.com.
    22 ** Nokia at developer.feedback@nokia.com.
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
       
    25 #include "hbinputvkbhostbridge.h"
       
    26 
    25 #include <QVariant>
    27 #include <QVariant>
    26 #include <QPointer>
    28 #include <QPointer>
    27 
       
    28 #include "hbinputvkbhostbridge.h"
       
    29 
    29 
    30 /*!
    30 /*!
    31 \proto
    31 \proto
    32 \class HbVkbHostBridge
    32 \class HbVkbHostBridge
    33 \brief Provides one connection point to receive signals from all the virtual keyboard hosts.
    33 \brief Provides one connection point to receive signals from all the virtual keyboard hosts.
    40 in the system changes state. It also forwards HbVkbHost API function calls to active host.
    40 in the system changes state. It also forwards HbVkbHost API function calls to active host.
    41 
    41 
    42 Note that there is active host only when editor widget is focused.
    42 Note that there is active host only when editor widget is focused.
    43 
    43 
    44 The bridge virtual keyboard host also has has an important internal role in synchronising state transitions between several
    44 The bridge virtual keyboard host also has has an important internal role in synchronising state transitions between several
    45 active virtual keyboard hosts.  
    45 active virtual keyboard hosts.
    46 
    46 
    47 \sa HbVkbHost
    47 \sa HbVkbHost
    48 */
    48 */
    49 
    49 
    50 /// @cond
    50 /// @cond
    73 }
    73 }
    74 
    74 
    75 /*!
    75 /*!
    76 \reimp
    76 \reimp
    77 */
    77 */
    78 void HbVkbHostBridge::openKeypad(HbVirtualKeyboard *vkb, HbInputMethod* owner, bool animationAllowed)
    78 void HbVkbHostBridge::openKeypad(HbVirtualKeyboard *vkb, HbInputMethod *owner, bool animationAllowed)
    79 {
    79 {
    80     Q_D(HbVkbHostBridge);
    80     Q_D(HbVkbHostBridge);
    81     if (d->mActiveHost) {
    81     if (d->mActiveHost) {
    82         d->mActiveHost->openKeypad(vkb, owner, animationAllowed);
    82         d->mActiveHost->openKeypad(vkb, owner, animationAllowed);
    83     }
    83     }
    84 }
    84 }
    85 
    85 
    86 /*!
    86 /*!
    87 \reimp
    87 \reimp
    88 */
    88 */
    89 void HbVkbHostBridge::openMinimizedKeypad(HbVirtualKeyboard *vkb, HbInputMethod* owner)
    89 void HbVkbHostBridge::openMinimizedKeypad(HbVirtualKeyboard *vkb, HbInputMethod *owner)
    90 {
    90 {
    91     Q_D(HbVkbHostBridge);
    91     Q_D(HbVkbHostBridge);
    92     if (d->mActiveHost) {
    92     if (d->mActiveHost) {
    93         d->mActiveHost->openMinimizedKeypad(vkb, owner);
    93         d->mActiveHost->openMinimizedKeypad(vkb, owner);
    94     }
    94     }
   130     return HbVkbHost::HbVkbStatusClosed;
   130     return HbVkbHost::HbVkbStatusClosed;
   131 }
   131 }
   132 
   132 
   133 /*!
   133 /*!
   134 \reimp
   134 \reimp
   135 */ 
   135 */
   136 QSizeF HbVkbHostBridge::keyboardArea() const
   136 QSizeF HbVkbHostBridge::keyboardArea() const
   137 {
   137 {
   138     Q_D(const HbVkbHostBridge);
   138     Q_D(const HbVkbHostBridge);
   139     if (d->mActiveHost) {
   139     if (d->mActiveHost) {
   140         return d->mActiveHost->keyboardArea();
   140         return d->mActiveHost->keyboardArea();
   144 }
   144 }
   145 
   145 
   146 /*!
   146 /*!
   147 \reimp
   147 \reimp
   148 */
   148 */
   149 HbVirtualKeyboard* HbVkbHostBridge::activeKeypad() const
   149 HbVirtualKeyboard *HbVkbHostBridge::activeKeypad() const
   150 {
   150 {
   151     Q_D(const HbVkbHostBridge);
   151     Q_D(const HbVkbHostBridge);
   152     if (d->mActiveHost) {
   152     if (d->mActiveHost) {
   153         return d->mActiveHost->activeKeypad();
   153         return d->mActiveHost->activeKeypad();
   154     }
   154     }
   201 */
   201 */
   202 bool HbVkbHostBridge::connectHost(HbVkbHost *host)
   202 bool HbVkbHostBridge::connectHost(HbVkbHost *host)
   203 {
   203 {
   204     Q_D(HbVkbHostBridge);
   204     Q_D(HbVkbHostBridge);
   205 
   205 
   206     if (d->mActiveHost && d->mActiveHost->stateTransitionOngoing()) {     
   206     if (d->mActiveHost && d->mActiveHost->stateTransitionOngoing()) {
   207         return false;
   207         return false;
   208     }
   208     }
   209 
   209 
   210     if (d->mActiveHost != host) {
   210     if (d->mActiveHost != host) {
   211         if (d->mActiveHost) {
   211         if (d->mActiveHost) {
   212 		    // Closing the previous vkb hosts keypad so that if necessary can be launched again for that same vkb host.
   212             // Closing the previous vkb hosts keypad so that if necessary can be launched again for that same vkb host.
   213             d->mActiveHost->closeKeypad(false);
   213             d->mActiveHost->closeKeypad(false);
   214             disconnect(d->mActiveHost, SIGNAL(aboutToOpen()), this, SIGNAL(aboutToOpen()));
   214             disconnect(d->mActiveHost, SIGNAL(aboutToOpen()), this, SIGNAL(aboutToOpen()));
   215             disconnect(d->mActiveHost, SIGNAL(aboutToClose()), this, SIGNAL(aboutToClose()));
   215             disconnect(d->mActiveHost, SIGNAL(aboutToClose()), this, SIGNAL(aboutToClose()));
   216             disconnect(d->mActiveHost, SIGNAL(keypadOpened()), this, SIGNAL(keypadOpened()));
   216             disconnect(d->mActiveHost, SIGNAL(keypadOpened()), this, SIGNAL(keypadOpened()));
   217             disconnect(d->mActiveHost, SIGNAL(keypadClosed()), this, SIGNAL(keypadClosed()));
   217             disconnect(d->mActiveHost, SIGNAL(keypadClosed()), this, SIGNAL(keypadClosed()));
   218             disconnect(d->mActiveHost, SIGNAL(keypadOpened()), this, SIGNAL(stateTransitionCompleted()));
   218             disconnect(d->mActiveHost, SIGNAL(keypadOpened()), this, SIGNAL(stateTransitionCompleted()));
   219             disconnect(d->mActiveHost, SIGNAL(keypadClosed()), this, SIGNAL(stateTransitionCompleted()));
   219             disconnect(d->mActiveHost, SIGNAL(keypadClosed()), this, SIGNAL(stateTransitionCompleted()));
   220         }  
   220         }
   221 
   221 
   222         d->mActiveHost = host;
   222         d->mActiveHost = host;
   223         if (d->mActiveHost) {
   223         if (d->mActiveHost) {
   224             connect(d->mActiveHost, SIGNAL(aboutToOpen()), this, SIGNAL(aboutToOpen()));
   224             connect(d->mActiveHost, SIGNAL(aboutToOpen()), this, SIGNAL(aboutToOpen()));
   225             connect(d->mActiveHost, SIGNAL(aboutToClose()), this, SIGNAL(aboutToClose()));
   225             connect(d->mActiveHost, SIGNAL(aboutToClose()), this, SIGNAL(aboutToClose()));