homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuviewbuilder.cpp
changeset 51 4785f57bf3d4
parent 46 23b5d6a29cce
child 55 03646e8da489
equal deleted inserted replaced
46:23b5d6a29cce 51:4785f57bf3d4
    32 #include <HbToolBarExtension>
    32 #include <HbToolBarExtension>
    33 
    33 
    34 #include "hsmenuviewbuilder.h"
    34 #include "hsmenuviewbuilder.h"
    35 #include "hsmenustates_global.h"
    35 #include "hsmenustates_global.h"
    36 
    36 
    37 // TODO this class is temprary solution, proper one should come from Orbit
       
    38 class HsVkbHost : public HbStaticVkbHost
       
    39 {
       
    40 public:
       
    41     explicit HsVkbHost(HbWidget *target):
       
    42         HbStaticVkbHost(target), mWidget(target) {}
       
    43 
       
    44 #ifdef COVERAGE_MEASUREMENT
       
    45 #pragma CTC SKIP
       
    46 #endif //COVERAGE_MEASUREMENT skipped: its very temporary TODO
       
    47     void openFinished() {
       
    48         updateViewHeight(applicationArea().height());
       
    49     }
       
    50 
       
    51     void closeFinished() {
       
    52         updateViewHeight(-1);
       
    53     }
       
    54 
       
    55     void updateViewHeight(qreal height) {
       
    56         HbView *view = mWidget->mainWindow()->currentView();
       
    57         view->setMaximumHeight(height);
       
    58     }
       
    59 #ifdef COVERAGE_MEASUREMENT
       
    60 #pragma CTC ENDSKIP
       
    61 #endif //COVERAGE_MEASUREMENT
       
    62 
       
    63     HbWidget *mWidget;
       
    64 };
       
    65 
    37 
    66 /*!
    38 /*!
    67     \class HsMenuViewBuilder
    39     \class HsMenuViewBuilder
    68     \ingroup group_hsmenustateplugin
    40     \ingroup group_hsmenustateplugin
    69 
    41 
    83   hide otherwise.
    55   hide otherwise.
    84  */
    56  */
    85 void HsMenuViewBuilder::searchPanelVisibilityChange(bool visible)
    57 void HsMenuViewBuilder::searchPanelVisibilityChange(bool visible)
    86 {
    58 {
    87     if (visible) {
    59     if (visible) {
    88         // TODO this is temprary solution, proper solution should come from Orbit
    60 
    89         if (!HbVkbHost::getVkbHost(currentSearchPanel())) {
       
    90             new HsVkbHost(currentSearchPanel());
       
    91         }
       
    92         HbLineEdit *const lineEdit(searchPanelLineEdit());
    61         HbLineEdit *const lineEdit(searchPanelLineEdit());
    93 
    62 
    94         lineEdit->setText("");
    63         lineEdit->setText("");
    95     } else {
    64         lineEdit->setFocus();
    96         if (static_cast<HsVkbHost *>(HbVkbHost::getVkbHost(currentSearchPanel()))) {
    65     } 
    97             static_cast<HsVkbHost *>(HbVkbHost::getVkbHost(currentSearchPanel()))->
       
    98             updateViewHeight(-1);
       
    99         }
       
   100     }
       
   101 
    66 
   102 }
    67 }
   103 
    68 
   104 /*!
    69 /*!
   105  \return pointer to the view resulting from last \a build call or NULL if 
    70  \return pointer to the view resulting from last \a build call or NULL if