File indexing completed on 2022-11-23 10:29:24

0001 #include <QApplication>
0002 #include <kmessagebox.h>
0003 
0004 #include "passworddialog.h"
0005 
0006 int main(int argc, char **argv)
0007 {
0008     QApplication::setApplicationName("kiopassdlgtest");
0009     QApplication app(argc, argv);
0010 
0011     QString usr, pass, comment, label;
0012     label = "Site:";
0013     comment = "<b>localhost</b>";
0014     int res = KIO::PasswordDialog::getNameAndPassword(usr, pass, nullptr,
0015               QString(), false,
0016               QString(), comment,
0017               label);
0018     if (res == QDialog::Accepted)
0019         KMessageBox::information(nullptr, QString("You entered:\n"
0020                                              "  Username: %1\n"
0021                                              "  Password: %2").arg(usr).arg(pass),
0022                                  "Test Result");
0023     else
0024         KMessageBox::information(nullptr, "Password dialog was canceled!",
0025                                  "Test Result");
0026 
0027     return 0;
0028 }