mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
Surround multi-import and deletion by a transaction
This commit is contained in:
parent
2bf7fa6bf4
commit
6e0828bfe2
@ -152,10 +152,14 @@ void ImportMulti::on_butRemove_clicked()
|
||||
|
||||
void ImportMulti::on_butOk_clicked()
|
||||
{
|
||||
Transaction;
|
||||
if (!TransBegin())
|
||||
return;
|
||||
while (mcont->rootItem->childCount()) {
|
||||
QModelIndex idx = mcont->index(0, 0, QModelIndex());
|
||||
import(idx);
|
||||
}
|
||||
TransCommit();
|
||||
accept();
|
||||
}
|
||||
|
||||
@ -163,13 +167,16 @@ void ImportMulti::on_butImport_clicked()
|
||||
{
|
||||
QItemSelectionModel *selectionModel = listView->selectionModel();
|
||||
QModelIndexList indexes = selectionModel->selectedIndexes();
|
||||
QModelIndex index;
|
||||
|
||||
foreach(index, indexes) {
|
||||
Transaction;
|
||||
if (!TransBegin())
|
||||
return;
|
||||
foreach(QModelIndex index, indexes) {
|
||||
if (index.column() != 0)
|
||||
continue;
|
||||
import(index);
|
||||
}
|
||||
TransCommit();
|
||||
}
|
||||
|
||||
void ImportMulti::on_deleteToken_clicked()
|
||||
|
||||
@ -218,6 +218,10 @@ void XcaTreeView::deleteItems(void)
|
||||
count++;
|
||||
}
|
||||
|
||||
Transaction;
|
||||
if (!TransBegin())
|
||||
return;
|
||||
|
||||
if (count == 1)
|
||||
msg = pki->getMsg(pki_base::msg_delete).arg(pki->getIntName());
|
||||
else
|
||||
@ -230,6 +234,7 @@ void XcaTreeView::deleteItems(void)
|
||||
foreach(index, indexes) {
|
||||
basemodel->deletePKI(index);
|
||||
}
|
||||
TransCommit();
|
||||
}
|
||||
|
||||
void XcaTreeView::storeItems(void)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user