|
|
|
@ -60,7 +60,7 @@ kMyMoneyMoneyValidator::kMyMoneyMoneyValidator( double bottom, double top, int d
|
|
|
|
|
TQValidator::State kMyMoneyMoneyValidator::validate( TQString & input, int & _p ) const
|
|
|
|
|
{
|
|
|
|
|
TQString s = input;
|
|
|
|
|
KLocale * l = TDEGlobal::locale();
|
|
|
|
|
TDELocale * l = TDEGlobal::locale();
|
|
|
|
|
// ok, we have to re-format the number to have:
|
|
|
|
|
// 1. decimalSymbol == '.'
|
|
|
|
|
// 2. negativeSign == '-'
|
|
|
|
@ -102,8 +102,8 @@ TQValidator::State kMyMoneyMoneyValidator::validate( TQString & input, int & _p
|
|
|
|
|
// the locale settings.
|
|
|
|
|
// If the lead-in or lead-out paren is present, remove it
|
|
|
|
|
// before passing the string to the TQDoubleValidator
|
|
|
|
|
if(l->negativeMonetarySignPosition() == KLocale::ParensAround
|
|
|
|
|
|| l->positiveMonetarySignPosition() == KLocale::ParensAround) {
|
|
|
|
|
if(l->negativeMonetarySignPosition() == TDELocale::ParensAround
|
|
|
|
|
|| l->positiveMonetarySignPosition() == TDELocale::ParensAround) {
|
|
|
|
|
TQRegExp regExp("^(\\()?([\\d-\\.]*)(\\))?$");
|
|
|
|
|
if(s.find(regExp) != -1) {
|
|
|
|
|
s = regExp.cap(2);
|
|
|
|
@ -142,8 +142,8 @@ TQValidator::State kMyMoneyMoneyValidator::validate( TQString & input, int & _p
|
|
|
|
|
// is intermediate, if only the lead-out is present then it
|
|
|
|
|
// definitely is invalid. Nevertheless, we check for parens
|
|
|
|
|
// only, if the locale settings have it enabled.
|
|
|
|
|
if(l->negativeMonetarySignPosition() == KLocale::ParensAround
|
|
|
|
|
|| l->positiveMonetarySignPosition() == KLocale::ParensAround) {
|
|
|
|
|
if(l->negativeMonetarySignPosition() == TDELocale::ParensAround
|
|
|
|
|
|| l->positiveMonetarySignPosition() == TDELocale::ParensAround) {
|
|
|
|
|
int tmp = input.contains('(') - input.contains(')');
|
|
|
|
|
if(tmp > 0)
|
|
|
|
|
rc = Intermediate;
|
|
|
|
@ -319,12 +319,12 @@ void kMyMoneyEdit::resetText(void)
|
|
|
|
|
|
|
|
|
|
void kMyMoneyEdit::theTextChanged(const TQString & theText)
|
|
|
|
|
{
|
|
|
|
|
KLocale * l = TDEGlobal::locale();
|
|
|
|
|
TDELocale * l = TDEGlobal::locale();
|
|
|
|
|
TQString d = l->monetaryDecimalSymbol();
|
|
|
|
|
TQString l_text = theText;
|
|
|
|
|
TQString nsign, psign;
|
|
|
|
|
if(l->negativeMonetarySignPosition() == KLocale::ParensAround
|
|
|
|
|
|| l->positiveMonetarySignPosition() == KLocale::ParensAround) {
|
|
|
|
|
if(l->negativeMonetarySignPosition() == TDELocale::ParensAround
|
|
|
|
|
|| l->positiveMonetarySignPosition() == TDELocale::ParensAround) {
|
|
|
|
|
nsign = psign = "(";
|
|
|
|
|
} else {
|
|
|
|
|
nsign = l->negativeSign();
|
|
|
|
@ -360,7 +360,7 @@ void kMyMoneyEdit::ensureFractionalPart(void)
|
|
|
|
|
void kMyMoneyEdit::ensureFractionalPart(TQString& s) const
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
KLocale* locale = TDEGlobal::locale();
|
|
|
|
|
TDELocale* locale = TDEGlobal::locale();
|
|
|
|
|
TQString decimalSymbol = locale->monetaryDecimalSymbol();
|
|
|
|
|
if(decimalSymbol.isEmpty())
|
|
|
|
|
decimalSymbol = ".";
|
|
|
|
|