const QString& sect, const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param ),
myType( String ),
- myDecimals( 1000 )
+ myDecimals( 1000 ),
+ myEchoMode( 0 )
{
setControl( myEditor = new QLineEdit() );
updateEditor();
const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param ),
myType( type ),
- myDecimals( 1000 )
+ myDecimals( 1000 ),
+ myEchoMode( 0 )
{
setControl( myEditor = new QLineEdit() );
updateEditor();
updateEditor();
}
+/*!
+ \brief Get the line edit's echo mode
+ \return preference item echo mode value
+ \sa setEchoMode()
+*/
+int QtxPagePrefEditItem::echoMode() const
+{
+ return myEchoMode;
+}
+
+/*!
+ \brief Set the line edit's echo mode
+ \param echo new preference item echo mode value
+ \sa echoMode()
+*/
+void QtxPagePrefEditItem::setEchoMode( const int echo )
+{
+ if ( myEchoMode == echo )
+ return;
+
+ myEchoMode = echo;
+ updateEditor();
+}
+
/*!
\brief Store preference item to the resource manager.
\sa retrieve()
return inputType();
else if ( name == "precision" || name == "prec" || name == "decimals" )
return decimals();
+ else if ( name == "echo" || name == "echo_mode" || name == "echomode")
+ return echoMode();
else
return QtxPageNamedPrefItem::optionValue( name );
}
if ( val.canConvert( QVariant::Int ) )
setDecimals( val.toInt() );
}
+ else if ( name == "echo" || name == "echo_mode" || name == "echomode") {
+ if ( val.canConvert( QVariant::Int ) )
+ setEchoMode( val.toInt() );
+ }
else
QtxPageNamedPrefItem::setOptionValue( name, val );
}
*/
void QtxPagePrefEditItem::updateEditor()
{
+ switch (myEchoMode)
+ {
+ case 0:
+ myEditor->setEchoMode(QLineEdit::Normal);
+ break;
+ case 1:
+ myEditor->setEchoMode(QLineEdit::NoEcho);
+ break;
+ case 2:
+ myEditor->setEchoMode(QLineEdit::Password);
+ break;
+ case 3:
+ myEditor->setEchoMode(QLineEdit::PasswordEchoOnEdit);
+ break;
+ default:
+ myEditor->setEchoMode(QLineEdit::Normal);
+ }
+
QValidator* val = 0;
switch ( inputType() )
{