~x2go/x2go/pinentry-x2go_build-main

« back to all changes in this revision

Viewing changes to qt/secqlineedit.h

  • Committer: Mike Gabriel
  • Date: 2012-06-13 12:55:37 UTC
  • Revision ID: git-v1:d2060291d5cc7beb92f78168e48ececfe765d552
Strip code project down to its essentials, remove a lot of unneeded cruft. / Make code tree fully build with autotools, see README file for further info.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* secqlineedit.h - Secure version of QLineEdit.
2
 
   Copyright (C) 1992-2002 Trolltech AS.  All rights reserved.
3
 
   Copyright (C) 2003 g10 Code GmbH
4
 
 
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.
10
 
 
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.
15
 
 
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.
20
 
 
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
24
 
   02111-1307, USA  */
25
 
 
26
 
#include "secqstring.h"
27
 
 
28
 
/* This disables some insecure code.  */
29
 
#define SECURE  1
30
 
 
31
 
/**********************************************************************
32
 
** $Id: secqlineedit.h 169 2007-09-18 17:45:38Z wk $
33
 
**
34
 
** Definition of SecQLineEdit widget class
35
 
**
36
 
** Created : 941011
37
 
**
38
 
** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
39
 
**
40
 
** This file is part of the widgets module of the Qt GUI Toolkit.
41
 
**
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.
45
 
**
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.
50
 
**
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.
54
 
**
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.
57
 
**
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.
62
 
**
63
 
** Contact info@trolltech.com if any conditions of this licensing are
64
 
** not clear to you.
65
 
**
66
 
**********************************************************************/
67
 
 
68
 
#ifndef SECQLINEEDIT_H
69
 
#define SECQLINEEDIT_H
70
 
 
71
 
struct SecQLineEditPrivate;
72
 
 
73
 
class QPopupMenu;
74
 
 
75
 
#ifndef QT_H
76
 
#include "qframe.h"
77
 
#include "qstring.h"
78
 
#endif // QT_H
79
 
 
80
 
class QTextParagraph;
81
 
class QTextCursor;
82
 
 
83
 
class Q_EXPORT SecQLineEdit : public QFrame
84
 
{
85
 
    Q_OBJECT
86
 
    Q_ENUMS( EchoMode )
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 )
103
 
 
104
 
public:
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 );
108
 
    ~SecQLineEdit();
109
 
 
110
 
    SecQString text() const;
111
 
 
112
 
    QString displayText() const;
113
 
 
114
 
    int maxLength() const;
115
 
 
116
 
    bool frame() const;
117
 
 
118
 
    enum EchoMode { Normal, NoEcho, Password };
119
 
    EchoMode echoMode() const;
120
 
 
121
 
    bool isReadOnly() const;
122
 
 
123
 
    QSize sizeHint() const;
124
 
    QSize minimumSizeHint() const;
125
 
 
126
 
    int cursorPosition() const;
127
 
    bool validateAndSet( const SecQString &, int, int, int ); // obsolete
128
 
 
129
 
    int alignment() const;
130
 
 
131
 
#ifndef QT_NO_COMPAT
132
 
    void cursorLeft( bool mark, int steps = 1 ) { cursorForward( mark, -steps ); }
133
 
    void cursorRight( bool mark, int steps = 1 ) { cursorForward( mark, steps ); }
134
 
#endif
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 );
139
 
    void backspace();
140
 
    void del();
141
 
    void home( bool mark );
142
 
    void end( bool mark );
143
 
 
144
 
    bool isModified() const;
145
 
    void clearModified();
146
 
 
147
 
    bool edited() const; // obsolete, use isModified()
148
 
    void setEdited( bool ); // obsolete, use clearModified()
149
 
 
150
 
    bool hasSelectedText() const;
151
 
    SecQString selectedText() const;
152
 
    int selectionStart() const;
153
 
 
154
 
    bool isUndoAvailable() const;
155
 
    bool isRedoAvailable() const;
156
 
 
157
 
#ifndef QT_NO_COMPAT
158
 
    bool hasMarkedText() const { return hasSelectedText(); }
159
 
    SecQString markedText() const { return selectedText(); }
160
 
#endif
161
 
 
162
 
public slots:
163
 
    virtual void setText( const SecQString &);
164
 
    virtual void selectAll();
165
 
    virtual void deselect();
166
 
    virtual void insert( const SecQString &);
167
 
    virtual void clear();
168
 
    virtual void undo();
169
 
    virtual void redo();
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
180
 
    virtual void cut();
181
 
    virtual void copy() const;
182
 
    virtual void paste();
183
 
#endif
184
 
 
185
 
signals:
186
 
    void textChanged( const SecQString &);
187
 
    void textModified( const SecQString &);
188
 
    void returnPressed();
189
 
    void lostFocus();
190
 
    void selectionChanged();
191
 
 
192
 
protected:
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 );
207
 
#ifndef QT_NO_COMPAT
208
 
    void repaintArea( int, int ) { update(); }
209
 
#endif
210
 
 
211
 
private slots:
212
 
    void clipboardChanged();
213
 
 
214
 
public:
215
 
    QChar passwordChar() const; // obsolete internal
216
 
 
217
 
private:
218
 
    friend struct SecQLineEditPrivate;
219
 
    SecQLineEditPrivate * d;
220
 
 
221
 
private:        // Disabled copy constructor and operator=
222
 
#if defined(Q_DISABLE_COPY)
223
 
    SecQLineEdit( const SecQLineEdit & );
224
 
    SecQLineEdit &operator=( const SecQLineEdit & );
225
 
#endif
226
 
};
227
 
 
228
 
#endif // SECQLINEEDIT_H