show if it is private or public key in icon

This commit is contained in:
chris 2002-07-24 13:23:57 +00:00
parent e7f8c55612
commit 1fcdca4d6f
2 changed files with 25 additions and 1 deletions

View File

@ -5,7 +5,6 @@ db_key::db_key(DbEnv *dbe, string DBfile, QListView *l)
:db_base(dbe, DBfile, "keydb")
{
listView = l;
icon = loadImg("key.png");
loadContainer();
updateView();
}
@ -15,6 +14,30 @@ pki_base *db_key::newPKI(){
}
bool db_key::updateView()
{
listView->clear();
QPixmap *pm[2];
pm[0] = loadImg("key.png");
pm[1] = loadImg("halfkey.png");
pki_key *pki;
QListViewItem *current;
cerr <<"myupdate keys"<<endl;
if ( container.isEmpty() ) return false;
QListIterator<pki_base> it(container);
for ( ; it.current(); ++it ) {
pki = (pki_key *)it.current();
// create the listview item
current = new QListViewItem(listView, pki->getDescription().c_str());
CERR<< "Adding as parent: "<<pki->getDescription().c_str()<<endl;
int pixnum = 0;
if (pki->isPubKey()) pixnum += 1;
current->setPixmap(0, *pm[pixnum]);
}
return true;
}
QStringList db_key::getPrivateDesc()
{
pki_key *pki;

View File

@ -12,6 +12,7 @@ class db_key: public db_base
db_key(DbEnv *dbe, string DBfile, QListView *l);
pki_base *newPKI();
QStringList getPrivateDesc();
bool updateView();
};
#endif