pki_base* db_key::insert(pki_base *item) { pki_key *lkey = (pki_key *)item; pki_key *oldkey; oldkey = (pki_key *)getByReference(lkey); if (oldkey != NULL) { if ((oldkey->isPrivKey() && lkey->isPrivKey()) || lkey->isPubKey()){ QMessageBox::information(mainwin, XCA_TITLE, tr("The key is already in the database as:\n'%1'\nand is not going to be imported").arg(oldkey->getIntName())); delete(lkey); return NULL; } else { QMessageBox::information(mainwin, XCA_TITLE, tr("The database already contains the public part of the imported key as\n'%1\nand will be completed by the new, private part of the key").arg(oldkey->getIntName())); lkey->setIntName(oldkey->getIntName()); currentIdx = index(oldkey->row(), 0, QModelIndex()); deletePKI(); currentIdx = QModelIndex(); } } insertPKI(lkey); return lkey; }
pki_base *db_x509req::insert(pki_base *item) { pki_x509req *oldreq, *req; req = (pki_x509req *)item; oldreq = (pki_x509req *)getByReference(req); if (oldreq) { XCA_INFO(tr("The certificate signing request already exists in the database as\n'%1'\nand thus was not stored").arg(oldreq->getIntName())); delete(req); return NULL; } insertPKI(req); return req; }