Use C++11 initializers for all non-static class members

When XCA started in 2002, there were no C++ initializers.
Drop explicit initializers from the constructors.

 - Fix indentations of section declarators.
 - Replace NULL by nullptr when feasible.
 - Sort private section: properties first, then methods.
This commit is contained in:
Christian Hohnstaedt 2023-10-08 01:11:03 +02:00
parent 7f4794ff4a
commit 993da2d474
109 changed files with 417 additions and 502 deletions

View File

@ -14,23 +14,20 @@
class BioByteArray
{
protected:
BIO *read_write;
BIO *read_only;
QByteArray store;
protected:
BIO *read_write{};
BIO *read_only{};
QByteArray store{};
void set(const QByteArray &qba);
void add(const QByteArray &qba);
void biowrite(const QByteArray &qba);
void cleanse_and_free(BIO *bio);
public:
BioByteArray(const QByteArray &qba) :
read_write(NULL), read_only(NULL), store(qba) { }
BioByteArray(const BioByteArray &bba) :
read_write(NULL), read_only(NULL), store(bba.byteArray()) { }
BioByteArray() :
read_write(NULL), read_only(NULL), store() { }
public:
BioByteArray(const QByteArray &qba) : store(qba) { }
BioByteArray(const BioByteArray &bba) : store(bba.byteArray()) { }
BioByteArray() { }
~BioByteArray();
int size() const;
BIO *bio();

View File

@ -12,7 +12,7 @@
class Passwd: public QByteArray
{
public:
public:
void cleanse();
~Passwd();
unsigned char *constUchar() const;

View File

@ -14,7 +14,7 @@
class PwDialogUI_i
{
public:
public:
virtual enum open_result execute(pass_info *p, Passwd *passwd,
bool write = false, bool abort = false) = 0;
virtual ~PwDialogUI_i() { };
@ -22,10 +22,10 @@ class PwDialogUI_i
class PwDialogCore
{
private:
private:
static PwDialogUI_i *pwdialog;
public:
public:
static Passwd cmdline_passwd;
static enum open_result execute(pass_info *p, Passwd *passwd,
bool write = false, bool abort = false);

View File

@ -12,7 +12,7 @@
class XcaProgress_i
{
public:
public:
XcaProgress_i() = default;
virtual void start(const QString &what, int max) = 0;
virtual void stop() = 0;
@ -22,10 +22,10 @@ class XcaProgress_i
class XcaProgressCmd : public XcaProgress_i
{
private:
int i;
private:
int i{};
public:
public:
void start(const QString &what, int max);
void stop();
void increment();
@ -33,10 +33,10 @@ class XcaProgressCmd : public XcaProgress_i
class XcaProgress
{
private:
private:
static XcaProgress_i *progress;
public:
public:
XcaProgress(const QString &what = QString(), int max = 100);
~XcaProgress();
void increment();

View File

@ -24,7 +24,7 @@
class xcaWarning_i
{
public:
public:
virtual void information(const QString &msg) = 0;
virtual void warning(const QString &msg) = 0;
virtual void warningv3(const QString &msg, const extList &el) = 0;
@ -39,7 +39,7 @@ class xcaWarningCore : public QObject, public xcaWarning_i
{
Q_OBJECT
public:
public:
void information(const QString &msg);
void warning(const QString &msg);
bool yesno(const QString &msg);
@ -53,7 +53,7 @@ class xcaWarning
{
static class xcaWarning_i *gui;
public:
public:
xcaWarning() = delete;
xcaWarning(const xcaWarningCore &) = delete;
~xcaWarning() = delete;

View File

@ -271,7 +271,6 @@ int arguments::parse(int argc, char *argv[])
arguments::arguments(int argc, char *argv[])
{
need_db = false;
parse(argc, argv);
}

View File

@ -22,13 +22,13 @@ enum {
class arg_option
{
public:
const char *long_opt;
const char *arg;
int arg_type;
bool no_gui;
bool need_db;
QString help;
public:
const char *long_opt{};
const char *arg{};
int arg_type{};
bool no_gui{};
bool need_db{};
QString help{};
arg_option(const char *l, const char *a, int has_arg,
bool n, bool nd, const char *h);
@ -37,14 +37,14 @@ class arg_option
class arguments
{
private:
private:
static const QList<arg_option> opts;
int result;
QMap<QString, QString> found_options;
QStringList files;
bool need_db;
int result{};
QMap<QString, QString> found_options{};
QStringList files{};
bool need_db{ false };
public:
public:
static bool is_console(int argc, char *argv[]);
static QString help();
static QString man();

View File

@ -13,12 +13,13 @@
class a1int
{
private:
ASN1_INTEGER *in;
private:
ASN1_INTEGER *in{};
ASN1_INTEGER *dup(const ASN1_INTEGER *a) const;
a1int &setQString(const QString &s, int dec);
QString toQString(int dec) const;
public:
public:
a1int();
a1int(const ASN1_INTEGER *i);
a1int(const a1int &a);

View File

@ -77,42 +77,26 @@ int a1time::set_asn1(const QString &str, int type)
return 0;
}
a1time::a1time(const QDateTime &a)
: QDateTime(a)
{
atime = NULL;
}
a1time::a1time(const a1time &a)
: QDateTime(a)
{
atime = NULL;
}
a1time &a1time::operator = (const a1time &a)
{
if (atime)
ASN1_TIME_free(atime);
atime = NULL;
QDateTime::operator=(a);
return *this;
}
a1time::a1time()
{
atime = NULL;
*this = now();
}
a1time::a1time(const ASN1_TIME *a)
{
atime = NULL;
from_asn1(a);
}
a1time::a1time(const QString &plain)
{
atime = NULL;
fromPlain(plain);
}

View File

@ -22,15 +22,15 @@
class a1time : public QDateTime
{
private:
ASN1_TIME *atime;
ASN1_TIME *atime{};
int from_asn1(const ASN1_TIME *a);
int set_asn1(const QString &str, int type);
public:
a1time();
a1time(const QDateTime &a);
a1time(const QDateTime &a) : QDateTime(a) { };
a1time(const a1time &a) : QDateTime(a) { };
a1time(const ASN1_TIME *a);
a1time(const a1time &a);
a1time(const QString &plain);
a1time &operator = (const a1time &a);
~a1time();

View File

@ -1,4 +1,5 @@
/*
/* vi: set sw=4 ts=4:
*
* Copyright (C) 2014 - 2020 Christian Hohnstaedt.
*
* All rights reserved.
@ -18,25 +19,22 @@
class builtin_curve
{
public:
int nid;
QString comment;
unsigned order_size;
int flags;
public:
int nid{};
QString comment{};
unsigned order_size{};
int flags{};
/* type: CKF_EC_F_P || CKF_EC_F_2M */
unsigned long type;
builtin_curve(int n, QString c, int s, int f, int t) {
nid = n;
comment = c;
order_size = s;
flags = f;
type = t;
};
unsigned long type{};
builtin_curve(int n, QString c, int s, int f, int t)
: nid(n), comment(c), order_size(s), flags(f), type(t) { };
builtin_curve() = delete;
};
class builtin_curves: public QList<builtin_curve>
{
public:
public:
builtin_curves();
bool containNid(int nid)
{

View File

@ -140,9 +140,9 @@ database_model::database_model(const QString &name, const Passwd &pass)
#ifndef APPSTORE_COMPLIANT
dbName = name;
#else
(void)name;
dbName = "default.xdb";
#endif
dbTimer = 0;
if (dbName.isEmpty())
dbName = get_default_db();

View File

@ -25,12 +25,13 @@ class database_model: public QObject
Q_OBJECT
private:
QList<db_base*> models;
int dbTimer;
QList<db_base*> models{};
int dbTimer{};
QString dbName{};
QString db_provider{};
void openSqlDB();
QSqlError initSqlDB();
QString dbName;
QString db_provider;
const QString &detect_provider();
bool checkForOldDbFormat(const QString &dbfile) const;
enum open_result verifyOldDbPass(const QString &dbname) const;
@ -74,7 +75,7 @@ class database_model: public QObject
if (m)
return m;
}
return NULL;
return nullptr;
}
pki_base *insert(pki_base *pki);
@ -89,10 +90,10 @@ class database_model: public QObject
class xca_db
{
private:
database_model *db;
database_model *db{};
public:
xca_db() : db(nullptr) { }
xca_db() { }
~xca_db()
{
close();

View File

@ -33,10 +33,7 @@ db_base::db_base(const char *classname)
{
rootItem = new pki_base(QString("ROOTitem(%1)").arg(classname));
treeItem = new pki_base(QString("TREEitem(%1)").arg(classname));
colResizing = 0;
class_name = classname;
secondsTimer = minutesTimer = hoursTimer = 0;
treeview = true;
restart_timer();
}
@ -48,9 +45,8 @@ db_base::~db_base()
delete treeItem;
}
pki_base *db_base::newPKI(enum pki_type type)
pki_base *db_base::newPKI(enum pki_type)
{
(void)type;
return new pki_base();
}

View File

@ -28,23 +28,24 @@ class db_base: public QAbstractItemModel
Q_OBJECT
protected:
int secondsTimer, minutesTimer, hoursTimer;
void _writePKI(pki_base *pki, bool overwrite);
QList<enum pki_type> pkitype;
QList<enum pki_type> pkitype_depends;
QString class_name;
int secondsTimer{}, minutesTimer{}, hoursTimer{};
QList<enum pki_type> pkitype{};
QList<enum pki_type> pkitype_depends{};
QString class_name{};
/* Sql table containing the 'hash' of this items */
QString sqlHashTable;
dbheaderList allHeaders;
QString sqlHashTable{};
dbheaderList allHeaders{};
int colResizing{};
bool treeview{ true };
pki_base *rootItem{};
pki_base *treeItem{};
QVariant selected{};
void _writePKI(pki_base *pki, bool overwrite);
virtual dbheaderList getHeaders();
int colResizing;
QString sqlItemSelector();
bool isValidCol(int col) const;
void timerEvent(QTimerEvent *event);
bool treeview;
pki_base *rootItem;
pki_base *treeItem;
QVariant selected;
public:
void restart_timer();

View File

@ -16,10 +16,10 @@ class pki_temp;
class db_temp: public db_x509name
{
Q_OBJECT
protected:
QList<pki_temp*> predefs;
protected:
QList<pki_temp*> predefs{};
public:
public:
db_temp();
~db_temp();
pki_base *newPKI(enum pki_type type = none);

View File

@ -16,7 +16,8 @@ class db_token: public db_base
{
Q_OBJECT
private:
slotid slot;
slotid slot{};
public:
db_token();
bool setData(const QModelIndex &index,

View File

@ -30,7 +30,6 @@ dbhistory::dbhistory()
return;
}
history.clear();
while (!file.atEnd()) {
QByteArray ba;
ba = file.readLine(1024);

View File

@ -13,7 +13,7 @@
class dbhistory
{
private:
QStringList history;
QStringList history{};
static QString lastRemote;
public:

View File

@ -15,16 +15,16 @@
class DHgen: public QThread
{
QString fname;
int bits;
errorEx err;
QString fname{};
int bits{};
errorEx err{};
public:
public:
DHgen(const QString &n, int b) : QThread(), fname(n), bits(b) {}
QString filename() const { return fname; }
errorEx error() const { return err; }
protected:
protected:
void run();
};
#endif

View File

@ -15,11 +15,12 @@ class digest
{
private:
static int default_md;
int md_nid;
int md_nid{ NID_sha256 };
public:
static const QList<int> all_digests;
digest() { };
digest(int nid);
digest(const EVP_MD *md);
digest(const QString &name);

View File

@ -14,15 +14,15 @@
class Entropy
{
protected:
QString rnd;
protected:
QString rnd{};
static QElapsedTimer timer;
static unsigned char pool[512];
static unsigned pool_pos;
static unsigned seed_strength;
static int random_from_file(QString fname, unsigned amount,
int weakness=1);
public:
public:
Entropy();
~Entropy();
static void add(int rand);

View File

@ -24,7 +24,7 @@ enum open_result {
class errorEx
{
protected:
QString msg;
QString msg{};
public:
errorEx(QString txt = "", QString className = "")

View File

@ -61,20 +61,10 @@
class dbheader
{
protected:
void init()
{
id = HD_undef;
action = NULL;
show = showDefault = false;
size = -1;
visualIndex = -1;
sortIndicator = -1;
type = hd_default;
}
QString name, tooltip;
protected:
QString name{}, tooltip{};
public:
public:
enum hdr_type {
hd_default,
hd_x509name,
@ -84,30 +74,23 @@ class dbheader
hd_asn1time,
hd_key,
};
int id;
bool show;
bool showDefault;
int id{ HD_undef };
bool show{ false };
bool showDefault{ false };
QAction *action{};
int size{ -1 };
int visualIndex{ -1 };
int sortIndicator{ -1 };
enum hdr_type type{ hd_default };
virtual QString getName() { return name; }
virtual QString getTooltip() { return tooltip; }
QAction *action;
int size;
int visualIndex;
int sortIndicator;
enum hdr_type type;
dbheader(QString aname = QString())
{
init();
name = aname;
}
dbheader(QString aname = QString()) : name(aname) { }
dbheader(int aid, bool ashow = false,
QString aname = QString(), QString atip = QString())
: name(aname), tooltip(atip), id(aid), show(ashow), showDefault(ashow)
{
init();
id = aid;
name = aname;
tooltip = atip;
show = showDefault = ashow;
}
virtual ~dbheader() { }
@ -136,11 +119,12 @@ class dbheader
}
QString toData()
{
QStringList sl; sl
<< QString::number(visualIndex)
<< QString::number(sortIndicator)
<< QString::number(size)
<< QString::number(show);
QStringList sl{
QString::number(visualIndex),
QString::number(sortIndicator),
QString::number(size),
QString::number(show)
};
return sl.join(" ");
}
void fromData(QString s)
@ -185,10 +169,10 @@ class dbheader
class nid_dbheader : public dbheader
{
private:
QString sn;
private:
QString sn{};
public:
public:
nid_dbheader(int aid, enum hdr_type atype)
: dbheader(aid, aid == NID_commonName)
{

View File

@ -16,8 +16,8 @@ class pki_base;
class load_base
{
public:
QString filter;
QString caption;
QString filter{};
QString caption{};
load_base();
virtual ~load_base();
virtual pki_base *loadItem(const QString &s);

View File

@ -16,8 +16,7 @@ class MainWindow;
extern MainWindow *mainwin;
extern char segv_data[1024];
//extern bool exitApp;
pki_multi *probeAnything(const QString &, int *ret = NULL);
pki_multi *probeAnything(const QString &, int *ret = nullptr);
int exportIndex(const QString &fname, bool hierarchy);
#endif

View File

@ -8,13 +8,9 @@
#include "pass_info.h"
pass_info::pass_info(const QString &t, const QString &d, QWidget *w)
: title(t), description(d), widget(w),
type(tr("Password")), pixmap(QString(":keyImg")), result(pw_ok)
{
title = t;
description = d;
widget = w;
type = tr("Password");
pixmap = QString(":keyImg");
result = pw_ok;
}
void pass_info::setPin()

View File

@ -20,16 +20,16 @@ class pass_info: public QObject
{
Q_OBJECT
private:
QString title;
QString description;
QWidget *widget;
QString type;
QString pixmap;
enum open_result result;
private:
QString title{};
QString description{};
QWidget *widget{};
QString type{};
QString pixmap{};
enum open_result result{};
public:
pass_info(const QString &t, const QString &d, QWidget *w = NULL);
public:
pass_info(const QString &t, const QString &d, QWidget *w = nullptr);
QString getTitle() const
{
return title;

View File

@ -22,13 +22,13 @@ class pk11_attlist;
class pk11_attribute
{
friend class pk11_attlist;
protected:
CK_ATTRIBUTE attr;
public:
protected:
CK_ATTRIBUTE attr{};
public:
pk11_attribute(unsigned long type)
{
memset(&attr, 0, sizeof(attr));
attr.type = type;
}
virtual ~pk11_attribute() { }

View File

@ -39,12 +39,9 @@ extern char segv_data[1024];
class tkInfo
{
private:
CK_TOKEN_INFO token_info;
CK_TOKEN_INFO token_info{};
public:
tkInfo()
{
memset(&token_info, 0, sizeof token_info);
}
tkInfo() { }
tkInfo(const CK_TOKEN_INFO *ti)
{
set(ti);

View File

@ -22,7 +22,6 @@ pkcs11_lib::pkcs11_lib(const QString &f)
CK_RV (*c_get_function_list)(CK_FUNCTION_LIST_PTR_PTR);
CK_RV rv;
file = name2File(f, &enabled);
p11 = NULL;
if (!enabled)
return;

View File

@ -20,14 +20,15 @@ class pkcs11_lib : public QLibrary
{
Q_OBJECT
private:
CK_FUNCTION_LIST *p11;
QString file, load_error;
bool enabled;
private:
CK_FUNCTION_LIST *p11{};
QString file, load_error{};
bool enabled{};
public:
static QString name2File(const QString &name, bool *enabled = NULL);
public:
static QString name2File(const QString &name, bool *enabled = nullptr);
pkcs11_lib(const QString &file);
pkcs11_lib() = delete;
~pkcs11_lib();
QList<unsigned long> getSlotList();

View File

@ -22,24 +22,15 @@ QRegularExpression pki_base::limitPattern;
bool pki_base::pem_comment;
QBrush pki_base::red, pki_base::cyan, pki_base::yellow;
pki_base::pki_base(const QString &name)
pki_base::pki_base(const QString &name) : desc(name)
{
desc = name;
parent = nullptr;
childItems.clear();
pkiType=none;
pkiSource=unknown;
iamvisible = 1;
}
pki_base::pki_base(const pki_base *p)
{
desc = p->desc;
parent = nullptr;
childItems.clear();
pkiType = p->pkiType;
pkiSource = p->pkiSource;
iamvisible = 1;
p->inheritFilename(this);
}

View File

@ -59,20 +59,21 @@ class pki_base : public QObject
static void setupColors(const QPalette &pal);
protected:
QVariant sqlItemId;
QString desc, comment;
a1time insertion_date;
enum pki_type pkiType;
QVariant sqlItemId{};
QString desc{}, comment{};
a1time insertion_date{};
enum pki_type pkiType{ none };
/* model data */
pki_base *parent;
pki_base *parent{};
QString filename{};
QList<pki_base*> childItems{};
mutable QRegularExpression lastPattern{};
int iamvisible{ 1 };
static QBrush red, yellow, cyan;
void my_error(const QString &error) const;
QString filename;
virtual QByteArray PEM_comment() const;
virtual void collect_properties(QMap<QString, QString> &) const;
QList<pki_base*> childItems;
mutable QRegularExpression lastPattern;
static QBrush red, yellow, cyan;
int iamvisible;
public:
enum msg_type {
@ -86,7 +87,7 @@ class pki_base : public QObject
print_pem,
print_coloured,
};
enum pki_source pkiSource;
enum pki_source pkiSource{ unknown };
pki_base(const QString &d = QString());
pki_base(const pki_base *p);
@ -178,9 +179,8 @@ class pki_base : public QObject
virtual void writeDefault(const QString&) const;
/* Qt Model-View methods */
virtual QVariant bg_color(const dbheader *hd) const
virtual QVariant bg_color(const dbheader *) const
{
(void)hd;
return QVariant();
}
virtual QVariant column_data(const dbheader *hd) const;

View File

@ -12,7 +12,7 @@
#include "database_model.h"
#include <QDir>
pki_crl::pki_crl(const QString name )
pki_crl::pki_crl(const QString &name)
:pki_x509name(name)
{
crl = X509_CRL_new();

View File

@ -22,19 +22,19 @@
class crljob
{
public:
pki_x509 *issuer;
bool withReason;
bool authKeyId;
bool subAltName;
bool setCrlNumber;
a1int crlNumber;
int crlDays;
digest hashAlgo;
a1time lastUpdate;
a1time nextUpdate;
public:
pki_x509 *issuer{};
bool withReason{};
bool authKeyId{};
bool subAltName{};
bool setCrlNumber{};
a1int crlNumber{};
int crlDays{};
digest hashAlgo{};
a1time lastUpdate{};
a1time nextUpdate{};
crljob(pki_x509 *x) : issuer(x),
crljob(pki_x509 *x = nullptr) : issuer(x),
withReason(true),
authKeyId(true),
subAltName(true),
@ -52,7 +52,6 @@ class crljob
delete key;
}
}
crljob() = delete;
};
class pki_crl: public pki_x509name
@ -60,12 +59,12 @@ class pki_crl: public pki_x509name
Q_OBJECT
friend class pki_x509;
protected:
QVariant issuerSqlId;
X509_CRL *crl;
QVariant issuerSqlId{};
X509_CRL *crl{};
extList extensions() const;
void collect_properties(QMap<QString, QString> &prp) const;
public:
pki_crl(const QString name = "");
pki_crl(const QString &name = QString());
~pki_crl();
void fromPEM_BIO(BIO *bio, const QString &name);
void fload(const QString &fname);

View File

@ -53,7 +53,7 @@ class pki_export : public QObject {
Q_OBJECT
public:
public:
int id;
enum pki_type pki_type;
@ -69,7 +69,7 @@ class pki_export : public QObject {
static void free_elements();
bool match_all(int match_flags) const;
private:
private:
static QList<pki_export*> elements;
};

View File

@ -1,4 +1,5 @@
/*
/* vi: set sw=4 ts=4:
*
* Copyright (C) 2001 - 2020 Christian Hohnstaedt.
*
* All rights reserved.
@ -28,7 +29,7 @@ extern builtin_curves builtinCurves;
class keytype
{
public:
public:
static QList<keytype> types()
{
return QList<keytype> {
@ -45,10 +46,10 @@ class keytype
#endif
};
}
int type;
QString name;
CK_MECHANISM_TYPE mech;
bool curve, length;
int type{};
QString name{};
CK_MECHANISM_TYPE mech{};
bool curve{}, length{};
keytype(int t, const QString &n, CK_MECHANISM_TYPE m, bool c, bool l)
: type(t), name(n), mech(m), curve(c), length(l) { }

View File

@ -16,7 +16,7 @@ class pki_multi: public pki_base
{
Q_OBJECT
protected:
QList<pki_base*> multi;
QList<pki_base*> multi{};
public:
pki_multi(const QString &name = "");
~pki_multi();

View File

@ -34,7 +34,6 @@ pki_pkcs12::pki_pkcs12(const QString &fname)
Passwd pass;
EVP_PKEY *mykey = NULL;
X509 *mycert = NULL;
key = NULL; cert = NULL;
pass_info p(XCA_TITLE, tr("Please enter the password to decrypt the PKCS#12 file:\n%1").arg(compressFilename(fname)));
const X509_ALGOR *macalgid = NULL;
const ASN1_INTEGER *maciter = NULL;

View File

@ -15,11 +15,11 @@ class pki_x509;
class encAlgo
{
private:
private:
static int default_encAlgo;
int encAlgo_nid;
int encAlgo_nid { NID_undef };
public:
public:
static const QList<int> all_encAlgos;
encAlgo(int nid);
@ -41,9 +41,9 @@ class pki_pkcs12: public pki_multi
friend class pki_evp;
protected:
QString alias, algorithm;
pki_x509 *cert;
pki_key *key;
QString alias{}, algorithm{};
pki_x509 *cert{};
pki_key *key{};
public:
pki_pkcs12(const QString &d, pki_x509 *acert, pki_key *akey);

View File

@ -17,7 +17,6 @@
pki_pkcs7::pki_pkcs7(const QString &name)
:pki_multi(name)
{
p7 = NULL;
}
pki_pkcs7::~pki_pkcs7()

View File

@ -22,7 +22,7 @@ class pki_pkcs7: public pki_multi
friend class pki_x509;
protected:
PKCS7 *p7;
PKCS7 *p7{};
void signBio(pki_x509 *crt, BIO *bio);
void encryptBio(pki_x509 *crt, BIO *bio);
void append_certs(PKCS7 *myp7, const QString &name);

View File

@ -25,12 +25,9 @@ void pki_scard::init(void)
ownPass = ptPin;
pkiType = smartCard;
isPub = false;
card_serial = card_manufacturer = card_label = "";
card_model = slot_label = "";
}
pki_scard::pki_scard(const QString name)
pki_scard::pki_scard(const QString &name)
:pki_key(name)
{
init();

View File

@ -26,17 +26,17 @@ class pki_scard: public pki_key
{
Q_OBJECT
protected:
QString card_serial;
QString card_manufacturer;
QString card_model;
QString card_label;
QString slot_label;
QString object_id;
QList<CK_MECHANISM_TYPE> mech_list;
QString card_serial{};
QString card_manufacturer{};
QString card_model{};
QString card_label{};
QString slot_label{};
QString object_id{};
QList<CK_MECHANISM_TYPE> mech_list{};
void init(void);
public:
pki_scard(const QString name);
pki_scard(const QString &name);
virtual ~pki_scard();
void load_token(pkcs11 &p11, CK_OBJECT_HANDLE object);
bool prepare_card(slotid *slot) const;

View File

@ -88,19 +88,14 @@ const QList<QString> pki_temp::tmpl_keys = {
};
pki_temp::pki_temp(const pki_temp *pk)
:pki_x509name(pk->getIntName())
:pki_x509name(pk->getIntName()), xname(pk->xname), settings(pk->settings)
{
pre_defined = false;
xname = pk->xname;
settings = pk->settings;
}
pki_temp::pki_temp(const QString &d)
:pki_x509name(d)
{
pkiType = tmpl;
pre_defined = false;
foreach(QString key, tmpl_keys) {
settings[key] = QString();
@ -112,7 +107,7 @@ pki_temp::pki_temp(const QString &d)
QString pki_temp::comboText() const
{
return pre_defined ? QString("[default] ") + pki_base::comboText() :
pki_base::comboText();
pki_base::comboText();
}
QSqlError pki_temp::insertSqlData()

View File

@ -29,10 +29,10 @@ class pki_temp: public pki_x509name
static const QList<QString> tmpl_keys;
int dataSize();
void try_fload(XFile &file);
bool pre_defined;
x509name xname;
QMap<QString, QString> settings;
QString adv_ext;
bool pre_defined{ false };
x509name xname{};
QMap<QString, QString> settings{};
QString adv_ext{};
void fromExtList(extList *el, int nid, const char *item);
public:
@ -40,22 +40,22 @@ class pki_temp: public pki_x509name
pki_temp(const QString &d = QString());
~pki_temp();
QString getSetting(QString key)
QString getSetting(const QString &key)
{
CHECK_TMPL_KEY
return settings[key];
}
int getSettingInt(QString key)
int getSettingInt(const QString &key)
{
CHECK_TMPL_KEY
return settings[key].toInt();
}
void setSetting(QString key, QString value)
void setSetting(const QString &key, const QString &value)
{
CHECK_TMPL_KEY
settings[key] = value;
}
void setSetting(QString key, int value)
void setSetting(const QString &key, int value)
{
CHECK_TMPL_KEY
settings[key] = QString::number(value);

View File

@ -18,11 +18,9 @@
#include "pass_info.h"
pki_x509::pki_x509(X509 *c)
:pki_x509super()
:pki_x509super(), cert(c)
{
init();
cert = c;
pki_openssl_error();
}
pki_x509::pki_x509(const pki_x509 *crt)
@ -249,10 +247,7 @@ pki_x509::~pki_x509()
void pki_x509::init()
{
caTemplateSqlId = QVariant();
crlDays = 30;
crlExpire.setUndefined();
cert = NULL;
pkiType = x509;
}

View File

@ -34,15 +34,15 @@ class pki_x509 : public pki_x509super
{
Q_OBJECT
private:
QVariant issuerSqlId;
a1time crlExpire;
a1int crlNumber;
int crlDays;
QVariant caTemplateSqlId;
X509 *cert;
QVariant issuerSqlId{};
a1time crlExpire{};
a1int crlNumber{};
int crlDays{ 30 };
QVariant caTemplateSqlId{};
X509 *cert{};
x509rev revocation{};
x509revList fromDataRevList{};
void init();
x509rev revocation;
x509revList fromDataRevList;
void resetX509ReqCount() const;
protected:

View File

@ -22,8 +22,7 @@ pki_x509req::pki_x509req(const QString &name)
{
request = X509_REQ_new();
pki_openssl_error();
pkiType=x509_req;
done = false;
pkiType = x509_req;
resetX509count();
}

View File

@ -25,10 +25,10 @@ class pki_x509req : public pki_x509super
{
Q_OBJECT
mutable int x509count;
mutable int x509count{};
protected:
X509_REQ *request;
bool done;
X509_REQ *request{};
bool done{ false };
int sigAlg() const;
void collect_properties(QMap<QString, QString> &prp) const;

View File

@ -19,10 +19,10 @@
class pki_x509name : public pki_base
{
protected:
protected:
QByteArray PEM_comment() const;
public:
public:
pki_x509name(const QString &name = QString());
pki_x509name(const pki_x509name *n);
virtual x509name getSubject() const = 0;
@ -36,7 +36,7 @@ class pki_x509super : public pki_x509name
{
Q_OBJECT
protected:
QVariant keySqlId;
QVariant keySqlId{};
virtual int sigAlg() const = 0;
void collect_properties(QMap<QString, QString> &prp) const;
public:

View File

@ -1,3 +1,10 @@
/* vi: set sw=4 ts=4:
*
* Copyright (C) 2018 Christian Hohnstaedt.
*
* All rights reserved.
*/
#include "settings.h"
#include "func.h"
#include "sql.h"
@ -13,9 +20,8 @@
settings Settings;
svalue::svalue(settings *s, const QString &k)
: setting(s), key(k)
{
setting = s;
key = k;
}
QString svalue::get() const

View File

@ -16,13 +16,13 @@
class settings;
class svalue
{
private:
settings *setting;
QString key;
private:
settings *setting{};
QString key{};
QString get() const;
void set(const QString &val);
public:
public:
svalue(settings *s, const QString &k);
QStringList split(QString sep)
{
@ -91,17 +91,17 @@ class settings
{
friend class svalue;
private:
bool loaded;
QStringList db_keys, hostspecific;
QMap<QString, QString> values;
QMap<QString, QString> defaul;
private:
bool loaded{};
QStringList db_keys{}, hostspecific{};
QMap<QString, QString> values{};
QMap<QString, QString> defaul{};
void load_settings();
QString get(QString key);
void set(QString key, QString value);
void setAction(const QString &key, const QString &value);
public:
public:
settings();
void clear();
QString defaults(const QString &key);

View File

@ -27,11 +27,6 @@ void DbTransaction::debug(const char *func, const char *file, int line)
.arg(line).arg(func).arg(mutex).arg(error);
}
DbTransaction::DbTransaction()
{
has_begun = false;
}
DbTransaction::~DbTransaction()
{
if (has_begun)

View File

@ -23,12 +23,12 @@ class DbTransaction
static int error;
static QList<quint64> items;
static bool hasTransaction;
bool has_begun;
bool has_begun{};
void debug(const char *func, const char *file, int line);
bool finish(const char *oper, const char *file, int line);
public:
DbTransaction();
DbTransaction() { };
~DbTransaction();
bool begin(const char *file, int line);
bool commit(const char *file, int line);

View File

@ -26,13 +26,11 @@ x509name::x509name(const X509_NAME *n)
x509name::x509name(STACK_OF(X509_NAME_ENTRY) *entries)
{
xn = NULL;
set(entries);
}
x509name::x509name(const x509name &n)
{
xn = NULL;
set(n.xn);
}

View File

@ -16,7 +16,7 @@
class x509name
{
private:
X509_NAME *xn;
X509_NAME *xn{};
public:
x509name();
x509name(const X509_NAME *n);

View File

@ -20,9 +20,9 @@
class x509rev
{
private:
a1int serial;
a1time date, ivalDate;
int reason_idx, crlNo;
a1int serial{};
a1time date{}, ivalDate{};
int reason_idx{}, crlNo{};
void set(const x509rev &x);
X509_REVOKED *toREVOKED(bool withReason=true) const;
@ -38,7 +38,6 @@ class x509rev
x509rev()
{
reason_idx = 0;
date.setUndefined();
}
x509rev(X509_REVOKED *n)

View File

@ -20,10 +20,9 @@
x509v3ext::x509v3ext()
{
ext = nullptr;
}
x509v3ext::x509v3ext(const X509_EXTENSION *n) : ext(nullptr)
x509v3ext::x509v3ext(const X509_EXTENSION *n)
{
if (n) {
ext = X509_EXTENSION_dup((X509_EXTENSION *)n);
@ -31,12 +30,12 @@ x509v3ext::x509v3ext(const X509_EXTENSION *n) : ext(nullptr)
}
}
x509v3ext::x509v3ext(const x509v3ext &n) : ext(nullptr)
x509v3ext::x509v3ext(const x509v3ext &n)
{
set(n.ext);
}
x509v3ext::x509v3ext(int nid, const QString &et, X509V3_CTX *ctx) : ext(nullptr)
x509v3ext::x509v3ext(int nid, const QString &et, X509V3_CTX *ctx)
{
create(nid, et, ctx);
}

View File

@ -19,7 +19,7 @@ class QString;
class x509v3ext
{
private:
X509_EXTENSION *ext;
X509_EXTENSION *ext{};
const ASN1_OBJECT *object() const;
public:
x509v3ext();

View File

@ -19,11 +19,11 @@ class CertDetail: public XcaDetail, public Ui::CertDetail
{
Q_OBJECT
bool showConf;
QVariant keySqlId, issuerSqlId, thisSqlId;
QString conf, exts;
bool showConf{ false };
QVariant keySqlId{}, issuerSqlId{}, thisSqlId{};
QString conf{}, exts{};
QLabel *labelFromAsn1String(ASN1_STRING *s);
pki_key *myPubKey, *tmpPubKey;
pki_key *myPubKey{}, *tmpPubKey{};
void setCert(pki_x509 *cert);
void setReq(pki_x509req *req);

View File

@ -17,7 +17,7 @@ class CertExtend: public QDialog, public Ui::CertExtend
{
Q_OBJECT
pki_x509 *signer;
pki_x509 *signer{};
public:
CertExtend(QWidget *parent, pki_x509 *s);

View File

@ -20,7 +20,7 @@
#include <QTextEdit>
#include <QLineEdit>
CrlDetail::CrlDetail(QWidget *w) : XcaDetail(w), issuerSqlId(), crlSqlId()
CrlDetail::CrlDetail(QWidget *w) : XcaDetail(w)
{
setupUi(this);
init("crldetail", ":revImg");

View File

@ -19,7 +19,7 @@ class CrlDetail: public XcaDetail, public Ui::CrlDetail
Q_OBJECT
private:
QVariant issuerSqlId, crlSqlId;
QVariant issuerSqlId{}, crlSqlId{};
public:
CrlDetail(QWidget *w = nullptr);
void setCrl(pki_crl *crl);

View File

@ -19,10 +19,10 @@ class ExportDialog: public QDialog, public Ui::ExportDialog
{
Q_OBJECT
protected:
QString filter;
protected:
QString filter{};
public:
public:
ExportDialog(QWidget *w, const QString &title, const QString &filt,
const QModelIndexList &indexes, const QPixmap &img,
QList<const pki_export*> types,
@ -31,7 +31,7 @@ class ExportDialog: public QDialog, public Ui::ExportDialog
static bool mayWriteFile(const QString &fname);
const pki_export *export_type(int idx = -1) const;
public slots:
public slots:
void on_fileBut_clicked();
void on_exportFormat_activated(int);
void on_exportFormat_highlighted(int index);

View File

@ -12,7 +12,7 @@
class focusCombo : public QComboBox
{
public:
public:
focusCombo(QWidget *parent) : QComboBox(parent) { }
void hidePopup()
{

View File

@ -16,7 +16,7 @@
#include <QHelpLink>
#endif
Help::Help() : QWidget(NULL), helpengine(nullptr)
Help::Help() : QWidget(NULL)
{
setupUi(this);
setWindowTitle(XCA_TITLE);

View File

@ -18,17 +18,17 @@ class Help: public QWidget, public Ui::Help
{
Q_OBJECT
QHelpEngineCore *helpengine;
QHelpEngineCore *helpengine{};
void display(const QUrl &url);
public:
public:
Help();
~Help();
void register_ctxhelp_button(QDialog *dlg,
const QString &help_ctx) const;
QList<QUrl> url_by_ctx(const QString &ctx) const;
public slots:
public slots:
void contexthelp();
void contexthelp(const QString &context);
void content();

View File

@ -21,8 +21,8 @@ class ImportMulti: public QDialog, private Ui::ImportMulti
Q_OBJECT
private:
slotid slot;
db_token *mcont;
slotid slot{};
db_token *mcont{};
void importError(QStringList failed);
public:

View File

@ -18,7 +18,7 @@
template <class T> class itemCombo : public QComboBox
{
public:
public:
itemCombo(QWidget *parent) : QComboBox(parent) { }
void insertPkiItems(QList<T*> items) {
clear();

View File

@ -22,7 +22,7 @@
#include <QPushButton>
#include <QLineEdit>
KeyDetail::KeyDetail(QWidget *w) : XcaDetail(w) , keySqlId()
KeyDetail::KeyDetail(QWidget *w) : XcaDetail(w)
{
setupUi(this);

View File

@ -18,7 +18,7 @@ class KeyDetail: public XcaDetail, public Ui::KeyDetail
{
Q_OBJECT
QVariant keySqlId;
QVariant keySqlId{};
public:
KeyDetail(QWidget *w = nullptr);

View File

@ -21,14 +21,14 @@ class KeyTreeView: public XcaTreeView
return dynamic_cast<db_key*>(basemodel);
}
public:
public:
KeyTreeView(QWidget *parent) : XcaTreeView(parent) { }
void fillContextMenu(QMenu *menu, QMenu *subExport,
const QModelIndex &index, QModelIndexList indexes);
void showPki(pki_base *pki);
ExportDialog *exportDialog(const QModelIndexList &indexes);
public slots:
public slots:
void resetOwnPass();
void setOwnPass();
void changePin();

View File

@ -89,7 +89,6 @@ MainWindow::MainWindow() : QMainWindow()
OpenDb::initDatabases();
historyMenu = NULL;
helpdlg = new Help();
init_menu();
setItemEnabled(false);
@ -128,9 +127,6 @@ MainWindow::MainWindow() : QMainWindow()
XcaProgress::setGui(new XcaProgressGui(this));
xcaWarning::setGui(new xcaWarningGui());
PwDialogCore::setGui(new PwDialogUI());
dhgen = nullptr;
dhgenProgress = nullptr;
}
void MainWindow::dropEvent(QDropEvent *event)

View File

@ -35,7 +35,7 @@ class tipMenu : public QMenu
{
Q_OBJECT
public:
public:
tipMenu(QString n, QWidget *w) : QMenu(n, w) {}
bool event (QEvent * e)
{
@ -58,22 +58,22 @@ class MainWindow: public QMainWindow, public Ui::MainWindow
private:
static OidResolver *resolver;
QString string_opt;
QList<QWidget*> wdList;
QList<QWidget*> wdMenuList;
QList<QWidget*> scardList;
QList<QAction*> acList;
tipMenu *historyMenu;
QString string_opt{};
QList<QWidget*> wdList{};
QList<QWidget*> wdMenuList{};
QList<QWidget*> scardList{};
QList<QAction*> acList{};
tipMenu *historyMenu{};
QLineEdit *searchEdit{};
QStringList urlsToOpen{};
XcaProgress *dhgenProgress{};
DHgen *dhgen{};
QList<XcaTreeView *> views{};
dbhistory history{};
void set_geometry(QString geo);
QLineEdit *searchEdit;
QStringList urlsToOpen;
int checkOldGetNewPass(Passwd &pass);
void checkDB();
XcaProgress *dhgenProgress;
DHgen *dhgen;
const QList<QStringList> getTranslators() const;
QList<XcaTreeView *> views;
dbhistory history;
void exportIndex(const QString &fname, bool hierarchy) const;
QAction *languageMenuEntry(const QStringList &sl);

View File

@ -17,14 +17,14 @@ class NewCrl: public QWidget, public Ui::NewCrl
{
Q_OBJECT
crljob task;
public:
crljob task{};
public:
NewCrl(const crljob &task, QWidget *w = nullptr);
~NewCrl();
crljob getCrlJob() const;
static void newCrl(QWidget *parent, pki_x509 *issuer);
public slots:
public slots:
void on_applyTime_clicked();
};
#endif

View File

@ -110,9 +110,8 @@ QList<nameEdit> NewX509::setupExplicitInputs(NIDlist nid_list,
return edits;
}
NewX509::NewX509(QWidget *w) : QDialog(w ? w : mainwin)
NewX509::NewX509(QWidget *w) : QDialog(w && w->isVisible() ? w : nullptr)
{
int i;
QStringList keys;
db_key *keymodel = Database.model<db_key>();
db_x509req *reqmodel = Database.model<db_x509req>();
@ -123,8 +122,6 @@ NewX509::NewX509(QWidget *w) : QDialog(w ? w : mainwin)
mainwin->helpdlg->register_ctxhelp_button(this, "wizard");
/* temporary storage for creating temporary X509V3_CTX */
ctx_cert = NULL;
pkiSource = generated;
foreach(int nid, distname_nid)
keys << QString(OBJ_nid2ln(nid));
@ -152,7 +149,7 @@ NewX509::NewX509(QWidget *w) : QDialog(w ? w : mainwin)
setWindowTitle(XCA_TITLE);
for (i=0; i<tabWidget->count(); i++) {
for (int i=0; i<tabWidget->count(); i++) {
tabWidget->widget(i)->setObjectName(tabnames[i]);
qDebug() << "TAB:" << i << tabWidget->tabText(i);
}
@ -207,7 +204,6 @@ NewX509::NewX509(QWidget *w) : QDialog(w ? w : mainwin)
certList->setDisabled(true);
tabWidget->setCurrentIndex(0);
attrWidget->hide();
pt = none;
notAfter->setEndDate(true);
basicPath->setValidator(new QIntValidator(0, 1000, this));

View File

@ -28,11 +28,12 @@ class x509name;
class x509v3ext;
class extList;
class nameEdit {
public:
int nid;
QLineEdit *edit;
QLabel *label;
class nameEdit
{
public:
int nid{};
QLineEdit *edit{};
QLabel *label{};
nameEdit(int n, QLineEdit *e, QLabel *l) {
nid = n; edit = e; label = l;
}
@ -42,30 +43,30 @@ class NewX509: public QDialog, public Ui::NewX509
{
Q_OBJECT
private:
NIDlist aia_nid;
NIDlist attr_nid;
QList<nameEdit> attrEdits;
QList<nameEdit> nameEdits;
X509V3_CTX ext_ctx;
NIDlist aia_nid{};
NIDlist attr_nid{};
QList<nameEdit> attrEdits{};
QList<nameEdit> nameEdits{};
X509V3_CTX ext_ctx{};
void editV3ext(QLineEdit *le, QString types, int n);
enum pki_type pt;
enum pki_source pkiSource;
enum pki_type pt{ none };
enum pki_source pkiSource{ generated };
void templateChanged(QString templatename);
QString mandatoryDnRemain();
QStringList tabnames;
QList<pki_key*> unusedKeys, allKeys;
pki_x509 *ctx_cert;
QString v3ext_backup;
kvmodel *extDNmodel;
QStringList tabnames{};
QList<pki_key*> unusedKeys, allKeys{};
pki_x509 *ctx_cert{};
QString v3ext_backup{};
kvmodel *extDNmodel{};
extList getExtDuplicates();
void checkIcon(const QString &text, int nid, QLabel*img);
void selfComment(QString msg);
QMap<QString, QLineEdit*> templateLineEdits;
QMap<QString, QCheckBox*> templateCheckBoxes;
QMap<QString, QLineEdit*> templateLineEdits{};
QMap<QString, QCheckBox*> templateCheckBoxes{};
pki_temp *caTemplate(pki_x509 *ca) const;
void setupExplicitDN(NIDlist my_dn_nid);
QList<nameEdit> setupExplicitInputs(NIDlist nid_list,
QWidget *parent, QWidget *old, int columns);
QWidget *parent, QWidget *old, int columns);
public:
NewX509(QWidget *w = nullptr);

View File

@ -20,7 +20,7 @@ class OpenDb: public QDialog, public Ui::OpenDb
private:
static DbMap databases;
static QString lastRemote;
bool sqlite, show_connection_settings;
bool sqlite{}, show_connection_settings{};
void setupDatabaseName(const QString &db);
QString getDbType() const;
void fillDbDropDown(const QString &current);

View File

@ -41,7 +41,6 @@ Options::Options(QWidget *parent)
mbstring->setCurrentIndex(string_opts.indexOf(
QString(Settings["string_opt"])));
searchP11 = NULL;
transDnEntries->setText(transDnEntries->text()
.arg(OBJ_nid2ln(NID_commonName))
.arg(dn_translations[NID_commonName]));

View File

@ -18,8 +18,8 @@ class Options: public QDialog, public Ui::Options
{
Q_OBJECT
private:
SearchPkcs11 *searchP11;
QStringList string_opts;
SearchPkcs11 *searchP11{};
QStringList string_opts{};
QString getDnString(QListWidget *w);
void setDnString(QString dn, QListWidget *w);

View File

@ -48,7 +48,7 @@ enum open_result PwDialogUI::execute(pass_info *p, Passwd *passwd,
}
PwDialog::PwDialog(pass_info *p, bool write)
:QDialog(p->getWidget())
:QDialog(p->getWidget()), pi(p)
{
pi = p;
setupUi(this);

View File

@ -17,9 +17,9 @@ class PwDialog: public QDialog, public Ui::PwDialog
Q_OBJECT
private:
bool wrDialog;
Passwd final;
pass_info *pi;
pass_info *pi{};
Passwd final{};
bool wrDialog{};
public:
PwDialog(pass_info *p, bool write = false);

View File

@ -18,7 +18,7 @@ enum revCol { Cnumber, Cserial, Cdate, Creason, CiDate, Cmax };
class revListItem : public QTreeWidgetItem
{
public:
public:
revListItem(QTreeWidget *w) : QTreeWidgetItem(w) { };
bool operator < (const QTreeWidgetItem &other) const
{
@ -95,7 +95,8 @@ void RevocationList::setupRevocationView(QTreeWidget *certList,
certList->setSelectionMode(QAbstractItemView::ExtendedSelection);
}
RevocationList::RevocationList(QWidget *w) : QDialog(w ? w : mainwin)
RevocationList::RevocationList(QWidget *w)
: QDialog(w && w->isVisible() ? w : nullptr)
{
QPushButton *genCrl;
setupUi(this);

View File

@ -20,8 +20,8 @@ class RevocationList: public QDialog, public Ui::RevocationList
Q_OBJECT
private:
x509revList revList;
pki_x509 *issuer;
x509revList revList{};
pki_x509 *issuer{};
public:
static void setupRevocationView(QTreeWidget *certList,
const x509revList &revList, const pki_x509 *iss);

View File

@ -22,7 +22,7 @@ class TempTreeView: public XcaTreeView
bool runTempDlg(pki_temp *temp);
public:
public:
TempTreeView(QWidget *parent) : XcaTreeView(parent) { }
void fillContextMenu(QMenu *menu, QMenu *subExport,
const QModelIndex &index, QModelIndexList indexes);
@ -30,14 +30,14 @@ class TempTreeView: public XcaTreeView
bool alterTemp(pki_temp *temp);
ExportDialog *exportDialog(const QModelIndexList &index);
public slots:
public slots:
void certFromTemp();
void reqFromTemp();
void duplicateTemp();
void newItem();
void load();
signals:
signals:
void newReq(pki_temp *);
void newCert(pki_temp *);
};

View File

@ -21,7 +21,6 @@ void X509SuperTreeView::fillContextMenu(QMenu *menu, QMenu *subExport,
{
pki_x509super *x = dynamic_cast<pki_x509super*>(
db_base::fromIndex(index));
transform = NULL;
if (indexes.size() != 1 || !x)
return;

View File

@ -20,18 +20,15 @@ class X509SuperTreeView: public XcaTreeView
return dynamic_cast<db_x509super*>(basemodel);
}
protected:
QMenu *transform;
protected:
QMenu *transform{};
public:
X509SuperTreeView(QWidget *parent) : XcaTreeView(parent)
{
transform = NULL;
}
public:
X509SuperTreeView(QWidget *parent) : XcaTreeView(parent) { }
void fillContextMenu(QMenu *menu, QMenu *subExport,
const QModelIndex &index, QModelIndexList indexes);
public slots:
public slots:
void showPki(pki_base *pki);
void extractPubkey();
void toTemplate();

View File

@ -35,7 +35,7 @@ static QString defaultlang()
}
XcaApplication::XcaApplication(int &argc, char *argv[])
:QApplication(argc, argv), mainw(nullptr), qtTr(nullptr), xcaTr(nullptr)
: QApplication(argc, argv)
{
QLocale lang;

View File

@ -18,7 +18,7 @@ class QAction;
class XcaTranslator : public QTranslator
{
Q_OBJECT
public:
public:
XcaTranslator(QObject *p = NULL) : QTranslator(p) { }
bool load(const QLocale &locale, const QString &filename,
const QString &dir)
@ -32,13 +32,13 @@ class XcaApplication : public QApplication
{
Q_OBJECT
private:
MainWindow *mainw;
XcaTranslator *qtTr;
XcaTranslator *xcaTr;
private:
MainWindow *mainw{};
XcaTranslator *qtTr{};
XcaTranslator *xcaTr{};
static QList<QLocale> langAvail;
public:
public:
XcaApplication(int &argc, char *argv[]);
virtual ~XcaApplication();
void setMainwin(MainWindow *m);

View File

@ -19,7 +19,7 @@
#include "lib/database_model.h"
XcaDetail::XcaDetail(QWidget *w)
: QDialog(w && w->isVisible() ? w : nullptr), pki(nullptr)
: QDialog(w && w->isVisible() ? w : nullptr)
{
importmulti = dynamic_cast<ImportMulti *>(w);
setWindowTitle(XCA_TITLE);

View File

@ -18,9 +18,9 @@ class XcaDetail: public QDialog
Q_OBJECT
protected:
pki_base *pki;
ImportMulti *importmulti;
QPushButton *importbut;
pki_base *pki{};
ImportMulti *importmulti{};
QPushButton *importbut{};
void updateNameComment();
public:

View File

@ -15,7 +15,7 @@
class XcaDialog : public QDialog, public Ui::XcaDialog
{
QWidget *widg;
public:
public:
XcaDialog(QWidget *parent, enum pki_type type, QWidget *w,
const QString &t, const QString &desc,
const QString &help_ctx = QString());

View File

@ -18,13 +18,13 @@
class XcaProgressGui : public XcaProgress_i
{
private:
QMainWindow *mwin;
QProgressBar *bar;
private:
QMainWindow *mwin{};
QProgressBar *bar{};
public:
public:
XcaProgressGui() = delete;
XcaProgressGui(QMainWindow *m) : XcaProgress_i(), mwin(m), bar()
XcaProgressGui(QMainWindow *m) : XcaProgress_i(), mwin(m)
{
bar = new QProgressBar();
bar->setMinimum(0);

View File

@ -15,7 +15,7 @@
class XcaProxyModel: public QSortFilterProxyModel
{
Q_OBJECT
public:
public:
XcaProxyModel(QWidget *parent = 0)
:QSortFilterProxyModel(parent) { }
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;

View File

@ -31,7 +31,6 @@
XcaTreeView::XcaTreeView(QWidget *parent)
:QTreeView(parent)
{
mainwin = NULL;
setHeader(new XcaHeaderView());
setAlternatingRowColors(true);
setSelectionMode(QAbstractItemView::ExtendedSelection);
@ -45,7 +44,6 @@ XcaTreeView::XcaTreeView(QWidget *parent)
setSortingEnabled(true);
proxy->setDynamicSortFilter(true);
sortByColumn(0, Qt::AscendingOrder);
basemodel = NULL;
connect(header(), SIGNAL(sectionHandleDoubleClicked(int)),
this, SLOT(resizeColumnToContents(int)));
connect(this, SIGNAL(doubleClicked(const QModelIndex &)),
@ -409,8 +407,6 @@ void XcaTreeView::contextMenu(QContextMenuEvent *e, QMenu *parent, int col)
if (curr_hd->id > 0)
menu->addAction(tr("Details"), this,
SLOT(headerDetails()));
} else {
curr_hd = NULL;
}
menu->addSeparator();
foreach(hd, allHeaders) {

View File

@ -29,16 +29,16 @@ class XcaTreeView: public QTreeView
{
Q_OBJECT
dbheader *curr_hd;
QTimer throttle;
dbheader *curr_hd{};
QTimer throttle{};
protected:
db_base *basemodel;
QSortFilterProxyModel *proxy;
MainWindow *mainwin;
protected:
db_base *basemodel{};
QSortFilterProxyModel *proxy{};
MainWindow *mainwin{};
public:
XcaTreeView(QWidget *parent = 0);
public:
XcaTreeView(QWidget *parent = nullptr);
virtual ~XcaTreeView();
void contextMenuEvent(QContextMenuEvent *e);
void setModel(QAbstractItemModel *model);

View File

@ -28,7 +28,7 @@ class xcaWarningGui : public QObject, public xcaWarning_i
int showBox(const QString &txt, QMessageBox::Icon icn,
QMessageBox::StandardButtons b);
public:
public:
void information(const QString &msg);
void warning(const QString &msg);
void warningv3(const QString &msg, const extList &el);

View File

@ -16,7 +16,7 @@ class DoubleClickLabel : public QLabel
{
Q_OBJECT
QString clicktext;
QString clicktext{};
public:
DoubleClickLabel(QWidget *parent) : QLabel(parent) { }
void setClickText(QString s);

Some files were not shown because too many files have changed in this diff Show More