File indexing completed on 2024-05-05 16:08:29

0001 /* This file is part of the KDE libraries
0002    Copyright (C) 2000 David Faure <faure@kde.org>
0003    Copyright (C) 2000 Dawit Alemayehu <adawit@kde.org>
0004 
0005    This library is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License version 2 as published by the Free Software Foundation.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public
0015    License along with this library; see the file COPYING.LIB.  If
0016    not, write to the Free Software Foundation, Inc., 51 Franklin Street,
0017    Fifth Floor, Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef kio_pass_word_dialog_h
0021 #define kio_pass_word_dialog_h
0022 
0023 #include <kdelibs4support_export.h>
0024 #include <kpassworddialog.h>
0025 
0026 namespace KIO
0027 {
0028 
0029 /**
0030  * @deprecated  use KPasswordDialog
0031  * A dialog for requesting a login and a password from the end user.
0032  *
0033  * KIO-Slave authors are encouraged to use SlaveBase::openPassDlg
0034  * instead of directly instantiating this dialog.
0035  * @short dialog for requesting login and password from the end user
0036  */
0037 class KDELIBS4SUPPORT_DEPRECATED_EXPORT PasswordDialog : public KPasswordDialog
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     /**
0043      * Create a password dialog.
0044      *
0045      * @param prompt        instructional text to be shown.
0046      * @param user          username, if known initially.
0047      * @param enableKeep    if true, shows checkbox that makes password persistent until KDE is shutdown.
0048      * @param modal         if true, the dialog will be modal (default:true).
0049      * @param parent        the parent widget (default:NULL).
0050      */
0051     PasswordDialog(const QString &prompt, const QString &user,
0052                    bool enableKeep = false, bool modal = true,
0053                    QWidget *parent = nullptr);
0054 
0055     /**
0056      * Destructor
0057      */
0058     ~PasswordDialog() override;
0059 
0060     /**
0061      * A convienence static method for obtaining authorization
0062      * information from the end user.
0063      *
0064      *
0065      * @param user          username
0066      * @param pass          password
0067      * @param keep          pointer to flag that indicates whether to keep password (can be null)
0068      * @param prompt        text to display to user.
0069      * @param readOnly      make the username field read-only.
0070      * @param caption       set the title bar to given text.
0071      * @param comment       extra comment to display to user.
0072      * @param label         optinal label for extra comment.
0073      *
0074      * @return Accepted/Rejected based on the user choice.
0075      */
0076     static int getNameAndPassword(QString &user, QString &pass, bool *keep,
0077                                   const QString &prompt = QString(),
0078                                   bool readOnly = false,
0079                                   const QString &caption = QString(),
0080                                   const QString &comment = QString(),
0081                                   const QString &label = QString());
0082 
0083 };
0084 
0085 }
0086 
0087 #endif