diff options
-rw-r--r-- | keygendialog.cpp | 19 | ||||
-rw-r--r-- | keygendialog.h | 6 |
2 files changed, 19 insertions, 6 deletions
diff --git a/keygendialog.cpp b/keygendialog.cpp index bce9071..c387681 100644 --- a/keygendialog.cpp +++ b/keygendialog.cpp @@ -27,7 +27,6 @@ KeyGenDialog::KeyGenDialog(GpgME::GpgContext *ctx, QWidget *parent) { mCtx = ctx; buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - this->setWindowTitle(tr("Generate Key")); this->setModal(true); generateKeyDialog(); @@ -43,6 +42,7 @@ void KeyGenDialog::generateKeyDialog() keySizeSpinBox = new QSpinBox(this); keySizeSpinBox->setRange(768, 16384); keySizeSpinBox->setValue(2048); + this->lastKeySize=2048; keySizeSpinBox->setSingleStep(256); @@ -110,6 +110,7 @@ void KeyGenDialog::generateKeyDialog() connect(expireCheckBox, SIGNAL(stateChanged(int)), this, SLOT(expireBoxChanged())); connect(passwordEdit, SIGNAL(textChanged(QString)), this, SLOT(passwordEditChanged())); connect(keyTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(keyTypeChanged())); + connect(keySizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(keySizeChanged())); this->setLayout(vbox2); } @@ -219,18 +220,24 @@ void KeyGenDialog::passwordEditChanged() pwStrengthSlider->setValue(checkPassWordStrength()); update(); } +void KeyGenDialog::keySizeChanged() +{ + if (keySizeSpinBox->value() > 2048 && lastKeySize <=2048) { + QMessageBox::warning(this, tr("Key size warning"), + tr("You've set the keysize to more than 2048 bits. This setting is for advanced users only. The key generation could take a very, very long time.")); + } + lastKeySize=keySizeSpinBox->value(); +} void KeyGenDialog::keyTypeChanged() { - qDebug() << "changed"; if (keyTypeComboBox->currentText() == "RSA") { - qDebug() << "RSA"; keySizeSpinBox->setMaximum(16384); + keySizeSpinBox->setMinimum(1024); } else { - qDebug() << "DSA"; - keySizeSpinBox->setMaximum(65536); + keySizeSpinBox->setMaximum(16384); + keySizeSpinBox->setMinimum(768); } - } int KeyGenDialog::checkPassWordStrength() diff --git a/keygendialog.h b/keygendialog.h index 75cda4e..6d264c1 100644 --- a/keygendialog.h +++ b/keygendialog.h @@ -65,6 +65,7 @@ private: QDateTimeEdit *dateEdit; /** Dateedit for expiration date */ QCheckBox *expireCheckBox; /** Checkbox, if key should expire */ QSlider *pwStrengthSlider; /** Slider showing the password strength */ + int lastKeySize; /** integer to remember to last selected keysize (only display warning first tim above 2048)*/ private slots: /** * @details when expirebox was checked/unchecked, enable/disable the expiration date box @@ -77,6 +78,11 @@ private slots: void passwordEditChanged(); /** + * @details When keysize changed, show message, when too large + */ + void keySizeChanged(); + + /** * @details When passwordedit changed, set keysize appropriately */ void keyTypeChanged(); |