--- wt-3.2.1/src/Wt/WLineEdit.C.orig +++ wt-3.2.1/src/Wt/WLineEdit.C @@ -19,7 +19,8 @@ : WFormWidget(parent), textSize_(10), maxLength_(-1), - echoMode_(Normal) + echoMode_(Normal), + autocomplete_(true) { setInline(true); setFormObject(true); @@ -30,7 +31,8 @@ content_(text), textSize_(10), maxLength_(-1), - echoMode_(Normal) + echoMode_(Normal), + autocomplete_(true) { setInline(true); setFormObject(true); @@ -77,6 +79,15 @@ } } +void WLineEdit::setAutocomplete(bool enabled) +{ + if (autocomplete_ != enabled) { + autocomplete_ = enabled; + flags_.set(BIT_AUTOCOMPLETE_CHANGED); + repaint(RepaintPropertyAttribute); + } +} + void WLineEdit::updateDom(DomElement& element, bool all) { if (all || flags_.test(BIT_CONTENT_CHANGED)) { @@ -89,6 +100,13 @@ flags_.reset(BIT_ECHO_MODE_CHANGED); } + if (all || flags_.test(BIT_AUTOCOMPLETE_CHANGED)) { + if (!all || !autocomplete_) { + element.setAttribute("autocomplete", autocomplete_ == true ? "on" : "off"); + } + flags_.reset(BIT_AUTOCOMPLETE_CHANGED); + } + if (all || flags_.test(BIT_TEXT_SIZE_CHANGED)) { element.setAttribute("size", boost::lexical_cast(textSize_)); --- wt-3.2.1/src/Wt/WLineEdit.orig +++ wt-3.2.1/src/Wt/WLineEdit @@ -129,6 +129,18 @@ */ EchoMode echoMode() const { return echoMode_; } + /*! \brief Sets autocomplete attribute. + * + * The default autocomplete attribute is enabled ("on"). + */ + void setAutocomplete(bool enabled); + + /*! \brief Returns the autocomplete attribute. + * + * \sa setAutocomplete(bool) + */ + bool autocomplete() const { return autocomplete_; } + /*! \brief Returns the current selection start. * * Returns -1 if there is no selected text. @@ -174,13 +186,15 @@ int textSize_; int maxLength_; EchoMode echoMode_; + bool autocomplete_; static const int BIT_CONTENT_CHANGED = 0; static const int BIT_TEXT_SIZE_CHANGED = 1; static const int BIT_MAX_LENGTH_CHANGED = 2; static const int BIT_ECHO_MODE_CHANGED = 3; + static const int BIT_AUTOCOMPLETE_CHANGED = 4; - std::bitset<4> flags_; + std::bitset<5> flags_; protected: virtual void updateDom(DomElement& element, bool all);