signals and slots introduced to db

certs and requests do notice fading and arising keys
This commit is contained in:
chris 2002-07-25 09:43:57 +00:00
parent 8da3c1a033
commit 37a58ab9c8
10 changed files with 63 additions and 5 deletions

View File

@ -7,12 +7,13 @@ TARGET=xca-$(VERSION)
GCC=@CXX@
CPPFLAGS=@CPPFLAGS@ -Wall -g
MOC=@MOC@
##############################################
PKIOBJS=pki_base.o pki_key.o pki_x509req.o pki_x509.o pki_pkcs12.o
DBOBJS=db_base.o db_key.o db_x509req.o db_x509.o
DBOBJS=db_base.o db_key.o db_x509req.o db_x509.o db_key_MOC.o db_x509req_MOC.o db_x509_MOC.o
all: libpki.a libxcadb.a
@ -23,6 +24,9 @@ libpki.a: $(PKIOBJS)
libxcadb.a: $(DBOBJS)
ar rcs libxcadb.a $(DBOBJS)
%_MOC.cpp: %.h
$(MOC) $< -o $@
%.o: %.cpp %.h
$(GCC) $(CPPFLAGS) -c $(INC) -DVER=\"$(VERSION)\" -DPREFIX=\"@prefix@/share/xca\" $<

View File

@ -290,4 +290,3 @@ QPixmap *db_base::loadImg(const char *name )
return new QPixmap(path + name);
}

View File

@ -15,7 +15,7 @@
#define DB_BASE_H
class db_base
class db_base: public QObject
{
protected:
@ -28,7 +28,7 @@ class db_base
db_base(DbEnv *dbe, string DBfile, string db);
virtual ~db_base();
virtual pki_base *newPKI(){
cerr<<"VIRTUAL CALLED: newPKI\n"; return NULL;}
CERR<<"VIRTUAL CALLED: newPKI\n"; return NULL;}
virtual bool updateView();
bool insertPKI(pki_base *pki);
bool deletePKI(pki_base *pki);
@ -37,6 +37,9 @@ class db_base
pki_base *getSelectedPKI();
pki_base *findPKI(pki_base *refpki);
virtual void loadContainer();
/* preprocess should be implemented once to speed up updateView()
* i.e search for signers and keys */
virtual void preprocess() {return;}
virtual void remFromCont(pki_base *pki);
Dbc *getCursor();
bool freeCursor(Dbc *cursor);

View File

@ -50,3 +50,15 @@ QStringList db_key::getPrivateDesc()
return x;
}
void db_key::remFromCont(pki_base *pki)
{
container.remove(pki);
emit delKey((pki_key *)pki);
}
bool db_key::insertPKI(pki_base *pki)
{
db_base::insertPKI(pki);
emit newKey((pki_key *)pki);
return true;
}

View File

@ -8,11 +8,17 @@
class db_key: public db_base
{
Q_OBJECT
public:
db_key(DbEnv *dbe, string DBfile, QListView *l);
pki_base *newPKI();
QStringList getPrivateDesc();
bool updateView();
bool insertPKI(pki_base *pki);
void remFromCont(pki_base *pki);
signals:
void delKey(pki_key *delkey);
void newKey(pki_key *newkey);
};
#endif

View File

@ -8,6 +8,8 @@ db_x509::db_x509(DbEnv *dbe, string DBfile, QListView *l, db_key *keyl)
listView = l;
loadContainer();
updateView();
connect(keyl, SIGNAL(delKey(pki_key *)), this, SLOT(delKey(pki_key *)));
connect(keyl, SIGNAL(newKey(pki_key *)), this, SLOT(newKey(pki_key *)));
}
pki_base *db_x509::newPKI(){
@ -122,4 +124,14 @@ pki_key *db_x509::findKey(pki_x509* cert)
return key;
}
void db_x509::delKey(pki_key *delkey)
{
updateView();
}
void db_x509::newKey(pki_key *newkey)
{
updateView();
}

View File

@ -9,6 +9,7 @@
class db_x509: public db_base
{
Q_OBJECT
protected:
db_key *keylist;
public:
@ -19,6 +20,9 @@ class db_x509: public db_base
void remFromCont(pki_base *pki);
QStringList getPrivateDesc();
pki_key * findKey(pki_x509 *cert);
public slots:
void delKey(pki_key *delkey);
void newKey(pki_key *newKey);
};
#endif

View File

@ -8,6 +8,8 @@ db_x509req::db_x509req(DbEnv *dbe, string DBfile, QListView *l, db_key *keyl)
keylist = keyl;
loadContainer();
updateView();
connect(keyl, SIGNAL(delKey(pki_key *)), this, SLOT(delKey(pki_key *)));
connect(keyl, SIGNAL(newKey(pki_key *)), this, SLOT(newKey(pki_key *)));
}
pki_base *db_x509req::newPKI(){
@ -47,3 +49,16 @@ bool db_x509req::updateView()
}
return true;
}
void db_x509req::delKey(pki_key *delkey)
{
updateView();
}
void db_x509req::newKey(pki_key *newkey)
{
updateView();
}

View File

@ -8,6 +8,7 @@
class db_x509req: public db_base
{
Q_OBJECT
protected:
db_key *keylist;
public:
@ -15,6 +16,9 @@ class db_x509req: public db_base
pki_base *newPKI();
QStringList getDesc();
bool updateView();
public slots:
void delKey(pki_key *delkey);
void newKey(pki_key *newKey);
};
#endif

View File

@ -237,7 +237,6 @@ string pki_x509::fingerprint(EVP_MD *digest)
return fp;
}
int pki_x509::checkDate()
{
time_t tnow = time(NULL);