• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KIO

  • kio
  • kio
passworddialog.cpp
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright (C) 2000 David Faure <faure@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18#include "passworddialog.h"
19
20#include <QCheckBox>
21#include <QLabel>
22#include <QLayout>
23#include <QTextDocument>
24#include <QTextLayout>
25
26#include <kconfig.h>
27#include <klocale.h>
28
29using namespace KIO;
30
31PasswordDialog::PasswordDialog( const QString& prompt, const QString& user,
32 bool enableKeep, bool modal, QWidget* parent )
33 :KPasswordDialog( parent , enableKeep ? (ShowUsernameLine | ShowKeepPassword) : ShowUsernameLine )
34{
35 setModal( modal );
36 setPrompt(prompt);
37 setUsername( user );
38}
39
40PasswordDialog::~PasswordDialog()
41{
42}
43
44
45int PasswordDialog::getNameAndPassword( QString& user, QString& pass, bool* keep,
46 const QString& prompt, bool readOnly,
47 const QString& caption,
48 const QString& comment,
49 const QString& label )
50{
51 PasswordDialog* dlg;
52 dlg = new PasswordDialog( prompt, user, keep );
53
54 if ( !caption.isEmpty() )
55 dlg->setCaption( caption );
56 else
57 dlg->setCaption( i18n("Authorization Dialog") );
58
59 if ( !comment.isEmpty() )
60 dlg->addCommentLine( label, comment );
61
62 if ( readOnly )
63 dlg->setUsernameReadOnly( readOnly );
64
65 if ( keep )
66 dlg->setKeepPassword( *keep );
67
68 int ret = dlg->exec();
69 if ( ret == Accepted )
70 {
71 user = dlg->username();
72 pass = dlg->password();
73 if ( keep ) { (*keep) = dlg->keepPassword(); }
74 }
75 delete dlg;
76 return ret;
77 }
78
79
80#include "passworddialog.moc"
KDialog::setCaption
virtual void setCaption(const QString &caption)
KIO::PasswordDialog
dialog for requesting login and password from the end user
Definition: passworddialog.h:38
KIO::PasswordDialog::getNameAndPassword
static int getNameAndPassword(QString &user, QString &pass, bool *keep, const QString &prompt=QString(), bool readOnly=false, const QString &caption=QString(), const QString &comment=QString(), const QString &label=QString())
A convienence static method for obtaining authorization information from the end user.
Definition: passworddialog.cpp:45
KIO::PasswordDialog::PasswordDialog
PasswordDialog(const QString &prompt, const QString &user, bool enableKeep=false, bool modal=true, QWidget *parent=0)
Create a password dialog.
Definition: passworddialog.cpp:31
KIO::PasswordDialog::~PasswordDialog
~PasswordDialog()
Destructor.
Definition: passworddialog.cpp:40
KPasswordDialog
KPasswordDialog::prompt
QString prompt() const
KPasswordDialog::setKeepPassword
void setKeepPassword(bool b)
KPasswordDialog::password
QString password() const
KPasswordDialog::setUsername
void setUsername(const QString &)
KPasswordDialog::setPrompt
void setPrompt(const QString &prompt)
KPasswordDialog::addCommentLine
void addCommentLine(const QString &label, const QString &comment)
KPasswordDialog::setUsernameReadOnly
void setUsernameReadOnly(bool readOnly)
KPasswordDialog::keepPassword
bool keepPassword() const
KPasswordDialog::username
QString username() const
QWidget
kconfig.h
klocale.h
i18n
QString i18n(const char *text)
caption
QString caption()
KIO
A namespace for KIO globals.
Definition: kbookmarkmenu.h:55
label
QString label(StandardShortcut id)
passworddialog.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal