Vidalia  0.2.21
ControlPasswordInputDialog.h
Go to the documentation of this file.
1 /*
2 ** This file is part of Vidalia, and is subject to the license terms in the
3 ** LICENSE file, found in the top level directory of this distribution. If you
4 ** did not receive the LICENSE file with this file, you may obtain it from the
5 ** Vidalia source package distributed by the Vidalia Project at
6 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7 ** including this file, may be copied, modified, propagated, or distributed
8 ** except according to the terms described in the LICENSE file.
9 */
10 
11 /*
12 ** \file ControlPasswordInputDialog.h
13 ** \brief Prompts the user to enter their control port password, and gives
14 ** them the option to save or attempt to reset it.
15 */
16 
17 #ifndef _CONTROLPASSWORDINPUTDIALOG_H
18 #define _CONTROLPASSWORDINPUTDIALOG_H
19 
20 #include "ui_ControlPasswordInputDialog.h"
21 
22 #include <QDialog>
23 #include <QString>
24 
25 
26 class ControlPasswordInputDialog : public QDialog
27 {
28  Q_OBJECT
29 
30 public:
31  /** Default constructor.
32  */
33  ControlPasswordInputDialog(QWidget *parent = 0);
34 
35  /** Returns the password entered in the dialog. If the dialog was dismissed
36  * with the "Cancel" button, then the returned QString will be empty.
37  */
38  QString password() const;
39 
40  /** Returns true if the "Remember my password" checkbox was checked at the
41  * time the dialog was dismissed.
42  */
43  bool isSavePasswordChecked() const;
44 
45  /** If <b>enabled</b> is true, then the "Reset" button will be visible on
46  * the password input dialog. Otherwise, the "Reset" button will be hidden.
47  */
48  void setResetEnabled(bool enabled);
49 
50 signals:
51  /** Emitted when the user clicks on the "Help" dialog button.
52  */
53  void helpRequested(const QString &topic);
54 
55 protected slots:
56  /** Called when one of the QDialogButtonBox's buttons is clicked. The dialog
57  * is closed if <b>button</b> is the "Ok", "Cancel", or "Reset" button, and
58  * the clicked button's QDialogButtonBox::StandardButton enum value is
59  * returned as the dialog's result code.
60  */
61  void clicked(QAbstractButton *button);
62 
63  /** Called when the user changes the password QLineEdit. If the password is
64  * empty, then the "Ok" button will be disabled. Otherwise, it is enabled.
65  */
66  void passwordEdited(const QString &text);
67 
68 protected:
69  /** Adjusts the size of the input dialog when it is displayed. */
70  virtual void setVisible(bool visible);
71 
72 private:
73  Ui::ControlPasswordInputDialog ui; /**< Qt Designer generated object. */
74 };
75 
76 #endif
77