kstringvalidator.h
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:
00070 KStringListValidator( const QStringList & list=QStringList(),
00071 bool rejecting=true, bool fixupEnabled=false,
00072 QObject * parent=0, const char * name=0 )
00073 : QValidator( parent, name ), mStringList( list ),
00074 mRejecting( rejecting ), mFixupEnabled( fixupEnabled ) {}
00075
00076 virtual State validate( QString & input, int & pos ) const;
00077 virtual void fixup( QString & input ) const;
00078
00079 void setRejecting( bool rejecting ) { mRejecting = rejecting; }
00080 bool isRejecting() const { return mRejecting; }
00081
00082 void setFixupEnabled( bool fixupEnabled ) { mFixupEnabled = fixupEnabled; }
00083 bool isFixupEnabled() const { return mFixupEnabled; }
00084
00085 void setStringList( const QStringList & list ) { mStringList = list; }
00086 QStringList stringList() const { return mStringList; }
00087
00088 protected:
00089 QStringList mStringList;
00090 bool mRejecting;
00091 bool mFixupEnabled;
00092 private:
00093 class KStringListValidator* d;
00094 };
00095
00112 class KMimeTypeValidator : public QValidator
00113 {
00114 Q_OBJECT
00115 public:
00116 KMimeTypeValidator( QObject* parent, const char* name=0)
00117 : QValidator( parent, name ) {}
00118
00125 virtual State validate( QString & input, int & pos ) const;
00129 virtual void fixup( QString & input ) const;
00130 private:
00131 class KMimeTypeValidator* d;
00132 };
00133
00134
00135
00136 #endif // __KSTRINGVALIDATOR_H__
This file is part of the documentation for kdelibs Version 3.1.4.