homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuviewbuilder.cpp
changeset 39 4e8ebe173323
parent 35 f9ce957a272c
child 46 23b5d6a29cce
equal deleted inserted replaced
36:cdae8c6c3876 39:4e8ebe173323
    23 #include <HbLineEdit>
    23 #include <HbLineEdit>
    24 #include <HbSearchPanel>
    24 #include <HbSearchPanel>
    25 #include <HbToolBar>
    25 #include <HbToolBar>
    26 #include <HbView>
    26 #include <HbView>
    27 #include <HbWidget>
    27 #include <HbWidget>
       
    28 #include <HbStaticVkbHost>
       
    29 #include <HbMainWindow>
       
    30 #include <HbInputMethod>
    28 
    31 
    29 #include "hsmenuviewbuilder.h"
    32 #include "hsmenuviewbuilder.h"
    30 #include "hsmenustates_global.h"
    33 #include "hsmenustates_global.h"
       
    34 
       
    35 // TODO this class is temprary solution, proper one should come from Orbit
       
    36 class HsVkbHost : public HbStaticVkbHost {
       
    37 public:
       
    38 	explicit HsVkbHost(HbWidget *target):
       
    39 		HbStaticVkbHost(target), mWidget(target) {}
       
    40 
       
    41 #ifdef COVERAGE_MEASUREMENT
       
    42 #pragma CTC SKIP
       
    43 #endif //COVERAGE_MEASUREMENT skipped: its very temporary TODO
       
    44 	void openFinished() {		
       
    45 		updateViewHeight(applicationArea().height());
       
    46 	}
       
    47 
       
    48 	void closeFinished(){				
       
    49 		updateViewHeight(-1);
       
    50 	}
       
    51 
       
    52 	void updateViewHeight(qreal height) {		
       
    53 		HbView* view = mWidget->mainWindow()->currentView();
       
    54 		view->setMaximumHeight(height);
       
    55 	}
       
    56 #ifdef COVERAGE_MEASUREMENT
       
    57 #pragma CTC ENDSKIP
       
    58 #endif //COVERAGE_MEASUREMENT
       
    59 	
       
    60 	HbWidget * mWidget;
       
    61 };
    31 
    62 
    32 /*!
    63 /*!
    33     \class HsMenuViewBuilder
    64     \class HsMenuViewBuilder
    34     \ingroup group_hsmenustateplugin
    65     \ingroup group_hsmenustateplugin
    35 
    66 
    70     if (visible != mViewOptions.testFlag(Search)) {
   101     if (visible != mViewOptions.testFlag(Search)) {
    71         mViewOptions ^= ViewOptions(Search);
   102         mViewOptions ^= ViewOptions(Search);
    72         result = parseSection(mSections[mViewOptions]);
   103         result = parseSection(mSections[mViewOptions]);
    73 
   104 
    74         if (visible) {
   105         if (visible) {
       
   106 			// TODO this is temprary solution, proper solution should come from Orbit
       
   107                         if (!HbVkbHost::getVkbHost(searchPanel()))
       
   108                                 {
       
   109                                 new HsVkbHost(searchPanel());
       
   110                                 }
    75             HbLineEdit *const lineEdit(searchPanelLineEdit());
   111             HbLineEdit *const lineEdit(searchPanelLineEdit());
    76 
   112 
    77             lineEdit->setText("");
   113             lineEdit->setText("");
    78         }
   114         }
       
   115         else {
       
   116            if (static_cast<HsVkbHost *>(HbVkbHost::getVkbHost(searchPanel()))) {
       
   117              static_cast<HsVkbHost *>(HbVkbHost::getVkbHost(searchPanel()))->
       
   118                      updateViewHeight(-1);
       
   119             }
       
   120        }
    79     }
   121     }
    80 
       
    81     return result;
   122     return result;
    82 }
   123 }
    83 
   124 
    84 /*!
   125 /*!
    85  \return \a true when label is visible, \a false otherwise.
   126  \return \a true when label is visible, \a false otherwise.