xca/lib/pki_temp.h
Christian Hohnstaedt c6304a073d
Some checks are pending
CMake / build (build/xca-*-Linux.tar.gz, Unix Makefiles, linux, /usr, ubuntu, 5.15.2, ubuntu-latest) (push) Waiting to run
CMake / build (build/xca-*-Linux.tar.gz, Unix Makefiles, linux, /usr, ubuntu, 6.6.2, ubuntu-latest) (push) Waiting to run
CMake / build (build/xca-*.dmg, Unix Makefiles, mac, /opt/homebrew/opt/openssl, macos, 6.6.2, macos-latest) (push) Waiting to run
CMake / build (build/xca-*.msi build/xca-portable-*.zip , MinGW Makefiles, windows, D:\msys2\msys64\mingw64, windows, 5.15.2, windows-2019, win64_mingw81) (push) Waiting to run
Close #296: Proper plurals
Use the provided plural mechanisms of QT.
The "PO" translation also works smoothly and
the translation mechanisms between .po <-> .qt
was tested successfully.

The new english translation file translates
the single phrase:
 "Delete the %n revocation list(s): '%1'?"
into
 "Delete the revocation list: '%1'?" for one item
and
 "Delete the %n revocation lists: '%1'?" otherwise
2024-09-14 10:22:45 +02:00

100 lines
2.4 KiB
C++

/* vi: set sw=4 ts=4:
*
* Copyright (C) 2001 - 2020 Christian Hohnstaedt.
*
* All rights reserved.
*/
#ifndef __PKI_TEMP_H
#define __PKI_TEMP_H
#include "pki_base.h"
#include "x509name.h"
#include "asn1time.h"
#include "pki_x509super.h"
#define D5 "-----"
#define PEM_STRING_XCA_TEMPLATE "XCA TEMPLATE"
#define TMPL_VERSION 10
#define CHECK_TMPL_KEY if (!tmpl_keys.contains(key)) { qFatal("Unknown template key: %s(%s)", __func__, CCHAR(key)); }
#define VIEW_temp_version 6
#define VIEW_temp_template 7
class pki_temp: public pki_x509name
{
Q_OBJECT
protected:
static const QList<QString> tmpl_keys;
int dataSize();
void try_fload(XFile &file);
bool pre_defined{ false };
x509name xname{};
QMap<QString, QString> settings{};
QString adv_ext{};
void fromExtList(extList *el, int nid, const char *item);
public:
pki_temp(const pki_temp *pk);
pki_temp(const QString &d = QString());
~pki_temp();
QString getSetting(const QString &key)
{
CHECK_TMPL_KEY
return settings[key];
}
int getSettingInt(const QString &key)
{
CHECK_TMPL_KEY
return settings[key].toInt();
}
void setSetting(const QString &key, const QString &value)
{
CHECK_TMPL_KEY
settings[key] = value;
}
void setSetting(const QString &key, int value)
{
CHECK_TMPL_KEY
settings[key] = QString::number(value);
}
void fload(const QString &fname);
void writeDefault(const QString &dirname) const ;
void fromData(const unsigned char *p, int size, int version);
void old_fromData(const unsigned char *p, int size, int version);
void fromData(QByteArray &ba, int version);
void setAsPreDefined()
{
pre_defined = true;
}
QString comboText() const;
QByteArray toData(bool for_export = false) const;
QString toB64Data()
{
return QString::fromLatin1(toData().toBase64());
}
bool compare(const pki_base *ref) const;
void writeTemp(XFile &file) const;
QVariant getIcon(const dbheader *hd) const;
QString getMsg(msg_type msg, int n = 1) const;
x509name getSubject() const;
void setSubject(x509name n)
{
xname = n;
}
bool pem(BioByteArray &);
QByteArray toExportData() const;
void fromPEM_BIO(BIO *, const QString &);
void fromExportData(QByteArray data);
extList fromCert(pki_x509super *cert_or_req);
QSqlError insertSqlData();
QSqlError deleteSqlData();
void restoreSql(const QSqlRecord &rec);
void autoIntName(const QString &file);
};
Q_DECLARE_METATYPE(pki_temp *);
#endif