mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
Fix deprecation warnings
The proposed "addAction()" with the KeySequence as 2nd argument is only available soince Qt6.3 and not compatible with QT5 Change the call in a compatible way and set the shortcut afterwards.
This commit is contained in:
parent
fa0d67b26c
commit
7206024d6a
@ -492,7 +492,7 @@ void *d2i_bytearray(void *(*d2i)(void *, unsigned char **, long),
|
||||
unsigned char *p, *p1;
|
||||
void *ret;
|
||||
p = p1 = (unsigned char *)ba.constData();
|
||||
ret = d2i(NULL, &p1, ba.count());
|
||||
ret = d2i(NULL, &p1, ba.size());
|
||||
ba = ba.mid(p1-p);
|
||||
openssl_error();
|
||||
return ret;
|
||||
|
||||
@ -349,7 +349,7 @@ EVP_PKEY *pki_evp::load_ssh_ed25519_privatekey(const QByteArray &ba,
|
||||
pub = ssh_key_next_chunk(&content);
|
||||
ssh_key_check_chunk(&pub, "ssh-ed25519");
|
||||
pub = ssh_key_next_chunk(&pub);
|
||||
if (pub.count() != ED25519_KEYLEN)
|
||||
if (pub.size() != ED25519_KEYLEN)
|
||||
return NULL;
|
||||
|
||||
// Followed by the private key
|
||||
@ -364,7 +364,7 @@ EVP_PKEY *pki_evp::load_ssh_ed25519_privatekey(const QByteArray &ba,
|
||||
return NULL;
|
||||
priv = ssh_key_next_chunk(&priv);
|
||||
// The private key is concatenated by the public key in one chunk
|
||||
if (priv.count() != 2 * ED25519_KEYLEN)
|
||||
if (priv.size() != 2 * ED25519_KEYLEN)
|
||||
return NULL;
|
||||
// The last ED25519_KEYLEN bytes must match the public key
|
||||
if (pub != priv.mid(ED25519_KEYLEN))
|
||||
@ -487,8 +487,8 @@ EVP_PKEY *pki_evp::decryptKey() const
|
||||
}
|
||||
}
|
||||
QByteArray myencKey = getEncKey();
|
||||
qDebug() << "myencKey.count()"<<myencKey.count();
|
||||
if (myencKey.count() == 0)
|
||||
qDebug() << "myencKey.size()"<<myencKey.size();
|
||||
if (myencKey.size() == 0)
|
||||
return NULL;
|
||||
EVP_PKEY *priv = NULL;
|
||||
X509_SIG *p8 = d2i_PKCS8_bio(BioByteArray(myencKey).ro(), NULL);
|
||||
@ -635,7 +635,7 @@ QByteArray pki_evp::getEncKey() const
|
||||
QSqlError e;
|
||||
QByteArray ba;
|
||||
|
||||
if (encKey.count() > 0 || !sqlItemId.isValid())
|
||||
if (encKey.size() > 0 || !sqlItemId.isValid())
|
||||
return encKey;
|
||||
|
||||
SQL_PREPARE(q, "SELECT private FROM private_keys WHERE item=?");
|
||||
|
||||
@ -73,7 +73,7 @@ void pki_key::d2i_old(QByteArray &ba, int type)
|
||||
{
|
||||
const unsigned char *p, *p1;
|
||||
p = p1 = (const unsigned char *)ba.constData();
|
||||
EVP_PKEY *k = d2i_PublicKey(type, NULL, &p1, ba.count());
|
||||
EVP_PKEY *k = d2i_PublicKey(type, NULL, &p1, ba.size());
|
||||
|
||||
pki_openssl_error();
|
||||
|
||||
@ -661,7 +661,7 @@ EVP_PKEY *pki_key::load_ssh2_key(const QByteArray &b)
|
||||
ssh_key_check_chunk(&ba, "ssh-ed25519");
|
||||
QByteArray pub = ssh_key_next_chunk(&ba);
|
||||
pk = EVP_PKEY_new_raw_public_key(EVP_PKEY_ED25519, NULL,
|
||||
(const unsigned char *)pub.constData(), pub.count());
|
||||
(const unsigned char *)pub.constData(), pub.size());
|
||||
pki_openssl_error();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -27,7 +27,7 @@ namespace db {
|
||||
uint32_t intFromData(QByteArray &ba)
|
||||
{
|
||||
uint32_t ret;
|
||||
if ((unsigned)(ba.count()) < sizeof(uint32_t)) {
|
||||
if ((unsigned)(ba.size()) < sizeof(uint32_t)) {
|
||||
throw errorEx(QObject::tr("Out of data"));
|
||||
}
|
||||
memcpy(&ret, ba.constData(), sizeof(uint32_t));
|
||||
@ -37,7 +37,7 @@ namespace db {
|
||||
bool boolFromData(QByteArray &ba)
|
||||
{
|
||||
unsigned char c;
|
||||
if (ba.count() < 1)
|
||||
if (ba.size() < 1)
|
||||
throw errorEx(QObject::tr("Out of data"));
|
||||
|
||||
c = ba.constData()[0];
|
||||
@ -307,7 +307,7 @@ static QString old_eKeyUse2QString(int old)
|
||||
{
|
||||
QStringList sl;
|
||||
|
||||
for (int i = 0; i < extkeyuse_nid.count(); i++) {
|
||||
for (int i = 0; i < extkeyuse_nid.size(); i++) {
|
||||
if (old & (1<<i)) {
|
||||
sl << OBJ_nid2sn(extkeyuse_nid[i]);
|
||||
}
|
||||
@ -363,8 +363,8 @@ void pki_temp::old_fromData(const unsigned char *p, int size, int version)
|
||||
settings["noWellDefinedExpDate"] =
|
||||
QString::number(db::boolFromData(ba));
|
||||
|
||||
if (ba.count() > 0) {
|
||||
my_error(tr("Wrong Size %1").arg(ba.count()));
|
||||
if (ba.size() > 0) {
|
||||
my_error(tr("Wrong Size %1").arg(ba.size()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -418,7 +418,7 @@ QByteArray pki_temp::toExportData() const
|
||||
{
|
||||
QByteArray data, header;
|
||||
data = toData();
|
||||
header = db::intToData(data.count());
|
||||
header = db::intToData(data.size());
|
||||
header += db::intToData(TMPL_VERSION);
|
||||
header += data;
|
||||
return header;
|
||||
|
||||
@ -98,20 +98,24 @@ void MainWindow::init_menu()
|
||||
languageMenu->addAction(a);
|
||||
}
|
||||
file = menuBar()->addMenu(tr("&File"));
|
||||
file->addAction(tr("New DataBase"), this, SLOT(new_database()),
|
||||
QKeySequence::New)
|
||||
->setEnabled(OpenDb::hasSqLite());
|
||||
file->addAction(tr("Open DataBase"), this, SLOT(load_database()),
|
||||
QKeySequence::Open)
|
||||
->setEnabled(OpenDb::hasSqLite());
|
||||
|
||||
a = file->addAction(tr("New DataBase"), this, SLOT(new_database()));
|
||||
a->setShortcut(QKeySequence::New);
|
||||
a->setEnabled(OpenDb::hasSqLite());
|
||||
|
||||
a = file->addAction(tr("Open DataBase"), this, SLOT(load_database()));
|
||||
a->setShortcut(QKeySequence::Open);
|
||||
a->setEnabled(OpenDb::hasSqLite());
|
||||
|
||||
file->addAction(tr("Open Remote DataBase"),
|
||||
this, SLOT(openRemoteSqlDB()))
|
||||
->setEnabled(OpenDb::hasRemoteDrivers());
|
||||
this, SLOT(openRemoteSqlDB()))->
|
||||
setEnabled(OpenDb::hasRemoteDrivers());
|
||||
file->addMenu(historyMenu);
|
||||
file->addAction(tr("Set as default DataBase"), this,
|
||||
SLOT(default_database()));
|
||||
acList += file->addAction(tr("Close DataBase"), this,
|
||||
SLOT(close_database()), QKeySequence::Close);
|
||||
a = file->addAction(tr("Close DataBase"), this, SLOT(close_database()));
|
||||
a->setShortcut(QKeySequence::Close);
|
||||
acList += a;
|
||||
|
||||
a = new QAction(tr("Options"), this);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(setOptions()));
|
||||
@ -137,8 +141,8 @@ void MainWindow::init_menu()
|
||||
import->addAction(tr("Template"), tempView, SLOT(load()) );
|
||||
import->addAction(tr("Revocation list"), crlView, SLOT(load()));
|
||||
import->addAction(tr("PEM file"), this, SLOT(loadPem()) );
|
||||
import->addAction(tr("Paste PEM file"), this, SLOT(pastePem()),
|
||||
QKeySequence::Paste);
|
||||
import->addAction(tr("Paste PEM file"), this, SLOT(pastePem()))->
|
||||
setShortcut(QKeySequence::Paste);
|
||||
|
||||
token = menuBar()->addMenu(tr("Token"));
|
||||
token->addAction(tr("&Manage Security token"), this,
|
||||
@ -170,8 +174,8 @@ void MainWindow::init_menu()
|
||||
extra->addAction(tr("OID Resolver"), resolver, SLOT(show()));
|
||||
|
||||
help = menuBar()->addMenu(tr("&Help") );
|
||||
help->addAction(tr("Content"), helpdlg, SLOT(content()),
|
||||
QKeySequence::HelpContents);
|
||||
help->addAction(tr("Content"), helpdlg, SLOT(content()))->
|
||||
setShortcut(QKeySequence::HelpContents);
|
||||
a = new QAction(tr("About"), this);
|
||||
connect(a, SIGNAL(triggered()), this, SLOT(about()));
|
||||
a->setMenuRole(QAction::AboutRole);
|
||||
|
||||
@ -498,21 +498,21 @@ void XcaTreeView::showContextMenu(QContextMenuEvent *e,
|
||||
index = idx.isValid() ? idx : currentIndex();
|
||||
menu->addAction(tr("New"), this, SLOT(newItem()));
|
||||
menu->addAction(tr("Import"), this, SLOT(load()));
|
||||
menu->addAction(tr("Paste PEM data"), mainwin, SLOT(pastePem()),
|
||||
QKeySequence::Paste);
|
||||
menu->addAction(tr("Paste PEM data"), mainwin, SLOT(pastePem()))->
|
||||
setShortcut(QKeySequence::Paste);
|
||||
|
||||
if (indexes.size() == 1) {
|
||||
menu->addAction(tr("Rename"), this, SLOT(editIdx()));
|
||||
menu->addAction(tr("Properties"), this, SLOT(editComment()));
|
||||
}
|
||||
if (indexes.size() > 0) {
|
||||
menu->addAction(tr("Delete"), this, SLOT(deleteItems()),
|
||||
QKeySequence::Delete);
|
||||
menu->addAction(tr("Delete"), this, SLOT(deleteItems()))->
|
||||
setShortcut(QKeySequence::Delete);
|
||||
subExport = menu->addMenu(tr("Export"));
|
||||
subExport->addAction(tr("Clipboard"), this,
|
||||
SLOT(pem2clipboard()), QKeySequence::Copy);
|
||||
subExport->addAction(tr("File"), this, SLOT(exportItems()),
|
||||
QKeySequence::Save);
|
||||
SLOT(pem2clipboard()))->setShortcut(QKeySequence::Copy);
|
||||
subExport->addAction(tr("File"), this, SLOT(exportItems()))->
|
||||
setShortcut(QKeySequence::Save);
|
||||
}
|
||||
|
||||
fillContextMenu(menu, subExport, index, indexes);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user