GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
pinlineedit.h
1 /* pinlineedit.h - Modified QLineEdit widget.
2  * Copyright (C) 2018 Damien Goutte-Gattat
3  * Copyright (C) 2021 g10 Code GmbH
4  *
5  * Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, see <https://www.gnu.org/licenses/>.
19  * SPDX-License-Identifier: GPL-2.0+
20  */
21 
22 #ifndef _PINLINEEDIT_H_
23 #define _PINLINEEDIT_H_
24 
25 #include <QLineEdit>
26 
27 class PinLineEdit : public QLineEdit {
28  Q_OBJECT
29 
30  public:
31  explicit PinLineEdit(QWidget *parent = nullptr);
32  ~PinLineEdit() override;
33 
34  void setPin(const QString &pin);
35  QString pin() const;
36 
37  public Q_SLOTS:
38  void setFormattedPassphrase(bool on);
39  void copy() const;
40  void cut();
41 
42  Q_SIGNALS:
43  void backspacePressed();
44 
45  protected:
46  void keyPressEvent(QKeyEvent *) override;
47 
48  private:
49  using QLineEdit::setText;
50  using QLineEdit::text;
51 
52  private Q_SLOTS:
53  void textEdited();
54 
55  private:
56  class Private;
57  std::unique_ptr<Private> d;
58 };
59 
60 #endif // _PINLINEEDIT_H_
Definition: pinlineedit.cpp:41
Definition: pinlineedit.h:27