dbhub: When deleting last local database of a user, remove user too

When deleting the last local database of a user in the Local files view,
remove the now empty user directory too.

See issue #2349.
This commit is contained in:
Martin Kleusberg
2020-08-12 13:55:11 +02:00
parent 8db6e16f3d
commit 70eb15a8e2
+9
View File
@@ -178,5 +178,14 @@ bool RemoteLocalFilesModel::removeRows(int row, int count, const QModelIndex& pa
}
endRemoveRows();
// If parent node is empty, remove that one too. Make sure to not remove the root node
if(parent.isValid() && !index(0, 0, parent).isValid())
{
beginRemoveRows(parent.parent(), 0, 0);
auto item = static_cast<QTreeWidgetItem*>(parent.internalPointer());
item->parent()->removeChild(item);
endRemoveRows();
}
return true;
}