Process correctly the return value of the confirm dialog.

Update the backup usage label after deleting an entry.
Update the parent metadata size after deleting a node.
This commit is contained in:
codestation
2013-08-29 12:28:40 -04:30
parent b34b2f63f4
commit e44c3bca28
5 changed files with 17 additions and 9 deletions

View File

@@ -61,12 +61,7 @@ void BackupManagerForm::removeEntry(BackupItem *item)
msgBox.setMessageText(tr("Are you sure to remove the backup of the following entry?"), item->title);
msgBox.setMessagePixmap(*item->getIconPixmap(), item->getIconWidth());
switch(msgBox.exec()) {
case QDialogButtonBox::Ok:
break;
case QDialogButtonBox::Cancel:
return;
default:
if(msgBox.exec() == 0) {
return;
}
@@ -78,6 +73,15 @@ void BackupManagerForm::removeEntry(BackupItem *item)
db->remove(obj);
}
ui->tableWidget->removeRow(item->row);
obj = db->ohfiToObject(obj->metadata.ohfiParent);
if(obj) {
setBackupUsage(obj->metadata.size);
}
}
void BackupManagerForm::setBackupUsage(quint64 size)
{
ui->usageLabel->setText(tr("Backup disk usage: %1").arg(readable_size(size, true)));
}
void BackupManagerForm::loadBackupListing(int index)
@@ -138,7 +142,7 @@ void BackupManagerForm::loadBackupListing(int index)
horiz_header->setResizeMode(QHeaderView::Stretch);
CMAObject *obj = db->ohfiToObject(ohfi);
ui->usageLabel->setText(tr("Backup disk usage: %1").arg(readable_size(obj->metadata.size, true)));
setBackupUsage(obj->metadata.size);
QList<BackupItem *> item_list;