author | tille <tille> | 2003-05-23 19:43:46 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-23 19:43:46 (UTC) |
commit | 9b6b21112f38181f49b07e973bfe00c0d83a6900 (patch) (unidiff) | |
tree | c2fa45a93ac5c26fe98558f28bb0a166b14ad065 /noncore/settings/networksettings/ppp/knumvalidator.h | |
parent | 34b9974063032242e5de65fa56d4c2cb5e1ce565 (diff) | |
download | opie-9b6b21112f38181f49b07e973bfe00c0d83a6900.zip opie-9b6b21112f38181f49b07e973bfe00c0d83a6900.tar.gz opie-9b6b21112f38181f49b07e973bfe00c0d83a6900.tar.bz2 |
configure dialog basicly working
more kppp stuff... ;)
Diffstat (limited to 'noncore/settings/networksettings/ppp/knumvalidator.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/knumvalidator.h | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/ppp/knumvalidator.h b/noncore/settings/networksettings/ppp/knumvalidator.h new file mode 100644 index 0000000..c95293a --- a/dev/null +++ b/noncore/settings/networksettings/ppp/knumvalidator.h | |||
@@ -0,0 +1,211 @@ | |||
1 | /********************************************************************** | ||
2 | ** | ||
3 | ** $Id$ | ||
4 | ** | ||
5 | ** Copyright (C) 1999 Glen Parker <glenebob@nwlink.com> | ||
6 | ** Copyright (C) 2002 Marc Mutz <mutz@kde.org> | ||
7 | ** | ||
8 | ** This library is free software; you can redistribute it and/or | ||
9 | ** modify it under the terms of the GNU Library General Public | ||
10 | ** License as published by the Free Software Foundation; either | ||
11 | ** version 2 of the License, or (at your option) any later version. | ||
12 | ** | ||
13 | ** This library is distributed in the hope that it will be useful, | ||
14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | ** Library General Public License for more details. | ||
17 | ** | ||
18 | ** You should have received a copy of the GNU Library General Public | ||
19 | ** License along with this library; if not, write to the Free | ||
20 | ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | ** | ||
22 | *****************************************************************************/ | ||
23 | |||
24 | #ifndef __KNUMVALIDATOR_H | ||
25 | #define __KNUMVALIDATOR_H | ||
26 | |||
27 | #include <qvalidator.h> | ||
28 | |||
29 | class QWidget; | ||
30 | class QString; | ||
31 | |||
32 | /** | ||
33 | * @ref QValidator for integers. | ||
34 | |||
35 | This can be used by @ref QLineEdit or subclass to provide validated | ||
36 | text entry. Can be provided with a base value (default is 10), to allow | ||
37 | the proper entry of hexadecimal, octal, or any other base numeric data. | ||
38 | |||
39 | @author Glen Parker <glenebob@nwlink.com> | ||
40 | @version 0.0.1 | ||
41 | */ | ||
42 | class KIntValidator : public QValidator { | ||
43 | |||
44 | public: | ||
45 | /** | ||
46 | Constuctor. Also sets the base value. | ||
47 | */ | ||
48 | KIntValidator ( QWidget * parent, int base = 10, const char * name = 0 ); | ||
49 | /** | ||
50 | * Constructor. Also sets the minimum, maximum, and numeric base values. | ||
51 | */ | ||
52 | KIntValidator ( int bottom, int top, QWidget * parent, int base = 10, const char * name = 0 ); | ||
53 | /** | ||
54 | * Destructs the validator. | ||
55 | */ | ||
56 | virtual ~KIntValidator (); | ||
57 | /** | ||
58 | * Validates the text, and return the result. Does not modify the parameters. | ||
59 | */ | ||
60 | virtual State validate ( QString &, int & ) const; | ||
61 | /** | ||
62 | * Fixes the text if possible, providing a valid string. The parameter may be modified. | ||
63 | */ | ||
64 | virtual void fixup ( QString & ) const; | ||
65 | /** | ||
66 | * Sets the minimum and maximum values allowed. | ||
67 | */ | ||
68 | virtual void setRange ( int bottom, int top ); | ||
69 | /** | ||
70 | * Sets the numeric base value. | ||
71 | */ | ||
72 | virtual void setBase ( int base ); | ||
73 | /** | ||
74 | * Returns the current minimum value allowed. | ||
75 | */ | ||
76 | virtual int bottom () const; | ||
77 | /** | ||
78 | * Returns the current maximum value allowed. | ||
79 | */ | ||
80 | virtual int top () const; | ||
81 | /** | ||
82 | * Returns the current numeric base. | ||
83 | */ | ||
84 | virtual int base () const; | ||
85 | |||
86 | private: | ||
87 | int _base; | ||
88 | int _min; | ||
89 | int _max; | ||
90 | |||
91 | }; | ||
92 | |||
93 | class KFloatValidatorPrivate; | ||
94 | |||
95 | /** | ||
96 | @obsolete Use @ref KDoubleValidator | ||
97 | |||
98 | @ref QValidator for floating point entry. | ||
99 | Extends the QValidator class to properly validate double numeric data. | ||
100 | This can be used by @ref QLineEdit or subclass to provide validated | ||
101 | text entry. | ||
102 | |||
103 | @author Glen Parker <glenebob@nwlink.com> | ||
104 | @version 0.0.1 | ||
105 | */ | ||
106 | class KFloatValidator : public QValidator { | ||
107 | |||
108 | public: | ||
109 | /** | ||
110 | * Constructor. | ||
111 | */ | ||
112 | KFloatValidator ( QWidget * parent, const char * name = 0 ); | ||
113 | /** | ||
114 | * Constructor. Also sets the minimum and maximum values. | ||
115 | */ | ||
116 | KFloatValidator ( double bottom, double top, QWidget * parent, const char * name = 0 ); | ||
117 | /** | ||
118 | * Constructor. Sets the validator to be locale aware if @p localeAware is true. | ||
119 | */ | ||
120 | KFloatValidator ( double bottom, double top, bool localeAware, QWidget * parent, const char * name = 0 ); | ||
121 | /** | ||
122 | * Destructs the validator. | ||
123 | */ | ||
124 | virtual ~KFloatValidator (); | ||
125 | /** | ||
126 | * Validates the text, and return the result. Does not modify the parameters. | ||
127 | */ | ||
128 | virtual State validate ( QString &, int & ) const; | ||
129 | /** | ||
130 | * Fixes the text if possible, providing a valid string. The parameter may be modified. | ||
131 | */ | ||
132 | virtual void fixup ( QString & ) const; | ||
133 | /** | ||
134 | * Sets the minimum and maximum value allowed. | ||
135 | */ | ||
136 | virtual void setRange ( double bottom, double top ); | ||
137 | /** | ||
138 | * Returns the current minimum value allowed. | ||
139 | */ | ||
140 | virtual double bottom () const; | ||
141 | /** | ||
142 | * Returns the current maximum value allowed. | ||
143 | */ | ||
144 | virtual double top () const; | ||
145 | /** | ||
146 | * Sets the validator to be locale aware if @p is true. In this case, the | ||
147 | * character KLocale::decimalSymbol() from the global locale is recognized | ||
148 | * as decimal separator. | ||
149 | */ | ||
150 | void setAcceptLocalizedNumbers(bool b); | ||
151 | /** | ||
152 | * Returns true if the validator is locale aware. | ||
153 | * @see setAcceptLocalizedNumbers(). | ||
154 | */ | ||
155 | bool acceptLocalizedNumbers() const; | ||
156 | |||
157 | private: | ||
158 | double _min; | ||
159 | double _max; | ||
160 | |||
161 | KFloatValidatorPrivate *d; | ||
162 | }; | ||
163 | |||
164 | /** | ||
165 | KDoubleValidator extends @ref QDoubleValidator to be | ||
166 | locale-aware. That means that - subject to not being disabled - | ||
167 | @ref KLocale::decimalPoint(), @ref KLocale::thousandsSeparator() | ||
168 | and @ref KLocale::positiveSign() and @ref KLocale::negativeSign() | ||
169 | are respected. | ||
170 | |||
171 | @short A locale-aware @ref QDoubleValidator | ||
172 | @author Marc Mutz <mutz@kde.org> | ||
173 | @version $Id$ | ||
174 | @see KIntValidator | ||
175 | @since 3.1 | ||
176 | **/ | ||
177 | |||
178 | class KDoubleValidator : public QDoubleValidator { | ||
179 | Q_OBJECT | ||
180 | Q_PROPERTY( bool acceptLocalizedNumbers READ acceptLocalizedNumbers WRITE setAcceptLocalizedNumbers ) | ||
181 | public: | ||
182 | /** Constuct a locale-aware KDoubleValidator with default range | ||
183 | (whatever @ref QDoubleValidator uses for that) and parent @p | ||
184 | parent */ | ||
185 | // KDoubleValidator( QObject * parent, const char * name=0 ); | ||
186 | KDoubleValidator( QWidget * parent, const char * name=0 ); | ||
187 | /** Constuct a locale-aware KDoubleValidator for range [@p bottom,@p | ||
188 | top] and a precision of @p decimals decimals after the decimal | ||
189 | point. */ | ||
190 | KDoubleValidator( double bottom, double top, int decimals, | ||
191 | QWidget * parent, const char * name=0 ); | ||
192 | // QObject * parent, const char * name=0 ); | ||
193 | /** Destructs the validator. | ||
194 | */ | ||
195 | virtual ~KDoubleValidator(); | ||
196 | |||
197 | /** Overloaded for internal reasons. The API is not affected. */ | ||
198 | virtual QValidator::State validate( QString & input, int & pos ) const; | ||
199 | |||
200 | /** @return whether localized numbers are accepted (default: true) */ | ||
201 | bool acceptLocalizedNumbers() const; | ||
202 | /** Sets whether to accept localized numbers (default: true) */ | ||
203 | void setAcceptLocalizedNumbers( bool accept ); | ||
204 | |||
205 | private: | ||
206 | typedef QDoubleValidator base; | ||
207 | class Private; | ||
208 | Private * d; | ||
209 | }; | ||
210 | |||
211 | #endif | ||