From deec9eb99333b008aa8059aeb0b22503177455d2 Mon Sep 17 00:00:00 2001 From: Christian Hohnstaedt Date: Mon, 13 Aug 2007 13:53:30 +0200 Subject: [PATCH] Minor changes - Add predefined templates to the list of templates - fix extension duplication bug in post 0.6.3 release - change Password dialog text properties - remove unused/duplicate code in lib/pki_key.cpp --- lib/db_temp.cpp | 25 ++++++++++++ lib/db_temp.h | 2 + lib/pki_key.cpp | 11 ------ lib/x509v3ext.cpp | 13 ++++--- ui/Makefile | 8 ---- ui/PassRead.ui | 92 ++++++++++++++++++++++++--------------------- ui/PassWrite.ui | 80 +++++++++++++++++++++++++-------------- widgets/NewX509.cpp | 2 +- 8 files changed, 136 insertions(+), 97 deletions(-) diff --git a/lib/db_temp.cpp b/lib/db_temp.cpp index 1b356200..e3ae04fa 100644 --- a/lib/db_temp.cpp +++ b/lib/db_temp.cpp @@ -60,6 +60,31 @@ pki_base *db_temp::newPKI(){ return new pki_temp(""); } +QStringList db_temp::getDescPredefs() +{ + QStringList x; + x.clear(); + for(pki_temp *pki=(pki_temp*)predefs->iterate(); pki; + pki=(pki_temp*)pki->iterate()) { + x.append(QString("[default] ") + pki->getIntName()); + } + x += getDesc(); + return x; +} + +pki_base *db_temp::getByName(QString desc) +{ + if (!desc.startsWith("[default] ")) + return db_base::getByName(desc); + desc.remove(0, 10); // "[default] " + for(pki_temp *pki=(pki_temp*)predefs->iterate(); pki; + pki=(pki_temp*)pki->iterate()) { + if (pki->getIntName() == desc) + return pki; + } + return NULL; +} + bool db_temp::runTempDlg(pki_temp *temp) { NewX509 *dlg = new NewX509(mainwin); diff --git a/lib/db_temp.h b/lib/db_temp.h index 9e813cd3..bf982687 100644 --- a/lib/db_temp.h +++ b/lib/db_temp.h @@ -29,6 +29,8 @@ class db_temp: public db_base bool runTempDlg(pki_temp *temp); bool alterTemp(pki_temp *temp); void showContextMenu(QContextMenuEvent *e, const QModelIndex &index); + pki_base *getByName(QString desc); + QStringList getDescPredefs(); public slots: void newItem(); diff --git a/lib/pki_key.cpp b/lib/pki_key.cpp index 06116d3a..c129d099 100644 --- a/lib/pki_key.cpp +++ b/lib/pki_key.cpp @@ -85,17 +85,6 @@ QString pki_key::getTypeString() QString pki_key::getIntNameWithType() { - QString postfix; - switch (key->type) { - case EVP_PKEY_RSA: - postfix = " (RSA)"; - break; - case EVP_PKEY_DSA: - postfix = " (DSA)"; - break; - default: - postfix = " (---)"; - } return getIntName() + " (" + getTypeString() + ")"; } diff --git a/lib/x509v3ext.cpp b/lib/x509v3ext.cpp index 7e2fa09c..fc519265 100644 --- a/lib/x509v3ext.cpp +++ b/lib/x509v3ext.cpp @@ -42,14 +42,15 @@ x509v3ext &x509v3ext::set(const X509_EXTENSION *n) x509v3ext &x509v3ext::create(int nid, const QString &et, X509V3_CTX *ctx) { - X509_EXTENSION *new_ext = NULL; - if (!et.isEmpty()) { - new_ext = X509V3_EXT_conf_nid(NULL, ctx, nid, (char*)CCHAR(et)); - } - if (new_ext) { + if (ext) { X509_EXTENSION_free(ext); - ext = new_ext; + ext = NULL; } + if (!et.isEmpty()) { + ext = X509V3_EXT_conf_nid(NULL, ctx, nid, (char*)CCHAR(et)); + } + if (!ext) + ext = X509_EXTENSION_new(); return *this; } diff --git a/ui/Makefile b/ui/Makefile index 34337c31..7074d1b9 100644 --- a/ui/Makefile +++ b/ui/Makefile @@ -4,17 +4,9 @@ TOPDIR=.. endif UINAMES=$(patsubst %.ui, ui_%, $(wildcard *.ui)) -#OBJS=$(patsubst %, moc_%.o, $(UINAMES)) $(patsubst %, %.o, $(UINAMES)) - -#MOC_CPP=$(patsubst %, moc_%.cpp, $(UINAMES)) -#UI_CPP=$(patsubst %, %.cpp, $(UINAMES)) UI_H=$(patsubst %, %.h, $(UINAMES)) - -#DELFILES=$(MOC_CPP) $(UI_CPP) $(UI_H) DELFILES=$(UI_H) -#EXTRA_CFLAGS+=-I../widgets -I../view - include ../Rules.mak headers: $(UI_H) diff --git a/ui/PassRead.ui b/ui/PassRead.ui index 8ad8834c..050c901f 100644 --- a/ui/PassRead.ui +++ b/ui/PassRead.ui @@ -1,14 +1,11 @@ - - - PassRead 0 0 - 339 + 330 192 @@ -16,20 +13,38 @@ Password - - 8 - 6 + + 8 + + + 8 + + + 8 + + + 8 + - - 0 - 6 + + 0 + + + 0 + + + 0 + + + 0 + @@ -87,35 +102,9 @@ - - - 0 - 0 - - - - - 32767 - 32767 - - - - - Sans Serif - 9 - 50 - false - false - false - false - - - - false - @@ -127,12 +116,21 @@ QFrame::Sunken - - 8 - 6 + + 8 + + + 8 + + + 8 + + + 8 + @@ -152,12 +150,21 @@ - - 0 - 6 + + 0 + + + 0 + + + 0 + + + 0 + @@ -192,7 +199,6 @@ - pass PushButton1 diff --git a/ui/PassWrite.ui b/ui/PassWrite.ui index d0571cb9..b1a9b141 100644 --- a/ui/PassWrite.ui +++ b/ui/PassWrite.ui @@ -5,28 +5,46 @@ 0 0 - 474 - 243 + 330 + 221 Password - - 8 - 6 + + 8 + + + 8 + + + 8 + + + 8 + - - 0 - 6 + + 0 + + + 0 + + + 0 + + + 0 + @@ -98,32 +116,29 @@ QFrame::Sunken - + 8 - + + 8 + + + 8 + + + 8 + + + 6 + + 6 - - - 0 - 0 - - - - - 32767 - 32767 - - Repeat password - - false - @@ -152,12 +167,21 @@ - - 0 - 6 + + 0 + + + 0 + + + 0 + + + 0 + diff --git a/widgets/NewX509.cpp b/widgets/NewX509.cpp index 1e1e9c50..4ab85786 100644 --- a/widgets/NewX509.cpp +++ b/widgets/NewX509.cpp @@ -96,7 +96,7 @@ NewX509::NewX509(QWidget *parent) // settings for the templates .... strings.clear(); - strings = MainWindow::temps->getDesc(); + strings = MainWindow::temps->getDescPredefs(); tempList->insertItems(0, strings); // setup Extended keyusage