diff --git a/lib/pki_key.cpp b/lib/pki_key.cpp index f40921d6..e240b643 100644 --- a/lib/pki_key.cpp +++ b/lib/pki_key.cpp @@ -17,6 +17,7 @@ #include builtin_curves builtinCurves; +keyjob keyjob::defaultjob; pki_key::pki_key(const QString &name) :pki_base(name) diff --git a/lib/pki_key.h b/lib/pki_key.h index c2d0a620..15810c62 100644 --- a/lib/pki_key.h +++ b/lib/pki_key.h @@ -94,6 +94,7 @@ class keytype class keyjob { public: + static keyjob defaultjob; keytype ktype; int size; int ec_nid; diff --git a/lib/settings.cpp b/lib/settings.cpp index a333014e..98113581 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -1,8 +1,8 @@ #include "settings.h" #include "func.h" #include "sql.h" +#include "pki_key.h" #include "widgets/hashBox.h" -#include "widgets/NewKey.h" #include #include #include @@ -57,7 +57,7 @@ void settings::setAction(const QString &key, const QString &value) else if (key == "default_hash") hashBox::setDefault(value); else if (key == "defaultkey") - NewKey::defaultjob = keyjob(value); + keyjob::defaultjob = keyjob(value); else if (key == "optionflags") { XSqlQuery q; Transaction; diff --git a/widgets/NewKey.cpp b/widgets/NewKey.cpp index 75d01000..2086dbfe 100644 --- a/widgets/NewKey.cpp +++ b/widgets/NewKey.cpp @@ -19,8 +19,6 @@ #include #include -keyjob NewKey::defaultjob; - class keyListItem { public: @@ -108,7 +106,7 @@ NewKey::NewKey(QWidget *parent, const QString &name) keytypes << keyListItem(t); updateCurves(); - keyLength->setEditText(QString("%1 bit").arg(defaultjob.size)); + keyLength->setEditText(QString("%1 bit").arg(keyjob::defaultjob.size)); keyDesc->setFocus(); if (pkcs11::libraries.loaded()) try { pkcs11 p11; @@ -129,7 +127,7 @@ NewKey::NewKey(QWidget *parent, const QString &name) q.setValue(keytypes[i]); keyType->addItem(keytypes[i].printname, q); if (!keytypes[i].card && - keytypes[i].type() == defaultjob.ktype.type) + keytypes[i].type() == keyjob::defaultjob.ktype.type) { keyType->setCurrentIndex(i); } @@ -175,7 +173,8 @@ void NewKey::updateCurves(unsigned min, unsigned max, unsigned long ec_flags) curveBox->insertSeparator(curveBox->count()); addCurveBoxCurves(curve_other); - int default_index = curveBox->findData(QVariant(defaultjob.ec_nid)); + int default_index = curveBox->findData( + QVariant(keyjob::defaultjob.ec_nid)); curveBox->setCurrentIndex(default_index == -1 ? 0 : default_index); #else (void)min; (void)max; (void)ec_flags; @@ -218,8 +217,8 @@ keyjob NewKey::getKeyJob() const void NewKey::accept() { if (rememberDefault->isChecked()) { - defaultjob = getKeyJob(); - Settings["defaultkey"] = defaultjob.toString(); + keyjob::defaultjob = getKeyJob(); + Settings["defaultkey"] = keyjob::defaultjob.toString(); } QDialog::accept(); } diff --git a/widgets/NewKey.h b/widgets/NewKey.h index c27bd7f2..dfbc7130 100644 --- a/widgets/NewKey.h +++ b/widgets/NewKey.h @@ -22,7 +22,6 @@ class NewKey: public QDialog, public Ui::NewKey unsigned long ec_flags=0); void addCurveBoxCurves(const QList &curves); public: - static keyjob defaultjob; NewKey(QWidget *parent, const QString &name); keyjob getKeyJob() const;