kstringvalidator.h Source File (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# 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., 59 Temple Place, Suite 330, Boston, MA
    00019     02111-1307 USA
    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.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:57:45 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001