src/hbwidgets/widgets/hbsearchpanel_p.cpp
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 6 c3690ec91ef8
equal deleted inserted replaced
0:16d8024aca5e 1:f7ac710697a9
    45 
    45 
    46 HbSearchPanelPrivate::HbSearchPanelPrivate( ):
    46 HbSearchPanelPrivate::HbSearchPanelPrivate( ):
    47     HbWidgetPrivate (  ),
    47     HbWidgetPrivate (  ),
    48     mProgressive ( true ),
    48     mProgressive ( true ),
    49     mSearchOptions ( false ),
    49     mSearchOptions ( false ),
       
    50     mCancelEnabled(true),
    50     mSearchOptionsButton(0),
    51     mSearchOptionsButton(0),
    51     mLineEdit(0),
    52     mLineEdit(0),
    52     mProgressButton(0),
    53     mProgressButton(0),
    53     mCancelButton(0)
    54     mCancelButton(0)
    54 {
    55 {
    66     //set default values
    67     //set default values
    67     q->setAttribute(Hb::InputMethodNeutral);
    68     q->setAttribute(Hb::InputMethodNeutral);
    68     q->setFlag(QGraphicsItem::ItemIsFocusable);
    69     q->setFlag(QGraphicsItem::ItemIsFocusable);
    69 
    70 
    70     // connect initial state signals
    71     // connect initial state signals
    71     QObject::connect(mCancelButton, SIGNAL(clicked()), q, SLOT(_q_hideClicked()));
       
    72     QObject::connect(mLineEdit, SIGNAL(textChanged(QString)), q, SIGNAL(criteriaChanged(QString)));
    72     QObject::connect(mLineEdit, SIGNAL(textChanged(QString)), q, SIGNAL(criteriaChanged(QString)));
    73 
    73 
    74 }
    74 }
    75 
    75 
    76 void HbSearchPanelPrivate::addSearchOptionsButton()
    76 void HbSearchPanelPrivate::addSearchOptionsButton()
   125     // start to send events always when text is updated
   125     // start to send events always when text is updated
   126     QObject::connect(mLineEdit, SIGNAL(textChanged(QString)), q, SIGNAL(criteriaChanged(QString)));
   126     QObject::connect(mLineEdit, SIGNAL(textChanged(QString)), q, SIGNAL(criteriaChanged(QString)));
   127     q->repolish();
   127     q->repolish();
   128 }
   128 }
   129 
   129 
       
   130 void HbSearchPanelPrivate::addCancelButton()
       
   131 {
       
   132     Q_Q( HbSearchPanel );
       
   133     mCancelEnabled = true;
       
   134     mCancelButton = new HbPushButton(q);
       
   135     mCancelButton->setObjectName("cancelbutton");
       
   136     mCancelButton->setIcon(HbIcon(cancelIcon));
       
   137     mCancelButton->setFlag(QGraphicsItem::ItemIsPanel, true);
       
   138     mCancelButton->setActive(false);
       
   139     HbStyle::setItemName( mCancelButton, "cancelbutton" );
       
   140     QObject::connect(mCancelButton, SIGNAL(clicked()), q, SLOT(_q_hideClicked()));
       
   141     q->repolish();
       
   142 }
       
   143 
       
   144 void HbSearchPanelPrivate::removeCancelButton()
       
   145 {
       
   146     Q_Q( HbSearchPanel );
       
   147     mCancelEnabled = false;
       
   148     HbStyle::setItemName( mCancelButton, "" );
       
   149     mCancelButton->deleteLater();
       
   150     mCancelButton = 0;
       
   151     q->repolish();
       
   152 }
       
   153 
       
   154 
   130 void HbSearchPanelPrivate::constructUi()
   155 void HbSearchPanelPrivate::constructUi()
   131 {
   156 {
   132     Q_Q( HbSearchPanel );
   157     Q_Q( HbSearchPanel );
   133 
   158 
   134     //construct default ui.
   159     //construct default ui.
   135     mLineEdit = new HbLineEdit(q);
   160     mLineEdit = new HbLineEdit(q);
   136     mLineEdit->setObjectName("lineedit");
   161     mLineEdit->setObjectName("lineedit");
   137     mLineEdit->setFontSpec(HbFontSpec(HbFontSpec::Secondary));
       
   138     HbStyle::setItemName( mLineEdit, "lineedit" );
   162     HbStyle::setItemName( mLineEdit, "lineedit" );
   139 	
   163     if(mCancelEnabled) {
   140     mCancelButton = new HbPushButton(q);
   164         addCancelButton();
   141     mCancelButton->setObjectName("cancelbutton");
   165     }
   142     mCancelButton->setIcon(cancelIcon);
       
   143 #if QT_VERSION >= 0x040600
       
   144     mCancelButton->setFlag(QGraphicsItem::ItemIsPanel, true);
       
   145     mCancelButton->setActive(false);
       
   146 #endif
       
   147     HbStyle::setItemName( mCancelButton, "cancelbutton" );
       
   148 }
   166 }
   149 
   167 
   150 void HbSearchPanelPrivate::_q_hideClicked()
   168 void HbSearchPanelPrivate::_q_hideClicked()
   151 {
   169 {
   152     Q_Q( HbSearchPanel );
   170     Q_Q( HbSearchPanel );