forked from qt-creator/qt-creator
Android: Inline androidcreatekeystorecertificate.ui
Change-Id: Ibfde487c963903b5a0c5af1beae4104777c00e9c Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -9,7 +9,7 @@ add_qtc_plugin(Android
|
||||
androidbuildapkstep.cpp androidbuildapkstep.h
|
||||
androidconfigurations.cpp androidconfigurations.h
|
||||
androidconstants.h
|
||||
androidcreatekeystorecertificate.cpp androidcreatekeystorecertificate.h androidcreatekeystorecertificate.ui
|
||||
androidcreatekeystorecertificate.cpp androidcreatekeystorecertificate.h
|
||||
androiddebugsupport.cpp androiddebugsupport.h
|
||||
androiddeployqtstep.cpp androiddeployqtstep.h
|
||||
androiddevice.cpp androiddevice.h
|
||||
|
||||
@@ -27,7 +27,6 @@ Project {
|
||||
"androidconstants.h",
|
||||
"androidcreatekeystorecertificate.cpp",
|
||||
"androidcreatekeystorecertificate.h",
|
||||
"androidcreatekeystorecertificate.ui",
|
||||
"androidbuildapkstep.cpp",
|
||||
"androidbuildapkstep.h",
|
||||
"androiddeployqtstep.cpp",
|
||||
|
||||
@@ -24,153 +24,242 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "androidcreatekeystorecertificate.h"
|
||||
#include "androidconfigurations.h"
|
||||
#include "ui_androidcreatekeystorecertificate.h"
|
||||
|
||||
#include "androidconfigurations.h"
|
||||
|
||||
#include <utils/infolabel.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QRegularExpression>
|
||||
#include <QCheckBox>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QRegularExpression>
|
||||
#include <QSpinBox>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
using namespace Android::Internal;
|
||||
namespace Android::Internal {
|
||||
|
||||
AndroidCreateKeystoreCertificate::AndroidCreateKeystoreCertificate(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AndroidCreateKeystoreCertificate)
|
||||
AndroidCreateKeystoreCertificate::AndroidCreateKeystoreCertificate(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->infoLabel->setType(InfoLabel::Error);
|
||||
ui->infoLabel->hide();
|
||||
resize(638, 473);
|
||||
setWindowTitle(tr("Create a keystore and a certificate"));
|
||||
|
||||
connect(ui->keystorePassLineEdit, &QLineEdit::textChanged,
|
||||
m_commonNameLineEdit = new QLineEdit;
|
||||
|
||||
m_organizationUnitLineEdit = new QLineEdit;
|
||||
|
||||
m_organizationNameLineEdit = new QLineEdit;
|
||||
|
||||
m_localityNameLineEdit = new QLineEdit;
|
||||
|
||||
m_stateNameLineEdit = new QLineEdit;
|
||||
|
||||
m_countryLineEdit = new QLineEdit;
|
||||
m_countryLineEdit->setMaxLength(2);
|
||||
m_countryLineEdit->setInputMask(QString());
|
||||
|
||||
m_certificateRetypePassLineEdit = new QLineEdit;
|
||||
m_certificateRetypePassLineEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
m_certificateShowPassCheckBox = new QCheckBox(tr("Show password"));
|
||||
|
||||
m_validitySpinBox = new QSpinBox;
|
||||
m_validitySpinBox->setRange(10000, 100000);
|
||||
|
||||
m_certificateAliasLineEdit = new QLineEdit;
|
||||
m_certificateAliasLineEdit->setInputMask({});
|
||||
m_certificateAliasLineEdit->setMaxLength(32);
|
||||
|
||||
m_certificatePassLineEdit = new QLineEdit;
|
||||
m_certificatePassLineEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
m_keySizeSpinBox = new QSpinBox;
|
||||
m_keySizeSpinBox->setRange(2048, 2097152);
|
||||
|
||||
m_samePasswordCheckBox = new QCheckBox(tr("Use Keystore password"));
|
||||
|
||||
m_keystorePassLineEdit = new QLineEdit;
|
||||
m_keystorePassLineEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
m_keystoreRetypePassLineEdit = new QLineEdit;
|
||||
m_keystoreRetypePassLineEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
m_infoLabel = new InfoLabel;
|
||||
m_infoLabel->setType(InfoLabel::Error);
|
||||
m_infoLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
m_infoLabel->hide();
|
||||
|
||||
auto keystoreShowPassCheckBox = new QCheckBox(tr("Show password"));
|
||||
|
||||
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close|QDialogButtonBox::Save);
|
||||
|
||||
using namespace Layouting;
|
||||
const Break br;
|
||||
|
||||
Column {
|
||||
Group {
|
||||
Title(tr("Keystore")),
|
||||
Form {
|
||||
tr("Password:"), m_keystorePassLineEdit, br,
|
||||
tr("Retype password:"), m_keystoreRetypePassLineEdit, br,
|
||||
Span(2, keystoreShowPassCheckBox), br,
|
||||
}
|
||||
},
|
||||
|
||||
Group {
|
||||
Title(tr("Certificate")),
|
||||
Form {
|
||||
tr("Alias name:"), m_certificateAliasLineEdit, br,
|
||||
tr("Keysize:"), m_keySizeSpinBox, br,
|
||||
tr("Validity (days):"), m_validitySpinBox, br,
|
||||
tr("Password:"), m_certificatePassLineEdit, br,
|
||||
tr("Retype password:"), m_certificateRetypePassLineEdit, br,
|
||||
Span(2, m_samePasswordCheckBox), br,
|
||||
Span(2, m_certificateShowPassCheckBox), br,
|
||||
}
|
||||
},
|
||||
|
||||
Group {
|
||||
Title(tr("Certificate Distinguished Names")),
|
||||
Form {
|
||||
tr("First and last name:"), m_commonNameLineEdit, br,
|
||||
tr("Organizational unit (e.g. Necessitas):"), m_organizationUnitLineEdit, br,
|
||||
tr("Organization (e.g. KDE):"), m_organizationNameLineEdit, br,
|
||||
tr("City or locality:"), m_localityNameLineEdit, br,
|
||||
tr("State or province:"), m_stateNameLineEdit, br,
|
||||
tr("Two-letter country code for this unit (e.g. RO):"), m_countryLineEdit,
|
||||
}
|
||||
},
|
||||
|
||||
Row { m_infoLabel, buttonBox }
|
||||
}.attachTo(this);
|
||||
|
||||
connect(m_keystorePassLineEdit, &QLineEdit::textChanged,
|
||||
this, &AndroidCreateKeystoreCertificate::checkKeystorePassword);
|
||||
connect(ui->keystoreRetypePassLineEdit, &QLineEdit::textChanged,
|
||||
connect(m_keystoreRetypePassLineEdit, &QLineEdit::textChanged,
|
||||
this, &AndroidCreateKeystoreCertificate::checkKeystorePassword);
|
||||
connect(ui->certificatePassLineEdit, &QLineEdit::textChanged,
|
||||
connect(m_certificatePassLineEdit, &QLineEdit::textChanged,
|
||||
this, &AndroidCreateKeystoreCertificate::checkCertificatePassword);
|
||||
connect(ui->certificateRetypePassLineEdit, &QLineEdit::textChanged,
|
||||
connect(m_certificateRetypePassLineEdit, &QLineEdit::textChanged,
|
||||
this, &AndroidCreateKeystoreCertificate::checkCertificatePassword);
|
||||
connect(ui->certificateAliasLineEdit, &QLineEdit::textChanged,
|
||||
connect(m_certificateAliasLineEdit, &QLineEdit::textChanged,
|
||||
this, &AndroidCreateKeystoreCertificate::checkCertificateAlias);
|
||||
connect(ui->countryLineEdit, &QLineEdit::textChanged,
|
||||
connect(m_countryLineEdit, &QLineEdit::textChanged,
|
||||
this, &AndroidCreateKeystoreCertificate::checkCountryCode);
|
||||
connect(ui->keystoreShowPassCheckBox, &QCheckBox::stateChanged,
|
||||
connect(keystoreShowPassCheckBox, &QCheckBox::stateChanged,
|
||||
this, &AndroidCreateKeystoreCertificate::keystoreShowPassStateChanged);
|
||||
connect(ui->certificateShowPassCheckBox, &QCheckBox::stateChanged,
|
||||
connect(m_certificateShowPassCheckBox, &QCheckBox::stateChanged,
|
||||
this, &AndroidCreateKeystoreCertificate::certificateShowPassStateChanged);
|
||||
connect(ui->samePasswordCheckBox, &QCheckBox::stateChanged,
|
||||
connect(m_samePasswordCheckBox, &QCheckBox::stateChanged,
|
||||
this, &AndroidCreateKeystoreCertificate::samePasswordStateChanged);
|
||||
connect(ui->buttonBox, &QDialogButtonBox::accepted,
|
||||
connect(buttonBox, &QDialogButtonBox::accepted,
|
||||
this, &AndroidCreateKeystoreCertificate::buttonBoxAccepted);
|
||||
connect(ui->buttonBox, &QDialogButtonBox::rejected,
|
||||
connect(buttonBox, &QDialogButtonBox::rejected,
|
||||
this, &QDialog::reject);
|
||||
connect(ui->keystorePassLineEdit,
|
||||
&QLineEdit::editingFinished,
|
||||
ui->keystoreRetypePassLineEdit,
|
||||
QOverload<>::of(&QLineEdit::setFocus));
|
||||
connect(m_keystorePassLineEdit, &QLineEdit::editingFinished,
|
||||
m_keystoreRetypePassLineEdit, QOverload<>::of(&QWidget::setFocus));
|
||||
}
|
||||
|
||||
AndroidCreateKeystoreCertificate::~AndroidCreateKeystoreCertificate()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
AndroidCreateKeystoreCertificate::~AndroidCreateKeystoreCertificate() = default;
|
||||
|
||||
Utils::FilePath AndroidCreateKeystoreCertificate::keystoreFilePath()
|
||||
FilePath AndroidCreateKeystoreCertificate::keystoreFilePath() const
|
||||
{
|
||||
return m_keystoreFilePath;
|
||||
}
|
||||
|
||||
QString AndroidCreateKeystoreCertificate::keystorePassword()
|
||||
QString AndroidCreateKeystoreCertificate::keystorePassword() const
|
||||
{
|
||||
return ui->keystorePassLineEdit->text();
|
||||
return m_keystorePassLineEdit->text();
|
||||
}
|
||||
|
||||
QString AndroidCreateKeystoreCertificate::certificateAlias()
|
||||
QString AndroidCreateKeystoreCertificate::certificateAlias() const
|
||||
{
|
||||
return ui->certificateAliasLineEdit->text();
|
||||
return m_certificateAliasLineEdit->text();
|
||||
}
|
||||
|
||||
QString AndroidCreateKeystoreCertificate::certificatePassword()
|
||||
QString AndroidCreateKeystoreCertificate::certificatePassword() const
|
||||
{
|
||||
return (ui->samePasswordCheckBox->checkState() == Qt::Checked)
|
||||
return (m_samePasswordCheckBox->checkState() == Qt::Checked)
|
||||
? keystorePassword()
|
||||
: ui->certificatePassLineEdit->text();
|
||||
: m_certificatePassLineEdit->text();
|
||||
}
|
||||
|
||||
AndroidCreateKeystoreCertificate::PasswordStatus AndroidCreateKeystoreCertificate::checkKeystorePassword()
|
||||
{
|
||||
if (ui->keystorePassLineEdit->text().length() < 6) {
|
||||
ui->infoLabel->show();
|
||||
ui->infoLabel->setText(tr("Keystore password is too short."));
|
||||
if (m_keystorePassLineEdit->text().length() < 6) {
|
||||
m_infoLabel->show();
|
||||
m_infoLabel->setText(tr("Keystore password is too short."));
|
||||
return Invalid;
|
||||
}
|
||||
if (ui->keystorePassLineEdit->text() != ui->keystoreRetypePassLineEdit->text()) {
|
||||
ui->infoLabel->show();
|
||||
ui->infoLabel->setText(tr("Keystore passwords do not match."));
|
||||
if (m_keystorePassLineEdit->text() != m_keystoreRetypePassLineEdit->text()) {
|
||||
m_infoLabel->show();
|
||||
m_infoLabel->setText(tr("Keystore passwords do not match."));
|
||||
return NoMatch;
|
||||
}
|
||||
|
||||
ui->infoLabel->hide();
|
||||
m_infoLabel->hide();
|
||||
return Match;
|
||||
}
|
||||
|
||||
AndroidCreateKeystoreCertificate::PasswordStatus AndroidCreateKeystoreCertificate::checkCertificatePassword()
|
||||
{
|
||||
if (ui->samePasswordCheckBox->checkState() == Qt::Checked)
|
||||
if (m_samePasswordCheckBox->checkState() == Qt::Checked)
|
||||
return Match;
|
||||
|
||||
if (ui->certificatePassLineEdit->text().length() < 6) {
|
||||
ui->infoLabel->show();
|
||||
ui->infoLabel->setText(tr("Certificate password is too short."));
|
||||
if (m_certificatePassLineEdit->text().length() < 6) {
|
||||
m_infoLabel->show();
|
||||
m_infoLabel->setText(tr("Certificate password is too short."));
|
||||
return Invalid;
|
||||
}
|
||||
if (ui->certificatePassLineEdit->text() != ui->certificateRetypePassLineEdit->text()) {
|
||||
ui->infoLabel->show();
|
||||
ui->infoLabel->setText(tr("Certificate passwords do not match."));
|
||||
if (m_certificatePassLineEdit->text() != m_certificateRetypePassLineEdit->text()) {
|
||||
m_infoLabel->show();
|
||||
m_infoLabel->setText(tr("Certificate passwords do not match."));
|
||||
return NoMatch;
|
||||
}
|
||||
|
||||
ui->infoLabel->hide();
|
||||
m_infoLabel->hide();
|
||||
return Match;
|
||||
}
|
||||
|
||||
bool AndroidCreateKeystoreCertificate::checkCertificateAlias()
|
||||
{
|
||||
if (ui->certificateAliasLineEdit->text().length() == 0) {
|
||||
ui->infoLabel->show();
|
||||
ui->infoLabel->setText(tr("Certificate alias is missing."));
|
||||
if (m_certificateAliasLineEdit->text().length() == 0) {
|
||||
m_infoLabel->show();
|
||||
m_infoLabel->setText(tr("Certificate alias is missing."));
|
||||
return false;
|
||||
}
|
||||
|
||||
ui->infoLabel->hide();
|
||||
m_infoLabel->hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AndroidCreateKeystoreCertificate::checkCountryCode()
|
||||
{
|
||||
if (!ui->countryLineEdit->text().contains(QRegularExpression("[A-Z]{2}"))) {
|
||||
ui->infoLabel->show();
|
||||
ui->infoLabel->setText(tr("Invalid country code."));
|
||||
if (!m_countryLineEdit->text().contains(QRegularExpression("[A-Z]{2}"))) {
|
||||
m_infoLabel->show();
|
||||
m_infoLabel->setText(tr("Invalid country code."));
|
||||
return false;
|
||||
}
|
||||
|
||||
ui->infoLabel->hide();
|
||||
m_infoLabel->hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
void AndroidCreateKeystoreCertificate::keystoreShowPassStateChanged(int state)
|
||||
{
|
||||
ui->keystorePassLineEdit->setEchoMode(state == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password);
|
||||
ui->keystoreRetypePassLineEdit->setEchoMode(ui->keystorePassLineEdit->echoMode());
|
||||
m_keystorePassLineEdit->setEchoMode(state == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password);
|
||||
m_keystoreRetypePassLineEdit->setEchoMode(m_keystorePassLineEdit->echoMode());
|
||||
}
|
||||
|
||||
void AndroidCreateKeystoreCertificate::certificateShowPassStateChanged(int state)
|
||||
{
|
||||
ui->certificatePassLineEdit->setEchoMode(state == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password);
|
||||
ui->certificateRetypePassLineEdit->setEchoMode(ui->certificatePassLineEdit->echoMode());
|
||||
m_certificatePassLineEdit->setEchoMode(state == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password);
|
||||
m_certificateRetypePassLineEdit->setEchoMode(m_certificatePassLineEdit->echoMode());
|
||||
}
|
||||
|
||||
void AndroidCreateKeystoreCertificate::buttonBoxAccepted()
|
||||
@@ -184,24 +273,24 @@ void AndroidCreateKeystoreCertificate::buttonBoxAccepted()
|
||||
if (m_keystoreFilePath.isEmpty())
|
||||
return;
|
||||
QString distinguishedNames(QString::fromLatin1("CN=%1, O=%2, L=%3, C=%4")
|
||||
.arg(ui->commonNameLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,")))
|
||||
.arg(ui->organizationNameLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,")))
|
||||
.arg(ui->localityNameLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,")))
|
||||
.arg(ui->countryLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,"))));
|
||||
.arg(m_commonNameLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,")))
|
||||
.arg(m_organizationNameLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,")))
|
||||
.arg(m_localityNameLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,")))
|
||||
.arg(m_countryLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,"))));
|
||||
|
||||
if (!ui->organizationUnitLineEdit->text().isEmpty())
|
||||
distinguishedNames += QLatin1String(", OU=") + ui->organizationUnitLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,"));
|
||||
if (!m_organizationUnitLineEdit->text().isEmpty())
|
||||
distinguishedNames += QLatin1String(", OU=") + m_organizationUnitLineEdit->text().replace(',', QLatin1String("\\,"));
|
||||
|
||||
if (!ui->stateNameLineEdit->text().isEmpty())
|
||||
distinguishedNames += QLatin1String(", S=") + ui->stateNameLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,"));
|
||||
if (!m_stateNameLineEdit->text().isEmpty())
|
||||
distinguishedNames += QLatin1String(", S=") + m_stateNameLineEdit->text().replace(',', QLatin1String("\\,"));
|
||||
|
||||
const CommandLine command(AndroidConfigurations::currentConfig().keytoolPath(),
|
||||
{ "-genkey", "-keyalg", "RSA",
|
||||
"-keystore", m_keystoreFilePath.toString(),
|
||||
"-storepass", keystorePassword(),
|
||||
"-alias", certificateAlias(),
|
||||
"-keysize", ui->keySizeSpinBox->text(),
|
||||
"-validity", ui->validitySpinBox->text(),
|
||||
"-keysize", m_keySizeSpinBox->text(),
|
||||
"-validity", m_validitySpinBox->text(),
|
||||
"-keypass", certificatePassword(),
|
||||
"-dname", distinguishedNames});
|
||||
|
||||
@@ -221,15 +310,15 @@ void AndroidCreateKeystoreCertificate::buttonBoxAccepted()
|
||||
void AndroidCreateKeystoreCertificate::samePasswordStateChanged(int state)
|
||||
{
|
||||
if (state == Qt::Checked) {
|
||||
ui->certificatePassLineEdit->setDisabled(true);
|
||||
ui->certificateRetypePassLineEdit->setDisabled(true);
|
||||
ui->certificateShowPassCheckBox->setDisabled(true);
|
||||
m_certificatePassLineEdit->setDisabled(true);
|
||||
m_certificateRetypePassLineEdit->setDisabled(true);
|
||||
m_certificateShowPassCheckBox->setDisabled(true);
|
||||
}
|
||||
|
||||
if (state == Qt::Unchecked) {
|
||||
ui->certificatePassLineEdit->setEnabled(true);
|
||||
ui->certificateRetypePassLineEdit->setEnabled(true);
|
||||
ui->certificateShowPassCheckBox->setEnabled(true);
|
||||
m_certificatePassLineEdit->setEnabled(true);
|
||||
m_certificateRetypePassLineEdit->setEnabled(true);
|
||||
m_certificateShowPassCheckBox->setEnabled(true);
|
||||
}
|
||||
|
||||
validateUserInput();
|
||||
@@ -239,35 +328,37 @@ bool AndroidCreateKeystoreCertificate::validateUserInput()
|
||||
{
|
||||
switch (checkKeystorePassword()) {
|
||||
case Invalid:
|
||||
ui->keystorePassLineEdit->setFocus();
|
||||
m_keystorePassLineEdit->setFocus();
|
||||
return false;
|
||||
case NoMatch:
|
||||
ui->keystoreRetypePassLineEdit->setFocus();
|
||||
m_keystoreRetypePassLineEdit->setFocus();
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!checkCertificateAlias()) {
|
||||
ui->certificateAliasLineEdit->setFocus();
|
||||
m_certificateAliasLineEdit->setFocus();
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (checkCertificatePassword()) {
|
||||
case Invalid:
|
||||
ui->certificatePassLineEdit->setFocus();
|
||||
m_certificatePassLineEdit->setFocus();
|
||||
return false;
|
||||
case NoMatch:
|
||||
ui->certificateRetypePassLineEdit->setFocus();
|
||||
m_certificateRetypePassLineEdit->setFocus();
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!checkCountryCode()) {
|
||||
ui->countryLineEdit->setFocus();
|
||||
m_countryLineEdit->setFocus();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // Android::Internal
|
||||
|
||||
@@ -25,16 +25,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class AndroidCreateKeystoreCertificate; }
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class QSpinBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
namespace Utils { class InfoLabel; }
|
||||
|
||||
namespace Android::Internal {
|
||||
|
||||
class AndroidCreateKeystoreCertificate : public QDialog
|
||||
{
|
||||
@@ -49,10 +52,11 @@ class AndroidCreateKeystoreCertificate : public QDialog
|
||||
public:
|
||||
explicit AndroidCreateKeystoreCertificate(QWidget *parent = nullptr);
|
||||
~AndroidCreateKeystoreCertificate() override;
|
||||
Utils::FilePath keystoreFilePath();
|
||||
QString keystorePassword();
|
||||
QString certificateAlias();
|
||||
QString certificatePassword();
|
||||
|
||||
Utils::FilePath keystoreFilePath() const;
|
||||
QString keystorePassword() const;
|
||||
QString certificateAlias() const;
|
||||
QString certificatePassword() const;
|
||||
|
||||
private:
|
||||
PasswordStatus checkKeystorePassword();
|
||||
@@ -60,17 +64,31 @@ private:
|
||||
bool checkCertificateAlias();
|
||||
bool checkCountryCode();
|
||||
|
||||
private slots:
|
||||
void keystoreShowPassStateChanged(int state);
|
||||
void certificateShowPassStateChanged(int state);
|
||||
void buttonBoxAccepted();
|
||||
void samePasswordStateChanged(int state);
|
||||
|
||||
private:
|
||||
bool validateUserInput();
|
||||
Ui::AndroidCreateKeystoreCertificate *ui;
|
||||
|
||||
Utils::FilePath m_keystoreFilePath;
|
||||
|
||||
QLineEdit *m_commonNameLineEdit;
|
||||
QLineEdit *m_organizationUnitLineEdit;
|
||||
QLineEdit *m_organizationNameLineEdit;
|
||||
QLineEdit *m_localityNameLineEdit;
|
||||
QLineEdit *m_stateNameLineEdit;
|
||||
QLineEdit *m_countryLineEdit;
|
||||
QLineEdit *m_certificateRetypePassLineEdit;
|
||||
QCheckBox *m_certificateShowPassCheckBox;
|
||||
QSpinBox *m_validitySpinBox;
|
||||
QLineEdit *m_certificateAliasLineEdit;
|
||||
QLineEdit *m_certificatePassLineEdit;
|
||||
QSpinBox *m_keySizeSpinBox;
|
||||
QCheckBox *m_samePasswordCheckBox;
|
||||
QLineEdit *m_keystorePassLineEdit;
|
||||
QLineEdit *m_keystoreRetypePassLineEdit;
|
||||
Utils::InfoLabel *m_infoLabel;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
} // Android::Internal
|
||||
|
||||
@@ -1,332 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AndroidCreateKeystoreCertificate</class>
|
||||
<widget class="QDialog" name="AndroidCreateKeystoreCertificate">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>638</width>
|
||||
<height>473</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create a keystore and a certificate</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Certificate Distinguished Names</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>First and last name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="commonNameLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Organizational unit (e.g. Necessitas):</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="organizationUnitLineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Organization (e.g. KDE):</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="organizationNameLineEdit"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>City or locality:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="localityNameLineEdit"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>State or province:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="stateNameLineEdit"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Two-letter country code for this unit (e.g. RO):</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="countryLineEdit">
|
||||
<property name="inputMask">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Certificate</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="certificateRetypePassLineEdit">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="certificateShowPassCheckBox">
|
||||
<property name="text">
|
||||
<string>Show password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="validitySpinBox">
|
||||
<property name="minimum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Validity (days):</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Alias name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="certificateAliasLineEdit">
|
||||
<property name="inputMask">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>32</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Keysize:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="certificatePassLineEdit">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="keySizeSpinBox">
|
||||
<property name="minimum">
|
||||
<number>2048</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2097152</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Retype password:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="samePasswordCheckBox">
|
||||
<property name="text">
|
||||
<string>Use Keystore password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Keystore</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="keystorePassLineEdit">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="keystoreRetypePassLineEdit">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="keystoreShowPassCheckBox">
|
||||
<property name="text">
|
||||
<string>Show password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Retype password:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="Utils::InfoLabel" name="infoLabel"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::InfoLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header location="global">utils/infolabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>keystorePassLineEdit</tabstop>
|
||||
<tabstop>keystoreRetypePassLineEdit</tabstop>
|
||||
<tabstop>keystoreShowPassCheckBox</tabstop>
|
||||
<tabstop>certificateAliasLineEdit</tabstop>
|
||||
<tabstop>keySizeSpinBox</tabstop>
|
||||
<tabstop>validitySpinBox</tabstop>
|
||||
<tabstop>certificatePassLineEdit</tabstop>
|
||||
<tabstop>certificateRetypePassLineEdit</tabstop>
|
||||
<tabstop>certificateShowPassCheckBox</tabstop>
|
||||
<tabstop>samePasswordCheckBox</tabstop>
|
||||
<tabstop>commonNameLineEdit</tabstop>
|
||||
<tabstop>organizationUnitLineEdit</tabstop>
|
||||
<tabstop>organizationNameLineEdit</tabstop>
|
||||
<tabstop>localityNameLineEdit</tabstop>
|
||||
<tabstop>stateNameLineEdit</tabstop>
|
||||
<tabstop>countryLineEdit</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user