Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 60c6600a authored by Julian Wolff's avatar Julian Wolff

add --newpassword option

Summary:
Adds an option to create a "new password"-dialog.
Closes Bug 340397

Reviewers: cfeck

Reviewed By: cfeck

Subscribers: #kde_applications

Differential Revision: https://phabricator.kde.org/D7072
parent fd50a04d
......@@ -300,6 +300,7 @@ int main(int argc, char *argv[])
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("msgbox"), i18n("Message Box dialog"), QLatin1String("text")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("inputbox"), i18n("Input Box dialog"), QLatin1String("text> <init")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("password"), i18n("Password dialog"), QLatin1String("text")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("newpassword"), i18n("New Password dialog"), QLatin1String("text")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("textbox"), i18n("Text Box dialog"), QLatin1String("file")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("textinputbox"), i18n("Text Input Box dialog"), QLatin1String("text> <init")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("combobox"), i18n("ComboBox dialog"), QLatin1String("text")));
......@@ -503,6 +504,15 @@ int main(int argc, char *argv[])
cout << qPrintable(result) << endl;
return retcode ? 0 : 1;
}
// --newpassword text
if (parser.isSet("newpassword"))
{
QString result;
const bool retcode = Widgets::newPasswordBox(0, title, parser.value("newpassword"), result);
cout << qPrintable(result) << endl;
return retcode ? 0 : 1;
}
// --passivepopup
if (parser.isSet("passivepopup"))
......
......@@ -36,6 +36,7 @@
// KDE
#include <kpassworddialog.h>
#include <knewpassworddialog.h>
#include <ktextedit.h>
#include <kdatepicker.h>
#include <klocalizedstring.h>
......@@ -76,6 +77,20 @@ bool Widgets::passwordBox(QWidget *parent, const QString& title, const QString&
return retcode;
}
bool Widgets::newPasswordBox(QWidget *parent, const QString& title, const QString& text, QString &result)
{
KNewPasswordDialog dlg( parent );
dlg.setWindowTitle(title);
dlg.setPrompt(text);
Utils::handleXGeometry(&dlg);
bool retcode = (dlg.exec() == QDialog::Accepted);
if ( retcode )
result = dlg.password();
return retcode;
}
int Widgets::textBox(QWidget *parent, int width, int height, const QString& title, const QString& file)
{
QDialog dlg(parent);
......
......@@ -29,6 +29,7 @@ namespace Widgets
{
bool inputBox(QWidget *parent, const QString& title, const QString& text, const QString& init, QString &result);
bool passwordBox(QWidget *parent, const QString& title, const QString& text, QString &result);
bool newPasswordBox(QWidget *parent, const QString& title, const QString& text, QString &result);
int textBox(QWidget *parent, int width, int height, const QString& title, const QString& file);
int textInputBox(QWidget *parent, int width, int height, const QString& title, const QString& text, const QString& init, QString &result);
bool listBox(QWidget *parent, const QString& title, const QString& text, const QStringList& args, const QString &defaultEntry, QString &result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment