diff --git a/lib/BioByteArray.cpp b/lib/BioByteArray.cpp index a5555e04..b8169685 100644 --- a/lib/BioByteArray.cpp +++ b/lib/BioByteArray.cpp @@ -94,6 +94,11 @@ int BioByteArray::size() const return BIO_get_mem_data(read_write, &p); } +QString BioByteArray::qstring() const +{ + return QString::fromUtf8(byteArray().constData()); +} + BioByteArray::operator BIO*() { return bio(); diff --git a/lib/BioByteArray.h b/lib/BioByteArray.h index 912889eb..3db8fdc5 100644 --- a/lib/BioByteArray.h +++ b/lib/BioByteArray.h @@ -9,6 +9,7 @@ #define __BIOBYTEARRAY_H #include +#include #include class BioByteArray @@ -35,6 +36,7 @@ class BioByteArray BIO *bio(); BIO *ro(); QByteArray byteArray() const; + QString qstring() const; operator BIO*(); operator QByteArray(); BioByteArray &operator = (const BioByteArray &other); diff --git a/lib/arguments.cpp b/lib/arguments.cpp index 6f859f0c..766b607e 100644 --- a/lib/arguments.cpp +++ b/lib/arguments.cpp @@ -38,7 +38,7 @@ const QList arguments::opts = { arg_option("issuers", NULL, no_argument, true, true, "Print all known issuer certificates that have an associated private key and the CA basic constraints set to 'true'."), arg_option("keygen", "", required_argument, true, true, - "Generate a new key and import it into the database. Use the 'name' option to set the intenral name of the new key. The parameter has the format: '[RSA|DSA|EC]:[|]."), + "Generate a new key and import it into the database. Use the 'name' option to set the internal name of the new key. The parameter has the format: '[RSA|DSA|EC]:[|]."), arg_option("list-curves", NULL, no_argument, true, false, "Prints all known Elliptic Curves."), arg_option("name", "", required_argument, false, true, diff --git a/lib/db_base.cpp b/lib/db_base.cpp index b0a3067a..14975ccc 100644 --- a/lib/db_base.cpp +++ b/lib/db_base.cpp @@ -263,7 +263,7 @@ QString db_base::pem2QString(QModelIndexList indexes) const pki->pem(bba, format); openssl_error(); } - return QString::fromUtf8(bba); + return bba.qstring(); } void db_base::pem2clipboard(QModelIndexList indexes) const diff --git a/lib/db_base.h b/lib/db_base.h index 8ca14ad1..a598deba 100644 --- a/lib/db_base.h +++ b/lib/db_base.h @@ -82,6 +82,10 @@ class db_base: public QAbstractItemModel QModelIndex index(pki_base *pki)const; QModelIndex parent(const QModelIndex &index) const; int rowCount(const QModelIndex &parent) const; + int allItemsCount() const + { + return rootItem->childCount(); + } int columnCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, diff --git a/lib/pki_base.cpp b/lib/pki_base.cpp index e02d5ba8..68827de9 100644 --- a/lib/pki_base.cpp +++ b/lib/pki_base.cpp @@ -273,7 +273,7 @@ void pki_base::takeChild(pki_base *pki) QList pki_base::getChildItems() const { - #warning need to collect all children below folders (later) + //#warning need to collect all children below folders (later) return childItems; } diff --git a/lib/pki_lookup.h b/lib/pki_lookup.h index 642468fe..551815a5 100644 --- a/lib/pki_lookup.h +++ b/lib/pki_lookup.h @@ -8,6 +8,7 @@ #ifndef __PKI_LOOKUP_H #define __PKI_LOOKUP_H +#include #include #include #include diff --git a/lib/x509name.cpp b/lib/x509name.cpp index d22fd29a..7404b5f1 100644 --- a/lib/x509name.cpp +++ b/lib/x509name.cpp @@ -68,7 +68,7 @@ QString x509name::oneLine(unsigned long flags) const { BioByteArray bba; X509_NAME_print_ex(bba, xn, 0, flags); - return QString::fromUtf8(bba); + return bba.qstring(); } QString x509name::getEntryByNid(int nid) const diff --git a/lib/x509v3ext.cpp b/lib/x509v3ext.cpp index cb4535a5..79975297 100644 --- a/lib/x509v3ext.cpp +++ b/lib/x509v3ext.cpp @@ -150,7 +150,7 @@ QString x509v3ext::getValue() const ret = ASN1_STRING_print(bba, (ASN1_STRING *)getData()); if (ign_openssl_error() || !ret) return QString(); - return QString::fromLocal8Bit(bba).trimmed(); + return bba.qstring().trimmed(); } QString x509v3ext::getHtmlValue() const diff --git a/widgets/ImportMulti.cpp b/widgets/ImportMulti.cpp index d05f3123..8c8331f2 100644 --- a/widgets/ImportMulti.cpp +++ b/widgets/ImportMulti.cpp @@ -325,10 +325,8 @@ ImportMulti::~ImportMulti() int ImportMulti::entries() { - return mcont->rowCount(QModelIndex()); + return mcont->allItemsCount(); } -#warning better mcont->rootItems().count() via accessor. rowCount() -#warning is only toplevel void ImportMulti::importError(QStringList failed) {