diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kugar/lib/inputmask.h | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kugar/lib/inputmask.h')
-rw-r--r-- | kugar/lib/inputmask.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/kugar/lib/inputmask.h b/kugar/lib/inputmask.h new file mode 100644 index 00000000..2668ba0c --- /dev/null +++ b/kugar/lib/inputmask.h @@ -0,0 +1,61 @@ +/*************************************************************************** +* Copyright (C) 2005 by Adam Treat * +* treat@kde.org * +* * +* Copyright (C) 2000 Trolltech AS. All rights reserved. * +* info@trolltech.com * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU Library General Public License as * +* published by the Free Software Foundation; either version 2 of the * +* License, or (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef INPUTMASK_H +#define INPUTMASK_H + +#include <qobject.h> + +namespace Kugar +{ + +class InputMask : public QObject +{ + Q_OBJECT +public: + InputMask( QObject *parent = 0, const char *name = 0 ); + + ~InputMask(); + + QString mask() const; + void setMask( const QString &mask ); + + QString formatText( const QString &txt ); + +private: + void parseInputMask( const QString &maskFields ); + bool isValidInput( QChar key, QChar mask ) const; + QString maskString( uint pos, const QString &str, bool clear = FALSE ) const; + QString clearString( uint pos, uint len ) const; + QString stripString( const QString &str ) const; + int findInMask( int pos, bool forward, bool findSeparator, QChar searchChar = QChar() ) const; + +private: + QString m_text; + int m_maxLength; + QChar m_blank; + QString m_mask; + struct MaskInputData + { + enum Casemode { NoCaseMode, Upper, Lower }; + QChar maskChar; // either the separator char or the inputmask + bool separator; + Casemode caseMode; + }; + MaskInputData *m_maskData; +}; + +} + +#endif |