Modify removeRecursively to be able to delete a file.

Added getParentId func.
Add the datatype for newly inserted items.
Pass a double pointer instead of a pointer reference so the metadata_t can be optional.
Make sure to delete the files after deleting an entry in the backup manager.
This commit is contained in:
codestation
2014-01-28 18:05:43 -04:30
parent b7ad2b13f4
commit a021c5db8f
9 changed files with 62 additions and 54 deletions

View File

@@ -66,11 +66,8 @@ void BackupManagerForm::removeEntry(BackupItem *item)
QMutexLocker locker(&db->mutex);
metadata meta;
if(db->getObjectMetadata(item->ohfi, meta)) {
setBackupUsage(db->getObjectSize(meta.ohfiParent));
}
int parent_ohfi = db->getParentId(item->ohfi);
removeRecursively(db->getAbsolutePath(item->ohfi));
db->deleteEntry(item->ohfi);
for(int i = 0; i < ui->tableWidget->rowCount(); ++i) {
@@ -80,6 +77,10 @@ void BackupManagerForm::removeEntry(BackupItem *item)
break;
}
}
if(parent_ohfi > 0) {
setBackupUsage(db->getObjectSize(parent_ohfi));
}
}
void BackupManagerForm::setBackupUsage(quint64 size)
@@ -143,8 +144,8 @@ void BackupManagerForm::loadBackupListing(int index)
db->mutex.lock();
// get the item list
metadata_t *meta;
int row_count = db->getObjectMetadatas(ohfi, meta);
metadata_t *meta = NULL;
int row_count = db->getObjectMetadatas(ohfi, &meta);
ui->tableWidget->setRowCount(row_count);
// exit if there aren't any items