src/hbwidgets/widgets/hbsearchpanel.cpp
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 34 ed14f46c0e55
--- a/src/hbwidgets/widgets/hbsearchpanel.cpp	Mon Apr 19 14:02:13 2010 +0300
+++ b/src/hbwidgets/widgets/hbsearchpanel.cpp	Mon May 03 12:48:33 2010 +0300
@@ -25,6 +25,7 @@
 
 #include "hbsearchpanel.h"
 #include "hbsearchpanel_p.h"
+#include "hblineedit.h"
 
 
 /*!
@@ -128,15 +129,48 @@
 {
     Q_D( HbSearchPanel );
 
-    if( progressive && !isProgressive( ) ) {
-        d->removeProgressButton();
-    }
-    else if ( !progressive && isProgressive( ) ) {
-        d->addProgressButton();
+    if( progressive != isProgressive( ) ) {
+        if(progressive) {
+            d->removeProgressButton();
+        } else {
+            d->addProgressButton();
+        }
     }
 }
 
 /*!
+    \property HbSearchPanel::cancelEnabled
+    True, there is a cancel button in the search panel.
+    False, there is not a cancel button in the search panel.
+
+    \sa setCancelEnabled
+ */
+bool HbSearchPanel::isCancelEnabled( ) const
+{
+    Q_D( const HbSearchPanel );
+    return d->mCancelEnabled;
+}
+
+/*!
+    Set cancelEnabled property of the search panel. Parameter \a enabled is the new value of the
+    property.
+
+    \sa isCancelEnabled
+ */
+void HbSearchPanel::setCancelEnabled( bool enabled )
+{
+    Q_D( HbSearchPanel );
+    if( enabled != isCancelEnabled( ) ) {
+        if(enabled) {
+            d->addCancelButton();
+        } else {
+            d->removeCancelButton();
+        }
+    }
+}
+
+
+/*!
     \property HbSearchPanel::searchOptions
     True, there is a search options button in the search panel.
     False, there is not a search options button in the search panel.
@@ -158,11 +192,62 @@
 void HbSearchPanel::setSearchOptionsEnabled( bool enabled )
 {
     Q_D( HbSearchPanel );
-    if( enabled && !isSearchOptionsEnabled( ) ) {
-        d->addSearchOptionsButton();
-    }
-    else if ( !enabled && isSearchOptionsEnabled( ) ) {
-        d->removeSearchOptionsButton();
+    if( enabled != isSearchOptionsEnabled( ) ) {
+        if(enabled) {
+            d->addSearchOptionsButton();
+        } else {
+            d->removeSearchOptionsButton();
+        }
     }
 }
 
+
+/*!
+    \property HbSearchPanel::placeholderText
+    \brief the search panel's placeholder text
+
+    Setting this property makes the editor in search panel display a grayed-out
+    placeholder text as long as the criteria() is empty.
+    By default, this property contains an empty string.
+
+    \sa criteria()
+*/
+
+QString HbSearchPanel::placeholderText() const
+{
+    Q_D(const HbSearchPanel);
+    return d->mLineEdit->placeholderText();
+}
+
+/*!
+    \sa placeholderText()
+*/
+void HbSearchPanel::setPlaceholderText(const QString &text)
+{
+    Q_D(HbSearchPanel);
+    d->mLineEdit->setPlaceholderText(text);
+}
+
+/*!
+    Returns the search criteria.
+
+    \sa setCriteria()
+*/
+QString HbSearchPanel::criteria() const
+{
+    Q_D(const HbSearchPanel);
+    return d->mLineEdit->text();
+}
+
+/*!
+    Sets the search criteria to the search panel.
+
+    \sa criteria()
+*/
+void HbSearchPanel::setCriteria(const QString &text)
+{
+    Q_D(HbSearchPanel);
+    d->mLineEdit->setText(text);
+}
+
+