1
/* secqlineedit.h - Secure version of QLineEdit.
2
Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
3
Copyright (C) 2003 g10 Code GmbH
5
The license of the original qlineedit.h file from which this file
6
is derived can be found below. Modified by Marcus Brinkmann
7
<marcus@g10code.de>. All modifications are licensed as follows, so
8
that the intersection of the two licenses is then the GNU General
9
Public License version 2.
11
This program is free software; you can redistribute it and/or
12
modify it under the terms of the GNU General Public License as
13
published by the Free Software Foundation; either version 2 of the
14
License, or (at your option) any later version.
16
This program is distributed in the hope that it will be useful, but
17
WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
General Public License for more details.
21
You should have received a copy of the GNU General Public License
22
along with this program; if not, write to the Free Software
23
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26
#include "secqstring.h"
28
/* This disables some insecure code. */
31
/**********************************************************************
32
** $Id: secqlineedit.h 169 2007-09-18 17:45:38Z wk $
34
** Definition of SecQLineEdit widget class
38
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
40
** This file is part of the widgets module of the Qt GUI Toolkit.
42
** This file may be distributed under the terms of the Q Public License
43
** as defined by Trolltech AS of Norway and appearing in the file
44
** LICENSE.QPL included in the packaging of this file.
46
** This file may be distributed and/or modified under the terms of the
47
** GNU General Public License version 2 as published by the Free Software
48
** Foundation and appearing in the file LICENSE.GPL included in the
49
** packaging of this file.
51
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
52
** licenses may use this file in accordance with the Qt Commercial License
53
** Agreement provided with the Software.
55
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
56
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
58
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
59
** information about Qt Commercial License Agreements.
60
** See http://www.trolltech.com/qpl/ for QPL licensing information.
61
** See http://www.trolltech.com/gpl/ for GPL licensing information.
63
** Contact info@trolltech.com if any conditions of this licensing are
66
**********************************************************************/
68
#ifndef SECQLINEEDIT_H
69
#define SECQLINEEDIT_H
71
struct SecQLineEditPrivate;
83
class Q_EXPORT SecQLineEdit : public QFrame
87
// Q_PROPERTY( SecQString text READ text WRITE setText )
88
Q_PROPERTY( int maxLength READ maxLength WRITE setMaxLength )
89
Q_PROPERTY( bool frame READ frame WRITE setFrame )
90
Q_PROPERTY( EchoMode echoMode READ echoMode WRITE setEchoMode )
91
Q_PROPERTY( QString displayText READ displayText )
92
Q_PROPERTY( int cursorPosition READ cursorPosition WRITE setCursorPosition )
93
Q_PROPERTY( Alignment alignment READ alignment WRITE setAlignment )
94
Q_PROPERTY( bool edited READ edited WRITE setEdited DESIGNABLE false )
95
Q_PROPERTY( bool modified READ isModified )
96
Q_PROPERTY( bool hasMarkedText READ hasMarkedText DESIGNABLE false )
97
Q_PROPERTY( bool hasSelectedText READ hasSelectedText )
98
// Q_PROPERTY( SecQString markedText READ markedText DESIGNABLE false )
99
// Q_PROPERTY( SecQString selectedText READ selectedText )
100
Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
101
Q_PROPERTY( bool undoAvailable READ isUndoAvailable )
102
Q_PROPERTY( bool redoAvailable READ isRedoAvailable )
105
SecQLineEdit( QWidget* parent, const char* name=0 );
106
SecQLineEdit( const SecQString &, QWidget* parent, const char* name=0 );
107
SecQLineEdit( const SecQString &, const QString &, QWidget* parent, const char* name=0 );
110
SecQString text() const;
112
QString displayText() const;
114
int maxLength() const;
118
enum EchoMode { Normal, NoEcho, Password };
119
EchoMode echoMode() const;
121
bool isReadOnly() const;
123
QSize sizeHint() const;
124
QSize minimumSizeHint() const;
126
int cursorPosition() const;
127
bool validateAndSet( const SecQString &, int, int, int ); // obsolete
129
int alignment() const;
132
void cursorLeft( bool mark, int steps = 1 ) { cursorForward( mark, -steps ); }
133
void cursorRight( bool mark, int steps = 1 ) { cursorForward( mark, steps ); }
135
void cursorForward( bool mark, int steps = 1 );
136
void cursorBackward( bool mark, int steps = 1 );
137
void cursorWordForward( bool mark );
138
void cursorWordBackward( bool mark );
141
void home( bool mark );
142
void end( bool mark );
144
bool isModified() const;
145
void clearModified();
147
bool edited() const; // obsolete, use isModified()
148
void setEdited( bool ); // obsolete, use clearModified()
150
bool hasSelectedText() const;
151
SecQString selectedText() const;
152
int selectionStart() const;
154
bool isUndoAvailable() const;
155
bool isRedoAvailable() const;
158
bool hasMarkedText() const { return hasSelectedText(); }
159
SecQString markedText() const { return selectedText(); }
163
virtual void setText( const SecQString &);
164
virtual void selectAll();
165
virtual void deselect();
166
virtual void insert( const SecQString &);
167
virtual void clear();
170
virtual void setMaxLength( int );
171
virtual void setFrame( bool );
172
virtual void setEchoMode( EchoMode );
173
virtual void setReadOnly( bool );
174
virtual void setFont( const QFont & );
175
virtual void setPalette( const QPalette & );
176
virtual void setSelection( int, int );
177
virtual void setCursorPosition( int );
178
virtual void setAlignment( int flag );
179
#ifndef QT_NO_CLIPBOARD
181
virtual void copy() const;
182
virtual void paste();
186
void textChanged( const SecQString &);
187
void textModified( const SecQString &);
188
void returnPressed();
190
void selectionChanged();
193
bool event( QEvent * );
194
void mousePressEvent( QMouseEvent * );
195
void mouseMoveEvent( QMouseEvent * );
196
void mouseReleaseEvent( QMouseEvent * );
197
void mouseDoubleClickEvent( QMouseEvent * );
198
void keyPressEvent( QKeyEvent * );
199
void imStartEvent( QIMEvent * );
200
void imComposeEvent( QIMEvent * );
201
void imEndEvent( QIMEvent * );
202
void focusInEvent( QFocusEvent * );
203
void focusOutEvent( QFocusEvent * );
204
void resizeEvent( QResizeEvent * );
205
void drawContents( QPainter * );
206
void windowActivationChange( bool );
208
void repaintArea( int, int ) { update(); }
212
void clipboardChanged();
215
QChar passwordChar() const; // obsolete internal
218
friend struct SecQLineEditPrivate;
219
SecQLineEditPrivate * d;
221
private: // Disabled copy constructor and operator=
222
#if defined(Q_DISABLE_COPY)
223
SecQLineEdit( const SecQLineEdit & );
224
SecQLineEdit &operator=( const SecQLineEdit & );
228
#endif // SECQLINEEDIT_H