kstringvalidator.h
00001 /* 00002 kstringvalidator.h 00003 00004 Copyright (c) 2001 Marc Mutz <mutz@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; version 2.0 00009 of the License. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public 00017 License along with this library; if not, write to the Free 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 02110-1301 USA 00020 */ 00021 00022 #ifndef __KSTRINGVALIDATOR_H__ 00023 #define __KSTRINGVALIDATOR_H__ 00024 00025 #include <tqvalidator.h> 00026 #include <tqstringlist.h> 00027 00028 #include <tdelibs_export.h> 00029 00060 class TDEUI_EXPORT KStringListValidator : public TQValidator { 00061 Q_OBJECT 00062 TQ_PROPERTY( TQStringList stringList READ stringList WRITE setStringList ) 00063 TQ_PROPERTY( bool rejecting READ isRejecting WRITE setRejecting ) 00064 TQ_PROPERTY( bool fixupEnabled READ isFixupEnabled WRITE setFixupEnabled ) 00065 public: 00076 KStringListValidator( const TQStringList & list=TQStringList(), 00077 bool rejecting=true, bool fixupEnabled=false, 00078 TQObject * parent=0, const char * name=0 ) 00079 : TQValidator( parent, name ), mStringList( list ), 00080 mRejecting( rejecting ), mFixupEnabled( fixupEnabled ) {} 00081 00082 virtual State validate( TQString & input, int & pos ) const; 00083 virtual void fixup( TQString & input ) const; 00084 00085 void setRejecting( bool rejecting ) { mRejecting = rejecting; } 00086 bool isRejecting() const { return mRejecting; } 00087 00088 void setFixupEnabled( bool fixupEnabled ) { mFixupEnabled = fixupEnabled; } 00089 bool isFixupEnabled() const { return mFixupEnabled; } 00090 00091 void setStringList( const TQStringList & list ) { mStringList = list; } 00092 TQStringList stringList() const { return mStringList; } 00093 00094 protected: 00095 TQStringList mStringList; 00096 bool mRejecting; 00097 bool mFixupEnabled; 00098 private: 00099 class KStringListValidator* d; 00100 }; 00101 00119 class TDEUI_EXPORT KMimeTypeValidator : public TQValidator 00120 { 00121 Q_OBJECT 00122 public: 00123 KMimeTypeValidator( TQObject* parent, const char* name=0) 00124 : TQValidator( parent, name ) {} 00125 00132 virtual State validate( TQString & input, int & pos ) const; 00136 virtual void fixup( TQString & input ) const; 00137 private: 00138 class KMimeTypeValidator* d; 00139 }; 00140 00141 #endif // __KSTRINGVALIDATOR_H__