xca/lib/db_token.cpp
Christian Hohnstaedt e5783553c1 improve renaming items on the token
- use the list-edit functionality in the MultiImport dialog
   instead of an extra pop-up window
2010-05-17 06:51:32 +02:00

33 lines
680 B
C++

#include "db_token.h"
#include "exception.h"
#include "widgets/MainWindow.h"
db_token::db_token(QString db, MainWindow *mw)
:db_base(db, mw)
{
class_name = "manageTokens";
slot = 0;
}
bool db_token::setData(const QModelIndex &index, const QVariant &value, int role)
{
QString on, nn;
pki_base *item;
if (index.isValid() && role == Qt::EditRole) {
nn = value.toString();
item = static_cast<pki_base*>(index.internalPointer());
on = item->getIntName();
try {
if (item->renameOnToken(slot, nn)) {
item->setIntName(nn);
emit dataChanged(index, index);
return true;
}
} catch (errorEx &err) {
mainwin->Error(err);
}
}
return false;
}