00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#ifndef __KSTRINGVALIDATOR_H__
00023
#define __KSTRINGVALIDATOR_H__
00024
00025
#include <qvalidator.h>
00026
#include <qstringlist.h>
00027
00057 class KStringListValidator :
public QValidator {
00058 Q_OBJECT
00059 Q_PROPERTY(
QStringList stringList READ stringList WRITE setStringList )
00060 Q_PROPERTY(
bool rejecting READ isRejecting WRITE setRejecting )
00061 Q_PROPERTY(
bool fixupEnabled READ isFixupEnabled WRITE setFixupEnabled )
00062
public:
00073 KStringListValidator(
const QStringList & list=
QStringList(),
00074
bool rejecting=
true,
bool fixupEnabled=
false,
00075
QObject * parent=0,
const char * name=0 )
00076 :
QValidator( parent, name ), mStringList( list ),
00077 mRejecting( rejecting ), mFixupEnabled( fixupEnabled ) {}
00078
00079
virtual State validate(
QString & input,
int & pos )
const;
00080
virtual void fixup(
QString & input )
const;
00081
00082
void setRejecting(
bool rejecting ) { mRejecting = rejecting; }
00083
bool isRejecting()
const {
return mRejecting; }
00084
00085
void setFixupEnabled(
bool fixupEnabled ) { mFixupEnabled = fixupEnabled; }
00086
bool isFixupEnabled()
const {
return mFixupEnabled; }
00087
00088
void setStringList(
const QStringList & list ) { mStringList = list; }
00089
QStringList stringList()
const {
return mStringList; }
00090
00091
protected:
00092
QStringList mStringList;
00093
bool mRejecting;
00094
bool mFixupEnabled;
00095
private:
00096
class KStringListValidator* d;
00097 };
00098
00115 class KMimeTypeValidator :
public QValidator
00116 {
00117 Q_OBJECT
00118
public:
00119
KMimeTypeValidator(
QObject* parent,
const char* name=0)
00120 :
QValidator( parent, name ) {}
00121
00128
virtual State
validate(
QString & input,
int & pos )
const;
00132
virtual void fixup(
QString & input )
const;
00133
private:
00134
class KMimeTypeValidator* d;
00135 };
00136
00137
00138
00139
#endif // __KSTRINGVALIDATOR_H__