src/hbplugins/inputmethods/common/hbinputabstractbase.cpp
changeset 0 16d8024aca5e
child 1 f7ac710697a9
equal deleted inserted replaced
-1:000000000000 0:16d8024aca5e
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (developer.feedback@nokia.com)
       
     6 **
       
     7 ** This file is part of the HbPlugins module of the UI Extensions for Mobile.
       
     8 **
       
     9 ** GNU Lesser General Public License Usage
       
    10 ** This file may be used under the terms of the GNU Lesser General Public
       
    11 ** License version 2.1 as published by the Free Software Foundation and
       
    12 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    13 ** Please review the following information to ensure the GNU Lesser General
       
    14 ** Public License version 2.1 requirements will be met:
       
    15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    16 **
       
    17 ** In addition, as a special exception, Nokia gives you certain additional
       
    18 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    20 **
       
    21 ** If you have questions regarding the use of this file, please contact
       
    22 ** Nokia at developer.feedback@nokia.com.
       
    23 **
       
    24 ****************************************************************************/
       
    25 
       
    26 #include <qglobal.h>
       
    27 #include <hbinputvkbwidget.h>
       
    28 #include <hbinputcandidatelist.h>
       
    29 #include <hbmainwindow.h>
       
    30 
       
    31 #include "hbinputabstractbase.h"
       
    32 
       
    33 const qreal HbDeltaHeight = 2.0;
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // HbInputAbstractMethod::HbInputAbstractMethod
       
    37 //
       
    38 // ---------------------------------------------------------------------------
       
    39 HbInputAbstractMethod::HbInputAbstractMethod()
       
    40 {
       
    41 }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // HbInputAbstractMethod::~HbInputAbstractMethod
       
    45 //
       
    46 // ---------------------------------------------------------------------------
       
    47 HbInputAbstractMethod::~HbInputAbstractMethod()
       
    48 {
       
    49 }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // HbInputAbstractMethod::launchCandidatePopup
       
    53 //
       
    54 // ---------------------------------------------------------------------------
       
    55 void HbInputAbstractMethod::launchCandidatePopup(const QStringList &candidates)
       
    56 {
       
    57     Q_UNUSED(candidates);
       
    58 }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // HbInputAbstractMethod::closeKeypad
       
    62 //
       
    63 // ---------------------------------------------------------------------------
       
    64 void HbInputAbstractMethod::closeKeypad()
       
    65 {
       
    66 }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // HbInputAbstractMethod::launchCharacterPreviewPane
       
    70 //
       
    71 // ---------------------------------------------------------------------------
       
    72 void HbInputAbstractMethod::launchCharacterPreviewPane(int key)
       
    73 {
       
    74     Q_UNUSED(key);
       
    75 }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // HbInputAbstractMethod::switchSpecialCharacterTable
       
    79 //
       
    80 // ---------------------------------------------------------------------------
       
    81 void HbInputAbstractMethod::switchSpecialCharacterTable()
       
    82 {
       
    83 }
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // HbInputAbstractMethod::selectSpecialCharacterTableMode
       
    87 //
       
    88 // ---------------------------------------------------------------------------
       
    89 void HbInputAbstractMethod::selectSpecialCharacterTableMode()
       
    90 {
       
    91 }
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // HbInputAbstractMethod::closeExactWordPopup
       
    95 //
       
    96 // ---------------------------------------------------------------------------
       
    97 void HbInputAbstractMethod::closeExactWordPopup()
       
    98 {
       
    99 }
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // HbInputAbstractMethod::launchExactWordPopup
       
   103 //
       
   104 // ---------------------------------------------------------------------------
       
   105 void HbInputAbstractMethod::launchExactWordPopup(QString exactWord)
       
   106 {
       
   107     Q_UNUSED(exactWord);
       
   108 }
       
   109 
       
   110 // ---------------------------------------------------------------------------
       
   111 // HbInputAbstractMethod::launchAutoCompletionPopup
       
   112 //
       
   113 // ---------------------------------------------------------------------------
       
   114 void HbInputAbstractMethod::launchAutoCompletionPopup(const QStringList& candidates)
       
   115 {
       
   116     Q_UNUSED(candidates);
       
   117 }
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // HbInputAbstractMethod::closeAutoCompletionPopup
       
   121 //
       
   122 // ---------------------------------------------------------------------------
       
   123 void HbInputAbstractMethod::closeAutoCompletionPopup()
       
   124 {
       
   125 }
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // HbInputAbstractMethod::switchMode
       
   129 //
       
   130 // ---------------------------------------------------------------------------
       
   131 void HbInputAbstractMethod::switchMode(int keyCode)
       
   132 {
       
   133     Q_UNUSED(keyCode);
       
   134 } 
       
   135 
       
   136 // ---------------------------------------------------------------------------
       
   137 // HbInputAbstractMethod::starKeySelected
       
   138 //
       
   139 // ---------------------------------------------------------------------------
       
   140 void HbInputAbstractMethod::starKeySelected()
       
   141 {
       
   142 }
       
   143 
       
   144 void HbInputAbstractMethod::getCandidatePositionAndSize(HbCandidateList *candidatePopup,
       
   145                     HbInputVkbWidget *currentKeypad, QPointF & pos,QSizeF & size)
       
   146 {
       
   147     QRectF cursorRect = focusObject()->microFocus(); // from the top of the screen
       
   148 
       
   149     QSize vpSize = currentKeypad->mainWindow()->size();
       
   150     QRectF viewport = QRectF(currentKeypad->mainWindow()->mapToScene(QPoint(0, 0)),
       
   151                       currentKeypad->mainWindow()->mapToScene(QPoint(vpSize.width(), vpSize.height())));
       
   152 
       
   153     pos = QPointF(cursorRect.bottomLeft().x(), cursorRect.bottomLeft().y() + HbDeltaHeight);
       
   154     size = candidatePopup->size();
       
   155     size.setHeight(abs((int)viewport.height()) - pos.y());
       
   156 
       
   157     QRectF geom = candidatePopup->geometry();
       
   158     if (size.height() > geom.height()) {
       
   159         size.setHeight(geom.height());
       
   160     }
       
   161 
       
   162     if ((pos.x() + size.width()) > abs((int)viewport.width())) {
       
   163         // can not fit candidate popup to the right side of inline edit text.
       
   164         pos.setX(abs((int)viewport.width()) - size.width());
       
   165     }
       
   166 }
       
   167