src/hbwidgets/widgets/hbsearchpanel.cpp
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 34 ed14f46c0e55
equal deleted inserted replaced
0:16d8024aca5e 1:f7ac710697a9
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 
    25 
    26 #include "hbsearchpanel.h"
    26 #include "hbsearchpanel.h"
    27 #include "hbsearchpanel_p.h"
    27 #include "hbsearchpanel_p.h"
       
    28 #include "hblineedit.h"
    28 
    29 
    29 
    30 
    30 /*!
    31 /*!
    31  @beta
    32  @beta
    32  @hbwidgets
    33  @hbwidgets
   126  */
   127  */
   127 void HbSearchPanel::setProgressive( bool progressive )
   128 void HbSearchPanel::setProgressive( bool progressive )
   128 {
   129 {
   129     Q_D( HbSearchPanel );
   130     Q_D( HbSearchPanel );
   130 
   131 
   131     if( progressive && !isProgressive( ) ) {
   132     if( progressive != isProgressive( ) ) {
   132         d->removeProgressButton();
   133         if(progressive) {
       
   134             d->removeProgressButton();
       
   135         } else {
       
   136             d->addProgressButton();
       
   137         }
   133     }
   138     }
   134     else if ( !progressive && isProgressive( ) ) {
   139 }
   135         d->addProgressButton();
   140 
       
   141 /*!
       
   142     \property HbSearchPanel::cancelEnabled
       
   143     True, there is a cancel button in the search panel.
       
   144     False, there is not a cancel button in the search panel.
       
   145 
       
   146     \sa setCancelEnabled
       
   147  */
       
   148 bool HbSearchPanel::isCancelEnabled( ) const
       
   149 {
       
   150     Q_D( const HbSearchPanel );
       
   151     return d->mCancelEnabled;
       
   152 }
       
   153 
       
   154 /*!
       
   155     Set cancelEnabled property of the search panel. Parameter \a enabled is the new value of the
       
   156     property.
       
   157 
       
   158     \sa isCancelEnabled
       
   159  */
       
   160 void HbSearchPanel::setCancelEnabled( bool enabled )
       
   161 {
       
   162     Q_D( HbSearchPanel );
       
   163     if( enabled != isCancelEnabled( ) ) {
       
   164         if(enabled) {
       
   165             d->addCancelButton();
       
   166         } else {
       
   167             d->removeCancelButton();
       
   168         }
   136     }
   169     }
   137 }
   170 }
       
   171 
   138 
   172 
   139 /*!
   173 /*!
   140     \property HbSearchPanel::searchOptions
   174     \property HbSearchPanel::searchOptions
   141     True, there is a search options button in the search panel.
   175     True, there is a search options button in the search panel.
   142     False, there is not a search options button in the search panel.
   176     False, there is not a search options button in the search panel.
   156     \sa isSearchOptionsEnabled
   190     \sa isSearchOptionsEnabled
   157  */
   191  */
   158 void HbSearchPanel::setSearchOptionsEnabled( bool enabled )
   192 void HbSearchPanel::setSearchOptionsEnabled( bool enabled )
   159 {
   193 {
   160     Q_D( HbSearchPanel );
   194     Q_D( HbSearchPanel );
   161     if( enabled && !isSearchOptionsEnabled( ) ) {
   195     if( enabled != isSearchOptionsEnabled( ) ) {
   162         d->addSearchOptionsButton();
   196         if(enabled) {
       
   197             d->addSearchOptionsButton();
       
   198         } else {
       
   199             d->removeSearchOptionsButton();
       
   200         }
   163     }
   201     }
   164     else if ( !enabled && isSearchOptionsEnabled( ) ) {
   202 }
   165         d->removeSearchOptionsButton();
   203 
   166     }
   204 
   167 }
   205 /*!
   168 
   206     \property HbSearchPanel::placeholderText
       
   207     \brief the search panel's placeholder text
       
   208 
       
   209     Setting this property makes the editor in search panel display a grayed-out
       
   210     placeholder text as long as the criteria() is empty.
       
   211     By default, this property contains an empty string.
       
   212 
       
   213     \sa criteria()
       
   214 */
       
   215 
       
   216 QString HbSearchPanel::placeholderText() const
       
   217 {
       
   218     Q_D(const HbSearchPanel);
       
   219     return d->mLineEdit->placeholderText();
       
   220 }
       
   221 
       
   222 /*!
       
   223     \sa placeholderText()
       
   224 */
       
   225 void HbSearchPanel::setPlaceholderText(const QString &text)
       
   226 {
       
   227     Q_D(HbSearchPanel);
       
   228     d->mLineEdit->setPlaceholderText(text);
       
   229 }
       
   230 
       
   231 /*!
       
   232     Returns the search criteria.
       
   233 
       
   234     \sa setCriteria()
       
   235 */
       
   236 QString HbSearchPanel::criteria() const
       
   237 {
       
   238     Q_D(const HbSearchPanel);
       
   239     return d->mLineEdit->text();
       
   240 }
       
   241 
       
   242 /*!
       
   243     Sets the search criteria to the search panel.
       
   244 
       
   245     \sa criteria()
       
   246 */
       
   247 void HbSearchPanel::setCriteria(const QString &text)
       
   248 {
       
   249     Q_D(HbSearchPanel);
       
   250     d->mLineEdit->setText(text);
       
   251 }
       
   252 
       
   253