Vidalia  0.2.17
ControlPasswordInputDialog.h
Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 
00007 **  including this file, may be copied, modified, propagated, or distributed 
00008 **  except according to the terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file ControlPasswordInputDialog.h
00013 ** \brief Prompts the user to enter their control port password, and gives
00014 ** them the option to save or attempt to reset it.
00015 */
00016 
00017 #ifndef _CONTROLPASSWORDINPUTDIALOG_H
00018 #define _CONTROLPASSWORDINPUTDIALOG_H
00019 
00020 #include "ui_ControlPasswordInputDialog.h"
00021 
00022 #include <QDialog>
00023 #include <QString>
00024 
00025 
00026 class ControlPasswordInputDialog : public QDialog
00027 {
00028   Q_OBJECT
00029 
00030 public:
00031   /** Default constructor.
00032    */
00033   ControlPasswordInputDialog(QWidget *parent = 0);
00034 
00035   /** Returns the password entered in the dialog. If the dialog was dismissed
00036    * with the "Cancel" button, then the returned QString will be empty.
00037    */
00038   QString password() const;
00039 
00040   /** Returns true if the "Remember my password" checkbox was checked at the
00041    * time the dialog was dismissed.
00042    */
00043   bool isSavePasswordChecked() const;
00044 
00045   /** If <b>enabled</b> is true, then the "Reset" button will be visible on
00046    * the password input dialog. Otherwise, the "Reset" button will be hidden.
00047    */
00048   void setResetEnabled(bool enabled);
00049 
00050 signals:
00051   /** Emitted when the user clicks on the "Help" dialog button.
00052    */
00053   void helpRequested(const QString &topic);
00054 
00055 protected slots:
00056   /** Called when one of the QDialogButtonBox's buttons is clicked. The dialog
00057    * is closed if <b>button</b> is the "Ok", "Cancel", or "Reset" button, and
00058    * the clicked button's QDialogButtonBox::StandardButton enum value is
00059    * returned as the dialog's result code.
00060    */
00061   void clicked(QAbstractButton *button);
00062 
00063   /** Called when the user changes the password QLineEdit. If the password is
00064    * empty, then the "Ok" button will be disabled. Otherwise, it is enabled.
00065    */
00066   void passwordEdited(const QString &text);
00067 
00068 protected:
00069   /** Adjusts the size of the input dialog when it is displayed. */
00070   virtual void setVisible(bool visible);
00071 
00072 private:
00073     Ui::ControlPasswordInputDialog ui; /**< Qt Designer generated object. */
00074 };
00075 
00076 #endif
00077